2019-07-17 14:30:55 +00:00
|
|
|
package actors
|
|
|
|
|
|
|
|
import (
|
2019-07-22 16:08:54 +00:00
|
|
|
"github.com/filecoin-project/go-lotus/chain/actors/aerrors"
|
2019-07-17 14:30:55 +00:00
|
|
|
cbor "github.com/ipfs/go-ipld-cbor"
|
|
|
|
)
|
|
|
|
|
2019-07-17 16:00:59 +00:00
|
|
|
var (
|
|
|
|
EmptyStructCBOR = []byte{0xa0}
|
|
|
|
)
|
|
|
|
|
2019-07-22 16:08:54 +00:00
|
|
|
func SerializeParams(i interface{}) ([]byte, aerrors.ActorError) {
|
|
|
|
dump, err := cbor.DumpObject(i)
|
|
|
|
if err != nil {
|
2019-08-07 06:35:57 +00:00
|
|
|
// TODO: shouldnt this be a fatal error?
|
2019-07-22 16:08:54 +00:00
|
|
|
return nil, aerrors.Absorb(err, 1, "failed to encode parameter")
|
|
|
|
}
|
|
|
|
return dump, nil
|
2019-07-17 14:30:55 +00:00
|
|
|
}
|