From 2a426c9d05a3d623c57652ab92847da19932c07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 28 Aug 2023 17:29:01 +0200 Subject: [PATCH 01/52] wip nv12 direct data onboarding types --- builtin/v12/gen/gen.go | 9 + builtin/v12/miner/cbor_gen.go | 1083 ++++++++++++++++++++++++++++++ builtin/v12/miner/miner_types.go | 59 ++ 3 files changed, 1151 insertions(+) diff --git a/builtin/v12/gen/gen.go b/builtin/v12/gen/gen.go index aa1d17ee..48013878 100644 --- a/builtin/v12/gen/gen.go +++ b/builtin/v12/gen/gen.go @@ -195,6 +195,15 @@ func main() { miner.GetOwnerReturn{}, miner.GetPeerIDReturn{}, miner.GetMultiAddrsReturn{}, + miner.ProveCommitSectors2Params{}, + miner.SectorActivationManifest{}, + miner.PieceActivationManifest{}, + miner.VerifiedAllocationKey{}, + miner.DataActivationNotification{}, + miner.ProveCommit2Return{}, + miner.SectorActivationReturn{}, + miner.PieceActivationReturn{}, + miner.DataActivationNotificationReturn{}, // other types miner.FaultDeclaration{}, miner.RecoveryDeclaration{}, diff --git a/builtin/v12/miner/cbor_gen.go b/builtin/v12/miner/cbor_gen.go index d0122748..03800a33 100644 --- a/builtin/v12/miner/cbor_gen.go +++ b/builtin/v12/miner/cbor_gen.go @@ -11,6 +11,7 @@ import ( address "github.com/filecoin-project/go-address" abi "github.com/filecoin-project/go-state-types/abi" verifreg "github.com/filecoin-project/go-state-types/builtin/v12/verifreg" + exitcode "github.com/filecoin-project/go-state-types/exitcode" proof "github.com/filecoin-project/go-state-types/proof" cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" @@ -6181,6 +6182,1088 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return nil } +var lengthBufProveCommitSectors2Params = []byte{133} + +func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveCommitSectors2Params); err != nil { + return err + } + + // t.SectorActivations ([]miner.SectorActivationManifest) (slice) + if len(t.SectorActivations) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorActivations was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorActivations))); err != nil { + return err + } + for _, v := range t.SectorActivations { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + + // t.SectorProofs ([][]uint8) (slice) + if len(t.SectorProofs) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorProofs was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorProofs))); err != nil { + return err + } + for _, v := range t.SectorProofs { + if len(v) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(v))); err != nil { + return err + } + + if _, err := cw.Write(v[:]); err != nil { + return err + } + } + + // t.AggregateProof ([]uint8) (slice) + if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.AggregateProof was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.AggregateProof))); err != nil { + return err + } + + if _, err := cw.Write(t.AggregateProof[:]); err != nil { + return err + } + + // t.RequireActivationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireActivationSuccess); err != nil { + return err + } + + // t.RequireNotificationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireNotificationSuccess); err != nil { + return err + } + return nil +} + +func (t *ProveCommitSectors2Params) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommitSectors2Params{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 5 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SectorActivations ([]miner.SectorActivationManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorActivations: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorActivations = make([]SectorActivationManifest, extra) + } + + for i := 0; i < int(extra); i++ { + + var v SectorActivationManifest + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.SectorActivations[i] = v + } + + // t.SectorProofs ([][]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorProofs = make([][]uint8, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.SectorProofs[i] = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { + return err + } + } + } + + // t.AggregateProof ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.AggregateProof = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + return err + } + // t.RequireActivationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireActivationSuccess = false + case 21: + t.RequireActivationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.RequireNotificationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireNotificationSuccess = false + case 21: + t.RequireNotificationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + return nil +} + +var lengthBufSectorActivationManifest = []byte{130} + +func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorActivationManifest); err != nil { + return err + } + + // t.SectorNumber (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { + return err + } + + // t.Pieces ([]miner.PieceActivationManifest) (slice) + if len(t.Pieces) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Pieces was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { + return err + } + for _, v := range t.Pieces { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorActivationManifest{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SectorNumber (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.SectorNumber = abi.SectorNumber(extra) + + } + // t.Pieces ([]miner.PieceActivationManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Pieces: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Pieces = make([]PieceActivationManifest, extra) + } + + for i := 0; i < int(extra); i++ { + + var v PieceActivationManifest + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.Pieces[i] = v + } + + return nil +} + +var lengthBufPieceActivationManifest = []byte{132} + +func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceActivationManifest); err != nil { + return err + } + + // t.CID (cid.Cid) (struct) + + if err := cbg.WriteCid(cw, t.CID); err != nil { + return xerrors.Errorf("failed to write cid field t.CID: %w", err) + } + + // t.Size (abi.PaddedPieceSize) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { + return err + } + + // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) + if err := t.VerifiedAllocationKey.MarshalCBOR(cw); err != nil { + return err + } + + // t.Notify ([]miner.DataActivationNotification) (slice) + if len(t.Notify) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Notify was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notify))); err != nil { + return err + } + for _, v := range t.Notify { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *PieceActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceActivationManifest{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + 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.CID (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.CID: %w", err) + } + + t.CID = c + + } + // t.Size (abi.PaddedPieceSize) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Size = abi.PaddedPieceSize(extra) + + } + // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.VerifiedAllocationKey = new(VerifiedAllocationKey) + if err := t.VerifiedAllocationKey.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.VerifiedAllocationKey pointer: %w", err) + } + } + + } + // t.Notify ([]miner.DataActivationNotification) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Notify: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Notify = make([]DataActivationNotification, extra) + } + + for i := 0; i < int(extra); i++ { + + var v DataActivationNotification + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.Notify[i] = v + } + + return nil +} + +var lengthBufVerifiedAllocationKey = []byte{130} + +func (t *VerifiedAllocationKey) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufVerifiedAllocationKey); err != nil { + return err + } + + // t.Client (abi.ActorID) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Client)); err != nil { + return err + } + + // t.ID (verifreg.AllocationId) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ID)); err != nil { + return err + } + + return nil +} + +func (t *VerifiedAllocationKey) UnmarshalCBOR(r io.Reader) (err error) { + *t = VerifiedAllocationKey{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Client (abi.ActorID) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Client = abi.ActorID(extra) + + } + // t.ID (verifreg.AllocationId) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.ID = verifreg.AllocationId(extra) + + } + return nil +} + +var lengthBufDataActivationNotification = []byte{130} + +func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufDataActivationNotification); err != nil { + return err + } + + // t.Address (address.Address) (struct) + if err := t.Address.MarshalCBOR(cw); err != nil { + return err + } + + // t.Payload ([]uint8) (slice) + if len(t.Payload) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Payload was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Payload))); err != nil { + return err + } + + if _, err := cw.Write(t.Payload[:]); err != nil { + return err + } + return nil +} + +func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { + *t = DataActivationNotification{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Address (address.Address) (struct) + + { + + if err := t.Address.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Address: %w", err) + } + + } + // t.Payload ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Payload: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Payload = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + return err + } + return nil +} + +var lengthBufProveCommit2Return = []byte{129} + +func (t *ProveCommit2Return) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveCommit2Return); err != nil { + return err + } + + // t.Sectors ([]miner.SectorActivationReturn) (slice) + if len(t.Sectors) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Sectors was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { + return err + } + for _, v := range t.Sectors { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *ProveCommit2Return) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommit2Return{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sectors ([]miner.SectorActivationReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Sectors: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Sectors = make([]SectorActivationReturn, extra) + } + + for i := 0; i < int(extra); i++ { + + var v SectorActivationReturn + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.Sectors[i] = v + } + + return nil +} + +var lengthBufSectorActivationReturn = []byte{131} + +func (t *SectorActivationReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorActivationReturn); err != nil { + return err + } + + // t.Activated (bool) (bool) + if err := cbg.WriteBool(w, t.Activated); err != nil { + return err + } + + // t.Power (big.Int) (struct) + if err := t.Power.MarshalCBOR(cw); err != nil { + return err + } + + // t.Pieces ([]miner.PieceActivationReturn) (slice) + if len(t.Pieces) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Pieces was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { + return err + } + for _, v := range t.Pieces { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorActivationReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 3 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Activated (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.Activated = false + case 21: + t.Activated = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.Power (big.Int) (struct) + + { + + if err := t.Power.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Power: %w", err) + } + + } + // t.Pieces ([]miner.PieceActivationReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Pieces: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Pieces = make([]PieceActivationReturn, extra) + } + + for i := 0; i < int(extra); i++ { + + var v PieceActivationReturn + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.Pieces[i] = v + } + + return nil +} + +var lengthBufPieceActivationReturn = []byte{130} + +func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceActivationReturn); err != nil { + return err + } + + // t.Claimed (bool) (bool) + if err := cbg.WriteBool(w, t.Claimed); err != nil { + return err + } + + // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) + if len(t.Notifications) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Notifications was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notifications))); err != nil { + return err + } + for _, v := range t.Notifications { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *PieceActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceActivationReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Claimed (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.Claimed = false + case 21: + t.Claimed = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Notifications: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Notifications = make([]DataActivationNotificationReturn, extra) + } + + for i := 0; i < int(extra); i++ { + + var v DataActivationNotificationReturn + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.Notifications[i] = v + } + + return nil +} + +var lengthBufDataActivationNotificationReturn = []byte{130} + +func (t *DataActivationNotificationReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufDataActivationNotificationReturn); err != nil { + return err + } + + // t.Code (exitcode.ExitCode) (int64) + if t.Code >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Code)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Code-1)); err != nil { + return err + } + } + + // t.Data ([]uint8) (slice) + if len(t.Data) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Data was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Data))); err != nil { + return err + } + + if _, err := cw.Write(t.Data[:]); err != nil { + return err + } + return nil +} + +func (t *DataActivationNotificationReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = DataActivationNotificationReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Code (exitcode.ExitCode) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative oveflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.Code = exitcode.ExitCode(extraI) + } + // t.Data ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Data: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Data = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + return err + } + return nil +} + var lengthBufFaultDeclaration = []byte{131} func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v12/miner/miner_types.go b/builtin/v12/miner/miner_types.go index 9f4e4bd4..f293b28c 100644 --- a/builtin/v12/miner/miner_types.go +++ b/builtin/v12/miner/miner_types.go @@ -394,3 +394,62 @@ type GetPeerIDReturn struct { type GetMultiAddrsReturn struct { MultiAddrs []byte } + +// ProveCommitSectors2Params represents the parameters for proving committed sectors. +type ProveCommitSectors2Params struct { + SectorActivations []SectorActivationManifest + SectorProofs [][]byte + AggregateProof []byte + RequireActivationSuccess bool + RequireNotificationSuccess bool +} + +// SectorActivationManifest represents the manifest for activating a sector. +type SectorActivationManifest struct { + SectorNumber abi.SectorNumber + Pieces []PieceActivationManifest +} + +// PieceActivationManifest represents the manifest for activating a piece. +type PieceActivationManifest struct { + CID cid.Cid + Size abi.PaddedPieceSize + VerifiedAllocationKey *VerifiedAllocationKey + Notify []DataActivationNotification +} + +// VerifiedAllocationKey represents the key for a verified allocation. +type VerifiedAllocationKey struct { + Client abi.ActorID + ID verifreg.AllocationId +} + +// DataActivationNotification represents a notification for data activation. +type DataActivationNotification struct { + Address addr.Address + Payload []byte +} + +// ProveCommit2Return represents the return value for the ProveCommit2 function. +type ProveCommit2Return struct { + Sectors []SectorActivationReturn +} + +// SectorActivationReturn represents the return value for sector activation. +type SectorActivationReturn struct { + Activated bool + Power abi.StoragePower + Pieces []PieceActivationReturn +} + +// PieceActivationReturn represents the return value for piece activation. +type PieceActivationReturn struct { + Claimed bool + Notifications []DataActivationNotificationReturn +} + +// DataActivationNotificationReturn represents the return value for a data activation notification. +type DataActivationNotificationReturn struct { + Code xc.ExitCode // todo correct?? + Data []byte +} From 231a5d9537a1a8107c4d91546c79aeeae1db3ac6 Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 5 Dec 2023 11:42:16 -0500 Subject: [PATCH 02/52] feat: add simple nv22 migration --- builtin/v13/migration/system.go | 36 +++++++++++ builtin/v13/migration/top.go | 104 ++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 builtin/v13/migration/system.go create mode 100644 builtin/v13/migration/top.go diff --git a/builtin/v13/migration/system.go b/builtin/v13/migration/system.go new file mode 100644 index 00000000..76642730 --- /dev/null +++ b/builtin/v13/migration/system.go @@ -0,0 +1,36 @@ +package migration + +import ( + "context" + + system13 "github.com/filecoin-project/go-state-types/builtin/v13/system" + + "github.com/filecoin-project/go-state-types/migration" + + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" +) + +// System Actor migrator +type systemActorMigrator struct { + OutCodeCID cid.Cid + ManifestData cid.Cid +} + +func (m systemActorMigrator) MigratedCodeCID() cid.Cid { + return m.OutCodeCID +} + +func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput) (*migration.ActorMigrationResult, error) { + // The ManifestData itself is already in the blockstore + state := system13.State{BuiltinActors: m.ManifestData} + stateHead, err := store.Put(ctx, &state) + if err != nil { + return nil, err + } + + return &migration.ActorMigrationResult{ + NewCodeCID: m.OutCodeCID, + NewHead: stateHead, + }, nil +} diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go new file mode 100644 index 00000000..c909dc75 --- /dev/null +++ b/builtin/v13/migration/top.go @@ -0,0 +1,104 @@ +package migration + +import ( + "context" + + adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" + + system12 "github.com/filecoin-project/go-state-types/builtin/v12/system" + + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" + "github.com/filecoin-project/go-state-types/migration" + + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "golang.org/x/xerrors" +) + +// MigrateStateTree Migrates the filecoin state tree starting from the global state tree and upgrading all actor state. +// The store must support concurrent writes (even if the configured worker count is 1). +func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID cid.Cid, actorsRootIn cid.Cid, priorEpoch abi.ChainEpoch, cfg migration.Config, log migration.Logger, cache migration.MigrationCache) (cid.Cid, error) { + if cfg.MaxWorkers <= 0 { + return cid.Undef, xerrors.Errorf("invalid migration config with %d workers", cfg.MaxWorkers) + } + + adtStore := adt13.WrapStore(ctx, store) + + // Load input and output state trees + actorsIn, err := builtin.LoadTree(adtStore, actorsRootIn) + if err != nil { + return cid.Undef, xerrors.Errorf("loading state tree: %w", err) + } + + // load old manifest data + systemActor, ok, err := actorsIn.GetActorV5(builtin.SystemActorAddr) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to get system actor: %w", err) + } + + if !ok { + return cid.Undef, xerrors.New("didn't find system actor") + } + + var systemState system12.State + if err := store.Get(ctx, systemActor.Head, &systemState); err != nil { + return cid.Undef, xerrors.Errorf("failed to get system actor state: %w", err) + } + + var oldManifestData manifest.ManifestData + if err := store.Get(ctx, systemState.BuiltinActors, &oldManifestData); err != nil { + return cid.Undef, xerrors.Errorf("failed to get old manifest data: %w", err) + } + + // load new manifest + var newManifest manifest.Manifest + if err := adtStore.Get(ctx, newManifestCID, &newManifest); err != nil { + return cid.Undef, xerrors.Errorf("error reading actor manifest: %w", err) + } + + if err := newManifest.Load(ctx, adtStore); err != nil { + return cid.Undef, xerrors.Errorf("error loading actor manifest: %w", err) + } + + // Maps prior version code CIDs to migration functions. + migrations := make(map[cid.Cid]migration.ActorMigration) + // Set of prior version code CIDs for actors to defer during iteration, for explicit migration afterwards. + deferredCodeIDs := make(map[cid.Cid]struct{}) + + for _, oldEntry := range oldManifestData.Entries { + newCodeCID, ok := newManifest.Get(oldEntry.Name) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for %s actor not found in new manifest", oldEntry.Name) + } + migrations[oldEntry.Code] = migration.CachedMigration(cache, migration.CodeMigrator{OutCodeCID: newCodeCID}) + } + + // migrations that migrate both code and state, override entries in `migrations` + + // The System Actor + + newSystemCodeCID, ok := newManifest.Get(manifest.SystemKey) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for system actor not found in new manifest") + } + + migrations[systemActor.Code] = systemActorMigrator{OutCodeCID: newSystemCodeCID, ManifestData: newManifest.Data} + + if len(migrations)+len(deferredCodeIDs) != len(oldManifestData.Entries) { + return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) + } + + actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to run migration: %w", err) + } + + outCid, err := actorsOut.Flush() + if err != nil { + return cid.Undef, xerrors.Errorf("failed to flush actorsOut: %w", err) + } + + return outCid, nil +} From 5a41c768e1305672bf90c91f8654f640c57495a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Dec 2023 13:31:55 +0100 Subject: [PATCH 03/52] v13 ddo types --- builtin/methods.go | 4 + builtin/v12/gen/gen.go | 9 --- builtin/v13/gen/gen.go | 19 +++++ builtin/v13/market/deal.go | 9 +-- builtin/v13/market/invariants.go | 4 - builtin/v13/market/market_state.go | 13 +++ builtin/v13/miner/miner_types.go | 125 +++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+), 18 deletions(-) diff --git a/builtin/methods.go b/builtin/methods.go index 903947d8..c15ea89e 100644 --- a/builtin/methods.go +++ b/builtin/methods.go @@ -231,6 +231,8 @@ var MethodsMiner = struct { GetVestingFundsExported abi.MethodNum GetPeerIDExported abi.MethodNum GetMultiaddrsExported abi.MethodNum + ProveCommitSectors2 abi.MethodNum + ProveReplicaUpdates3 abi.MethodNum }{ MethodConstructor, 2, @@ -279,6 +281,8 @@ var MethodsMiner = struct { MustGenerateFRCMethodNum("GetVestingFunds"), MustGenerateFRCMethodNum("GetPeerID"), MustGenerateFRCMethodNum("GetMultiaddrs"), + 33, + 34, } var MethodsVerifiedRegistry = struct { diff --git a/builtin/v12/gen/gen.go b/builtin/v12/gen/gen.go index ee76ce68..c358a4c7 100644 --- a/builtin/v12/gen/gen.go +++ b/builtin/v12/gen/gen.go @@ -192,15 +192,6 @@ func main() { miner.GetOwnerReturn{}, miner.GetPeerIDReturn{}, miner.GetMultiAddrsReturn{}, - miner.ProveCommitSectors2Params{}, - miner.SectorActivationManifest{}, - miner.PieceActivationManifest{}, - miner.VerifiedAllocationKey{}, - miner.DataActivationNotification{}, - miner.ProveCommit2Return{}, - miner.SectorActivationReturn{}, - miner.PieceActivationReturn{}, - miner.DataActivationNotificationReturn{}, // other types miner.FaultDeclaration{}, miner.RecoveryDeclaration{}, diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 6b015c67..70e73cc4 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -192,6 +192,25 @@ func main() { miner.GetOwnerReturn{}, miner.GetPeerIDReturn{}, miner.GetMultiAddrsReturn{}, + miner.ProveCommitSectors2Params{}, + miner.SectorActivationManifest{}, + miner.PieceActivationManifest{}, + miner.VerifiedAllocationKey{}, + miner.DataActivationNotification{}, + miner.ProveCommit2Return{}, + miner.PieceActivationReturn{}, + miner.DataActivationNotificationReturn{}, + miner.BatchReturn{}, + miner.FailCode{}, + miner.ProveReplicaUpdates3Params{}, + miner.SectorUpdateManifest{}, + miner.ProveReplicaUpdates3Return{}, + miner.SectorContentChangedParams{}, + miner.SectorChanges{}, + miner.PieceChange{}, + miner.SectorContentChangedReturn{}, + miner.SectorReturn{}, + miner.PieceReturn{}, // other types miner.FaultDeclaration{}, miner.RecoveryDeclaration{}, diff --git a/builtin/v13/market/deal.go b/builtin/v13/market/deal.go index cbe0aca8..1ab486c5 100644 --- a/builtin/v13/market/deal.go +++ b/builtin/v13/market/deal.go @@ -15,7 +15,6 @@ import ( addr "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/go-state-types/builtin/v13/verifreg" acrypto "github.com/filecoin-project/go-state-types/crypto" ) @@ -27,10 +26,10 @@ var PieceCIDPrefix = cid.Prefix{ } type DealState struct { - SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector - LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated - SlashEpoch abi.ChainEpoch // -1 if deal never slashed - VerifiedClaim verifreg.AllocationId + SectorNumber abi.SectorNumber // todo verify this + SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector + LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated + SlashEpoch abi.ChainEpoch // -1 if deal never slashed } // The DealLabel is a kinded union of string or byte slice. diff --git a/builtin/v13/market/invariants.go b/builtin/v13/market/invariants.go index d17c95b5..932c264c 100644 --- a/builtin/v13/market/invariants.go +++ b/builtin/v13/market/invariants.go @@ -157,10 +157,6 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c dealStateCount++ - if dealState.VerifiedClaim != verifreg.NoAllocationID { - claimIdToDealId[verifreg.ClaimId(dealState.VerifiedClaim)] = abi.DealID(dealID) - } - return nil }) acc.RequireNoError(err, "error iterating deal states") diff --git a/builtin/v13/market/market_state.go b/builtin/v13/market/market_state.go index 3dfa3bbd..4209e464 100644 --- a/builtin/v13/market/market_state.go +++ b/builtin/v13/market/market_state.go @@ -55,6 +55,14 @@ type State struct { // Verified registry allocation IDs for deals that are not yet activated. PendingDealAllocationIds cid.Cid // HAMT[DealID]AllocationID + + /// Maps providers to their sector IDs to deal IDs. + /// This supports finding affected deals when a sector is terminated early + /// or has data replaced. + /// Grouping by provider limits the cost of operations in the expected use case + /// of multiple sectors all belonging to the same provider. + /// HAMT[Address]HAMT[SectorNumber]SectorDealIDs + ProviderSectors cid.Cid } func ConstructState(store adt.Store) (*State, error) { @@ -83,6 +91,10 @@ func ConstructState(store adt.Store) (*State, error) { if err != nil { return nil, xerrors.Errorf("failed to create empty map: %w", err) } + emptyProviderSectorsMap, err := adt.StoreEmptyMap(store, builtin.DefaultHamtBitwidth) + if err != nil { + return nil, xerrors.Errorf("failed to create empty map: %w", err) + } return &State{ Proposals: emptyProposalsArrayCid, @@ -94,6 +106,7 @@ func ConstructState(store adt.Store) (*State, error) { DealOpsByEpoch: emptyDealOpsHamtCid, LastCron: abi.ChainEpoch(-1), PendingDealAllocationIds: emptyPendingDealAllocationMapCid, + ProviderSectors: emptyProviderSectorsMap, TotalClientLockedCollateral: abi.NewTokenAmount(0), TotalProviderLockedCollateral: abi.NewTokenAmount(0), diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index ca9dda29..3d242a52 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -394,3 +394,128 @@ type GetPeerIDReturn struct { type GetMultiAddrsReturn struct { MultiAddrs []byte } + +// ProveCommitSectors2Params represents the parameters for proving committed sectors. +type ProveCommitSectors2Params struct { + SectorActivations []SectorActivationManifest + SectorProofs [][]byte + AggregateProof []byte + RequireActivationSuccess bool + RequireNotificationSuccess bool +} + +// SectorActivationManifest contains data to activate a commitment to one sector and its data. +// All pieces of data must be specified, whether or not not claiming a FIL+ activation or being +// notified to a data consumer. +// An implicit zero piece fills any remaining sector capacity. +type SectorActivationManifest struct { + SectorNumber abi.SectorNumber + Pieces []PieceActivationManifest +} + +// PieceActivationManifest represents the manifest for activating a piece. +type PieceActivationManifest struct { + CID cid.Cid + Size abi.PaddedPieceSize + VerifiedAllocationKey *VerifiedAllocationKey + Notify []DataActivationNotification +} + +// VerifiedAllocationKey represents the key for a verified allocation. +type VerifiedAllocationKey struct { + Client abi.ActorID + ID verifreg.AllocationId +} + +// DataActivationNotification represents a notification for data activation. +type DataActivationNotification struct { + Address addr.Address + Payload []byte +} + +// ProveCommit2Return represents the return value for the ProveCommit2 function. +type ProveCommit2Return struct { + Sectors BatchReturn +} + +type BatchReturn struct { + SuccessCount uint64 + FailCodes []FailCode +} + +type FailCode struct { + // Idx represents the index of the operation that failed within the batch. + Idx uint64 + Code xc.ExitCode // todo correct? +} + +// PieceActivationReturn represents the return value for piece activation. +type PieceActivationReturn struct { + Claimed bool + Notifications []DataActivationNotificationReturn +} + +// DataActivationNotificationReturn represents the return value for a data activation notification. +type DataActivationNotificationReturn struct { + Code xc.ExitCode // todo correct?? + Data []byte +} + +// ProveReplicaUpdates3Params represents the parameters for proving replica updates. +type ProveReplicaUpdates3Params struct { + SectorUpdates []SectorUpdateManifest + SectorProofs [][]byte + AggregateProof []byte + UpdateProofsType abi.RegisteredUpdateProof + AggregateProofType abi.RegisteredAggregationProof + RequireActivationSuccess bool + RequireNotificationSuccess bool +} + +// SectorUpdateManifest contains data for sector update. +type SectorUpdateManifest struct { + Sector abi.SectorNumber + Deadline uint64 + Partition uint64 + NewSealedCID cid.Cid + Pieces []PieceActivationManifest +} + +// ProveReplicaUpdates3Return represents the return value for the ProveReplicaUpdates3 function. +type ProveReplicaUpdates3Return struct { + ActivationResults BatchReturn +} + +// SectorContentChangedParams represents a notification of change committed to sectors. +type SectorContentChangedParams struct { + Sectors []SectorChanges +} + +// SectorChanges describes changes to one sector's content. +type SectorChanges struct { + Sector abi.SectorNumber + MinimumCommitmentEpoch abi.ChainEpoch + Added []PieceChange +} + +// PieceChange describes a piece of data committed to a sector. +type PieceChange struct { + Data cid.Cid + Size abi.PaddedPieceSize + Payload []byte +} + +// SectorContentChangedReturn represents the return value for the SectorContentChanged function. +type SectorContentChangedReturn struct { + Sectors []SectorReturn +} + +// SectorReturn represents a result for each sector that was notified. +type SectorReturn struct { + Added []PieceReturn +} + +// PieceReturn represents a result for each piece for the sector that was notified. +type PieceReturn struct { + Accepted bool +} From a2d0012d5642cbac7d0ebd2d7a3574bbdf443c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Dec 2023 13:34:08 +0100 Subject: [PATCH 04/52] cbor gen --- builtin/v12/miner/cbor_gen.go | 1083 --------------- builtin/v13/market/cbor_gen.go | 63 +- builtin/v13/miner/cbor_gen.go | 2338 ++++++++++++++++++++++++++++++++ 3 files changed, 2378 insertions(+), 1106 deletions(-) diff --git a/builtin/v12/miner/cbor_gen.go b/builtin/v12/miner/cbor_gen.go index 8deb2c2a..09236233 100644 --- a/builtin/v12/miner/cbor_gen.go +++ b/builtin/v12/miner/cbor_gen.go @@ -11,7 +11,6 @@ import ( address "github.com/filecoin-project/go-address" abi "github.com/filecoin-project/go-state-types/abi" verifreg "github.com/filecoin-project/go-state-types/builtin/v12/verifreg" - exitcode "github.com/filecoin-project/go-state-types/exitcode" proof "github.com/filecoin-project/go-state-types/proof" cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" @@ -6394,1088 +6393,6 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveCommitSectors2Params = []byte{133} - -func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufProveCommitSectors2Params); err != nil { - return err - } - - // t.SectorActivations ([]miner.SectorActivationManifest) (slice) - if len(t.SectorActivations) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.SectorActivations was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorActivations))); err != nil { - return err - } - for _, v := range t.SectorActivations { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - - // t.SectorProofs ([][]uint8) (slice) - if len(t.SectorProofs) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.SectorProofs was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorProofs))); err != nil { - return err - } - for _, v := range t.SectorProofs { - if len(v) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field v was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(v))); err != nil { - return err - } - - if _, err := cw.Write(v[:]); err != nil { - return err - } - } - - // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.AggregateProof was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.AggregateProof))); err != nil { - return err - } - - if _, err := cw.Write(t.AggregateProof[:]); err != nil { - return err - } - - // t.RequireActivationSuccess (bool) (bool) - if err := cbg.WriteBool(w, t.RequireActivationSuccess); err != nil { - return err - } - - // t.RequireNotificationSuccess (bool) (bool) - if err := cbg.WriteBool(w, t.RequireNotificationSuccess); err != nil { - return err - } - return nil -} - -func (t *ProveCommitSectors2Params) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveCommitSectors2Params{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 5 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.SectorActivations ([]miner.SectorActivationManifest) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.SectorActivations: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.SectorActivations = make([]SectorActivationManifest, extra) - } - - for i := 0; i < int(extra); i++ { - - var v SectorActivationManifest - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.SectorActivations[i] = v - } - - // t.SectorProofs ([][]uint8) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.SectorProofs = make([][]uint8, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.SectorProofs[i] = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { - return err - } - } - } - - // t.AggregateProof ([]uint8) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.AggregateProof = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { - return err - } - // t.RequireActivationSuccess (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.RequireActivationSuccess = false - case 21: - t.RequireActivationSuccess = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.RequireNotificationSuccess (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.RequireNotificationSuccess = false - case 21: - t.RequireNotificationSuccess = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - return nil -} - -var lengthBufSectorActivationManifest = []byte{130} - -func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufSectorActivationManifest); err != nil { - return err - } - - // t.SectorNumber (abi.SectorNumber) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { - return err - } - - // t.Pieces ([]miner.PieceActivationManifest) (slice) - if len(t.Pieces) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Pieces was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { - return err - } - for _, v := range t.Pieces { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *SectorActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { - *t = SectorActivationManifest{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.SectorNumber (abi.SectorNumber) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.SectorNumber = abi.SectorNumber(extra) - - } - // t.Pieces ([]miner.PieceActivationManifest) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Pieces: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Pieces = make([]PieceActivationManifest, extra) - } - - for i := 0; i < int(extra); i++ { - - var v PieceActivationManifest - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Pieces[i] = v - } - - return nil -} - -var lengthBufPieceActivationManifest = []byte{132} - -func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufPieceActivationManifest); err != nil { - return err - } - - // t.CID (cid.Cid) (struct) - - if err := cbg.WriteCid(cw, t.CID); err != nil { - return xerrors.Errorf("failed to write cid field t.CID: %w", err) - } - - // t.Size (abi.PaddedPieceSize) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { - return err - } - - // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) - if err := t.VerifiedAllocationKey.MarshalCBOR(cw); err != nil { - return err - } - - // t.Notify ([]miner.DataActivationNotification) (slice) - if len(t.Notify) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Notify was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notify))); err != nil { - return err - } - for _, v := range t.Notify { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *PieceActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { - *t = PieceActivationManifest{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - 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.CID (cid.Cid) (struct) - - { - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.CID: %w", err) - } - - t.CID = c - - } - // t.Size (abi.PaddedPieceSize) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.Size = abi.PaddedPieceSize(extra) - - } - // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) - - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.VerifiedAllocationKey = new(VerifiedAllocationKey) - if err := t.VerifiedAllocationKey.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.VerifiedAllocationKey pointer: %w", err) - } - } - - } - // t.Notify ([]miner.DataActivationNotification) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Notify: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Notify = make([]DataActivationNotification, extra) - } - - for i := 0; i < int(extra); i++ { - - var v DataActivationNotification - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Notify[i] = v - } - - return nil -} - -var lengthBufVerifiedAllocationKey = []byte{130} - -func (t *VerifiedAllocationKey) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufVerifiedAllocationKey); err != nil { - return err - } - - // t.Client (abi.ActorID) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Client)); err != nil { - return err - } - - // t.ID (verifreg.AllocationId) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ID)); err != nil { - return err - } - - return nil -} - -func (t *VerifiedAllocationKey) UnmarshalCBOR(r io.Reader) (err error) { - *t = VerifiedAllocationKey{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Client (abi.ActorID) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.Client = abi.ActorID(extra) - - } - // t.ID (verifreg.AllocationId) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.ID = verifreg.AllocationId(extra) - - } - return nil -} - -var lengthBufDataActivationNotification = []byte{130} - -func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufDataActivationNotification); err != nil { - return err - } - - // t.Address (address.Address) (struct) - if err := t.Address.MarshalCBOR(cw); err != nil { - return err - } - - // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Payload was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Payload))); err != nil { - return err - } - - if _, err := cw.Write(t.Payload[:]); err != nil { - return err - } - return nil -} - -func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { - *t = DataActivationNotification{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Address (address.Address) (struct) - - { - - if err := t.Address.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Address: %w", err) - } - - } - // t.Payload ([]uint8) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Payload: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.Payload = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { - return err - } - return nil -} - -var lengthBufProveCommit2Return = []byte{129} - -func (t *ProveCommit2Return) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufProveCommit2Return); err != nil { - return err - } - - // t.Sectors ([]miner.SectorActivationReturn) (slice) - if len(t.Sectors) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Sectors was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { - return err - } - for _, v := range t.Sectors { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *ProveCommit2Return) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveCommit2Return{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Sectors ([]miner.SectorActivationReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Sectors: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Sectors = make([]SectorActivationReturn, extra) - } - - for i := 0; i < int(extra); i++ { - - var v SectorActivationReturn - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Sectors[i] = v - } - - return nil -} - -var lengthBufSectorActivationReturn = []byte{131} - -func (t *SectorActivationReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufSectorActivationReturn); err != nil { - return err - } - - // t.Activated (bool) (bool) - if err := cbg.WriteBool(w, t.Activated); err != nil { - return err - } - - // t.Power (big.Int) (struct) - if err := t.Power.MarshalCBOR(cw); err != nil { - return err - } - - // t.Pieces ([]miner.PieceActivationReturn) (slice) - if len(t.Pieces) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Pieces was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { - return err - } - for _, v := range t.Pieces { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *SectorActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = SectorActivationReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 3 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Activated (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.Activated = false - case 21: - t.Activated = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.Power (big.Int) (struct) - - { - - if err := t.Power.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Power: %w", err) - } - - } - // t.Pieces ([]miner.PieceActivationReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Pieces: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Pieces = make([]PieceActivationReturn, extra) - } - - for i := 0; i < int(extra); i++ { - - var v PieceActivationReturn - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Pieces[i] = v - } - - return nil -} - -var lengthBufPieceActivationReturn = []byte{130} - -func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufPieceActivationReturn); err != nil { - return err - } - - // t.Claimed (bool) (bool) - if err := cbg.WriteBool(w, t.Claimed); err != nil { - return err - } - - // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) - if len(t.Notifications) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Notifications was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notifications))); err != nil { - return err - } - for _, v := range t.Notifications { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *PieceActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = PieceActivationReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Claimed (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.Claimed = false - case 21: - t.Claimed = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Notifications: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Notifications = make([]DataActivationNotificationReturn, extra) - } - - for i := 0; i < int(extra); i++ { - - var v DataActivationNotificationReturn - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Notifications[i] = v - } - - return nil -} - -var lengthBufDataActivationNotificationReturn = []byte{130} - -func (t *DataActivationNotificationReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufDataActivationNotificationReturn); err != nil { - return err - } - - // t.Code (exitcode.ExitCode) (int64) - if t.Code >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Code)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Code-1)); err != nil { - return err - } - } - - // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Data was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Data))); err != nil { - return err - } - - if _, err := cw.Write(t.Data[:]); err != nil { - return err - } - return nil -} - -func (t *DataActivationNotificationReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = DataActivationNotificationReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Code (exitcode.ExitCode) (int64) - { - maj, extra, err := cr.ReadHeader() - var extraI int64 - if err != nil { - return err - } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - - t.Code = exitcode.ExitCode(extraI) - } - // t.Data ([]uint8) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Data: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.Data = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { - return err - } - return nil -} - var lengthBufFaultDeclaration = []byte{131} func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index f4726353..9fb6c5f2 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -20,7 +20,7 @@ var _ = cid.Undef var _ = math.E var _ = sort.Sort -var lengthBufState = []byte{140} +var lengthBufState = []byte{141} func (t *State) MarshalCBOR(w io.Writer) error { if t == nil { @@ -108,6 +108,12 @@ func (t *State) MarshalCBOR(w io.Writer) error { return xerrors.Errorf("failed to write cid field t.PendingDealAllocationIds: %w", err) } + // t.ProviderSectors (cid.Cid) (struct) + + if err := cbg.WriteCid(cw, t.ProviderSectors); err != nil { + return xerrors.Errorf("failed to write cid field t.ProviderSectors: %w", err) + } + return nil } @@ -130,7 +136,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return fmt.Errorf("cbor input should be of type array") } - if extra != 12 { + if extra != 13 { return fmt.Errorf("cbor input had wrong number of fields") } @@ -283,6 +289,18 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { t.PendingDealAllocationIds = c + } + // t.ProviderSectors (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.ProviderSectors: %w", err) + } + + t.ProviderSectors = c + } return nil } @@ -301,6 +319,12 @@ func (t *DealState) MarshalCBOR(w io.Writer) error { return err } + // t.SectorNumber (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { + return err + } + // t.SectorStartEpoch (abi.ChainEpoch) (int64) if t.SectorStartEpoch >= 0 { if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorStartEpoch)); err != nil { @@ -333,13 +357,6 @@ func (t *DealState) MarshalCBOR(w io.Writer) error { return err } } - - // t.VerifiedClaim (verifreg.AllocationId) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.VerifiedClaim)); err != nil { - return err - } - return nil } @@ -366,6 +383,20 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { return fmt.Errorf("cbor input had wrong number of fields") } + // t.SectorNumber (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.SectorNumber = abi.SectorNumber(extra) + + } // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -441,20 +472,6 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { t.SlashEpoch = abi.ChainEpoch(extraI) } - // t.VerifiedClaim (verifreg.AllocationId) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.VerifiedClaim = verifreg.AllocationId(extra) - - } return nil } diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 791f69ea..ec812395 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -11,6 +11,7 @@ import ( address "github.com/filecoin-project/go-address" abi "github.com/filecoin-project/go-state-types/abi" verifreg "github.com/filecoin-project/go-state-types/builtin/v13/verifreg" + exitcode "github.com/filecoin-project/go-state-types/exitcode" proof "github.com/filecoin-project/go-state-types/proof" cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" @@ -6393,6 +6394,2343 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return nil } +var lengthBufProveCommitSectors2Params = []byte{133} + +func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveCommitSectors2Params); err != nil { + return err + } + + // t.SectorActivations ([]miner.SectorActivationManifest) (slice) + if len(t.SectorActivations) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorActivations was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorActivations))); err != nil { + return err + } + for _, v := range t.SectorActivations { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + + // t.SectorProofs ([][]uint8) (slice) + if len(t.SectorProofs) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorProofs was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorProofs))); err != nil { + return err + } + for _, v := range t.SectorProofs { + if len(v) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(v))); err != nil { + return err + } + + if _, err := cw.Write(v[:]); err != nil { + return err + } + } + + // t.AggregateProof ([]uint8) (slice) + if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.AggregateProof was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.AggregateProof))); err != nil { + return err + } + + if _, err := cw.Write(t.AggregateProof[:]); err != nil { + return err + } + + // t.RequireActivationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireActivationSuccess); err != nil { + return err + } + + // t.RequireNotificationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireNotificationSuccess); err != nil { + return err + } + return nil +} + +func (t *ProveCommitSectors2Params) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommitSectors2Params{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 5 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SectorActivations ([]miner.SectorActivationManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorActivations: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorActivations = make([]SectorActivationManifest, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.SectorActivations[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.SectorActivations[i]: %w", err) + } + + } + } + } + + // t.SectorProofs ([][]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorProofs = make([][]uint8, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.SectorProofs[i] = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { + return err + } + } + } + + // t.AggregateProof ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.AggregateProof = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + return err + } + // t.RequireActivationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireActivationSuccess = false + case 21: + t.RequireActivationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.RequireNotificationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireNotificationSuccess = false + case 21: + t.RequireNotificationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + return nil +} + +var lengthBufSectorActivationManifest = []byte{130} + +func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorActivationManifest); err != nil { + return err + } + + // t.SectorNumber (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { + return err + } + + // t.Pieces ([]miner.PieceActivationManifest) (slice) + if len(t.Pieces) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Pieces was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { + return err + } + for _, v := range t.Pieces { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorActivationManifest{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SectorNumber (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.SectorNumber = abi.SectorNumber(extra) + + } + // t.Pieces ([]miner.PieceActivationManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Pieces: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Pieces = make([]PieceActivationManifest, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Pieces[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Pieces[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufPieceActivationManifest = []byte{132} + +func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceActivationManifest); err != nil { + return err + } + + // t.CID (cid.Cid) (struct) + + if err := cbg.WriteCid(cw, t.CID); err != nil { + return xerrors.Errorf("failed to write cid field t.CID: %w", err) + } + + // t.Size (abi.PaddedPieceSize) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { + return err + } + + // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) + if err := t.VerifiedAllocationKey.MarshalCBOR(cw); err != nil { + return err + } + + // t.Notify ([]miner.DataActivationNotification) (slice) + if len(t.Notify) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Notify was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notify))); err != nil { + return err + } + for _, v := range t.Notify { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *PieceActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceActivationManifest{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + 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.CID (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.CID: %w", err) + } + + t.CID = c + + } + // t.Size (abi.PaddedPieceSize) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Size = abi.PaddedPieceSize(extra) + + } + // t.VerifiedAllocationKey (miner.VerifiedAllocationKey) (struct) + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.VerifiedAllocationKey = new(VerifiedAllocationKey) + if err := t.VerifiedAllocationKey.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.VerifiedAllocationKey pointer: %w", err) + } + } + + } + // t.Notify ([]miner.DataActivationNotification) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Notify: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Notify = make([]DataActivationNotification, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Notify[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Notify[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufVerifiedAllocationKey = []byte{130} + +func (t *VerifiedAllocationKey) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufVerifiedAllocationKey); err != nil { + return err + } + + // t.Client (abi.ActorID) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Client)); err != nil { + return err + } + + // t.ID (verifreg.AllocationId) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.ID)); err != nil { + return err + } + + return nil +} + +func (t *VerifiedAllocationKey) UnmarshalCBOR(r io.Reader) (err error) { + *t = VerifiedAllocationKey{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Client (abi.ActorID) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Client = abi.ActorID(extra) + + } + // t.ID (verifreg.AllocationId) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.ID = verifreg.AllocationId(extra) + + } + return nil +} + +var lengthBufDataActivationNotification = []byte{130} + +func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufDataActivationNotification); err != nil { + return err + } + + // t.Address (address.Address) (struct) + if err := t.Address.MarshalCBOR(cw); err != nil { + return err + } + + // t.Payload ([]uint8) (slice) + if len(t.Payload) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Payload was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Payload))); err != nil { + return err + } + + if _, err := cw.Write(t.Payload[:]); err != nil { + return err + } + return nil +} + +func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { + *t = DataActivationNotification{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Address (address.Address) (struct) + + { + + if err := t.Address.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Address: %w", err) + } + + } + // t.Payload ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Payload: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Payload = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + return err + } + return nil +} + +var lengthBufProveCommit2Return = []byte{129} + +func (t *ProveCommit2Return) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveCommit2Return); err != nil { + return err + } + + // t.Sectors (miner.BatchReturn) (struct) + if err := t.Sectors.MarshalCBOR(cw); err != nil { + return err + } + return nil +} + +func (t *ProveCommit2Return) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommit2Return{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sectors (miner.BatchReturn) (struct) + + { + + if err := t.Sectors.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Sectors: %w", err) + } + + } + return nil +} + +var lengthBufPieceActivationReturn = []byte{130} + +func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceActivationReturn); err != nil { + return err + } + + // t.Claimed (bool) (bool) + if err := cbg.WriteBool(w, t.Claimed); err != nil { + return err + } + + // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) + if len(t.Notifications) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Notifications was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notifications))); err != nil { + return err + } + for _, v := range t.Notifications { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *PieceActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceActivationReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Claimed (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.Claimed = false + case 21: + t.Claimed = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Notifications: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Notifications = make([]DataActivationNotificationReturn, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Notifications[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Notifications[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufDataActivationNotificationReturn = []byte{130} + +func (t *DataActivationNotificationReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufDataActivationNotificationReturn); err != nil { + return err + } + + // t.Code (exitcode.ExitCode) (int64) + if t.Code >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Code)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Code-1)); err != nil { + return err + } + } + + // t.Data ([]uint8) (slice) + if len(t.Data) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Data was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Data))); err != nil { + return err + } + + if _, err := cw.Write(t.Data[:]); err != nil { + return err + } + return nil +} + +func (t *DataActivationNotificationReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = DataActivationNotificationReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Code (exitcode.ExitCode) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.Code = exitcode.ExitCode(extraI) + } + // t.Data ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Data: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Data = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + return err + } + return nil +} + +var lengthBufBatchReturn = []byte{130} + +func (t *BatchReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufBatchReturn); err != nil { + return err + } + + // t.SuccessCount (uint64) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SuccessCount)); err != nil { + return err + } + + // t.FailCodes ([]miner.FailCode) (slice) + if len(t.FailCodes) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.FailCodes was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.FailCodes))); err != nil { + return err + } + for _, v := range t.FailCodes { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = BatchReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SuccessCount (uint64) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.SuccessCount = uint64(extra) + + } + // t.FailCodes ([]miner.FailCode) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.FailCodes: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.FailCodes = make([]FailCode, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.FailCodes[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.FailCodes[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufFailCode = []byte{130} + +func (t *FailCode) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufFailCode); err != nil { + return err + } + + // t.Idx (uint64) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Idx)); err != nil { + return err + } + + // t.Code (exitcode.ExitCode) (int64) + if t.Code >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Code)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Code-1)); err != nil { + return err + } + } + return nil +} + +func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { + *t = FailCode{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 2 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Idx (uint64) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Idx = uint64(extra) + + } + // t.Code (exitcode.ExitCode) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.Code = exitcode.ExitCode(extraI) + } + return nil +} + +var lengthBufProveReplicaUpdates3Params = []byte{135} + +func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveReplicaUpdates3Params); err != nil { + return err + } + + // t.SectorUpdates ([]miner.SectorUpdateManifest) (slice) + if len(t.SectorUpdates) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorUpdates was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorUpdates))); err != nil { + return err + } + for _, v := range t.SectorUpdates { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + + // t.SectorProofs ([][]uint8) (slice) + if len(t.SectorProofs) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.SectorProofs was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.SectorProofs))); err != nil { + return err + } + for _, v := range t.SectorProofs { + if len(v) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(v))); err != nil { + return err + } + + if _, err := cw.Write(v[:]); err != nil { + return err + } + } + + // t.AggregateProof ([]uint8) (slice) + if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.AggregateProof was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.AggregateProof))); err != nil { + return err + } + + if _, err := cw.Write(t.AggregateProof[:]); err != nil { + return err + } + + // t.UpdateProofsType (abi.RegisteredUpdateProof) (int64) + if t.UpdateProofsType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.UpdateProofsType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.UpdateProofsType-1)); err != nil { + return err + } + } + + // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) + if t.AggregateProofType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.AggregateProofType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.AggregateProofType-1)); err != nil { + return err + } + } + + // t.RequireActivationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireActivationSuccess); err != nil { + return err + } + + // t.RequireNotificationSuccess (bool) (bool) + if err := cbg.WriteBool(w, t.RequireNotificationSuccess); err != nil { + return err + } + return nil +} + +func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveReplicaUpdates3Params{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 7 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.SectorUpdates ([]miner.SectorUpdateManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorUpdates: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorUpdates = make([]SectorUpdateManifest, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.SectorUpdates[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.SectorUpdates[i]: %w", err) + } + + } + } + } + + // t.SectorProofs ([][]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.SectorProofs = make([][]uint8, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.SectorProofs[i] = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { + return err + } + } + } + + // t.AggregateProof ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.AggregateProof = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + return err + } + // t.UpdateProofsType (abi.RegisteredUpdateProof) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.UpdateProofsType = abi.RegisteredUpdateProof(extraI) + } + // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.AggregateProofType = abi.RegisteredAggregationProof(extraI) + } + // t.RequireActivationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireActivationSuccess = false + case 21: + t.RequireActivationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.RequireNotificationSuccess (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RequireNotificationSuccess = false + case 21: + t.RequireNotificationSuccess = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + return nil +} + +var lengthBufSectorUpdateManifest = []byte{133} + +func (t *SectorUpdateManifest) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorUpdateManifest); err != nil { + return err + } + + // t.Sector (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Sector)); err != nil { + return err + } + + // t.Deadline (uint64) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Deadline)); err != nil { + return err + } + + // t.Partition (uint64) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Partition)); err != nil { + return err + } + + // t.NewSealedCID (cid.Cid) (struct) + + if err := cbg.WriteCid(cw, t.NewSealedCID); err != nil { + return xerrors.Errorf("failed to write cid field t.NewSealedCID: %w", err) + } + + // t.Pieces ([]miner.PieceActivationManifest) (slice) + if len(t.Pieces) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Pieces was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Pieces))); err != nil { + return err + } + for _, v := range t.Pieces { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorUpdateManifest) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorUpdateManifest{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 5 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sector (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Sector = abi.SectorNumber(extra) + + } + // t.Deadline (uint64) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Deadline = uint64(extra) + + } + // t.Partition (uint64) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Partition = uint64(extra) + + } + // t.NewSealedCID (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.NewSealedCID: %w", err) + } + + t.NewSealedCID = c + + } + // t.Pieces ([]miner.PieceActivationManifest) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Pieces: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Pieces = make([]PieceActivationManifest, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Pieces[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Pieces[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufProveReplicaUpdates3Return = []byte{129} + +func (t *ProveReplicaUpdates3Return) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufProveReplicaUpdates3Return); err != nil { + return err + } + + // t.ActivationResults (miner.BatchReturn) (struct) + if err := t.ActivationResults.MarshalCBOR(cw); err != nil { + return err + } + return nil +} + +func (t *ProveReplicaUpdates3Return) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveReplicaUpdates3Return{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.ActivationResults (miner.BatchReturn) (struct) + + { + + if err := t.ActivationResults.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.ActivationResults: %w", err) + } + + } + return nil +} + +var lengthBufSectorContentChangedParams = []byte{129} + +func (t *SectorContentChangedParams) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorContentChangedParams); err != nil { + return err + } + + // t.Sectors ([]miner.SectorChanges) (slice) + if len(t.Sectors) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Sectors was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { + return err + } + for _, v := range t.Sectors { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorContentChangedParams) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorContentChangedParams{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sectors ([]miner.SectorChanges) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Sectors: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Sectors = make([]SectorChanges, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Sectors[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Sectors[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufSectorChanges = []byte{131} + +func (t *SectorChanges) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorChanges); err != nil { + return err + } + + // t.Sector (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Sector)); err != nil { + return err + } + + // t.MinimumCommitmentEpoch (abi.ChainEpoch) (int64) + if t.MinimumCommitmentEpoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.MinimumCommitmentEpoch)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.MinimumCommitmentEpoch-1)); err != nil { + return err + } + } + + // t.Added ([]miner.PieceChange) (slice) + if len(t.Added) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Added was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Added))); err != nil { + return err + } + for _, v := range t.Added { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorChanges) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorChanges{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 3 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sector (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Sector = abi.SectorNumber(extra) + + } + // t.MinimumCommitmentEpoch (abi.ChainEpoch) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.MinimumCommitmentEpoch = abi.ChainEpoch(extraI) + } + // t.Added ([]miner.PieceChange) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Added: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Added = make([]PieceChange, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Added[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Added[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufPieceChange = []byte{131} + +func (t *PieceChange) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceChange); err != nil { + return err + } + + // t.Data (cid.Cid) (struct) + + if err := cbg.WriteCid(cw, t.Data); err != nil { + return xerrors.Errorf("failed to write cid field t.Data: %w", err) + } + + // t.Size (abi.PaddedPieceSize) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { + return err + } + + // t.Payload ([]uint8) (slice) + if len(t.Payload) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Payload was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Payload))); err != nil { + return err + } + + if _, err := cw.Write(t.Payload[:]); err != nil { + return err + } + return nil +} + +func (t *PieceChange) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceChange{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 3 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Data (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.Data: %w", err) + } + + t.Data = c + + } + // t.Size (abi.PaddedPieceSize) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Size = abi.PaddedPieceSize(extra) + + } + // t.Payload ([]uint8) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Payload: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Payload = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + return err + } + return nil +} + +var lengthBufSectorContentChangedReturn = []byte{129} + +func (t *SectorContentChangedReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorContentChangedReturn); err != nil { + return err + } + + // t.Sectors ([]miner.SectorReturn) (slice) + if len(t.Sectors) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Sectors was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { + return err + } + for _, v := range t.Sectors { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorContentChangedReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorContentChangedReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sectors ([]miner.SectorReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Sectors: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Sectors = make([]SectorReturn, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Sectors[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Sectors[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufSectorReturn = []byte{129} + +func (t *SectorReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorReturn); err != nil { + return err + } + + // t.Added ([]miner.PieceReturn) (slice) + if len(t.Added) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Added was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Added))); err != nil { + return err + } + for _, v := range t.Added { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } + return nil +} + +func (t *SectorReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Added ([]miner.PieceReturn) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Added: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Added = make([]PieceReturn, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + if err := t.Added[i].UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Added[i]: %w", err) + } + + } + } + } + + return nil +} + +var lengthBufPieceReturn = []byte{129} + +func (t *PieceReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufPieceReturn); err != nil { + return err + } + + // t.Accepted (bool) (bool) + if err := cbg.WriteBool(w, t.Accepted); err != nil { + return err + } + return nil +} + +func (t *PieceReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = PieceReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Accepted (bool) (bool) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.Accepted = false + case 21: + t.Accepted = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + return nil +} + var lengthBufFaultDeclaration = []byte{131} func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error { From 50bc8734ad0b44184d422200db226d16567c4b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Dec 2023 14:10:19 +0100 Subject: [PATCH 05/52] cleanup v12 --- builtin/v12/miner/miner_types.go | 60 -------------------------------- 1 file changed, 60 deletions(-) diff --git a/builtin/v12/miner/miner_types.go b/builtin/v12/miner/miner_types.go index 9afa19a8..9f4e4bd4 100644 --- a/builtin/v12/miner/miner_types.go +++ b/builtin/v12/miner/miner_types.go @@ -366,7 +366,6 @@ type ExpirationExtension2 struct { NewExpiration abi.ChainEpoch } - type SectorClaim struct { SectorNumber abi.SectorNumber MaintainClaims []verifreg.ClaimId @@ -395,62 +394,3 @@ type GetPeerIDReturn struct { type GetMultiAddrsReturn struct { MultiAddrs []byte } - -// ProveCommitSectors2Params represents the parameters for proving committed sectors. -type ProveCommitSectors2Params struct { - SectorActivations []SectorActivationManifest - SectorProofs [][]byte - AggregateProof []byte - RequireActivationSuccess bool - RequireNotificationSuccess bool -} - -// SectorActivationManifest represents the manifest for activating a sector. -type SectorActivationManifest struct { - SectorNumber abi.SectorNumber - Pieces []PieceActivationManifest -} - -// PieceActivationManifest represents the manifest for activating a piece. -type PieceActivationManifest struct { - CID cid.Cid - Size abi.PaddedPieceSize - VerifiedAllocationKey *VerifiedAllocationKey - Notify []DataActivationNotification -} - -// VerifiedAllocationKey represents the key for a verified allocation. -type VerifiedAllocationKey struct { - Client abi.ActorID - ID verifreg.AllocationId -} - -// DataActivationNotification represents a notification for data activation. -type DataActivationNotification struct { - Address addr.Address - Payload []byte -} - -// ProveCommit2Return represents the return value for the ProveCommit2 function. -type ProveCommit2Return struct { - Sectors []SectorActivationReturn -} - -// SectorActivationReturn represents the return value for sector activation. -type SectorActivationReturn struct { - Activated bool - Power abi.StoragePower - Pieces []PieceActivationReturn -} - -// PieceActivationReturn represents the return value for piece activation. -type PieceActivationReturn struct { - Claimed bool - Notifications []DataActivationNotificationReturn -} - -// DataActivationNotificationReturn represents the return value for a data activation notification. -type DataActivationNotificationReturn struct { - Code xc.ExitCode // todo correct?? - Data []byte -} From 1fb1d844b1461ab24e597fbf7d48eb518c689682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 12:55:30 +0100 Subject: [PATCH 06/52] add missing v13 ddo method types/defs --- builtin/methods.go | 21 +++++++++++++++------ builtin/v13/gen/gen.go | 3 ++- builtin/v13/market/market_types.go | 6 ++++++ builtin/v13/market/methods.go | 3 +++ builtin/v13/miner/cbor_gen.go | 6 +++--- builtin/v13/miner/methods.go | 3 +++ builtin/v13/miner/miner_types.go | 4 ++-- 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/builtin/methods.go b/builtin/methods.go index c15ea89e..10c94a03 100644 --- a/builtin/methods.go +++ b/builtin/methods.go @@ -101,6 +101,9 @@ var MethodsPaych = struct { 4, } +// ext::miner::SECTOR_CONTENT_CHANGED +var MethodSectorContentChanged = MustGenerateFRCMethodNum("SectorContentChanged") + var MethodsMarket = struct { Constructor abi.MethodNum AddBalance abi.MethodNum @@ -125,6 +128,8 @@ var MethodsMarket = struct { GetDealProviderCollateralExported abi.MethodNum GetDealVerifiedExported abi.MethodNum GetDealActivationExported abi.MethodNum + GetDealSectorExported abi.MethodNum + SectorContentChangedExported abi.MethodNum }{ MethodConstructor, 2, @@ -149,6 +154,8 @@ var MethodsMarket = struct { MustGenerateFRCMethodNum("GetDealProviderCollateral"), MustGenerateFRCMethodNum("GetDealVerified"), MustGenerateFRCMethodNum("GetDealActivation"), + MustGenerateFRCMethodNum("GetDealSector"), + MethodSectorContentChanged, } var MethodsPower = struct { @@ -191,7 +198,7 @@ var MethodsMiner = struct { ChangePeerID abi.MethodNum ChangePeerIDExported abi.MethodNum SubmitWindowedPoSt abi.MethodNum - PreCommitSector abi.MethodNum + PreCommitSector abi.MethodNum // deprecated av13 ProveCommitSector abi.MethodNum ExtendSectorExpiration abi.MethodNum TerminateSectors abi.MethodNum @@ -215,11 +222,11 @@ var MethodsMiner = struct { ChangeOwnerAddress abi.MethodNum ChangeOwnerAddressExported abi.MethodNum DisputeWindowedPoSt abi.MethodNum - PreCommitSectorBatch abi.MethodNum + PreCommitSectorBatch abi.MethodNum // deprecated av13 ProveCommitAggregate abi.MethodNum ProveReplicaUpdates abi.MethodNum PreCommitSectorBatch2 abi.MethodNum - ProveReplicaUpdates2 abi.MethodNum + ProveReplicaUpdates2 abi.MethodNum // deprecated av13 ChangeBeneficiary abi.MethodNum ChangeBeneficiaryExported abi.MethodNum GetBeneficiary abi.MethodNum @@ -231,8 +238,9 @@ var MethodsMiner = struct { GetVestingFundsExported abi.MethodNum GetPeerIDExported abi.MethodNum GetMultiaddrsExported abi.MethodNum - ProveCommitSectors2 abi.MethodNum - ProveReplicaUpdates3 abi.MethodNum + // MovePartitionsExported abi.MethodNum + ProveCommitSectors2 abi.MethodNum + ProveReplicaUpdates3 abi.MethodNum }{ MethodConstructor, 2, @@ -281,8 +289,9 @@ var MethodsMiner = struct { MustGenerateFRCMethodNum("GetVestingFunds"), MustGenerateFRCMethodNum("GetPeerID"), MustGenerateFRCMethodNum("GetMultiaddrs"), - 33, + // MovePartitions: 33, 34, + 35, } var MethodsVerifiedRegistry = struct { diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 70e73cc4..232d376f 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -126,6 +126,7 @@ func main() { market.GetDealTermReturn{}, market.GetDealActivationReturn{}, market.OnMinerSectorsTerminateParams{}, + market.GetDealSectorReturn{}, // other types market.DealProposal{}, @@ -197,7 +198,7 @@ func main() { miner.PieceActivationManifest{}, miner.VerifiedAllocationKey{}, miner.DataActivationNotification{}, - miner.ProveCommit2Return{}, + miner.ProveCommitSectors2Return{}, miner.PieceActivationReturn{}, miner.DataActivationNotificationReturn{}, miner.BatchReturn{}, diff --git a/builtin/v13/market/market_types.go b/builtin/v13/market/market_types.go index 2519f682..e3328e21 100644 --- a/builtin/v13/market/market_types.go +++ b/builtin/v13/market/market_types.go @@ -132,3 +132,9 @@ type GetDealActivationReturn struct { // Epoch at which the deal was terminated abnormally, or -1. Terminated abi.ChainEpoch } + +type GetDealSectorParams = DealQueryParams + +type GetDealSectorReturn struct { + Sector abi.SectorNumber +} diff --git a/builtin/v13/market/methods.go b/builtin/v13/market/methods.go index 74773777..d0034c6d 100644 --- a/builtin/v13/market/methods.go +++ b/builtin/v13/market/methods.go @@ -4,6 +4,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/builtin/v13/miner" ) var Methods = map[abi.MethodNum]builtin.MethodMeta{ @@ -30,4 +31,6 @@ var Methods = map[abi.MethodNum]builtin.MethodMeta{ builtin.MustGenerateFRCMethodNum("GetDealProviderCollateral"): {"GetDealProviderCollateralExported", *new(func(*GetDealProviderCollateralParams) *GetDealProviderCollateralReturn)}, // GetDealProviderCollateralExported builtin.MustGenerateFRCMethodNum("GetDealVerified"): {"GetDealVerifiedExported", *new(func(*GetDealVerifiedParams) *GetDealVerifiedReturn)}, // GetDealVerifiedExported builtin.MustGenerateFRCMethodNum("GetDealActivation"): {"GetDealActivationExported", *new(func(*GetDealActivationParams) *GetDealActivationReturn)}, // GetDealActivationExported + builtin.MustGenerateFRCMethodNum("GetDealSector"): {"GetDealSectorExported", *new(func(*GetDealSectorParams) *GetDealSectorReturn)}, // GetDealSectorExported + builtin.MethodSectorContentChanged: {"SectorContentChanged", *new(func(*miner.SectorContentChangedParams) *miner.SectorContentChangedReturn)}, // SectorContentChanged } diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index ec812395..57073cf7 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -7083,7 +7083,7 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { var lengthBufProveCommit2Return = []byte{129} -func (t *ProveCommit2Return) MarshalCBOR(w io.Writer) error { +func (t *ProveCommitSectors2Return) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -7102,8 +7102,8 @@ func (t *ProveCommit2Return) MarshalCBOR(w io.Writer) error { return nil } -func (t *ProveCommit2Return) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveCommit2Return{} +func (t *ProveCommitSectors2Return) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommitSectors2Return{} cr := cbg.NewCborReader(r) diff --git a/builtin/v13/miner/methods.go b/builtin/v13/miner/methods.go index 848d60ff..3977ff62 100644 --- a/builtin/v13/miner/methods.go +++ b/builtin/v13/miner/methods.go @@ -59,4 +59,7 @@ var Methods = map[abi.MethodNum]builtin.MethodMeta{ builtin.MustGenerateFRCMethodNum("GetVestingFunds"): {"GetVestingFundsExported", *new(func(*abi.EmptyValue) *GetVestingFundsReturn)}, // GetVestingFundsExported builtin.MustGenerateFRCMethodNum("GetPeerID"): {"GetPeerIDExported", *new(func(*abi.EmptyValue) *GetPeerIDReturn)}, // GetPeerIDExported builtin.MustGenerateFRCMethodNum("GetMultiaddrs"): {"GetMultiaddrsExported", *new(func(*abi.EmptyValue) *GetMultiAddrsReturn)}, // GetMultiaddrsExported + // 33 MovePartitions + 34: {"ProveCommitSectors2", *new(func(*ProveCommitSectors2Params) ProveCommitSectors2Return)}, // ProveCommitSectors2 + 35: {"ProveReplicaUpdates3", *new(func(*ProveReplicaUpdates3Params) ProveReplicaUpdates3Return)}, // ProveReplicaUpdates3 } diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index 3d242a52..41bd884c 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -433,8 +433,8 @@ type DataActivationNotification struct { Payload []byte } -// ProveCommit2Return represents the return value for the ProveCommit2 function. -type ProveCommit2Return struct { +// ProveCommitSectors2Return represents the return value for the ProveCommit2 function. +type ProveCommitSectors2Return struct { Sectors BatchReturn } From b22c917e06f8437b8df149c787d9885e6e6b3dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 12:58:02 +0100 Subject: [PATCH 07/52] make gen --- builtin/v13/market/cbor_gen.go | 63 ++++++++++++++++++++++++++++++++++ builtin/v13/miner/cbor_gen.go | 4 +-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index 9fb6c5f2..8dd9a14e 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -1724,6 +1724,69 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return nil } +var lengthBufGetDealSectorReturn = []byte{129} + +func (t *GetDealSectorReturn) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufGetDealSectorReturn); err != nil { + return err + } + + // t.Sector (abi.SectorNumber) (uint64) + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Sector)); err != nil { + return err + } + + return nil +} + +func (t *GetDealSectorReturn) UnmarshalCBOR(r io.Reader) (err error) { + *t = GetDealSectorReturn{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Sector (abi.SectorNumber) (uint64) + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Sector = abi.SectorNumber(extra) + + } + return nil +} + var lengthBufDealProposal = []byte{139} func (t *DealProposal) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 57073cf7..6915b189 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -7081,7 +7081,7 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveCommit2Return = []byte{129} +var lengthBufProveCommitSectors2Return = []byte{129} func (t *ProveCommitSectors2Return) MarshalCBOR(w io.Writer) error { if t == nil { @@ -7091,7 +7091,7 @@ func (t *ProveCommitSectors2Return) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write(lengthBufProveCommit2Return); err != nil { + if _, err := cw.Write(lengthBufProveCommitSectors2Return); err != nil { return err } From 0e53b05f5e3a096a21c1533dad38224cab8c9636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 15:22:58 +0100 Subject: [PATCH 08/52] update Go to a less obsolete version --- .circleci/config.yml | 6 ++--- go.mod | 20 +++++++++++++- go.sum | 63 ++------------------------------------------ 3 files changed, 24 insertions(+), 65 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4358a8a..4f1b25a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: executors: golang: docker: - - image: circleci/golang:1.17 + - image: cimg/go:1.18 resource_class: small commands: @@ -59,7 +59,7 @@ jobs: - run: name: "Install goimports" command: | - cd / && go get golang.org/x/tools/cmd/goimports + cd / && go install golang.org/x/tools/cmd/goimports@latest - run: name: "Ensure we don't need to run 'make gen'" command: | @@ -90,7 +90,7 @@ jobs: default: golang golangci-lint-version: type: string - default: 1.42.1 + default: 1.55.2 concurrency: type: string default: '2' diff --git a/go.mod b/go.mod index 1c3fa5cf..b8070304 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/filecoin-project/go-state-types -go 1.13 +go 1.18 retract v0.12.7 // wrongfully skipped a patch version, use v0.12.6 or v0.12.8&^ @@ -25,3 +25,21 @@ require ( golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/filecoin-project/go-commp-utils v0.1.3 // indirect + github.com/filecoin-project/go-fil-commcid v0.1.0 // indirect + github.com/ipfs/go-ipfs-util v0.0.2 // indirect + github.com/ipfs/go-ipld-format v0.0.2 // indirect + github.com/klauspost/cpuid/v2 v2.2.3 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.0.3 // indirect + github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + golang.org/x/sys v0.1.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + lukechampine.com/blake3 v1.1.6 // indirect +) diff --git a/go.sum b/go.sum index a74d5f69..27677be0 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,13 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f h1:vg/6KEAOBjICMaWj+xofJCp09HYRfpO3ZbJsnJo22pA= github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f/go.mod h1:+If3s2VxyjZn+KGGZIoRXBDSFQ9xL404JBJGf4WhEj0= github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8= -github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8= github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE= github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA= github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs= -github.com/filecoin-project/go-amt-ipld/v4 v4.0.0/go.mod h1:gF053YQ4BIpzTNDoEwHZas7U3oAwncDVGvOHyY8oDpE= github.com/filecoin-project/go-amt-ipld/v4 v4.2.0 h1:DQTXQwMXxaetd+lhZGODjt5qC1WYT7tMAlYrWqI/fwI= github.com/filecoin-project/go-amt-ipld/v4 v4.2.0/go.mod h1:0eDVF7pROvxrsxvLJx+SJZXqRaXXcEPUcgb/rG0zGU4= github.com/filecoin-project/go-bitfield v0.2.0/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= @@ -33,16 +29,12 @@ github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.m github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20200904021452-1883f36ca2f4/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= -github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/specs-actors v0.9.4 h1:FePB+hrctHHiTbmaY4hnvBJzfgckN3eJreUZWpS5yks= github.com/filecoin-project/specs-actors v0.9.4/go.mod h1:BStZQzx5x7TmCkLv0Bpa07U6cPKol6fd3w9KjMPZ6Z4= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= @@ -59,7 +51,6 @@ github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67Fexh github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= github.com/ipfs/go-hamt-ipld v0.1.1/go.mod h1:1EZCr2v0jlCnhpa+aZ0JZYp8Tt2w16+JJOAVz17YcDk= @@ -67,8 +58,6 @@ github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyB github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= github.com/ipfs/go-ipld-cbor v0.0.4/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4= -github.com/ipfs/go-ipld-cbor v0.0.5/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4= -github.com/ipfs/go-ipld-cbor v0.0.6-0.20211211231443-5d9b9e1f6fa8/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA= github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eBQ0= github.com/ipfs/go-ipld-cbor v0.0.6/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA= github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= @@ -88,24 +77,19 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7 github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= @@ -121,12 +105,10 @@ github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/g github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= github.com/multiformats/go-multicodec v0.6.0 h1:KhH2kSuCARyuJraYMFxrNO3DqIaYhOdS039kbhgVwpE= -github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= -github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg= github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= @@ -147,14 +129,12 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6O github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -165,23 +145,16 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tj/go-spin v1.1.0 h1:lhdWZsvImxvZ3q1C5OIB7d72DuOwP4O2NdBg9PyzNds= github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= -github.com/warpfork/go-testmark v0.10.0 h1:E86YlUMYfwIacEsQGlnTvjk1IgYkyTGjPhF0RnwTCmw= -github.com/warpfork/go-testmark v0.10.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0= github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= -github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W5MvapuoHRP8rz4vxjwCK1pDqF1aQcWsV5PZ+AHbqdg= github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20200723185710-6a3894a6352b/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20230923211252-36a87e1ba72f h1:SBuSxXJL0/ZJMtTxbXZgHZkThl9dNrzyaNhlyaqscRo= github.com/whyrusleeping/cbor-gen v0.0.0-20230923211252-36a87e1ba72f/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829 h1:wb7xrDzfkLgPHsSEBm+VSx6aDdi64VtV0xvP0E6j8bk= @@ -190,12 +163,10 @@ github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JL github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245/go.mod h1:C+diUUz7pxhNY6KAoLgrTYARGWnt82zWTylZlxT92vk= github.com/xorcare/golden v0.6.0/go.mod h1:7T39/ZMvaSEZlBPoYfVFmsBLmUl3uz9IuzWj/U6FtvQ= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= @@ -205,56 +176,29 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -262,9 +206,8 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d h1:F3OmlXCzYtG9YE6tXDnUOlJBzVzHF8EcmZ1yTJlcgIk= golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -279,11 +222,9 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= From 3fa8f868bf0a5c22c40e9f1cd4f8d5d2b1a43d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 15:40:06 +0100 Subject: [PATCH 09/52] fix new lint errors --- builtin/v10/util/math/ln.go | 2 +- builtin/v11/util/math/ln.go | 2 +- builtin/v12/util/math/ln.go | 2 +- builtin/v13/util/math/ln.go | 2 +- builtin/v8/util/math/ln.go | 2 +- builtin/v9/util/math/ln.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/v10/util/math/ln.go b/builtin/v10/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v10/util/math/ln.go +++ b/builtin/v10/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 diff --git a/builtin/v11/util/math/ln.go b/builtin/v11/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v11/util/math/ln.go +++ b/builtin/v11/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 diff --git a/builtin/v12/util/math/ln.go b/builtin/v12/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v12/util/math/ln.go +++ b/builtin/v12/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 diff --git a/builtin/v13/util/math/ln.go b/builtin/v13/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v13/util/math/ln.go +++ b/builtin/v13/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 diff --git a/builtin/v8/util/math/ln.go b/builtin/v8/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v8/util/math/ln.go +++ b/builtin/v8/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 diff --git a/builtin/v9/util/math/ln.go b/builtin/v9/util/math/ln.go index 4d21b23b..cd54c7e6 100644 --- a/builtin/v9/util/math/ln.go +++ b/builtin/v9/util/math/ln.go @@ -51,7 +51,7 @@ func init() { func Ln(z big.Int) big.Int { // bitlen - 1 - precision k := int64(z.BitLen()) - 1 - Precision128 // Q.0 - x := big.Zero() // nolint:ineffassign + var x big.Int if k > 0 { x = big.Rsh(z, uint(k)) // Q.128 From f48622c1b6c8f5133023aff5d9c5bbda1aa76500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 21:29:52 +0100 Subject: [PATCH 10/52] fix v13 miner types --- builtin/v13/miner/methods.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/v13/miner/methods.go b/builtin/v13/miner/methods.go index 3977ff62..2885f401 100644 --- a/builtin/v13/miner/methods.go +++ b/builtin/v13/miner/methods.go @@ -60,6 +60,6 @@ var Methods = map[abi.MethodNum]builtin.MethodMeta{ builtin.MustGenerateFRCMethodNum("GetPeerID"): {"GetPeerIDExported", *new(func(*abi.EmptyValue) *GetPeerIDReturn)}, // GetPeerIDExported builtin.MustGenerateFRCMethodNum("GetMultiaddrs"): {"GetMultiaddrsExported", *new(func(*abi.EmptyValue) *GetMultiAddrsReturn)}, // GetMultiaddrsExported // 33 MovePartitions - 34: {"ProveCommitSectors2", *new(func(*ProveCommitSectors2Params) ProveCommitSectors2Return)}, // ProveCommitSectors2 - 35: {"ProveReplicaUpdates3", *new(func(*ProveReplicaUpdates3Params) ProveReplicaUpdates3Return)}, // ProveReplicaUpdates3 + 34: {"ProveCommitSectors2", *new(func(*ProveCommitSectors2Params) *ProveCommitSectors2Return)}, // ProveCommitSectors2 + 35: {"ProveReplicaUpdates3", *new(func(*ProveReplicaUpdates3Params) *ProveReplicaUpdates3Return)}, // ProveReplicaUpdates3 } From b448fa93a37e75b06122f3e0436ee6851c11c39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2023 22:23:08 +0100 Subject: [PATCH 11/52] v13: apparently some types use transparent serde --- builtin/v13/gen/gen.go | 5 - builtin/v13/miner/cbor_gen.go | 402 ------------------------------- builtin/v13/miner/miner_types.go | 20 +- 3 files changed, 5 insertions(+), 422 deletions(-) diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 232d376f..132c9f13 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -198,7 +198,6 @@ func main() { miner.PieceActivationManifest{}, miner.VerifiedAllocationKey{}, miner.DataActivationNotification{}, - miner.ProveCommitSectors2Return{}, miner.PieceActivationReturn{}, miner.DataActivationNotificationReturn{}, miner.BatchReturn{}, @@ -206,12 +205,8 @@ func main() { miner.ProveReplicaUpdates3Params{}, miner.SectorUpdateManifest{}, miner.ProveReplicaUpdates3Return{}, - miner.SectorContentChangedParams{}, miner.SectorChanges{}, miner.PieceChange{}, - miner.SectorContentChangedReturn{}, - miner.SectorReturn{}, - miner.PieceReturn{}, // other types miner.FaultDeclaration{}, miner.RecoveryDeclaration{}, diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 6915b189..5fc6dbb4 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -7081,62 +7081,6 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveCommitSectors2Return = []byte{129} - -func (t *ProveCommitSectors2Return) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufProveCommitSectors2Return); err != nil { - return err - } - - // t.Sectors (miner.BatchReturn) (struct) - if err := t.Sectors.MarshalCBOR(cw); err != nil { - return err - } - return nil -} - -func (t *ProveCommitSectors2Return) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveCommitSectors2Return{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Sectors (miner.BatchReturn) (struct) - - { - - if err := t.Sectors.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Sectors: %w", err) - } - - } - return nil -} - var lengthBufPieceActivationReturn = []byte{130} func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { @@ -8121,100 +8065,6 @@ func (t *ProveReplicaUpdates3Return) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufSectorContentChangedParams = []byte{129} - -func (t *SectorContentChangedParams) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufSectorContentChangedParams); err != nil { - return err - } - - // t.Sectors ([]miner.SectorChanges) (slice) - if len(t.Sectors) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Sectors was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { - return err - } - for _, v := range t.Sectors { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *SectorContentChangedParams) UnmarshalCBOR(r io.Reader) (err error) { - *t = SectorContentChangedParams{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Sectors ([]miner.SectorChanges) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Sectors: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Sectors = make([]SectorChanges, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - if err := t.Sectors[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Sectors[i]: %w", err) - } - - } - } - } - - return nil -} - var lengthBufSectorChanges = []byte{131} func (t *SectorChanges) MarshalCBOR(w io.Writer) error { @@ -8479,258 +8329,6 @@ func (t *PieceChange) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufSectorContentChangedReturn = []byte{129} - -func (t *SectorContentChangedReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufSectorContentChangedReturn); err != nil { - return err - } - - // t.Sectors ([]miner.SectorReturn) (slice) - if len(t.Sectors) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Sectors was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Sectors))); err != nil { - return err - } - for _, v := range t.Sectors { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *SectorContentChangedReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = SectorContentChangedReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Sectors ([]miner.SectorReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Sectors: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Sectors = make([]SectorReturn, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - if err := t.Sectors[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Sectors[i]: %w", err) - } - - } - } - } - - return nil -} - -var lengthBufSectorReturn = []byte{129} - -func (t *SectorReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufSectorReturn); err != nil { - return err - } - - // t.Added ([]miner.PieceReturn) (slice) - if len(t.Added) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Added was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Added))); err != nil { - return err - } - for _, v := range t.Added { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - } - return nil -} - -func (t *SectorReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = SectorReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Added ([]miner.PieceReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Added: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Added = make([]PieceReturn, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - if err := t.Added[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Added[i]: %w", err) - } - - } - } - } - - return nil -} - -var lengthBufPieceReturn = []byte{129} - -func (t *PieceReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufPieceReturn); err != nil { - return err - } - - // t.Accepted (bool) (bool) - if err := cbg.WriteBool(w, t.Accepted); err != nil { - return err - } - return nil -} - -func (t *PieceReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = PieceReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Accepted (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.Accepted = false - case 21: - t.Accepted = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - return nil -} - var lengthBufFaultDeclaration = []byte{131} func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index 41bd884c..650ca5a4 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -434,9 +434,7 @@ type DataActivationNotification struct { } // ProveCommitSectors2Return represents the return value for the ProveCommit2 function. -type ProveCommitSectors2Return struct { - Sectors BatchReturn -} +type ProveCommitSectors2Return = BatchReturn type BatchReturn struct { SuccessCount uint64 @@ -487,9 +485,7 @@ type ProveReplicaUpdates3Return struct { } // SectorContentChangedParams represents a notification of change committed to sectors. -type SectorContentChangedParams struct { - Sectors []SectorChanges -} +type SectorContentChangedParams = []SectorChanges // SectorChanges describes changes to one sector's content. type SectorChanges struct { @@ -506,16 +502,10 @@ type PieceChange struct { } // SectorContentChangedReturn represents the return value for the SectorContentChanged function. -type SectorContentChangedReturn struct { - Sectors []SectorReturn -} +type SectorContentChangedReturn = []SectorReturn // SectorReturn represents a result for each sector that was notified. -type SectorReturn struct { - Added []PieceReturn -} +type SectorReturn = []PieceReturn // PieceReturn represents a result for each piece for the sector that was notified. -type PieceReturn struct { - Accepted bool -} +type PieceReturn = bool // Accepted = true From 7de5fbb815c65885fa6be5262421e8d66d6558dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Jan 2024 17:23:00 +0100 Subject: [PATCH 12/52] v13: miner: Prove*2 -> Prove*3 --- builtin/methods.go | 2 +- builtin/v13/gen/gen.go | 3 +- builtin/v13/miner/cbor_gen.go | 66 +++----------------------------- builtin/v13/miner/methods.go | 2 +- builtin/v13/miner/miner_types.go | 12 +++--- 5 files changed, 13 insertions(+), 72 deletions(-) diff --git a/builtin/methods.go b/builtin/methods.go index 10c94a03..f4bd10a8 100644 --- a/builtin/methods.go +++ b/builtin/methods.go @@ -239,7 +239,7 @@ var MethodsMiner = struct { GetPeerIDExported abi.MethodNum GetMultiaddrsExported abi.MethodNum // MovePartitionsExported abi.MethodNum - ProveCommitSectors2 abi.MethodNum + ProveCommitSectors3 abi.MethodNum ProveReplicaUpdates3 abi.MethodNum }{ MethodConstructor, diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 132c9f13..0d926851 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -193,7 +193,7 @@ func main() { miner.GetOwnerReturn{}, miner.GetPeerIDReturn{}, miner.GetMultiAddrsReturn{}, - miner.ProveCommitSectors2Params{}, + miner.ProveCommitSectors3Params{}, miner.SectorActivationManifest{}, miner.PieceActivationManifest{}, miner.VerifiedAllocationKey{}, @@ -204,7 +204,6 @@ func main() { miner.FailCode{}, miner.ProveReplicaUpdates3Params{}, miner.SectorUpdateManifest{}, - miner.ProveReplicaUpdates3Return{}, miner.SectorChanges{}, miner.PieceChange{}, // other types diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 5fc6dbb4..27baf88a 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -6394,9 +6394,9 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveCommitSectors2Params = []byte{133} +var lengthBufProveCommitSectors3Params = []byte{133} -func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { +func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err @@ -6404,7 +6404,7 @@ func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) - if _, err := cw.Write(lengthBufProveCommitSectors2Params); err != nil { + if _, err := cw.Write(lengthBufProveCommitSectors3Params); err != nil { return err } @@ -6469,8 +6469,8 @@ func (t *ProveCommitSectors2Params) MarshalCBOR(w io.Writer) error { return nil } -func (t *ProveCommitSectors2Params) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveCommitSectors2Params{} +func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { + *t = ProveCommitSectors3Params{} cr := cbg.NewCborReader(r) @@ -8009,62 +8009,6 @@ func (t *SectorUpdateManifest) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveReplicaUpdates3Return = []byte{129} - -func (t *ProveReplicaUpdates3Return) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufProveReplicaUpdates3Return); err != nil { - return err - } - - // t.ActivationResults (miner.BatchReturn) (struct) - if err := t.ActivationResults.MarshalCBOR(cw); err != nil { - return err - } - return nil -} - -func (t *ProveReplicaUpdates3Return) UnmarshalCBOR(r io.Reader) (err error) { - *t = ProveReplicaUpdates3Return{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.ActivationResults (miner.BatchReturn) (struct) - - { - - if err := t.ActivationResults.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.ActivationResults: %w", err) - } - - } - return nil -} - var lengthBufSectorChanges = []byte{131} func (t *SectorChanges) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/miner/methods.go b/builtin/v13/miner/methods.go index 2885f401..7f33f42f 100644 --- a/builtin/v13/miner/methods.go +++ b/builtin/v13/miner/methods.go @@ -60,6 +60,6 @@ var Methods = map[abi.MethodNum]builtin.MethodMeta{ builtin.MustGenerateFRCMethodNum("GetPeerID"): {"GetPeerIDExported", *new(func(*abi.EmptyValue) *GetPeerIDReturn)}, // GetPeerIDExported builtin.MustGenerateFRCMethodNum("GetMultiaddrs"): {"GetMultiaddrsExported", *new(func(*abi.EmptyValue) *GetMultiAddrsReturn)}, // GetMultiaddrsExported // 33 MovePartitions - 34: {"ProveCommitSectors2", *new(func(*ProveCommitSectors2Params) *ProveCommitSectors2Return)}, // ProveCommitSectors2 + 34: {"ProveCommitSectors3", *new(func(*ProveCommitSectors3Params) *ProveCommitSectors3Return)}, // ProveCommitSectors3 35: {"ProveReplicaUpdates3", *new(func(*ProveReplicaUpdates3Params) *ProveReplicaUpdates3Return)}, // ProveReplicaUpdates3 } diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index 650ca5a4..d91b2789 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -395,8 +395,8 @@ type GetMultiAddrsReturn struct { MultiAddrs []byte } -// ProveCommitSectors2Params represents the parameters for proving committed sectors. -type ProveCommitSectors2Params struct { +// ProveCommitSectors3Params represents the parameters for proving committed sectors. +type ProveCommitSectors3Params struct { SectorActivations []SectorActivationManifest SectorProofs [][]byte AggregateProof []byte @@ -433,8 +433,8 @@ type DataActivationNotification struct { Payload []byte } -// ProveCommitSectors2Return represents the return value for the ProveCommit2 function. -type ProveCommitSectors2Return = BatchReturn +// ProveCommitSectors3Return represents the return value for the ProveCommit2 function. +type ProveCommitSectors3Return = BatchReturn type BatchReturn struct { SuccessCount uint64 @@ -480,9 +480,7 @@ type SectorUpdateManifest struct { } // ProveReplicaUpdates3Return represents the return value for the ProveReplicaUpdates3 function. -type ProveReplicaUpdates3Return struct { - ActivationResults BatchReturn -} +type ProveReplicaUpdates3Return = BatchReturn // SectorContentChangedParams represents a notification of change committed to sectors. type SectorContentChangedParams = []SectorChanges From 575a3b6a06dc5d52ca58be91cfab13e4738b8f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Jan 2024 22:05:08 +0100 Subject: [PATCH 13/52] v13: ddo market migration --- builtin/v13/gen/gen.go | 1 + builtin/v13/market/cbor_gen.go | 101 ++++++++++++++++++ builtin/v13/market/deal.go | 2 +- builtin/v13/market/market_state.go | 1 + builtin/v13/market/market_types.go | 4 + builtin/v13/migration/market.go | 163 +++++++++++++++++++++++++++++ builtin/v13/migration/miner.go | 105 +++++++++++++++++++ builtin/v13/migration/top.go | 47 ++++++++- migration/runner.go | 69 +++++++++++- migration/util.go | 42 ++++++++ 10 files changed, 532 insertions(+), 3 deletions(-) create mode 100644 builtin/v13/migration/market.go create mode 100644 builtin/v13/migration/miner.go diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 0d926851..07a06e06 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -113,6 +113,7 @@ func main() { // actor state market.State{}, market.DealState{}, + market.SectorDealIDs{}, // method params and returns market.WithdrawBalanceParams{}, market.PublishStorageDealsParams{}, diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index 8dd9a14e..22e6eff7 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -475,6 +475,107 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { return nil } +var lengthBufSectorDealIDs = []byte{129} + +func (t *SectorDealIDs) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write(lengthBufSectorDealIDs); err != nil { + return err + } + + // t.Deals ([]abi.DealID) (slice) + if len(t.Deals) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Deals was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Deals))); err != nil { + return err + } + for _, v := range t.Deals { + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(v)); err != nil { + return err + } + + } + return nil +} + +func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { + *t = SectorDealIDs{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.Deals ([]abi.DealID) (slice) + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Deals: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Deals = make([]abi.DealID, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Deals[i] = abi.DealID(extra) + + } + } + } + + return nil +} + var lengthBufWithdrawBalanceParams = []byte{130} func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/market/deal.go b/builtin/v13/market/deal.go index 1ab486c5..0b19ae84 100644 --- a/builtin/v13/market/deal.go +++ b/builtin/v13/market/deal.go @@ -26,7 +26,7 @@ var PieceCIDPrefix = cid.Prefix{ } type DealState struct { - SectorNumber abi.SectorNumber // todo verify this + SectorNumber abi.SectorNumber // 0 if not yet included in proven sector (0 is also a valid sector number) SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated SlashEpoch abi.ChainEpoch // -1 if deal never slashed diff --git a/builtin/v13/market/market_state.go b/builtin/v13/market/market_state.go index 4209e464..49c9219f 100644 --- a/builtin/v13/market/market_state.go +++ b/builtin/v13/market/market_state.go @@ -19,6 +19,7 @@ const EpochUndefined = abi.ChainEpoch(-1) // Bitwidth of AMTs determined empirically from mutation patterns and projections of mainnet data. const ProposalsAmtBitwidth = 5 const StatesAmtBitwidth = 6 +const ProviderSectorsHamtBitwidth = 5 type State struct { // Proposals are deals that have been proposed and not yet cleaned up after expiry or termination. diff --git a/builtin/v13/market/market_types.go b/builtin/v13/market/market_types.go index e3328e21..5b058b86 100644 --- a/builtin/v13/market/market_types.go +++ b/builtin/v13/market/market_types.go @@ -11,6 +11,10 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v13/verifreg" ) +type SectorDealIDs struct { + Deals []abi.DealID +} + type WithdrawBalanceParams struct { ProviderOrClientAddress addr.Address Amount abi.TokenAmount diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go new file mode 100644 index 00000000..e5889ce3 --- /dev/null +++ b/builtin/v13/migration/market.go @@ -0,0 +1,163 @@ +package migration + +import ( + "context" + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" + market13 "github.com/filecoin-project/go-state-types/builtin/v13/market" + miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner" + "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/migration" + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "golang.org/x/xerrors" +) + +type marketMigrator struct { + providerSectors *providerSectors + OutCodeCID cid.Cid +} + +func newMarketMigrator(ctx context.Context, store cbor.IpldStore, outCode cid.Cid, ps *providerSectors) (*marketMigrator, error) { + return &marketMigrator{ + providerSectors: ps, + OutCodeCID: outCode, + }, nil +} + +func (m *marketMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput) (result *migration.ActorMigrationResult, err error) { + var inState market12.State + if err := store.Get(ctx, in.Head, &inState); err != nil { + return nil, xerrors.Errorf("failed to load market state for %s: %w", in.Address, err) + } + + providerSectors, newStates, err := m.migrateProviderSectorsAndStates(ctx, store, inState.States) + if err != nil { + return nil, xerrors.Errorf("failed to migrate provider sectors: %w", err) + } + + outState := market13.State{ + Proposals: inState.Proposals, + States: newStates, + PendingProposals: inState.PendingProposals, + EscrowTable: inState.EscrowTable, + LockedTable: inState.LockedTable, + NextID: inState.NextID, + DealOpsByEpoch: inState.DealOpsByEpoch, + LastCron: inState.LastCron, + TotalClientLockedCollateral: inState.TotalClientLockedCollateral, + TotalProviderLockedCollateral: inState.TotalProviderLockedCollateral, + TotalClientStorageFee: inState.TotalClientStorageFee, + PendingDealAllocationIds: inState.PendingDealAllocationIds, + ProviderSectors: providerSectors, + } + + newHead, err := store.Put(ctx, &outState) + if err != nil { + return nil, xerrors.Errorf("failed to put new state: %w", err) + } + + return &migration.ActorMigrationResult{ + NewCodeCID: m.MigratedCodeCID(), + NewHead: newHead, + }, nil +} + +func (m *marketMigrator) MigratedCodeCID() cid.Cid { + return m.OutCodeCID +} + +func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, states cid.Cid) (cid.Cid, cid.Cid, error) { + + // out HAMT[Address]HAMT[SectorNumber]SectorDealIDs + ctxStore := adt.WrapStore(ctx, store) + + oldStateArray, err := adt.AsArray(ctxStore, states, market12.StatesAmtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load states array: %w", err) + } + + newStateArray, err := adt.AsArray(ctxStore, states, market13.StatesAmtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load states array: %w", err) + } + + providerSectorsMem := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} + + var oldState market12.DealState + var newState market13.DealState + err = oldStateArray.ForEach(&oldState, func(i int64) error { + deal := abi.DealID(i) + + newState.SlashEpoch = oldState.SlashEpoch + newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch + newState.SectorStartEpoch = oldState.SectorStartEpoch + newState.SectorNumber = 0 // terminated / not found (?) + + if oldState.SlashEpoch == -1 { + sid, ok := m.providerSectors.dealToSector[deal] + if ok { + newState.SectorNumber = sid.Number + } + + if _, ok := providerSectorsMem[sid.Miner]; !ok { + providerSectorsMem[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + } + providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) + } + + if err := newStateArray.AppendContinuous(&newState); err != nil { + return xerrors.Errorf("failed to append new state: %w", err) + } + + return nil + }) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to iterate states: %w", err) + } + + newStateArrayRoot, err := newStateArray.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get newStateArrayRoot: %w", err) + } + + outProviderSectors, err := adt.MakeEmptyMap(ctxStore, market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to create empty map: %w", err) + } + + for miner, sectors := range providerSectorsMem { + actorSectors, err := adt.MakeEmptyMap(ctxStore, market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to create empty map: %w", err) + } + + var sectorDealIDs market13.SectorDealIDs + for sector, deals := range sectors { + sectorDealIDs.Deals = deals + + if err := actorSectors.Put(miner13.SectorKey(sector), §orDealIDs); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to put sector: %w", err) + } + } + + maddr, err := address.NewIDAddress(uint64(miner)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to convert miner ID to address: %w", err) + } + + if err := outProviderSectors.Put(abi.AddrKey(maddr), actorSectors); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to put actor sectors: %w", err) + } + } + + providerSectorsRoot, err := outProviderSectors.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get providerSectorsRoot: %w", err) + } + + return providerSectorsRoot, newStateArrayRoot, nil +} + +var _ migration.ActorMigration = (*marketMigrator)(nil) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go new file mode 100644 index 00000000..cf415084 --- /dev/null +++ b/builtin/v13/migration/miner.go @@ -0,0 +1,105 @@ +package migration + +import ( + "context" + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner" + "github.com/filecoin-project/go-state-types/builtin/v13/miner" + "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" + "github.com/filecoin-project/go-state-types/migration" + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "golang.org/x/xerrors" + "sync" +) + +type providerSectors struct { + lk sync.Mutex + + //providerSectors map[address.Address]cid.Cid // HAMT[SectorNumber]SectorDealIDs + dealToSector map[abi.DealID]abi.SectorID + minerToSectorDeals map[address.Address]map[abi.SectorNumber][]abi.DealID +} + +// minerMigration is technically a no-op, but it collects a cache for market migration +type minerMigrator struct { + providerSectors *providerSectors + + OutCodeCID cid.Cid +} + +func newMinerMigrator(ctx context.Context, store cbor.IpldStore, outCode cid.Cid, ps *providerSectors) (*minerMigrator, error) { + return &minerMigrator{ + providerSectors: ps, + + OutCodeCID: outCode, + }, nil +} + +func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput) (result *migration.ActorMigrationResult, err error) { + var inState miner12.State + if err := store.Get(ctx, in.Head, &inState); err != nil { + return nil, xerrors.Errorf("failed to load miner state for %s: %w", in.Address, err) + } + + ctxStore := adt.WrapStore(ctx, store) + + sa, err := adt.AsArray(ctxStore, inState.Sectors, miner.SectorsAmtBitwidth) + if err != nil { + return nil, xerrors.Errorf("failed to load sectors array: %w", err) + } + + var sector miner.SectorOnChainInfo + + mid, err := address.IDFromAddress(in.Address) + if err != nil { + return nil, xerrors.Errorf("failed to get miner ID: %w", err) + } + + err = sa.ForEach(§or, func(i int64) error { + if len(sector.DealIDs) == 0 { + return nil + } + + m.providerSectors.lk.Lock() + for _, dealID := range sector.DealIDs { + m.providerSectors.dealToSector[dealID] = abi.SectorID{ + Miner: abi.ActorID(mid), + Number: abi.SectorNumber(i), + } + if _, ok := m.providerSectors.minerToSectorDeals[in.Address]; !ok { + m.providerSectors.minerToSectorDeals[in.Address] = make(map[abi.SectorNumber][]abi.DealID) + } + m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber] = append(m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber], dealID) + } + + _, ok := m.providerSectors.minerToSectorDeals[in.Address] + if !ok { + m.providerSectors.minerToSectorDeals[in.Address] = make(map[abi.SectorNumber][]abi.DealID) + } + + dealIDsCopy := make([]abi.DealID, len(sector.DealIDs)) + copy(dealIDsCopy, sector.DealIDs) + + m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber] = dealIDsCopy + + m.providerSectors.lk.Unlock() + + return nil + }) + if err != nil { + return nil, xerrors.Errorf("failed to iterate sectors: %w", err) + } + + return &migration.ActorMigrationResult{ + NewCodeCID: m.MigratedCodeCID(), + NewHead: in.Head, + }, nil +} + +func (m *minerMigrator) MigratedCodeCID() cid.Cid { + return m.OutCodeCID +} + +var _ migration.ActorMigration = (*minerMigrator)(nil) diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go index c909dc75..3c158683 100644 --- a/builtin/v13/migration/top.go +++ b/builtin/v13/migration/top.go @@ -2,7 +2,7 @@ package migration import ( "context" - + "github.com/filecoin-project/go-address" adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" system12 "github.com/filecoin-project/go-state-types/builtin/v12/system" @@ -67,7 +67,16 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID // Set of prior version code CIDs for actors to defer during iteration, for explicit migration afterwards. deferredCodeIDs := make(map[cid.Cid]struct{}) + market12Cid := cid.Undef + miner12Cid := cid.Undef + for _, oldEntry := range oldManifestData.Entries { + if oldEntry.Name == manifest.MarketKey { + market12Cid = oldEntry.Code + } + if oldEntry.Name == manifest.MinerKey { + miner12Cid = oldEntry.Code + } newCodeCID, ok := newManifest.Get(oldEntry.Name) if !ok { return cid.Undef, xerrors.Errorf("code cid for %s actor not found in new manifest", oldEntry.Name) @@ -77,6 +86,8 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID // migrations that migrate both code and state, override entries in `migrations` + deferred := migration.NewDeferredMigrationSet() + // The System Actor newSystemCodeCID, ok := newManifest.Get(manifest.SystemKey) @@ -90,6 +101,40 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) } + // Miner actors + miner13Cid, ok := newManifest.Get(manifest.MinerKey) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for miner actor not found in new manifest") + } + + ps := &providerSectors{ + dealToSector: map[abi.DealID]abi.SectorID{}, + minerToSectorDeals: map[address.Address]map[abi.SectorNumber][]abi.DealID{}, + } + + minerMig, err := newMinerMigrator(ctx, store, miner13Cid, ps) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to create miner migrator: %w", err) + } + + migrations[miner12Cid] = migration.CachedMigration(cache, minerMig) + + // The Market Actor + market13Cid, ok := newManifest.Get(manifest.MarketKey) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for miner actor not found in new manifest") + } + + marketMig, err := newMarketMigrator(ctx, store, market13Cid, ps) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to create market migrator: %w", err) + } + migrations[market12Cid] = migration.NewDeferredMigrator(deferred, marketMig) // migration.CachedMigration(cache, marketMig) + + if len(migrations)+len(deferredCodeIDs) != len(oldManifestData.Entries) { + return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) + } + actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) if err != nil { return cid.Undef, xerrors.Errorf("failed to run migration: %w", err) diff --git a/migration/runner.go b/migration/runner.go index 518b7445..43e12bed 100644 --- a/migration/runner.go +++ b/migration/runner.go @@ -16,9 +16,26 @@ import ( "golang.org/x/xerrors" ) -func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store cbor.IpldStore, log Logger, actorsIn *builtin.ActorTree, migrations map[cid.Cid]ActorMigration) (*builtin.ActorTree, error) { +type migrationSettings struct { + deferred *DeferredMigrationSet +} + +type MigrationOption func(*migrationSettings) + +func WithDeferredMigrationSet(deferred *DeferredMigrationSet) MigrationOption { + return func(settings *migrationSettings) { + settings.deferred = deferred + } +} + +func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store cbor.IpldStore, log Logger, actorsIn *builtin.ActorTree, migrations map[cid.Cid]ActorMigration, opts ...MigrationOption) (*builtin.ActorTree, error) { startTime := time.Now() + settings := migrationSettings{} + for _, opt := range opts { + opt(&settings) + } + // Setup synchronization grp, ctx := errgroup.WithContext(ctx) // Input and output queues for workers. @@ -69,6 +86,10 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c for job := range jobCh { result, err := job.run(ctx, store) if err != nil { + if err == errMigrationDeferred { + atomic.AddUint32(&doneCount, 1) + continue + } return xerrors.Errorf("running job: %w", err) } select { @@ -144,6 +165,52 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c return nil, xerrors.Errorf("migration group error: %w", err) } + if settings.deferred != nil { + // deferred round + // NOTE this is not parralelized for now as this was only ever needed for singleton actor migrations + + log.Log(rt.INFO, "Running deferred migrations") + + for addr := range settings.deferred.todo { + log.Log(rt.INFO, "Running deferred migration for %s", addr) + + actorIn, found, err := actorsIn.GetActorV5(addr) + if err != nil { + return nil, xerrors.Errorf("failed to get actor %s: %w", addr, err) + } + + if !found { + return nil, xerrors.Errorf("failed to find actor %s", addr) + } + + actorMigration, ok := migrations[actorIn.Code] + if !ok { + return nil, xerrors.Errorf("actor with code %s has no registered migration function", actorIn.Code) + } + + dm, ok := actorMigration.(*DeferredMigrator) + if !ok { + return nil, xerrors.Errorf("actor with code %s has a migration which claims to be deferred but isn't", actorIn.Code) + } + + actorMigration = dm.sub + + res, err := (&migrationJob{ + Address: addr, + ActorV5: *actorIn, + ActorMigration: actorMigration, + cache: cache, + }).run(ctx, store) + if err != nil { + return nil, xerrors.Errorf("running deferred job: %w", err) + } + + if err := actorsOut.SetActorV5(res.Address, &res.ActorV5); err != nil { + return nil, xerrors.Errorf("error setting actor %s: %w", res.Address, err) + } + } + } + elapsed := time.Since(startTime) rate := float64(doneCount) / elapsed.Seconds() log.Log(rt.INFO, "All %d done after %v (%.0f/s)", doneCount, elapsed, rate) diff --git a/migration/util.go b/migration/util.go index 77a9fc08..17ccafd6 100644 --- a/migration/util.go +++ b/migration/util.go @@ -204,3 +204,45 @@ func CachedMigration(cache MigrationCache, m ActorMigration) ActorMigration { cache: cache, } } + +type DeferredMigrationSet struct { + todo map[address.Address]struct{} + lk sync.Mutex +} + +func NewDeferredMigrationSet() *DeferredMigrationSet { + return &DeferredMigrationSet{ + todo: make(map[address.Address]struct{}), + } +} + +type DeferredMigrator struct { + ds *DeferredMigrationSet + sub ActorMigration +} + +func NewDeferredMigrator(ds *DeferredMigrationSet, sub ActorMigration) *DeferredMigrator { + return &DeferredMigrator{ + ds: ds, + sub: sub, + } +} + +func (d DeferredMigrator) MigratedCodeCID() cid.Cid { + panic("this can't be called") +} + +var errMigrationDeferred = xerrors.Errorf("migration deferred") + +func (d DeferredMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in ActorMigrationInput) (*ActorMigrationResult, error) { + d.ds.lk.Lock() + defer d.ds.lk.Unlock() + + _, ok := d.ds.todo[in.Address] + if ok { + return nil, xerrors.Errorf("actor %s already in deferred set", in.Address) + } + d.ds.todo[in.Address] = struct{}{} + + return nil, errMigrationDeferred +} From 04392436b7838d75835bfeed4d9f37bb044f17cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Jan 2024 00:02:51 +0100 Subject: [PATCH 14/52] fix deferred migration --- migration/runner.go | 3 ++- migration/util.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/runner.go b/migration/runner.go index 43e12bed..7c4c78ff 100644 --- a/migration/runner.go +++ b/migration/runner.go @@ -2,6 +2,7 @@ package migration import ( "context" + "errors" "sync" "sync/atomic" "time" @@ -86,7 +87,7 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c for job := range jobCh { result, err := job.run(ctx, store) if err != nil { - if err == errMigrationDeferred { + if errors.Is(err, errMigrationDeferred) { atomic.AddUint32(&doneCount, 1) continue } diff --git a/migration/util.go b/migration/util.go index 17ccafd6..29db9b11 100644 --- a/migration/util.go +++ b/migration/util.go @@ -2,6 +2,7 @@ package migration import ( "context" + "errors" "sync" "time" @@ -232,7 +233,7 @@ func (d DeferredMigrator) MigratedCodeCID() cid.Cid { panic("this can't be called") } -var errMigrationDeferred = xerrors.Errorf("migration deferred") +var errMigrationDeferred = errors.New("migration deferred") func (d DeferredMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in ActorMigrationInput) (*ActorMigrationResult, error) { d.ds.lk.Lock() From 9941a911fb05556e3b895c09f3d56788ff954b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Jan 2024 00:11:41 +0100 Subject: [PATCH 15/52] v13: actually run deferred migrations --- builtin/v13/migration/top.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go index 3c158683..774e9ea9 100644 --- a/builtin/v13/migration/top.go +++ b/builtin/v13/migration/top.go @@ -135,7 +135,7 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) } - actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) + actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations, migration.WithDeferredMigrationSet(deferred)) if err != nil { return cid.Undef, xerrors.Errorf("failed to run migration: %w", err) } From 8092cb6e5b348683fda01d9eb224ec0488ad11b3 Mon Sep 17 00:00:00 2001 From: Aayush Date: Tue, 5 Dec 2023 11:42:16 -0500 Subject: [PATCH 16/52] feat: add simple nv22 migration --- builtin/v13/migration/system.go | 36 +++++++++++ builtin/v13/migration/top.go | 104 ++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 builtin/v13/migration/system.go create mode 100644 builtin/v13/migration/top.go diff --git a/builtin/v13/migration/system.go b/builtin/v13/migration/system.go new file mode 100644 index 00000000..76642730 --- /dev/null +++ b/builtin/v13/migration/system.go @@ -0,0 +1,36 @@ +package migration + +import ( + "context" + + system13 "github.com/filecoin-project/go-state-types/builtin/v13/system" + + "github.com/filecoin-project/go-state-types/migration" + + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" +) + +// System Actor migrator +type systemActorMigrator struct { + OutCodeCID cid.Cid + ManifestData cid.Cid +} + +func (m systemActorMigrator) MigratedCodeCID() cid.Cid { + return m.OutCodeCID +} + +func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput) (*migration.ActorMigrationResult, error) { + // The ManifestData itself is already in the blockstore + state := system13.State{BuiltinActors: m.ManifestData} + stateHead, err := store.Put(ctx, &state) + if err != nil { + return nil, err + } + + return &migration.ActorMigrationResult{ + NewCodeCID: m.OutCodeCID, + NewHead: stateHead, + }, nil +} diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go new file mode 100644 index 00000000..c909dc75 --- /dev/null +++ b/builtin/v13/migration/top.go @@ -0,0 +1,104 @@ +package migration + +import ( + "context" + + adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" + + system12 "github.com/filecoin-project/go-state-types/builtin/v12/system" + + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" + "github.com/filecoin-project/go-state-types/migration" + + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "golang.org/x/xerrors" +) + +// MigrateStateTree Migrates the filecoin state tree starting from the global state tree and upgrading all actor state. +// The store must support concurrent writes (even if the configured worker count is 1). +func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID cid.Cid, actorsRootIn cid.Cid, priorEpoch abi.ChainEpoch, cfg migration.Config, log migration.Logger, cache migration.MigrationCache) (cid.Cid, error) { + if cfg.MaxWorkers <= 0 { + return cid.Undef, xerrors.Errorf("invalid migration config with %d workers", cfg.MaxWorkers) + } + + adtStore := adt13.WrapStore(ctx, store) + + // Load input and output state trees + actorsIn, err := builtin.LoadTree(adtStore, actorsRootIn) + if err != nil { + return cid.Undef, xerrors.Errorf("loading state tree: %w", err) + } + + // load old manifest data + systemActor, ok, err := actorsIn.GetActorV5(builtin.SystemActorAddr) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to get system actor: %w", err) + } + + if !ok { + return cid.Undef, xerrors.New("didn't find system actor") + } + + var systemState system12.State + if err := store.Get(ctx, systemActor.Head, &systemState); err != nil { + return cid.Undef, xerrors.Errorf("failed to get system actor state: %w", err) + } + + var oldManifestData manifest.ManifestData + if err := store.Get(ctx, systemState.BuiltinActors, &oldManifestData); err != nil { + return cid.Undef, xerrors.Errorf("failed to get old manifest data: %w", err) + } + + // load new manifest + var newManifest manifest.Manifest + if err := adtStore.Get(ctx, newManifestCID, &newManifest); err != nil { + return cid.Undef, xerrors.Errorf("error reading actor manifest: %w", err) + } + + if err := newManifest.Load(ctx, adtStore); err != nil { + return cid.Undef, xerrors.Errorf("error loading actor manifest: %w", err) + } + + // Maps prior version code CIDs to migration functions. + migrations := make(map[cid.Cid]migration.ActorMigration) + // Set of prior version code CIDs for actors to defer during iteration, for explicit migration afterwards. + deferredCodeIDs := make(map[cid.Cid]struct{}) + + for _, oldEntry := range oldManifestData.Entries { + newCodeCID, ok := newManifest.Get(oldEntry.Name) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for %s actor not found in new manifest", oldEntry.Name) + } + migrations[oldEntry.Code] = migration.CachedMigration(cache, migration.CodeMigrator{OutCodeCID: newCodeCID}) + } + + // migrations that migrate both code and state, override entries in `migrations` + + // The System Actor + + newSystemCodeCID, ok := newManifest.Get(manifest.SystemKey) + if !ok { + return cid.Undef, xerrors.Errorf("code cid for system actor not found in new manifest") + } + + migrations[systemActor.Code] = systemActorMigrator{OutCodeCID: newSystemCodeCID, ManifestData: newManifest.Data} + + if len(migrations)+len(deferredCodeIDs) != len(oldManifestData.Entries) { + return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) + } + + actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to run migration: %w", err) + } + + outCid, err := actorsOut.Flush() + if err != nil { + return cid.Undef, xerrors.Errorf("failed to flush actorsOut: %w", err) + } + + return outCid, nil +} From d14906dff9425729c615d246fa458849af6bb5c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 24 Jan 2024 15:02:18 +0100 Subject: [PATCH 17/52] update cbor-gen --- builtin/v10/account/cbor_gen.go | 11 +- builtin/v10/cron/cbor_gen.go | 3 +- builtin/v10/datacap/cbor_gen.go | 33 +++-- builtin/v10/eam/cbor_gen.go | 18 +-- builtin/v10/evm/cbor_gen.go | 19 +-- builtin/v10/init/cbor_gen.go | 17 ++- builtin/v10/market/cbor_gen.go | 28 ++-- builtin/v10/miner/cbor_gen.go | 157 ++++++++++++++-------- builtin/v10/multisig/cbor_gen.go | 44 +++--- builtin/v10/paych/cbor_gen.go | 20 ++- builtin/v10/power/cbor_gen.go | 39 +++--- builtin/v10/verifreg/cbor_gen.go | 39 +++--- builtin/v11/account/cbor_gen.go | 11 +- builtin/v11/cron/cbor_gen.go | 3 +- builtin/v11/datacap/cbor_gen.go | 33 +++-- builtin/v11/eam/cbor_gen.go | 18 +-- builtin/v11/evm/cbor_gen.go | 19 +-- builtin/v11/init/cbor_gen.go | 17 ++- builtin/v11/market/cbor_gen.go | 28 ++-- builtin/v11/miner/cbor_gen.go | 157 ++++++++++++++-------- builtin/v11/multisig/cbor_gen.go | 44 +++--- builtin/v11/paych/cbor_gen.go | 20 ++- builtin/v11/power/cbor_gen.go | 39 +++--- builtin/v11/verifreg/cbor_gen.go | 39 +++--- builtin/v12/account/cbor_gen.go | 11 +- builtin/v12/cron/cbor_gen.go | 3 +- builtin/v12/datacap/cbor_gen.go | 33 +++-- builtin/v12/eam/cbor_gen.go | 18 +-- builtin/v12/evm/cbor_gen.go | 19 +-- builtin/v12/init/cbor_gen.go | 17 ++- builtin/v12/market/cbor_gen.go | 21 +-- builtin/v12/miner/cbor_gen.go | 157 ++++++++++++++-------- builtin/v12/multisig/cbor_gen.go | 44 +++--- builtin/v12/paych/cbor_gen.go | 20 ++- builtin/v12/power/cbor_gen.go | 39 +++--- builtin/v12/verifreg/cbor_gen.go | 39 +++--- builtin/v13/account/cbor_gen.go | 11 +- builtin/v13/cron/cbor_gen.go | 3 +- builtin/v13/datacap/cbor_gen.go | 33 +++-- builtin/v13/eam/cbor_gen.go | 18 +-- builtin/v13/evm/cbor_gen.go | 19 +-- builtin/v13/init/cbor_gen.go | 17 ++- builtin/v13/market/cbor_gen.go | 23 ++-- builtin/v13/miner/cbor_gen.go | 223 +++++++++++++++++++------------ builtin/v13/multisig/cbor_gen.go | 44 +++--- builtin/v13/paych/cbor_gen.go | 20 ++- builtin/v13/power/cbor_gen.go | 39 +++--- builtin/v13/verifreg/cbor_gen.go | 39 +++--- builtin/v8/cron/cbor_gen.go | 3 +- builtin/v8/init/cbor_gen.go | 6 +- builtin/v8/market/cbor_gen.go | 25 ++-- builtin/v8/miner/cbor_gen.go | 121 ++++++++++------- builtin/v8/multisig/cbor_gen.go | 44 +++--- builtin/v8/paych/cbor_gen.go | 20 ++- builtin/v8/power/cbor_gen.go | 39 +++--- builtin/v9/account/cbor_gen.go | 11 +- builtin/v9/cron/cbor_gen.go | 3 +- builtin/v9/datacap/cbor_gen.go | 33 +++-- builtin/v9/init/cbor_gen.go | 6 +- builtin/v9/market/cbor_gen.go | 28 ++-- builtin/v9/miner/cbor_gen.go | 145 ++++++++++++-------- builtin/v9/multisig/cbor_gen.go | 44 +++--- builtin/v9/paych/cbor_gen.go | 20 ++- builtin/v9/power/cbor_gen.go | 39 +++--- builtin/v9/verifreg/cbor_gen.go | 39 +++--- go.mod | 2 +- go.sum | 4 +- 67 files changed, 1470 insertions(+), 928 deletions(-) diff --git a/builtin/v10/account/cbor_gen.go b/builtin/v10/account/cbor_gen.go index b76ca4dd..4a49915b 100644 --- a/builtin/v10/account/cbor_gen.go +++ b/builtin/v10/account/cbor_gen.go @@ -97,7 +97,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Signature[:]); err != nil { + if _, err := cw.Write(t.Signature); err != nil { return err } @@ -110,9 +110,10 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Message[:]); err != nil { + if _, err := cw.Write(t.Message); err != nil { return err } + return nil } @@ -157,9 +158,10 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Signature = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Signature[:]); err != nil { + if _, err := io.ReadFull(cr, t.Signature); err != nil { return err } + // t.Message ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -178,8 +180,9 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Message = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Message[:]); err != nil { + if _, err := io.ReadFull(cr, t.Message); err != nil { return err } + return nil } diff --git a/builtin/v10/cron/cbor_gen.go b/builtin/v10/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v10/cron/cbor_gen.go +++ b/builtin/v10/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v10/datacap/cbor_gen.go b/builtin/v10/datacap/cbor_gen.go index fcc5f700..4f61008b 100644 --- a/builtin/v10/datacap/cbor_gen.go +++ b/builtin/v10/datacap/cbor_gen.go @@ -238,6 +238,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -318,9 +319,9 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -357,9 +358,10 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -422,9 +424,10 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -531,9 +534,10 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -596,9 +600,10 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -635,9 +640,10 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -700,9 +706,10 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -744,9 +751,10 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -818,9 +826,10 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -862,9 +871,10 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -936,9 +946,10 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } diff --git a/builtin/v10/eam/cbor_gen.go b/builtin/v10/eam/cbor_gen.go index e8e569e9..368a14e0 100644 --- a/builtin/v10/eam/cbor_gen.go +++ b/builtin/v10/eam/cbor_gen.go @@ -42,7 +42,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -96,9 +96,10 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Nonce (uint64) (uint64) { @@ -225,13 +226,11 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -261,7 +260,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -321,9 +320,10 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Salt ([32]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -337,13 +337,11 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.Salt = [32]uint8{} - if _, err := io.ReadFull(cr, t.Salt[:]); err != nil { return err } @@ -459,13 +457,11 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -581,13 +577,11 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } diff --git a/builtin/v10/evm/cbor_gen.go b/builtin/v10/evm/cbor_gen.go index 0daf048d..f0b0a7b8 100644 --- a/builtin/v10/evm/cbor_gen.go +++ b/builtin/v10/evm/cbor_gen.go @@ -202,13 +202,11 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.BytecodeHash = [32]uint8{} - if _, err := io.ReadFull(cr, t.BytecodeHash[:]); err != nil { return err } @@ -296,9 +294,10 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } + return nil } @@ -338,13 +337,11 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Creator = [20]uint8{} - if _, err := io.ReadFull(cr, t.Creator[:]); err != nil { return err } @@ -366,9 +363,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + return nil } @@ -437,13 +435,11 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.StorageKey = [32]uint8{} - if _, err := io.ReadFull(cr, t.StorageKey[:]); err != nil { return err } @@ -479,7 +475,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Input[:]); err != nil { + if _, err := cw.Write(t.Input); err != nil { return err } @@ -556,9 +552,10 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { t.Input = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Input[:]); err != nil { + if _, err := io.ReadFull(cr, t.Input); err != nil { return err } + // t.Caller ([20]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -572,13 +569,11 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Caller = [20]uint8{} - if _, err := io.ReadFull(cr, t.Caller[:]); err != nil { return err } diff --git a/builtin/v10/init/cbor_gen.go b/builtin/v10/init/cbor_gen.go index c054c05c..161f445f 100644 --- a/builtin/v10/init/cbor_gen.go +++ b/builtin/v10/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } @@ -378,7 +380,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } @@ -391,9 +393,10 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SubAddress[:]); err != nil { + if _, err := cw.Write(t.SubAddress); err != nil { return err } + return nil } @@ -450,9 +453,10 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + // t.SubAddress ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -471,8 +475,9 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.SubAddress = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SubAddress[:]); err != nil { + if _, err := io.ReadFull(cr, t.SubAddress); err != nil { return err } + return nil } diff --git a/builtin/v10/market/cbor_gen.go b/builtin/v10/market/cbor_gen.go index c246465c..88062076 100644 --- a/builtin/v10/market/cbor_gen.go +++ b/builtin/v10/market/cbor_gen.go @@ -554,6 +554,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -616,9 +617,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -722,9 +723,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -843,9 +844,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -905,6 +906,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -976,9 +978,9 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1008,6 +1010,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1070,9 +1073,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1102,6 +1105,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1164,9 +1168,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1196,6 +1200,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1268,9 +1273,9 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1300,6 +1305,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1362,9 +1368,9 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1878,9 +1884,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2379,9 +2385,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2638,9 +2644,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v10/miner/cbor_gen.go b/builtin/v10/miner/cbor_gen.go index 26bd2435..cb4b2623 100644 --- a/builtin/v10/miner/cbor_gen.go +++ b/builtin/v10/miner/cbor_gen.go @@ -374,6 +374,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -390,7 +391,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -411,9 +412,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -548,9 +550,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -588,9 +590,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -635,12 +638,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -847,13 +850,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1833,9 +1834,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2135,9 +2136,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2427,6 +2428,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2489,9 +2491,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2618,6 +2620,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2689,9 +2692,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3057,6 +3060,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3137,9 +3141,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3174,6 +3178,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3245,9 +3250,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3274,9 +3279,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -3321,9 +3327,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3359,6 +3366,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3373,6 +3381,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3395,9 +3404,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3473,9 +3483,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3511,9 +3521,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3557,9 +3567,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3803,9 +3814,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3922,9 +3933,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3983,9 +3995,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -4015,6 +4028,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4077,9 +4091,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4109,6 +4123,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4171,9 +4186,9 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4203,6 +4218,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4265,9 +4281,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4361,6 +4377,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4423,9 +4440,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4455,6 +4472,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4517,9 +4535,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4546,7 +4564,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4603,9 +4621,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4783,7 +4802,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4796,7 +4815,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4809,9 +4828,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4856,9 +4876,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4877,9 +4898,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4898,9 +4920,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -5070,9 +5093,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -5134,9 +5157,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -5208,12 +5232,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5458,6 +5482,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5520,9 +5545,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5554,9 +5579,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5610,9 +5636,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5642,6 +5669,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5704,9 +5732,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5814,6 +5842,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5876,9 +5905,9 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5908,6 +5937,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5970,9 +6000,9 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6265,9 +6295,10 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } + return nil } @@ -6312,9 +6343,10 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + return nil } @@ -6341,9 +6373,10 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.MultiAddrs[:]); err != nil { + if _, err := cw.Write(t.MultiAddrs); err != nil { return err } + return nil } @@ -6388,9 +6421,10 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.MultiAddrs = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.MultiAddrs[:]); err != nil { + if _, err := io.ReadFull(cr, t.MultiAddrs); err != nil { return err } + return nil } @@ -6964,9 +6998,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7087,9 +7122,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7133,9 +7168,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7219,9 +7255,10 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7354,9 +7391,9 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7400,9 +7437,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7449,6 +7487,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NewExpiration (abi.ChainEpoch) (int64) @@ -7559,9 +7598,9 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -7721,9 +7760,9 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.MaintainClaims[i] = verifreg.ClaimId(extra) } + } } - // t.DropClaims ([]verifreg.ClaimId) (slice) maj, extra, err = cr.ReadHeader() @@ -7764,8 +7803,8 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.DropClaims[i] = verifreg.ClaimId(extra) } + } } - return nil } diff --git a/builtin/v10/multisig/cbor_gen.go b/builtin/v10/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v10/multisig/cbor_gen.go +++ b/builtin/v10/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v10/paych/cbor_gen.go b/builtin/v10/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v10/paych/cbor_gen.go +++ b/builtin/v10/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v10/power/cbor_gen.go b/builtin/v10/power/cbor_gen.go index 278a646a..883b0b4c 100644 --- a/builtin/v10/power/cbor_gen.go +++ b/builtin/v10/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1405,9 +1412,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1461,8 +1469,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v10/verifreg/cbor_gen.go b/builtin/v10/verifreg/cbor_gen.go index fa7a3938..230e422b 100644 --- a/builtin/v10/verifreg/cbor_gen.go +++ b/builtin/v10/verifreg/cbor_gen.go @@ -732,9 +732,9 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) t.AllocationIds[i] = AllocationId(extra) } + } } - return nil } @@ -843,9 +843,9 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -899,6 +899,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -975,9 +976,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1007,6 +1008,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.AllOrNothing (bool) (bool) @@ -1074,9 +1076,9 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.AllOrNothing (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -1282,9 +1284,9 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -1319,6 +1321,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1390,9 +1393,9 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1425,9 +1428,10 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1486,9 +1490,10 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1615,9 +1620,9 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { t.NewAllocations[i] = AllocationId(extra) } + } } - return nil } @@ -1647,6 +1652,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1709,9 +1715,9 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1747,6 +1753,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1823,9 +1830,9 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1944,9 +1951,9 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -2050,9 +2057,9 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -3497,6 +3504,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) @@ -3511,6 +3519,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3573,9 +3582,9 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) maj, extra, err = cr.ReadHeader() @@ -3611,8 +3620,8 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v11/account/cbor_gen.go b/builtin/v11/account/cbor_gen.go index b76ca4dd..4a49915b 100644 --- a/builtin/v11/account/cbor_gen.go +++ b/builtin/v11/account/cbor_gen.go @@ -97,7 +97,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Signature[:]); err != nil { + if _, err := cw.Write(t.Signature); err != nil { return err } @@ -110,9 +110,10 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Message[:]); err != nil { + if _, err := cw.Write(t.Message); err != nil { return err } + return nil } @@ -157,9 +158,10 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Signature = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Signature[:]); err != nil { + if _, err := io.ReadFull(cr, t.Signature); err != nil { return err } + // t.Message ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -178,8 +180,9 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Message = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Message[:]); err != nil { + if _, err := io.ReadFull(cr, t.Message); err != nil { return err } + return nil } diff --git a/builtin/v11/cron/cbor_gen.go b/builtin/v11/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v11/cron/cbor_gen.go +++ b/builtin/v11/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v11/datacap/cbor_gen.go b/builtin/v11/datacap/cbor_gen.go index fcc5f700..4f61008b 100644 --- a/builtin/v11/datacap/cbor_gen.go +++ b/builtin/v11/datacap/cbor_gen.go @@ -238,6 +238,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -318,9 +319,9 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -357,9 +358,10 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -422,9 +424,10 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -531,9 +534,10 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -596,9 +600,10 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -635,9 +640,10 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -700,9 +706,10 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -744,9 +751,10 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -818,9 +826,10 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -862,9 +871,10 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -936,9 +946,10 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } diff --git a/builtin/v11/eam/cbor_gen.go b/builtin/v11/eam/cbor_gen.go index e8e569e9..368a14e0 100644 --- a/builtin/v11/eam/cbor_gen.go +++ b/builtin/v11/eam/cbor_gen.go @@ -42,7 +42,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -96,9 +96,10 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Nonce (uint64) (uint64) { @@ -225,13 +226,11 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -261,7 +260,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -321,9 +320,10 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Salt ([32]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -337,13 +337,11 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.Salt = [32]uint8{} - if _, err := io.ReadFull(cr, t.Salt[:]); err != nil { return err } @@ -459,13 +457,11 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -581,13 +577,11 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } diff --git a/builtin/v11/evm/cbor_gen.go b/builtin/v11/evm/cbor_gen.go index 0daf048d..f0b0a7b8 100644 --- a/builtin/v11/evm/cbor_gen.go +++ b/builtin/v11/evm/cbor_gen.go @@ -202,13 +202,11 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.BytecodeHash = [32]uint8{} - if _, err := io.ReadFull(cr, t.BytecodeHash[:]); err != nil { return err } @@ -296,9 +294,10 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } + return nil } @@ -338,13 +337,11 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Creator = [20]uint8{} - if _, err := io.ReadFull(cr, t.Creator[:]); err != nil { return err } @@ -366,9 +363,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + return nil } @@ -437,13 +435,11 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.StorageKey = [32]uint8{} - if _, err := io.ReadFull(cr, t.StorageKey[:]); err != nil { return err } @@ -479,7 +475,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Input[:]); err != nil { + if _, err := cw.Write(t.Input); err != nil { return err } @@ -556,9 +552,10 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { t.Input = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Input[:]); err != nil { + if _, err := io.ReadFull(cr, t.Input); err != nil { return err } + // t.Caller ([20]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -572,13 +569,11 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Caller = [20]uint8{} - if _, err := io.ReadFull(cr, t.Caller[:]); err != nil { return err } diff --git a/builtin/v11/init/cbor_gen.go b/builtin/v11/init/cbor_gen.go index c054c05c..161f445f 100644 --- a/builtin/v11/init/cbor_gen.go +++ b/builtin/v11/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } @@ -378,7 +380,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } @@ -391,9 +393,10 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SubAddress[:]); err != nil { + if _, err := cw.Write(t.SubAddress); err != nil { return err } + return nil } @@ -450,9 +453,10 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + // t.SubAddress ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -471,8 +475,9 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.SubAddress = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SubAddress[:]); err != nil { + if _, err := io.ReadFull(cr, t.SubAddress); err != nil { return err } + return nil } diff --git a/builtin/v11/market/cbor_gen.go b/builtin/v11/market/cbor_gen.go index d112917c..e06ffc83 100644 --- a/builtin/v11/market/cbor_gen.go +++ b/builtin/v11/market/cbor_gen.go @@ -554,6 +554,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -616,9 +617,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -722,9 +723,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -843,9 +844,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -905,6 +906,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -976,9 +978,9 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1008,6 +1010,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1070,9 +1073,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1102,6 +1105,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1164,9 +1168,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1196,6 +1200,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1268,9 +1273,9 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1300,6 +1305,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1362,9 +1368,9 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1878,9 +1884,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2379,9 +2385,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2638,9 +2644,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v11/miner/cbor_gen.go b/builtin/v11/miner/cbor_gen.go index c869ab33..ed2fe006 100644 --- a/builtin/v11/miner/cbor_gen.go +++ b/builtin/v11/miner/cbor_gen.go @@ -374,6 +374,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -390,7 +391,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -411,9 +412,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -548,9 +550,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -588,9 +590,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -635,12 +638,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -847,13 +850,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1833,9 +1834,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2135,9 +2136,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2427,6 +2428,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2489,9 +2491,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2618,6 +2620,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2689,9 +2692,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3057,6 +3060,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3137,9 +3141,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3174,6 +3178,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3245,9 +3250,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3274,9 +3279,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -3321,9 +3327,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3359,6 +3366,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3373,6 +3381,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3395,9 +3404,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3473,9 +3483,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3511,9 +3521,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3557,9 +3567,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3803,9 +3814,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3922,9 +3933,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3983,9 +3995,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -4015,6 +4028,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4077,9 +4091,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4109,6 +4123,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4171,9 +4186,9 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4203,6 +4218,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4265,9 +4281,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4361,6 +4377,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4423,9 +4440,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4455,6 +4472,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4517,9 +4535,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4546,7 +4564,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4603,9 +4621,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4783,7 +4802,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4796,7 +4815,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4809,9 +4828,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4856,9 +4876,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4877,9 +4898,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4898,9 +4920,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -5070,9 +5093,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -5134,9 +5157,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -5208,12 +5232,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5458,6 +5482,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5520,9 +5545,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5554,9 +5579,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5610,9 +5636,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5642,6 +5669,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5704,9 +5732,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5814,6 +5842,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5876,9 +5905,9 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5908,6 +5937,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5970,9 +6000,9 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6265,9 +6295,10 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } + return nil } @@ -6312,9 +6343,10 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + return nil } @@ -6341,9 +6373,10 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.MultiAddrs[:]); err != nil { + if _, err := cw.Write(t.MultiAddrs); err != nil { return err } + return nil } @@ -6388,9 +6421,10 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.MultiAddrs = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.MultiAddrs[:]); err != nil { + if _, err := io.ReadFull(cr, t.MultiAddrs); err != nil { return err } + return nil } @@ -6964,9 +6998,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7087,9 +7122,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7133,9 +7168,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7219,9 +7255,10 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7354,9 +7391,9 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7400,9 +7437,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7449,6 +7487,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NewExpiration (abi.ChainEpoch) (int64) @@ -7559,9 +7598,9 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -7721,9 +7760,9 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.MaintainClaims[i] = verifreg.ClaimId(extra) } + } } - // t.DropClaims ([]verifreg.ClaimId) (slice) maj, extra, err = cr.ReadHeader() @@ -7764,8 +7803,8 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.DropClaims[i] = verifreg.ClaimId(extra) } + } } - return nil } diff --git a/builtin/v11/multisig/cbor_gen.go b/builtin/v11/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v11/multisig/cbor_gen.go +++ b/builtin/v11/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v11/paych/cbor_gen.go b/builtin/v11/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v11/paych/cbor_gen.go +++ b/builtin/v11/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v11/power/cbor_gen.go b/builtin/v11/power/cbor_gen.go index 278a646a..883b0b4c 100644 --- a/builtin/v11/power/cbor_gen.go +++ b/builtin/v11/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1405,9 +1412,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1461,8 +1469,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v11/verifreg/cbor_gen.go b/builtin/v11/verifreg/cbor_gen.go index fa7a3938..230e422b 100644 --- a/builtin/v11/verifreg/cbor_gen.go +++ b/builtin/v11/verifreg/cbor_gen.go @@ -732,9 +732,9 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) t.AllocationIds[i] = AllocationId(extra) } + } } - return nil } @@ -843,9 +843,9 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -899,6 +899,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -975,9 +976,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1007,6 +1008,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.AllOrNothing (bool) (bool) @@ -1074,9 +1076,9 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.AllOrNothing (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -1282,9 +1284,9 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -1319,6 +1321,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1390,9 +1393,9 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1425,9 +1428,10 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1486,9 +1490,10 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1615,9 +1620,9 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { t.NewAllocations[i] = AllocationId(extra) } + } } - return nil } @@ -1647,6 +1652,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1709,9 +1715,9 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1747,6 +1753,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1823,9 +1830,9 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1944,9 +1951,9 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -2050,9 +2057,9 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -3497,6 +3504,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) @@ -3511,6 +3519,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3573,9 +3582,9 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) maj, extra, err = cr.ReadHeader() @@ -3611,8 +3620,8 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v12/account/cbor_gen.go b/builtin/v12/account/cbor_gen.go index b76ca4dd..4a49915b 100644 --- a/builtin/v12/account/cbor_gen.go +++ b/builtin/v12/account/cbor_gen.go @@ -97,7 +97,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Signature[:]); err != nil { + if _, err := cw.Write(t.Signature); err != nil { return err } @@ -110,9 +110,10 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Message[:]); err != nil { + if _, err := cw.Write(t.Message); err != nil { return err } + return nil } @@ -157,9 +158,10 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Signature = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Signature[:]); err != nil { + if _, err := io.ReadFull(cr, t.Signature); err != nil { return err } + // t.Message ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -178,8 +180,9 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Message = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Message[:]); err != nil { + if _, err := io.ReadFull(cr, t.Message); err != nil { return err } + return nil } diff --git a/builtin/v12/cron/cbor_gen.go b/builtin/v12/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v12/cron/cbor_gen.go +++ b/builtin/v12/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v12/datacap/cbor_gen.go b/builtin/v12/datacap/cbor_gen.go index fcc5f700..4f61008b 100644 --- a/builtin/v12/datacap/cbor_gen.go +++ b/builtin/v12/datacap/cbor_gen.go @@ -238,6 +238,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -318,9 +319,9 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -357,9 +358,10 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -422,9 +424,10 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -531,9 +534,10 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -596,9 +600,10 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -635,9 +640,10 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -700,9 +706,10 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -744,9 +751,10 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -818,9 +826,10 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -862,9 +871,10 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -936,9 +946,10 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } diff --git a/builtin/v12/eam/cbor_gen.go b/builtin/v12/eam/cbor_gen.go index e8e569e9..368a14e0 100644 --- a/builtin/v12/eam/cbor_gen.go +++ b/builtin/v12/eam/cbor_gen.go @@ -42,7 +42,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -96,9 +96,10 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Nonce (uint64) (uint64) { @@ -225,13 +226,11 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -261,7 +260,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -321,9 +320,10 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Salt ([32]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -337,13 +337,11 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.Salt = [32]uint8{} - if _, err := io.ReadFull(cr, t.Salt[:]); err != nil { return err } @@ -459,13 +457,11 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -581,13 +577,11 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } diff --git a/builtin/v12/evm/cbor_gen.go b/builtin/v12/evm/cbor_gen.go index 0daf048d..f0b0a7b8 100644 --- a/builtin/v12/evm/cbor_gen.go +++ b/builtin/v12/evm/cbor_gen.go @@ -202,13 +202,11 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.BytecodeHash = [32]uint8{} - if _, err := io.ReadFull(cr, t.BytecodeHash[:]); err != nil { return err } @@ -296,9 +294,10 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } + return nil } @@ -338,13 +337,11 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Creator = [20]uint8{} - if _, err := io.ReadFull(cr, t.Creator[:]); err != nil { return err } @@ -366,9 +363,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + return nil } @@ -437,13 +435,11 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.StorageKey = [32]uint8{} - if _, err := io.ReadFull(cr, t.StorageKey[:]); err != nil { return err } @@ -479,7 +475,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Input[:]); err != nil { + if _, err := cw.Write(t.Input); err != nil { return err } @@ -556,9 +552,10 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { t.Input = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Input[:]); err != nil { + if _, err := io.ReadFull(cr, t.Input); err != nil { return err } + // t.Caller ([20]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -572,13 +569,11 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Caller = [20]uint8{} - if _, err := io.ReadFull(cr, t.Caller[:]); err != nil { return err } diff --git a/builtin/v12/init/cbor_gen.go b/builtin/v12/init/cbor_gen.go index c054c05c..161f445f 100644 --- a/builtin/v12/init/cbor_gen.go +++ b/builtin/v12/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } @@ -378,7 +380,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } @@ -391,9 +393,10 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SubAddress[:]); err != nil { + if _, err := cw.Write(t.SubAddress); err != nil { return err } + return nil } @@ -450,9 +453,10 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + // t.SubAddress ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -471,8 +475,9 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.SubAddress = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SubAddress[:]); err != nil { + if _, err := io.ReadFull(cr, t.SubAddress); err != nil { return err } + return nil } diff --git a/builtin/v12/market/cbor_gen.go b/builtin/v12/market/cbor_gen.go index 0c474936..821a198d 100644 --- a/builtin/v12/market/cbor_gen.go +++ b/builtin/v12/market/cbor_gen.go @@ -554,6 +554,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -616,9 +617,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -722,9 +723,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -843,9 +844,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -905,6 +906,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -976,9 +978,9 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1008,6 +1010,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1070,9 +1073,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1185,9 +1188,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1701,9 +1704,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2202,9 +2205,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2384,9 +2387,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v12/miner/cbor_gen.go b/builtin/v12/miner/cbor_gen.go index 09236233..1e0c2c8f 100644 --- a/builtin/v12/miner/cbor_gen.go +++ b/builtin/v12/miner/cbor_gen.go @@ -374,6 +374,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -390,7 +391,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -411,9 +412,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -548,9 +550,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -588,9 +590,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -635,12 +638,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -847,13 +850,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1833,9 +1834,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2137,9 +2138,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2426,6 +2427,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2488,9 +2490,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2617,6 +2619,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2688,9 +2691,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3056,6 +3059,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3136,9 +3140,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3173,6 +3177,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3244,9 +3249,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3273,9 +3278,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -3320,9 +3326,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3358,6 +3365,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3372,6 +3380,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3394,9 +3403,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3472,9 +3482,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3510,9 +3520,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3556,9 +3566,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3802,9 +3813,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3921,9 +3932,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3982,9 +3994,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -4014,6 +4027,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4076,9 +4090,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4108,6 +4122,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4170,9 +4185,9 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4202,6 +4217,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4264,9 +4280,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4360,6 +4376,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4422,9 +4439,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4454,6 +4471,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4516,9 +4534,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4545,7 +4563,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4602,9 +4620,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4782,7 +4801,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4795,7 +4814,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4808,9 +4827,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4855,9 +4875,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4876,9 +4897,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4897,9 +4919,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -5069,9 +5092,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -5133,9 +5156,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -5207,12 +5231,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5457,6 +5481,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5519,9 +5544,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5553,9 +5578,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5609,9 +5635,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5641,6 +5668,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5703,9 +5731,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5813,6 +5841,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5875,9 +5904,9 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5907,6 +5936,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5969,9 +5999,9 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6264,9 +6294,10 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } + return nil } @@ -6311,9 +6342,10 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + return nil } @@ -6340,9 +6372,10 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.MultiAddrs[:]); err != nil { + if _, err := cw.Write(t.MultiAddrs); err != nil { return err } + return nil } @@ -6387,9 +6420,10 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.MultiAddrs = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.MultiAddrs[:]); err != nil { + if _, err := io.ReadFull(cr, t.MultiAddrs); err != nil { return err } + return nil } @@ -6963,9 +6997,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7086,9 +7121,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7132,9 +7167,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7218,9 +7254,10 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7353,9 +7390,9 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7399,9 +7436,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7448,6 +7486,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NewExpiration (abi.ChainEpoch) (int64) @@ -7558,9 +7597,9 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -7720,9 +7759,9 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.MaintainClaims[i] = verifreg.ClaimId(extra) } + } } - // t.DropClaims ([]verifreg.ClaimId) (slice) maj, extra, err = cr.ReadHeader() @@ -7763,8 +7802,8 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.DropClaims[i] = verifreg.ClaimId(extra) } + } } - return nil } diff --git a/builtin/v12/multisig/cbor_gen.go b/builtin/v12/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v12/multisig/cbor_gen.go +++ b/builtin/v12/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v12/paych/cbor_gen.go b/builtin/v12/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v12/paych/cbor_gen.go +++ b/builtin/v12/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v12/power/cbor_gen.go b/builtin/v12/power/cbor_gen.go index 278a646a..883b0b4c 100644 --- a/builtin/v12/power/cbor_gen.go +++ b/builtin/v12/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1405,9 +1412,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1461,8 +1469,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v12/verifreg/cbor_gen.go b/builtin/v12/verifreg/cbor_gen.go index fa7a3938..230e422b 100644 --- a/builtin/v12/verifreg/cbor_gen.go +++ b/builtin/v12/verifreg/cbor_gen.go @@ -732,9 +732,9 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) t.AllocationIds[i] = AllocationId(extra) } + } } - return nil } @@ -843,9 +843,9 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -899,6 +899,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -975,9 +976,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1007,6 +1008,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.AllOrNothing (bool) (bool) @@ -1074,9 +1076,9 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.AllOrNothing (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -1282,9 +1284,9 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -1319,6 +1321,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1390,9 +1393,9 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1425,9 +1428,10 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1486,9 +1490,10 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1615,9 +1620,9 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { t.NewAllocations[i] = AllocationId(extra) } + } } - return nil } @@ -1647,6 +1652,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1709,9 +1715,9 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1747,6 +1753,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1823,9 +1830,9 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1944,9 +1951,9 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -2050,9 +2057,9 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -3497,6 +3504,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) @@ -3511,6 +3519,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3573,9 +3582,9 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) maj, extra, err = cr.ReadHeader() @@ -3611,8 +3620,8 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v13/account/cbor_gen.go b/builtin/v13/account/cbor_gen.go index b76ca4dd..4a49915b 100644 --- a/builtin/v13/account/cbor_gen.go +++ b/builtin/v13/account/cbor_gen.go @@ -97,7 +97,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Signature[:]); err != nil { + if _, err := cw.Write(t.Signature); err != nil { return err } @@ -110,9 +110,10 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Message[:]); err != nil { + if _, err := cw.Write(t.Message); err != nil { return err } + return nil } @@ -157,9 +158,10 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Signature = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Signature[:]); err != nil { + if _, err := io.ReadFull(cr, t.Signature); err != nil { return err } + // t.Message ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -178,8 +180,9 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Message = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Message[:]); err != nil { + if _, err := io.ReadFull(cr, t.Message); err != nil { return err } + return nil } diff --git a/builtin/v13/cron/cbor_gen.go b/builtin/v13/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v13/cron/cbor_gen.go +++ b/builtin/v13/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v13/datacap/cbor_gen.go b/builtin/v13/datacap/cbor_gen.go index fcc5f700..4f61008b 100644 --- a/builtin/v13/datacap/cbor_gen.go +++ b/builtin/v13/datacap/cbor_gen.go @@ -238,6 +238,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -318,9 +319,9 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -357,9 +358,10 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -422,9 +424,10 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -531,9 +534,10 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -596,9 +600,10 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -635,9 +640,10 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -700,9 +706,10 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -744,9 +751,10 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -818,9 +826,10 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -862,9 +871,10 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -936,9 +946,10 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } diff --git a/builtin/v13/eam/cbor_gen.go b/builtin/v13/eam/cbor_gen.go index e8e569e9..368a14e0 100644 --- a/builtin/v13/eam/cbor_gen.go +++ b/builtin/v13/eam/cbor_gen.go @@ -42,7 +42,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -96,9 +96,10 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Nonce (uint64) (uint64) { @@ -225,13 +226,11 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -261,7 +260,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } @@ -321,9 +320,10 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + // t.Salt ([32]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -337,13 +337,11 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.Salt = [32]uint8{} - if _, err := io.ReadFull(cr, t.Salt[:]); err != nil { return err } @@ -459,13 +457,11 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } @@ -581,13 +577,11 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.EthAddress = [20]uint8{} - if _, err := io.ReadFull(cr, t.EthAddress[:]); err != nil { return err } diff --git a/builtin/v13/evm/cbor_gen.go b/builtin/v13/evm/cbor_gen.go index 0daf048d..f0b0a7b8 100644 --- a/builtin/v13/evm/cbor_gen.go +++ b/builtin/v13/evm/cbor_gen.go @@ -202,13 +202,11 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.BytecodeHash = [32]uint8{} - if _, err := io.ReadFull(cr, t.BytecodeHash[:]); err != nil { return err } @@ -296,9 +294,10 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Initcode[:]); err != nil { + if _, err := cw.Write(t.Initcode); err != nil { return err } + return nil } @@ -338,13 +337,11 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Creator = [20]uint8{} - if _, err := io.ReadFull(cr, t.Creator[:]); err != nil { return err } @@ -366,9 +363,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Initcode = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Initcode[:]); err != nil { + if _, err := io.ReadFull(cr, t.Initcode); err != nil { return err } + return nil } @@ -437,13 +435,11 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 32 { return fmt.Errorf("expected array to have 32 elements") } t.StorageKey = [32]uint8{} - if _, err := io.ReadFull(cr, t.StorageKey[:]); err != nil { return err } @@ -479,7 +475,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Input[:]); err != nil { + if _, err := cw.Write(t.Input); err != nil { return err } @@ -556,9 +552,10 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { t.Input = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Input[:]); err != nil { + if _, err := io.ReadFull(cr, t.Input); err != nil { return err } + // t.Caller ([20]uint8) (array) maj, extra, err = cr.ReadHeader() @@ -572,13 +569,11 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } - if extra != 20 { return fmt.Errorf("expected array to have 20 elements") } t.Caller = [20]uint8{} - if _, err := io.ReadFull(cr, t.Caller[:]); err != nil { return err } diff --git a/builtin/v13/init/cbor_gen.go b/builtin/v13/init/cbor_gen.go index c054c05c..161f445f 100644 --- a/builtin/v13/init/cbor_gen.go +++ b/builtin/v13/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } @@ -378,7 +380,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } @@ -391,9 +393,10 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SubAddress[:]); err != nil { + if _, err := cw.Write(t.SubAddress); err != nil { return err } + return nil } @@ -450,9 +453,10 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + // t.SubAddress ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -471,8 +475,9 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { t.SubAddress = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SubAddress[:]); err != nil { + if _, err := io.ReadFull(cr, t.SubAddress); err != nil { return err } + return nil } diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index 22e6eff7..6d21b9d8 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -570,9 +570,9 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - return nil } @@ -672,6 +672,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -734,9 +735,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -840,9 +841,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -961,9 +962,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -1023,6 +1024,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1094,9 +1096,9 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1126,6 +1128,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1188,9 +1191,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1303,9 +1306,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1819,9 +1822,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2383,9 +2386,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2565,9 +2568,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 27baf88a..27443f07 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -375,6 +375,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -391,7 +392,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -412,9 +413,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -549,9 +551,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -589,9 +591,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -636,12 +639,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -848,13 +851,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1834,9 +1835,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2138,9 +2139,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2427,6 +2428,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2489,9 +2491,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2618,6 +2620,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2689,9 +2692,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3057,6 +3060,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3137,9 +3141,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3174,6 +3178,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3245,9 +3250,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3274,9 +3279,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -3321,9 +3327,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3359,6 +3366,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3373,6 +3381,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3395,9 +3404,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3473,9 +3483,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3511,9 +3521,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3557,9 +3567,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3803,9 +3814,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3922,9 +3933,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3983,9 +3995,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -4015,6 +4028,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4077,9 +4091,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4109,6 +4123,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4171,9 +4186,9 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4203,6 +4218,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4265,9 +4281,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4361,6 +4377,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4423,9 +4440,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4455,6 +4472,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4517,9 +4535,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4546,7 +4564,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4603,9 +4621,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4783,7 +4802,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4796,7 +4815,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4809,9 +4828,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4856,9 +4876,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4877,9 +4898,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4898,9 +4920,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -5070,9 +5093,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -5134,9 +5157,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -5208,12 +5232,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5458,6 +5482,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5520,9 +5545,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5554,9 +5579,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5610,9 +5636,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5642,6 +5669,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5704,9 +5732,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5814,6 +5842,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5876,9 +5905,9 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5908,6 +5937,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5970,9 +6000,9 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6265,9 +6295,10 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } + return nil } @@ -6312,9 +6343,10 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + return nil } @@ -6341,9 +6373,10 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.MultiAddrs[:]); err != nil { + if _, err := cw.Write(t.MultiAddrs); err != nil { return err } + return nil } @@ -6388,9 +6421,10 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.MultiAddrs = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.MultiAddrs[:]); err != nil { + if _, err := io.ReadFull(cr, t.MultiAddrs); err != nil { return err } + return nil } @@ -6420,6 +6454,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.SectorProofs ([][]uint8) (slice) @@ -6439,9 +6474,10 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.AggregateProof ([]uint8) (slice) @@ -6453,7 +6489,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } @@ -6527,9 +6563,9 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.SectorProofs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -6574,12 +6610,12 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { t.SectorProofs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.SectorProofs[i]); err != nil { return err } + } } - // t.AggregateProof ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -6598,9 +6634,10 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + // t.RequireActivationSuccess (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -6670,6 +6707,7 @@ func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -6746,9 +6784,9 @@ func (t *SectorActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6795,6 +6833,7 @@ func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -6902,9 +6941,9 @@ func (t *PieceActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -7019,9 +7058,10 @@ func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -7075,9 +7115,10 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -7112,6 +7153,7 @@ func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -7191,9 +7233,9 @@ func (t *PieceActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -7231,9 +7273,10 @@ func (t *DataActivationNotificationReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -7303,9 +7346,10 @@ func (t *DataActivationNotificationReturn) UnmarshalCBOR(r io.Reader) (err error t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } @@ -7341,6 +7385,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -7417,9 +7462,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -7547,6 +7592,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.SectorProofs ([][]uint8) (slice) @@ -7566,9 +7612,10 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.AggregateProof ([]uint8) (slice) @@ -7580,7 +7627,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } @@ -7676,9 +7723,9 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.SectorProofs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -7723,12 +7770,12 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { t.SectorProofs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SectorProofs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.SectorProofs[i]); err != nil { return err } + } } - // t.AggregateProof ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -7747,9 +7794,10 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + // t.UpdateProofsType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7887,6 +7935,7 @@ func (t *SectorUpdateManifest) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -8003,9 +8052,9 @@ func (t *SectorUpdateManifest) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -8052,6 +8101,7 @@ func (t *SectorChanges) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -8153,9 +8203,9 @@ func (t *SectorChanges) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -8194,9 +8244,10 @@ func (t *PieceChange) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -8267,9 +8318,10 @@ func (t *PieceChange) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -8843,9 +8895,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -8966,9 +9019,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -9012,9 +9065,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -9098,9 +9152,10 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -9233,9 +9288,9 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -9279,9 +9334,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -9328,6 +9384,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NewExpiration (abi.ChainEpoch) (int64) @@ -9438,9 +9495,9 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -9600,9 +9657,9 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.MaintainClaims[i] = verifreg.ClaimId(extra) } + } } - // t.DropClaims ([]verifreg.ClaimId) (slice) maj, extra, err = cr.ReadHeader() @@ -9643,8 +9700,8 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.DropClaims[i] = verifreg.ClaimId(extra) } + } } - return nil } diff --git a/builtin/v13/multisig/cbor_gen.go b/builtin/v13/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v13/multisig/cbor_gen.go +++ b/builtin/v13/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v13/paych/cbor_gen.go b/builtin/v13/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v13/paych/cbor_gen.go +++ b/builtin/v13/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v13/power/cbor_gen.go b/builtin/v13/power/cbor_gen.go index 278a646a..883b0b4c 100644 --- a/builtin/v13/power/cbor_gen.go +++ b/builtin/v13/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1405,9 +1412,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1461,8 +1469,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v13/verifreg/cbor_gen.go b/builtin/v13/verifreg/cbor_gen.go index fa7a3938..230e422b 100644 --- a/builtin/v13/verifreg/cbor_gen.go +++ b/builtin/v13/verifreg/cbor_gen.go @@ -732,9 +732,9 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) t.AllocationIds[i] = AllocationId(extra) } + } } - return nil } @@ -843,9 +843,9 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -899,6 +899,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -975,9 +976,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1007,6 +1008,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.AllOrNothing (bool) (bool) @@ -1074,9 +1076,9 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.AllOrNothing (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -1282,9 +1284,9 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -1319,6 +1321,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1390,9 +1393,9 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1425,9 +1428,10 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1486,9 +1490,10 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1615,9 +1620,9 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { t.NewAllocations[i] = AllocationId(extra) } + } } - return nil } @@ -1647,6 +1652,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1709,9 +1715,9 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1747,6 +1753,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1823,9 +1830,9 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1944,9 +1951,9 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -2050,9 +2057,9 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -3497,6 +3504,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) @@ -3511,6 +3519,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3573,9 +3582,9 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) maj, extra, err = cr.ReadHeader() @@ -3611,8 +3620,8 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v8/cron/cbor_gen.go b/builtin/v8/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v8/cron/cbor_gen.go +++ b/builtin/v8/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v8/init/cbor_gen.go b/builtin/v8/init/cbor_gen.go index b8bccbd2..7d64308d 100644 --- a/builtin/v8/init/cbor_gen.go +++ b/builtin/v8/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } diff --git a/builtin/v8/market/cbor_gen.go b/builtin/v8/market/cbor_gen.go index 1c494bb7..599ce610 100644 --- a/builtin/v8/market/cbor_gen.go +++ b/builtin/v8/market/cbor_gen.go @@ -513,6 +513,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -575,9 +576,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -681,9 +682,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -802,9 +803,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -859,6 +860,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -921,9 +923,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -953,6 +955,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1015,9 +1018,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1047,6 +1050,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1119,9 +1123,9 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1151,6 +1155,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1213,9 +1218,9 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1350,9 +1355,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -1815,9 +1820,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2017,9 +2022,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v8/miner/cbor_gen.go b/builtin/v8/miner/cbor_gen.go index 197575f6..95d39068 100644 --- a/builtin/v8/miner/cbor_gen.go +++ b/builtin/v8/miner/cbor_gen.go @@ -373,6 +373,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -389,7 +390,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -410,9 +411,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -532,9 +534,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -572,9 +574,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -619,12 +622,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -794,13 +797,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1819,9 +1820,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2154,9 +2155,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2429,6 +2430,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2491,9 +2493,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2620,6 +2622,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2691,9 +2694,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2733,6 +2736,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2813,9 +2817,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2850,6 +2854,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2921,9 +2926,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2950,9 +2955,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -2997,9 +3003,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3035,6 +3042,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3049,6 +3057,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3071,9 +3080,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3149,9 +3159,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3187,9 +3197,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3233,9 +3243,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3479,9 +3490,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3598,9 +3609,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3659,9 +3671,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -3691,6 +3704,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3753,9 +3767,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3785,6 +3799,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3847,9 +3862,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3943,6 +3958,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4005,9 +4021,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4037,6 +4053,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4099,9 +4116,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4128,7 +4145,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4185,9 +4202,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4365,7 +4383,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4378,7 +4396,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4391,9 +4409,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4438,9 +4457,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4459,9 +4479,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4480,9 +4501,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4652,9 +4674,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4716,9 +4738,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -4790,12 +4813,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5040,6 +5063,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5102,9 +5126,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5136,9 +5160,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5192,9 +5217,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5224,6 +5250,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5286,9 +5313,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5940,9 +5967,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -6063,9 +6091,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -6109,8 +6137,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } diff --git a/builtin/v8/multisig/cbor_gen.go b/builtin/v8/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v8/multisig/cbor_gen.go +++ b/builtin/v8/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v8/paych/cbor_gen.go b/builtin/v8/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v8/paych/cbor_gen.go +++ b/builtin/v8/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v8/power/cbor_gen.go b/builtin/v8/power/cbor_gen.go index 4c1804ad..67c51152 100644 --- a/builtin/v8/power/cbor_gen.go +++ b/builtin/v8/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1327,9 +1334,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1383,8 +1391,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v9/account/cbor_gen.go b/builtin/v9/account/cbor_gen.go index b76ca4dd..4a49915b 100644 --- a/builtin/v9/account/cbor_gen.go +++ b/builtin/v9/account/cbor_gen.go @@ -97,7 +97,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Signature[:]); err != nil { + if _, err := cw.Write(t.Signature); err != nil { return err } @@ -110,9 +110,10 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Message[:]); err != nil { + if _, err := cw.Write(t.Message); err != nil { return err } + return nil } @@ -157,9 +158,10 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Signature = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Signature[:]); err != nil { + if _, err := io.ReadFull(cr, t.Signature); err != nil { return err } + // t.Message ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -178,8 +180,9 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { t.Message = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Message[:]); err != nil { + if _, err := io.ReadFull(cr, t.Message); err != nil { return err } + return nil } diff --git a/builtin/v9/cron/cbor_gen.go b/builtin/v9/cron/cbor_gen.go index be7c0923..013f8f58 100644 --- a/builtin/v9/cron/cbor_gen.go +++ b/builtin/v9/cron/cbor_gen.go @@ -45,6 +45,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -107,9 +108,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/builtin/v9/datacap/cbor_gen.go b/builtin/v9/datacap/cbor_gen.go index fcc5f700..4f61008b 100644 --- a/builtin/v9/datacap/cbor_gen.go +++ b/builtin/v9/datacap/cbor_gen.go @@ -238,6 +238,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -318,9 +319,9 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -357,9 +358,10 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -422,9 +424,10 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -531,9 +534,10 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -596,9 +600,10 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -635,9 +640,10 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -700,9 +706,10 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } @@ -744,9 +751,10 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.OperatorData[:]); err != nil { + if _, err := cw.Write(t.OperatorData); err != nil { return err } + return nil } @@ -818,9 +826,10 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { t.OperatorData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.OperatorData[:]); err != nil { + if _, err := io.ReadFull(cr, t.OperatorData); err != nil { return err } + return nil } @@ -862,9 +871,10 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.RecipientData[:]); err != nil { + if _, err := cw.Write(t.RecipientData); err != nil { return err } + return nil } @@ -936,9 +946,10 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { t.RecipientData = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.RecipientData[:]); err != nil { + if _, err := io.ReadFull(cr, t.RecipientData); err != nil { return err } + return nil } diff --git a/builtin/v9/init/cbor_gen.go b/builtin/v9/init/cbor_gen.go index b8bccbd2..7d64308d 100644 --- a/builtin/v9/init/cbor_gen.go +++ b/builtin/v9/init/cbor_gen.go @@ -214,9 +214,10 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ConstructorParams[:]); err != nil { + if _, err := cw.Write(t.ConstructorParams); err != nil { return err } + return nil } @@ -273,9 +274,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { t.ConstructorParams = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ConstructorParams[:]); err != nil { + if _, err := io.ReadFull(cr, t.ConstructorParams); err != nil { return err } + return nil } diff --git a/builtin/v9/market/cbor_gen.go b/builtin/v9/market/cbor_gen.go index 9ffc9285..ac3fea63 100644 --- a/builtin/v9/market/cbor_gen.go +++ b/builtin/v9/market/cbor_gen.go @@ -554,6 +554,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -616,9 +617,9 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -722,9 +723,9 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.IDs[i] = abi.DealID(extra) } + } } - // t.ValidDeals (bitfield.BitField) (struct) { @@ -843,9 +844,9 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -905,6 +906,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -976,9 +978,9 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1008,6 +1010,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1070,9 +1073,9 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1102,6 +1105,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1164,9 +1168,9 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) } } + } } - return nil } @@ -1196,6 +1200,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1268,9 +1273,9 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1300,6 +1305,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1362,9 +1368,9 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1499,9 +1505,9 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2000,9 +2006,9 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - return nil } @@ -2259,9 +2265,9 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() diff --git a/builtin/v9/miner/cbor_gen.go b/builtin/v9/miner/cbor_gen.go index 67a6236e..c4a69b10 100644 --- a/builtin/v9/miner/cbor_gen.go +++ b/builtin/v9/miner/cbor_gen.go @@ -374,6 +374,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) @@ -390,7 +391,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -411,9 +412,10 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -548,9 +550,9 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.PendingWorkerKey (miner.WorkerKeyChange) (struct) { @@ -588,9 +590,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -635,12 +638,12 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -847,13 +850,11 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajArray { return fmt.Errorf("expected cbor array") } - if extra != 48 { return fmt.Errorf("expected array to have 48 elements") } t.Due = [48]cid.Cid{} - for i := 0; i < int(extra); i++ { { var maj byte @@ -1833,9 +1834,9 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2135,9 +2136,9 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -2427,6 +2428,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2489,9 +2491,9 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -2618,6 +2620,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -2689,9 +2692,9 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3057,6 +3060,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3137,9 +3141,9 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3174,6 +3178,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3245,9 +3250,9 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -3274,9 +3279,10 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.NewID[:]); err != nil { + if _, err := cw.Write(t.NewID); err != nil { return err } + return nil } @@ -3321,9 +3327,10 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewID = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewID[:]); err != nil { + if _, err := io.ReadFull(cr, t.NewID); err != nil { return err } + return nil } @@ -3359,6 +3366,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Proofs ([]proof.PoStProof) (slice) @@ -3373,6 +3381,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.ChainCommitEpoch (abi.ChainEpoch) (int64) @@ -3395,9 +3404,10 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ChainCommitRand[:]); err != nil { + if _, err := cw.Write(t.ChainCommitRand); err != nil { return err } + return nil } @@ -3473,9 +3483,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Proofs ([]proof.PoStProof) (slice) maj, extra, err = cr.ReadHeader() @@ -3511,9 +3521,9 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3557,9 +3567,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { t.ChainCommitRand = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ChainCommitRand[:]); err != nil { + if _, err := io.ReadFull(cr, t.ChainCommitRand); err != nil { return err } + return nil } @@ -3803,9 +3814,9 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.DealIDs[i] = abi.DealID(extra) } + } } - // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -3922,9 +3933,10 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.Proof); err != nil { return err } + return nil } @@ -3983,9 +3995,10 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Proof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.Proof); err != nil { return err } + return nil } @@ -4015,6 +4028,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4077,9 +4091,9 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4109,6 +4123,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4171,9 +4186,9 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4203,6 +4218,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4265,9 +4281,9 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4361,6 +4377,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4423,9 +4440,9 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4455,6 +4472,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -4517,9 +4535,9 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -4546,7 +4564,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.EventPayload[:]); err != nil { + if _, err := cw.Write(t.EventPayload); err != nil { return err } @@ -4603,9 +4621,10 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.EventPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.EventPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.EventPayload); err != nil { return err } + // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -4783,7 +4802,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader1[:]); err != nil { + if _, err := cw.Write(t.BlockHeader1); err != nil { return err } @@ -4796,7 +4815,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeader2[:]); err != nil { + if _, err := cw.Write(t.BlockHeader2); err != nil { return err } @@ -4809,9 +4828,10 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.BlockHeaderExtra[:]); err != nil { + if _, err := cw.Write(t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -4856,9 +4876,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader1 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader1[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader1); err != nil { return err } + // t.BlockHeader2 ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4877,9 +4898,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeader2 = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeader2[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeader2); err != nil { return err } + // t.BlockHeaderExtra ([]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -4898,9 +4920,10 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { t.BlockHeaderExtra = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.BlockHeaderExtra[:]); err != nil { + if _, err := io.ReadFull(cr, t.BlockHeaderExtra); err != nil { return err } + return nil } @@ -5070,9 +5093,9 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { t.Sectors[i] = abi.SectorNumber(extra) } + } } - // t.RewardSmoothed (smoothing.FilterEstimate) (struct) { @@ -5134,9 +5157,10 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -5208,12 +5232,12 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { t.NewMultiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.NewMultiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.NewMultiaddrs[i]); err != nil { return err } + } } - return nil } @@ -5458,6 +5482,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5520,9 +5545,9 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5554,9 +5579,10 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.AggregateProof[:]); err != nil { + if _, err := cw.Write(t.AggregateProof); err != nil { return err } + return nil } @@ -5610,9 +5636,10 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { t.AggregateProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.AggregateProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.AggregateProof); err != nil { return err } + return nil } @@ -5642,6 +5669,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5704,9 +5732,9 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5814,6 +5842,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5876,9 +5905,9 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -5908,6 +5937,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -5970,9 +6000,9 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -6732,9 +6762,10 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -6855,9 +6886,9 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -6901,9 +6932,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -6987,9 +7019,10 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ReplicaProof[:]); err != nil { + if _, err := cw.Write(t.ReplicaProof); err != nil { return err } + return nil } @@ -7122,9 +7155,9 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.Deals[i] = abi.DealID(extra) } + } } - // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -7168,9 +7201,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { t.ReplicaProof = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ReplicaProof[:]); err != nil { + if _, err := io.ReadFull(cr, t.ReplicaProof); err != nil { return err } + return nil } @@ -7217,6 +7251,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NewExpiration (abi.ChainEpoch) (int64) @@ -7327,9 +7362,9 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() @@ -7489,9 +7524,9 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.MaintainClaims[i] = verifreg.ClaimId(extra) } + } } - // t.DropClaims ([]verifreg.ClaimId) (slice) maj, extra, err = cr.ReadHeader() @@ -7532,8 +7567,8 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { t.DropClaims[i] = verifreg.ClaimId(extra) } + } } - return nil } diff --git a/builtin/v9/multisig/cbor_gen.go b/builtin/v9/multisig/cbor_gen.go index 4bf1a21d..c5b4f9d9 100644 --- a/builtin/v9/multisig/cbor_gen.go +++ b/builtin/v9/multisig/cbor_gen.go @@ -47,6 +47,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -160,9 +161,9 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -315,7 +316,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } @@ -331,6 +332,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -408,9 +410,10 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + // t.Approved ([]address.Address) (slice) maj, extra, err = cr.ReadHeader() @@ -446,9 +449,9 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -496,9 +499,10 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -584,9 +588,10 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -616,6 +621,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.NumApprovalsThreshold (uint64) (uint64) @@ -706,9 +712,9 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.NumApprovalsThreshold (uint64) (uint64) { @@ -815,9 +821,10 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Params[:]); err != nil { + if _, err := cw.Write(t.Params); err != nil { return err } + return nil } @@ -894,9 +901,10 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { t.Params = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Params[:]); err != nil { + if _, err := io.ReadFull(cr, t.Params); err != nil { return err } + return nil } @@ -950,9 +958,10 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1064,9 +1073,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } @@ -1260,9 +1270,10 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.ProposalHash[:]); err != nil { + if _, err := cw.Write(t.ProposalHash); err != nil { return err } + return nil } @@ -1332,9 +1343,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { t.ProposalHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.ProposalHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.ProposalHash); err != nil { return err } + return nil } @@ -1377,9 +1389,10 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Ret[:]); err != nil { + if _, err := cw.Write(t.Ret); err != nil { return err } + return nil } @@ -1466,9 +1479,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Ret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Ret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Ret); err != nil { return err } + return nil } diff --git a/builtin/v9/paych/cbor_gen.go b/builtin/v9/paych/cbor_gen.go index 381c7e78..f53c5e62 100644 --- a/builtin/v9/paych/cbor_gen.go +++ b/builtin/v9/paych/cbor_gen.go @@ -370,9 +370,10 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Secret[:]); err != nil { + if _, err := cw.Write(t.Secret); err != nil { return err } + return nil } @@ -426,9 +427,10 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { t.Secret = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Secret[:]); err != nil { + if _, err := io.ReadFull(cr, t.Secret); err != nil { return err } + return nil } @@ -482,7 +484,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.SecretHash[:]); err != nil { + if _, err := cw.Write(t.SecretHash); err != nil { return err } @@ -531,6 +533,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Signature (crypto.Signature) (struct) @@ -640,9 +643,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { t.SecretHash = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.SecretHash[:]); err != nil { + if _, err := io.ReadFull(cr, t.SecretHash); err != nil { return err } + // t.Extra (paych.ModVerifyParams) (struct) { @@ -759,9 +763,9 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Signature (crypto.Signature) (struct) { @@ -818,9 +822,10 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Data[:]); err != nil { + if _, err := cw.Write(t.Data); err != nil { return err } + return nil } @@ -888,9 +893,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { t.Data = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Data[:]); err != nil { + if _, err := io.ReadFull(cr, t.Data); err != nil { return err } + return nil } diff --git a/builtin/v9/power/cbor_gen.go b/builtin/v9/power/cbor_gen.go index 4c1804ad..67c51152 100644 --- a/builtin/v9/power/cbor_gen.go +++ b/builtin/v9/power/cbor_gen.go @@ -579,6 +579,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) @@ -601,7 +602,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.PeerId[:]); err != nil { + if _, err := cw.Write(t.PeerId); err != nil { return err } @@ -622,9 +623,10 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -705,9 +707,9 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() @@ -751,9 +753,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.PeerId = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PeerId[:]); err != nil { + if _, err := io.ReadFull(cr, t.PeerId); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -798,12 +801,12 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -851,7 +854,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Peer[:]); err != nil { + if _, err := cw.Write(t.Peer); err != nil { return err } @@ -872,9 +875,10 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(v[:]); err != nil { + if _, err := cw.Write(v); err != nil { return err } + } return nil } @@ -963,9 +967,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Peer = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Peer[:]); err != nil { + if _, err := io.ReadFull(cr, t.Peer); err != nil { return err } + // t.Multiaddrs ([][]uint8) (slice) maj, extra, err = cr.ReadHeader() @@ -1010,12 +1015,12 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { t.Multiaddrs[i] = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Multiaddrs[i][:]); err != nil { + if _, err := io.ReadFull(cr, t.Multiaddrs[i]); err != nil { return err } + } } - return nil } @@ -1221,9 +1226,10 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1293,9 +1299,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1327,9 +1334,10 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.CallbackPayload[:]); err != nil { + if _, err := cw.Write(t.CallbackPayload); err != nil { return err } + return nil } @@ -1383,8 +1391,9 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { t.CallbackPayload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.CallbackPayload[:]); err != nil { + if _, err := io.ReadFull(cr, t.CallbackPayload); err != nil { return err } + return nil } diff --git a/builtin/v9/verifreg/cbor_gen.go b/builtin/v9/verifreg/cbor_gen.go index fa7a3938..230e422b 100644 --- a/builtin/v9/verifreg/cbor_gen.go +++ b/builtin/v9/verifreg/cbor_gen.go @@ -732,9 +732,9 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) t.AllocationIds[i] = AllocationId(extra) } + } } - return nil } @@ -843,9 +843,9 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -899,6 +899,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -975,9 +976,9 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1007,6 +1008,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.AllOrNothing (bool) (bool) @@ -1074,9 +1076,9 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.AllOrNothing (bool) (bool) maj, extra, err = cr.ReadHeader() @@ -1282,9 +1284,9 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -1319,6 +1321,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1390,9 +1393,9 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1425,9 +1428,10 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { return err } - if _, err := cw.Write(t.Payload[:]); err != nil { + if _, err := cw.Write(t.Payload); err != nil { return err } + return nil } @@ -1486,9 +1490,10 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { t.Payload = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Payload[:]); err != nil { + if _, err := io.ReadFull(cr, t.Payload); err != nil { return err } + return nil } @@ -1615,9 +1620,9 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { t.NewAllocations[i] = AllocationId(extra) } + } } - return nil } @@ -1647,6 +1652,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1709,9 +1715,9 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1747,6 +1753,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -1823,9 +1830,9 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } @@ -1944,9 +1951,9 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { t.ClaimIds[i] = ClaimId(extra) } + } } - return nil } @@ -2050,9 +2057,9 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { t.Considered[i] = AllocationId(extra) } + } } - // t.Results (verifreg.BatchReturn) (struct) { @@ -3497,6 +3504,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) @@ -3511,6 +3519,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { if err := v.MarshalCBOR(cw); err != nil { return err } + } return nil } @@ -3573,9 +3582,9 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) maj, extra, err = cr.ReadHeader() @@ -3611,8 +3620,8 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { } } + } } - return nil } diff --git a/go.mod b/go.mod index b8070304..cc25d3df 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/multiformats/go-multihash v0.2.1 github.com/multiformats/go-varint v0.0.6 github.com/stretchr/testify v1.7.0 - github.com/whyrusleeping/cbor-gen v0.0.0-20230923211252-36a87e1ba72f + github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b golang.org/x/crypto v0.1.0 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 diff --git a/go.sum b/go.sum index 27677be0..804f2b7c 100644 --- a/go.sum +++ b/go.sum @@ -155,8 +155,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:f github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20230923211252-36a87e1ba72f h1:SBuSxXJL0/ZJMtTxbXZgHZkThl9dNrzyaNhlyaqscRo= -github.com/whyrusleeping/cbor-gen v0.0.0-20230923211252-36a87e1ba72f/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b h1:+Yd0HVs6f9v2sRlpqcODhojlOd2PiBtWZTPcYmaSm5A= +github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829 h1:wb7xrDzfkLgPHsSEBm+VSx6aDdi64VtV0xvP0E6j8bk= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829/go.mod h1:h/1PEBwj7Ym/8kOuMWvO2ujZ6Lt+TMbySEXNhjjR87I= github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JLlWugkzsrlB50jR9v2khiD9FxuSo= From 24c91c4340d0afc0b76bd16c90ff1e39cbb4f070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 24 Jan 2024 15:06:03 +0100 Subject: [PATCH 18/52] Fix the SectorDealIDs type --- builtin/v13/market/cbor_gen.go | 52 ++++++++---------------------- builtin/v13/market/market_types.go | 4 +-- builtin/v13/migration/market.go | 2 +- 3 files changed, 15 insertions(+), 43 deletions(-) diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index 6d21b9d8..dc8319d6 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -475,29 +475,18 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufSectorDealIDs = []byte{129} - func (t *SectorDealIDs) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - cw := cbg.NewCborWriter(w) - if _, err := cw.Write(lengthBufSectorDealIDs); err != nil { - return err + // (*t) (market.SectorDealIDs) (slice) + if len((*t)) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field (*t) was too long") } - // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Deals was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Deals))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len((*t)))); err != nil { return err } - for _, v := range t.Deals { + for _, v := range *t { if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(v)); err != nil { return err @@ -511,26 +500,11 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { *t = SectorDealIDs{} cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Deals ([]abi.DealID) (slice) + var maj byte + var extra uint64 + _ = maj + _ = extra + // (*t) (market.SectorDealIDs) (slice) maj, extra, err = cr.ReadHeader() if err != nil { @@ -538,7 +512,7 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.MaxLength { - return fmt.Errorf("t.Deals: array too large (%d)", extra) + return fmt.Errorf("(*t): array too large (%d)", extra) } if maj != cbg.MajArray { @@ -546,7 +520,7 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { } if extra > 0 { - t.Deals = make([]abi.DealID, extra) + (*t) = make([]abi.DealID, extra) } for i := 0; i < int(extra); i++ { @@ -567,7 +541,7 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.Deals[i] = abi.DealID(extra) + (*t)[i] = abi.DealID(extra) } diff --git a/builtin/v13/market/market_types.go b/builtin/v13/market/market_types.go index 5b058b86..e2d0fcff 100644 --- a/builtin/v13/market/market_types.go +++ b/builtin/v13/market/market_types.go @@ -11,9 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v13/verifreg" ) -type SectorDealIDs struct { - Deals []abi.DealID -} +type SectorDealIDs []abi.DealID type WithdrawBalanceParams struct { ProviderOrClientAddress addr.Address diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index e5889ce3..215d426f 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -135,7 +135,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st var sectorDealIDs market13.SectorDealIDs for sector, deals := range sectors { - sectorDealIDs.Deals = deals + sectorDealIDs = deals if err := actorSectors.Put(miner13.SectorKey(sector), §orDealIDs); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to put sector: %w", err) From 177a0644db65646a582ffff6bc1fd8d4048fed15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 24 Jan 2024 17:10:09 +0100 Subject: [PATCH 19/52] Add AggregateProofType to v13 ProveCommitSectors3Params --- builtin/v13/miner/cbor_gen.go | 40 ++++++++++++++++++++++++++++++-- builtin/v13/miner/miner_types.go | 1 + 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 27443f07..22a23bc3 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -6428,7 +6428,7 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufProveCommitSectors3Params = []byte{133} +var lengthBufProveCommitSectors3Params = []byte{134} func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { if t == nil { @@ -6493,6 +6493,17 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { return err } + // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) + if t.AggregateProofType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.AggregateProofType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.AggregateProofType-1)); err != nil { + return err + } + } + // t.RequireActivationSuccess (bool) (bool) if err := cbg.WriteBool(w, t.RequireActivationSuccess); err != nil { return err @@ -6524,7 +6535,7 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return fmt.Errorf("cbor input should be of type array") } - if extra != 5 { + if extra != 6 { return fmt.Errorf("cbor input had wrong number of fields") } @@ -6638,6 +6649,31 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } + // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.AggregateProofType = abi.RegisteredAggregationProof(extraI) + } // t.RequireActivationSuccess (bool) (bool) maj, extra, err = cr.ReadHeader() diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index d91b2789..caff3091 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -400,6 +400,7 @@ type ProveCommitSectors3Params struct { SectorActivations []SectorActivationManifest SectorProofs [][]byte AggregateProof []byte + AggregateProofType abi.RegisteredAggregationProof RequireActivationSuccess bool RequireNotificationSuccess bool } From e625a47c4906282f6cea5cfbb40c3aeb5911e6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 24 Jan 2024 22:10:02 +0100 Subject: [PATCH 20/52] v13: Cleanup migration a bit --- builtin/v13/migration/miner.go | 15 +-------------- builtin/v13/migration/top.go | 4 +--- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index cf415084..644e8ac1 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -17,9 +17,7 @@ import ( type providerSectors struct { lk sync.Mutex - //providerSectors map[address.Address]cid.Cid // HAMT[SectorNumber]SectorDealIDs - dealToSector map[abi.DealID]abi.SectorID - minerToSectorDeals map[address.Address]map[abi.SectorNumber][]abi.DealID + dealToSector map[abi.DealID]abi.SectorID } // minerMigration is technically a no-op, but it collects a cache for market migration @@ -68,22 +66,11 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, Miner: abi.ActorID(mid), Number: abi.SectorNumber(i), } - if _, ok := m.providerSectors.minerToSectorDeals[in.Address]; !ok { - m.providerSectors.minerToSectorDeals[in.Address] = make(map[abi.SectorNumber][]abi.DealID) - } - m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber] = append(m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber], dealID) - } - - _, ok := m.providerSectors.minerToSectorDeals[in.Address] - if !ok { - m.providerSectors.minerToSectorDeals[in.Address] = make(map[abi.SectorNumber][]abi.DealID) } dealIDsCopy := make([]abi.DealID, len(sector.DealIDs)) copy(dealIDsCopy, sector.DealIDs) - m.providerSectors.minerToSectorDeals[in.Address][sector.SectorNumber] = dealIDsCopy - m.providerSectors.lk.Unlock() return nil diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go index 774e9ea9..508bc97f 100644 --- a/builtin/v13/migration/top.go +++ b/builtin/v13/migration/top.go @@ -2,7 +2,6 @@ package migration import ( "context" - "github.com/filecoin-project/go-address" adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" system12 "github.com/filecoin-project/go-state-types/builtin/v12/system" @@ -108,8 +107,7 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID } ps := &providerSectors{ - dealToSector: map[abi.DealID]abi.SectorID{}, - minerToSectorDeals: map[address.Address]map[abi.SectorNumber][]abi.DealID{}, + dealToSector: map[abi.DealID]abi.SectorID{}, } minerMig, err := newMinerMigrator(ctx, store, miner13Cid, ps) From dbf4b5b126e2a2bf3e11c9e3d7c5b9dd861aaf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 25 Jan 2024 12:11:37 +0100 Subject: [PATCH 21/52] v13 Address review --- builtin/v13/gen/gen.go | 3 - builtin/v13/market/cbor_gen.go | 63 -------- builtin/v13/market/market_state.go | 2 +- builtin/v13/market/market_types.go | 4 +- builtin/v13/migration/market.go | 10 +- builtin/v13/miner/cbor_gen.go | 231 ----------------------------- builtin/v13/miner/miner_types.go | 12 -- 7 files changed, 4 insertions(+), 321 deletions(-) diff --git a/builtin/v13/gen/gen.go b/builtin/v13/gen/gen.go index 07a06e06..b73e6445 100644 --- a/builtin/v13/gen/gen.go +++ b/builtin/v13/gen/gen.go @@ -127,7 +127,6 @@ func main() { market.GetDealTermReturn{}, market.GetDealActivationReturn{}, market.OnMinerSectorsTerminateParams{}, - market.GetDealSectorReturn{}, // other types market.DealProposal{}, @@ -199,8 +198,6 @@ func main() { miner.PieceActivationManifest{}, miner.VerifiedAllocationKey{}, miner.DataActivationNotification{}, - miner.PieceActivationReturn{}, - miner.DataActivationNotificationReturn{}, miner.BatchReturn{}, miner.FailCode{}, miner.ProveReplicaUpdates3Params{}, diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index dc8319d6..2fd49cf2 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -1802,69 +1802,6 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufGetDealSectorReturn = []byte{129} - -func (t *GetDealSectorReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufGetDealSectorReturn); err != nil { - return err - } - - // t.Sector (abi.SectorNumber) (uint64) - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Sector)); err != nil { - return err - } - - return nil -} - -func (t *GetDealSectorReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = GetDealSectorReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 1 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Sector (abi.SectorNumber) (uint64) - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.Sector = abi.SectorNumber(extra) - - } - return nil -} - var lengthBufDealProposal = []byte{139} func (t *DealProposal) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/market/market_state.go b/builtin/v13/market/market_state.go index 49c9219f..e44e2060 100644 --- a/builtin/v13/market/market_state.go +++ b/builtin/v13/market/market_state.go @@ -62,7 +62,7 @@ type State struct { /// or has data replaced. /// Grouping by provider limits the cost of operations in the expected use case /// of multiple sectors all belonging to the same provider. - /// HAMT[Address]HAMT[SectorNumber]SectorDealIDs + /// HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs ProviderSectors cid.Cid } diff --git a/builtin/v13/market/market_types.go b/builtin/v13/market/market_types.go index e2d0fcff..474a1a45 100644 --- a/builtin/v13/market/market_types.go +++ b/builtin/v13/market/market_types.go @@ -137,6 +137,4 @@ type GetDealActivationReturn struct { type GetDealSectorParams = DealQueryParams -type GetDealSectorReturn struct { - Sector abi.SectorNumber -} +type GetDealSectorReturn = abi.SectorNumber // abi.SectorNumber diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 215d426f..5896a0ee 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -2,7 +2,6 @@ package migration import ( "context" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" market13 "github.com/filecoin-project/go-state-types/builtin/v13/market" @@ -70,7 +69,7 @@ func (m *marketMigrator) MigratedCodeCID() cid.Cid { func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, states cid.Cid) (cid.Cid, cid.Cid, error) { - // out HAMT[Address]HAMT[SectorNumber]SectorDealIDs + // out HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs ctxStore := adt.WrapStore(ctx, store) oldStateArray, err := adt.AsArray(ctxStore, states, market12.StatesAmtBitwidth) @@ -142,12 +141,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st } } - maddr, err := address.NewIDAddress(uint64(miner)) - if err != nil { - return cid.Undef, cid.Undef, xerrors.Errorf("failed to convert miner ID to address: %w", err) - } - - if err := outProviderSectors.Put(abi.AddrKey(maddr), actorSectors); err != nil { + if err := outProviderSectors.Put(abi.UIntKey(uint64(miner)), actorSectors); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to put actor sectors: %w", err) } } diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 22a23bc3..c51ad003 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -7158,237 +7158,6 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { return nil } -var lengthBufPieceActivationReturn = []byte{130} - -func (t *PieceActivationReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufPieceActivationReturn); err != nil { - return err - } - - // t.Claimed (bool) (bool) - if err := cbg.WriteBool(w, t.Claimed); err != nil { - return err - } - - // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) - if len(t.Notifications) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Notifications was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Notifications))); err != nil { - return err - } - for _, v := range t.Notifications { - if err := v.MarshalCBOR(cw); err != nil { - return err - } - - } - return nil -} - -func (t *PieceActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = PieceActivationReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Claimed (bool) (bool) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.Claimed = false - case 21: - t.Claimed = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.Notifications ([]miner.DataActivationNotificationReturn) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Notifications: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Notifications = make([]DataActivationNotificationReturn, extra) - } - - for i := 0; i < int(extra); i++ { - { - var maj byte - var extra uint64 - var err error - _ = maj - _ = extra - _ = err - - { - - if err := t.Notifications[i].UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Notifications[i]: %w", err) - } - - } - - } - } - return nil -} - -var lengthBufDataActivationNotificationReturn = []byte{130} - -func (t *DataActivationNotificationReturn) MarshalCBOR(w io.Writer) error { - if t == nil { - _, err := w.Write(cbg.CborNull) - return err - } - - cw := cbg.NewCborWriter(w) - - if _, err := cw.Write(lengthBufDataActivationNotificationReturn); err != nil { - return err - } - - // t.Code (exitcode.ExitCode) (int64) - if t.Code >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Code)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Code-1)); err != nil { - return err - } - } - - // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Data was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Data))); err != nil { - return err - } - - if _, err := cw.Write(t.Data); err != nil { - return err - } - - return nil -} - -func (t *DataActivationNotificationReturn) UnmarshalCBOR(r io.Reader) (err error) { - *t = DataActivationNotificationReturn{} - - cr := cbg.NewCborReader(r) - - maj, extra, err := cr.ReadHeader() - if err != nil { - return err - } - defer func() { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - }() - - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") - } - - if extra != 2 { - return fmt.Errorf("cbor input had wrong number of fields") - } - - // t.Code (exitcode.ExitCode) (int64) - { - maj, extra, err := cr.ReadHeader() - var extraI int64 - if err != nil { - return err - } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - - t.Code = exitcode.ExitCode(extraI) - } - // t.Data ([]uint8) (slice) - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Data: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.Data = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.Data); err != nil { - return err - } - - return nil -} - var lengthBufBatchReturn = []byte{130} func (t *BatchReturn) MarshalCBOR(w io.Writer) error { diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index caff3091..f9f0c956 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -448,18 +448,6 @@ type FailCode struct { Code xc.ExitCode // todo correct? } -// PieceActivationReturn represents the return value for piece activation. -type PieceActivationReturn struct { - Claimed bool - Notifications []DataActivationNotificationReturn -} - -// DataActivationNotificationReturn represents the return value for a data activation notification. -type DataActivationNotificationReturn struct { - Code xc.ExitCode // todo correct?? - Data []byte -} - // ProveReplicaUpdates3Params represents the parameters for proving replica updates. type ProveReplicaUpdates3Params struct { SectorUpdates []SectorUpdateManifest From 08bdf6c89b48ec76a0479af33b69298f00fcf0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Jan 2024 15:59:37 +0100 Subject: [PATCH 22/52] v13: Cached migration --- builtin/v13/migration/market.go | 329 +++++++++++++++++++++++++++++++- builtin/v13/migration/miner.go | 134 ++++++++++--- migration/util.go | 12 ++ 3 files changed, 446 insertions(+), 29 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 5896a0ee..9762c851 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -1,18 +1,26 @@ package migration import ( + "bytes" "context" + "errors" + "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" + miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner" market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" market13 "github.com/filecoin-project/go-state-types/builtin/v13/market" miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner" + adt13 "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" "github.com/filecoin-project/go-state-types/migration" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" + typegen "github.com/whyrusleeping/cbor-gen" "golang.org/x/xerrors" ) +var errItemFound = errors.New("item found") + type marketMigrator struct { providerSectors *providerSectors OutCodeCID cid.Cid @@ -31,7 +39,7 @@ func (m *marketMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, return nil, xerrors.Errorf("failed to load market state for %s: %w", in.Address, err) } - providerSectors, newStates, err := m.migrateProviderSectorsAndStates(ctx, store, inState.States) + providerSectors, newStates, err := m.migrateProviderSectorsAndStates(ctx, store, in, inState.States) if err != nil { return nil, xerrors.Errorf("failed to migrate provider sectors: %w", err) } @@ -67,9 +75,320 @@ func (m *marketMigrator) MigratedCodeCID() cid.Cid { return m.OutCodeCID } -func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, states cid.Cid) (cid.Cid, cid.Cid, error) { +func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, states cid.Cid) (cid.Cid, cid.Cid, error) { + // providerSectorsRoot: HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs + + okIn, prevInStates, err := in.Cache.Read(migration.MarketPrevDealStatesInKey(in.Address)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous inRoot from cache: %w", err) + } + + okOut, prevOutStates, err := in.Cache.Read(migration.MarketPrevDealStatesOutKey(in.Address)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous outRoot from cache: %w", err) + } + + okOutPs, prevOutProviderSectors, err := in.Cache.Read(migration.MarketPrevProviderSectorsOutKey(in.Address)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous outRoot from cache: %w", err) + } + + var providerSectorsRoot, newStateArrayRoot cid.Cid + + if okIn && okOut && okOutPs { + providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesWithDiff(ctx, store, in, prevInStates, prevOutStates, prevOutProviderSectors, states) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to migrate provider sectors (diff): %w", err) + } + } else { + providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesFromScratch(ctx, store, in, states) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to migrate provider sectors (all): %w", err) + } + } + + if err := in.Cache.Write(migration.MarketPrevDealStatesInKey(in.Address), states); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous inRoot to cache: %w", err) + } + + if err := in.Cache.Write(migration.MarketPrevDealStatesOutKey(in.Address), newStateArrayRoot); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous outRoot to cache: %w", err) + } + + if err := in.Cache.Write(migration.MarketPrevProviderSectorsOutKey(in.Address), providerSectorsRoot); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous outRoot to cache: %w", err) + } + + return providerSectorsRoot, newStateArrayRoot, nil +} + +func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid cid.Cid) (cid.Cid, cid.Cid, error) { + diffs, err := amt.Diff(ctx, store, store, prevInStatesCid, inStatesCid, amt.UseTreeBitWidth(miner11.SectorsAmtBitwidth)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to diff old and new deal state AMTs: %w", err) + } + + ctxStore := adt.WrapStore(ctx, store) + + prevOutStates, err := adt.AsArray(ctxStore, prevOutStatesCid, market13.StatesAmtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load prevOutStates array: %w", err) + } + + prevOutProviderSectors, err := adt.AsMap(ctxStore, prevOutProviderSectorsCid, market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load prevOutProviderSectors map: %w", err) + } + + // in-memory maps with changesets to be applied to prevOutProviderSectors + providerSectorsMem := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // added + providerSectorsMemRemoved := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // removed + + addProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) error { + sid, ok := m.providerSectors.dealToSector[deal] + if !ok { + return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? + } + + newState.SectorNumber = sid.Number + if _, ok := providerSectorsMem[sid.Miner]; !ok { + providerSectorsMem[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + } + providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) + + return nil + } + + removeProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) error { + sid, ok := m.providerSectors.removedDealToSector[deal] + if !ok { + return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? + } + + newState.SectorNumber = 0 + if _, ok := providerSectorsMemRemoved[sid.Miner]; !ok { + providerSectorsMemRemoved[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + } + providerSectorsMemRemoved[sid.Miner][sid.Number] = append(providerSectorsMemRemoved[sid.Miner][sid.Number], deal) + + return nil + } + + var oldState, prevOldState market12.DealState + var newState market13.DealState + for _, change := range diffs { + deal := abi.DealID(change.Key) + + switch change.Type { + case amt.Add: + if err := oldState.UnmarshalCBOR(bytes.NewReader(change.After.Raw)); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to unmarshal old state: %w", err) + } + + newState.SlashEpoch = oldState.SlashEpoch + newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch + newState.SectorStartEpoch = oldState.SectorStartEpoch + newState.SectorNumber = 0 // terminated / not found (?) + + if oldState.SlashEpoch == -1 { // todo slashEpoch != -1? or is this correct?? + if err := addProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) + } + } + + if err := prevOutStates.Set(uint64(deal), &newState); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) + } + + case amt.Remove: + ok, err := prevOutStates.Get(uint64(deal), &newState) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: %w", err) + } + if !ok { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") + } + + if newState.SlashEpoch == -1 { + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) + } + } + + if err := prevOutStates.Delete(uint64(deal)); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to delete new state: %w", err) + } + + case amt.Modify: + if err := prevOldState.UnmarshalCBOR(bytes.NewReader(change.Before.Raw)); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to unmarshal old state: %w", err) + } + if err := oldState.UnmarshalCBOR(bytes.NewReader(change.After.Raw)); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to unmarshal old state: %w", err) + } + ok, err := prevOutStates.Get(uint64(deal), &newState) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: %w", err) + } + if !ok { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") + } + + newState.SlashEpoch = oldState.SlashEpoch + newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch + newState.SectorStartEpoch = oldState.SectorStartEpoch + + if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { + // neither was in a sector, unclear if this can happen, but we handle this case anyway + } + + if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch == -1) && oldState.SlashEpoch == -1 { + // wasn't in a sector, now is + if err := addProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) + } + } + + if (oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1) && prevOldState.SlashEpoch != -1 { + // was in a sector, now isn't + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) + } + } + + if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch != -1) && oldState.SlashEpoch == -1 { + // both in a sector, check if the same + _, rm := m.providerSectors.removedDealToSector[deal] + if rm { + // changed which sector it's in + + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) + } + + if err := addProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) + } + } + } + + if err := prevOutStates.Set(uint64(deal), &newState); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) + } + } + } + + // process prevOutProviderSectors, first removes, then adds + + var actorSectorsMapRoot typegen.CborCid + var sectorDeals market13.SectorDealIDs + + for miner, sectors := range providerSectorsMemRemoved { + found, err := prevOutProviderSectors.Get(abi.UIntKey(uint64(miner)), &actorSectorsMapRoot) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors: %w", err) + } + if !found { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors: not found") + } + + actorSectors, err := adt.AsMap(ctxStore, cid.Cid(actorSectorsMapRoot), market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load actor sectors map: %w", err) + } + + for sector := range sectors { + // todo should we bother checking deals in the sector? + + if err := actorSectors.Delete(miner13.SectorKey(sector)); err != nil { + return cid.Cid{}, cid.Cid{}, err + } + } + + // check if actorSectors are empty + err = actorSectors.ForEach(nil, func(k string) error { + return errItemFound + }) + var nonEmpty bool + if err == errItemFound { + found = true + err = nil + } + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to iterate actor sectors: %w", err) + } + + if nonEmpty { + newActorSectorsMapRoot, err := actorSectors.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors root: %w", err) + } + actorSectorsMapRoot = typegen.CborCid(newActorSectorsMapRoot) + + if err := prevOutProviderSectors.Put(abi.UIntKey(uint64(miner)), &actorSectorsMapRoot); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to put actor sectors: %w", err) + } + } else { + if err := prevOutProviderSectors.Delete(abi.UIntKey(uint64(miner))); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to delete actor sectors: %w", err) + } + } + } + + for miner, sectors := range providerSectorsMem { + found, err := prevOutProviderSectors.Get(abi.UIntKey(uint64(miner)), &actorSectorsMapRoot) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors: %w", err) + } + + var actorSectors *adt13.Map + if !found { + // can happen, this miner just didn't have any sectors before + actorSectors, err = adt13.MakeEmptyMap(ctxStore, market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to make empty actor sectors map: %w", err) + } + } else { + actorSectors, err = adt13.AsMap(ctxStore, cid.Cid(actorSectorsMapRoot), market13.ProviderSectorsHamtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load actor sectors map: %w", err) + } + } + + for sector, deals := range sectors { + sectorDeals = deals + + if err := actorSectors.Put(miner13.SectorKey(sector), §orDeals); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to put sector: %w", err) + } + } + + newActorSectorsMapRoot, err := actorSectors.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors root: %w", err) + } + actorSectorsMapRoot = typegen.CborCid(newActorSectorsMapRoot) + + if err := prevOutProviderSectors.Put(abi.UIntKey(uint64(miner)), &actorSectorsMapRoot); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to put actor sectors: %w", err) + } + } + + // get roots + outProviderSectors, err := prevOutProviderSectors.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get providerSectorsRoot: %w", err) + } + + outStates, err := prevOutStates.Root() + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get statesRoot: %w", err) + } + + return outProviderSectors, outStates, nil +} - // out HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs +func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, states cid.Cid) (cid.Cid, cid.Cid, error) { ctxStore := adt.WrapStore(ctx, store) oldStateArray, err := adt.AsArray(ctxStore, states, market12.StatesAmtBitwidth) @@ -77,7 +396,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st return cid.Undef, cid.Undef, xerrors.Errorf("failed to load states array: %w", err) } - newStateArray, err := adt.AsArray(ctxStore, states, market13.StatesAmtBitwidth) + newStateArray, err := adt13.MakeEmptyArray(ctxStore, market13.StatesAmtBitwidth) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to load states array: %w", err) } @@ -98,6 +417,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st sid, ok := m.providerSectors.dealToSector[deal] if ok { newState.SectorNumber = sid.Number + } else { + return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? } if _, ok := providerSectorsMem[sid.Miner]; !ok { diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 644e8ac1..831b4064 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -2,22 +2,29 @@ package migration import ( "context" + "sync" + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-amt-ipld/v4" + "github.com/ipfs/go-cid" + cbor "github.com/ipfs/go-ipld-cbor" + "golang.org/x/xerrors" + "github.com/filecoin-project/go-state-types/abi" - miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner" "github.com/filecoin-project/go-state-types/builtin/v13/miner" "github.com/filecoin-project/go-state-types/builtin/v13/util/adt" + + miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner" "github.com/filecoin-project/go-state-types/migration" - "github.com/ipfs/go-cid" - cbor "github.com/ipfs/go-ipld-cbor" - "golang.org/x/xerrors" - "sync" ) type providerSectors struct { lk sync.Mutex dealToSector map[abi.DealID]abi.SectorID + + // diff mode removes + removedDealToSector map[abi.DealID]abi.SectorID } // minerMigration is technically a no-op, but it collects a cache for market migration @@ -43,11 +50,6 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, ctxStore := adt.WrapStore(ctx, store) - sa, err := adt.AsArray(ctxStore, inState.Sectors, miner.SectorsAmtBitwidth) - if err != nil { - return nil, xerrors.Errorf("failed to load sectors array: %w", err) - } - var sector miner.SectorOnChainInfo mid, err := address.IDFromAddress(in.Address) @@ -55,28 +57,110 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, return nil, xerrors.Errorf("failed to get miner ID: %w", err) } - err = sa.ForEach(§or, func(i int64) error { - if len(sector.DealIDs) == 0 { - return nil - } + inSectors, err := adt.AsArray(ctxStore, inState.Sectors, miner.SectorsAmtBitwidth) + if err != nil { + return nil, xerrors.Errorf("failed to load sectors array: %w", err) + } + + hasCached, prevSectors, err := in.Cache.Read(migration.MinerPrevSectorsInKey(in.Address)) + if err != nil { + return nil, xerrors.Errorf("failed to read prev sectors from cache: %w", err) + } + + if !hasCached { + // no cached migration, so we simply iterate all sectors and collect deal IDs - m.providerSectors.lk.Lock() - for _, dealID := range sector.DealIDs { - m.providerSectors.dealToSector[dealID] = abi.SectorID{ - Miner: abi.ActorID(mid), - Number: abi.SectorNumber(i), + err = inSectors.ForEach(§or, func(i int64) error { + if len(sector.DealIDs) == 0 { + return nil } + + m.providerSectors.lk.Lock() + for _, dealID := range sector.DealIDs { + m.providerSectors.dealToSector[dealID] = abi.SectorID{ + Miner: abi.ActorID(mid), + Number: abi.SectorNumber(i), + } + } + m.providerSectors.lk.Unlock() + + return nil + }) + if err != nil { + return nil, xerrors.Errorf("failed to iterate sectors: %w", err) + } + } else { + diffs, err := amt.Diff(ctx, store, store, prevSectors, inState.Sectors, amt.UseTreeBitWidth(miner12.SectorsAmtBitwidth)) + if err != nil { + return nil, xerrors.Errorf("failed to diff old and new Sector AMTs: %w", err) } - dealIDsCopy := make([]abi.DealID, len(sector.DealIDs)) - copy(dealIDsCopy, sector.DealIDs) + prevInSectors, err := adt.AsArray(ctxStore, prevSectors, miner12.SectorsAmtBitwidth) + if err != nil { + return nil, xerrors.Errorf("failed to load prev sectors array: %w", err) + } - m.providerSectors.lk.Unlock() + for i, change := range diffs { + sectorNo := abi.SectorNumber(change.Key) + + switch change.Type { + case amt.Add: + + found, err := inSectors.Get(change.Key, §or) + if err != nil { + return nil, xerrors.Errorf("failed to get sector %d in inSectors: %w", sectorNo, err) + } + + if !found { + return nil, xerrors.Errorf("didn't find sector %d in inSectors", sectorNo) + } + + if len(sector.DealIDs) == 0 { + // if no deals don't even bother taking the lock + continue + } + + m.providerSectors.lk.Lock() + for _, dealID := range sector.DealIDs { + m.providerSectors.dealToSector[dealID] = abi.SectorID{ + Miner: abi.ActorID(mid), + Number: abi.SectorNumber(i), + } + } + m.providerSectors.lk.Unlock() + case amt.Modify: + return nil, xerrors.Errorf("WHAT?! sector %d modified, this not supported and not supposed to happen", i) // todo: is it? + case amt.Remove: + // related deals will also get removed in the market, so we don't have anything to do here + + found, err := prevInSectors.Get(change.Key, §or) + if err != nil { + return nil, xerrors.Errorf("failed to get sector %d in prevInSectors: %w", sectorNo, err) + } + if !found { + return nil, xerrors.Errorf("didn't find sector %d in prevInSectors", sectorNo) + } + + if len(sector.DealIDs) == 0 { + // if no deals don't even bother taking the lock + continue + } + + m.providerSectors.lk.Lock() + for _, dealID := range sector.DealIDs { + m.providerSectors.removedDealToSector[dealID] = abi.SectorID{ + Miner: abi.ActorID(mid), + Number: abi.SectorNumber(i), + } + } + m.providerSectors.lk.Unlock() + } + } + } - return nil - }) + err = in.Cache.Write(migration.MinerPrevSectorsInKey(in.Address), inState.Sectors) if err != nil { - return nil, xerrors.Errorf("failed to iterate sectors: %w", err) + return nil, xerrors.Errorf("failed to write prev sectors to cache: %w", err) } return &migration.ActorMigrationResult{ diff --git a/migration/util.go b/migration/util.go index 29db9b11..2d92ea91 100644 --- a/migration/util.go +++ b/migration/util.go @@ -142,6 +142,18 @@ func MinerPrevSectorsOutKey(m address.Address) string { return "prevSectorsOut-" + m.String() } +func MarketPrevDealStatesInKey(m address.Address) string { + return "prevDealStatesIn-" + m.String() +} + +func MarketPrevDealStatesOutKey(m address.Address) string { + return "prevDealStatesOut-" + m.String() +} + +func MarketPrevProviderSectorsOutKey(m address.Address) string { + return "prevProviderSectorsOut-" + m.String() +} + type ActorMigrationInput struct { Address address.Address // actor's address Head cid.Cid From 419c7cd8466e5fb97d552caafdaa185e0a1031cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Jan 2024 16:21:56 +0100 Subject: [PATCH 23/52] v13: Use correct bitwidth in market diff migrator --- builtin/v13/migration/market.go | 3 +-- builtin/v13/migration/miner.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 9762c851..c7fb4f3f 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -6,7 +6,6 @@ import ( "errors" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" - miner11 "github.com/filecoin-project/go-state-types/builtin/v11/miner" market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" market13 "github.com/filecoin-project/go-state-types/builtin/v13/market" miner13 "github.com/filecoin-project/go-state-types/builtin/v13/miner" @@ -123,7 +122,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st } func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid cid.Cid) (cid.Cid, cid.Cid, error) { - diffs, err := amt.Diff(ctx, store, store, prevInStatesCid, inStatesCid, amt.UseTreeBitWidth(miner11.SectorsAmtBitwidth)) + diffs, err := amt.Diff(ctx, store, store, prevInStatesCid, inStatesCid, amt.UseTreeBitWidth(market12.StatesAmtBitwidth)) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to diff old and new deal state AMTs: %w", err) } diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 831b4064..0b19818c 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -57,7 +57,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, return nil, xerrors.Errorf("failed to get miner ID: %w", err) } - inSectors, err := adt.AsArray(ctxStore, inState.Sectors, miner.SectorsAmtBitwidth) + inSectors, err := adt.AsArray(ctxStore, inState.Sectors, miner12.SectorsAmtBitwidth) if err != nil { return nil, xerrors.Errorf("failed to load sectors array: %w", err) } From e4fd3202b96df7e7cf1b55903ee39ab61592f580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Jan 2024 16:34:18 +0100 Subject: [PATCH 24/52] v13: Don't use AppendContinous for deal states --- builtin/v13/migration/market.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index c7fb4f3f..c73cdc0f 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -95,7 +95,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st var providerSectorsRoot, newStateArrayRoot cid.Cid if okIn && okOut && okOutPs { - providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesWithDiff(ctx, store, in, prevInStates, prevOutStates, prevOutProviderSectors, states) + providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesWithDiff(ctx, store, prevInStates, prevOutStates, prevOutProviderSectors, states) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to migrate provider sectors (diff): %w", err) } @@ -121,7 +121,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st return providerSectorsRoot, newStateArrayRoot, nil } -func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid cid.Cid) (cid.Cid, cid.Cid, error) { +func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid cid.Cid) (cid.Cid, cid.Cid, error) { diffs, err := amt.Diff(ctx, store, store, prevInStatesCid, inStatesCid, amt.UseTreeBitWidth(market12.StatesAmtBitwidth)) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to diff old and new deal state AMTs: %w", err) @@ -426,7 +426,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) } - if err := newStateArray.AppendContinuous(&newState); err != nil { + if err := newStateArray.Set(uint64(deal), &newState); err != nil { return xerrors.Errorf("failed to append new state: %w", err) } From dd197850217c51571716e24faf7f37e2baacb437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Jan 2024 19:22:08 +0100 Subject: [PATCH 25/52] v13: Fixes in cached migration --- builtin/v13/migration/market.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index c73cdc0f..e9533ab4 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "fmt" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" @@ -173,6 +174,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return nil } + //fmt.Printf("state diffs: %d\n", len(diffs)) + //fmt.Printf("dealToSector: %d\n", len(m.providerSectors.dealToSector)) + //fmt.Printf("removedDealToSector: %d\n", len(m.providerSectors.removedDealToSector)) + var oldState, prevOldState market12.DealState var newState market13.DealState for _, change := range diffs { @@ -184,12 +189,14 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to unmarshal old state: %w", err) } + //fmt.Printf("add deal %d\n", deal) + newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch newState.SectorNumber = 0 // terminated / not found (?) - if oldState.SlashEpoch == -1 { // todo slashEpoch != -1? or is this correct?? + if oldState.SectorStartEpoch == -1 { // todo slashEpoch != -1? or is this correct?? if err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } @@ -200,6 +207,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } case amt.Remove: + //fmt.Printf("remove deal %d\n", deal) + ok, err := prevOutStates.Get(uint64(deal), &newState) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: %w", err) @@ -219,6 +228,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } case amt.Modify: + if err := prevOldState.UnmarshalCBOR(bytes.NewReader(change.Before.Raw)); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to unmarshal old state: %w", err) } @@ -238,10 +248,12 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorStartEpoch = oldState.SectorStartEpoch if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { + //fmt.Printf("deal %d start -1 both\n", deal) // neither was in a sector, unclear if this can happen, but we handle this case anyway } if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch == -1) && oldState.SlashEpoch == -1 { + //fmt.Printf("deal %d start -1 -> %d\n", deal, oldState.SectorStartEpoch) // wasn't in a sector, now is if err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) @@ -249,6 +261,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } if (oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1) && prevOldState.SlashEpoch != -1 { + //fmt.Printf("deal %d start %d -> -1\n", deal, prevOldState.SectorStartEpoch) // was in a sector, now isn't if err := removeProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) @@ -256,9 +269,11 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch != -1) && oldState.SlashEpoch == -1 { + //fmt.Printf("deal %d start %d -> %d\n", deal, prevOldState.SectorStartEpoch, oldState.SectorStartEpoch) // both in a sector, check if the same _, rm := m.providerSectors.removedDealToSector[deal] if rm { + fmt.Printf(" !! change\n") // changed which sector it's in if err := removeProviderSectorEntry(deal, &newState); err != nil { @@ -268,6 +283,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con if err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } + } else if _, added := m.providerSectors.dealToSector[deal]; added { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("deal %d with modified state was added to providerSectors, but was not in removedDealToSector", deal) } } @@ -412,7 +429,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. newState.SectorStartEpoch = oldState.SectorStartEpoch newState.SectorNumber = 0 // terminated / not found (?) - if oldState.SlashEpoch == -1 { + if oldState.SectorStartEpoch == -1 { sid, ok := m.providerSectors.dealToSector[deal] if ok { newState.SectorNumber = sid.Number From e41b8a311b2aa9ba8db773b9f961dec4db7c9cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 27 Jan 2024 17:56:52 +0100 Subject: [PATCH 26/52] v13: Support snapdeals/extension in diff migration --- builtin/v13/migration/miner.go | 44 +++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 0b19818c..27c956e4 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -1,7 +1,10 @@ package migration import ( + "bytes" "context" + "encoding/json" + "fmt" "sync" "github.com/filecoin-project/go-address" @@ -129,7 +132,46 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } m.providerSectors.lk.Unlock() case amt.Modify: - return nil, xerrors.Errorf("WHAT?! sector %d modified, this not supported and not supposed to happen", i) // todo: is it? + // oh snap deals?? + + var sectorBefore miner.SectorOnChainInfo + if err := sectorBefore.UnmarshalCBOR(bytes.NewReader(change.Before.Raw)); err != nil { + return nil, xerrors.Errorf("failed to unmarshal sector %d before: %w", sectorNo, err) + } + pjsonb, err := json.MarshalIndent(sectorBefore, "", " ") + if err != nil { + return nil, err + } + + var sectorAfter miner.SectorOnChainInfo + + if err := sectorAfter.UnmarshalCBOR(bytes.NewReader(change.After.Raw)); err != nil { + return nil, xerrors.Errorf("failed to unmarshal sector %d after: %w", sectorNo, err) + } + pjson, err := json.MarshalIndent(sectorAfter, "", " ") + if err != nil { + return nil, err + } + + if len(sectorBefore.DealIDs) != len(sectorAfter.DealIDs) { + if len(sectorBefore.DealIDs) != 0 { + fmt.Println("sector before: ", string(pjsonb)) + fmt.Println("sector after: ", string(pjson)) + return nil, xerrors.Errorf("WHAT?! sector %d modified, this not supported and not supposed to happen", i) // todo: is it? Can't happen w/o a deep, deep reorg, and even then we wouldn't use the cache?? + } + // snap + + m.providerSectors.lk.Lock() + for _, dealID := range sectorAfter.DealIDs { + m.providerSectors.dealToSector[dealID] = abi.SectorID{ + Miner: abi.ActorID(mid), + Number: abi.SectorNumber(i), + } + } + m.providerSectors.lk.Unlock() + } + + // extensions, etc. here; we don't care about those case amt.Remove: // related deals will also get removed in the market, so we don't have anything to do here From c382eb0f2e110fd1287f46090c9c9ea6df5cd0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 27 Jan 2024 17:58:02 +0100 Subject: [PATCH 27/52] v13: Correctly persist actorSectors, thanks mr linter --- builtin/v13/migration/market.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index e9533ab4..7bda7b31 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -217,7 +217,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") } - if newState.SlashEpoch == -1 { + if newState.SlashEpoch != -1 { if err := removeProviderSectorEntry(deal, &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) } @@ -247,10 +247,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch - if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { - //fmt.Printf("deal %d start -1 both\n", deal) - // neither was in a sector, unclear if this can happen, but we handle this case anyway - } + //if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { + //fmt.Printf("deal %d start -1 both\n", deal) + // neither was in a sector, unclear if this can happen, but we handle this case anyway + //} if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch == -1) && oldState.SlashEpoch == -1 { //fmt.Printf("deal %d start -1 -> %d\n", deal, oldState.SectorStartEpoch) @@ -327,7 +327,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con }) var nonEmpty bool if err == errItemFound { - found = true + nonEmpty = true err = nil } if err != nil { From d349fbb98182eb062022b1387dd6d31562981d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 27 Jan 2024 19:36:21 +0100 Subject: [PATCH 28/52] v13: More migration edge-case handling --- builtin/v13/migration/market.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 7bda7b31..c4c4cfc8 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -218,8 +218,13 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } if newState.SlashEpoch != -1 { - if err := removeProviderSectorEntry(deal, &newState); err != nil { - return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) + _, ok := m.providerSectors.removedDealToSector[deal] + if ok { + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) + } + } else { + fmt.Printf("missing deal?? weird market cron? %d\n", deal) // todo review can someone confirm that just ignoring this is fine?? } } From d0fe71d38affd9d14e8fc2a093ab5280070263be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 1 Feb 2024 14:30:36 +0100 Subject: [PATCH 29/52] Make deferred migrations use explicit method --- builtin/v10/migration/init.go | 4 +++ builtin/v10/migration/system.go | 4 +++ builtin/v11/migration/miner.go | 4 +++ builtin/v11/migration/power.go | 4 +++ builtin/v11/migration/system.go | 4 +++ builtin/v12/migration/miner.go | 4 +++ builtin/v12/migration/system.go | 4 +++ builtin/v13/migration/market.go | 4 +++ builtin/v13/migration/miner.go | 4 +++ builtin/v13/migration/system.go | 4 +++ builtin/v13/migration/top.go | 6 ++-- migration/runner.go | 45 +++++++++------------------ migration/util.go | 54 +++++++-------------------------- 13 files changed, 67 insertions(+), 78 deletions(-) diff --git a/builtin/v10/migration/init.go b/builtin/v10/migration/init.go index 9589215a..973a21dc 100644 --- a/builtin/v10/migration/init.go +++ b/builtin/v10/migration/init.go @@ -68,3 +68,7 @@ func (m initActorMigrator) MigrateState(ctx context.Context, store cbor.IpldStor NewHead: outHead, }, nil } + +func (m initActorMigrator) Deferred() bool { + return false +} diff --git a/builtin/v10/migration/system.go b/builtin/v10/migration/system.go index 66cbbf5f..2d81a4b0 100644 --- a/builtin/v10/migration/system.go +++ b/builtin/v10/migration/system.go @@ -34,3 +34,7 @@ func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldSt NewHead: stateHead, }, nil } + +func (m systemActorMigrator) Deferred() bool { + return false +} diff --git a/builtin/v11/migration/miner.go b/builtin/v11/migration/miner.go index e0c4ac6e..cac0d7fb 100644 --- a/builtin/v11/migration/miner.go +++ b/builtin/v11/migration/miner.go @@ -87,3 +87,7 @@ func (m minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, i NewHead: newHead, }, nil } + +func (m minerMigrator) Deferred() bool { + return false +} diff --git a/builtin/v11/migration/power.go b/builtin/v11/migration/power.go index 6cf357bd..9d0a84b6 100644 --- a/builtin/v11/migration/power.go +++ b/builtin/v11/migration/power.go @@ -112,3 +112,7 @@ func (m powerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, i NewHead: newHead, }, nil } + +func (m powerMigrator) Deferred() bool { + return false +} diff --git a/builtin/v11/migration/system.go b/builtin/v11/migration/system.go index 66cbbf5f..2d81a4b0 100644 --- a/builtin/v11/migration/system.go +++ b/builtin/v11/migration/system.go @@ -34,3 +34,7 @@ func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldSt NewHead: stateHead, }, nil } + +func (m systemActorMigrator) Deferred() bool { + return false +} diff --git a/builtin/v12/migration/miner.go b/builtin/v12/migration/miner.go index f5731413..7ef9a576 100644 --- a/builtin/v12/migration/miner.go +++ b/builtin/v12/migration/miner.go @@ -79,6 +79,10 @@ func (m minerMigrator) MigratedCodeCID() cid.Cid { return m.OutCodeCID } +func (m minerMigrator) Deferred() bool { + return false +} + func (m minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput) (*migration.ActorMigrationResult, error) { var inState miner11.State if err := store.Get(ctx, in.Head, &inState); err != nil { diff --git a/builtin/v12/migration/system.go b/builtin/v12/migration/system.go index 41e9627c..9ae257f9 100644 --- a/builtin/v12/migration/system.go +++ b/builtin/v12/migration/system.go @@ -33,3 +33,7 @@ func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldSt NewHead: stateHead, }, nil } + +func (m systemActorMigrator) Deferred() bool { + return false +} diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index c4c4cfc8..d488ab1e 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -496,4 +496,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. return providerSectorsRoot, newStateArrayRoot, nil } +func (m *marketMigrator) Deferred() bool { + return true +} + var _ migration.ActorMigration = (*marketMigrator)(nil) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 27c956e4..35e961e7 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -215,4 +215,8 @@ func (m *minerMigrator) MigratedCodeCID() cid.Cid { return m.OutCodeCID } +func (m *minerMigrator) Deferred() bool { + return false +} + var _ migration.ActorMigration = (*minerMigrator)(nil) diff --git a/builtin/v13/migration/system.go b/builtin/v13/migration/system.go index 76642730..1a54671a 100644 --- a/builtin/v13/migration/system.go +++ b/builtin/v13/migration/system.go @@ -34,3 +34,7 @@ func (m systemActorMigrator) MigrateState(ctx context.Context, store cbor.IpldSt NewHead: stateHead, }, nil } + +func (m systemActorMigrator) Deferred() bool { + return false +} diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go index 508bc97f..75652807 100644 --- a/builtin/v13/migration/top.go +++ b/builtin/v13/migration/top.go @@ -85,8 +85,6 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID // migrations that migrate both code and state, override entries in `migrations` - deferred := migration.NewDeferredMigrationSet() - // The System Actor newSystemCodeCID, ok := newManifest.Get(manifest.SystemKey) @@ -127,13 +125,13 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID if err != nil { return cid.Undef, xerrors.Errorf("failed to create market migrator: %w", err) } - migrations[market12Cid] = migration.NewDeferredMigrator(deferred, marketMig) // migration.CachedMigration(cache, marketMig) + migrations[market12Cid] = migration.CachedMigration(cache, marketMig) if len(migrations)+len(deferredCodeIDs) != len(oldManifestData.Entries) { return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) } - actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations, migration.WithDeferredMigrationSet(deferred)) + actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) if err != nil { return cid.Undef, xerrors.Errorf("failed to run migration: %w", err) } diff --git a/migration/runner.go b/migration/runner.go index 7c4c78ff..2a614aa1 100644 --- a/migration/runner.go +++ b/migration/runner.go @@ -2,7 +2,6 @@ package migration import ( "context" - "errors" "sync" "sync/atomic" "time" @@ -17,25 +16,11 @@ import ( "golang.org/x/xerrors" ) -type migrationSettings struct { - deferred *DeferredMigrationSet -} - -type MigrationOption func(*migrationSettings) - -func WithDeferredMigrationSet(deferred *DeferredMigrationSet) MigrationOption { - return func(settings *migrationSettings) { - settings.deferred = deferred - } -} - -func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store cbor.IpldStore, log Logger, actorsIn *builtin.ActorTree, migrations map[cid.Cid]ActorMigration, opts ...MigrationOption) (*builtin.ActorTree, error) { +func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store cbor.IpldStore, log Logger, actorsIn *builtin.ActorTree, migrations map[cid.Cid]ActorMigration) (*builtin.ActorTree, error) { startTime := time.Now() - settings := migrationSettings{} - for _, opt := range opts { - opt(&settings) - } + deferred := map[address.Address]struct{}{} + var deferredLk sync.Mutex // Setup synchronization grp, ctx := errgroup.WithContext(ctx) @@ -85,12 +70,17 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c grp.Go(func() error { defer workerWg.Done() for job := range jobCh { + if job.ActorMigration.Deferred() { + deferredLk.Lock() + deferred[job.Address] = struct{}{} + deferredLk.Unlock() + + atomic.AddUint32(&doneCount, 1) + continue + } + result, err := job.run(ctx, store) if err != nil { - if errors.Is(err, errMigrationDeferred) { - atomic.AddUint32(&doneCount, 1) - continue - } return xerrors.Errorf("running job: %w", err) } select { @@ -166,13 +156,13 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c return nil, xerrors.Errorf("migration group error: %w", err) } - if settings.deferred != nil { + if len(deferred) > 0 { // deferred round // NOTE this is not parralelized for now as this was only ever needed for singleton actor migrations log.Log(rt.INFO, "Running deferred migrations") - for addr := range settings.deferred.todo { + for addr := range deferred { log.Log(rt.INFO, "Running deferred migration for %s", addr) actorIn, found, err := actorsIn.GetActorV5(addr) @@ -189,13 +179,6 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c return nil, xerrors.Errorf("actor with code %s has no registered migration function", actorIn.Code) } - dm, ok := actorMigration.(*DeferredMigrator) - if !ok { - return nil, xerrors.Errorf("actor with code %s has a migration which claims to be deferred but isn't", actorIn.Code) - } - - actorMigration = dm.sub - res, err := (&migrationJob{ Address: addr, ActorV5: *actorIn, diff --git a/migration/util.go b/migration/util.go index 2d92ea91..3a5b6738 100644 --- a/migration/util.go +++ b/migration/util.go @@ -2,7 +2,6 @@ package migration import ( "context" - "errors" "sync" "time" @@ -170,6 +169,9 @@ type ActorMigration interface { // Returns the new state head CID. MigrateState(ctx context.Context, store cbor.IpldStore, input ActorMigrationInput) (result *ActorMigrationResult, err error) MigratedCodeCID() cid.Cid + + // Deferred returns true if this migration should be run after all non-deferred migrations have completed. + Deferred() bool } // Migrator which preserves the head CID and provides a fixed result code CID. @@ -188,6 +190,10 @@ func (n CodeMigrator) MigratedCodeCID() cid.Cid { return n.OutCodeCID } +func (n CodeMigrator) Deferred() bool { + return false +} + // Migrator that uses cached transformation if it exists type CachedMigrator struct { cache MigrationCache @@ -211,51 +217,13 @@ func (c CachedMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, }, nil } +func (c CachedMigrator) Deferred() bool { + return c.ActorMigration.Deferred() +} + func CachedMigration(cache MigrationCache, m ActorMigration) ActorMigration { return CachedMigrator{ ActorMigration: m, cache: cache, } } - -type DeferredMigrationSet struct { - todo map[address.Address]struct{} - lk sync.Mutex -} - -func NewDeferredMigrationSet() *DeferredMigrationSet { - return &DeferredMigrationSet{ - todo: make(map[address.Address]struct{}), - } -} - -type DeferredMigrator struct { - ds *DeferredMigrationSet - sub ActorMigration -} - -func NewDeferredMigrator(ds *DeferredMigrationSet, sub ActorMigration) *DeferredMigrator { - return &DeferredMigrator{ - ds: ds, - sub: sub, - } -} - -func (d DeferredMigrator) MigratedCodeCID() cid.Cid { - panic("this can't be called") -} - -var errMigrationDeferred = errors.New("migration deferred") - -func (d DeferredMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, in ActorMigrationInput) (*ActorMigrationResult, error) { - d.ds.lk.Lock() - defer d.ds.lk.Unlock() - - _, ok := d.ds.todo[in.Address] - if ok { - return nil, xerrors.Errorf("actor %s already in deferred set", in.Address) - } - d.ds.todo[in.Address] = struct{}{} - - return nil, errMigrationDeferred -} From 877d4072fa4545cef96bdf766e54a081d8cfb045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 5 Feb 2024 09:48:37 +0100 Subject: [PATCH 30/52] v13: Address review --- builtin/v13/market/market_state.go | 2 +- builtin/v13/market/market_types.go | 2 +- builtin/v13/migration/market.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/v13/market/market_state.go b/builtin/v13/market/market_state.go index e44e2060..344dc1e0 100644 --- a/builtin/v13/market/market_state.go +++ b/builtin/v13/market/market_state.go @@ -92,7 +92,7 @@ func ConstructState(store adt.Store) (*State, error) { if err != nil { return nil, xerrors.Errorf("failed to create empty map: %w", err) } - emptyProviderSectorsMap, err := adt.StoreEmptyMap(store, builtin.DefaultHamtBitwidth) + emptyProviderSectorsMap, err := adt.StoreEmptyMap(store, ProviderSectorsHamtBitwidth) if err != nil { return nil, xerrors.Errorf("failed to create empty map: %w", err) } diff --git a/builtin/v13/market/market_types.go b/builtin/v13/market/market_types.go index 474a1a45..a214f169 100644 --- a/builtin/v13/market/market_types.go +++ b/builtin/v13/market/market_types.go @@ -137,4 +137,4 @@ type GetDealActivationReturn struct { type GetDealSectorParams = DealQueryParams -type GetDealSectorReturn = abi.SectorNumber // abi.SectorNumber +type GetDealSectorReturn = abi.SectorNumber diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index d488ab1e..77f49bb8 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -432,7 +432,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch - newState.SectorNumber = 0 // terminated / not found (?) + newState.SectorNumber = 0 if oldState.SectorStartEpoch == -1 { sid, ok := m.providerSectors.dealToSector[deal] From 01402d0070bc7dfa6676c573c7a0adf6fdb0bfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 5 Feb 2024 10:07:17 +0100 Subject: [PATCH 31/52] v13: Invariant for dealState.SectorNumber --- builtin/v13/check.go | 4 ++++ builtin/v13/market/invariants.go | 2 ++ builtin/v13/miner/invariants.go | 2 ++ 3 files changed, 8 insertions(+) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index bb495063..e6044738 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -288,6 +288,10 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari acc.Require(deal.SlashEpoch <= sectorDeal.SectorExpiration, "deal state slashed at %d after sector expiration %d for miner %v", deal.SlashEpoch, sectorDeal.SectorExpiration, deal.Provider) + + acc.Require(deal.SectorNumber == sectorDeal.SectorNumber, + "deal sector number %d does not match sector %d for miner %v", + deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider) } } diff --git a/builtin/v13/market/invariants.go b/builtin/v13/market/invariants.go index 932c264c..5ac4e725 100644 --- a/builtin/v13/market/invariants.go +++ b/builtin/v13/market/invariants.go @@ -22,6 +22,7 @@ type DealSummary struct { SectorStartEpoch abi.ChainEpoch LastUpdatedEpoch abi.ChainEpoch SlashEpoch abi.ChainEpoch + SectorNumber abi.SectorNumber PieceCid cid.Cid } @@ -151,6 +152,7 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c stats.SectorStartEpoch = dealState.SectorStartEpoch stats.LastUpdatedEpoch = dealState.LastUpdatedEpoch stats.SlashEpoch = dealState.SlashEpoch + stats.SectorNumber = dealState.SectorNumber } _, found = pendingDealAllocationIds[abi.DealID(dealID)] acc.Require(!found, "deal %d has pending allocation", dealID) diff --git a/builtin/v13/miner/invariants.go b/builtin/v13/miner/invariants.go index 9ca2fc60..1c75fb9f 100644 --- a/builtin/v13/miner/invariants.go +++ b/builtin/v13/miner/invariants.go @@ -15,6 +15,7 @@ import ( type DealSummary struct { SectorStart abi.ChainEpoch SectorExpiration abi.ChainEpoch + SectorNumber abi.SectorNumber } type StateSummary struct { @@ -102,6 +103,7 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount) ( minerSummary.Deals[dealID] = DealSummary{ SectorStart: sector.Activation, SectorExpiration: sector.Expiration, + SectorNumber: sector.SectorNumber, } } From e4f30ab4d0504c0c366627685dd6c078d42183e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 5 Feb 2024 10:42:57 +0100 Subject: [PATCH 32/52] v13: Invariants for ProviderSectors --- builtin/v13/check.go | 61 ++++++++++++++++++++++++++++++-- builtin/v13/market/invariants.go | 43 ++++++++++++++++++++++ builtin/v13/migration/market.go | 4 +-- 3 files changed, 104 insertions(+), 4 deletions(-) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index e6044738..e4839a9d 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -290,8 +290,65 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari deal.SlashEpoch, sectorDeal.SectorExpiration, deal.Provider) acc.Require(deal.SectorNumber == sectorDeal.SectorNumber, - "deal sector number %d does not match sector %d for miner %v", - deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider) + "deal sector number %d does not match sector %d for miner %v (ds: %#v; ss %#v)", + deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider, deal, sectorDeal) + } + + // /// HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs + foundSectorDeals := make(map[abi.DealID]abi.SectorID) + + for sectorID, dealIDs := range marketSummary.ProviderSectors { + maddr, err := address.NewIDAddress(uint64(sectorID.Miner)) + if err != nil { + acc.Addf("error creating ID address: %v", err) + continue + } + + minerSummary, found := minerSummaries[maddr] + if !found { + acc.Addf("provider %v for sector %v not found among miners", sectorID, sectorID) + continue + } + + sector := minerSummary.SectorsWithDeals[sectorID.Number] + acc.Require(sector, "sector %v not found in miner %v for deals %v", sectorID, maddr, dealIDs) + + for _, dealID := range dealIDs { + _, found := minerSummary.Deals[dealID] + acc.Require(found, "deal %d not found in miner %v for sector %v", dealID, maddr, sectorID) + + _, found = foundSectorDeals[dealID] + acc.Require(!found, "deal %d found in multiple sectors", dealID) + + foundSectorDeals[dealID] = sectorID + } + } + + inverseSectorDeals := make(map[abi.DealID]abi.SectorID) + for a, summary := range minerSummaries { + mid, err := address.IDFromAddress(a) + if err != nil { + acc.Addf("error creating ID address: %v", err) + continue + } + for dealID, dealSummary := range summary.Deals { + _, found := inverseSectorDeals[dealID] + acc.Require(!found, "deal %d found in multiple sectors", dealID) + + inverseSectorDeals[dealID] = abi.SectorID{Miner: abi.ActorID(mid), Number: dealSummary.SectorNumber} + } + } + + for dealID, sectorID := range inverseSectorDeals { + ds := marketSummary.Deals[dealID] + _, found := marketSummary.ProviderSectors[sectorID] + if ds == nil { + acc.Require(!found, "expired deal %d found in sector %v", dealID, sectorID) + + continue // expired deal + } + + acc.Require(found, "deal %d found in sector %v not found in market (ds: %v)", dealID, sectorID, ds) } } diff --git a/builtin/v13/market/invariants.go b/builtin/v13/market/invariants.go index 5ac4e725..e9877957 100644 --- a/builtin/v13/market/invariants.go +++ b/builtin/v13/market/invariants.go @@ -31,6 +31,7 @@ type StateSummary struct { PendingDealAllocationIds map[abi.DealID]verifreg.AllocationId ClaimIdToDealId map[verifreg.ClaimId]abi.DealID AllocIdToDealId map[verifreg.AllocationId]abi.DealID + ProviderSectors map[abi.SectorID][]abi.DealID PendingProposalCount uint64 DealStateCount uint64 LockTableCount uint64 @@ -256,6 +257,47 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c acc.Require(len(expectedDealOps) == 0, "missing deal ops for proposals: %v", expectedDealOps) + // + // Provider Sectors + // + + providerSectors := make(map[abi.SectorID][]abi.DealID) + if sectorDeals, err := adt.AsMap(store, st.ProviderSectors, ProviderSectorsHamtBitwidth); err != nil { + acc.Addf("error loading sector deals: %v", err) + } else { + var sectorMapRoot cbg.CborCid + err = sectorDeals.ForEach(§orMapRoot, func(providerID string) error { + provider, err := abi.ParseUIntKey(providerID) + acc.RequireNoError(err, "error getting address from bytes") + + sectorMap, err := adt.AsMap(store, cid.Cid(sectorMapRoot), ProviderSectorsHamtBitwidth) + acc.RequireNoError(err, "error loading sector map for provider %s", provider) + + var dealIDs SectorDealIDs + err = sectorMap.ForEach(&dealIDs, func(sectorID string) error { + sectorNumber, err := abi.ParseUIntKey(sectorID) + acc.RequireNoError(err, "error sector number from bytes") + + dealIDsCopy := make([]abi.DealID, len(dealIDs)) + copy(dealIDsCopy, dealIDs) + + providerSectors[abi.SectorID{Miner: abi.ActorID(provider), Number: abi.SectorNumber(sectorNumber)}] = dealIDsCopy + + // check against proposalStats + for _, dealID := range dealIDsCopy { + st, found := proposalStats[dealID] + acc.Require(found, "deal id %d in provider sectors not found in proposals", dealID) + acc.Require(st.SectorNumber == abi.SectorNumber(sectorNumber), "deal id %d sector number %d does not match sector id %d", dealID, st.SectorNumber, sectorNumber) + } + + return nil + }) + acc.RequireNoError(err, "error iterating sector deals") + return nil + }) + acc.RequireNoError(err, "error iterating sector deals") + } + return &StateSummary{ Deals: proposalStats, PendingDealAllocationIds: pendingDealAllocationIds, @@ -266,5 +308,6 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c DealOpCount: dealOpCount, ClaimIdToDealId: claimIdToDealId, AllocIdToDealId: allocationIdToDealId, + ProviderSectors: providerSectors, }, acc } diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 77f49bb8..46f9e1e8 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -196,7 +196,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorStartEpoch = oldState.SectorStartEpoch newState.SectorNumber = 0 // terminated / not found (?) - if oldState.SectorStartEpoch == -1 { // todo slashEpoch != -1? or is this correct?? + if oldState.SectorStartEpoch != -1 { // todo slashEpoch != -1? or is this correct?? if err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } @@ -434,7 +434,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. newState.SectorStartEpoch = oldState.SectorStartEpoch newState.SectorNumber = 0 - if oldState.SectorStartEpoch == -1 { + if oldState.SectorStartEpoch != -1 { sid, ok := m.providerSectors.dealToSector[deal] if ok { newState.SectorNumber = sid.Number From 5021f0b6e6b41766d246797ae3394ecdc497a196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Feb 2024 11:21:04 +0100 Subject: [PATCH 33/52] v13: Match the FIP-76 migration text more strictly --- builtin/v13/migration/market.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 46f9e1e8..6d4fa695 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -426,26 +426,33 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. var oldState market12.DealState var newState market13.DealState + + // FIP: For each deal state object in the market actor state that has a terminated epoch set to -1: err = oldStateArray.ForEach(&oldState, func(i int64) error { deal := abi.DealID(i) newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch - newState.SectorNumber = 0 + newState.SectorNumber = 0 // non- -1 slashed eport - if oldState.SectorStartEpoch != -1 { + if oldState.SlashEpoch == -1 { + // FIP: find the corresponding deal proposal object and extract the provider's actor ID; + // - we do this by collecting all dealIDs in providerSectors in miner migration + + // in the provider's miner state, find the ID of the sector with the corresponding deal ID in sector metadata; sid, ok := m.providerSectors.dealToSector[deal] if ok { - newState.SectorNumber = sid.Number - } else { - return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? - } + newState.SectorNumber = sid.Number // FIP: set the new deal state object's sector number to the sector ID found; - if _, ok := providerSectorsMem[sid.Miner]; !ok { - providerSectorsMem[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + // FIP: add the deal ID to the ProviderSectors mapping for the provider's actor ID and sector number. + if _, ok := providerSectorsMem[sid.Miner]; !ok { + providerSectorsMem[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + } + providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) + } else { + newState.SectorNumber = 0 // FIP: if such a sector cannot be found, assert that the deal's end epoch has passed and use sector ID 0 } - providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) } if err := newStateArray.Set(uint64(deal), &newState); err != nil { From c34fd9b67c3bd7a8edc75fe5889faec1e26fd12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Feb 2024 12:58:37 +0100 Subject: [PATCH 34/52] v13: review: Update invariants --- builtin/v13/check.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index e4839a9d..348ecc72 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -289,7 +289,7 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari "deal state slashed at %d after sector expiration %d for miner %v", deal.SlashEpoch, sectorDeal.SectorExpiration, deal.Provider) - acc.Require(deal.SectorNumber == sectorDeal.SectorNumber, + acc.Require((deal.SectorNumber == sectorDeal.SectorNumber) || (deal.SectorNumber == 0 && deal.LastUpdatedEpoch != -1), "deal sector number %d does not match sector %d for miner %v (ds: %#v; ss %#v)", deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider, deal, sectorDeal) } @@ -343,12 +343,12 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari ds := marketSummary.Deals[dealID] _, found := marketSummary.ProviderSectors[sectorID] if ds == nil { - acc.Require(!found, "expired deal %d found in sector %v", dealID, sectorID) + acc.Require(!found, "expired deal %d found in sector %v", dealID, sectorID) // TODO we see this, is this fine? continue // expired deal } - acc.Require(found, "deal %d found in sector %v not found in market (ds: %v)", dealID, sectorID, ds) + acc.Require(found, "deal %d found in sector %v not found in market (ds: %v)", dealID, sectorID, ds) // TODO we see this, is this fine? } } From a6102cecc4b519f9ec3f8f572298a137565151cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Feb 2024 13:30:22 +0100 Subject: [PATCH 35/52] v13: Diff migration fixes --- builtin/v13/migration/market.go | 66 +++++++++++++++++++++++---------- builtin/v13/migration/miner.go | 15 ++++++-- 2 files changed, 58 insertions(+), 23 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 6d4fa695..78087626 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -144,10 +144,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con providerSectorsMem := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // added providerSectorsMemRemoved := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // removed - addProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) error { + addProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) (abi.SectorNumber, error) { sid, ok := m.providerSectors.dealToSector[deal] if !ok { - return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? + return 0, xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? } newState.SectorNumber = sid.Number @@ -156,13 +156,23 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) - return nil + return sid.Number, nil } removeProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) error { sid, ok := m.providerSectors.removedDealToSector[deal] if !ok { - return xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? + if newState.SectorNumber == 0 { + // already removed, sector was likely terminated/slashed, but not + // yet picked up by the market + return nil + } + + // this can happen if the deal was terminated between premigration and migration + // if it's not here it wasn't in premigration ProviderSectors either + fmt.Printf("notice: deal %d not found in removedDealToSector\n", deal) + newState.SectorNumber = 0 + return nil } newState.SectorNumber = 0 @@ -189,25 +199,27 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to unmarshal old state: %w", err) } - //fmt.Printf("add deal %d\n", deal) - newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch newState.SectorNumber = 0 // terminated / not found (?) - if oldState.SectorStartEpoch != -1 { // todo slashEpoch != -1? or is this correct?? - if err := addProviderSectorEntry(deal, &newState); err != nil { + if oldState.SlashEpoch == -1 { + si, err := addProviderSectorEntry(deal, &newState) + if err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } + newState.SectorNumber = si } + fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) + if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) } case amt.Remove: - //fmt.Printf("remove deal %d\n", deal) + fmt.Printf("remove deal %d\n", deal) ok, err := prevOutStates.Get(uint64(deal), &newState) if err != nil { @@ -252,21 +264,35 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch - //if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { - //fmt.Printf("deal %d start -1 both\n", deal) - // neither was in a sector, unclear if this can happen, but we handle this case anyway - //} + // if nowOld.Slash == -1, then 'now' is not slashed, so we should try to find the sector + // we probably don't care about prevOldSlash?? beyond it changing from newSlash? + + fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) + + if oldState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { + // not slashed -> slashed + fmt.Printf("deal %d slash -1 -> %d\n", deal, oldState.SlashEpoch) + + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) + } + } + + /*if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { + fmt.Printf("deal %d start -1 both\n", deal) + // neither was in a sector, unclear if this can happen, but we handle this case anyway + } if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch == -1) && oldState.SlashEpoch == -1 { - //fmt.Printf("deal %d start -1 -> %d\n", deal, oldState.SectorStartEpoch) + fmt.Printf("deal %d start -1 -> %d\n", deal, oldState.SectorStartEpoch) // wasn't in a sector, now is - if err := addProviderSectorEntry(deal, &newState); err != nil { + if _, err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } } if (oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1) && prevOldState.SlashEpoch != -1 { - //fmt.Printf("deal %d start %d -> -1\n", deal, prevOldState.SectorStartEpoch) + fmt.Printf("deal %d start %d -> -1\n", deal, prevOldState.SectorStartEpoch) // was in a sector, now isn't if err := removeProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) @@ -274,7 +300,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch != -1) && oldState.SlashEpoch == -1 { - //fmt.Printf("deal %d start %d -> %d\n", deal, prevOldState.SectorStartEpoch, oldState.SectorStartEpoch) + fmt.Printf("deal %d start %d -> %d\n", deal, prevOldState.SectorStartEpoch, oldState.SectorStartEpoch) // both in a sector, check if the same _, rm := m.providerSectors.removedDealToSector[deal] if rm { @@ -285,13 +311,13 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) } - if err := addProviderSectorEntry(deal, &newState); err != nil { + if _, err := addProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } } else if _, added := m.providerSectors.dealToSector[deal]; added { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("deal %d with modified state was added to providerSectors, but was not in removedDealToSector", deal) } - } + }*/ if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) @@ -434,7 +460,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch - newState.SectorNumber = 0 // non- -1 slashed eport + newState.SectorNumber = 0 // non- -1 slashed epoch if oldState.SlashEpoch == -1 { // FIP: find the corresponding deal proposal object and extract the provider's actor ID; diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 35e961e7..53fb2059 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -123,11 +123,13 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } + fmt.Printf("prov ds ADD %d: %v\n", sectorNo, sector.DealIDs) + m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { m.providerSectors.dealToSector[dealID] = abi.SectorID{ Miner: abi.ActorID(mid), - Number: abi.SectorNumber(i), + Number: sectorNo, } } m.providerSectors.lk.Unlock() @@ -161,14 +163,19 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } // snap + fmt.Printf("prov ds MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) + m.providerSectors.lk.Lock() for _, dealID := range sectorAfter.DealIDs { m.providerSectors.dealToSector[dealID] = abi.SectorID{ Miner: abi.ActorID(mid), - Number: abi.SectorNumber(i), + Number: sectorNo, } } m.providerSectors.lk.Unlock() + } else { + fmt.Println("sector2 before: ", string(pjsonb)) + fmt.Println("sector2 after: ", string(pjson)) } // extensions, etc. here; we don't care about those @@ -188,11 +195,13 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } + fmt.Printf("prov ds REM %d: %v\n", sectorNo, sector.DealIDs) + m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { m.providerSectors.removedDealToSector[dealID] = abi.SectorID{ Miner: abi.ActorID(mid), - Number: abi.SectorNumber(i), + Number: sectorNo, } } m.providerSectors.lk.Unlock() From 92fe7cc85a89dec29177f7662d920ff4e4c91c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Feb 2024 15:15:26 +0100 Subject: [PATCH 36/52] v13: Remove deals in diff migration wo miner state changes --- builtin/v13/migration/market.go | 72 +++++++++++++++++++-------------- builtin/v13/migration/miner.go | 20 +++++---- migration/util.go | 4 ++ 3 files changed, 55 insertions(+), 41 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 78087626..15742702 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" market12 "github.com/filecoin-project/go-state-types/builtin/v12/market" @@ -39,7 +40,7 @@ func (m *marketMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, return nil, xerrors.Errorf("failed to load market state for %s: %w", in.Address, err) } - providerSectors, newStates, err := m.migrateProviderSectorsAndStates(ctx, store, in, inState.States) + providerSectors, newStates, err := m.migrateProviderSectorsAndStates(ctx, store, in, inState.States, inState.Proposals) if err != nil { return nil, xerrors.Errorf("failed to migrate provider sectors: %w", err) } @@ -75,7 +76,7 @@ func (m *marketMigrator) MigratedCodeCID() cid.Cid { return m.OutCodeCID } -func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, states cid.Cid) (cid.Cid, cid.Cid, error) { +func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, store cbor.IpldStore, in migration.ActorMigrationInput, states, proposals cid.Cid) (cid.Cid, cid.Cid, error) { // providerSectorsRoot: HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs okIn, prevInStates, err := in.Cache.Read(migration.MarketPrevDealStatesInKey(in.Address)) @@ -83,6 +84,11 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous inRoot from cache: %w", err) } + okInPr, prevInProposals, err := in.Cache.Read(migration.MarketPrevDealProposalsInKey(in.Address)) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous inRoot from cache: %w", err) + } + okOut, prevOutStates, err := in.Cache.Read(migration.MarketPrevDealStatesOutKey(in.Address)) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous outRoot from cache: %w", err) @@ -95,8 +101,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st var providerSectorsRoot, newStateArrayRoot cid.Cid - if okIn && okOut && okOutPs { - providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesWithDiff(ctx, store, prevInStates, prevOutStates, prevOutProviderSectors, states) + if okIn && okInPr && okOut && okOutPs { + providerSectorsRoot, newStateArrayRoot, err = m.migrateProviderSectorsAndStatesWithDiff(ctx, store, prevInStates, prevOutStates, prevOutProviderSectors, states, prevInProposals) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to migrate provider sectors (diff): %w", err) } @@ -111,6 +117,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous inRoot to cache: %w", err) } + if err := in.Cache.Write(migration.MarketPrevDealProposalsInKey(in.Address), proposals); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous inRoot to cache: %w", err) + } + if err := in.Cache.Write(migration.MarketPrevDealStatesOutKey(in.Address), newStateArrayRoot); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to write previous outRoot to cache: %w", err) } @@ -122,7 +132,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStates(ctx context.Context, st return providerSectorsRoot, newStateArrayRoot, nil } -func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid cid.Cid) (cid.Cid, cid.Cid, error) { +func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Context, store cbor.IpldStore, prevInStatesCid, prevOutStatesCid, prevOutProviderSectorsCid, inStatesCid, proposals cid.Cid) (cid.Cid, cid.Cid, error) { diffs, err := amt.Diff(ctx, store, store, prevInStatesCid, inStatesCid, amt.UseTreeBitWidth(market12.StatesAmtBitwidth)) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to diff old and new deal state AMTs: %w", err) @@ -140,6 +150,11 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to load prevOutProviderSectors map: %w", err) } + proposalsArr, err := adt.AsArray(ctxStore, proposals, market12.ProposalsAmtBitwidth) + if err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to load proposals map: %w", err) + } + // in-memory maps with changesets to be applied to prevOutProviderSectors providerSectorsMem := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // added providerSectorsMemRemoved := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // removed @@ -159,27 +174,29 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return sid.Number, nil } - removeProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) error { - sid, ok := m.providerSectors.removedDealToSector[deal] - if !ok { - if newState.SectorNumber == 0 { - // already removed, sector was likely terminated/slashed, but not - // yet picked up by the market - return nil - } + removeProviderSectorEntry := func(deal abi.DealID, newStatePrevState *market13.DealState) error { + snum := newStatePrevState.SectorNumber + + var proposals market12.DealProposal + found, err := proposalsArr.Get(uint64(deal), &proposals) + if err != nil { + return xerrors.Errorf("failed to get proposal for removed deal: %w", err) + } + if !found { + return xerrors.Errorf("proposal not found") + } - // this can happen if the deal was terminated between premigration and migration - // if it's not here it wasn't in premigration ProviderSectors either - fmt.Printf("notice: deal %d not found in removedDealToSector\n", deal) - newState.SectorNumber = 0 - return nil + midd, err := address.IDFromAddress(proposals.Provider) + if err != nil { + return xerrors.Errorf("failed to get miner ID: %w", err) } + mid := abi.ActorID(midd) - newState.SectorNumber = 0 - if _, ok := providerSectorsMemRemoved[sid.Miner]; !ok { - providerSectorsMemRemoved[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) + newStatePrevState.SectorNumber = 0 + if _, ok := providerSectorsMemRemoved[mid]; !ok { + providerSectorsMemRemoved[mid] = make(map[abi.SectorNumber][]abi.DealID) } - providerSectorsMemRemoved[sid.Miner][sid.Number] = append(providerSectorsMemRemoved[sid.Miner][sid.Number], deal) + providerSectorsMemRemoved[mid][snum] = append(providerSectorsMemRemoved[mid][snum], deal) return nil } @@ -229,14 +246,9 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") } - if newState.SlashEpoch != -1 { - _, ok := m.providerSectors.removedDealToSector[deal] - if ok { - if err := removeProviderSectorEntry(deal, &newState); err != nil { - return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) - } - } else { - fmt.Printf("missing deal?? weird market cron? %d\n", deal) // todo review can someone confirm that just ignoring this is fine?? + if newState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { + if err := removeProviderSectorEntry(deal, &newState); err != nil { + return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) } } diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 53fb2059..92ed415a 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -140,23 +140,24 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, if err := sectorBefore.UnmarshalCBOR(bytes.NewReader(change.Before.Raw)); err != nil { return nil, xerrors.Errorf("failed to unmarshal sector %d before: %w", sectorNo, err) } - pjsonb, err := json.MarshalIndent(sectorBefore, "", " ") - if err != nil { - return nil, err - } var sectorAfter miner.SectorOnChainInfo if err := sectorAfter.UnmarshalCBOR(bytes.NewReader(change.After.Raw)); err != nil { return nil, xerrors.Errorf("failed to unmarshal sector %d after: %w", sectorNo, err) } - pjson, err := json.MarshalIndent(sectorAfter, "", " ") - if err != nil { - return nil, err - } if len(sectorBefore.DealIDs) != len(sectorAfter.DealIDs) { if len(sectorBefore.DealIDs) != 0 { + pjsonb, err := json.MarshalIndent(sectorBefore, "", " ") + if err != nil { + return nil, err + } + pjson, err := json.MarshalIndent(sectorAfter, "", " ") + if err != nil { + return nil, err + } + fmt.Println("sector before: ", string(pjsonb)) fmt.Println("sector after: ", string(pjson)) return nil, xerrors.Errorf("WHAT?! sector %d modified, this not supported and not supposed to happen", i) // todo: is it? Can't happen w/o a deep, deep reorg, and even then we wouldn't use the cache?? @@ -173,9 +174,6 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } } m.providerSectors.lk.Unlock() - } else { - fmt.Println("sector2 before: ", string(pjsonb)) - fmt.Println("sector2 after: ", string(pjson)) } // extensions, etc. here; we don't care about those diff --git a/migration/util.go b/migration/util.go index 3a5b6738..1f4896e3 100644 --- a/migration/util.go +++ b/migration/util.go @@ -145,6 +145,10 @@ func MarketPrevDealStatesInKey(m address.Address) string { return "prevDealStatesIn-" + m.String() } +func MarketPrevDealProposalsInKey(m address.Address) string { + return "prevDealProposalsIn-" + m.String() +} + func MarketPrevDealStatesOutKey(m address.Address) string { return "prevDealStatesOut-" + m.String() } From 191c05a03707c976cacf794b5f89fe1a211bc174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 6 Feb 2024 15:23:57 +0100 Subject: [PATCH 37/52] v13: Mute migration comments --- builtin/v13/migration/market.go | 9 ++++----- builtin/v13/migration/miner.go | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 15742702..cebfc716 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "errors" - "fmt" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" @@ -229,14 +228,14 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorNumber = si } - fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) + //fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) } case amt.Remove: - fmt.Printf("remove deal %d\n", deal) + //fmt.Printf("remove deal %d\n", deal) ok, err := prevOutStates.Get(uint64(deal), &newState) if err != nil { @@ -279,11 +278,11 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con // if nowOld.Slash == -1, then 'now' is not slashed, so we should try to find the sector // we probably don't care about prevOldSlash?? beyond it changing from newSlash? - fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) + //fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) if oldState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { // not slashed -> slashed - fmt.Printf("deal %d slash -1 -> %d\n", deal, oldState.SlashEpoch) + //fmt.Printf("deal %d slash -1 -> %d\n", deal, oldState.SlashEpoch) if err := removeProviderSectorEntry(deal, &newState); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 92ed415a..d50a7b1d 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -123,7 +123,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - fmt.Printf("prov ds ADD %d: %v\n", sectorNo, sector.DealIDs) + //fmt.Printf("prov ds ADD %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { @@ -164,7 +164,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } // snap - fmt.Printf("prov ds MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) + //fmt.Printf("prov ds MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sectorAfter.DealIDs { @@ -193,7 +193,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - fmt.Printf("prov ds REM %d: %v\n", sectorNo, sector.DealIDs) + //fmt.Printf("prov ds REM %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { From 68093425bc6e7ba9d402793888a43b9970e3e30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Feb 2024 12:45:35 +0100 Subject: [PATCH 38/52] v13: Use TryDelete in providerSectorsMemRemoved loop --- builtin/v13/migration/market.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index cebfc716..64040a59 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -347,7 +347,12 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors: %w", err) } if !found { - return cid.Undef, cid.Undef, xerrors.Errorf("failed to get actor sectors: not found") + // this is fine, all sectors of this miner were already not present + // in ProviderSectors. Sadly because the default value of a non-present + // sector number in deal state is 0, we can't tell if a sector was + // removed or if it was never there to begin with, which is why we + // may occasionally end up here. + continue } actorSectors, err := adt.AsMap(ctxStore, cid.Cid(actorSectorsMapRoot), market13.ProviderSectorsHamtBitwidth) @@ -358,8 +363,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con for sector := range sectors { // todo should we bother checking deals in the sector? - if err := actorSectors.Delete(miner13.SectorKey(sector)); err != nil { - return cid.Cid{}, cid.Cid{}, err + if _, err := actorSectors.TryDelete(miner13.SectorKey(sector)); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("removing providerSectors entry: %w", err) } } From 791c685a373199ff2f9d550b74b394038aa69840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Feb 2024 15:17:08 +0100 Subject: [PATCH 39/52] v13: debug logging again --- builtin/v13/migration/market.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 64040a59..5501ec31 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "fmt" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" @@ -228,14 +229,14 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorNumber = si } - //fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) + fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) } case amt.Remove: - //fmt.Printf("remove deal %d\n", deal) + fmt.Printf("remove deal %d\n", deal) ok, err := prevOutStates.Get(uint64(deal), &newState) if err != nil { @@ -278,7 +279,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con // if nowOld.Slash == -1, then 'now' is not slashed, so we should try to find the sector // we probably don't care about prevOldSlash?? beyond it changing from newSlash? - //fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) + fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) if oldState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { // not slashed -> slashed @@ -352,6 +353,9 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con // sector number in deal state is 0, we can't tell if a sector was // removed or if it was never there to begin with, which is why we // may occasionally end up here. + + fmt.Printf("no actor sectors for miner %d\n", miner) + continue } @@ -363,8 +367,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con for sector := range sectors { // todo should we bother checking deals in the sector? - if _, err := actorSectors.TryDelete(miner13.SectorKey(sector)); err != nil { + if found, err := actorSectors.TryDelete(miner13.SectorKey(sector)); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("removing providerSectors entry: %w", err) + } else if !found { + fmt.Printf("not deleting sector %d, not found for miner %d\n", sector, miner) } } From 4abc56a1be6d6d887247216bcc6d81c20d4bb4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Feb 2024 21:59:44 +0100 Subject: [PATCH 40/52] v13: Don't reuse variables in migration wrongly --- builtin/v13/migration/market.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 5501ec31..c9028405 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -205,17 +205,17 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con //fmt.Printf("dealToSector: %d\n", len(m.providerSectors.dealToSector)) //fmt.Printf("removedDealToSector: %d\n", len(m.providerSectors.removedDealToSector)) - var oldState, prevOldState market12.DealState - var newState market13.DealState for _, change := range diffs { deal := abi.DealID(change.Key) switch change.Type { case amt.Add: + var oldState market12.DealState if err := oldState.UnmarshalCBOR(bytes.NewReader(change.After.Raw)); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to unmarshal old state: %w", err) } + var newState market13.DealState newState.SlashEpoch = oldState.SlashEpoch newState.LastUpdatedEpoch = oldState.LastUpdatedEpoch newState.SectorStartEpoch = oldState.SectorStartEpoch @@ -238,7 +238,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con case amt.Remove: fmt.Printf("remove deal %d\n", deal) - ok, err := prevOutStates.Get(uint64(deal), &newState) + var prevOutState market13.DealState // note: this says "prevOut", not "prevOld" + ok, err := prevOutStates.Get(uint64(deal), &prevOutState) if err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: %w", err) } @@ -246,8 +247,10 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") } - if newState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { - if err := removeProviderSectorEntry(deal, &newState); err != nil { + if prevOutState.SlashEpoch != -1 { + // if the previous OUT state was not slashed then it has a provider sector entry that needs to be removed + + if err := removeProviderSectorEntry(deal, &prevOutState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to remove provider sector entry: %w", err) } } @@ -258,6 +261,8 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con case amt.Modify: + var oldState, prevOldState market12.DealState + var newState market13.DealState if err := prevOldState.UnmarshalCBOR(bytes.NewReader(change.Before.Raw)); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to unmarshal old state: %w", err) } From 4be4b3090dd8551d7f3ac8ee5fde6d4a3044028d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 7 Feb 2024 22:37:03 +0100 Subject: [PATCH 41/52] v13 not slashed is -1, not slashed is -1, not sla.. --- builtin/v13/migration/market.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index c9028405..49cc82d9 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -247,7 +247,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to get previous newstate: not found") } - if prevOutState.SlashEpoch != -1 { + if prevOutState.SlashEpoch == -1 { // if the previous OUT state was not slashed then it has a provider sector entry that needs to be removed if err := removeProviderSectorEntry(deal, &prevOutState); err != nil { From b4466b2449eedadbd5dc3e985119edffb1138532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Feb 2024 12:56:57 +0100 Subject: [PATCH 42/52] v13 more migration debug logs --- builtin/v13/migration/market.go | 4 ++++ builtin/v13/migration/miner.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 49cc82d9..ca85aded 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -504,8 +504,12 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. } providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) } else { + fmt.Printf("deal %d not found in providerSectors: %v\n", deal, oldState) + newState.SectorNumber = 0 // FIP: if such a sector cannot be found, assert that the deal's end epoch has passed and use sector ID 0 } + } else { + fmt.Printf("deal %d slashed, not inserting ProviderSectors record: %v\n", deal, oldState) } if err := newStateArray.Set(uint64(deal), &newState); err != nil { diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index d50a7b1d..36fbd7d8 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -123,7 +123,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - //fmt.Printf("prov ds ADD %d: %v\n", sectorNo, sector.DealIDs) + fmt.Printf("prov dealsector ADD %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { @@ -164,7 +164,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } // snap - //fmt.Printf("prov ds MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) + fmt.Printf("prov dealsector MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sectorAfter.DealIDs { @@ -193,7 +193,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - //fmt.Printf("prov ds REM %d: %v\n", sectorNo, sector.DealIDs) + fmt.Printf("prov dealsector REM %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { From e88d6132f573f7b607e076cd85fa671855bac73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Feb 2024 16:02:15 +0100 Subject: [PATCH 43/52] v13: Remove DEALS in providerSectorsMemRemoved loop --- builtin/v13/migration/market.go | 36 +++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index ca85aded..816499d5 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -369,13 +369,37 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con return cid.Undef, cid.Undef, xerrors.Errorf("failed to load actor sectors map: %w", err) } - for sector := range sectors { - // todo should we bother checking deals in the sector? + for sector, deals := range sectors { + var sectorDeals market13.SectorDealIDs // []abi.DealID + found, err := actorSectors.Get(miner13.SectorKey(sector), §orDeals) + if err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to get sector: %w", err) + } + if !found { + continue + } - if found, err := actorSectors.TryDelete(miner13.SectorKey(sector)); err != nil { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("removing providerSectors entry: %w", err) - } else if !found { - fmt.Printf("not deleting sector %d, not found for miner %d\n", sector, miner) + // remove deals from sectorDeals + for _, deal := range deals { + for j, d := range sectorDeals { + if d == deal { + // delete j-th element + sectorDeals = append(sectorDeals[:j], sectorDeals[j+1:]...) + break + } + } + } + + if len(sectorDeals) == 0 { + fmt.Printf("delete providersector %d, deals %v\n", sector, deals) + if err := actorSectors.Delete(miner13.SectorKey(sector)); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to delete sector: %w", err) + } + } else { + fmt.Printf("update providersector %d, deals %v\n", sector, sectorDeals) + if err := actorSectors.Put(miner13.SectorKey(sector), §orDeals); err != nil { + return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to put sector: %w", err) + } } } From a7dbfc361ea25d5e099b3caaa839cd0ae120866e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Feb 2024 16:33:08 +0100 Subject: [PATCH 44/52] v13: Mute migration comments --- builtin/v13/migration/market.go | 19 +++++++++---------- builtin/v13/migration/miner.go | 6 +++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 816499d5..c4d41f90 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "errors" - "fmt" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-amt-ipld/v4" "github.com/filecoin-project/go-state-types/abi" @@ -229,14 +228,14 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorNumber = si } - fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) + //fmt.Printf("add deal %d to sector %d\n", deal, newState.SectorNumber) if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) } case amt.Remove: - fmt.Printf("remove deal %d\n", deal) + //fmt.Printf("remove deal %d\n", deal) var prevOutState market13.DealState // note: this says "prevOut", not "prevOld" ok, err := prevOutStates.Get(uint64(deal), &prevOutState) @@ -284,7 +283,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con // if nowOld.Slash == -1, then 'now' is not slashed, so we should try to find the sector // we probably don't care about prevOldSlash?? beyond it changing from newSlash? - fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) + //fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) if oldState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { // not slashed -> slashed @@ -359,7 +358,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con // removed or if it was never there to begin with, which is why we // may occasionally end up here. - fmt.Printf("no actor sectors for miner %d\n", miner) + //fmt.Printf("no actor sectors for miner %d\n", miner) continue } @@ -391,12 +390,12 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } if len(sectorDeals) == 0 { - fmt.Printf("delete providersector %d, deals %v\n", sector, deals) + //fmt.Printf("delete providersector %d, deals %v\n", sector, deals) if err := actorSectors.Delete(miner13.SectorKey(sector)); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to delete sector: %w", err) } } else { - fmt.Printf("update providersector %d, deals %v\n", sector, sectorDeals) + //fmt.Printf("update providersector %d, deals %v\n", sector, sectorDeals) if err := actorSectors.Put(miner13.SectorKey(sector), §orDeals); err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to put sector: %w", err) } @@ -528,13 +527,13 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. } providerSectorsMem[sid.Miner][sid.Number] = append(providerSectorsMem[sid.Miner][sid.Number], deal) } else { - fmt.Printf("deal %d not found in providerSectors: %v\n", deal, oldState) + //fmt.Printf("deal %d not found in providerSectors: %v\n", deal, oldState) newState.SectorNumber = 0 // FIP: if such a sector cannot be found, assert that the deal's end epoch has passed and use sector ID 0 } - } else { + } /*else { fmt.Printf("deal %d slashed, not inserting ProviderSectors record: %v\n", deal, oldState) - } + }*/ if err := newStateArray.Set(uint64(deal), &newState); err != nil { return xerrors.Errorf("failed to append new state: %w", err) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 36fbd7d8..6bdeaf65 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -123,7 +123,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - fmt.Printf("prov dealsector ADD %d: %v\n", sectorNo, sector.DealIDs) + //fmt.Printf("prov dealsector ADD %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { @@ -164,7 +164,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, } // snap - fmt.Printf("prov dealsector MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) + //fmt.Printf("prov dealsector MOD %d: %v -> %v\n", sectorNo, sectorBefore.DealIDs, sectorAfter.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sectorAfter.DealIDs { @@ -193,7 +193,7 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, continue } - fmt.Printf("prov dealsector REM %d: %v\n", sectorNo, sector.DealIDs) + //fmt.Printf("prov dealsector REM %d: %v\n", sectorNo, sector.DealIDs) m.providerSectors.lk.Lock() for _, dealID := range sector.DealIDs { From c675d85d7ec7ee5e79e8526880cbd5ea8efdd072 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 6 Feb 2024 19:11:57 +1100 Subject: [PATCH 45/52] v13: make AggregateProofType optional on ProveCommitSectors3Params & ProveReplicaUpdates3Params Ref: https://github.com/filecoin-project/FIPs/pull/934 --- abi/cbor_bytes.go | 2 +- abi/cbor_string.go | 2 +- builtin/v10/account/cbor_gen.go | 4 +- builtin/v10/cron/cbor_gen.go | 2 +- builtin/v10/datacap/cbor_gen.go | 12 +- builtin/v10/eam/cbor_gen.go | 12 +- builtin/v10/evm/cbor_gen.go | 12 +- builtin/v10/init/cbor_gen.go | 10 +- builtin/v10/market/cbor_gen.go | 26 ++-- builtin/v10/market/deal.go | 6 +- builtin/v10/miner/cbor_gen.go | 93 +++++------ builtin/v10/multisig/cbor_gen.go | 19 +-- builtin/v10/paych/cbor_gen.go | 8 +- builtin/v10/power/cbor_gen.go | 18 +-- builtin/v10/reward/cbor_gen.go | 1 + builtin/v10/verifreg/cbor_gen.go | 34 ++-- builtin/v11/account/cbor_gen.go | 4 +- builtin/v11/cron/cbor_gen.go | 2 +- builtin/v11/datacap/cbor_gen.go | 12 +- builtin/v11/eam/cbor_gen.go | 12 +- builtin/v11/evm/cbor_gen.go | 12 +- builtin/v11/init/cbor_gen.go | 10 +- builtin/v11/market/cbor_gen.go | 26 ++-- builtin/v11/market/deal.go | 6 +- builtin/v11/miner/cbor_gen.go | 93 +++++------ builtin/v11/multisig/cbor_gen.go | 19 +-- builtin/v11/paych/cbor_gen.go | 8 +- builtin/v11/power/cbor_gen.go | 18 +-- builtin/v11/reward/cbor_gen.go | 1 + builtin/v11/verifreg/cbor_gen.go | 34 ++-- builtin/v12/account/cbor_gen.go | 4 +- builtin/v12/cron/cbor_gen.go | 2 +- builtin/v12/datacap/cbor_gen.go | 12 +- builtin/v12/eam/cbor_gen.go | 12 +- builtin/v12/evm/cbor_gen.go | 12 +- builtin/v12/init/cbor_gen.go | 10 +- builtin/v12/market/cbor_gen.go | 22 +-- builtin/v12/market/deal.go | 2 +- builtin/v12/miner/cbor_gen.go | 93 +++++------ builtin/v12/multisig/cbor_gen.go | 19 +-- builtin/v12/paych/cbor_gen.go | 8 +- builtin/v12/power/cbor_gen.go | 18 +-- builtin/v12/reward/cbor_gen.go | 1 + builtin/v12/verifreg/cbor_gen.go | 34 ++-- builtin/v13/account/cbor_gen.go | 4 +- builtin/v13/cron/cbor_gen.go | 2 +- builtin/v13/datacap/cbor_gen.go | 12 +- builtin/v13/eam/cbor_gen.go | 12 +- builtin/v13/evm/cbor_gen.go | 12 +- builtin/v13/init/cbor_gen.go | 10 +- builtin/v13/market/cbor_gen.go | 25 +-- builtin/v13/market/deal.go | 2 +- builtin/v13/miner/cbor_gen.go | 232 ++++++++++++++++------------ builtin/v13/miner/miner_types.go | 4 +- builtin/v13/multisig/cbor_gen.go | 19 +-- builtin/v13/paych/cbor_gen.go | 8 +- builtin/v13/power/cbor_gen.go | 18 +-- builtin/v13/reward/cbor_gen.go | 1 + builtin/v13/verifreg/cbor_gen.go | 34 ++-- builtin/v8/cron/cbor_gen.go | 2 +- builtin/v8/init/cbor_gen.go | 6 +- builtin/v8/market/cbor_gen.go | 23 +-- builtin/v8/market/deal.go | 2 +- builtin/v8/miner/cbor_gen.go | 69 +++++---- builtin/v8/multisig/cbor_gen.go | 19 +-- builtin/v8/paych/cbor_gen.go | 8 +- builtin/v8/power/cbor_gen.go | 18 +-- builtin/v8/reward/cbor_gen.go | 1 + builtin/v9/account/cbor_gen.go | 4 +- builtin/v9/cron/cbor_gen.go | 2 +- builtin/v9/datacap/cbor_gen.go | 12 +- builtin/v9/init/cbor_gen.go | 6 +- builtin/v9/init/init_actor_state.go | 2 +- builtin/v9/market/cbor_gen.go | 24 +-- builtin/v9/market/deal.go | 2 +- builtin/v9/miner/cbor_gen.go | 89 ++++++----- builtin/v9/multisig/cbor_gen.go | 19 +-- builtin/v9/paych/cbor_gen.go | 8 +- builtin/v9/power/cbor_gen.go | 18 +-- builtin/v9/reward/cbor_gen.go | 1 + builtin/v9/verifreg/cbor_gen.go | 34 ++-- go.mod | 14 +- go.sum | 30 ++-- manifest/cbor_gen.go | 2 +- manifest/manifest.go | 10 +- proof/cbor_gen.go | 22 +-- 86 files changed, 868 insertions(+), 741 deletions(-) diff --git a/abi/cbor_bytes.go b/abi/cbor_bytes.go index f3acf177..7ffddc7f 100644 --- a/abi/cbor_bytes.go +++ b/abi/cbor_bytes.go @@ -11,7 +11,7 @@ import ( type CborBytes []byte func (t *CborBytes) MarshalCBOR(w io.Writer) error { - if len(*t) > cbg.ByteArrayMaxLen { + if uint64(len(*t)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("byte array was too long") } diff --git a/abi/cbor_string.go b/abi/cbor_string.go index e3d316f7..72c9181a 100644 --- a/abi/cbor_string.go +++ b/abi/cbor_string.go @@ -13,7 +13,7 @@ type CborString string func (t *CborString) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 8) - if len(*t) > cbg.MaxLength { + if uint64(len(*t)) > cbg.MaxLength { return xerrors.Errorf("Value in t was too long") } diff --git a/builtin/v10/account/cbor_gen.go b/builtin/v10/account/cbor_gen.go index 4a49915b..0bd09be2 100644 --- a/builtin/v10/account/cbor_gen.go +++ b/builtin/v10/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if len(t.Signature) > cbg.ByteArrayMaxLen { + if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if len(t.Message) > cbg.ByteArrayMaxLen { + if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Message was too long") } diff --git a/builtin/v10/cron/cbor_gen.go b/builtin/v10/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v10/cron/cbor_gen.go +++ b/builtin/v10/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v10/datacap/cbor_gen.go b/builtin/v10/datacap/cbor_gen.go index 4f61008b..42c936a6 100644 --- a/builtin/v10/datacap/cbor_gen.go +++ b/builtin/v10/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if len(t.Operators) > cbg.MaxLength { + if uint64(len(t.Operators)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } diff --git a/builtin/v10/eam/cbor_gen.go b/builtin/v10/eam/cbor_gen.go index 368a14e0..ef731149 100644 --- a/builtin/v10/eam/cbor_gen.go +++ b/builtin/v10/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if len(t.Salt) > cbg.ByteArrayMaxLen { + if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } diff --git a/builtin/v10/evm/cbor_gen.go b/builtin/v10/evm/cbor_gen.go index f0b0a7b8..dffac8ac 100644 --- a/builtin/v10/evm/cbor_gen.go +++ b/builtin/v10/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if len(t.BytecodeHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if len(t.Creator) > cbg.ByteArrayMaxLen { + if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if len(t.StorageKey) > cbg.ByteArrayMaxLen { + if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if len(t.Input) > cbg.ByteArrayMaxLen { + if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if len(t.Caller) > cbg.ByteArrayMaxLen { + if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Caller was too long") } diff --git a/builtin/v10/init/cbor_gen.go b/builtin/v10/init/cbor_gen.go index 161f445f..e648e48a 100644 --- a/builtin/v10/init/cbor_gen.go +++ b/builtin/v10/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if len(t.SubAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } diff --git a/builtin/v10/market/cbor_gen.go b/builtin/v10/market/cbor_gen.go index 88062076..10542ba0 100644 --- a/builtin/v10/market/cbor_gen.go +++ b/builtin/v10/market/cbor_gen.go @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -778,6 +778,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -895,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if len(t.VerifiedInfos) > cbg.MaxLength { + if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -999,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1094,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1189,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if len(t.Inputs) > cbg.MaxLength { + if uint64(len(t.Inputs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1294,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if len(t.CommDs) > cbg.MaxLength { + if uint64(len(t.CommDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1560,6 +1561,7 @@ func (t *GetDealTermReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1674,6 +1676,7 @@ func (t *GetDealActivationReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1779,7 +1782,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2255,7 +2258,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2553,7 +2556,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2578,6 +2581,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v10/market/deal.go b/builtin/v10/market/deal.go index bdd4a4e5..da4544ad 100644 --- a/builtin/v10/market/deal.go +++ b/builtin/v10/market/deal.go @@ -46,7 +46,7 @@ type DealLabel struct { var EmptyDealLabel = DealLabel{} func NewLabelFromString(s string) (DealLabel, error) { - if len(s) > DealMaxLabelSize { + if uint64(len(s)) > DealMaxLabelSize { return EmptyDealLabel, xerrors.Errorf("provided string is too large to be a label (%d), max length (%d)", len(s), DealMaxLabelSize) } if !utf8.ValidString(s) { @@ -59,7 +59,7 @@ func NewLabelFromString(s string) (DealLabel, error) { } func NewLabelFromBytes(b []byte) (DealLabel, error) { - if len(b) > DealMaxLabelSize { + if uint64(len(b)) > DealMaxLabelSize { return EmptyDealLabel, xerrors.Errorf("provided bytes are too large to be a label (%d), max length (%d)", len(b), DealMaxLabelSize) } @@ -112,7 +112,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v10/miner/cbor_gen.go b/builtin/v10/miner/cbor_gen.go index cb4b2623..65d891b1 100644 --- a/builtin/v10/miner/cbor_gen.go +++ b/builtin/v10/miner/cbor_gen.go @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1533,6 +1533,7 @@ func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1654,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1925,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2339,6 +2340,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2417,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2609,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2802,6 +2804,7 @@ func (t *BeneficiaryTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3049,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3167,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3271,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3355,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3370,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3396,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3623,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3925,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -4017,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4112,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4207,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4366,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4461,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4556,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4794,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4807,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4820,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4998,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5141,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5149,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5471,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5571,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5658,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5762,6 +5765,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5831,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5926,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -6040,6 +6044,7 @@ func (t *ChangeBeneficiaryParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6287,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6365,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if len(t.MultiAddrs) > cbg.ByteArrayMaxLen { + if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6661,6 +6666,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6963,7 +6969,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6990,7 +6996,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7220,7 +7226,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7247,7 +7253,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7476,7 +7482,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if len(t.SectorsWithClaims) > cbg.MaxLength { + if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7500,6 +7506,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -7650,7 +7657,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if len(t.MaintainClaims) > cbg.MaxLength { + if uint64(len(t.MaintainClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7666,7 +7673,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if len(t.DropClaims) > cbg.MaxLength { + if uint64(len(t.DropClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } diff --git a/builtin/v10/multisig/cbor_gen.go b/builtin/v10/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v10/multisig/cbor_gen.go +++ b/builtin/v10/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v10/paych/cbor_gen.go b/builtin/v10/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v10/paych/cbor_gen.go +++ b/builtin/v10/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v10/power/cbor_gen.go b/builtin/v10/power/cbor_gen.go index 883b0b4c..827e4263 100644 --- a/builtin/v10/power/cbor_gen.go +++ b/builtin/v10/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v10/reward/cbor_gen.go b/builtin/v10/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v10/reward/cbor_gen.go +++ b/builtin/v10/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v10/verifreg/cbor_gen.go b/builtin/v10/verifreg/cbor_gen.go index 230e422b..e16c254b 100644 --- a/builtin/v10/verifreg/cbor_gen.go +++ b/builtin/v10/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if len(t.AllocationIds) > cbg.MaxLength { + if uint64(len(t.AllocationIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if len(t.Claims) > cbg.MaxLength { + if uint64(len(t.Claims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if len(t.NewAllocations) > cbg.MaxLength { + if uint64(len(t.NewAllocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if len(t.Terms) > cbg.MaxLength { + if uint64(len(t.Terms)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2319,6 +2319,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2441,6 +2442,7 @@ func (t *SectorAllocationClaim) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2848,6 +2850,7 @@ func (t *ClaimTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2965,6 +2968,7 @@ func (t *ClaimExtensionRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3112,6 +3116,7 @@ func (t *Allocation) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3334,6 +3339,7 @@ func (t *AllocationRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3493,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if len(t.Allocations) > cbg.MaxLength { + if uint64(len(t.Allocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3508,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } diff --git a/builtin/v11/account/cbor_gen.go b/builtin/v11/account/cbor_gen.go index 4a49915b..0bd09be2 100644 --- a/builtin/v11/account/cbor_gen.go +++ b/builtin/v11/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if len(t.Signature) > cbg.ByteArrayMaxLen { + if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if len(t.Message) > cbg.ByteArrayMaxLen { + if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Message was too long") } diff --git a/builtin/v11/cron/cbor_gen.go b/builtin/v11/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v11/cron/cbor_gen.go +++ b/builtin/v11/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v11/datacap/cbor_gen.go b/builtin/v11/datacap/cbor_gen.go index 4f61008b..42c936a6 100644 --- a/builtin/v11/datacap/cbor_gen.go +++ b/builtin/v11/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if len(t.Operators) > cbg.MaxLength { + if uint64(len(t.Operators)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } diff --git a/builtin/v11/eam/cbor_gen.go b/builtin/v11/eam/cbor_gen.go index 368a14e0..ef731149 100644 --- a/builtin/v11/eam/cbor_gen.go +++ b/builtin/v11/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if len(t.Salt) > cbg.ByteArrayMaxLen { + if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } diff --git a/builtin/v11/evm/cbor_gen.go b/builtin/v11/evm/cbor_gen.go index f0b0a7b8..dffac8ac 100644 --- a/builtin/v11/evm/cbor_gen.go +++ b/builtin/v11/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if len(t.BytecodeHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if len(t.Creator) > cbg.ByteArrayMaxLen { + if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if len(t.StorageKey) > cbg.ByteArrayMaxLen { + if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if len(t.Input) > cbg.ByteArrayMaxLen { + if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if len(t.Caller) > cbg.ByteArrayMaxLen { + if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Caller was too long") } diff --git a/builtin/v11/init/cbor_gen.go b/builtin/v11/init/cbor_gen.go index 161f445f..e648e48a 100644 --- a/builtin/v11/init/cbor_gen.go +++ b/builtin/v11/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if len(t.SubAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } diff --git a/builtin/v11/market/cbor_gen.go b/builtin/v11/market/cbor_gen.go index e06ffc83..28c99082 100644 --- a/builtin/v11/market/cbor_gen.go +++ b/builtin/v11/market/cbor_gen.go @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -778,6 +778,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -895,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if len(t.VerifiedInfos) > cbg.MaxLength { + if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -999,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1094,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1189,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if len(t.Inputs) > cbg.MaxLength { + if uint64(len(t.Inputs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1294,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if len(t.CommDs) > cbg.MaxLength { + if uint64(len(t.CommDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1560,6 +1561,7 @@ func (t *GetDealTermReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1674,6 +1676,7 @@ func (t *GetDealActivationReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1779,7 +1782,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2255,7 +2258,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2553,7 +2556,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2578,6 +2581,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v11/market/deal.go b/builtin/v11/market/deal.go index 382c2219..2114ef9b 100644 --- a/builtin/v11/market/deal.go +++ b/builtin/v11/market/deal.go @@ -46,7 +46,7 @@ type DealLabel struct { var EmptyDealLabel = DealLabel{} func NewLabelFromString(s string) (DealLabel, error) { - if len(s) > DealMaxLabelSize { + if uint64(len(s)) > DealMaxLabelSize { return EmptyDealLabel, xerrors.Errorf("provided string is too large to be a label (%d), max length (%d)", len(s), DealMaxLabelSize) } if !utf8.ValidString(s) { @@ -59,7 +59,7 @@ func NewLabelFromString(s string) (DealLabel, error) { } func NewLabelFromBytes(b []byte) (DealLabel, error) { - if len(b) > DealMaxLabelSize { + if uint64(len(b)) > DealMaxLabelSize { return EmptyDealLabel, xerrors.Errorf("provided bytes are too large to be a label (%d), max length (%d)", len(b), DealMaxLabelSize) } @@ -112,7 +112,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v11/miner/cbor_gen.go b/builtin/v11/miner/cbor_gen.go index ed2fe006..b550b50a 100644 --- a/builtin/v11/miner/cbor_gen.go +++ b/builtin/v11/miner/cbor_gen.go @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1533,6 +1533,7 @@ func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1654,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1925,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2339,6 +2340,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2417,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2609,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2802,6 +2804,7 @@ func (t *BeneficiaryTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3049,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3167,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3271,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3355,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3370,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3396,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3623,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3925,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -4017,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4112,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4207,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4366,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4461,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4556,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4794,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4807,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4820,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4998,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5141,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5149,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5471,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5571,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5658,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5762,6 +5765,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5831,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5926,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -6040,6 +6044,7 @@ func (t *ChangeBeneficiaryParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6287,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6365,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if len(t.MultiAddrs) > cbg.ByteArrayMaxLen { + if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6661,6 +6666,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6963,7 +6969,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6990,7 +6996,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7220,7 +7226,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7247,7 +7253,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7476,7 +7482,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if len(t.SectorsWithClaims) > cbg.MaxLength { + if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7500,6 +7506,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -7650,7 +7657,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if len(t.MaintainClaims) > cbg.MaxLength { + if uint64(len(t.MaintainClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7666,7 +7673,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if len(t.DropClaims) > cbg.MaxLength { + if uint64(len(t.DropClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } diff --git a/builtin/v11/multisig/cbor_gen.go b/builtin/v11/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v11/multisig/cbor_gen.go +++ b/builtin/v11/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v11/paych/cbor_gen.go b/builtin/v11/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v11/paych/cbor_gen.go +++ b/builtin/v11/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v11/power/cbor_gen.go b/builtin/v11/power/cbor_gen.go index 883b0b4c..827e4263 100644 --- a/builtin/v11/power/cbor_gen.go +++ b/builtin/v11/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v11/reward/cbor_gen.go b/builtin/v11/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v11/reward/cbor_gen.go +++ b/builtin/v11/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v11/verifreg/cbor_gen.go b/builtin/v11/verifreg/cbor_gen.go index 230e422b..e16c254b 100644 --- a/builtin/v11/verifreg/cbor_gen.go +++ b/builtin/v11/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if len(t.AllocationIds) > cbg.MaxLength { + if uint64(len(t.AllocationIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if len(t.Claims) > cbg.MaxLength { + if uint64(len(t.Claims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if len(t.NewAllocations) > cbg.MaxLength { + if uint64(len(t.NewAllocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if len(t.Terms) > cbg.MaxLength { + if uint64(len(t.Terms)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2319,6 +2319,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2441,6 +2442,7 @@ func (t *SectorAllocationClaim) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2848,6 +2850,7 @@ func (t *ClaimTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2965,6 +2968,7 @@ func (t *ClaimExtensionRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3112,6 +3116,7 @@ func (t *Allocation) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3334,6 +3339,7 @@ func (t *AllocationRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3493,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if len(t.Allocations) > cbg.MaxLength { + if uint64(len(t.Allocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3508,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } diff --git a/builtin/v12/account/cbor_gen.go b/builtin/v12/account/cbor_gen.go index 4a49915b..0bd09be2 100644 --- a/builtin/v12/account/cbor_gen.go +++ b/builtin/v12/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if len(t.Signature) > cbg.ByteArrayMaxLen { + if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if len(t.Message) > cbg.ByteArrayMaxLen { + if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Message was too long") } diff --git a/builtin/v12/cron/cbor_gen.go b/builtin/v12/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v12/cron/cbor_gen.go +++ b/builtin/v12/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v12/datacap/cbor_gen.go b/builtin/v12/datacap/cbor_gen.go index 4f61008b..42c936a6 100644 --- a/builtin/v12/datacap/cbor_gen.go +++ b/builtin/v12/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if len(t.Operators) > cbg.MaxLength { + if uint64(len(t.Operators)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } diff --git a/builtin/v12/eam/cbor_gen.go b/builtin/v12/eam/cbor_gen.go index 368a14e0..ef731149 100644 --- a/builtin/v12/eam/cbor_gen.go +++ b/builtin/v12/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if len(t.Salt) > cbg.ByteArrayMaxLen { + if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } diff --git a/builtin/v12/evm/cbor_gen.go b/builtin/v12/evm/cbor_gen.go index f0b0a7b8..dffac8ac 100644 --- a/builtin/v12/evm/cbor_gen.go +++ b/builtin/v12/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if len(t.BytecodeHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if len(t.Creator) > cbg.ByteArrayMaxLen { + if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if len(t.StorageKey) > cbg.ByteArrayMaxLen { + if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if len(t.Input) > cbg.ByteArrayMaxLen { + if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if len(t.Caller) > cbg.ByteArrayMaxLen { + if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Caller was too long") } diff --git a/builtin/v12/init/cbor_gen.go b/builtin/v12/init/cbor_gen.go index 161f445f..e648e48a 100644 --- a/builtin/v12/init/cbor_gen.go +++ b/builtin/v12/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if len(t.SubAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } diff --git a/builtin/v12/market/cbor_gen.go b/builtin/v12/market/cbor_gen.go index 821a198d..5905a7af 100644 --- a/builtin/v12/market/cbor_gen.go +++ b/builtin/v12/market/cbor_gen.go @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -778,6 +778,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -895,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if len(t.VerifiedInfos) > cbg.MaxLength { + if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -999,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1094,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.UnsealedCIDs ([]*cid.Cid) (slice) - if len(t.UnsealedCIDs) > cbg.MaxLength { + if uint64(len(t.UnsealedCIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.UnsealedCIDs was too long") } @@ -1380,6 +1381,7 @@ func (t *GetDealTermReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1494,6 +1496,7 @@ func (t *GetDealActivationReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1599,7 +1602,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2075,7 +2078,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2296,7 +2299,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2321,6 +2324,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v12/market/deal.go b/builtin/v12/market/deal.go index 73ee872a..d025802c 100644 --- a/builtin/v12/market/deal.go +++ b/builtin/v12/market/deal.go @@ -111,7 +111,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v12/miner/cbor_gen.go b/builtin/v12/miner/cbor_gen.go index 1e0c2c8f..e414b56d 100644 --- a/builtin/v12/miner/cbor_gen.go +++ b/builtin/v12/miner/cbor_gen.go @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1533,6 +1533,7 @@ func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1654,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1925,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2338,6 +2339,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2416,7 +2418,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2608,7 +2610,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2801,6 +2803,7 @@ func (t *BeneficiaryTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3048,7 +3051,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3166,7 +3169,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3270,7 +3273,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3354,7 +3357,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3369,7 +3372,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3395,7 +3398,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3622,7 +3625,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3924,7 +3927,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -4016,7 +4019,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4111,7 +4114,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4206,7 +4209,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4365,7 +4368,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4460,7 +4463,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4555,7 +4558,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4793,7 +4796,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4806,7 +4809,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4819,7 +4822,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4997,7 +5000,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5140,7 +5143,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5148,7 +5151,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5470,7 +5473,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5570,7 +5573,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5657,7 +5660,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5761,6 +5764,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5830,7 +5834,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5925,7 +5929,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -6039,6 +6043,7 @@ func (t *ChangeBeneficiaryParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6286,7 +6291,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6364,7 +6369,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if len(t.MultiAddrs) > cbg.ByteArrayMaxLen { + if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6660,6 +6665,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6962,7 +6968,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6989,7 +6995,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7219,7 +7225,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7246,7 +7252,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7475,7 +7481,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if len(t.SectorsWithClaims) > cbg.MaxLength { + if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7499,6 +7505,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -7649,7 +7656,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if len(t.MaintainClaims) > cbg.MaxLength { + if uint64(len(t.MaintainClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7665,7 +7672,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if len(t.DropClaims) > cbg.MaxLength { + if uint64(len(t.DropClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } diff --git a/builtin/v12/multisig/cbor_gen.go b/builtin/v12/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v12/multisig/cbor_gen.go +++ b/builtin/v12/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v12/paych/cbor_gen.go b/builtin/v12/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v12/paych/cbor_gen.go +++ b/builtin/v12/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v12/power/cbor_gen.go b/builtin/v12/power/cbor_gen.go index 883b0b4c..827e4263 100644 --- a/builtin/v12/power/cbor_gen.go +++ b/builtin/v12/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v12/reward/cbor_gen.go b/builtin/v12/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v12/reward/cbor_gen.go +++ b/builtin/v12/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v12/verifreg/cbor_gen.go b/builtin/v12/verifreg/cbor_gen.go index 230e422b..e16c254b 100644 --- a/builtin/v12/verifreg/cbor_gen.go +++ b/builtin/v12/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if len(t.AllocationIds) > cbg.MaxLength { + if uint64(len(t.AllocationIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if len(t.Claims) > cbg.MaxLength { + if uint64(len(t.Claims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if len(t.NewAllocations) > cbg.MaxLength { + if uint64(len(t.NewAllocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if len(t.Terms) > cbg.MaxLength { + if uint64(len(t.Terms)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2319,6 +2319,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2441,6 +2442,7 @@ func (t *SectorAllocationClaim) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2848,6 +2850,7 @@ func (t *ClaimTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2965,6 +2968,7 @@ func (t *ClaimExtensionRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3112,6 +3116,7 @@ func (t *Allocation) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3334,6 +3339,7 @@ func (t *AllocationRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3493,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if len(t.Allocations) > cbg.MaxLength { + if uint64(len(t.Allocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3508,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } diff --git a/builtin/v13/account/cbor_gen.go b/builtin/v13/account/cbor_gen.go index 4a49915b..0bd09be2 100644 --- a/builtin/v13/account/cbor_gen.go +++ b/builtin/v13/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if len(t.Signature) > cbg.ByteArrayMaxLen { + if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if len(t.Message) > cbg.ByteArrayMaxLen { + if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Message was too long") } diff --git a/builtin/v13/cron/cbor_gen.go b/builtin/v13/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v13/cron/cbor_gen.go +++ b/builtin/v13/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v13/datacap/cbor_gen.go b/builtin/v13/datacap/cbor_gen.go index 4f61008b..42c936a6 100644 --- a/builtin/v13/datacap/cbor_gen.go +++ b/builtin/v13/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if len(t.Operators) > cbg.MaxLength { + if uint64(len(t.Operators)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } diff --git a/builtin/v13/eam/cbor_gen.go b/builtin/v13/eam/cbor_gen.go index 368a14e0..ef731149 100644 --- a/builtin/v13/eam/cbor_gen.go +++ b/builtin/v13/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if len(t.Salt) > cbg.ByteArrayMaxLen { + if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if len(t.EthAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } diff --git a/builtin/v13/evm/cbor_gen.go b/builtin/v13/evm/cbor_gen.go index f0b0a7b8..dffac8ac 100644 --- a/builtin/v13/evm/cbor_gen.go +++ b/builtin/v13/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if len(t.BytecodeHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if len(t.Creator) > cbg.ByteArrayMaxLen { + if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if len(t.Initcode) > cbg.ByteArrayMaxLen { + if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if len(t.StorageKey) > cbg.ByteArrayMaxLen { + if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if len(t.Input) > cbg.ByteArrayMaxLen { + if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if len(t.Caller) > cbg.ByteArrayMaxLen { + if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Caller was too long") } diff --git a/builtin/v13/init/cbor_gen.go b/builtin/v13/init/cbor_gen.go index 161f445f..e648e48a 100644 --- a/builtin/v13/init/cbor_gen.go +++ b/builtin/v13/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if len(t.SubAddress) > cbg.ByteArrayMaxLen { + if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index 2fd49cf2..e2889dc2 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -357,6 +357,7 @@ func (t *DealState) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -479,7 +480,7 @@ func (t *SectorDealIDs) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) // (*t) (market.SectorDealIDs) (slice) - if len((*t)) > cbg.MaxLength { + if uint64(len((*t))) > cbg.MaxLength { return xerrors.Errorf("Slice value in field (*t) was too long") } @@ -635,7 +636,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -730,7 +731,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -845,7 +846,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -870,6 +871,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -987,7 +989,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if len(t.VerifiedInfos) > cbg.MaxLength { + if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -1091,7 +1093,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1186,7 +1188,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.UnsealedCIDs ([]*cid.Cid) (slice) - if len(t.UnsealedCIDs) > cbg.MaxLength { + if uint64(len(t.UnsealedCIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.UnsealedCIDs was too long") } @@ -1472,6 +1474,7 @@ func (t *GetDealTermReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1586,6 +1589,7 @@ func (t *GetDealActivationReturn) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1691,7 +1695,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2167,7 +2171,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2388,7 +2392,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2413,6 +2417,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v13/market/deal.go b/builtin/v13/market/deal.go index 0b19ae84..36b615ae 100644 --- a/builtin/v13/market/deal.go +++ b/builtin/v13/market/deal.go @@ -110,7 +110,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index c51ad003..1d73014b 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -364,7 +364,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -384,7 +384,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -397,7 +397,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -405,7 +405,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -797,7 +797,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1534,6 +1534,7 @@ func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1655,7 +1656,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1926,7 +1927,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2339,6 +2340,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2417,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2609,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2802,6 +2804,7 @@ func (t *BeneficiaryTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3049,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3167,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3271,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3355,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3370,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3396,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3623,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3925,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -4017,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4112,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4207,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4366,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4461,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4556,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4794,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4807,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4820,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4998,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5141,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5149,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5471,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5571,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5658,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5762,6 +5765,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5831,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5926,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -6040,6 +6044,7 @@ func (t *ChangeBeneficiaryParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6287,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6365,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if len(t.MultiAddrs) > cbg.ByteArrayMaxLen { + if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6443,7 +6448,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.SectorActivations ([]miner.SectorActivationManifest) (slice) - if len(t.SectorActivations) > cbg.MaxLength { + if uint64(len(t.SectorActivations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorActivations was too long") } @@ -6458,7 +6463,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.SectorProofs ([][]uint8) (slice) - if len(t.SectorProofs) > cbg.MaxLength { + if uint64(len(t.SectorProofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorProofs was too long") } @@ -6466,7 +6471,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.SectorProofs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -6481,7 +6486,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -6494,13 +6499,19 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) - if t.AggregateProofType >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.AggregateProofType)); err != nil { + if t.AggregateProofType == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.AggregateProofType-1)); err != nil { - return err + if *t.AggregateProofType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.AggregateProofType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.AggregateProofType-1)); err != nil { + return err + } } } @@ -6651,28 +6662,38 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) { - maj, extra, err := cr.ReadHeader() - var extraI int64 + + b, err := cr.ReadByte() if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") + maj, extra, err = cr.ReadHeader() + var extraI int64 + if err != nil { + return err } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + t.AggregateProofType = &extraI } - t.AggregateProofType = abi.RegisteredAggregationProof(extraI) } // t.RequireActivationSuccess (bool) (bool) @@ -6732,7 +6753,7 @@ func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { } // t.Pieces ([]miner.PieceActivationManifest) (slice) - if len(t.Pieces) > cbg.MaxLength { + if uint64(len(t.Pieces)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Pieces was too long") } @@ -6858,7 +6879,7 @@ func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { } // t.Notify ([]miner.DataActivationNotification) (slice) - if len(t.Notify) > cbg.MaxLength { + if uint64(len(t.Notify)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Notify was too long") } @@ -7086,7 +7107,7 @@ func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -7179,7 +7200,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]miner.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -7303,6 +7324,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -7386,7 +7408,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.SectorUpdates ([]miner.SectorUpdateManifest) (slice) - if len(t.SectorUpdates) > cbg.MaxLength { + if uint64(len(t.SectorUpdates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorUpdates was too long") } @@ -7401,7 +7423,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.SectorProofs ([][]uint8) (slice) - if len(t.SectorProofs) > cbg.MaxLength { + if uint64(len(t.SectorProofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorProofs was too long") } @@ -7409,7 +7431,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.SectorProofs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -7424,7 +7446,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -7448,13 +7470,19 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) - if t.AggregateProofType >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.AggregateProofType)); err != nil { + if t.AggregateProofType == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.AggregateProofType-1)); err != nil { - return err + if *t.AggregateProofType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.AggregateProofType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.AggregateProofType-1)); err != nil { + return err + } } } @@ -7630,28 +7658,38 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { } // t.AggregateProofType (abi.RegisteredAggregationProof) (int64) { - maj, extra, err := cr.ReadHeader() - var extraI int64 + + b, err := cr.ReadByte() if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative overflow") + maj, extra, err = cr.ReadHeader() + var extraI int64 + if err != nil { + return err } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + t.AggregateProofType = &extraI } - t.AggregateProofType = abi.RegisteredAggregationProof(extraI) } // t.RequireActivationSuccess (bool) (bool) @@ -7729,7 +7767,7 @@ func (t *SectorUpdateManifest) MarshalCBOR(w io.Writer) error { } // t.Pieces ([]miner.PieceActivationManifest) (slice) - if len(t.Pieces) > cbg.MaxLength { + if uint64(len(t.Pieces)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Pieces was too long") } @@ -7895,7 +7933,7 @@ func (t *SectorChanges) MarshalCBOR(w io.Writer) error { } // t.Added ([]miner.PieceChange) (slice) - if len(t.Added) > cbg.MaxLength { + if uint64(len(t.Added)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Added was too long") } @@ -8041,7 +8079,7 @@ func (t *PieceChange) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -8363,6 +8401,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -8665,7 +8704,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -8692,7 +8731,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -8922,7 +8961,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -8949,7 +8988,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -9178,7 +9217,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if len(t.SectorsWithClaims) > cbg.MaxLength { + if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -9202,6 +9241,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -9352,7 +9392,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if len(t.MaintainClaims) > cbg.MaxLength { + if uint64(len(t.MaintainClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -9368,7 +9408,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if len(t.DropClaims) > cbg.MaxLength { + if uint64(len(t.DropClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } diff --git a/builtin/v13/miner/miner_types.go b/builtin/v13/miner/miner_types.go index f9f0c956..fabc5105 100644 --- a/builtin/v13/miner/miner_types.go +++ b/builtin/v13/miner/miner_types.go @@ -400,7 +400,7 @@ type ProveCommitSectors3Params struct { SectorActivations []SectorActivationManifest SectorProofs [][]byte AggregateProof []byte - AggregateProofType abi.RegisteredAggregationProof + AggregateProofType *abi.RegisteredAggregationProof RequireActivationSuccess bool RequireNotificationSuccess bool } @@ -454,7 +454,7 @@ type ProveReplicaUpdates3Params struct { SectorProofs [][]byte AggregateProof []byte UpdateProofsType abi.RegisteredUpdateProof - AggregateProofType abi.RegisteredAggregationProof + AggregateProofType *abi.RegisteredAggregationProof RequireActivationSuccess bool RequireNotificationSuccess bool } diff --git a/builtin/v13/multisig/cbor_gen.go b/builtin/v13/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v13/multisig/cbor_gen.go +++ b/builtin/v13/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v13/paych/cbor_gen.go b/builtin/v13/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v13/paych/cbor_gen.go +++ b/builtin/v13/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v13/power/cbor_gen.go b/builtin/v13/power/cbor_gen.go index 883b0b4c..827e4263 100644 --- a/builtin/v13/power/cbor_gen.go +++ b/builtin/v13/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v13/reward/cbor_gen.go b/builtin/v13/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v13/reward/cbor_gen.go +++ b/builtin/v13/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v13/verifreg/cbor_gen.go b/builtin/v13/verifreg/cbor_gen.go index 230e422b..e16c254b 100644 --- a/builtin/v13/verifreg/cbor_gen.go +++ b/builtin/v13/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if len(t.AllocationIds) > cbg.MaxLength { + if uint64(len(t.AllocationIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if len(t.Claims) > cbg.MaxLength { + if uint64(len(t.Claims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if len(t.NewAllocations) > cbg.MaxLength { + if uint64(len(t.NewAllocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if len(t.Terms) > cbg.MaxLength { + if uint64(len(t.Terms)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2319,6 +2319,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2441,6 +2442,7 @@ func (t *SectorAllocationClaim) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2848,6 +2850,7 @@ func (t *ClaimTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2965,6 +2968,7 @@ func (t *ClaimExtensionRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3112,6 +3116,7 @@ func (t *Allocation) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3334,6 +3339,7 @@ func (t *AllocationRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3493,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if len(t.Allocations) > cbg.MaxLength { + if uint64(len(t.Allocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3508,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } diff --git a/builtin/v8/cron/cbor_gen.go b/builtin/v8/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v8/cron/cbor_gen.go +++ b/builtin/v8/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v8/init/cbor_gen.go b/builtin/v8/init/cbor_gen.go index 7d64308d..ddb5664f 100644 --- a/builtin/v8/init/cbor_gen.go +++ b/builtin/v8/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } diff --git a/builtin/v8/market/cbor_gen.go b/builtin/v8/market/cbor_gen.go index 599ce610..4cfec096 100644 --- a/builtin/v8/market/cbor_gen.go +++ b/builtin/v8/market/cbor_gen.go @@ -313,6 +313,7 @@ func (t *DealState) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -502,7 +503,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -597,7 +598,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -712,7 +713,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -737,6 +738,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -849,7 +851,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -944,7 +946,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorWeights) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1039,7 +1041,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if len(t.Inputs) > cbg.MaxLength { + if uint64(len(t.Inputs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1144,7 +1146,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if len(t.CommDs) > cbg.MaxLength { + if uint64(len(t.CommDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1250,7 +1252,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1715,7 +1717,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1931,7 +1933,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1956,6 +1958,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v8/market/deal.go b/builtin/v8/market/deal.go index c6c2da20..5393d4e8 100644 --- a/builtin/v8/market/deal.go +++ b/builtin/v8/market/deal.go @@ -109,7 +109,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v8/miner/cbor_gen.go b/builtin/v8/miner/cbor_gen.go index 95d39068..cd1a1b73 100644 --- a/builtin/v8/miner/cbor_gen.go +++ b/builtin/v8/miner/cbor_gen.go @@ -362,7 +362,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -382,7 +382,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -395,7 +395,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -403,7 +403,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -743,7 +743,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1629,7 +1629,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1948,7 +1948,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2341,6 +2341,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2419,7 +2420,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2611,7 +2612,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2725,7 +2726,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -2843,7 +2844,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -2947,7 +2948,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3031,7 +3032,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3046,7 +3047,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3072,7 +3073,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3299,7 +3300,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3601,7 +3602,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3693,7 +3694,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3788,7 +3789,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -3947,7 +3948,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4042,7 +4043,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4137,7 +4138,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4375,7 +4376,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4388,7 +4389,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4401,7 +4402,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4579,7 +4580,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -4722,7 +4723,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -4730,7 +4731,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5052,7 +5053,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5152,7 +5153,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5239,7 +5240,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5343,6 +5344,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5630,6 +5632,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5932,7 +5935,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -5959,7 +5962,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } diff --git a/builtin/v8/multisig/cbor_gen.go b/builtin/v8/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v8/multisig/cbor_gen.go +++ b/builtin/v8/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v8/paych/cbor_gen.go b/builtin/v8/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v8/paych/cbor_gen.go +++ b/builtin/v8/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v8/power/cbor_gen.go b/builtin/v8/power/cbor_gen.go index 67c51152..d28e889e 100644 --- a/builtin/v8/power/cbor_gen.go +++ b/builtin/v8/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1326,7 +1326,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v8/reward/cbor_gen.go b/builtin/v8/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v8/reward/cbor_gen.go +++ b/builtin/v8/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v9/account/cbor_gen.go b/builtin/v9/account/cbor_gen.go index 4a49915b..0bd09be2 100644 --- a/builtin/v9/account/cbor_gen.go +++ b/builtin/v9/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if len(t.Signature) > cbg.ByteArrayMaxLen { + if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if len(t.Message) > cbg.ByteArrayMaxLen { + if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Message was too long") } diff --git a/builtin/v9/cron/cbor_gen.go b/builtin/v9/cron/cbor_gen.go index 013f8f58..73deb41d 100644 --- a/builtin/v9/cron/cbor_gen.go +++ b/builtin/v9/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if len(t.Entries) > cbg.MaxLength { + if uint64(len(t.Entries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Entries was too long") } diff --git a/builtin/v9/datacap/cbor_gen.go b/builtin/v9/datacap/cbor_gen.go index 4f61008b..42c936a6 100644 --- a/builtin/v9/datacap/cbor_gen.go +++ b/builtin/v9/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if len(t.Operators) > cbg.MaxLength { + if uint64(len(t.Operators)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if len(t.OperatorData) > cbg.ByteArrayMaxLen { + if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if len(t.RecipientData) > cbg.ByteArrayMaxLen { + if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } diff --git a/builtin/v9/init/cbor_gen.go b/builtin/v9/init/cbor_gen.go index 7d64308d..ddb5664f 100644 --- a/builtin/v9/init/cbor_gen.go +++ b/builtin/v9/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if len(t.NetworkName) > cbg.MaxLength { + if uint64(len(t.NetworkName)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if len(t.ConstructorParams) > cbg.ByteArrayMaxLen { + if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } diff --git a/builtin/v9/init/init_actor_state.go b/builtin/v9/init/init_actor_state.go index 28f1e229..fca70b59 100644 --- a/builtin/v9/init/init_actor_state.go +++ b/builtin/v9/init/init_actor_state.go @@ -130,7 +130,7 @@ func (d *InstalledActors) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) - if len(d.Entries) > cbg.MaxLength { + if uint64(len(d.Entries)) > cbg.MaxLength { return fmt.Errorf("too many installed actor entries") } diff --git a/builtin/v9/market/cbor_gen.go b/builtin/v9/market/cbor_gen.go index ac3fea63..f8939df4 100644 --- a/builtin/v9/market/cbor_gen.go +++ b/builtin/v9/market/cbor_gen.go @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if len(t.IDs) > cbg.MaxLength { + if uint64(len(t.IDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -778,6 +778,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -895,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if len(t.VerifiedInfos) > cbg.MaxLength { + if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -999,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1094,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1189,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if len(t.Inputs) > cbg.MaxLength { + if uint64(len(t.Inputs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1294,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if len(t.CommDs) > cbg.MaxLength { + if uint64(len(t.CommDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1400,7 +1401,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1876,7 +1877,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2174,7 +2175,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2199,6 +2200,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v9/market/deal.go b/builtin/v9/market/deal.go index 147ff7bc..fca7d9d4 100644 --- a/builtin/v9/market/deal.go +++ b/builtin/v9/market/deal.go @@ -112,7 +112,7 @@ func (label *DealLabel) MarshalCBOR(w io.Writer) error { _, err := io.WriteString(w, string("")) return err } - if len(label.bs) > cbg.ByteArrayMaxLen { + if uint64(len(label.bs)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("label is too long to marshal (%d), max allowed (%d)", len(label.bs), cbg.ByteArrayMaxLen) } diff --git a/builtin/v9/miner/cbor_gen.go b/builtin/v9/miner/cbor_gen.go index c4a69b10..5dc35eda 100644 --- a/builtin/v9/miner/cbor_gen.go +++ b/builtin/v9/miner/cbor_gen.go @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if len(t.ControlAddresses) > cbg.MaxLength { + if uint64(len(t.ControlAddresses)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if len(t.Due) > cbg.MaxLength { + if uint64(len(t.Due)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -1533,6 +1533,7 @@ func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -1654,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1925,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2339,6 +2340,7 @@ func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2417,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if len(t.Funds) > cbg.MaxLength { + if uint64(len(t.Funds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2609,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2802,6 +2804,7 @@ func (t *BeneficiaryTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3049,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3167,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if len(t.NewControlAddrs) > cbg.MaxLength { + if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3271,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if len(t.NewID) > cbg.ByteArrayMaxLen { + if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3355,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if len(t.Partitions) > cbg.MaxLength { + if uint64(len(t.Partitions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3370,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3396,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if len(t.ChainCommitRand) > cbg.ByteArrayMaxLen { + if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3623,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3925,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -4017,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4112,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4207,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if len(t.Terminations) > cbg.MaxLength { + if uint64(len(t.Terminations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4366,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if len(t.Faults) > cbg.MaxLength { + if uint64(len(t.Faults)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4461,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if len(t.Recoveries) > cbg.MaxLength { + if uint64(len(t.Recoveries)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4556,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if len(t.EventPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4794,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if len(t.BlockHeader1) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4807,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if len(t.BlockHeader2) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4820,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if len(t.BlockHeaderExtra) > cbg.ByteArrayMaxLen { + if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4998,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5141,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if len(t.NewMultiaddrs) > cbg.MaxLength { + if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5149,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -5471,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5571,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if len(t.AggregateProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5658,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5762,6 +5765,7 @@ func (t *CronEventPayload) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -5831,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5926,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if len(t.Updates) > cbg.MaxLength { + if uint64(len(t.Updates)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -6040,6 +6044,7 @@ func (t *ChangeBeneficiaryParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6425,6 +6430,7 @@ func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -6727,7 +6733,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6754,7 +6760,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -6984,7 +6990,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if len(t.Deals) > cbg.MaxLength { + if uint64(len(t.Deals)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7011,7 +7017,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if len(t.ReplicaProof) > cbg.ByteArrayMaxLen { + if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7240,7 +7246,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if len(t.SectorsWithClaims) > cbg.MaxLength { + if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7264,6 +7270,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -7414,7 +7421,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if len(t.MaintainClaims) > cbg.MaxLength { + if uint64(len(t.MaintainClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7430,7 +7437,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if len(t.DropClaims) > cbg.MaxLength { + if uint64(len(t.DropClaims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } diff --git a/builtin/v9/multisig/cbor_gen.go b/builtin/v9/multisig/cbor_gen.go index c5b4f9d9..c28dfdf4 100644 --- a/builtin/v9/multisig/cbor_gen.go +++ b/builtin/v9/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if len(t.Approved) > cbg.MaxLength { + if uint64(len(t.Approved)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if len(t.Signers) > cbg.MaxLength { + if uint64(len(t.Signers)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -651,6 +651,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -813,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if len(t.Params) > cbg.ByteArrayMaxLen { + if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -950,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1262,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if len(t.ProposalHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1381,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if len(t.Ret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Ret was too long") } diff --git a/builtin/v9/paych/cbor_gen.go b/builtin/v9/paych/cbor_gen.go index f53c5e62..b4e06f44 100644 --- a/builtin/v9/paych/cbor_gen.go +++ b/builtin/v9/paych/cbor_gen.go @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if len(t.Secret) > cbg.ByteArrayMaxLen { + if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if len(t.SecretHash) > cbg.ByteArrayMaxLen { + if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if len(t.Merges) > cbg.MaxLength { + if uint64(len(t.Merges)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if len(t.Data) > cbg.ByteArrayMaxLen { + if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Data was too long") } diff --git a/builtin/v9/power/cbor_gen.go b/builtin/v9/power/cbor_gen.go index 67c51152..d28e889e 100644 --- a/builtin/v9/power/cbor_gen.go +++ b/builtin/v9/power/cbor_gen.go @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if len(t.ControlAddrs) > cbg.MaxLength { + if uint64(len(t.ControlAddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if len(t.PeerId) > cbg.ByteArrayMaxLen { + if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if len(t.Peer) > cbg.ByteArrayMaxLen { + if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if len(t.Multiaddrs) > cbg.MaxLength { + if uint64(len(t.Multiaddrs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if len(v) > cbg.ByteArrayMaxLen { + if uint64(len(v)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field v was too long") } @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1326,7 +1326,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if len(t.CallbackPayload) > cbg.ByteArrayMaxLen { + if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } diff --git a/builtin/v9/reward/cbor_gen.go b/builtin/v9/reward/cbor_gen.go index d3365367..ec29a320 100644 --- a/builtin/v9/reward/cbor_gen.go +++ b/builtin/v9/reward/cbor_gen.go @@ -368,6 +368,7 @@ func (t *AwardBlockRewardParams) MarshalCBOR(w io.Writer) error { return err } } + return nil } diff --git a/builtin/v9/verifreg/cbor_gen.go b/builtin/v9/verifreg/cbor_gen.go index 230e422b..e16c254b 100644 --- a/builtin/v9/verifreg/cbor_gen.go +++ b/builtin/v9/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if len(t.AllocationIds) > cbg.MaxLength { + if uint64(len(t.AllocationIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if len(t.Sectors) > cbg.MaxLength { + if uint64(len(t.Sectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if len(t.Claims) > cbg.MaxLength { + if uint64(len(t.Claims)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if len(t.Payload) > cbg.ByteArrayMaxLen { + if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if len(t.NewAllocations) > cbg.MaxLength { + if uint64(len(t.NewAllocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if len(t.Terms) > cbg.MaxLength { + if uint64(len(t.Terms)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if len(t.FailCodes) > cbg.MaxLength { + if uint64(len(t.FailCodes)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if len(t.ClaimIds) > cbg.MaxLength { + if uint64(len(t.ClaimIds)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if len(t.Considered) > cbg.MaxLength { + if uint64(len(t.Considered)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2319,6 +2319,7 @@ func (t *FailCode) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2441,6 +2442,7 @@ func (t *SectorAllocationClaim) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2848,6 +2850,7 @@ func (t *ClaimTerm) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -2965,6 +2968,7 @@ func (t *ClaimExtensionRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3112,6 +3116,7 @@ func (t *Allocation) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3334,6 +3339,7 @@ func (t *AllocationRequest) MarshalCBOR(w io.Writer) error { return err } } + return nil } @@ -3493,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if len(t.Allocations) > cbg.MaxLength { + if uint64(len(t.Allocations)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3508,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if len(t.Extensions) > cbg.MaxLength { + if uint64(len(t.Extensions)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Extensions was too long") } diff --git a/go.mod b/go.mod index cc25d3df..1966584f 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,14 @@ go 1.18 retract v0.12.7 // wrongfully skipped a patch version, use v0.12.6 or v0.12.8&^ +replace github.com/whyrusleeping/cbor-gen => ../../whyrusleeping/cbor-gen + require ( github.com/filecoin-project/go-address v1.1.0 - github.com/filecoin-project/go-amt-ipld/v4 v4.2.0 + github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef github.com/filecoin-project/go-bitfield v0.2.4 github.com/filecoin-project/go-commp-utils/nonffi v0.0.0-20220905160352-62059082a837 - github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 + github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045 github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-cid v0.3.2 github.com/ipfs/go-ipld-cbor v0.0.6 @@ -20,8 +22,8 @@ require ( github.com/multiformats/go-multihash v0.2.1 github.com/multiformats/go-varint v0.0.6 github.com/stretchr/testify v1.7.0 - github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b - golang.org/x/crypto v0.1.0 + github.com/whyrusleeping/cbor-gen v0.0.0-20240202185644-fcdaca49d05c + golang.org/x/crypto v0.17.0 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 ) @@ -39,7 +41,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - golang.org/x/sys v0.1.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + golang.org/x/sys v0.15.0 // indirect + gopkg.in/yaml.v3 v3.0.0 // indirect lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/go.sum b/go.sum index 804f2b7c..c991e443 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+ github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE= github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA= github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs= -github.com/filecoin-project/go-amt-ipld/v4 v4.2.0 h1:DQTXQwMXxaetd+lhZGODjt5qC1WYT7tMAlYrWqI/fwI= -github.com/filecoin-project/go-amt-ipld/v4 v4.2.0/go.mod h1:0eDVF7pROvxrsxvLJx+SJZXqRaXXcEPUcgb/rG0zGU4= +github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef h1:d2a6kO4Nq8wnFzWC/+x967xZa3y0KrWB5cnnWTH693I= +github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef/go.mod h1:yho4SqDGret1aOl53OnsBL0h7zgodUuzrwsADe0v9ho= github.com/filecoin-project/go-bitfield v0.2.0/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW8p9au0C68JPgk= github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= @@ -23,8 +23,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8= github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= -github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI= -github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g= +github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045 h1:w2Ydu6hiPnxR9lDIbHKU5i31Ho+1pGtN5xTk2i7/sII= +github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045/go.mod h1:LOii7J9ZDSEeMK9jTfYFbStSqD0FlyA0qKoep7w36jw= github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak= github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20200904021452-1883f36ca2f4/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= @@ -48,7 +48,6 @@ github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUP github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= @@ -148,15 +147,6 @@ github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKw github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= -github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= -github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= -github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W5MvapuoHRP8rz4vxjwCK1pDqF1aQcWsV5PZ+AHbqdg= -github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= -github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b h1:+Yd0HVs6f9v2sRlpqcODhojlOd2PiBtWZTPcYmaSm5A= -github.com/whyrusleeping/cbor-gen v0.0.0-20240124134906-0efd71a8493b/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829 h1:wb7xrDzfkLgPHsSEBm+VSx6aDdi64VtV0xvP0E6j8bk= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829/go.mod h1:h/1PEBwj7Ym/8kOuMWvO2ujZ6Lt+TMbySEXNhjjR87I= github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JLlWugkzsrlB50jR9v2khiD9FxuSo= @@ -176,8 +166,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= @@ -196,8 +186,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -223,8 +213,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= diff --git a/manifest/cbor_gen.go b/manifest/cbor_gen.go index d596609e..b3a9e63e 100644 --- a/manifest/cbor_gen.go +++ b/manifest/cbor_gen.go @@ -101,7 +101,7 @@ func (t *ManifestEntry) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) // t.Name (string) (string) - if len(t.Name) > cbg.MaxLength { + if uint64(len(t.Name)) > cbg.MaxLength { return xerrors.Errorf("Value in field t.Name was too long") } diff --git a/manifest/manifest.go b/manifest/manifest.go index a1cecc4c..a859de5a 100644 --- a/manifest/manifest.go +++ b/manifest/manifest.go @@ -15,10 +15,10 @@ import ( ) const ( - AccountKey = "account" - CronKey = "cron" - InitKey = "init" - MarketKey = "storagemarket" + AccountKey = "account" + CronKey = "cron" + InitKey = "init" + MarketKey = "storagemarket" MinerKey = "storageminer" MultisigKey = "multisig" PaychKey = "paymentchannel" @@ -137,7 +137,7 @@ func (d *ManifestData) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) - if len(d.Entries) > cbg.MaxLength { + if uint64(len(d.Entries)) > cbg.MaxLength { return fmt.Errorf("too many manifest entries") } diff --git a/proof/cbor_gen.go b/proof/cbor_gen.go index 8816a82f..6184391e 100644 --- a/proof/cbor_gen.go +++ b/proof/cbor_gen.go @@ -38,7 +38,7 @@ func (t *PoStProof) MarshalCBOR(w io.Writer) error { } // t.ProofBytes ([]uint8) (slice) - if len(t.ProofBytes) > cbg.ByteArrayMaxLen { + if uint64(len(t.ProofBytes)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.ProofBytes was too long") } @@ -294,7 +294,7 @@ func (t *SealVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if len(t.DealIDs) > cbg.MaxLength { + if uint64(len(t.DealIDs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -308,7 +308,7 @@ func (t *SealVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.Randomness (abi.SealRandomness) (slice) - if len(t.Randomness) > cbg.ByteArrayMaxLen { + if uint64(len(t.Randomness)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Randomness was too long") } @@ -321,7 +321,7 @@ func (t *SealVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.InteractiveRandomness (abi.InteractiveSealRandomness) (slice) - if len(t.InteractiveRandomness) > cbg.ByteArrayMaxLen { + if uint64(len(t.InteractiveRandomness)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.InteractiveRandomness was too long") } @@ -334,7 +334,7 @@ func (t *SealVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if len(t.Proof) > cbg.ByteArrayMaxLen { + if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -550,7 +550,7 @@ func (t *WindowPoStVerifyInfo) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) // t.Randomness (abi.PoStRandomness) (slice) - if len(t.Randomness) > cbg.ByteArrayMaxLen { + if uint64(len(t.Randomness)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Randomness was too long") } @@ -563,7 +563,7 @@ func (t *WindowPoStVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -577,7 +577,7 @@ func (t *WindowPoStVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.ChallengedSectors ([]proof.SectorInfo) (slice) - if len(t.ChallengedSectors) > cbg.MaxLength { + if uint64(len(t.ChallengedSectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ChallengedSectors was too long") } @@ -727,7 +727,7 @@ func (t *WinningPoStVerifyInfo) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) // t.Randomness (abi.PoStRandomness) (slice) - if len(t.Randomness) > cbg.ByteArrayMaxLen { + if uint64(len(t.Randomness)) > cbg.ByteArrayMaxLen { return xerrors.Errorf("Byte array in field t.Randomness was too long") } @@ -740,7 +740,7 @@ func (t *WinningPoStVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if len(t.Proofs) > cbg.MaxLength { + if uint64(len(t.Proofs)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -754,7 +754,7 @@ func (t *WinningPoStVerifyInfo) MarshalCBOR(w io.Writer) error { } // t.ChallengedSectors ([]proof.SectorInfo) (slice) - if len(t.ChallengedSectors) > cbg.MaxLength { + if uint64(len(t.ChallengedSectors)) > cbg.MaxLength { return xerrors.Errorf("Slice value in field t.ChallengedSectors was too long") } From 2eac3d421377a31215de031baff962dbc6384d2c Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 7 Feb 2024 11:48:41 +1100 Subject: [PATCH 46/52] Update for cbor-gen with nullable ints and without globals --- abi/cbor_bytes.go | 2 +- abi/cbor_string.go | 2 +- builtin/v10/account/cbor_gen.go | 8 +- builtin/v10/cron/cbor_gen.go | 4 +- builtin/v10/datacap/cbor_gen.go | 24 +-- builtin/v10/eam/cbor_gen.go | 24 +-- builtin/v10/evm/cbor_gen.go | 24 +-- builtin/v10/init/cbor_gen.go | 20 +- builtin/v10/market/cbor_gen.go | 74 ++++---- builtin/v10/miner/cbor_gen.go | 222 +++++++++++----------- builtin/v10/multisig/cbor_gen.go | 58 +++--- builtin/v10/paych/cbor_gen.go | 26 +-- builtin/v10/power/cbor_gen.go | 50 ++--- builtin/v10/reward/cbor_gen.go | 6 +- builtin/v10/verifreg/cbor_gen.go | 82 ++++----- builtin/v11/account/cbor_gen.go | 8 +- builtin/v11/cron/cbor_gen.go | 4 +- builtin/v11/datacap/cbor_gen.go | 24 +-- builtin/v11/eam/cbor_gen.go | 24 +-- builtin/v11/evm/cbor_gen.go | 24 +-- builtin/v11/init/cbor_gen.go | 20 +- builtin/v11/market/cbor_gen.go | 74 ++++---- builtin/v11/miner/cbor_gen.go | 222 +++++++++++----------- builtin/v11/multisig/cbor_gen.go | 58 +++--- builtin/v11/paych/cbor_gen.go | 26 +-- builtin/v11/power/cbor_gen.go | 50 ++--- builtin/v11/reward/cbor_gen.go | 6 +- builtin/v11/verifreg/cbor_gen.go | 82 ++++----- builtin/v12/account/cbor_gen.go | 8 +- builtin/v12/cron/cbor_gen.go | 4 +- builtin/v12/datacap/cbor_gen.go | 24 +-- builtin/v12/eam/cbor_gen.go | 24 +-- builtin/v12/evm/cbor_gen.go | 24 +-- builtin/v12/init/cbor_gen.go | 20 +- builtin/v12/market/cbor_gen.go | 66 +++---- builtin/v12/miner/cbor_gen.go | 222 +++++++++++----------- builtin/v12/multisig/cbor_gen.go | 58 +++--- builtin/v12/paych/cbor_gen.go | 26 +-- builtin/v12/power/cbor_gen.go | 50 ++--- builtin/v12/reward/cbor_gen.go | 6 +- builtin/v12/verifreg/cbor_gen.go | 82 ++++----- builtin/v13/account/cbor_gen.go | 8 +- builtin/v13/cron/cbor_gen.go | 4 +- builtin/v13/datacap/cbor_gen.go | 24 +-- builtin/v13/eam/cbor_gen.go | 24 +-- builtin/v13/evm/cbor_gen.go | 24 +-- builtin/v13/init/cbor_gen.go | 20 +- builtin/v13/market/cbor_gen.go | 70 +++---- builtin/v13/miner/cbor_gen.go | 304 +++++++++++++++---------------- builtin/v13/multisig/cbor_gen.go | 58 +++--- builtin/v13/paych/cbor_gen.go | 26 +-- builtin/v13/power/cbor_gen.go | 50 ++--- builtin/v13/reward/cbor_gen.go | 6 +- builtin/v13/verifreg/cbor_gen.go | 82 ++++----- builtin/v8/cron/cbor_gen.go | 4 +- builtin/v8/init/cbor_gen.go | 12 +- builtin/v8/market/cbor_gen.go | 60 +++--- builtin/v8/miner/cbor_gen.go | 172 ++++++++--------- builtin/v8/multisig/cbor_gen.go | 58 +++--- builtin/v8/paych/cbor_gen.go | 26 +-- builtin/v8/power/cbor_gen.go | 50 ++--- builtin/v8/reward/cbor_gen.go | 6 +- builtin/v9/account/cbor_gen.go | 8 +- builtin/v9/cron/cbor_gen.go | 4 +- builtin/v9/datacap/cbor_gen.go | 24 +-- builtin/v9/init/cbor_gen.go | 12 +- builtin/v9/market/cbor_gen.go | 66 +++---- builtin/v9/miner/cbor_gen.go | 214 +++++++++++----------- builtin/v9/multisig/cbor_gen.go | 58 +++--- builtin/v9/paych/cbor_gen.go | 26 +-- builtin/v9/power/cbor_gen.go | 50 ++--- builtin/v9/reward/cbor_gen.go | 6 +- builtin/v9/verifreg/cbor_gen.go | 82 ++++----- go.mod | 14 +- go.sum | 30 ++- 75 files changed, 1776 insertions(+), 1768 deletions(-) diff --git a/abi/cbor_bytes.go b/abi/cbor_bytes.go index 7ffddc7f..f3acf177 100644 --- a/abi/cbor_bytes.go +++ b/abi/cbor_bytes.go @@ -11,7 +11,7 @@ import ( type CborBytes []byte func (t *CborBytes) MarshalCBOR(w io.Writer) error { - if uint64(len(*t)) > cbg.ByteArrayMaxLen { + if len(*t) > cbg.ByteArrayMaxLen { return xerrors.Errorf("byte array was too long") } diff --git a/abi/cbor_string.go b/abi/cbor_string.go index 72c9181a..e3d316f7 100644 --- a/abi/cbor_string.go +++ b/abi/cbor_string.go @@ -13,7 +13,7 @@ type CborString string func (t *CborString) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 8) - if uint64(len(*t)) > cbg.MaxLength { + if len(*t) > cbg.MaxLength { return xerrors.Errorf("Value in t was too long") } diff --git a/builtin/v10/account/cbor_gen.go b/builtin/v10/account/cbor_gen.go index 0bd09be2..55e97f33 100644 --- a/builtin/v10/account/cbor_gen.go +++ b/builtin/v10/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { + if len(t.Signature) > 2097152 { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { + if len(t.Message) > 2097152 { return xerrors.Errorf("Byte array in field t.Message was too long") } @@ -147,7 +147,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Signature: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -169,7 +169,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Message: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/cron/cbor_gen.go b/builtin/v10/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v10/cron/cbor_gen.go +++ b/builtin/v10/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v10/datacap/cbor_gen.go b/builtin/v10/datacap/cbor_gen.go index 42c936a6..11e7cbb1 100644 --- a/builtin/v10/datacap/cbor_gen.go +++ b/builtin/v10/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if uint64(len(t.Operators)) > cbg.MaxLength { + if len(t.Operators) > 8192 { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -291,7 +291,7 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Operators: array too large (%d)", extra) } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -413,7 +413,7 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -589,7 +589,7 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -695,7 +695,7 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -815,7 +815,7 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -935,7 +935,7 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/eam/cbor_gen.go b/builtin/v10/eam/cbor_gen.go index ef731149..3c4b391a 100644 --- a/builtin/v10/eam/cbor_gen.go +++ b/builtin/v10/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -85,7 +85,7 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -220,7 +220,7 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { + if len(t.Salt) > 2097152 { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -309,7 +309,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -331,7 +331,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Salt: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -451,7 +451,7 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -571,7 +571,7 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/evm/cbor_gen.go b/builtin/v10/evm/cbor_gen.go index dffac8ac..ea0b5f37 100644 --- a/builtin/v10/evm/cbor_gen.go +++ b/builtin/v10/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { + if len(t.BytecodeHash) > 2097152 { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -196,7 +196,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BytecodeHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { + if len(t.Creator) > 2097152 { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -331,7 +331,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Creator: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -352,7 +352,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { + if len(t.StorageKey) > 2097152 { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -429,7 +429,7 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.StorageKey: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { + if len(t.Input) > 2097152 { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { + if len(t.Caller) > 2097152 { return xerrors.Errorf("Byte array in field t.Caller was too long") } @@ -541,7 +541,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Input: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -563,7 +563,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Caller: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/init/cbor_gen.go b/builtin/v10/init/cbor_gen.go index e648e48a..934e614c 100644 --- a/builtin/v10/init/cbor_gen.go +++ b/builtin/v10/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { + if len(t.SubAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } @@ -442,7 +442,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -464,7 +464,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SubAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/market/cbor_gen.go b/builtin/v10/market/cbor_gen.go index 10542ba0..43006a8b 100644 --- a/builtin/v10/market/cbor_gen.go +++ b/builtin/v10/market/cbor_gen.go @@ -223,10 +223,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -369,10 +369,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -394,10 +394,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -419,10 +419,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -589,7 +589,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -690,7 +690,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -812,7 +812,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -851,10 +851,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -896,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { + if len(t.VerifiedInfos) > 8192 { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -951,7 +951,7 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.VerifiedInfos: array too large (%d)", extra) } @@ -1000,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1046,7 +1046,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1095,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1141,7 +1141,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if uint64(len(t.Inputs)) > cbg.MaxLength { + if len(t.Inputs) > 8192 { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1236,7 +1236,7 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Inputs: array too large (%d)", extra) } @@ -1295,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if uint64(len(t.CommDs)) > cbg.MaxLength { + if len(t.CommDs) > 8192 { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1341,7 +1341,7 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.CommDs: array too large (%d)", extra) } @@ -1591,10 +1591,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Start (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1616,10 +1616,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Duration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1706,10 +1706,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Activated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1731,10 +1731,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Terminated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1782,7 +1782,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1825,10 +1825,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1854,7 +1854,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2074,10 +2074,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2099,10 +2099,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2258,7 +2258,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2301,10 +2301,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2326,10 +2326,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2355,7 +2355,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2556,7 +2556,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2615,7 +2615,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2654,10 +2654,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v10/miner/cbor_gen.go b/builtin/v10/miner/cbor_gen.go index 65d891b1..c0d8b03c 100644 --- a/builtin/v10/miner/cbor_gen.go +++ b/builtin/v10/miner/cbor_gen.go @@ -261,10 +261,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -522,7 +522,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -579,7 +579,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -601,7 +601,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -627,7 +627,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -647,10 +647,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -700,10 +700,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -843,7 +843,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1581,10 +1581,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1655,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1722,10 +1722,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1773,10 +1773,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1802,7 +1802,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1841,10 +1841,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1926,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2063,10 +2063,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2104,7 +2104,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2143,10 +2143,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2168,10 +2168,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2238,10 +2238,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ReplacedSectorAge (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2379,10 +2379,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2419,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2465,7 +2465,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2557,10 +2557,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2611,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2666,7 +2666,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2852,10 +2852,10 @@ func (t *BeneficiaryTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2968,10 +2968,10 @@ func (t *PendingBeneficiaryChange) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3052,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3116,7 +3116,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -3170,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3225,7 +3225,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -3274,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3319,7 +3319,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3358,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3373,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3399,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3458,7 +3458,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3496,7 +3496,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3530,10 +3530,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3559,7 +3559,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3626,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3704,10 +3704,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3755,10 +3755,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3784,7 +3784,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3823,10 +3823,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3928,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3987,7 +3987,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4020,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4066,7 +4066,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4115,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4161,7 +4161,7 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4210,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4256,7 +4256,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -4369,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4415,7 +4415,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4464,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4510,7 +4510,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4559,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4613,7 +4613,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4797,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4810,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4823,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4868,7 +4868,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4890,7 +4890,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4912,7 +4912,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5001,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5063,7 +5063,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5144,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5152,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -5198,7 +5198,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -5224,7 +5224,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5474,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5520,7 +5520,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5574,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5628,7 +5628,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5661,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5707,7 +5707,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5795,10 +5795,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5835,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5881,7 +5881,7 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5930,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5976,7 +5976,7 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -6092,10 +6092,10 @@ func (t *ChangeBeneficiaryParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6292,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6337,7 +6337,7 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6370,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { + if len(t.MultiAddrs) > 2097152 { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6415,7 +6415,7 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.MultiAddrs: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6733,10 +6733,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6969,7 +6969,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6996,7 +6996,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7095,7 +7095,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7134,10 +7134,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7163,7 +7163,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7226,7 +7226,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7253,7 +7253,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7364,7 +7364,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7403,10 +7403,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7432,7 +7432,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7482,7 +7482,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { + if len(t.SectorsWithClaims) > 8192 { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7577,7 +7577,7 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorsWithClaims: array too large (%d)", extra) } @@ -7611,10 +7611,10 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7657,7 +7657,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.MaintainClaims)) > cbg.MaxLength { + if len(t.MaintainClaims) > 8192 { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7673,7 +7673,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.DropClaims)) > cbg.MaxLength { + if len(t.DropClaims) > 8192 { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } @@ -7734,7 +7734,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.MaintainClaims: array too large (%d)", extra) } @@ -7777,7 +7777,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DropClaims: array too large (%d)", extra) } diff --git a/builtin/v10/multisig/cbor_gen.go b/builtin/v10/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v10/multisig/cbor_gen.go +++ b/builtin/v10/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v10/paych/cbor_gen.go b/builtin/v10/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v10/paych/cbor_gen.go +++ b/builtin/v10/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/power/cbor_gen.go b/builtin/v10/power/cbor_gen.go index 827e4263..4b3371b7 100644 --- a/builtin/v10/power/cbor_gen.go +++ b/builtin/v10/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1458,7 +1458,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v10/reward/cbor_gen.go b/builtin/v10/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v10/reward/cbor_gen.go +++ b/builtin/v10/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v10/verifreg/cbor_gen.go b/builtin/v10/verifreg/cbor_gen.go index e16c254b..777358be 100644 --- a/builtin/v10/verifreg/cbor_gen.go +++ b/builtin/v10/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if uint64(len(t.AllocationIds)) > cbg.MaxLength { + if len(t.AllocationIds) > 8192 { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -699,7 +699,7 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.AllocationIds: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -810,7 +810,7 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -948,7 +948,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1048,7 +1048,7 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1251,7 +1251,7 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if uint64(len(t.Claims)) > cbg.MaxLength { + if len(t.Claims) > 8192 { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1365,7 +1365,7 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Claims: array too large (%d)", extra) } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1479,7 +1479,7 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if uint64(len(t.NewAllocations)) > cbg.MaxLength { + if len(t.NewAllocations) > 8192 { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1587,7 +1587,7 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewAllocations: array too large (%d)", extra) } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if uint64(len(t.Terms)) > cbg.MaxLength { + if len(t.Terms) > 8192 { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1687,7 +1687,7 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terms: array too large (%d)", extra) } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1802,7 +1802,7 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1918,7 +1918,7 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2024,7 +2024,7 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -2363,10 +2363,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2540,10 +2540,10 @@ func (t *SectorAllocationClaim) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2725,10 +2725,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2750,10 +2750,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2775,10 +2775,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2908,10 +2908,10 @@ func (t *ClaimTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3021,10 +3021,10 @@ func (t *ClaimExtensionRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3200,10 +3200,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3225,10 +3225,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3250,10 +3250,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3409,10 +3409,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3434,10 +3434,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3459,10 +3459,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3499,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if uint64(len(t.Allocations)) > cbg.MaxLength { + if len(t.Allocations) > 8192 { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3514,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3560,7 +3560,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Allocations: array too large (%d)", extra) } @@ -3598,7 +3598,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } diff --git a/builtin/v11/account/cbor_gen.go b/builtin/v11/account/cbor_gen.go index 0bd09be2..55e97f33 100644 --- a/builtin/v11/account/cbor_gen.go +++ b/builtin/v11/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { + if len(t.Signature) > 2097152 { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { + if len(t.Message) > 2097152 { return xerrors.Errorf("Byte array in field t.Message was too long") } @@ -147,7 +147,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Signature: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -169,7 +169,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Message: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/cron/cbor_gen.go b/builtin/v11/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v11/cron/cbor_gen.go +++ b/builtin/v11/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v11/datacap/cbor_gen.go b/builtin/v11/datacap/cbor_gen.go index 42c936a6..11e7cbb1 100644 --- a/builtin/v11/datacap/cbor_gen.go +++ b/builtin/v11/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if uint64(len(t.Operators)) > cbg.MaxLength { + if len(t.Operators) > 8192 { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -291,7 +291,7 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Operators: array too large (%d)", extra) } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -413,7 +413,7 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -589,7 +589,7 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -695,7 +695,7 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -815,7 +815,7 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -935,7 +935,7 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/eam/cbor_gen.go b/builtin/v11/eam/cbor_gen.go index ef731149..3c4b391a 100644 --- a/builtin/v11/eam/cbor_gen.go +++ b/builtin/v11/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -85,7 +85,7 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -220,7 +220,7 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { + if len(t.Salt) > 2097152 { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -309,7 +309,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -331,7 +331,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Salt: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -451,7 +451,7 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -571,7 +571,7 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/evm/cbor_gen.go b/builtin/v11/evm/cbor_gen.go index dffac8ac..ea0b5f37 100644 --- a/builtin/v11/evm/cbor_gen.go +++ b/builtin/v11/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { + if len(t.BytecodeHash) > 2097152 { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -196,7 +196,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BytecodeHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { + if len(t.Creator) > 2097152 { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -331,7 +331,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Creator: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -352,7 +352,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { + if len(t.StorageKey) > 2097152 { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -429,7 +429,7 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.StorageKey: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { + if len(t.Input) > 2097152 { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { + if len(t.Caller) > 2097152 { return xerrors.Errorf("Byte array in field t.Caller was too long") } @@ -541,7 +541,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Input: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -563,7 +563,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Caller: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/init/cbor_gen.go b/builtin/v11/init/cbor_gen.go index e648e48a..934e614c 100644 --- a/builtin/v11/init/cbor_gen.go +++ b/builtin/v11/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { + if len(t.SubAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } @@ -442,7 +442,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -464,7 +464,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SubAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/market/cbor_gen.go b/builtin/v11/market/cbor_gen.go index 28c99082..89fb2423 100644 --- a/builtin/v11/market/cbor_gen.go +++ b/builtin/v11/market/cbor_gen.go @@ -223,10 +223,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -369,10 +369,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -394,10 +394,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -419,10 +419,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -589,7 +589,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -690,7 +690,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -812,7 +812,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -851,10 +851,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -896,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { + if len(t.VerifiedInfos) > 8192 { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -951,7 +951,7 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.VerifiedInfos: array too large (%d)", extra) } @@ -1000,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1046,7 +1046,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1095,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1141,7 +1141,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if uint64(len(t.Inputs)) > cbg.MaxLength { + if len(t.Inputs) > 8192 { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1236,7 +1236,7 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Inputs: array too large (%d)", extra) } @@ -1295,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if uint64(len(t.CommDs)) > cbg.MaxLength { + if len(t.CommDs) > 8192 { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1341,7 +1341,7 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.CommDs: array too large (%d)", extra) } @@ -1591,10 +1591,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Start (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1616,10 +1616,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Duration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1706,10 +1706,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Activated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1731,10 +1731,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Terminated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1782,7 +1782,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1825,10 +1825,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1854,7 +1854,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2074,10 +2074,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2099,10 +2099,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2258,7 +2258,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2301,10 +2301,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2326,10 +2326,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2355,7 +2355,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2556,7 +2556,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2615,7 +2615,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2654,10 +2654,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v11/miner/cbor_gen.go b/builtin/v11/miner/cbor_gen.go index b550b50a..51bf05a2 100644 --- a/builtin/v11/miner/cbor_gen.go +++ b/builtin/v11/miner/cbor_gen.go @@ -261,10 +261,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -522,7 +522,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -579,7 +579,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -601,7 +601,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -627,7 +627,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -647,10 +647,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -700,10 +700,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -843,7 +843,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1581,10 +1581,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1655,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1722,10 +1722,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1773,10 +1773,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1802,7 +1802,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1841,10 +1841,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1926,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2063,10 +2063,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2104,7 +2104,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2143,10 +2143,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2168,10 +2168,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2238,10 +2238,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ReplacedSectorAge (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2379,10 +2379,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2419,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2465,7 +2465,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2557,10 +2557,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2611,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2666,7 +2666,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2852,10 +2852,10 @@ func (t *BeneficiaryTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2968,10 +2968,10 @@ func (t *PendingBeneficiaryChange) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3052,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3116,7 +3116,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -3170,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3225,7 +3225,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -3274,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3319,7 +3319,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3358,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3373,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3399,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3458,7 +3458,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3496,7 +3496,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3530,10 +3530,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3559,7 +3559,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3626,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3704,10 +3704,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3755,10 +3755,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3784,7 +3784,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3823,10 +3823,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3928,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3987,7 +3987,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4020,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4066,7 +4066,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4115,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4161,7 +4161,7 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4210,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4256,7 +4256,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -4369,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4415,7 +4415,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4464,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4510,7 +4510,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4559,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4613,7 +4613,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4797,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4810,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4823,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4868,7 +4868,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4890,7 +4890,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4912,7 +4912,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5001,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5063,7 +5063,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5144,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5152,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -5198,7 +5198,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -5224,7 +5224,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5474,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5520,7 +5520,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5574,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5628,7 +5628,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5661,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5707,7 +5707,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5795,10 +5795,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5835,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5881,7 +5881,7 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5930,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5976,7 +5976,7 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -6092,10 +6092,10 @@ func (t *ChangeBeneficiaryParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6292,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6337,7 +6337,7 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6370,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { + if len(t.MultiAddrs) > 2097152 { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6415,7 +6415,7 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.MultiAddrs: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6733,10 +6733,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6969,7 +6969,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6996,7 +6996,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7095,7 +7095,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7134,10 +7134,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7163,7 +7163,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7226,7 +7226,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7253,7 +7253,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7364,7 +7364,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7403,10 +7403,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7432,7 +7432,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7482,7 +7482,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { + if len(t.SectorsWithClaims) > 8192 { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7577,7 +7577,7 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorsWithClaims: array too large (%d)", extra) } @@ -7611,10 +7611,10 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7657,7 +7657,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.MaintainClaims)) > cbg.MaxLength { + if len(t.MaintainClaims) > 8192 { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7673,7 +7673,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.DropClaims)) > cbg.MaxLength { + if len(t.DropClaims) > 8192 { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } @@ -7734,7 +7734,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.MaintainClaims: array too large (%d)", extra) } @@ -7777,7 +7777,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DropClaims: array too large (%d)", extra) } diff --git a/builtin/v11/multisig/cbor_gen.go b/builtin/v11/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v11/multisig/cbor_gen.go +++ b/builtin/v11/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v11/paych/cbor_gen.go b/builtin/v11/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v11/paych/cbor_gen.go +++ b/builtin/v11/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/power/cbor_gen.go b/builtin/v11/power/cbor_gen.go index 827e4263..4b3371b7 100644 --- a/builtin/v11/power/cbor_gen.go +++ b/builtin/v11/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1458,7 +1458,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v11/reward/cbor_gen.go b/builtin/v11/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v11/reward/cbor_gen.go +++ b/builtin/v11/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v11/verifreg/cbor_gen.go b/builtin/v11/verifreg/cbor_gen.go index e16c254b..777358be 100644 --- a/builtin/v11/verifreg/cbor_gen.go +++ b/builtin/v11/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if uint64(len(t.AllocationIds)) > cbg.MaxLength { + if len(t.AllocationIds) > 8192 { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -699,7 +699,7 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.AllocationIds: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -810,7 +810,7 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -948,7 +948,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1048,7 +1048,7 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1251,7 +1251,7 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if uint64(len(t.Claims)) > cbg.MaxLength { + if len(t.Claims) > 8192 { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1365,7 +1365,7 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Claims: array too large (%d)", extra) } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1479,7 +1479,7 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if uint64(len(t.NewAllocations)) > cbg.MaxLength { + if len(t.NewAllocations) > 8192 { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1587,7 +1587,7 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewAllocations: array too large (%d)", extra) } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if uint64(len(t.Terms)) > cbg.MaxLength { + if len(t.Terms) > 8192 { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1687,7 +1687,7 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terms: array too large (%d)", extra) } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1802,7 +1802,7 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1918,7 +1918,7 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2024,7 +2024,7 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -2363,10 +2363,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2540,10 +2540,10 @@ func (t *SectorAllocationClaim) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2725,10 +2725,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2750,10 +2750,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2775,10 +2775,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2908,10 +2908,10 @@ func (t *ClaimTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3021,10 +3021,10 @@ func (t *ClaimExtensionRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3200,10 +3200,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3225,10 +3225,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3250,10 +3250,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3409,10 +3409,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3434,10 +3434,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3459,10 +3459,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3499,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if uint64(len(t.Allocations)) > cbg.MaxLength { + if len(t.Allocations) > 8192 { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3514,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3560,7 +3560,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Allocations: array too large (%d)", extra) } @@ -3598,7 +3598,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } diff --git a/builtin/v12/account/cbor_gen.go b/builtin/v12/account/cbor_gen.go index 0bd09be2..55e97f33 100644 --- a/builtin/v12/account/cbor_gen.go +++ b/builtin/v12/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { + if len(t.Signature) > 2097152 { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { + if len(t.Message) > 2097152 { return xerrors.Errorf("Byte array in field t.Message was too long") } @@ -147,7 +147,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Signature: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -169,7 +169,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Message: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/cron/cbor_gen.go b/builtin/v12/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v12/cron/cbor_gen.go +++ b/builtin/v12/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v12/datacap/cbor_gen.go b/builtin/v12/datacap/cbor_gen.go index 42c936a6..11e7cbb1 100644 --- a/builtin/v12/datacap/cbor_gen.go +++ b/builtin/v12/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if uint64(len(t.Operators)) > cbg.MaxLength { + if len(t.Operators) > 8192 { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -291,7 +291,7 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Operators: array too large (%d)", extra) } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -413,7 +413,7 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -589,7 +589,7 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -695,7 +695,7 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -815,7 +815,7 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -935,7 +935,7 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/eam/cbor_gen.go b/builtin/v12/eam/cbor_gen.go index ef731149..3c4b391a 100644 --- a/builtin/v12/eam/cbor_gen.go +++ b/builtin/v12/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -85,7 +85,7 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -220,7 +220,7 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { + if len(t.Salt) > 2097152 { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -309,7 +309,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -331,7 +331,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Salt: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -451,7 +451,7 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -571,7 +571,7 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/evm/cbor_gen.go b/builtin/v12/evm/cbor_gen.go index dffac8ac..ea0b5f37 100644 --- a/builtin/v12/evm/cbor_gen.go +++ b/builtin/v12/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { + if len(t.BytecodeHash) > 2097152 { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -196,7 +196,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BytecodeHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { + if len(t.Creator) > 2097152 { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -331,7 +331,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Creator: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -352,7 +352,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { + if len(t.StorageKey) > 2097152 { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -429,7 +429,7 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.StorageKey: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { + if len(t.Input) > 2097152 { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { + if len(t.Caller) > 2097152 { return xerrors.Errorf("Byte array in field t.Caller was too long") } @@ -541,7 +541,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Input: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -563,7 +563,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Caller: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/init/cbor_gen.go b/builtin/v12/init/cbor_gen.go index e648e48a..934e614c 100644 --- a/builtin/v12/init/cbor_gen.go +++ b/builtin/v12/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { + if len(t.SubAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } @@ -442,7 +442,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -464,7 +464,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SubAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/market/cbor_gen.go b/builtin/v12/market/cbor_gen.go index 5905a7af..eaf5235f 100644 --- a/builtin/v12/market/cbor_gen.go +++ b/builtin/v12/market/cbor_gen.go @@ -223,10 +223,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -369,10 +369,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -394,10 +394,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -419,10 +419,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -589,7 +589,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -690,7 +690,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -812,7 +812,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -851,10 +851,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -896,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { + if len(t.VerifiedInfos) > 8192 { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -951,7 +951,7 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.VerifiedInfos: array too large (%d)", extra) } @@ -1000,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1046,7 +1046,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1095,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.UnsealedCIDs ([]*cid.Cid) (slice) - if uint64(len(t.UnsealedCIDs)) > cbg.MaxLength { + if len(t.UnsealedCIDs) > 8192 { return xerrors.Errorf("Slice value in field t.UnsealedCIDs was too long") } @@ -1148,7 +1148,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.UnsealedCIDs: array too large (%d)", extra) } @@ -1411,10 +1411,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Start (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1436,10 +1436,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Duration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1526,10 +1526,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Activated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1551,10 +1551,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Terminated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1602,7 +1602,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1645,10 +1645,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1674,7 +1674,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1894,10 +1894,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1919,10 +1919,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2078,7 +2078,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2121,10 +2121,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2146,10 +2146,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2175,7 +2175,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2299,7 +2299,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2358,7 +2358,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2397,10 +2397,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v12/miner/cbor_gen.go b/builtin/v12/miner/cbor_gen.go index e414b56d..1ac08a72 100644 --- a/builtin/v12/miner/cbor_gen.go +++ b/builtin/v12/miner/cbor_gen.go @@ -261,10 +261,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -522,7 +522,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -579,7 +579,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -601,7 +601,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -627,7 +627,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -647,10 +647,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -700,10 +700,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -843,7 +843,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1581,10 +1581,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1655,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1722,10 +1722,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1773,10 +1773,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1802,7 +1802,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1841,10 +1841,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1926,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2065,10 +2065,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2106,7 +2106,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2145,10 +2145,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2170,10 +2170,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2240,10 +2240,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PowerBaseEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2378,10 +2378,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2418,7 +2418,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2464,7 +2464,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2556,10 +2556,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2610,7 +2610,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2665,7 +2665,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2851,10 +2851,10 @@ func (t *BeneficiaryTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2967,10 +2967,10 @@ func (t *PendingBeneficiaryChange) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3051,7 +3051,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3115,7 +3115,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -3169,7 +3169,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3224,7 +3224,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -3273,7 +3273,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3318,7 +3318,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3357,7 +3357,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3372,7 +3372,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3398,7 +3398,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3457,7 +3457,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3495,7 +3495,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3529,10 +3529,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3558,7 +3558,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3625,7 +3625,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3703,10 +3703,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3754,10 +3754,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3783,7 +3783,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3822,10 +3822,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3927,7 +3927,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3986,7 +3986,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4019,7 +4019,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4065,7 +4065,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4114,7 +4114,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4160,7 +4160,7 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4209,7 +4209,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4255,7 +4255,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -4368,7 +4368,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4414,7 +4414,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4463,7 +4463,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4509,7 +4509,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4558,7 +4558,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4612,7 +4612,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4796,7 +4796,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4809,7 +4809,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4822,7 +4822,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4867,7 +4867,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4889,7 +4889,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4911,7 +4911,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5000,7 +5000,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5062,7 +5062,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5143,7 +5143,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5151,7 +5151,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -5197,7 +5197,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -5223,7 +5223,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5473,7 +5473,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5519,7 +5519,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5573,7 +5573,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5627,7 +5627,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5660,7 +5660,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5706,7 +5706,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5794,10 +5794,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5834,7 +5834,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5880,7 +5880,7 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5929,7 +5929,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5975,7 +5975,7 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -6091,10 +6091,10 @@ func (t *ChangeBeneficiaryParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6291,7 +6291,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6336,7 +6336,7 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6369,7 +6369,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { + if len(t.MultiAddrs) > 2097152 { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6414,7 +6414,7 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.MultiAddrs: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6732,10 +6732,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6968,7 +6968,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6995,7 +6995,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7094,7 +7094,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7133,10 +7133,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7162,7 +7162,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7225,7 +7225,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7252,7 +7252,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7363,7 +7363,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7402,10 +7402,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7431,7 +7431,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7481,7 +7481,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { + if len(t.SectorsWithClaims) > 8192 { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7576,7 +7576,7 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorsWithClaims: array too large (%d)", extra) } @@ -7610,10 +7610,10 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7656,7 +7656,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.MaintainClaims)) > cbg.MaxLength { + if len(t.MaintainClaims) > 8192 { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7672,7 +7672,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.DropClaims)) > cbg.MaxLength { + if len(t.DropClaims) > 8192 { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } @@ -7733,7 +7733,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.MaintainClaims: array too large (%d)", extra) } @@ -7776,7 +7776,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DropClaims: array too large (%d)", extra) } diff --git a/builtin/v12/multisig/cbor_gen.go b/builtin/v12/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v12/multisig/cbor_gen.go +++ b/builtin/v12/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v12/paych/cbor_gen.go b/builtin/v12/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v12/paych/cbor_gen.go +++ b/builtin/v12/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/power/cbor_gen.go b/builtin/v12/power/cbor_gen.go index 827e4263..4b3371b7 100644 --- a/builtin/v12/power/cbor_gen.go +++ b/builtin/v12/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1458,7 +1458,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v12/reward/cbor_gen.go b/builtin/v12/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v12/reward/cbor_gen.go +++ b/builtin/v12/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v12/verifreg/cbor_gen.go b/builtin/v12/verifreg/cbor_gen.go index e16c254b..777358be 100644 --- a/builtin/v12/verifreg/cbor_gen.go +++ b/builtin/v12/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if uint64(len(t.AllocationIds)) > cbg.MaxLength { + if len(t.AllocationIds) > 8192 { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -699,7 +699,7 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.AllocationIds: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -810,7 +810,7 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -948,7 +948,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1048,7 +1048,7 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1251,7 +1251,7 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if uint64(len(t.Claims)) > cbg.MaxLength { + if len(t.Claims) > 8192 { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1365,7 +1365,7 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Claims: array too large (%d)", extra) } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1479,7 +1479,7 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if uint64(len(t.NewAllocations)) > cbg.MaxLength { + if len(t.NewAllocations) > 8192 { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1587,7 +1587,7 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewAllocations: array too large (%d)", extra) } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if uint64(len(t.Terms)) > cbg.MaxLength { + if len(t.Terms) > 8192 { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1687,7 +1687,7 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terms: array too large (%d)", extra) } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1802,7 +1802,7 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1918,7 +1918,7 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2024,7 +2024,7 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -2363,10 +2363,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2540,10 +2540,10 @@ func (t *SectorAllocationClaim) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2725,10 +2725,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2750,10 +2750,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2775,10 +2775,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2908,10 +2908,10 @@ func (t *ClaimTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3021,10 +3021,10 @@ func (t *ClaimExtensionRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3200,10 +3200,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3225,10 +3225,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3250,10 +3250,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3409,10 +3409,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3434,10 +3434,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3459,10 +3459,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3499,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if uint64(len(t.Allocations)) > cbg.MaxLength { + if len(t.Allocations) > 8192 { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3514,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3560,7 +3560,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Allocations: array too large (%d)", extra) } @@ -3598,7 +3598,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } diff --git a/builtin/v13/account/cbor_gen.go b/builtin/v13/account/cbor_gen.go index 0bd09be2..55e97f33 100644 --- a/builtin/v13/account/cbor_gen.go +++ b/builtin/v13/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { + if len(t.Signature) > 2097152 { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { + if len(t.Message) > 2097152 { return xerrors.Errorf("Byte array in field t.Message was too long") } @@ -147,7 +147,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Signature: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -169,7 +169,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Message: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/cron/cbor_gen.go b/builtin/v13/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v13/cron/cbor_gen.go +++ b/builtin/v13/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v13/datacap/cbor_gen.go b/builtin/v13/datacap/cbor_gen.go index 42c936a6..11e7cbb1 100644 --- a/builtin/v13/datacap/cbor_gen.go +++ b/builtin/v13/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if uint64(len(t.Operators)) > cbg.MaxLength { + if len(t.Operators) > 8192 { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -291,7 +291,7 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Operators: array too large (%d)", extra) } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -413,7 +413,7 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -589,7 +589,7 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -695,7 +695,7 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -815,7 +815,7 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -935,7 +935,7 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/eam/cbor_gen.go b/builtin/v13/eam/cbor_gen.go index ef731149..3c4b391a 100644 --- a/builtin/v13/eam/cbor_gen.go +++ b/builtin/v13/eam/cbor_gen.go @@ -34,7 +34,7 @@ func (t *CreateParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -85,7 +85,7 @@ func (t *CreateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -143,7 +143,7 @@ func (t *CreateReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -220,7 +220,7 @@ func (t *CreateReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -252,7 +252,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -265,7 +265,7 @@ func (t *Create2Params) MarshalCBOR(w io.Writer) error { } // t.Salt ([32]uint8) (array) - if uint64(len(t.Salt)) > cbg.ByteArrayMaxLen { + if len(t.Salt) > 2097152 { return xerrors.Errorf("Byte array in field t.Salt was too long") } @@ -309,7 +309,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -331,7 +331,7 @@ func (t *Create2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Salt: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -374,7 +374,7 @@ func (t *Create2Return) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -451,7 +451,7 @@ func (t *Create2Return) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -494,7 +494,7 @@ func (t *CreateExternalReturn) MarshalCBOR(w io.Writer) error { } // t.EthAddress ([20]uint8) (array) - if uint64(len(t.EthAddress)) > cbg.ByteArrayMaxLen { + if len(t.EthAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.EthAddress was too long") } @@ -571,7 +571,7 @@ func (t *CreateExternalReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EthAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/evm/cbor_gen.go b/builtin/v13/evm/cbor_gen.go index dffac8ac..ea0b5f37 100644 --- a/builtin/v13/evm/cbor_gen.go +++ b/builtin/v13/evm/cbor_gen.go @@ -123,7 +123,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.BytecodeHash ([32]uint8) (array) - if uint64(len(t.BytecodeHash)) > cbg.ByteArrayMaxLen { + if len(t.BytecodeHash) > 2097152 { return xerrors.Errorf("Byte array in field t.BytecodeHash was too long") } @@ -196,7 +196,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BytecodeHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -273,7 +273,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Creator ([20]uint8) (array) - if uint64(len(t.Creator)) > cbg.ByteArrayMaxLen { + if len(t.Creator) > 2097152 { return xerrors.Errorf("Byte array in field t.Creator was too long") } @@ -286,7 +286,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Initcode ([]uint8) (slice) - if uint64(len(t.Initcode)) > cbg.ByteArrayMaxLen { + if len(t.Initcode) > 2097152 { return xerrors.Errorf("Byte array in field t.Initcode was too long") } @@ -331,7 +331,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Creator: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -352,7 +352,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Initcode: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -385,7 +385,7 @@ func (t *GetStorageAtParams) MarshalCBOR(w io.Writer) error { } // t.StorageKey ([32]uint8) (array) - if uint64(len(t.StorageKey)) > cbg.ByteArrayMaxLen { + if len(t.StorageKey) > 2097152 { return xerrors.Errorf("Byte array in field t.StorageKey was too long") } @@ -429,7 +429,7 @@ func (t *GetStorageAtParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.StorageKey: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -467,7 +467,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Input ([]uint8) (slice) - if uint64(len(t.Input)) > cbg.ByteArrayMaxLen { + if len(t.Input) > 2097152 { return xerrors.Errorf("Byte array in field t.Input was too long") } @@ -480,7 +480,7 @@ func (t *DelegateCallParams) MarshalCBOR(w io.Writer) error { } // t.Caller ([20]uint8) (array) - if uint64(len(t.Caller)) > cbg.ByteArrayMaxLen { + if len(t.Caller) > 2097152 { return xerrors.Errorf("Byte array in field t.Caller was too long") } @@ -541,7 +541,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Input: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -563,7 +563,7 @@ func (t *DelegateCallParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Caller: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/init/cbor_gen.go b/builtin/v13/init/cbor_gen.go index e648e48a..934e614c 100644 --- a/builtin/v13/init/cbor_gen.go +++ b/builtin/v13/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -372,7 +372,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -385,7 +385,7 @@ func (t *Exec4Params) MarshalCBOR(w io.Writer) error { } // t.SubAddress ([]uint8) (slice) - if uint64(len(t.SubAddress)) > cbg.ByteArrayMaxLen { + if len(t.SubAddress) > 2097152 { return xerrors.Errorf("Byte array in field t.SubAddress was too long") } @@ -442,7 +442,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -464,7 +464,7 @@ func (t *Exec4Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SubAddress: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/market/cbor_gen.go b/builtin/v13/market/cbor_gen.go index e2889dc2..84934719 100644 --- a/builtin/v13/market/cbor_gen.go +++ b/builtin/v13/market/cbor_gen.go @@ -229,10 +229,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -401,10 +401,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -426,10 +426,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -451,10 +451,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -480,7 +480,7 @@ func (t *SectorDealIDs) MarshalCBOR(w io.Writer) error { cw := cbg.NewCborWriter(w) // (*t) (market.SectorDealIDs) (slice) - if uint64(len((*t))) > cbg.MaxLength { + if len((*t)) > 8192 { return xerrors.Errorf("Slice value in field (*t) was too long") } @@ -512,7 +512,7 @@ func (t *SectorDealIDs) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("(*t): array too large (%d)", extra) } @@ -636,7 +636,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -682,7 +682,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -731,7 +731,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -783,7 +783,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -846,7 +846,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -905,7 +905,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -944,10 +944,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -989,7 +989,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { + if len(t.VerifiedInfos) > 8192 { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -1044,7 +1044,7 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.VerifiedInfos: array too large (%d)", extra) } @@ -1093,7 +1093,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1139,7 +1139,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1188,7 +1188,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.UnsealedCIDs ([]*cid.Cid) (slice) - if uint64(len(t.UnsealedCIDs)) > cbg.MaxLength { + if len(t.UnsealedCIDs) > 8192 { return xerrors.Errorf("Slice value in field t.UnsealedCIDs was too long") } @@ -1241,7 +1241,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.UnsealedCIDs: array too large (%d)", extra) } @@ -1504,10 +1504,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Start (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1529,10 +1529,10 @@ func (t *GetDealTermReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Duration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1619,10 +1619,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Activated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1644,10 +1644,10 @@ func (t *GetDealActivationReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Terminated (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1695,7 +1695,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1738,10 +1738,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1767,7 +1767,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1987,10 +1987,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2012,10 +2012,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2171,7 +2171,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2214,10 +2214,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2239,10 +2239,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2268,7 +2268,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2392,7 +2392,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2451,7 +2451,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2490,10 +2490,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v13/miner/cbor_gen.go b/builtin/v13/miner/cbor_gen.go index 1d73014b..eb249a78 100644 --- a/builtin/v13/miner/cbor_gen.go +++ b/builtin/v13/miner/cbor_gen.go @@ -262,10 +262,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -364,7 +364,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -384,7 +384,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -397,7 +397,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -405,7 +405,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -523,7 +523,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -580,7 +580,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -602,7 +602,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -628,7 +628,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -648,10 +648,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -701,10 +701,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -797,7 +797,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -844,7 +844,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1582,10 +1582,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1656,7 +1656,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1723,10 +1723,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1774,10 +1774,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1803,7 +1803,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1842,10 +1842,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1927,7 +1927,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2066,10 +2066,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2107,7 +2107,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2146,10 +2146,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2171,10 +2171,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2241,10 +2241,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PowerBaseEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2379,10 +2379,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2419,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2465,7 +2465,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2557,10 +2557,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2611,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2666,7 +2666,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2852,10 +2852,10 @@ func (t *BeneficiaryTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2968,10 +2968,10 @@ func (t *PendingBeneficiaryChange) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3052,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3116,7 +3116,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -3170,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3225,7 +3225,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -3274,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3319,7 +3319,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3358,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3373,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3399,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3458,7 +3458,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3496,7 +3496,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3530,10 +3530,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3559,7 +3559,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3626,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3704,10 +3704,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3755,10 +3755,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3784,7 +3784,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3823,10 +3823,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3928,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3987,7 +3987,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4020,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4066,7 +4066,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4115,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4161,7 +4161,7 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4210,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4256,7 +4256,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -4369,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4415,7 +4415,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4464,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4510,7 +4510,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4559,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4613,7 +4613,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4797,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4810,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4823,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4868,7 +4868,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4890,7 +4890,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4912,7 +4912,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5001,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5063,7 +5063,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5144,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5152,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -5198,7 +5198,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -5224,7 +5224,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5474,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5520,7 +5520,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5574,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5628,7 +5628,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5661,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5707,7 +5707,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5795,10 +5795,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5835,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5881,7 +5881,7 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5930,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5976,7 +5976,7 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -6092,10 +6092,10 @@ func (t *ChangeBeneficiaryParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6292,7 +6292,7 @@ func (t *GetPeerIDReturn) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -6337,7 +6337,7 @@ func (t *GetPeerIDReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6370,7 +6370,7 @@ func (t *GetMultiAddrsReturn) MarshalCBOR(w io.Writer) error { } // t.MultiAddrs ([]uint8) (slice) - if uint64(len(t.MultiAddrs)) > cbg.ByteArrayMaxLen { + if len(t.MultiAddrs) > 2097152 { return xerrors.Errorf("Byte array in field t.MultiAddrs was too long") } @@ -6415,7 +6415,7 @@ func (t *GetMultiAddrsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.MultiAddrs: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6448,7 +6448,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.SectorActivations ([]miner.SectorActivationManifest) (slice) - if uint64(len(t.SectorActivations)) > cbg.MaxLength { + if len(t.SectorActivations) > 8192 { return xerrors.Errorf("Slice value in field t.SectorActivations was too long") } @@ -6463,7 +6463,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.SectorProofs ([][]uint8) (slice) - if uint64(len(t.SectorProofs)) > cbg.MaxLength { + if len(t.SectorProofs) > 8192 { return xerrors.Errorf("Slice value in field t.SectorProofs was too long") } @@ -6471,7 +6471,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.SectorProofs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -6486,7 +6486,7 @@ func (t *ProveCommitSectors3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -6557,7 +6557,7 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorActivations: array too large (%d)", extra) } @@ -6595,7 +6595,7 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) } @@ -6621,7 +6621,7 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6645,7 +6645,7 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6671,11 +6671,11 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - maj, extra, err = cr.ReadHeader() - var extraI int64 + maj, extra, err := cr.ReadHeader() if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6691,9 +6691,9 @@ func (t *ProveCommitSectors3Params) UnmarshalCBOR(r io.Reader) (err error) { default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.AggregateProofType = &extraI - } + t.AggregateProofType = (*abi.RegisteredAggregationProof)(&extraI) + } } // t.RequireActivationSuccess (bool) (bool) @@ -6753,7 +6753,7 @@ func (t *SectorActivationManifest) MarshalCBOR(w io.Writer) error { } // t.Pieces ([]miner.PieceActivationManifest) (slice) - if uint64(len(t.Pieces)) > cbg.MaxLength { + if len(t.Pieces) > 8192 { return xerrors.Errorf("Slice value in field t.Pieces was too long") } @@ -6813,7 +6813,7 @@ func (t *SectorActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Pieces: array too large (%d)", extra) } @@ -6879,7 +6879,7 @@ func (t *PieceActivationManifest) MarshalCBOR(w io.Writer) error { } // t.Notify ([]miner.DataActivationNotification) (slice) - if uint64(len(t.Notify)) > cbg.MaxLength { + if len(t.Notify) > 8192 { return xerrors.Errorf("Slice value in field t.Notify was too long") } @@ -6970,7 +6970,7 @@ func (t *PieceActivationManifest) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Notify: array too large (%d)", extra) } @@ -7107,7 +7107,7 @@ func (t *DataActivationNotification) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -7161,7 +7161,7 @@ func (t *DataActivationNotification) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7200,7 +7200,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]miner.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -7260,7 +7260,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -7368,10 +7368,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7408,7 +7408,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.SectorUpdates ([]miner.SectorUpdateManifest) (slice) - if uint64(len(t.SectorUpdates)) > cbg.MaxLength { + if len(t.SectorUpdates) > 8192 { return xerrors.Errorf("Slice value in field t.SectorUpdates was too long") } @@ -7423,7 +7423,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.SectorProofs ([][]uint8) (slice) - if uint64(len(t.SectorProofs)) > cbg.MaxLength { + if len(t.SectorProofs) > 8192 { return xerrors.Errorf("Slice value in field t.SectorProofs was too long") } @@ -7431,7 +7431,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.SectorProofs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -7446,7 +7446,7 @@ func (t *ProveReplicaUpdates3Params) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -7528,7 +7528,7 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorUpdates: array too large (%d)", extra) } @@ -7566,7 +7566,7 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorProofs: array too large (%d)", extra) } @@ -7592,7 +7592,7 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SectorProofs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7616,7 +7616,7 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7634,10 +7634,10 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofsType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7667,11 +7667,11 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - maj, extra, err = cr.ReadHeader() - var extraI int64 + maj, extra, err := cr.ReadHeader() if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7687,9 +7687,9 @@ func (t *ProveReplicaUpdates3Params) UnmarshalCBOR(r io.Reader) (err error) { default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.AggregateProofType = &extraI - } + t.AggregateProofType = (*abi.RegisteredAggregationProof)(&extraI) + } } // t.RequireActivationSuccess (bool) (bool) @@ -7767,7 +7767,7 @@ func (t *SectorUpdateManifest) MarshalCBOR(w io.Writer) error { } // t.Pieces ([]miner.PieceActivationManifest) (slice) - if uint64(len(t.Pieces)) > cbg.MaxLength { + if len(t.Pieces) > 8192 { return xerrors.Errorf("Slice value in field t.Pieces was too long") } @@ -7867,7 +7867,7 @@ func (t *SectorUpdateManifest) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Pieces: array too large (%d)", extra) } @@ -7933,7 +7933,7 @@ func (t *SectorChanges) MarshalCBOR(w io.Writer) error { } // t.Added ([]miner.PieceChange) (slice) - if uint64(len(t.Added)) > cbg.MaxLength { + if len(t.Added) > 8192 { return xerrors.Errorf("Slice value in field t.Added was too long") } @@ -7989,10 +7989,10 @@ func (t *SectorChanges) UnmarshalCBOR(r io.Reader) (err error) { // t.MinimumCommitmentEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -8018,7 +8018,7 @@ func (t *SectorChanges) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Added: array too large (%d)", extra) } @@ -8079,7 +8079,7 @@ func (t *PieceChange) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -8150,7 +8150,7 @@ func (t *PieceChange) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -8468,10 +8468,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -8704,7 +8704,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -8731,7 +8731,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -8830,7 +8830,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -8869,10 +8869,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -8898,7 +8898,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -8961,7 +8961,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -8988,7 +8988,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -9099,7 +9099,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -9138,10 +9138,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -9167,7 +9167,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -9217,7 +9217,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { + if len(t.SectorsWithClaims) > 8192 { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -9312,7 +9312,7 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorsWithClaims: array too large (%d)", extra) } @@ -9346,10 +9346,10 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -9392,7 +9392,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.MaintainClaims)) > cbg.MaxLength { + if len(t.MaintainClaims) > 8192 { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -9408,7 +9408,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.DropClaims)) > cbg.MaxLength { + if len(t.DropClaims) > 8192 { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } @@ -9469,7 +9469,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.MaintainClaims: array too large (%d)", extra) } @@ -9512,7 +9512,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DropClaims: array too large (%d)", extra) } diff --git a/builtin/v13/multisig/cbor_gen.go b/builtin/v13/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v13/multisig/cbor_gen.go +++ b/builtin/v13/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v13/paych/cbor_gen.go b/builtin/v13/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v13/paych/cbor_gen.go +++ b/builtin/v13/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/power/cbor_gen.go b/builtin/v13/power/cbor_gen.go index 827e4263..4b3371b7 100644 --- a/builtin/v13/power/cbor_gen.go +++ b/builtin/v13/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1404,7 +1404,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1458,7 +1458,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v13/reward/cbor_gen.go b/builtin/v13/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v13/reward/cbor_gen.go +++ b/builtin/v13/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v13/verifreg/cbor_gen.go b/builtin/v13/verifreg/cbor_gen.go index e16c254b..777358be 100644 --- a/builtin/v13/verifreg/cbor_gen.go +++ b/builtin/v13/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if uint64(len(t.AllocationIds)) > cbg.MaxLength { + if len(t.AllocationIds) > 8192 { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -699,7 +699,7 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.AllocationIds: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -810,7 +810,7 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -948,7 +948,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1048,7 +1048,7 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1251,7 +1251,7 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if uint64(len(t.Claims)) > cbg.MaxLength { + if len(t.Claims) > 8192 { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1365,7 +1365,7 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Claims: array too large (%d)", extra) } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1479,7 +1479,7 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if uint64(len(t.NewAllocations)) > cbg.MaxLength { + if len(t.NewAllocations) > 8192 { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1587,7 +1587,7 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewAllocations: array too large (%d)", extra) } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if uint64(len(t.Terms)) > cbg.MaxLength { + if len(t.Terms) > 8192 { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1687,7 +1687,7 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terms: array too large (%d)", extra) } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1802,7 +1802,7 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1918,7 +1918,7 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2024,7 +2024,7 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -2363,10 +2363,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2540,10 +2540,10 @@ func (t *SectorAllocationClaim) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2725,10 +2725,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2750,10 +2750,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2775,10 +2775,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2908,10 +2908,10 @@ func (t *ClaimTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3021,10 +3021,10 @@ func (t *ClaimExtensionRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3200,10 +3200,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3225,10 +3225,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3250,10 +3250,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3409,10 +3409,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3434,10 +3434,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3459,10 +3459,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3499,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if uint64(len(t.Allocations)) > cbg.MaxLength { + if len(t.Allocations) > 8192 { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3514,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3560,7 +3560,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Allocations: array too large (%d)", extra) } @@ -3598,7 +3598,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } diff --git a/builtin/v8/cron/cbor_gen.go b/builtin/v8/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v8/cron/cbor_gen.go +++ b/builtin/v8/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v8/init/cbor_gen.go b/builtin/v8/init/cbor_gen.go index ddb5664f..253a32d2 100644 --- a/builtin/v8/init/cbor_gen.go +++ b/builtin/v8/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v8/market/cbor_gen.go b/builtin/v8/market/cbor_gen.go index 4cfec096..1d05e974 100644 --- a/builtin/v8/market/cbor_gen.go +++ b/builtin/v8/market/cbor_gen.go @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -343,10 +343,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -368,10 +368,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -393,10 +393,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -503,7 +503,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -549,7 +549,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -598,7 +598,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -650,7 +650,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -713,7 +713,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -772,7 +772,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -811,10 +811,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -851,7 +851,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -897,7 +897,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -946,7 +946,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorWeights) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -992,7 +992,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1041,7 +1041,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if uint64(len(t.Inputs)) > cbg.MaxLength { + if len(t.Inputs) > 8192 { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1087,7 +1087,7 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Inputs: array too large (%d)", extra) } @@ -1146,7 +1146,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if uint64(len(t.CommDs)) > cbg.MaxLength { + if len(t.CommDs) > 8192 { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1192,7 +1192,7 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.CommDs: array too large (%d)", extra) } @@ -1252,7 +1252,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1295,10 +1295,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1324,7 +1324,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1544,10 +1544,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1569,10 +1569,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1717,7 +1717,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1760,10 +1760,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1789,7 +1789,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1933,7 +1933,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1992,7 +1992,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2031,10 +2031,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v8/miner/cbor_gen.go b/builtin/v8/miner/cbor_gen.go index cd1a1b73..2a94c42a 100644 --- a/builtin/v8/miner/cbor_gen.go +++ b/builtin/v8/miner/cbor_gen.go @@ -260,10 +260,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -382,7 +382,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -395,7 +395,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -403,7 +403,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -506,7 +506,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -563,7 +563,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -585,7 +585,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -611,7 +611,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -631,10 +631,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -684,10 +684,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -743,7 +743,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -790,7 +790,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1537,10 +1537,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1629,7 +1629,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1707,10 +1707,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1758,10 +1758,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1787,7 +1787,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1826,10 +1826,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1948,7 +1948,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2081,10 +2081,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2122,7 +2122,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2161,10 +2161,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2186,10 +2186,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2256,10 +2256,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ReplacedSectorAge (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2380,10 +2380,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2420,7 +2420,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2466,7 +2466,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2558,10 +2558,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2612,7 +2612,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2667,7 +2667,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2726,7 +2726,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -2790,7 +2790,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -2844,7 +2844,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -2899,7 +2899,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -2948,7 +2948,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -2993,7 +2993,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3032,7 +3032,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3047,7 +3047,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3073,7 +3073,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3132,7 +3132,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3170,7 +3170,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3204,10 +3204,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3233,7 +3233,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3300,7 +3300,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3378,10 +3378,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3429,10 +3429,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3458,7 +3458,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3497,10 +3497,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3602,7 +3602,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3661,7 +3661,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3694,7 +3694,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3740,7 +3740,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -3789,7 +3789,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -3835,7 +3835,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -3948,7 +3948,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -3994,7 +3994,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4043,7 +4043,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4089,7 +4089,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4138,7 +4138,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4192,7 +4192,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4376,7 +4376,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4389,7 +4389,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4402,7 +4402,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4447,7 +4447,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4469,7 +4469,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4491,7 +4491,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4580,7 +4580,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -4642,7 +4642,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -4723,7 +4723,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -4731,7 +4731,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -4777,7 +4777,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -4803,7 +4803,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5053,7 +5053,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5099,7 +5099,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5153,7 +5153,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5207,7 +5207,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5240,7 +5240,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5286,7 +5286,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5374,10 +5374,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5699,10 +5699,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5935,7 +5935,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -5962,7 +5962,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -6061,7 +6061,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -6100,10 +6100,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6129,7 +6129,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v8/multisig/cbor_gen.go b/builtin/v8/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v8/multisig/cbor_gen.go +++ b/builtin/v8/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v8/paych/cbor_gen.go b/builtin/v8/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v8/paych/cbor_gen.go +++ b/builtin/v8/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v8/power/cbor_gen.go b/builtin/v8/power/cbor_gen.go index d28e889e..c09ca4f4 100644 --- a/builtin/v8/power/cbor_gen.go +++ b/builtin/v8/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1326,7 +1326,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1380,7 +1380,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v8/reward/cbor_gen.go b/builtin/v8/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v8/reward/cbor_gen.go +++ b/builtin/v8/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v9/account/cbor_gen.go b/builtin/v9/account/cbor_gen.go index 0bd09be2..55e97f33 100644 --- a/builtin/v9/account/cbor_gen.go +++ b/builtin/v9/account/cbor_gen.go @@ -89,7 +89,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Signature ([]uint8) (slice) - if uint64(len(t.Signature)) > cbg.ByteArrayMaxLen { + if len(t.Signature) > 2097152 { return xerrors.Errorf("Byte array in field t.Signature was too long") } @@ -102,7 +102,7 @@ func (t *AuthenticateMessageParams) MarshalCBOR(w io.Writer) error { } // t.Message ([]uint8) (slice) - if uint64(len(t.Message)) > cbg.ByteArrayMaxLen { + if len(t.Message) > 2097152 { return xerrors.Errorf("Byte array in field t.Message was too long") } @@ -147,7 +147,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Signature: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -169,7 +169,7 @@ func (t *AuthenticateMessageParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Message: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v9/cron/cbor_gen.go b/builtin/v9/cron/cbor_gen.go index 73deb41d..b00c94d4 100644 --- a/builtin/v9/cron/cbor_gen.go +++ b/builtin/v9/cron/cbor_gen.go @@ -34,7 +34,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Entries ([]cron.Entry) (slice) - if uint64(len(t.Entries)) > cbg.MaxLength { + if len(t.Entries) > 8192 { return xerrors.Errorf("Slice value in field t.Entries was too long") } @@ -80,7 +80,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Entries: array too large (%d)", extra) } diff --git a/builtin/v9/datacap/cbor_gen.go b/builtin/v9/datacap/cbor_gen.go index 42c936a6..11e7cbb1 100644 --- a/builtin/v9/datacap/cbor_gen.go +++ b/builtin/v9/datacap/cbor_gen.go @@ -227,7 +227,7 @@ func (t *MintParams) MarshalCBOR(w io.Writer) error { } // t.Operators ([]address.Address) (slice) - if uint64(len(t.Operators)) > cbg.MaxLength { + if len(t.Operators) > 8192 { return xerrors.Errorf("Slice value in field t.Operators was too long") } @@ -291,7 +291,7 @@ func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Operators: array too large (%d)", extra) } @@ -350,7 +350,7 @@ func (t *MintReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -413,7 +413,7 @@ func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -526,7 +526,7 @@ func (t *TransferParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -589,7 +589,7 @@ func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -632,7 +632,7 @@ func (t *TransferReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -695,7 +695,7 @@ func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -743,7 +743,7 @@ func (t *TransferFromParams) MarshalCBOR(w io.Writer) error { } // t.OperatorData ([]uint8) (slice) - if uint64(len(t.OperatorData)) > cbg.ByteArrayMaxLen { + if len(t.OperatorData) > 2097152 { return xerrors.Errorf("Byte array in field t.OperatorData was too long") } @@ -815,7 +815,7 @@ func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.OperatorData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -863,7 +863,7 @@ func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error { } // t.RecipientData ([]uint8) (slice) - if uint64(len(t.RecipientData)) > cbg.ByteArrayMaxLen { + if len(t.RecipientData) > 2097152 { return xerrors.Errorf("Byte array in field t.RecipientData was too long") } @@ -935,7 +935,7 @@ func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.RecipientData: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v9/init/cbor_gen.go b/builtin/v9/init/cbor_gen.go index ddb5664f..253a32d2 100644 --- a/builtin/v9/init/cbor_gen.go +++ b/builtin/v9/init/cbor_gen.go @@ -46,7 +46,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -111,7 +111,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -136,7 +136,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.NetworkName (string) (string) - if uint64(len(t.NetworkName)) > cbg.MaxLength { + if len(t.NetworkName) > 8192 { return xerrors.Errorf("Value in field t.NetworkName was too long") } @@ -175,7 +175,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NetworkName (string) (string) { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -206,7 +206,7 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { } // t.ConstructorParams ([]uint8) (slice) - if uint64(len(t.ConstructorParams)) > cbg.ByteArrayMaxLen { + if len(t.ConstructorParams) > 2097152 { return xerrors.Errorf("Byte array in field t.ConstructorParams was too long") } @@ -263,7 +263,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ConstructorParams: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v9/market/cbor_gen.go b/builtin/v9/market/cbor_gen.go index f8939df4..3f42e55c 100644 --- a/builtin/v9/market/cbor_gen.go +++ b/builtin/v9/market/cbor_gen.go @@ -223,10 +223,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.LastCron (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -369,10 +369,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorStartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -394,10 +394,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.LastUpdatedEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -419,10 +419,10 @@ func (t *DealState) UnmarshalCBOR(r io.Reader) (err error) { // t.SlashEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -543,7 +543,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { } // t.Deals ([]market.ClientDealProposal) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -589,7 +589,7 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -638,7 +638,7 @@ func (t *PublishStorageDealsReturn) MarshalCBOR(w io.Writer) error { } // t.IDs ([]abi.DealID) (slice) - if uint64(len(t.IDs)) > cbg.MaxLength { + if len(t.IDs) > 8192 { return xerrors.Errorf("Slice value in field t.IDs was too long") } @@ -690,7 +690,7 @@ func (t *PublishStorageDealsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.IDs: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *ActivateDealsParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -812,7 +812,7 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -851,10 +851,10 @@ func (t *ActivateDealsParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -896,7 +896,7 @@ func (t *ActivateDealsResult) MarshalCBOR(w io.Writer) error { } // t.VerifiedInfos ([]market.VerifiedDealInfo) (slice) - if uint64(len(t.VerifiedInfos)) > cbg.MaxLength { + if len(t.VerifiedInfos) > 8192 { return xerrors.Errorf("Slice value in field t.VerifiedInfos was too long") } @@ -951,7 +951,7 @@ func (t *ActivateDealsResult) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.VerifiedInfos: array too large (%d)", extra) } @@ -1000,7 +1000,7 @@ func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDeals) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1046,7 +1046,7 @@ func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1095,7 +1095,7 @@ func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]market.SectorDealData) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1141,7 +1141,7 @@ func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } // t.Inputs ([]*market.SectorDataSpec) (slice) - if uint64(len(t.Inputs)) > cbg.MaxLength { + if len(t.Inputs) > 8192 { return xerrors.Errorf("Slice value in field t.Inputs was too long") } @@ -1236,7 +1236,7 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Inputs: array too large (%d)", extra) } @@ -1295,7 +1295,7 @@ func (t *ComputeDataCommitmentReturn) MarshalCBOR(w io.Writer) error { } // t.CommDs ([]typegen.CborCid) (slice) - if uint64(len(t.CommDs)) > cbg.MaxLength { + if len(t.CommDs) > 8192 { return xerrors.Errorf("Slice value in field t.CommDs was too long") } @@ -1341,7 +1341,7 @@ func (t *ComputeDataCommitmentReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.CommDs: array too large (%d)", extra) } @@ -1401,7 +1401,7 @@ func (t *OnMinerSectorsTerminateParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1444,10 +1444,10 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1473,7 +1473,7 @@ func (t *OnMinerSectorsTerminateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1693,10 +1693,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1718,10 +1718,10 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) (err error) { // t.EndEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1877,7 +1877,7 @@ func (t *SectorDeals) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1920,10 +1920,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1945,10 +1945,10 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1974,7 +1974,7 @@ func (t *SectorDeals) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2175,7 +2175,7 @@ func (t *SectorDataSpec) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2234,7 +2234,7 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2273,10 +2273,10 @@ func (t *SectorDataSpec) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorType (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v9/miner/cbor_gen.go b/builtin/v9/miner/cbor_gen.go index 5dc35eda..15deb937 100644 --- a/builtin/v9/miner/cbor_gen.go +++ b/builtin/v9/miner/cbor_gen.go @@ -261,10 +261,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.ProvingPeriodStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -363,7 +363,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.ControlAddresses ([]address.Address) (slice) - if uint64(len(t.ControlAddresses)) > cbg.MaxLength { + if len(t.ControlAddresses) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddresses was too long") } @@ -383,7 +383,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -396,7 +396,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -404,7 +404,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -522,7 +522,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddresses: array too large (%d)", extra) } @@ -579,7 +579,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -601,7 +601,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -627,7 +627,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -647,10 +647,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -700,10 +700,10 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ConsensusFaultElapsed (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -796,7 +796,7 @@ func (t *Deadlines) MarshalCBOR(w io.Writer) error { } // t.Due ([48]cid.Cid) (array) - if uint64(len(t.Due)) > cbg.MaxLength { + if len(t.Due) > 8192 { return xerrors.Errorf("Slice value in field t.Due was too long") } @@ -843,7 +843,7 @@ func (t *Deadlines) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Due: array too large (%d)", extra) } @@ -1581,10 +1581,10 @@ func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.PreCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1655,7 +1655,7 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -1722,10 +1722,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1773,10 +1773,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1802,7 +1802,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -1841,10 +1841,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1926,7 +1926,7 @@ func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -2063,10 +2063,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2104,7 +2104,7 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -2143,10 +2143,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Activation (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2168,10 +2168,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2238,10 +2238,10 @@ func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) (err error) { // t.ReplacedSectorAge (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2379,10 +2379,10 @@ func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2419,7 +2419,7 @@ func (t *VestingFunds) MarshalCBOR(w io.Writer) error { } // t.Funds ([]miner.VestingFund) (slice) - if uint64(len(t.Funds)) > cbg.MaxLength { + if len(t.Funds) > 8192 { return xerrors.Errorf("Slice value in field t.Funds was too long") } @@ -2465,7 +2465,7 @@ func (t *VestingFunds) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Funds: array too large (%d)", extra) } @@ -2557,10 +2557,10 @@ func (t *VestingFund) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2611,7 +2611,7 @@ func (t *WindowedPoSt) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -2666,7 +2666,7 @@ func (t *WindowedPoSt) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -2852,10 +2852,10 @@ func (t *BeneficiaryTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2968,10 +2968,10 @@ func (t *PendingBeneficiaryChange) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3052,7 +3052,7 @@ func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -3116,7 +3116,7 @@ func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -3170,7 +3170,7 @@ func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error { } // t.NewControlAddrs ([]address.Address) (slice) - if uint64(len(t.NewControlAddrs)) > cbg.MaxLength { + if len(t.NewControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewControlAddrs was too long") } @@ -3225,7 +3225,7 @@ func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewControlAddrs: array too large (%d)", extra) } @@ -3274,7 +3274,7 @@ func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error { } // t.NewID ([]uint8) (slice) - if uint64(len(t.NewID)) > cbg.ByteArrayMaxLen { + if len(t.NewID) > 2097152 { return xerrors.Errorf("Byte array in field t.NewID was too long") } @@ -3319,7 +3319,7 @@ func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewID: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3358,7 +3358,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Partitions ([]miner.PoStPartition) (slice) - if uint64(len(t.Partitions)) > cbg.MaxLength { + if len(t.Partitions) > 8192 { return xerrors.Errorf("Slice value in field t.Partitions was too long") } @@ -3373,7 +3373,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.Proofs ([]proof.PoStProof) (slice) - if uint64(len(t.Proofs)) > cbg.MaxLength { + if len(t.Proofs) > 8192 { return xerrors.Errorf("Slice value in field t.Proofs was too long") } @@ -3399,7 +3399,7 @@ func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error { } // t.ChainCommitRand (abi.Randomness) (slice) - if uint64(len(t.ChainCommitRand)) > cbg.ByteArrayMaxLen { + if len(t.ChainCommitRand) > 2097152 { return xerrors.Errorf("Byte array in field t.ChainCommitRand was too long") } @@ -3458,7 +3458,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Partitions: array too large (%d)", extra) } @@ -3496,7 +3496,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Proofs: array too large (%d)", extra) } @@ -3530,10 +3530,10 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ChainCommitEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3559,7 +3559,7 @@ func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ChainCommitRand: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -3626,7 +3626,7 @@ func (t *PreCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.DealIDs ([]abi.DealID) (slice) - if uint64(len(t.DealIDs)) > cbg.MaxLength { + if len(t.DealIDs) > 8192 { return xerrors.Errorf("Slice value in field t.DealIDs was too long") } @@ -3704,10 +3704,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealProof (abi.RegisteredSealProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3755,10 +3755,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.SealRandEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3784,7 +3784,7 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3823,10 +3823,10 @@ func (t *PreCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3928,7 +3928,7 @@ func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error { } // t.Proof ([]uint8) (slice) - if uint64(len(t.Proof)) > cbg.ByteArrayMaxLen { + if len(t.Proof) > 2097152 { return xerrors.Errorf("Byte array in field t.Proof was too long") } @@ -3987,7 +3987,7 @@ func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4020,7 +4020,7 @@ func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4066,7 +4066,7 @@ func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4115,7 +4115,7 @@ func (t *ExtendSectorExpiration2Params) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]miner.ExpirationExtension2) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -4161,7 +4161,7 @@ func (t *ExtendSectorExpiration2Params) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } @@ -4210,7 +4210,7 @@ func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error { } // t.Terminations ([]miner.TerminationDeclaration) (slice) - if uint64(len(t.Terminations)) > cbg.MaxLength { + if len(t.Terminations) > 8192 { return xerrors.Errorf("Slice value in field t.Terminations was too long") } @@ -4256,7 +4256,7 @@ func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terminations: array too large (%d)", extra) } @@ -4369,7 +4369,7 @@ func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error { } // t.Faults ([]miner.FaultDeclaration) (slice) - if uint64(len(t.Faults)) > cbg.MaxLength { + if len(t.Faults) > 8192 { return xerrors.Errorf("Slice value in field t.Faults was too long") } @@ -4415,7 +4415,7 @@ func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Faults: array too large (%d)", extra) } @@ -4464,7 +4464,7 @@ func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error { } // t.Recoveries ([]miner.RecoveryDeclaration) (slice) - if uint64(len(t.Recoveries)) > cbg.MaxLength { + if len(t.Recoveries) > 8192 { return xerrors.Errorf("Slice value in field t.Recoveries was too long") } @@ -4510,7 +4510,7 @@ func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Recoveries: array too large (%d)", extra) } @@ -4559,7 +4559,7 @@ func (t *DeferredCronEventParams) MarshalCBOR(w io.Writer) error { } // t.EventPayload ([]uint8) (slice) - if uint64(len(t.EventPayload)) > cbg.ByteArrayMaxLen { + if len(t.EventPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.EventPayload was too long") } @@ -4613,7 +4613,7 @@ func (t *DeferredCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.EventPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4797,7 +4797,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader1 ([]uint8) (slice) - if uint64(len(t.BlockHeader1)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader1) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader1 was too long") } @@ -4810,7 +4810,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeader2 ([]uint8) (slice) - if uint64(len(t.BlockHeader2)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeader2) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeader2 was too long") } @@ -4823,7 +4823,7 @@ func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error { } // t.BlockHeaderExtra ([]uint8) (slice) - if uint64(len(t.BlockHeaderExtra)) > cbg.ByteArrayMaxLen { + if len(t.BlockHeaderExtra) > 2097152 { return xerrors.Errorf("Byte array in field t.BlockHeaderExtra was too long") } @@ -4868,7 +4868,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader1: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4890,7 +4890,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeader2: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -4912,7 +4912,7 @@ func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.BlockHeaderExtra: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5001,7 +5001,7 @@ func (t *ConfirmSectorProofsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]abi.SectorNumber) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5063,7 +5063,7 @@ func (t *ConfirmSectorProofsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5144,7 +5144,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { } // t.NewMultiaddrs ([][]uint8) (slice) - if uint64(len(t.NewMultiaddrs)) > cbg.MaxLength { + if len(t.NewMultiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.NewMultiaddrs was too long") } @@ -5152,7 +5152,7 @@ func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.NewMultiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -5198,7 +5198,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewMultiaddrs: array too large (%d)", extra) } @@ -5224,7 +5224,7 @@ func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.NewMultiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5474,7 +5474,7 @@ func (t *PreCommitSectorBatchParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.PreCommitSectorParams) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5520,7 +5520,7 @@ func (t *PreCommitSectorBatchParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5574,7 +5574,7 @@ func (t *ProveCommitAggregateParams) MarshalCBOR(w io.Writer) error { } // t.AggregateProof ([]uint8) (slice) - if uint64(len(t.AggregateProof)) > cbg.ByteArrayMaxLen { + if len(t.AggregateProof) > 2097152 { return xerrors.Errorf("Byte array in field t.AggregateProof was too long") } @@ -5628,7 +5628,7 @@ func (t *ProveCommitAggregateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.AggregateProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -5661,7 +5661,7 @@ func (t *ProveReplicaUpdatesParams) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5707,7 +5707,7 @@ func (t *ProveReplicaUpdatesParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -5795,10 +5795,10 @@ func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) (err error) { // t.EventType (miner.CronEventType) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -5835,7 +5835,7 @@ func (t *PreCommitSectorBatchParams2) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]miner.SectorPreCommitInfo) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -5881,7 +5881,7 @@ func (t *PreCommitSectorBatchParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -5930,7 +5930,7 @@ func (t *ProveReplicaUpdatesParams2) MarshalCBOR(w io.Writer) error { } // t.Updates ([]miner.ReplicaUpdate2) (slice) - if uint64(len(t.Updates)) > cbg.MaxLength { + if len(t.Updates) > 8192 { return xerrors.Errorf("Slice value in field t.Updates was too long") } @@ -5976,7 +5976,7 @@ func (t *ProveReplicaUpdatesParams2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Updates: array too large (%d)", extra) } @@ -6092,10 +6092,10 @@ func (t *ChangeBeneficiaryParams) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6497,10 +6497,10 @@ func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6733,7 +6733,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -6760,7 +6760,7 @@ func (t *ReplicaUpdate) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -6859,7 +6859,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -6898,10 +6898,10 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -6927,7 +6927,7 @@ func (t *ReplicaUpdate) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -6990,7 +6990,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.Deals ([]abi.DealID) (slice) - if uint64(len(t.Deals)) > cbg.MaxLength { + if len(t.Deals) > 8192 { return xerrors.Errorf("Slice value in field t.Deals was too long") } @@ -7017,7 +7017,7 @@ func (t *ReplicaUpdate2) MarshalCBOR(w io.Writer) error { } // t.ReplicaProof ([]uint8) (slice) - if uint64(len(t.ReplicaProof)) > cbg.ByteArrayMaxLen { + if len(t.ReplicaProof) > 2097152 { return xerrors.Errorf("Byte array in field t.ReplicaProof was too long") } @@ -7128,7 +7128,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -7167,10 +7167,10 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { // t.UpdateProofType (abi.RegisteredUpdateProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7196,7 +7196,7 @@ func (t *ReplicaUpdate2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ReplicaProof: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -7246,7 +7246,7 @@ func (t *ExpirationExtension2) MarshalCBOR(w io.Writer) error { } // t.SectorsWithClaims ([]miner.SectorClaim) (slice) - if uint64(len(t.SectorsWithClaims)) > cbg.MaxLength { + if len(t.SectorsWithClaims) > 8192 { return xerrors.Errorf("Slice value in field t.SectorsWithClaims was too long") } @@ -7341,7 +7341,7 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.SectorsWithClaims: array too large (%d)", extra) } @@ -7375,10 +7375,10 @@ func (t *ExpirationExtension2) UnmarshalCBOR(r io.Reader) (err error) { // t.NewExpiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -7421,7 +7421,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.MaintainClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.MaintainClaims)) > cbg.MaxLength { + if len(t.MaintainClaims) > 8192 { return xerrors.Errorf("Slice value in field t.MaintainClaims was too long") } @@ -7437,7 +7437,7 @@ func (t *SectorClaim) MarshalCBOR(w io.Writer) error { } // t.DropClaims ([]verifreg.ClaimId) (slice) - if uint64(len(t.DropClaims)) > cbg.MaxLength { + if len(t.DropClaims) > 8192 { return xerrors.Errorf("Slice value in field t.DropClaims was too long") } @@ -7498,7 +7498,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.MaintainClaims: array too large (%d)", extra) } @@ -7541,7 +7541,7 @@ func (t *SectorClaim) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.DropClaims: array too large (%d)", extra) } diff --git a/builtin/v9/multisig/cbor_gen.go b/builtin/v9/multisig/cbor_gen.go index c28dfdf4..c9a552a1 100644 --- a/builtin/v9/multisig/cbor_gen.go +++ b/builtin/v9/multisig/cbor_gen.go @@ -36,7 +36,7 @@ func (t *State) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -133,7 +133,7 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -181,10 +181,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.NextTxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -215,10 +215,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -240,10 +240,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,7 +308,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -321,7 +321,7 @@ func (t *Transaction) MarshalCBOR(w io.Writer) error { } // t.Approved ([]address.Address) (slice) - if uint64(len(t.Approved)) > cbg.MaxLength { + if len(t.Approved) > 8192 { return xerrors.Errorf("Slice value in field t.Approved was too long") } @@ -399,7 +399,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -421,7 +421,7 @@ func (t *Transaction) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -491,7 +491,7 @@ func (t *ProposalHashData) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -577,7 +577,7 @@ func (t *ProposalHashData) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -610,7 +610,7 @@ func (t *ConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Signers ([]address.Address) (slice) - if uint64(len(t.Signers)) > cbg.MaxLength { + if len(t.Signers) > 8192 { return xerrors.Errorf("Slice value in field t.Signers was too long") } @@ -685,7 +685,7 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -733,10 +733,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -758,10 +758,10 @@ func (t *ConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -814,7 +814,7 @@ func (t *ProposeParams) MarshalCBOR(w io.Writer) error { } // t.Params ([]uint8) (slice) - if uint64(len(t.Params)) > cbg.ByteArrayMaxLen { + if len(t.Params) > 2097152 { return xerrors.Errorf("Byte array in field t.Params was too long") } @@ -891,7 +891,7 @@ func (t *ProposeParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Params: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -951,7 +951,7 @@ func (t *ProposeReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -992,10 +992,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.TxnID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1034,10 +1034,10 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1063,7 +1063,7 @@ func (t *ProposeReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1263,7 +1263,7 @@ func (t *TxnIDParams) MarshalCBOR(w io.Writer) error { } // t.ProposalHash ([]uint8) (slice) - if uint64(len(t.ProposalHash)) > cbg.ByteArrayMaxLen { + if len(t.ProposalHash) > 2097152 { return xerrors.Errorf("Byte array in field t.ProposalHash was too long") } @@ -1304,10 +1304,10 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { // t.ID (multisig.TxnID) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1333,7 +1333,7 @@ func (t *TxnIDParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.ProposalHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1382,7 +1382,7 @@ func (t *ApproveReturn) MarshalCBOR(w io.Writer) error { } // t.Ret ([]uint8) (slice) - if uint64(len(t.Ret)) > cbg.ByteArrayMaxLen { + if len(t.Ret) > 2097152 { return xerrors.Errorf("Byte array in field t.Ret was too long") } @@ -1440,10 +1440,10 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1469,7 +1469,7 @@ func (t *ApproveReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Ret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1689,10 +1689,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.StartEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1714,10 +1714,10 @@ func (t *LockBalanceParams) UnmarshalCBOR(r io.Reader) (err error) { // t.UnlockDuration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v9/paych/cbor_gen.go b/builtin/v9/paych/cbor_gen.go index b4e06f44..1bff11b5 100644 --- a/builtin/v9/paych/cbor_gen.go +++ b/builtin/v9/paych/cbor_gen.go @@ -133,10 +133,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.SettlingAt (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -158,10 +158,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -362,7 +362,7 @@ func (t *UpdateChannelStateParams) MarshalCBOR(w io.Writer) error { } // t.Secret ([]uint8) (slice) - if uint64(len(t.Secret)) > cbg.ByteArrayMaxLen { + if len(t.Secret) > 2097152 { return xerrors.Errorf("Byte array in field t.Secret was too long") } @@ -416,7 +416,7 @@ func (t *UpdateChannelStateParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Secret: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -476,7 +476,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.SecretHash ([]uint8) (slice) - if uint64(len(t.SecretHash)) > cbg.ByteArrayMaxLen { + if len(t.SecretHash) > 2097152 { return xerrors.Errorf("Byte array in field t.SecretHash was too long") } @@ -522,7 +522,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } // t.Merges ([]paych.Merge) (slice) - if uint64(len(t.Merges)) > cbg.MaxLength { + if len(t.Merges) > 8192 { return xerrors.Errorf("Slice value in field t.Merges was too long") } @@ -578,10 +578,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -603,10 +603,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.TimeLockMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -632,7 +632,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.SecretHash: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -706,10 +706,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { // t.MinSettleHeight (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -735,7 +735,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -814,7 +814,7 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { } // t.Data ([]uint8) (slice) - if uint64(len(t.Data)) > cbg.ByteArrayMaxLen { + if len(t.Data) > 2097152 { return xerrors.Errorf("Byte array in field t.Data was too long") } @@ -882,7 +882,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Data: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v9/power/cbor_gen.go b/builtin/v9/power/cbor_gen.go index d28e889e..c09ca4f4 100644 --- a/builtin/v9/power/cbor_gen.go +++ b/builtin/v9/power/cbor_gen.go @@ -246,10 +246,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -271,10 +271,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.MinerAboveMinPowerCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -308,10 +308,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.FirstCronEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -430,10 +430,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -568,7 +568,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.ControlAddrs ([]address.Address) (slice) - if uint64(len(t.ControlAddrs)) > cbg.MaxLength { + if len(t.ControlAddrs) > 8192 { return xerrors.Errorf("Slice value in field t.ControlAddrs was too long") } @@ -594,7 +594,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.PeerId ([]uint8) (slice) - if uint64(len(t.PeerId)) > cbg.ByteArrayMaxLen { + if len(t.PeerId) > 2097152 { return xerrors.Errorf("Byte array in field t.PeerId was too long") } @@ -607,7 +607,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -615,7 +615,7 @@ func (t *MinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -679,7 +679,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ControlAddrs: array too large (%d)", extra) } @@ -713,10 +713,10 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -742,7 +742,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.PeerId: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -764,7 +764,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -790,7 +790,7 @@ func (t *MinerConstructorParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -846,7 +846,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Peer ([]uint8) (slice) - if uint64(len(t.Peer)) > cbg.ByteArrayMaxLen { + if len(t.Peer) > 2097152 { return xerrors.Errorf("Byte array in field t.Peer was too long") } @@ -859,7 +859,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { } // t.Multiaddrs ([][]uint8) (slice) - if uint64(len(t.Multiaddrs)) > cbg.MaxLength { + if len(t.Multiaddrs) > 8192 { return xerrors.Errorf("Slice value in field t.Multiaddrs was too long") } @@ -867,7 +867,7 @@ func (t *CreateMinerParams) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Multiaddrs { - if uint64(len(v)) > cbg.ByteArrayMaxLen { + if len(v) > 2097152 { return xerrors.Errorf("Byte array in field v was too long") } @@ -927,10 +927,10 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WindowPoStProofType (abi.RegisteredPoStProof) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -956,7 +956,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Peer: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -978,7 +978,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Multiaddrs: array too large (%d)", extra) } @@ -1004,7 +1004,7 @@ func (t *CreateMinerParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Multiaddrs[i]: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1218,7 +1218,7 @@ func (t *EnrollCronEventParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1259,10 +1259,10 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { // t.EventEpoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1288,7 +1288,7 @@ func (t *EnrollCronEventParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1326,7 +1326,7 @@ func (t *CronEvent) MarshalCBOR(w io.Writer) error { } // t.CallbackPayload ([]uint8) (slice) - if uint64(len(t.CallbackPayload)) > cbg.ByteArrayMaxLen { + if len(t.CallbackPayload) > 2097152 { return xerrors.Errorf("Byte array in field t.CallbackPayload was too long") } @@ -1380,7 +1380,7 @@ func (t *CronEvent) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.CallbackPayload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { diff --git a/builtin/v9/reward/cbor_gen.go b/builtin/v9/reward/cbor_gen.go index ec29a320..568037e7 100644 --- a/builtin/v9/reward/cbor_gen.go +++ b/builtin/v9/reward/cbor_gen.go @@ -146,10 +146,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.EffectiveNetworkTime (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -207,10 +207,10 @@ func (t *State) UnmarshalCBOR(r io.Reader) (err error) { // t.Epoch (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -425,10 +425,10 @@ func (t *AwardBlockRewardParams) UnmarshalCBOR(r io.Reader) (err error) { // t.WinCount (int64) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) diff --git a/builtin/v9/verifreg/cbor_gen.go b/builtin/v9/verifreg/cbor_gen.go index e16c254b..777358be 100644 --- a/builtin/v9/verifreg/cbor_gen.go +++ b/builtin/v9/verifreg/cbor_gen.go @@ -638,7 +638,7 @@ func (t *RemoveExpiredAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.AllocationIds ([]verifreg.AllocationId) (slice) - if uint64(len(t.AllocationIds)) > cbg.MaxLength { + if len(t.AllocationIds) > 8192 { return xerrors.Errorf("Slice value in field t.AllocationIds was too long") } @@ -699,7 +699,7 @@ func (t *RemoveExpiredAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.AllocationIds: array too large (%d)", extra) } @@ -753,7 +753,7 @@ func (t *RemoveExpiredAllocationsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -810,7 +810,7 @@ func (t *RemoveExpiredAllocationsReturn) UnmarshalCBOR(r io.Reader) (err error) return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -888,7 +888,7 @@ func (t *BatchReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -948,7 +948,7 @@ func (t *BatchReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -997,7 +997,7 @@ func (t *ClaimAllocationsParams) MarshalCBOR(w io.Writer) error { } // t.Sectors ([]verifreg.SectorAllocationClaim) (slice) - if uint64(len(t.Sectors)) > cbg.MaxLength { + if len(t.Sectors) > 8192 { return xerrors.Errorf("Slice value in field t.Sectors was too long") } @@ -1048,7 +1048,7 @@ func (t *ClaimAllocationsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Sectors: array too large (%d)", extra) } @@ -1190,7 +1190,7 @@ func (t *GetClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1251,7 +1251,7 @@ func (t *GetClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1310,7 +1310,7 @@ func (t *GetClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Claims ([]verifreg.Claim) (slice) - if uint64(len(t.Claims)) > cbg.MaxLength { + if len(t.Claims) > 8192 { return xerrors.Errorf("Slice value in field t.Claims was too long") } @@ -1365,7 +1365,7 @@ func (t *GetClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Claims: array too large (%d)", extra) } @@ -1420,7 +1420,7 @@ func (t *UniversalReceiverParams) MarshalCBOR(w io.Writer) error { } // t.Payload ([]uint8) (slice) - if uint64(len(t.Payload)) > cbg.ByteArrayMaxLen { + if len(t.Payload) > 2097152 { return xerrors.Errorf("Byte array in field t.Payload was too long") } @@ -1479,7 +1479,7 @@ func (t *UniversalReceiverParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.Payload: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -1522,7 +1522,7 @@ func (t *AllocationsResponse) MarshalCBOR(w io.Writer) error { } // t.NewAllocations ([]verifreg.AllocationId) (slice) - if uint64(len(t.NewAllocations)) > cbg.MaxLength { + if len(t.NewAllocations) > 8192 { return xerrors.Errorf("Slice value in field t.NewAllocations was too long") } @@ -1587,7 +1587,7 @@ func (t *AllocationsResponse) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.NewAllocations: array too large (%d)", extra) } @@ -1641,7 +1641,7 @@ func (t *ExtendClaimTermsParams) MarshalCBOR(w io.Writer) error { } // t.Terms ([]verifreg.ClaimTerm) (slice) - if uint64(len(t.Terms)) > cbg.MaxLength { + if len(t.Terms) > 8192 { return xerrors.Errorf("Slice value in field t.Terms was too long") } @@ -1687,7 +1687,7 @@ func (t *ExtendClaimTermsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Terms: array too large (%d)", extra) } @@ -1742,7 +1742,7 @@ func (t *ExtendClaimTermsReturn) MarshalCBOR(w io.Writer) error { } // t.FailCodes ([]verifreg.FailCode) (slice) - if uint64(len(t.FailCodes)) > cbg.MaxLength { + if len(t.FailCodes) > 8192 { return xerrors.Errorf("Slice value in field t.FailCodes was too long") } @@ -1802,7 +1802,7 @@ func (t *ExtendClaimTermsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.FailCodes: array too large (%d)", extra) } @@ -1857,7 +1857,7 @@ func (t *RemoveExpiredClaimsParams) MarshalCBOR(w io.Writer) error { } // t.ClaimIds ([]verifreg.ClaimId) (slice) - if uint64(len(t.ClaimIds)) > cbg.MaxLength { + if len(t.ClaimIds) > 8192 { return xerrors.Errorf("Slice value in field t.ClaimIds was too long") } @@ -1918,7 +1918,7 @@ func (t *RemoveExpiredClaimsParams) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.ClaimIds: array too large (%d)", extra) } @@ -1972,7 +1972,7 @@ func (t *RemoveExpiredClaimsReturn) MarshalCBOR(w io.Writer) error { } // t.Considered ([]verifreg.AllocationId) (slice) - if uint64(len(t.Considered)) > cbg.MaxLength { + if len(t.Considered) > 8192 { return xerrors.Errorf("Slice value in field t.Considered was too long") } @@ -2024,7 +2024,7 @@ func (t *RemoveExpiredClaimsReturn) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Considered: array too large (%d)", extra) } @@ -2363,10 +2363,10 @@ func (t *FailCode) UnmarshalCBOR(r io.Reader) (err error) { // t.Code (exitcode.ExitCode) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2540,10 +2540,10 @@ func (t *SectorAllocationClaim) UnmarshalCBOR(r io.Reader) (err error) { // t.SectorExpiry (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2725,10 +2725,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2750,10 +2750,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2775,10 +2775,10 @@ func (t *Claim) UnmarshalCBOR(r io.Reader) (err error) { // t.TermStart (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -2908,10 +2908,10 @@ func (t *ClaimTerm) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3021,10 +3021,10 @@ func (t *ClaimExtensionRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3200,10 +3200,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3225,10 +3225,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3250,10 +3250,10 @@ func (t *Allocation) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3409,10 +3409,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMin (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3434,10 +3434,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.TermMax (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3459,10 +3459,10 @@ func (t *AllocationRequest) UnmarshalCBOR(r io.Reader) (err error) { // t.Expiration (abi.ChainEpoch) (int64) { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -3499,7 +3499,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Allocations ([]verifreg.AllocationRequest) (slice) - if uint64(len(t.Allocations)) > cbg.MaxLength { + if len(t.Allocations) > 8192 { return xerrors.Errorf("Slice value in field t.Allocations was too long") } @@ -3514,7 +3514,7 @@ func (t *AllocationRequests) MarshalCBOR(w io.Writer) error { } // t.Extensions ([]verifreg.ClaimExtensionRequest) (slice) - if uint64(len(t.Extensions)) > cbg.MaxLength { + if len(t.Extensions) > 8192 { return xerrors.Errorf("Slice value in field t.Extensions was too long") } @@ -3560,7 +3560,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Allocations: array too large (%d)", extra) } @@ -3598,7 +3598,7 @@ func (t *AllocationRequests) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Extensions: array too large (%d)", extra) } diff --git a/go.mod b/go.mod index 1966584f..0535b826 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,12 @@ go 1.18 retract v0.12.7 // wrongfully skipped a patch version, use v0.12.6 or v0.12.8&^ -replace github.com/whyrusleeping/cbor-gen => ../../whyrusleeping/cbor-gen - require ( github.com/filecoin-project/go-address v1.1.0 - github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef + github.com/filecoin-project/go-amt-ipld/v4 v4.2.0 github.com/filecoin-project/go-bitfield v0.2.4 github.com/filecoin-project/go-commp-utils/nonffi v0.0.0-20220905160352-62059082a837 - github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045 + github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-cid v0.3.2 github.com/ipfs/go-ipld-cbor v0.0.6 @@ -22,8 +20,8 @@ require ( github.com/multiformats/go-multihash v0.2.1 github.com/multiformats/go-varint v0.0.6 github.com/stretchr/testify v1.7.0 - github.com/whyrusleeping/cbor-gen v0.0.0-20240202185644-fcdaca49d05c - golang.org/x/crypto v0.17.0 + github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41 + golang.org/x/crypto v0.1.0 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 ) @@ -41,7 +39,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - golang.org/x/sys v0.15.0 // indirect - gopkg.in/yaml.v3 v3.0.0 // indirect + golang.org/x/sys v0.1.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect lukechampine.com/blake3 v1.1.6 // indirect ) diff --git a/go.sum b/go.sum index c991e443..200e61f1 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+ github.com/filecoin-project/go-address v1.1.0 h1:ofdtUtEsNxkIxkDw67ecSmvtzaVSdcea4boAmLbnHfE= github.com/filecoin-project/go-address v1.1.0/go.mod h1:5t3z6qPmIADZBtuE9EIzi0EwzcRy2nVhpo0I/c1r0OA= github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs= -github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef h1:d2a6kO4Nq8wnFzWC/+x967xZa3y0KrWB5cnnWTH693I= -github.com/filecoin-project/go-amt-ipld/v4 v4.2.1-0.20240206063011-8207d7a1e4ef/go.mod h1:yho4SqDGret1aOl53OnsBL0h7zgodUuzrwsADe0v9ho= +github.com/filecoin-project/go-amt-ipld/v4 v4.2.0 h1:DQTXQwMXxaetd+lhZGODjt5qC1WYT7tMAlYrWqI/fwI= +github.com/filecoin-project/go-amt-ipld/v4 v4.2.0/go.mod h1:0eDVF7pROvxrsxvLJx+SJZXqRaXXcEPUcgb/rG0zGU4= github.com/filecoin-project/go-bitfield v0.2.0/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW8p9au0C68JPgk= github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM= @@ -23,8 +23,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8= github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= -github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045 h1:w2Ydu6hiPnxR9lDIbHKU5i31Ho+1pGtN5xTk2i7/sII= -github.com/filecoin-project/go-hamt-ipld/v3 v3.3.1-0.20240206064418-6c31c2ab8045/go.mod h1:LOii7J9ZDSEeMK9jTfYFbStSqD0FlyA0qKoep7w36jw= +github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI= +github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g= github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak= github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= github.com/filecoin-project/go-state-types v0.0.0-20200904021452-1883f36ca2f4/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I= @@ -48,6 +48,7 @@ github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUP github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= +github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= @@ -147,6 +148,15 @@ github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKw github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= +github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= +github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI= +github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W5MvapuoHRP8rz4vxjwCK1pDqF1aQcWsV5PZ+AHbqdg= +github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= +github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41 h1:w7OO90SNCSrjl2mgFna9Cpx+o0wcwnRMhalfaQU/dAE= +github.com/whyrusleeping/cbor-gen v0.0.0-20240207022414-c5f90eb30d41/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829 h1:wb7xrDzfkLgPHsSEBm+VSx6aDdi64VtV0xvP0E6j8bk= github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829/go.mod h1:h/1PEBwj7Ym/8kOuMWvO2ujZ6Lt+TMbySEXNhjjR87I= github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JLlWugkzsrlB50jR9v2khiD9FxuSo= @@ -166,8 +176,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= @@ -186,8 +196,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -213,8 +223,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= From 90fc5ee8a28fcd6fa788fb3f5912271374757f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Feb 2024 19:57:47 +0100 Subject: [PATCH 47/52] v13: Simplify invariants --- builtin/v13/check.go | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index 348ecc72..65c600c1 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -294,8 +294,8 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider, deal, sectorDeal) } - // /// HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs - foundSectorDeals := make(map[abi.DealID]abi.SectorID) + // HAMT[ActorID]HAMT[SectorNumber]SectorDealIDs + marketDealToSector := make(map[abi.DealID]abi.SectorID) for sectorID, dealIDs := range marketSummary.ProviderSectors { maddr, err := address.NewIDAddress(uint64(sectorID.Miner)) @@ -317,38 +317,32 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari _, found := minerSummary.Deals[dealID] acc.Require(found, "deal %d not found in miner %v for sector %v", dealID, maddr, sectorID) - _, found = foundSectorDeals[dealID] + _, found = marketDealToSector[dealID] acc.Require(!found, "deal %d found in multiple sectors", dealID) - foundSectorDeals[dealID] = sectorID + marketDealToSector[dealID] = sectorID } } - inverseSectorDeals := make(map[abi.DealID]abi.SectorID) - for a, summary := range minerSummaries { - mid, err := address.IDFromAddress(a) - if err != nil { - acc.Addf("error creating ID address: %v", err) - continue - } - for dealID, dealSummary := range summary.Deals { - _, found := inverseSectorDeals[dealID] - acc.Require(!found, "deal %d found in multiple sectors", dealID) + for sectorID, ids := range marketSummary.ProviderSectors { + acc.Require(len(ids) > 0, "no deal ids in sector %v", sectorID) - inverseSectorDeals[dealID] = abi.SectorID{Miner: abi.ActorID(mid), Number: dealSummary.SectorNumber} - } - } + for _, dealID := range ids { + deal, found := marketSummary.Deals[dealID] + acc.Require(found, "providersectors %v sector deal %d not found in market", sectorID, dealID) + if !found { + continue + } - for dealID, sectorID := range inverseSectorDeals { - ds := marketSummary.Deals[dealID] - _, found := marketSummary.ProviderSectors[sectorID] - if ds == nil { - acc.Require(!found, "expired deal %d found in sector %v", dealID, sectorID) // TODO we see this, is this fine? + provID, err := address.IDFromAddress(deal.Provider) + if err != nil { + acc.Addf("error creating ID address: %v", err) + continue + } - continue // expired deal + acc.Require(abi.ActorID(provID) == sectorID.Miner, "deal %d has provider %v, expected %v", dealID, deal.Provider, sectorID) + acc.Require(deal.SectorNumber == sectorID.Number, "deal %d has sector number %d, expected %d", dealID, deal.SectorNumber, sectorID.Number) } - - acc.Require(found, "deal %d found in sector %v not found in market (ds: %v)", dealID, sectorID, ds) // TODO we see this, is this fine? } } From e44a28448649c497f0b1795aa0a16548fb91044e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Feb 2024 18:28:47 +0100 Subject: [PATCH 48/52] v13: Add missing provider entries invarient --- builtin/v13/market/invariants.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builtin/v13/market/invariants.go b/builtin/v13/market/invariants.go index e9877957..f5c13bb6 100644 --- a/builtin/v13/market/invariants.go +++ b/builtin/v13/market/invariants.go @@ -121,6 +121,7 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c dealStateCount := uint64(0) claimIdToDealId := make(map[verifreg.ClaimId]abi.DealID) + expectedProviderSectors := make(map[abi.DealID]struct{}) if dealStates, err := adt.AsArray(store, st.States, StatesAmtBitwidth); err != nil { acc.Addf("error loading deal states: %v", err) } else { @@ -158,6 +159,10 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c _, found = pendingDealAllocationIds[abi.DealID(dealID)] acc.Require(!found, "deal %d has pending allocation", dealID) + if dealState.SlashEpoch == EpochUndefined && dealState.SectorStartEpoch != EpochUndefined { + expectedProviderSectors[abi.DealID(dealID)] = struct{}{} + } + dealStateCount++ return nil @@ -288,6 +293,8 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c st, found := proposalStats[dealID] acc.Require(found, "deal id %d in provider sectors not found in proposals", dealID) acc.Require(st.SectorNumber == abi.SectorNumber(sectorNumber), "deal id %d sector number %d does not match sector id %d", dealID, st.SectorNumber, sectorNumber) + + delete(expectedProviderSectors, dealID) } return nil @@ -298,6 +305,8 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c acc.RequireNoError(err, "error iterating sector deals") } + acc.Require(len(expectedProviderSectors) == 0, "missing %d providersectors entries for deals", len(expectedProviderSectors)) + return &StateSummary{ Deals: proposalStats, PendingDealAllocationIds: pendingDealAllocationIds, From 90e0f571d4d9eb3a335b3a820826d63d2ce5e99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Feb 2024 18:35:44 +0100 Subject: [PATCH 49/52] v13: Move some global checks into market checks --- builtin/v13/check.go | 21 --------------------- builtin/v13/market/invariants.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index 65c600c1..7f68b18a 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -323,27 +323,6 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari marketDealToSector[dealID] = sectorID } } - - for sectorID, ids := range marketSummary.ProviderSectors { - acc.Require(len(ids) > 0, "no deal ids in sector %v", sectorID) - - for _, dealID := range ids { - deal, found := marketSummary.Deals[dealID] - acc.Require(found, "providersectors %v sector deal %d not found in market", sectorID, dealID) - if !found { - continue - } - - provID, err := address.IDFromAddress(deal.Provider) - if err != nil { - acc.Addf("error creating ID address: %v", err) - continue - } - - acc.Require(abi.ActorID(provID) == sectorID.Miner, "deal %d has provider %v, expected %v", dealID, deal.Provider, sectorID) - acc.Require(deal.SectorNumber == sectorID.Number, "deal %d has sector number %d, expected %d", dealID, deal.SectorNumber, sectorID.Number) - } - } } func CheckVerifregAgainstDatacap(acc *builtin.MessageAccumulator, verifregSummary *verifreg.StateSummary, datacapSummary *datacap.StateSummary) { diff --git a/builtin/v13/market/invariants.go b/builtin/v13/market/invariants.go index f5c13bb6..902a8c4c 100644 --- a/builtin/v13/market/invariants.go +++ b/builtin/v13/market/invariants.go @@ -283,6 +283,8 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c sectorNumber, err := abi.ParseUIntKey(sectorID) acc.RequireNoError(err, "error sector number from bytes") + acc.Require(len(dealIDs) > 0, "no deal ids in sector %v", sectorID) + dealIDsCopy := make([]abi.DealID, len(dealIDs)) copy(dealIDsCopy, dealIDs) @@ -295,6 +297,14 @@ func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount, c acc.Require(st.SectorNumber == abi.SectorNumber(sectorNumber), "deal id %d sector number %d does not match sector id %d", dealID, st.SectorNumber, sectorNumber) delete(expectedProviderSectors, dealID) + + provID, err := address.IDFromAddress(st.Provider) + if err != nil { + acc.Addf("error creating ID address: %v", err) + continue + } + + acc.Require(provider == provID, "deal %d has provider %v, expected %v", dealID, provID, provider) } return nil From 884c4fc4b7cc0308a6dd46187cd7e5184d872e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Feb 2024 18:45:52 +0100 Subject: [PATCH 50/52] v13: Cleanup miner migration --- builtin/v13/migration/miner.go | 46 ++-------------------------------- builtin/v13/migration/top.go | 8 ++++-- 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/builtin/v13/migration/miner.go b/builtin/v13/migration/miner.go index 6bdeaf65..35f19a9c 100644 --- a/builtin/v13/migration/miner.go +++ b/builtin/v13/migration/miner.go @@ -3,8 +3,6 @@ package migration import ( "bytes" "context" - "encoding/json" - "fmt" "sync" "github.com/filecoin-project/go-address" @@ -25,9 +23,6 @@ type providerSectors struct { lk sync.Mutex dealToSector map[abi.DealID]abi.SectorID - - // diff mode removes - removedDealToSector map[abi.DealID]abi.SectorID } // minerMigration is technically a no-op, but it collects a cache for market migration @@ -98,11 +93,6 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, return nil, xerrors.Errorf("failed to diff old and new Sector AMTs: %w", err) } - prevInSectors, err := adt.AsArray(ctxStore, prevSectors, miner12.SectorsAmtBitwidth) - if err != nil { - return nil, xerrors.Errorf("failed to load prev sectors array: %w", err) - } - for i, change := range diffs { sectorNo := abi.SectorNumber(change.Key) @@ -149,17 +139,6 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, if len(sectorBefore.DealIDs) != len(sectorAfter.DealIDs) { if len(sectorBefore.DealIDs) != 0 { - pjsonb, err := json.MarshalIndent(sectorBefore, "", " ") - if err != nil { - return nil, err - } - pjson, err := json.MarshalIndent(sectorAfter, "", " ") - if err != nil { - return nil, err - } - - fmt.Println("sector before: ", string(pjsonb)) - fmt.Println("sector after: ", string(pjson)) return nil, xerrors.Errorf("WHAT?! sector %d modified, this not supported and not supposed to happen", i) // todo: is it? Can't happen w/o a deep, deep reorg, and even then we wouldn't use the cache?? } // snap @@ -178,31 +157,10 @@ func (m *minerMigrator) MigrateState(ctx context.Context, store cbor.IpldStore, // extensions, etc. here; we don't care about those case amt.Remove: - // related deals will also get removed in the market, so we don't have anything to do here - - found, err := prevInSectors.Get(change.Key, §or) - if err != nil { - return nil, xerrors.Errorf("failed to get sector %d in prevInSectors: %w", sectorNo, err) - } - if !found { - return nil, xerrors.Errorf("didn't find sector %d in prevInSectors", sectorNo) - } - - if len(sector.DealIDs) == 0 { - // if no deals don't even bother taking the lock - continue - } + // nothing to do here, market removes deals based on activation/slash status, and can tell what + // mappings to remove because non-slashed deals already had them //fmt.Printf("prov dealsector REM %d: %v\n", sectorNo, sector.DealIDs) - - m.providerSectors.lk.Lock() - for _, dealID := range sector.DealIDs { - m.providerSectors.removedDealToSector[dealID] = abi.SectorID{ - Miner: abi.ActorID(mid), - Number: sectorNo, - } - } - m.providerSectors.lk.Unlock() } } } diff --git a/builtin/v13/migration/top.go b/builtin/v13/migration/top.go index 75652807..140ea9c9 100644 --- a/builtin/v13/migration/top.go +++ b/builtin/v13/migration/top.go @@ -83,6 +83,10 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID migrations[oldEntry.Code] = migration.CachedMigration(cache, migration.CodeMigrator{OutCodeCID: newCodeCID}) } + if market12Cid == cid.Undef || miner12Cid == cid.Undef { + return cid.Undef, xerrors.Errorf("could not find market or miner actor in old manifest") + } + // migrations that migrate both code and state, override entries in `migrations` // The System Actor @@ -118,7 +122,7 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID // The Market Actor market13Cid, ok := newManifest.Get(manifest.MarketKey) if !ok { - return cid.Undef, xerrors.Errorf("code cid for miner actor not found in new manifest") + return cid.Undef, xerrors.Errorf("code cid for market actor not found in new manifest") } marketMig, err := newMarketMigrator(ctx, store, market13Cid, ps) @@ -128,7 +132,7 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID migrations[market12Cid] = migration.CachedMigration(cache, marketMig) if len(migrations)+len(deferredCodeIDs) != len(oldManifestData.Entries) { - return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations), len(oldManifestData.Entries)) + return cid.Undef, xerrors.Errorf("incomplete migration specification with %d code CIDs, need %d", len(migrations)+len(deferredCodeIDs), len(oldManifestData.Entries)) } actorsOut, err := migration.RunMigration(ctx, cfg, cache, store, log, actorsIn, migrations) From f339bd4cd03ff68103c8c448821a0c30b96bde48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Feb 2024 18:49:11 +0100 Subject: [PATCH 51/52] v13: Cleanup market migration --- builtin/v13/migration/market.go | 48 +++------------------------------ 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index c4d41f90..ec908232 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -158,13 +158,12 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con providerSectorsMem := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // added providerSectorsMemRemoved := map[abi.ActorID]map[abi.SectorNumber][]abi.DealID{} // removed - addProviderSectorEntry := func(deal abi.DealID, newState *market13.DealState) (abi.SectorNumber, error) { + addProviderSectorEntry := func(deal abi.DealID) (abi.SectorNumber, error) { sid, ok := m.providerSectors.dealToSector[deal] if !ok { return 0, xerrors.Errorf("deal %d not found in providerSectors", deal) // todo is this normal and possible?? } - newState.SectorNumber = sid.Number if _, ok := providerSectorsMem[sid.Miner]; !ok { providerSectorsMem[sid.Miner] = make(map[abi.SectorNumber][]abi.DealID) } @@ -221,7 +220,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con newState.SectorNumber = 0 // terminated / not found (?) if oldState.SlashEpoch == -1 { - si, err := addProviderSectorEntry(deal, &newState) + si, err := addProviderSectorEntry(deal) if err != nil { return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) } @@ -285,7 +284,7 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con //fmt.Printf("deal %d slash %d -> %d, update %d -> %d (prev sec: %d)\n", deal, prevOldState.SlashEpoch, oldState.SlashEpoch, prevOldState.LastUpdatedEpoch, oldState.LastUpdatedEpoch, newState.SectorNumber) - if oldState.SlashEpoch != -1 && prevOldState.SlashEpoch == -1 { + if prevOldState.SlashEpoch == -1 && oldState.SlashEpoch != -1 { // not slashed -> slashed //fmt.Printf("deal %d slash -1 -> %d\n", deal, oldState.SlashEpoch) @@ -294,47 +293,6 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesWithDiff(ctx context.Con } } - /*if oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1 { - fmt.Printf("deal %d start -1 both\n", deal) - // neither was in a sector, unclear if this can happen, but we handle this case anyway - } - - if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch == -1) && oldState.SlashEpoch == -1 { - fmt.Printf("deal %d start -1 -> %d\n", deal, oldState.SectorStartEpoch) - // wasn't in a sector, now is - if _, err := addProviderSectorEntry(deal, &newState); err != nil { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) - } - } - - if (oldState.SectorStartEpoch == -1 && prevOldState.SectorStartEpoch != -1) && prevOldState.SlashEpoch != -1 { - fmt.Printf("deal %d start %d -> -1\n", deal, prevOldState.SectorStartEpoch) - // was in a sector, now isn't - if err := removeProviderSectorEntry(deal, &newState); err != nil { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) - } - } - - if (oldState.SectorStartEpoch != -1 && prevOldState.SectorStartEpoch != -1) && oldState.SlashEpoch == -1 { - fmt.Printf("deal %d start %d -> %d\n", deal, prevOldState.SectorStartEpoch, oldState.SectorStartEpoch) - // both in a sector, check if the same - _, rm := m.providerSectors.removedDealToSector[deal] - if rm { - fmt.Printf(" !! change\n") - // changed which sector it's in - - if err := removeProviderSectorEntry(deal, &newState); err != nil { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to remove provider sector entry: %w", err) - } - - if _, err := addProviderSectorEntry(deal, &newState); err != nil { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("failed to add provider sector entry: %w", err) - } - } else if _, added := m.providerSectors.dealToSector[deal]; added { - return cid.Cid{}, cid.Cid{}, xerrors.Errorf("deal %d with modified state was added to providerSectors, but was not in removedDealToSector", deal) - } - }*/ - if err := prevOutStates.Set(uint64(deal), &newState); err != nil { return cid.Undef, cid.Undef, xerrors.Errorf("failed to set new state: %w", err) } From 11fc27ca4593f7f495ad310da22630eeb9cd21ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 12 Feb 2024 11:59:25 +0100 Subject: [PATCH 52/52] v13: fix deal sector match predicate --- builtin/v13/check.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/v13/check.go b/builtin/v13/check.go index 7f68b18a..7c9bac7c 100644 --- a/builtin/v13/check.go +++ b/builtin/v13/check.go @@ -289,7 +289,7 @@ func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummari "deal state slashed at %d after sector expiration %d for miner %v", deal.SlashEpoch, sectorDeal.SectorExpiration, deal.Provider) - acc.Require((deal.SectorNumber == sectorDeal.SectorNumber) || (deal.SectorNumber == 0 && deal.LastUpdatedEpoch != -1), + acc.Require((deal.SectorNumber == sectorDeal.SectorNumber) || (deal.SectorNumber == 0 && deal.SlashEpoch != -1), "deal sector number %d does not match sector %d for miner %v (ds: %#v; ss %#v)", deal.SectorNumber, sectorDeal.SectorNumber, deal.Provider, deal, sectorDeal) }