170 lines
3.3 KiB
Go
170 lines
3.3 KiB
Go
|
// Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
|
||
|
|
||
|
package vm
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"math"
|
||
|
"sort"
|
||
|
|
||
|
types "github.com/filecoin-project/lotus/chain/types"
|
||
|
cid "github.com/ipfs/go-cid"
|
||
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||
|
xerrors "golang.org/x/xerrors"
|
||
|
)
|
||
|
|
||
|
var _ = xerrors.Errorf
|
||
|
var _ = cid.Undef
|
||
|
var _ = math.E
|
||
|
var _ = sort.Sort
|
||
|
|
||
|
var lengthBufFvmExecutionTrace = []byte{132}
|
||
|
|
||
|
func (t *FvmExecutionTrace) MarshalCBOR(w io.Writer) error {
|
||
|
if t == nil {
|
||
|
_, err := w.Write(cbg.CborNull)
|
||
|
return err
|
||
|
}
|
||
|
if _, err := w.Write(lengthBufFvmExecutionTrace); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
scratch := make([]byte, 9)
|
||
|
|
||
|
// t.Msg (types.Message) (struct)
|
||
|
if err := t.Msg.MarshalCBOR(w); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
// t.MsgRct (types.MessageReceipt) (struct)
|
||
|
if err := t.MsgRct.MarshalCBOR(w); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
// t.Error (string) (string)
|
||
|
if len(t.Error) > cbg.MaxLength {
|
||
|
return xerrors.Errorf("Value in field t.Error was too long")
|
||
|
}
|
||
|
|
||
|
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len(t.Error))); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if _, err := io.WriteString(w, string(t.Error)); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
// t.Subcalls ([]vm.FvmExecutionTrace) (slice)
|
||
|
if len(t.Subcalls) > cbg.MaxLength {
|
||
|
return xerrors.Errorf("Slice value in field t.Subcalls was too long")
|
||
|
}
|
||
|
|
||
|
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.Subcalls))); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
for _, v := range t.Subcalls {
|
||
|
if err := v.MarshalCBOR(w); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (t *FvmExecutionTrace) UnmarshalCBOR(r io.Reader) error {
|
||
|
*t = FvmExecutionTrace{}
|
||
|
|
||
|
br := cbg.GetPeeker(r)
|
||
|
scratch := make([]byte, 8)
|
||
|
|
||
|
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if maj != cbg.MajArray {
|
||
|
return fmt.Errorf("cbor input should be of type array")
|
||
|
}
|
||
|
|
||
|
if extra != 4 {
|
||
|
return fmt.Errorf("cbor input had wrong number of fields")
|
||
|
}
|
||
|
|
||
|
// t.Msg (types.Message) (struct)
|
||
|
|
||
|
{
|
||
|
|
||
|
b, err := br.ReadByte()
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if b != cbg.CborNull[0] {
|
||
|
if err := br.UnreadByte(); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
t.Msg = new(types.Message)
|
||
|
if err := t.Msg.UnmarshalCBOR(br); err != nil {
|
||
|
return xerrors.Errorf("unmarshaling t.Msg pointer: %w", err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
// t.MsgRct (types.MessageReceipt) (struct)
|
||
|
|
||
|
{
|
||
|
|
||
|
b, err := br.ReadByte()
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if b != cbg.CborNull[0] {
|
||
|
if err := br.UnreadByte(); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
t.MsgRct = new(types.MessageReceipt)
|
||
|
if err := t.MsgRct.UnmarshalCBOR(br); err != nil {
|
||
|
return xerrors.Errorf("unmarshaling t.MsgRct pointer: %w", err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
// t.Error (string) (string)
|
||
|
|
||
|
{
|
||
|
sval, err := cbg.ReadStringBuf(br, scratch)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
t.Error = string(sval)
|
||
|
}
|
||
|
// t.Subcalls ([]vm.FvmExecutionTrace) (slice)
|
||
|
|
||
|
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
if extra > cbg.MaxLength {
|
||
|
return fmt.Errorf("t.Subcalls: array too large (%d)", extra)
|
||
|
}
|
||
|
|
||
|
if maj != cbg.MajArray {
|
||
|
return fmt.Errorf("expected cbor array")
|
||
|
}
|
||
|
|
||
|
if extra > 0 {
|
||
|
t.Subcalls = make([]FvmExecutionTrace, extra)
|
||
|
}
|
||
|
|
||
|
for i := 0; i < int(extra); i++ {
|
||
|
|
||
|
var v FvmExecutionTrace
|
||
|
if err := v.UnmarshalCBOR(br); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
t.Subcalls[i] = v
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|