From e3d1f5b362a82e5a108ef2d1f684852c047e9a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 9 Dec 2019 16:11:54 +0100 Subject: [PATCH 1/3] storage: Better errors when starting sectorStateLoop --- storage/miner.go | 2 +- storage/sectors.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/miner.go b/storage/miner.go index 7026ce1f8..5d07908de 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -105,7 +105,7 @@ func (m *Miner) Run(ctx context.Context) error { go fps.run(ctx) if err := m.sectorStateLoop(ctx); err != nil { - log.Error(err) + log.Errorf("%+v", err) return xerrors.Errorf("failed to startup sector state loop: %w", err) } diff --git a/storage/sectors.go b/storage/sectors.go index 251c10331..92026adfa 100644 --- a/storage/sectors.go +++ b/storage/sectors.go @@ -65,7 +65,7 @@ func (m *Miner) UpdateSectorState(ctx context.Context, sector uint64, snonce uin func (m *Miner) sectorStateLoop(ctx context.Context) error { trackedSectors, err := m.ListSectors() if err != nil { - return err + return xerrors.Errorf("loading sector list: %w", err) } go func() { @@ -100,7 +100,7 @@ func (m *Miner) sectorStateLoop(ctx context.Context) error { ps, err := m.api.StateMinerProvingSet(ctx, m.maddr, curTs) if err != nil { - return err + return xerrors.Errorf("getting miner proving set: %w", err) } for _, ocs := range ps { if _, ok := trackedByID[ocs.SectorID]; ok { From 1d7dd4711dd1e80a03b21195bff9cce0f53053bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 9 Dec 2019 16:42:47 +0100 Subject: [PATCH 2/3] Cleanup sectorinfo struct --- storage/sector_types.go | 2 -- storage/sectors.go | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/storage/sector_types.go b/storage/sector_types.go index dccc885dc..aed3898db 100644 --- a/storage/sector_types.go +++ b/storage/sector_types.go @@ -56,10 +56,8 @@ type SectorInfo struct { Pieces []Piece // PreCommit - Pad0 []byte // TODO: legacy placeholder, remove CommD []byte CommR []byte - Pad1 []byte // TODO: legacy placeholder, remove Proof []byte Ticket SealTicket diff --git a/storage/sectors.go b/storage/sectors.go index 92026adfa..d9144a5cd 100644 --- a/storage/sectors.go +++ b/storage/sectors.go @@ -247,13 +247,13 @@ func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) { // Handled failure modes case api.SealFailed: - log.Warn("sector %d entered unimplemented state 'SealFailed'", update.id) + log.Warnf("sector %d entered unimplemented state 'SealFailed'", update.id) case api.PreCommitFailed: - log.Warn("sector %d entered unimplemented state 'PreCommitFailed'", update.id) + log.Warnf("sector %d entered unimplemented state 'PreCommitFailed'", update.id) case api.SealCommitFailed: - log.Warn("sector %d entered unimplemented state 'SealCommitFailed'", update.id) + log.Warnf("sector %d entered unimplemented state 'SealCommitFailed'", update.id) case api.CommitFailed: - log.Warn("sector %d entered unimplemented state 'CommitFailed'", update.id) + log.Warnf("sector %d entered unimplemented state 'CommitFailed'", update.id) // Fatal errors case api.UndefinedSectorState: From 94df2c656e9860c32af60d9dce6b82de3f021d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 9 Dec 2019 17:40:15 +0100 Subject: [PATCH 3/3] Use map encoders for some structs --- api/api_storage.go | 4 +- api/cbor_gen.go | 197 +++++++++-- chain/actors/cbor_gen.go | 637 ++++++++++++++++++------------------ chain/blocksync/cbor_gen.go | 71 ++-- chain/deals/cbor_gen.go | 140 ++++---- chain/types/cbor_gen.go | 333 ++++++++++--------- gen/main.go | 4 +- go.mod | 2 +- go.sum | 2 + node/impl/storminer.go | 2 +- paych/cbor_gen.go | 41 +-- retrieval/cbor_gen.go | 68 ++-- storage/cbor_gen.go | 553 +++++++++++++++++++++++++------ 13 files changed, 1285 insertions(+), 769 deletions(-) diff --git a/api/api_storage.go b/api/api_storage.go index 816ad74bf..f34bb3367 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -87,9 +87,9 @@ type SectorInfo struct { Deals []uint64 Ticket sectorbuilder.SealTicket Seed sectorbuilder.SealSeed - Retries uint64 + Retries uint64 - LastErr string + LastErr string } type SealedRef struct { diff --git a/api/cbor_gen.go b/api/cbor_gen.go index 0cd224876..7e1192037 100644 --- a/api/cbor_gen.go +++ b/api/cbor_gen.go @@ -18,16 +18,29 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{131}); err != nil { + if _, err := w.Write([]byte{163}); err != nil { + return err + } + + // t.Channel (address.Address) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Channel")))); err != nil { + return err + } + if _, err := w.Write([]byte("Channel")); err != nil { return err } - // t.t.Channel (address.Address) (struct) if err := t.Channel.MarshalCBOR(w); err != nil { return err } - // t.t.ChannelMessage (cid.Cid) (struct) + // t.ChannelMessage (cid.Cid) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("ChannelMessage")))); err != nil { + return err + } + if _, err := w.Write([]byte("ChannelMessage")); err != nil { + return err + } if t.ChannelMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -39,7 +52,14 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.Vouchers ([]*types.SignedVoucher) (slice) + // t.Vouchers ([]*types.SignedVoucher) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Vouchers")))); err != nil { + return err + } + if _, err := w.Write([]byte("Vouchers")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil { return err } @@ -58,15 +78,30 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 3 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Channel (address.Address) (struct) + var name string + + // t.Channel (address.Address) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Channel" { + return fmt.Errorf("expected struct map entry %s to be Channel", name) + } { @@ -75,7 +110,20 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ChannelMessage (cid.Cid) (struct) + // t.ChannelMessage (cid.Cid) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "ChannelMessage" { + return fmt.Errorf("expected struct map entry %s to be ChannelMessage", name) + } { @@ -99,13 +147,27 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Vouchers ([]*types.SignedVoucher) (slice) + // t.Vouchers ([]*types.SignedVoucher) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Vouchers" { + return fmt.Errorf("expected struct map entry %s to be Vouchers", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -133,21 +195,42 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{131}); err != nil { + if _, err := w.Write([]byte{163}); err != nil { + return err + } + + // t.SectorID (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorID")))); err != nil { + return err + } + if _, err := w.Write([]byte("SectorID")); err != nil { return err } - // t.t.SectorID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { return err } - // t.t.Offset (uint64) (uint64) + // t.Offset (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Offset")))); err != nil { + return err + } + if _, err := w.Write([]byte("Offset")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil { return err } - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Size")))); err != nil { + return err + } + if _, err := w.Write([]byte("Size")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { return err } @@ -161,15 +244,30 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 3 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.SectorID (uint64) (uint64) + var name string + + // t.SectorID (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "SectorID" { + return fmt.Errorf("expected struct map entry %s to be SectorID", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -179,7 +277,20 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorID = uint64(extra) - // t.t.Offset (uint64) (uint64) + // t.Offset (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Offset" { + return fmt.Errorf("expected struct map entry %s to be Offset", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -189,7 +300,20 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Offset = uint64(extra) - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Size" { + return fmt.Errorf("expected struct map entry %s to be Size", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -207,11 +331,18 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{129}); err != nil { + if _, err := w.Write([]byte{161}); err != nil { + return err + } + + // t.Refs ([]api.SealedRef) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Refs")))); err != nil { + return err + } + if _, err := w.Write([]byte("Refs")); err != nil { return err } - // t.t.Refs ([]api.SealedRef) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Refs)))); err != nil { return err } @@ -230,21 +361,37 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 1 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Refs ([]api.SealedRef) (slice) + var name string + + // t.Refs ([]api.SealedRef) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Refs" { + return fmt.Errorf("expected struct map entry %s to be Refs", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Refs: array too large (%d)", extra) } diff --git a/chain/actors/cbor_gen.go b/chain/actors/cbor_gen.go index e77ac2089..6c8577e33 100644 --- a/chain/actors/cbor_gen.go +++ b/chain/actors/cbor_gen.go @@ -25,13 +25,13 @@ func (t *InitActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.AddressMap (cid.Cid) (struct) + // t.AddressMap (cid.Cid) (struct) if err := cbg.WriteCid(w, t.AddressMap); err != nil { return xerrors.Errorf("failed to write cid field t.AddressMap: %w", err) } - // t.t.NextID (uint64) (uint64) + // t.NextID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextID))); err != nil { return err } @@ -53,7 +53,7 @@ func (t *InitActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.AddressMap (cid.Cid) (struct) + // t.AddressMap (cid.Cid) (struct) { @@ -65,7 +65,7 @@ func (t *InitActorState) UnmarshalCBOR(r io.Reader) error { t.AddressMap = c } - // t.t.NextID (uint64) (uint64) + // t.NextID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -87,13 +87,13 @@ func (t *ExecParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Code (cid.Cid) (struct) + // t.Code (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Code); err != nil { return xerrors.Errorf("failed to write cid field t.Code: %w", err) } - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil { return err } @@ -118,7 +118,7 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Code (cid.Cid) (struct) + // t.Code (cid.Cid) (struct) { @@ -130,16 +130,16 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) error { t.Code = c } - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -159,7 +159,7 @@ func (t *AccountActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.Address (address.Address) (struct) + // t.Address (address.Address) (struct) if err := t.Address.MarshalCBOR(w); err != nil { return err } @@ -181,7 +181,7 @@ func (t *AccountActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Address (address.Address) (struct) + // t.Address (address.Address) (struct) { @@ -202,7 +202,7 @@ func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.PreCommittedSectors (map[string]*actors.PreCommittedSector) (map) + // t.PreCommittedSectors (map[string]*actors.PreCommittedSector) (map) { if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.PreCommittedSectors))); err != nil { return err @@ -230,50 +230,50 @@ func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error { } } - // t.t.Sectors (cid.Cid) (struct) + // t.Sectors (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Sectors); err != nil { return xerrors.Errorf("failed to write cid field t.Sectors: %w", err) } - // t.t.ProvingSet (cid.Cid) (struct) + // t.ProvingSet (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ProvingSet); err != nil { return xerrors.Errorf("failed to write cid field t.ProvingSet: %w", err) } - // t.t.Info (cid.Cid) (struct) + // t.Info (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Info); err != nil { return xerrors.Errorf("failed to write cid field t.Info: %w", err) } - // t.t.CurrentFaultSet (types.BitField) (struct) + // t.CurrentFaultSet (types.BitField) (struct) if err := t.CurrentFaultSet.MarshalCBOR(w); err != nil { return err } - // t.t.NextFaultSet (types.BitField) (struct) + // t.NextFaultSet (types.BitField) (struct) if err := t.NextFaultSet.MarshalCBOR(w); err != nil { return err } - // t.t.Power (types.BigInt) (struct) + // t.Power (types.BigInt) (struct) if err := t.Power.MarshalCBOR(w); err != nil { return err } - // t.t.Active (bool) (bool) + // t.Active (bool) (bool) if err := cbg.WriteBool(w, t.Active); err != nil { return err } - // t.t.SlashedAt (uint64) (uint64) + // t.SlashedAt (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SlashedAt))); err != nil { return err } - // t.t.ElectionPeriodStart (uint64) (uint64) + // t.ElectionPeriodStart (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ElectionPeriodStart))); err != nil { return err } @@ -295,7 +295,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.PreCommittedSectors (map[string]*actors.PreCommittedSector) (map) + // t.PreCommittedSectors (map[string]*actors.PreCommittedSector) (map) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -348,7 +348,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { t.PreCommittedSectors[k] = v } - // t.t.Sectors (cid.Cid) (struct) + // t.Sectors (cid.Cid) (struct) { @@ -360,7 +360,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { t.Sectors = c } - // t.t.ProvingSet (cid.Cid) (struct) + // t.ProvingSet (cid.Cid) (struct) { @@ -372,7 +372,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { t.ProvingSet = c } - // t.t.Info (cid.Cid) (struct) + // t.Info (cid.Cid) (struct) { @@ -384,7 +384,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { t.Info = c } - // t.t.CurrentFaultSet (types.BitField) (struct) + // t.CurrentFaultSet (types.BitField) (struct) { @@ -393,7 +393,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.NextFaultSet (types.BitField) (struct) + // t.NextFaultSet (types.BitField) (struct) { @@ -402,7 +402,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Power (types.BigInt) (struct) + // t.Power (types.BigInt) (struct) { @@ -411,7 +411,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Active (bool) (bool) + // t.Active (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -428,7 +428,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.t.SlashedAt (uint64) (uint64) + // t.SlashedAt (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -438,7 +438,7 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SlashedAt = uint64(extra) - // t.t.ElectionPeriodStart (uint64) (uint64) + // t.ElectionPeriodStart (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -460,22 +460,22 @@ func (t *StorageMinerConstructorParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) if err := t.Owner.MarshalCBOR(w); err != nil { return err } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) if err := t.Worker.MarshalCBOR(w); err != nil { return err } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorSize))); err != nil { return err } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil { return err } @@ -500,7 +500,7 @@ func (t *StorageMinerConstructorParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) { @@ -509,7 +509,7 @@ func (t *StorageMinerConstructorParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) { @@ -518,7 +518,7 @@ func (t *StorageMinerConstructorParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -528,7 +528,7 @@ func (t *StorageMinerConstructorParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorSize = uint64(extra) - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -550,12 +550,12 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.SectorNumber (uint64) (uint64) + // t.SectorNumber (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorNumber))); err != nil { return err } - // t.t.CommR ([]uint8) (slice) + // t.CommR ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommR)))); err != nil { return err } @@ -563,12 +563,12 @@ func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.SealEpoch (uint64) (uint64) + // t.SealEpoch (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SealEpoch))); err != nil { return err } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil { return err } @@ -595,7 +595,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.SectorNumber (uint64) (uint64) + // t.SectorNumber (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -605,16 +605,16 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorNumber = uint64(extra) - // t.t.CommR ([]uint8) (slice) + // t.CommR ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.CommR: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.CommR: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -622,7 +622,7 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.CommR); err != nil { return err } - // t.t.SealEpoch (uint64) (uint64) + // t.SealEpoch (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -632,13 +632,14 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SealEpoch = uint64(extra) - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -674,12 +675,12 @@ func (t *PreCommittedSector) MarshalCBOR(w io.Writer) error { return err } - // t.t.Info (actors.SectorPreCommitInfo) (struct) + // t.Info (actors.SectorPreCommitInfo) (struct) if err := t.Info.MarshalCBOR(w); err != nil { return err } - // t.t.ReceivedEpoch (uint64) (uint64) + // t.ReceivedEpoch (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ReceivedEpoch))); err != nil { return err } @@ -701,7 +702,7 @@ func (t *PreCommittedSector) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Info (actors.SectorPreCommitInfo) (struct) + // t.Info (actors.SectorPreCommitInfo) (struct) { @@ -710,7 +711,7 @@ func (t *PreCommittedSector) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ReceivedEpoch (uint64) (uint64) + // t.ReceivedEpoch (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -732,17 +733,17 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) if err := t.Owner.MarshalCBOR(w); err != nil { return err } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) if err := t.Worker.MarshalCBOR(w); err != nil { return err } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil { return err } @@ -750,7 +751,7 @@ func (t *MinerInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorSize))); err != nil { return err } @@ -772,7 +773,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) { @@ -781,7 +782,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) { @@ -790,7 +791,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -800,7 +801,7 @@ func (t *MinerInfo) UnmarshalCBOR(r io.Reader) error { t.PeerID = peer.ID(sval) } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -822,7 +823,7 @@ func (t *SubmitFallbackPoStParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -830,7 +831,7 @@ func (t *SubmitFallbackPoStParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Candidates ([]types.EPostTicket) (slice) + // t.Candidates ([]types.EPostTicket) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Candidates)))); err != nil { return err } @@ -857,16 +858,16 @@ func (t *SubmitFallbackPoStParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -874,13 +875,14 @@ func (t *SubmitFallbackPoStParams) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Proof); err != nil { return err } - // t.t.Candidates ([]types.EPostTicket) (slice) + // t.Candidates ([]types.EPostTicket) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Candidates: array too large (%d)", extra) } @@ -912,7 +914,7 @@ func (t *PaymentVerifyParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Extra ([]uint8) (slice) + // t.Extra ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Extra)))); err != nil { return err } @@ -920,7 +922,7 @@ func (t *PaymentVerifyParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -945,16 +947,16 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Extra ([]uint8) (slice) + // t.Extra ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Extra: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Extra: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -962,16 +964,16 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Extra); err != nil { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -991,7 +993,7 @@ func (t *UpdatePeerIDParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil { return err } @@ -1016,7 +1018,7 @@ func (t *UpdatePeerIDParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -1038,7 +1040,7 @@ func (t *MultiSigActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.Signers ([]address.Address) (slice) + // t.Signers ([]address.Address) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Signers)))); err != nil { return err } @@ -1048,32 +1050,32 @@ func (t *MultiSigActorState) MarshalCBOR(w io.Writer) error { } } - // t.t.Required (uint64) (uint64) + // t.Required (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Required))); err != nil { return err } - // t.t.NextTxID (uint64) (uint64) + // t.NextTxID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextTxID))); err != nil { return err } - // t.t.InitialBalance (types.BigInt) (struct) + // t.InitialBalance (types.BigInt) (struct) if err := t.InitialBalance.MarshalCBOR(w); err != nil { return err } - // t.t.StartingBlock (uint64) (uint64) + // t.StartingBlock (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.StartingBlock))); err != nil { return err } - // t.t.UnlockDuration (uint64) (uint64) + // t.UnlockDuration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.UnlockDuration))); err != nil { return err } - // t.t.Transactions ([]actors.MTransaction) (slice) + // t.Transactions ([]actors.MTransaction) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Transactions)))); err != nil { return err } @@ -1100,13 +1102,14 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Signers ([]address.Address) (slice) + // t.Signers ([]address.Address) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -1126,7 +1129,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { t.Signers[i] = v } - // t.t.Required (uint64) (uint64) + // t.Required (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1136,7 +1139,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Required = uint64(extra) - // t.t.NextTxID (uint64) (uint64) + // t.NextTxID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1146,7 +1149,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.NextTxID = uint64(extra) - // t.t.InitialBalance (types.BigInt) (struct) + // t.InitialBalance (types.BigInt) (struct) { @@ -1155,7 +1158,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.StartingBlock (uint64) (uint64) + // t.StartingBlock (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1165,7 +1168,7 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.StartingBlock = uint64(extra) - // t.t.UnlockDuration (uint64) (uint64) + // t.UnlockDuration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1175,13 +1178,14 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.UnlockDuration = uint64(extra) - // t.t.Transactions ([]actors.MTransaction) (slice) + // t.Transactions ([]actors.MTransaction) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Transactions: array too large (%d)", extra) } @@ -1213,7 +1217,7 @@ func (t *MultiSigConstructorParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Signers ([]address.Address) (slice) + // t.Signers ([]address.Address) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Signers)))); err != nil { return err } @@ -1223,12 +1227,12 @@ func (t *MultiSigConstructorParams) MarshalCBOR(w io.Writer) error { } } - // t.t.Required (uint64) (uint64) + // t.Required (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Required))); err != nil { return err } - // t.t.UnlockDuration (uint64) (uint64) + // t.UnlockDuration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.UnlockDuration))); err != nil { return err } @@ -1250,13 +1254,14 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Signers ([]address.Address) (slice) + // t.Signers ([]address.Address) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -1276,7 +1281,7 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error { t.Signers[i] = v } - // t.t.Required (uint64) (uint64) + // t.Required (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1286,7 +1291,7 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Required = uint64(extra) - // t.t.UnlockDuration (uint64) (uint64) + // t.UnlockDuration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1308,22 +1313,22 @@ func (t *MultiSigProposeParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) if err := t.Value.MarshalCBOR(w); err != nil { return err } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Method))); err != nil { return err } - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil { return err } @@ -1348,7 +1353,7 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -1357,7 +1362,7 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) { @@ -1366,7 +1371,7 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1376,16 +1381,16 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Method = uint64(extra) - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -1405,7 +1410,7 @@ func (t *MultiSigTxID) MarshalCBOR(w io.Writer) error { return err } - // t.t.TxID (uint64) (uint64) + // t.TxID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.TxID))); err != nil { return err } @@ -1427,7 +1432,7 @@ func (t *MultiSigTxID) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.TxID (uint64) (uint64) + // t.TxID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1449,12 +1454,12 @@ func (t *MultiSigSwapSignerParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) if err := t.From.MarshalCBOR(w); err != nil { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } @@ -1476,7 +1481,7 @@ func (t *MultiSigSwapSignerParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) { @@ -1485,7 +1490,7 @@ func (t *MultiSigSwapSignerParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -1506,7 +1511,7 @@ func (t *MultiSigChangeReqParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Req (uint64) (uint64) + // t.Req (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Req))); err != nil { return err } @@ -1528,7 +1533,7 @@ func (t *MultiSigChangeReqParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Req (uint64) (uint64) + // t.Req (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1550,32 +1555,32 @@ func (t *MTransaction) MarshalCBOR(w io.Writer) error { return err } - // t.t.Created (uint64) (uint64) + // t.Created (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Created))); err != nil { return err } - // t.t.TxID (uint64) (uint64) + // t.TxID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.TxID))); err != nil { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) if err := t.Value.MarshalCBOR(w); err != nil { return err } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Method))); err != nil { return err } - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil { return err } @@ -1583,7 +1588,7 @@ func (t *MTransaction) MarshalCBOR(w io.Writer) error { return err } - // t.t.Approved ([]address.Address) (slice) + // t.Approved ([]address.Address) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Approved)))); err != nil { return err } @@ -1593,17 +1598,17 @@ func (t *MTransaction) MarshalCBOR(w io.Writer) error { } } - // t.t.Complete (bool) (bool) + // t.Complete (bool) (bool) if err := cbg.WriteBool(w, t.Complete); err != nil { return err } - // t.t.Canceled (bool) (bool) + // t.Canceled (bool) (bool) if err := cbg.WriteBool(w, t.Canceled); err != nil { return err } - // t.t.RetCode (uint64) (uint64) + // t.RetCode (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.RetCode))); err != nil { return err } @@ -1625,7 +1630,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Created (uint64) (uint64) + // t.Created (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1635,7 +1640,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Created = uint64(extra) - // t.t.TxID (uint64) (uint64) + // t.TxID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1645,7 +1650,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.TxID = uint64(extra) - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -1654,7 +1659,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) { @@ -1663,7 +1668,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1673,16 +1678,16 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Method = uint64(extra) - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -1690,13 +1695,14 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Params); err != nil { return err } - // t.t.Approved ([]address.Address) (slice) + // t.Approved ([]address.Address) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -1716,7 +1722,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { t.Approved[i] = v } - // t.t.Complete (bool) (bool) + // t.Complete (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1733,7 +1739,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.t.Canceled (bool) (bool) + // t.Canceled (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1750,7 +1756,7 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.t.RetCode (uint64) (uint64) + // t.RetCode (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1772,12 +1778,12 @@ func (t *MultiSigRemoveSignerParam) MarshalCBOR(w io.Writer) error { return err } - // t.t.Signer (address.Address) (struct) + // t.Signer (address.Address) (struct) if err := t.Signer.MarshalCBOR(w); err != nil { return err } - // t.t.Decrease (bool) (bool) + // t.Decrease (bool) (bool) if err := cbg.WriteBool(w, t.Decrease); err != nil { return err } @@ -1799,7 +1805,7 @@ func (t *MultiSigRemoveSignerParam) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Signer (address.Address) (struct) + // t.Signer (address.Address) (struct) { @@ -1808,7 +1814,7 @@ func (t *MultiSigRemoveSignerParam) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Decrease (bool) (bool) + // t.Decrease (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1837,12 +1843,12 @@ func (t *MultiSigAddSignerParam) MarshalCBOR(w io.Writer) error { return err } - // t.t.Signer (address.Address) (struct) + // t.Signer (address.Address) (struct) if err := t.Signer.MarshalCBOR(w); err != nil { return err } - // t.t.Increase (bool) (bool) + // t.Increase (bool) (bool) if err := cbg.WriteBool(w, t.Increase); err != nil { return err } @@ -1864,7 +1870,7 @@ func (t *MultiSigAddSignerParam) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Signer (address.Address) (struct) + // t.Signer (address.Address) (struct) { @@ -1873,7 +1879,7 @@ func (t *MultiSigAddSignerParam) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Increase (bool) (bool) + // t.Increase (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1902,32 +1908,32 @@ func (t *PaymentChannelActorState) MarshalCBOR(w io.Writer) error { return err } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) if err := t.From.MarshalCBOR(w); err != nil { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } - // t.t.ToSend (types.BigInt) (struct) + // t.ToSend (types.BigInt) (struct) if err := t.ToSend.MarshalCBOR(w); err != nil { return err } - // t.t.ClosingAt (uint64) (uint64) + // t.ClosingAt (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ClosingAt))); err != nil { return err } - // t.t.MinCloseHeight (uint64) (uint64) + // t.MinCloseHeight (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.MinCloseHeight))); err != nil { return err } - // t.t.LaneStates (map[string]*actors.LaneState) (map) + // t.LaneStates (map[string]*actors.LaneState) (map) { if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.LaneStates))); err != nil { return err @@ -1972,7 +1978,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) { @@ -1981,7 +1987,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -1990,7 +1996,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ToSend (types.BigInt) (struct) + // t.ToSend (types.BigInt) (struct) { @@ -1999,7 +2005,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ClosingAt (uint64) (uint64) + // t.ClosingAt (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2009,7 +2015,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.ClosingAt = uint64(extra) - // t.t.MinCloseHeight (uint64) (uint64) + // t.MinCloseHeight (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2019,7 +2025,7 @@ func (t *PaymentChannelActorState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.MinCloseHeight = uint64(extra) - // t.t.LaneStates (map[string]*actors.LaneState) (map) + // t.LaneStates (map[string]*actors.LaneState) (map) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2084,7 +2090,7 @@ func (t *PCAConstructorParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } @@ -2106,7 +2112,7 @@ func (t *PCAConstructorParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -2127,17 +2133,17 @@ func (t *LaneState) MarshalCBOR(w io.Writer) error { return err } - // t.t.Closed (bool) (bool) + // t.Closed (bool) (bool) if err := cbg.WriteBool(w, t.Closed); err != nil { return err } - // t.t.Redeemed (types.BigInt) (struct) + // t.Redeemed (types.BigInt) (struct) if err := t.Redeemed.MarshalCBOR(w); err != nil { return err } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } @@ -2159,7 +2165,7 @@ func (t *LaneState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Closed (bool) (bool) + // t.Closed (bool) (bool) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2176,7 +2182,7 @@ func (t *LaneState) UnmarshalCBOR(r io.Reader) error { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.t.Redeemed (types.BigInt) (struct) + // t.Redeemed (types.BigInt) (struct) { @@ -2185,7 +2191,7 @@ func (t *LaneState) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2207,12 +2213,12 @@ func (t *PCAUpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Sv (types.SignedVoucher) (struct) + // t.Sv (types.SignedVoucher) (struct) if err := t.Sv.MarshalCBOR(w); err != nil { return err } - // t.t.Secret ([]uint8) (slice) + // t.Secret ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Secret)))); err != nil { return err } @@ -2220,7 +2226,7 @@ func (t *PCAUpdateChannelStateParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -2245,7 +2251,7 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Sv (types.SignedVoucher) (struct) + // t.Sv (types.SignedVoucher) (struct) { @@ -2254,16 +2260,16 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Secret ([]uint8) (slice) + // t.Secret ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Secret: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Secret: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -2271,16 +2277,16 @@ func (t *PCAUpdateChannelStateParams) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Secret); err != nil { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -2300,17 +2306,17 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.PayChActor (address.Address) (struct) + // t.PayChActor (address.Address) (struct) if err := t.PayChActor.MarshalCBOR(w); err != nil { return err } - // t.t.Payer (address.Address) (struct) + // t.Payer (address.Address) (struct) if err := t.Payer.MarshalCBOR(w); err != nil { return err } - // t.t.ChannelMessage (cid.Cid) (struct) + // t.ChannelMessage (cid.Cid) (struct) if t.ChannelMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -2322,7 +2328,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.Vouchers ([]*types.SignedVoucher) (slice) + // t.Vouchers ([]*types.SignedVoucher) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil { return err } @@ -2349,7 +2355,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.PayChActor (address.Address) (struct) + // t.PayChActor (address.Address) (struct) { @@ -2358,7 +2364,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Payer (address.Address) (struct) + // t.Payer (address.Address) (struct) { @@ -2367,7 +2373,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ChannelMessage (cid.Cid) (struct) + // t.ChannelMessage (cid.Cid) (struct) { @@ -2391,13 +2397,14 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Vouchers ([]*types.SignedVoucher) (slice) + // t.Vouchers ([]*types.SignedVoucher) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -2429,29 +2436,29 @@ func (t *StoragePowerState) MarshalCBOR(w io.Writer) error { return err } - // t.t.Miners (cid.Cid) (struct) + // t.Miners (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Miners); err != nil { return xerrors.Errorf("failed to write cid field t.Miners: %w", err) } - // t.t.ProvingBuckets (cid.Cid) (struct) + // t.ProvingBuckets (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ProvingBuckets); err != nil { return xerrors.Errorf("failed to write cid field t.ProvingBuckets: %w", err) } - // t.t.MinerCount (uint64) (uint64) + // t.MinerCount (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.MinerCount))); err != nil { return err } - // t.t.LastMinerCheck (uint64) (uint64) + // t.LastMinerCheck (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.LastMinerCheck))); err != nil { return err } - // t.t.TotalStorage (types.BigInt) (struct) + // t.TotalStorage (types.BigInt) (struct) if err := t.TotalStorage.MarshalCBOR(w); err != nil { return err } @@ -2473,7 +2480,7 @@ func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Miners (cid.Cid) (struct) + // t.Miners (cid.Cid) (struct) { @@ -2485,7 +2492,7 @@ func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { t.Miners = c } - // t.t.ProvingBuckets (cid.Cid) (struct) + // t.ProvingBuckets (cid.Cid) (struct) { @@ -2497,7 +2504,7 @@ func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { t.ProvingBuckets = c } - // t.t.MinerCount (uint64) (uint64) + // t.MinerCount (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2507,7 +2514,7 @@ func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.MinerCount = uint64(extra) - // t.t.LastMinerCheck (uint64) (uint64) + // t.LastMinerCheck (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2517,7 +2524,7 @@ func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.LastMinerCheck = uint64(extra) - // t.t.TotalStorage (types.BigInt) (struct) + // t.TotalStorage (types.BigInt) (struct) { @@ -2538,22 +2545,22 @@ func (t *CreateStorageMinerParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) if err := t.Owner.MarshalCBOR(w); err != nil { return err } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) if err := t.Worker.MarshalCBOR(w); err != nil { return err } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorSize))); err != nil { return err } - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil { return err } @@ -2578,7 +2585,7 @@ func (t *CreateStorageMinerParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Owner (address.Address) (struct) + // t.Owner (address.Address) (struct) { @@ -2587,7 +2594,7 @@ func (t *CreateStorageMinerParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Worker (address.Address) (struct) + // t.Worker (address.Address) (struct) { @@ -2596,7 +2603,7 @@ func (t *CreateStorageMinerParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2606,7 +2613,7 @@ func (t *CreateStorageMinerParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorSize = uint64(extra) - // t.t.PeerID (peer.ID) (string) + // t.PeerID (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -2628,7 +2635,7 @@ func (t *IsValidMinerParam) MarshalCBOR(w io.Writer) error { return err } - // t.t.Addr (address.Address) (struct) + // t.Addr (address.Address) (struct) if err := t.Addr.MarshalCBOR(w); err != nil { return err } @@ -2650,7 +2657,7 @@ func (t *IsValidMinerParam) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Addr (address.Address) (struct) + // t.Addr (address.Address) (struct) { @@ -2671,7 +2678,7 @@ func (t *PowerLookupParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) if err := t.Miner.MarshalCBOR(w); err != nil { return err } @@ -2693,7 +2700,7 @@ func (t *PowerLookupParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) { @@ -2714,17 +2721,17 @@ func (t *UpdateStorageParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Delta (types.BigInt) (struct) + // t.Delta (types.BigInt) (struct) if err := t.Delta.MarshalCBOR(w); err != nil { return err } - // t.t.NextProvingPeriodEnd (uint64) (uint64) + // t.NextProvingPeriodEnd (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextProvingPeriodEnd))); err != nil { return err } - // t.t.PreviousProvingPeriodEnd (uint64) (uint64) + // t.PreviousProvingPeriodEnd (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.PreviousProvingPeriodEnd))); err != nil { return err } @@ -2746,7 +2753,7 @@ func (t *UpdateStorageParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Delta (types.BigInt) (struct) + // t.Delta (types.BigInt) (struct) { @@ -2755,7 +2762,7 @@ func (t *UpdateStorageParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.NextProvingPeriodEnd (uint64) (uint64) + // t.NextProvingPeriodEnd (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2765,7 +2772,7 @@ func (t *UpdateStorageParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.NextProvingPeriodEnd = uint64(extra) - // t.t.PreviousProvingPeriodEnd (uint64) (uint64) + // t.PreviousProvingPeriodEnd (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2787,12 +2794,12 @@ func (t *ArbitrateConsensusFaultParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Block1 (types.BlockHeader) (struct) + // t.Block1 (types.BlockHeader) (struct) if err := t.Block1.MarshalCBOR(w); err != nil { return err } - // t.t.Block2 (types.BlockHeader) (struct) + // t.Block2 (types.BlockHeader) (struct) if err := t.Block2.MarshalCBOR(w); err != nil { return err } @@ -2814,7 +2821,7 @@ func (t *ArbitrateConsensusFaultParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Block1 (types.BlockHeader) (struct) + // t.Block1 (types.BlockHeader) (struct) { @@ -2835,7 +2842,7 @@ func (t *ArbitrateConsensusFaultParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Block2 (types.BlockHeader) (struct) + // t.Block2 (types.BlockHeader) (struct) { @@ -2868,7 +2875,7 @@ func (t *PledgeCollateralParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Size (types.BigInt) (struct) + // t.Size (types.BigInt) (struct) if err := t.Size.MarshalCBOR(w); err != nil { return err } @@ -2890,7 +2897,7 @@ func (t *PledgeCollateralParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Size (types.BigInt) (struct) + // t.Size (types.BigInt) (struct) { @@ -2911,17 +2918,17 @@ func (t *MinerSlashConsensusFault) MarshalCBOR(w io.Writer) error { return err } - // t.t.Slasher (address.Address) (struct) + // t.Slasher (address.Address) (struct) if err := t.Slasher.MarshalCBOR(w); err != nil { return err } - // t.t.AtHeight (uint64) (uint64) + // t.AtHeight (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.AtHeight))); err != nil { return err } - // t.t.SlashedCollateral (types.BigInt) (struct) + // t.SlashedCollateral (types.BigInt) (struct) if err := t.SlashedCollateral.MarshalCBOR(w); err != nil { return err } @@ -2943,7 +2950,7 @@ func (t *MinerSlashConsensusFault) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Slasher (address.Address) (struct) + // t.Slasher (address.Address) (struct) { @@ -2952,7 +2959,7 @@ func (t *MinerSlashConsensusFault) UnmarshalCBOR(r io.Reader) error { } } - // t.t.AtHeight (uint64) (uint64) + // t.AtHeight (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -2962,7 +2969,7 @@ func (t *MinerSlashConsensusFault) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.AtHeight = uint64(extra) - // t.t.SlashedCollateral (types.BigInt) (struct) + // t.SlashedCollateral (types.BigInt) (struct) { @@ -2983,12 +2990,12 @@ func (t *StorageParticipantBalance) MarshalCBOR(w io.Writer) error { return err } - // t.t.Locked (types.BigInt) (struct) + // t.Locked (types.BigInt) (struct) if err := t.Locked.MarshalCBOR(w); err != nil { return err } - // t.t.Available (types.BigInt) (struct) + // t.Available (types.BigInt) (struct) if err := t.Available.MarshalCBOR(w); err != nil { return err } @@ -3010,7 +3017,7 @@ func (t *StorageParticipantBalance) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Locked (types.BigInt) (struct) + // t.Locked (types.BigInt) (struct) { @@ -3019,7 +3026,7 @@ func (t *StorageParticipantBalance) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Available (types.BigInt) (struct) + // t.Available (types.BigInt) (struct) { @@ -3040,19 +3047,19 @@ func (t *StorageMarketState) MarshalCBOR(w io.Writer) error { return err } - // t.t.Balances (cid.Cid) (struct) + // t.Balances (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Balances); err != nil { return xerrors.Errorf("failed to write cid field t.Balances: %w", err) } - // t.t.Deals (cid.Cid) (struct) + // t.Deals (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Deals); err != nil { return xerrors.Errorf("failed to write cid field t.Deals: %w", err) } - // t.t.NextDealID (uint64) (uint64) + // t.NextDealID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextDealID))); err != nil { return err } @@ -3074,7 +3081,7 @@ func (t *StorageMarketState) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Balances (cid.Cid) (struct) + // t.Balances (cid.Cid) (struct) { @@ -3086,7 +3093,7 @@ func (t *StorageMarketState) UnmarshalCBOR(r io.Reader) error { t.Balances = c } - // t.t.Deals (cid.Cid) (struct) + // t.Deals (cid.Cid) (struct) { @@ -3098,7 +3105,7 @@ func (t *StorageMarketState) UnmarshalCBOR(r io.Reader) error { t.Deals = c } - // t.t.NextDealID (uint64) (uint64) + // t.NextDealID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3120,7 +3127,7 @@ func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Balance (types.BigInt) (struct) + // t.Balance (types.BigInt) (struct) if err := t.Balance.MarshalCBOR(w); err != nil { return err } @@ -3142,7 +3149,7 @@ func (t *WithdrawBalanceParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Balance (types.BigInt) (struct) + // t.Balance (types.BigInt) (struct) { @@ -3163,7 +3170,7 @@ func (t *StorageDealProposal) MarshalCBOR(w io.Writer) error { return err } - // t.t.PieceRef ([]uint8) (slice) + // t.PieceRef ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.PieceRef)))); err != nil { return err } @@ -3171,47 +3178,47 @@ func (t *StorageDealProposal) MarshalCBOR(w io.Writer) error { return err } - // t.t.PieceSize (uint64) (uint64) + // t.PieceSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.PieceSize))); err != nil { return err } - // t.t.PieceSerialization (uint64) (uint64) + // t.PieceSerialization (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.PieceSerialization))); err != nil { return err } - // t.t.Client (address.Address) (struct) + // t.Client (address.Address) (struct) if err := t.Client.MarshalCBOR(w); err != nil { return err } - // t.t.Provider (address.Address) (struct) + // t.Provider (address.Address) (struct) if err := t.Provider.MarshalCBOR(w); err != nil { return err } - // t.t.ProposalExpiration (uint64) (uint64) + // t.ProposalExpiration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ProposalExpiration))); err != nil { return err } - // t.t.Duration (uint64) (uint64) + // t.Duration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Duration))); err != nil { return err } - // t.t.StoragePricePerEpoch (types.BigInt) (struct) + // t.StoragePricePerEpoch (types.BigInt) (struct) if err := t.StoragePricePerEpoch.MarshalCBOR(w); err != nil { return err } - // t.t.StorageCollateral (types.BigInt) (struct) + // t.StorageCollateral (types.BigInt) (struct) if err := t.StorageCollateral.MarshalCBOR(w); err != nil { return err } - // t.t.ProposerSignature (types.Signature) (struct) + // t.ProposerSignature (types.Signature) (struct) if err := t.ProposerSignature.MarshalCBOR(w); err != nil { return err } @@ -3233,16 +3240,16 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.PieceRef ([]uint8) (slice) + // t.PieceRef ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.PieceRef: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.PieceRef: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -3250,7 +3257,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.PieceRef); err != nil { return err } - // t.t.PieceSize (uint64) (uint64) + // t.PieceSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3260,7 +3267,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.PieceSize = uint64(extra) - // t.t.PieceSerialization (uint64) (uint64) + // t.PieceSerialization (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3270,7 +3277,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.PieceSerialization = uint64(extra) - // t.t.Client (address.Address) (struct) + // t.Client (address.Address) (struct) { @@ -3279,7 +3286,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Provider (address.Address) (struct) + // t.Provider (address.Address) (struct) { @@ -3288,7 +3295,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ProposalExpiration (uint64) (uint64) + // t.ProposalExpiration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3298,7 +3305,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.ProposalExpiration = uint64(extra) - // t.t.Duration (uint64) (uint64) + // t.Duration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3308,7 +3315,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Duration = uint64(extra) - // t.t.StoragePricePerEpoch (types.BigInt) (struct) + // t.StoragePricePerEpoch (types.BigInt) (struct) { @@ -3317,7 +3324,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.StorageCollateral (types.BigInt) (struct) + // t.StorageCollateral (types.BigInt) (struct) { @@ -3326,7 +3333,7 @@ func (t *StorageDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ProposerSignature (types.Signature) (struct) + // t.ProposerSignature (types.Signature) (struct) { @@ -3359,12 +3366,12 @@ func (t *StorageDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) if err := t.Proposal.MarshalCBOR(w); err != nil { return err } - // t.t.CounterSignature (types.Signature) (struct) + // t.CounterSignature (types.Signature) (struct) if err := t.CounterSignature.MarshalCBOR(w); err != nil { return err } @@ -3386,7 +3393,7 @@ func (t *StorageDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) { @@ -3395,7 +3402,7 @@ func (t *StorageDeal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.CounterSignature (types.Signature) (struct) + // t.CounterSignature (types.Signature) (struct) { @@ -3428,7 +3435,7 @@ func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Deals ([]actors.StorageDeal) (slice) + // t.Deals ([]actors.StorageDeal) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Deals)))); err != nil { return err } @@ -3455,13 +3462,14 @@ func (t *PublishStorageDealsParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Deals ([]actors.StorageDeal) (slice) + // t.Deals ([]actors.StorageDeal) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -3493,7 +3501,7 @@ func (t *PublishStorageDealResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil { return err } @@ -3520,13 +3528,14 @@ func (t *PublishStorageDealResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3562,7 +3571,7 @@ func (t *ActivateStorageDealsParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Deals ([]uint64) (slice) + // t.Deals ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Deals)))); err != nil { return err } @@ -3589,13 +3598,14 @@ func (t *ActivateStorageDealsParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Deals ([]uint64) (slice) + // t.Deals ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Deals: array too large (%d)", extra) } @@ -3631,7 +3641,7 @@ func (t *ProcessStorageDealsPaymentParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil { return err } @@ -3658,13 +3668,14 @@ func (t *ProcessStorageDealsPaymentParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3700,12 +3711,12 @@ func (t *OnChainDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Deal (actors.StorageDeal) (struct) + // t.Deal (actors.StorageDeal) (struct) if err := t.Deal.MarshalCBOR(w); err != nil { return err } - // t.t.ActivationEpoch (uint64) (uint64) + // t.ActivationEpoch (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ActivationEpoch))); err != nil { return err } @@ -3727,7 +3738,7 @@ func (t *OnChainDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Deal (actors.StorageDeal) (struct) + // t.Deal (actors.StorageDeal) (struct) { @@ -3736,7 +3747,7 @@ func (t *OnChainDeal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ActivationEpoch (uint64) (uint64) + // t.ActivationEpoch (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3758,7 +3769,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil { return err } @@ -3768,7 +3779,7 @@ func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error { } } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorSize))); err != nil { return err } @@ -3790,13 +3801,14 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3820,7 +3832,7 @@ func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) error { t.DealIDs[i] = val } - // t.t.SectorSize (uint64) (uint64) + // t.SectorSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3842,7 +3854,7 @@ func (t *SectorProveCommitInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -3850,12 +3862,12 @@ func (t *SectorProveCommitInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { return err } - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil { return err } @@ -3882,16 +3894,16 @@ func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -3899,7 +3911,7 @@ func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Proof); err != nil { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -3909,13 +3921,14 @@ func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorID = uint64(extra) - // t.t.DealIDs ([]uint64) (slice) + // t.DealIDs ([]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } @@ -3951,7 +3964,7 @@ func (t *CheckMinerParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.NetworkPower (types.BigInt) (struct) + // t.NetworkPower (types.BigInt) (struct) if err := t.NetworkPower.MarshalCBOR(w); err != nil { return err } @@ -3973,7 +3986,7 @@ func (t *CheckMinerParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.NetworkPower (types.BigInt) (struct) + // t.NetworkPower (types.BigInt) (struct) { diff --git a/chain/blocksync/cbor_gen.go b/chain/blocksync/cbor_gen.go index 4af61a490..8e2627cb7 100644 --- a/chain/blocksync/cbor_gen.go +++ b/chain/blocksync/cbor_gen.go @@ -23,7 +23,7 @@ func (t *BlockSyncRequest) MarshalCBOR(w io.Writer) error { return err } - // t.t.Start ([]cid.Cid) (slice) + // t.Start ([]cid.Cid) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Start)))); err != nil { return err } @@ -33,12 +33,12 @@ func (t *BlockSyncRequest) MarshalCBOR(w io.Writer) error { } } - // t.t.RequestLength (uint64) (uint64) + // t.RequestLength (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.RequestLength))); err != nil { return err } - // t.t.Options (uint64) (uint64) + // t.Options (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Options))); err != nil { return err } @@ -60,13 +60,14 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Start ([]cid.Cid) (slice) + // t.Start ([]cid.Cid) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Start: array too large (%d)", extra) } @@ -85,7 +86,7 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error { t.Start[i] = c } - // t.t.RequestLength (uint64) (uint64) + // t.RequestLength (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -95,7 +96,7 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.RequestLength = uint64(extra) - // t.t.Options (uint64) (uint64) + // t.Options (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -117,7 +118,7 @@ func (t *BlockSyncResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.Chain ([]*blocksync.BSTipSet) (slice) + // t.Chain ([]*blocksync.BSTipSet) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Chain)))); err != nil { return err } @@ -127,12 +128,12 @@ func (t *BlockSyncResponse) MarshalCBOR(w io.Writer) error { } } - // t.t.Status (uint64) (uint64) + // t.Status (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { return err } - // t.t.Message (string) (string) + // t.Message (string) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { return err } @@ -157,13 +158,14 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Chain ([]*blocksync.BSTipSet) (slice) + // t.Chain ([]*blocksync.BSTipSet) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Chain: array too large (%d)", extra) } @@ -183,7 +185,7 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error { t.Chain[i] = &v } - // t.t.Status (uint64) (uint64) + // t.Status (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -193,7 +195,7 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Status = uint64(extra) - // t.t.Message (string) (string) + // t.Message (string) (string) { sval, err := cbg.ReadString(br) @@ -215,7 +217,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { return err } - // t.t.Blocks ([]*types.BlockHeader) (slice) + // t.Blocks ([]*types.BlockHeader) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Blocks)))); err != nil { return err } @@ -225,7 +227,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.BlsMessages ([]*types.Message) (slice) + // t.BlsMessages ([]*types.Message) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMessages)))); err != nil { return err } @@ -235,7 +237,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.BlsMsgIncludes ([][]uint64) (slice) + // t.BlsMsgIncludes ([][]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMsgIncludes)))); err != nil { return err } @@ -250,7 +252,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.SecpkMessages ([]*types.SignedMessage) (slice) + // t.SecpkMessages ([]*types.SignedMessage) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMessages)))); err != nil { return err } @@ -260,7 +262,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.SecpkMsgIncludes ([][]uint64) (slice) + // t.SecpkMsgIncludes ([][]uint64) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMsgIncludes)))); err != nil { return err } @@ -292,13 +294,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Blocks ([]*types.BlockHeader) (slice) + // t.Blocks ([]*types.BlockHeader) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Blocks: array too large (%d)", extra) } @@ -318,13 +321,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { t.Blocks[i] = &v } - // t.t.BlsMessages ([]*types.Message) (slice) + // t.BlsMessages ([]*types.Message) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) } @@ -344,13 +348,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { t.BlsMessages[i] = &v } - // t.t.BlsMsgIncludes ([][]uint64) (slice) + // t.BlsMsgIncludes ([][]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.BlsMsgIncludes: array too large (%d)", extra) } @@ -370,7 +375,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.BlsMsgIncludes[i]: array too large (%d)", extra) } @@ -397,13 +403,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { } } - // t.t.SecpkMessages ([]*types.SignedMessage) (slice) + // t.SecpkMessages ([]*types.SignedMessage) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) } @@ -423,13 +430,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { t.SecpkMessages[i] = &v } - // t.t.SecpkMsgIncludes ([][]uint64) (slice) + // t.SecpkMsgIncludes ([][]uint64) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.SecpkMsgIncludes: array too large (%d)", extra) } @@ -449,7 +457,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.SecpkMsgIncludes[i]: array too large (%d)", extra) } diff --git a/chain/deals/cbor_gen.go b/chain/deals/cbor_gen.go index a5e20bb54..fee662f8c 100644 --- a/chain/deals/cbor_gen.go +++ b/chain/deals/cbor_gen.go @@ -24,7 +24,7 @@ func (t *AskRequest) MarshalCBOR(w io.Writer) error { return err } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) if err := t.Miner.MarshalCBOR(w); err != nil { return err } @@ -46,7 +46,7 @@ func (t *AskRequest) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) { @@ -67,7 +67,7 @@ func (t *AskResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.Ask (types.SignedStorageAsk) (struct) + // t.Ask (types.SignedStorageAsk) (struct) if err := t.Ask.MarshalCBOR(w); err != nil { return err } @@ -89,7 +89,7 @@ func (t *AskResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Ask (types.SignedStorageAsk) (struct) + // t.Ask (types.SignedStorageAsk) (struct) { @@ -122,12 +122,12 @@ func (t *Proposal) MarshalCBOR(w io.Writer) error { return err } - // t.t.DealProposal (actors.StorageDealProposal) (struct) + // t.DealProposal (actors.StorageDealProposal) (struct) if err := t.DealProposal.MarshalCBOR(w); err != nil { return err } - // t.t.Piece (cid.Cid) (struct) + // t.Piece (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Piece); err != nil { return xerrors.Errorf("failed to write cid field t.Piece: %w", err) @@ -151,7 +151,7 @@ func (t *Proposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.DealProposal (actors.StorageDealProposal) (struct) + // t.DealProposal (actors.StorageDealProposal) (struct) { @@ -172,7 +172,7 @@ func (t *Proposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Piece (cid.Cid) (struct) + // t.Piece (cid.Cid) (struct) { @@ -196,12 +196,12 @@ func (t *Response) MarshalCBOR(w io.Writer) error { return err } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { return err } - // t.t.Message (string) (string) + // t.Message (string) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { return err } @@ -209,18 +209,18 @@ func (t *Response) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proposal (cid.Cid) (struct) + // t.Proposal (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Proposal); err != nil { return xerrors.Errorf("failed to write cid field t.Proposal: %w", err) } - // t.t.StorageDeal (actors.StorageDeal) (struct) + // t.StorageDeal (actors.StorageDeal) (struct) if err := t.StorageDeal.MarshalCBOR(w); err != nil { return err } - // t.t.PublishMessage (cid.Cid) (struct) + // t.PublishMessage (cid.Cid) (struct) if t.PublishMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -250,7 +250,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -260,7 +260,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.State = uint64(extra) - // t.t.Message (string) (string) + // t.Message (string) (string) { sval, err := cbg.ReadString(br) @@ -270,7 +270,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error { t.Message = string(sval) } - // t.t.Proposal (cid.Cid) (struct) + // t.Proposal (cid.Cid) (struct) { @@ -282,7 +282,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error { t.Proposal = c } - // t.t.StorageDeal (actors.StorageDeal) (struct) + // t.StorageDeal (actors.StorageDeal) (struct) { @@ -303,7 +303,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error { } } - // t.t.PublishMessage (cid.Cid) (struct) + // t.PublishMessage (cid.Cid) (struct) { @@ -339,12 +339,12 @@ func (t *SignedResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.Response (deals.Response) (struct) + // t.Response (deals.Response) (struct) if err := t.Response.MarshalCBOR(w); err != nil { return err } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) if err := t.Signature.MarshalCBOR(w); err != nil { return err } @@ -366,7 +366,7 @@ func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Response (deals.Response) (struct) + // t.Response (deals.Response) (struct) { @@ -375,7 +375,7 @@ func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) { @@ -408,43 +408,43 @@ func (t *ClientDealProposal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Data (cid.Cid) (struct) + // t.Data (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Data); err != nil { return xerrors.Errorf("failed to write cid field t.Data: %w", err) } - // t.t.PricePerEpoch (types.BigInt) (struct) + // t.PricePerEpoch (types.BigInt) (struct) if err := t.PricePerEpoch.MarshalCBOR(w); err != nil { return err } - // t.t.ProposalExpiration (uint64) (uint64) + // t.ProposalExpiration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ProposalExpiration))); err != nil { return err } - // t.t.Duration (uint64) (uint64) + // t.Duration (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Duration))); err != nil { return err } - // t.t.ProviderAddress (address.Address) (struct) + // t.ProviderAddress (address.Address) (struct) if err := t.ProviderAddress.MarshalCBOR(w); err != nil { return err } - // t.t.Client (address.Address) (struct) + // t.Client (address.Address) (struct) if err := t.Client.MarshalCBOR(w); err != nil { return err } - // t.t.MinerWorker (address.Address) (struct) + // t.MinerWorker (address.Address) (struct) if err := t.MinerWorker.MarshalCBOR(w); err != nil { return err } - // t.t.MinerID (peer.ID) (string) + // t.MinerID (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.MinerID)))); err != nil { return err } @@ -469,7 +469,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Data (cid.Cid) (struct) + // t.Data (cid.Cid) (struct) { @@ -481,7 +481,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { t.Data = c } - // t.t.PricePerEpoch (types.BigInt) (struct) + // t.PricePerEpoch (types.BigInt) (struct) { @@ -490,7 +490,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ProposalExpiration (uint64) (uint64) + // t.ProposalExpiration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -500,7 +500,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.ProposalExpiration = uint64(extra) - // t.t.Duration (uint64) (uint64) + // t.Duration (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -510,7 +510,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Duration = uint64(extra) - // t.t.ProviderAddress (address.Address) (struct) + // t.ProviderAddress (address.Address) (struct) { @@ -519,7 +519,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Client (address.Address) (struct) + // t.Client (address.Address) (struct) { @@ -528,7 +528,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.MinerWorker (address.Address) (struct) + // t.MinerWorker (address.Address) (struct) { @@ -537,7 +537,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.MinerID (peer.ID) (string) + // t.MinerID (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -559,23 +559,23 @@ func (t *ClientDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.ProposalCid (cid.Cid) (struct) + // t.ProposalCid (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ProposalCid); err != nil { return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err) } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) if err := t.Proposal.MarshalCBOR(w); err != nil { return err } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { return err } - // t.t.Miner (peer.ID) (string) + // t.Miner (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Miner)))); err != nil { return err } @@ -583,17 +583,17 @@ func (t *ClientDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.MinerWorker (address.Address) (struct) + // t.MinerWorker (address.Address) (struct) if err := t.MinerWorker.MarshalCBOR(w); err != nil { return err } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { return err } - // t.t.PublishMessage (cid.Cid) (struct) + // t.PublishMessage (cid.Cid) (struct) if t.PublishMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -623,7 +623,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.ProposalCid (cid.Cid) (struct) + // t.ProposalCid (cid.Cid) (struct) { @@ -635,7 +635,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { t.ProposalCid = c } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) { @@ -644,7 +644,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -654,7 +654,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.State = uint64(extra) - // t.t.Miner (peer.ID) (string) + // t.Miner (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -664,7 +664,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { t.Miner = peer.ID(sval) } - // t.t.MinerWorker (address.Address) (struct) + // t.MinerWorker (address.Address) (struct) { @@ -673,7 +673,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -683,7 +683,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.DealID = uint64(extra) - // t.t.PublishMessage (cid.Cid) (struct) + // t.PublishMessage (cid.Cid) (struct) { @@ -719,7 +719,7 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Client (peer.ID) (string) + // t.Client (peer.ID) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Client)))); err != nil { return err } @@ -727,34 +727,34 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) if err := t.Proposal.MarshalCBOR(w); err != nil { return err } - // t.t.ProposalCid (cid.Cid) (struct) + // t.ProposalCid (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ProposalCid); err != nil { return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err) } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { return err } - // t.t.Ref (cid.Cid) (struct) + // t.Ref (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Ref); err != nil { return xerrors.Errorf("failed to write cid field t.Ref: %w", err) } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { return err } @@ -776,7 +776,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Client (peer.ID) (string) + // t.Client (peer.ID) (string) { sval, err := cbg.ReadString(br) @@ -786,7 +786,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { t.Client = peer.ID(sval) } - // t.t.Proposal (actors.StorageDealProposal) (struct) + // t.Proposal (actors.StorageDealProposal) (struct) { @@ -795,7 +795,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.ProposalCid (cid.Cid) (struct) + // t.ProposalCid (cid.Cid) (struct) { @@ -807,7 +807,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { t.ProposalCid = c } - // t.t.State (uint64) (uint64) + // t.State (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -817,7 +817,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.State = uint64(extra) - // t.t.Ref (cid.Cid) (struct) + // t.Ref (cid.Cid) (struct) { @@ -829,7 +829,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { t.Ref = c } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -839,7 +839,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.DealID = uint64(extra) - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -861,13 +861,13 @@ func (t *StorageDataTransferVoucher) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proposal (cid.Cid) (struct) + // t.Proposal (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Proposal); err != nil { return xerrors.Errorf("failed to write cid field t.Proposal: %w", err) } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { return err } @@ -889,7 +889,7 @@ func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Proposal (cid.Cid) (struct) + // t.Proposal (cid.Cid) (struct) { @@ -901,7 +901,7 @@ func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error { t.Proposal = c } - // t.t.DealID (uint64) (uint64) + // t.DealID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index d2b60f268..5bf2ffce8 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -23,22 +23,22 @@ func (t *BlockHeader) MarshalCBOR(w io.Writer) error { return err } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) if err := t.Miner.MarshalCBOR(w); err != nil { return err } - // t.t.Ticket (types.Ticket) (struct) + // t.Ticket (types.Ticket) (struct) if err := t.Ticket.MarshalCBOR(w); err != nil { return err } - // t.t.EPostProof (types.EPostProof) (struct) + // t.EPostProof (types.EPostProof) (struct) if err := t.EPostProof.MarshalCBOR(w); err != nil { return err } - // t.t.Parents ([]cid.Cid) (slice) + // t.Parents ([]cid.Cid) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Parents)))); err != nil { return err } @@ -48,45 +48,45 @@ func (t *BlockHeader) MarshalCBOR(w io.Writer) error { } } - // t.t.ParentWeight (types.BigInt) (struct) + // t.ParentWeight (types.BigInt) (struct) if err := t.ParentWeight.MarshalCBOR(w); err != nil { return err } - // t.t.Height (uint64) (uint64) + // t.Height (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Height))); err != nil { return err } - // t.t.ParentStateRoot (cid.Cid) (struct) + // t.ParentStateRoot (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ParentStateRoot); err != nil { return xerrors.Errorf("failed to write cid field t.ParentStateRoot: %w", err) } - // t.t.ParentMessageReceipts (cid.Cid) (struct) + // t.ParentMessageReceipts (cid.Cid) (struct) if err := cbg.WriteCid(w, t.ParentMessageReceipts); err != nil { return xerrors.Errorf("failed to write cid field t.ParentMessageReceipts: %w", err) } - // t.t.Messages (cid.Cid) (struct) + // t.Messages (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Messages); err != nil { return xerrors.Errorf("failed to write cid field t.Messages: %w", err) } - // t.t.BLSAggregate (types.Signature) (struct) + // t.BLSAggregate (types.Signature) (struct) if err := t.BLSAggregate.MarshalCBOR(w); err != nil { return err } - // t.t.Timestamp (uint64) (uint64) + // t.Timestamp (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Timestamp))); err != nil { return err } - // t.t.BlockSig (types.Signature) (struct) + // t.BlockSig (types.Signature) (struct) if err := t.BlockSig.MarshalCBOR(w); err != nil { return err } @@ -108,7 +108,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) { @@ -117,7 +117,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Ticket (types.Ticket) (struct) + // t.Ticket (types.Ticket) (struct) { @@ -138,7 +138,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } } - // t.t.EPostProof (types.EPostProof) (struct) + // t.EPostProof (types.EPostProof) (struct) { @@ -147,13 +147,14 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Parents ([]cid.Cid) (slice) + // t.Parents ([]cid.Cid) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Parents: array too large (%d)", extra) } @@ -172,7 +173,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { t.Parents[i] = c } - // t.t.ParentWeight (types.BigInt) (struct) + // t.ParentWeight (types.BigInt) (struct) { @@ -181,7 +182,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Height (uint64) (uint64) + // t.Height (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -191,7 +192,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Height = uint64(extra) - // t.t.ParentStateRoot (cid.Cid) (struct) + // t.ParentStateRoot (cid.Cid) (struct) { @@ -203,7 +204,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { t.ParentStateRoot = c } - // t.t.ParentMessageReceipts (cid.Cid) (struct) + // t.ParentMessageReceipts (cid.Cid) (struct) { @@ -215,7 +216,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { t.ParentMessageReceipts = c } - // t.t.Messages (cid.Cid) (struct) + // t.Messages (cid.Cid) (struct) { @@ -227,7 +228,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { t.Messages = c } - // t.t.BLSAggregate (types.Signature) (struct) + // t.BLSAggregate (types.Signature) (struct) { @@ -236,7 +237,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Timestamp (uint64) (uint64) + // t.Timestamp (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -246,7 +247,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Timestamp = uint64(extra) - // t.t.BlockSig (types.Signature) (struct) + // t.BlockSig (types.Signature) (struct) { @@ -279,7 +280,7 @@ func (t *Ticket) MarshalCBOR(w io.Writer) error { return err } - // t.t.VRFProof ([]uint8) (slice) + // t.VRFProof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.VRFProof)))); err != nil { return err } @@ -304,16 +305,16 @@ func (t *Ticket) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.VRFProof ([]uint8) (slice) + // t.VRFProof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.VRFProof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.VRFProof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -333,7 +334,7 @@ func (t *EPostProof) MarshalCBOR(w io.Writer) error { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -341,7 +342,7 @@ func (t *EPostProof) MarshalCBOR(w io.Writer) error { return err } - // t.t.PostRand ([]uint8) (slice) + // t.PostRand ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.PostRand)))); err != nil { return err } @@ -349,7 +350,7 @@ func (t *EPostProof) MarshalCBOR(w io.Writer) error { return err } - // t.t.Candidates ([]types.EPostTicket) (slice) + // t.Candidates ([]types.EPostTicket) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Candidates)))); err != nil { return err } @@ -376,16 +377,16 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -393,16 +394,16 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Proof); err != nil { return err } - // t.t.PostRand ([]uint8) (slice) + // t.PostRand ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.PostRand: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.PostRand: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -410,13 +411,14 @@ func (t *EPostProof) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.PostRand); err != nil { return err } - // t.t.Candidates ([]types.EPostTicket) (slice) + // t.Candidates ([]types.EPostTicket) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Candidates: array too large (%d)", extra) } @@ -448,7 +450,7 @@ func (t *EPostTicket) MarshalCBOR(w io.Writer) error { return err } - // t.t.Partial ([]uint8) (slice) + // t.Partial ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Partial)))); err != nil { return err } @@ -456,12 +458,12 @@ func (t *EPostTicket) MarshalCBOR(w io.Writer) error { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { return err } - // t.t.ChallengeIndex (uint64) (uint64) + // t.ChallengeIndex (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ChallengeIndex))); err != nil { return err } @@ -483,16 +485,16 @@ func (t *EPostTicket) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Partial ([]uint8) (slice) + // t.Partial ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Partial: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Partial: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -500,7 +502,7 @@ func (t *EPostTicket) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Partial); err != nil { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -510,7 +512,7 @@ func (t *EPostTicket) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorID = uint64(extra) - // t.t.ChallengeIndex (uint64) (uint64) + // t.ChallengeIndex (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -532,42 +534,42 @@ func (t *Message) MarshalCBOR(w io.Writer) error { return err } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) if err := t.To.MarshalCBOR(w); err != nil { return err } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) if err := t.From.MarshalCBOR(w); err != nil { return err } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) if err := t.Value.MarshalCBOR(w); err != nil { return err } - // t.t.GasPrice (types.BigInt) (struct) + // t.GasPrice (types.BigInt) (struct) if err := t.GasPrice.MarshalCBOR(w); err != nil { return err } - // t.t.GasLimit (types.BigInt) (struct) + // t.GasLimit (types.BigInt) (struct) if err := t.GasLimit.MarshalCBOR(w); err != nil { return err } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Method))); err != nil { return err } - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil { return err } @@ -592,7 +594,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.To (address.Address) (struct) + // t.To (address.Address) (struct) { @@ -601,7 +603,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.t.From (address.Address) (struct) + // t.From (address.Address) (struct) { @@ -610,7 +612,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -620,7 +622,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Nonce = uint64(extra) - // t.t.Value (types.BigInt) (struct) + // t.Value (types.BigInt) (struct) { @@ -629,7 +631,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.t.GasPrice (types.BigInt) (struct) + // t.GasPrice (types.BigInt) (struct) { @@ -638,7 +640,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.t.GasLimit (types.BigInt) (struct) + // t.GasLimit (types.BigInt) (struct) { @@ -647,7 +649,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -657,16 +659,16 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Method = uint64(extra) - // t.t.Params ([]uint8) (slice) + // t.Params ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -686,12 +688,12 @@ func (t *SignedMessage) MarshalCBOR(w io.Writer) error { return err } - // t.t.Message (types.Message) (struct) + // t.Message (types.Message) (struct) if err := t.Message.MarshalCBOR(w); err != nil { return err } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) if err := t.Signature.MarshalCBOR(w); err != nil { return err } @@ -713,7 +715,7 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Message (types.Message) (struct) + // t.Message (types.Message) (struct) { @@ -722,7 +724,7 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) { @@ -743,13 +745,13 @@ func (t *MsgMeta) MarshalCBOR(w io.Writer) error { return err } - // t.t.BlsMessages (cid.Cid) (struct) + // t.BlsMessages (cid.Cid) (struct) if err := cbg.WriteCid(w, t.BlsMessages); err != nil { return xerrors.Errorf("failed to write cid field t.BlsMessages: %w", err) } - // t.t.SecpkMessages (cid.Cid) (struct) + // t.SecpkMessages (cid.Cid) (struct) if err := cbg.WriteCid(w, t.SecpkMessages); err != nil { return xerrors.Errorf("failed to write cid field t.SecpkMessages: %w", err) @@ -773,7 +775,7 @@ func (t *MsgMeta) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.BlsMessages (cid.Cid) (struct) + // t.BlsMessages (cid.Cid) (struct) { @@ -785,7 +787,7 @@ func (t *MsgMeta) UnmarshalCBOR(r io.Reader) error { t.BlsMessages = c } - // t.t.SecpkMessages (cid.Cid) (struct) + // t.SecpkMessages (cid.Cid) (struct) { @@ -809,12 +811,12 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - // t.t.TimeLock (uint64) (uint64) + // t.TimeLock (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.TimeLock))); err != nil { return err } - // t.t.SecretPreimage ([]uint8) (slice) + // t.SecretPreimage ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.SecretPreimage)))); err != nil { return err } @@ -822,32 +824,32 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { return err } - // t.t.Extra (types.ModVerifyParams) (struct) + // t.Extra (types.ModVerifyParams) (struct) if err := t.Extra.MarshalCBOR(w); err != nil { return err } - // t.t.Lane (uint64) (uint64) + // t.Lane (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Lane))); err != nil { return err } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } - // t.t.Amount (types.BigInt) (struct) + // t.Amount (types.BigInt) (struct) if err := t.Amount.MarshalCBOR(w); err != nil { return err } - // t.t.MinCloseHeight (uint64) (uint64) + // t.MinCloseHeight (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.MinCloseHeight))); err != nil { return err } - // t.t.Merges ([]types.Merge) (slice) + // t.Merges ([]types.Merge) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Merges)))); err != nil { return err } @@ -857,7 +859,7 @@ func (t *SignedVoucher) MarshalCBOR(w io.Writer) error { } } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) if err := t.Signature.MarshalCBOR(w); err != nil { return err } @@ -879,7 +881,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.TimeLock (uint64) (uint64) + // t.TimeLock (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -889,16 +891,16 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.TimeLock = uint64(extra) - // t.t.SecretPreimage ([]uint8) (slice) + // t.SecretPreimage ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.SecretPreimage: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.SecretPreimage: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -906,7 +908,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.SecretPreimage); err != nil { return err } - // t.t.Extra (types.ModVerifyParams) (struct) + // t.Extra (types.ModVerifyParams) (struct) { @@ -927,7 +929,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Lane (uint64) (uint64) + // t.Lane (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -937,7 +939,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Lane = uint64(extra) - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -947,7 +949,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Nonce = uint64(extra) - // t.t.Amount (types.BigInt) (struct) + // t.Amount (types.BigInt) (struct) { @@ -956,7 +958,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { } } - // t.t.MinCloseHeight (uint64) (uint64) + // t.MinCloseHeight (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -966,13 +968,14 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.MinCloseHeight = uint64(extra) - // t.t.Merges ([]types.Merge) (slice) + // t.Merges ([]types.Merge) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -992,7 +995,7 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { t.Merges[i] = v } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) { @@ -1025,17 +1028,17 @@ func (t *ModVerifyParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Actor (address.Address) (struct) + // t.Actor (address.Address) (struct) if err := t.Actor.MarshalCBOR(w); err != nil { return err } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Method))); err != nil { return err } - // t.t.Data ([]uint8) (slice) + // t.Data ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Data)))); err != nil { return err } @@ -1060,7 +1063,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Actor (address.Address) (struct) + // t.Actor (address.Address) (struct) { @@ -1069,7 +1072,7 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Method (uint64) (uint64) + // t.Method (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1079,16 +1082,16 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Method = uint64(extra) - // t.t.Data ([]uint8) (slice) + // t.Data ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Data: array too large (%d)", extra) - } + 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") } @@ -1108,12 +1111,12 @@ func (t *Merge) MarshalCBOR(w io.Writer) error { return err } - // t.t.Lane (uint64) (uint64) + // t.Lane (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Lane))); err != nil { return err } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } @@ -1135,7 +1138,7 @@ func (t *Merge) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Lane (uint64) (uint64) + // t.Lane (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1145,7 +1148,7 @@ func (t *Merge) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Lane = uint64(extra) - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1167,24 +1170,24 @@ func (t *Actor) MarshalCBOR(w io.Writer) error { return err } - // t.t.Code (cid.Cid) (struct) + // t.Code (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Code); err != nil { return xerrors.Errorf("failed to write cid field t.Code: %w", err) } - // t.t.Head (cid.Cid) (struct) + // t.Head (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Head); err != nil { return xerrors.Errorf("failed to write cid field t.Head: %w", err) } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } - // t.t.Balance (types.BigInt) (struct) + // t.Balance (types.BigInt) (struct) if err := t.Balance.MarshalCBOR(w); err != nil { return err } @@ -1206,7 +1209,7 @@ func (t *Actor) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Code (cid.Cid) (struct) + // t.Code (cid.Cid) (struct) { @@ -1218,7 +1221,7 @@ func (t *Actor) UnmarshalCBOR(r io.Reader) error { t.Code = c } - // t.t.Head (cid.Cid) (struct) + // t.Head (cid.Cid) (struct) { @@ -1230,7 +1233,7 @@ func (t *Actor) UnmarshalCBOR(r io.Reader) error { t.Head = c } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1240,7 +1243,7 @@ func (t *Actor) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Nonce = uint64(extra) - // t.t.Balance (types.BigInt) (struct) + // t.Balance (types.BigInt) (struct) { @@ -1261,12 +1264,12 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error { return err } - // t.t.ExitCode (uint8) (uint8) + // t.ExitCode (uint8) (uint8) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ExitCode))); err != nil { return err } - // t.t.Return ([]uint8) (slice) + // t.Return ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Return)))); err != nil { return err } @@ -1274,7 +1277,7 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error { return err } - // t.t.GasUsed (types.BigInt) (struct) + // t.GasUsed (types.BigInt) (struct) if err := t.GasUsed.MarshalCBOR(w); err != nil { return err } @@ -1296,7 +1299,7 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.ExitCode (uint8) (uint8) + // t.ExitCode (uint8) (uint8) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1309,16 +1312,16 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("integer in input was too large for uint8 field") } t.ExitCode = uint8(extra) - // t.t.Return ([]uint8) (slice) + // t.Return ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Return: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Return: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -1326,7 +1329,7 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Return); err != nil { return err } - // t.t.GasUsed (types.BigInt) (struct) + // t.GasUsed (types.BigInt) (struct) { @@ -1347,12 +1350,12 @@ func (t *BlockMsg) MarshalCBOR(w io.Writer) error { return err } - // t.t.Header (types.BlockHeader) (struct) + // t.Header (types.BlockHeader) (struct) if err := t.Header.MarshalCBOR(w); err != nil { return err } - // t.t.BlsMessages ([]cid.Cid) (slice) + // t.BlsMessages ([]cid.Cid) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMessages)))); err != nil { return err } @@ -1362,7 +1365,7 @@ func (t *BlockMsg) MarshalCBOR(w io.Writer) error { } } - // t.t.SecpkMessages ([]cid.Cid) (slice) + // t.SecpkMessages ([]cid.Cid) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMessages)))); err != nil { return err } @@ -1389,7 +1392,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Header (types.BlockHeader) (struct) + // t.Header (types.BlockHeader) (struct) { @@ -1410,13 +1413,14 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error { } } - // t.t.BlsMessages ([]cid.Cid) (slice) + // t.BlsMessages ([]cid.Cid) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) } @@ -1435,13 +1439,14 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error { t.BlsMessages[i] = c } - // t.t.SecpkMessages ([]cid.Cid) (slice) + // t.SecpkMessages ([]cid.Cid) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) } @@ -1472,12 +1477,12 @@ func (t *SignedStorageAsk) MarshalCBOR(w io.Writer) error { return err } - // t.t.Ask (types.StorageAsk) (struct) + // t.Ask (types.StorageAsk) (struct) if err := t.Ask.MarshalCBOR(w); err != nil { return err } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) if err := t.Signature.MarshalCBOR(w); err != nil { return err } @@ -1499,7 +1504,7 @@ func (t *SignedStorageAsk) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Ask (types.StorageAsk) (struct) + // t.Ask (types.StorageAsk) (struct) { @@ -1520,7 +1525,7 @@ func (t *SignedStorageAsk) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Signature (types.Signature) (struct) + // t.Signature (types.Signature) (struct) { @@ -1553,32 +1558,32 @@ func (t *StorageAsk) MarshalCBOR(w io.Writer) error { return err } - // t.t.Price (types.BigInt) (struct) + // t.Price (types.BigInt) (struct) if err := t.Price.MarshalCBOR(w); err != nil { return err } - // t.t.MinPieceSize (uint64) (uint64) + // t.MinPieceSize (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.MinPieceSize))); err != nil { return err } - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) if err := t.Miner.MarshalCBOR(w); err != nil { return err } - // t.t.Timestamp (uint64) (uint64) + // t.Timestamp (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Timestamp))); err != nil { return err } - // t.t.Expiry (uint64) (uint64) + // t.Expiry (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Expiry))); err != nil { return err } - // t.t.SeqNo (uint64) (uint64) + // t.SeqNo (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SeqNo))); err != nil { return err } @@ -1600,7 +1605,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Price (types.BigInt) (struct) + // t.Price (types.BigInt) (struct) { @@ -1609,7 +1614,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { } } - // t.t.MinPieceSize (uint64) (uint64) + // t.MinPieceSize (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1619,7 +1624,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.MinPieceSize = uint64(extra) - // t.t.Miner (address.Address) (struct) + // t.Miner (address.Address) (struct) { @@ -1628,7 +1633,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Timestamp (uint64) (uint64) + // t.Timestamp (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1638,7 +1643,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Timestamp = uint64(extra) - // t.t.Expiry (uint64) (uint64) + // t.Expiry (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1648,7 +1653,7 @@ func (t *StorageAsk) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Expiry = uint64(extra) - // t.t.SeqNo (uint64) (uint64) + // t.SeqNo (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -1670,7 +1675,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { return err } - // t.t.Cids ([]cid.Cid) (slice) + // t.Cids ([]cid.Cid) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Cids)))); err != nil { return err } @@ -1680,7 +1685,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.Blocks ([]*types.BlockHeader) (slice) + // t.Blocks ([]*types.BlockHeader) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Blocks)))); err != nil { return err } @@ -1690,7 +1695,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error { } } - // t.t.Height (uint64) (uint64) + // t.Height (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Height))); err != nil { return err } @@ -1712,13 +1717,14 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Cids ([]cid.Cid) (slice) + // t.Cids ([]cid.Cid) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Cids: array too large (%d)", extra) } @@ -1737,13 +1743,14 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error { t.Cids[i] = c } - // t.t.Blocks ([]*types.BlockHeader) (slice) + // t.Blocks ([]*types.BlockHeader) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Blocks: array too large (%d)", extra) } @@ -1763,7 +1770,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error { t.Blocks[i] = &v } - // t.t.Height (uint64) (uint64) + // t.Height (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { diff --git a/gen/main.go b/gen/main.go index 8fd251eb7..76d87a49b 100644 --- a/gen/main.go +++ b/gen/main.go @@ -49,7 +49,7 @@ func main() { os.Exit(1) } - err = gen.WriteTupleEncodersToFile("./api/cbor_gen.go", "api", + err = gen.WriteMapEncodersToFile("./api/cbor_gen.go", "api", api.PaymentInfo{}, api.SealedRef{}, api.SealedRefs{}, @@ -154,7 +154,7 @@ func main() { os.Exit(1) } - err = gen.WriteTupleEncodersToFile("./storage/cbor_gen.go", "storage", + err = gen.WriteMapEncodersToFile("./storage/cbor_gen.go", "storage", storage.SealTicket{}, storage.SealSeed{}, storage.Piece{}, diff --git a/go.mod b/go.mod index 66f4a3b59..1dfb070ee 100644 --- a/go.mod +++ b/go.mod @@ -86,7 +86,7 @@ require ( github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect github.com/stretchr/testify v1.4.0 github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba - github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d + github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d go.opencensus.io v0.22.1 diff --git a/go.sum b/go.sum index a2d1f8286..9edc75a8c 100644 --- a/go.sum +++ b/go.sum @@ -586,6 +586,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20190910031516-c1cbffdb01bb/go.mod h1:x github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa h1:iuIvC21JR4TcHtdCtkXz2jG8KCAK9ZJQQQxbDkFxkNE= +github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 2b3a0352e..a31bd07a9 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -167,7 +167,7 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid uint64) (api.S Deals: deals, Ticket: info.Ticket.SB(), Seed: info.Seed.SB(), - Retries: info.Nonce, + Retries: info.Nonce, LastErr: info.LastErr, }, nil diff --git a/paych/cbor_gen.go b/paych/cbor_gen.go index e640f3057..b281bc755 100644 --- a/paych/cbor_gen.go +++ b/paych/cbor_gen.go @@ -22,12 +22,12 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Voucher (types.SignedVoucher) (struct) + // t.Voucher (types.SignedVoucher) (struct) if err := t.Voucher.MarshalCBOR(w); err != nil { return err } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -52,7 +52,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Voucher (types.SignedVoucher) (struct) + // t.Voucher (types.SignedVoucher) (struct) { @@ -73,16 +73,16 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -102,27 +102,27 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Channel (address.Address) (struct) + // t.Channel (address.Address) (struct) if err := t.Channel.MarshalCBOR(w); err != nil { return err } - // t.t.Control (address.Address) (struct) + // t.Control (address.Address) (struct) if err := t.Control.MarshalCBOR(w); err != nil { return err } - // t.t.Target (address.Address) (struct) + // t.Target (address.Address) (struct) if err := t.Target.MarshalCBOR(w); err != nil { return err } - // t.t.Direction (uint64) (uint64) + // t.Direction (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Direction))); err != nil { return err } - // t.t.Vouchers ([]*paych.VoucherInfo) (slice) + // t.Vouchers ([]*paych.VoucherInfo) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil { return err } @@ -132,7 +132,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.NextLane (uint64) (uint64) + // t.NextLane (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextLane))); err != nil { return err } @@ -154,7 +154,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Channel (address.Address) (struct) + // t.Channel (address.Address) (struct) { @@ -163,7 +163,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Control (address.Address) (struct) + // t.Control (address.Address) (struct) { @@ -172,7 +172,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Target (address.Address) (struct) + // t.Target (address.Address) (struct) { @@ -181,7 +181,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Direction (uint64) (uint64) + // t.Direction (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -191,13 +191,14 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Direction = uint64(extra) - // t.t.Vouchers ([]*paych.VoucherInfo) (slice) + // t.Vouchers ([]*paych.VoucherInfo) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -217,7 +218,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error { t.Vouchers[i] = &v } - // t.t.NextLane (uint64) (uint64) + // t.NextLane (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { diff --git a/retrieval/cbor_gen.go b/retrieval/cbor_gen.go index 3feb15dd1..f7a6279a9 100644 --- a/retrieval/cbor_gen.go +++ b/retrieval/cbor_gen.go @@ -21,7 +21,7 @@ func (t *RetParams) MarshalCBOR(w io.Writer) error { return err } - // t.t.Unixfs0 (retrieval.Unixfs0Offer) (struct) + // t.Unixfs0 (retrieval.Unixfs0Offer) (struct) if err := t.Unixfs0.MarshalCBOR(w); err != nil { return err } @@ -43,7 +43,7 @@ func (t *RetParams) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Unixfs0 (retrieval.Unixfs0Offer) (struct) + // t.Unixfs0 (retrieval.Unixfs0Offer) (struct) { @@ -76,7 +76,7 @@ func (t *Query) MarshalCBOR(w io.Writer) error { return err } - // t.t.Piece (cid.Cid) (struct) + // t.Piece (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Piece); err != nil { return xerrors.Errorf("failed to write cid field t.Piece: %w", err) @@ -100,7 +100,7 @@ func (t *Query) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Piece (cid.Cid) (struct) + // t.Piece (cid.Cid) (struct) { @@ -124,17 +124,17 @@ func (t *QueryResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.Status (retrieval.QueryResponseStatus) (uint64) + // t.Status (retrieval.QueryResponseStatus) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { return err } - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { return err } - // t.t.MinPrice (types.BigInt) (struct) + // t.MinPrice (types.BigInt) (struct) if err := t.MinPrice.MarshalCBOR(w); err != nil { return err } @@ -156,7 +156,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Status (retrieval.QueryResponseStatus) (uint64) + // t.Status (retrieval.QueryResponseStatus) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -166,7 +166,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Status = QueryResponseStatus(extra) - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -176,7 +176,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Size = uint64(extra) - // t.t.MinPrice (types.BigInt) (struct) + // t.MinPrice (types.BigInt) (struct) { @@ -197,12 +197,12 @@ func (t *Unixfs0Offer) MarshalCBOR(w io.Writer) error { return err } - // t.t.Offset (uint64) (uint64) + // t.Offset (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil { return err } - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { return err } @@ -224,7 +224,7 @@ func (t *Unixfs0Offer) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Offset (uint64) (uint64) + // t.Offset (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -234,7 +234,7 @@ func (t *Unixfs0Offer) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Offset = uint64(extra) - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -256,18 +256,18 @@ func (t *DealProposal) MarshalCBOR(w io.Writer) error { return err } - // t.t.Payment (api.PaymentInfo) (struct) + // t.Payment (api.PaymentInfo) (struct) if err := t.Payment.MarshalCBOR(w); err != nil { return err } - // t.t.Ref (cid.Cid) (struct) + // t.Ref (cid.Cid) (struct) if err := cbg.WriteCid(w, t.Ref); err != nil { return xerrors.Errorf("failed to write cid field t.Ref: %w", err) } - // t.t.Params (retrieval.RetParams) (struct) + // t.Params (retrieval.RetParams) (struct) if err := t.Params.MarshalCBOR(w); err != nil { return err } @@ -289,7 +289,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Payment (api.PaymentInfo) (struct) + // t.Payment (api.PaymentInfo) (struct) { @@ -298,7 +298,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Ref (cid.Cid) (struct) + // t.Ref (cid.Cid) (struct) { @@ -310,7 +310,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error { t.Ref = c } - // t.t.Params (retrieval.RetParams) (struct) + // t.Params (retrieval.RetParams) (struct) { @@ -331,12 +331,12 @@ func (t *DealResponse) MarshalCBOR(w io.Writer) error { return err } - // t.t.Status (uint64) (uint64) + // t.Status (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { return err } - // t.t.Message (string) (string) + // t.Message (string) (string) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { return err } @@ -361,7 +361,7 @@ func (t *DealResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Status (uint64) (uint64) + // t.Status (uint64) (uint64) maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -371,7 +371,7 @@ func (t *DealResponse) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Status = uint64(extra) - // t.t.Message (string) (string) + // t.Message (string) (string) { sval, err := cbg.ReadString(br) @@ -393,7 +393,7 @@ func (t *Block) MarshalCBOR(w io.Writer) error { return err } - // t.t.Prefix ([]uint8) (slice) + // t.Prefix ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Prefix)))); err != nil { return err } @@ -401,7 +401,7 @@ func (t *Block) MarshalCBOR(w io.Writer) error { return err } - // t.t.Data ([]uint8) (slice) + // t.Data ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Data)))); err != nil { return err } @@ -426,16 +426,16 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.Prefix ([]uint8) (slice) + // t.Prefix ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Prefix: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Prefix: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -443,16 +443,16 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Prefix); err != nil { return err } - // t.t.Data ([]uint8) (slice) + // t.Data ([]uint8) (slice) maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Data: array too large (%d)", extra) - } + 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") } diff --git a/storage/cbor_gen.go b/storage/cbor_gen.go index 7baef0f08..207747b6b 100644 --- a/storage/cbor_gen.go +++ b/storage/cbor_gen.go @@ -17,16 +17,30 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{130}); err != nil { + if _, err := w.Write([]byte{162}); err != nil { + return err + } + + // t.BlockHeight (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("BlockHeight")))); err != nil { + return err + } + if _, err := w.Write([]byte("BlockHeight")); err != nil { return err } - // t.t.BlockHeight (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil { return err } - // t.t.TicketBytes ([]uint8) (slice) + // t.TicketBytes ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("TicketBytes")))); err != nil { + return err + } + if _, err := w.Write([]byte("TicketBytes")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil { return err } @@ -43,15 +57,30 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 2 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.BlockHeight (uint64) (uint64) + var name string + + // t.BlockHeight (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "BlockHeight" { + return fmt.Errorf("expected struct map entry %s to be BlockHeight", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -61,16 +90,29 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.BlockHeight = uint64(extra) - // t.t.TicketBytes ([]uint8) (slice) + // t.TicketBytes ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "TicketBytes" { + return fmt.Errorf("expected struct map entry %s to be TicketBytes", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.TicketBytes: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -86,16 +128,30 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{130}); err != nil { + if _, err := w.Write([]byte{162}); err != nil { + return err + } + + // t.BlockHeight (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("BlockHeight")))); err != nil { + return err + } + if _, err := w.Write([]byte("BlockHeight")); err != nil { return err } - // t.t.BlockHeight (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil { return err } - // t.t.TicketBytes ([]uint8) (slice) + // t.TicketBytes ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("TicketBytes")))); err != nil { + return err + } + if _, err := w.Write([]byte("TicketBytes")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil { return err } @@ -112,15 +168,30 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 2 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.BlockHeight (uint64) (uint64) + var name string + + // t.BlockHeight (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "BlockHeight" { + return fmt.Errorf("expected struct map entry %s to be BlockHeight", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -130,16 +201,29 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.BlockHeight = uint64(extra) - // t.t.TicketBytes ([]uint8) (slice) + // t.TicketBytes ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "TicketBytes" { + return fmt.Errorf("expected struct map entry %s to be TicketBytes", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.TicketBytes: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -155,21 +239,42 @@ func (t *Piece) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{131}); err != nil { + if _, err := w.Write([]byte{163}); err != nil { + return err + } + + // t.DealID (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("DealID")))); err != nil { + return err + } + if _, err := w.Write([]byte("DealID")); err != nil { return err } - // t.t.DealID (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { return err } - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Size")))); err != nil { + return err + } + if _, err := w.Write([]byte("Size")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { return err } - // t.t.CommP ([]uint8) (slice) + // t.CommP ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommP")))); err != nil { + return err + } + if _, err := w.Write([]byte("CommP")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommP)))); err != nil { return err } @@ -186,15 +291,30 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } if extra != 3 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.DealID (uint64) (uint64) + var name string + + // t.DealID (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "DealID" { + return fmt.Errorf("expected struct map entry %s to be DealID", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -204,7 +324,20 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.DealID = uint64(extra) - // t.t.Size (uint64) (uint64) + // t.Size (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Size" { + return fmt.Errorf("expected struct map entry %s to be Size", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -214,16 +347,29 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Size = uint64(extra) - // t.t.CommP ([]uint8) (slice) + // t.CommP ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "CommP" { + return fmt.Errorf("expected struct map entry %s to be CommP", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.CommP: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.CommP: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -239,26 +385,54 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { _, err := w.Write(cbg.CborNull) return err } - if _, err := w.Write([]byte{142}); err != nil { + if _, err := w.Write([]byte{172}); err != nil { + return err + } + + // t.State (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("State")))); err != nil { + return err + } + if _, err := w.Write([]byte("State")); err != nil { return err } - // t.t.State (uint64) (uint64) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { return err } - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorID")))); err != nil { + return err + } + if _, err := w.Write([]byte("SectorID")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { return err } - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Nonce")))); err != nil { + return err + } + if _, err := w.Write([]byte("Nonce")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { return err } - // t.t.Pieces ([]storage.Piece) (slice) + // t.Pieces ([]storage.Piece) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Pieces")))); err != nil { + return err + } + if _, err := w.Write([]byte("Pieces")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Pieces)))); err != nil { return err } @@ -268,15 +442,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.Pad0 ([]uint8) (slice) - if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Pad0)))); err != nil { + // t.CommD ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommD")))); err != nil { return err } - if _, err := w.Write(t.Pad0); err != nil { + if _, err := w.Write([]byte("CommD")); err != nil { return err } - // t.t.CommD ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommD)))); err != nil { return err } @@ -284,7 +457,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.CommR ([]uint8) (slice) + // t.CommR ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommR")))); err != nil { + return err + } + if _, err := w.Write([]byte("CommR")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommR)))); err != nil { return err } @@ -292,15 +472,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Pad1 ([]uint8) (slice) - if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Pad1)))); err != nil { + // t.Proof ([]uint8) (slice) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Proof")))); err != nil { return err } - if _, err := w.Write(t.Pad1); err != nil { + if _, err := w.Write([]byte("Proof")); err != nil { return err } - // t.t.Proof ([]uint8) (slice) if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { return err } @@ -308,12 +487,25 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.t.Ticket (storage.SealTicket) (struct) + // t.Ticket (storage.SealTicket) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Ticket")))); err != nil { + return err + } + if _, err := w.Write([]byte("Ticket")); err != nil { + return err + } + if err := t.Ticket.MarshalCBOR(w); err != nil { return err } - // t.t.PreCommitMessage (cid.Cid) (struct) + // t.PreCommitMessage (cid.Cid) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("PreCommitMessage")))); err != nil { + return err + } + if _, err := w.Write([]byte("PreCommitMessage")); err != nil { + return err + } if t.PreCommitMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -325,12 +517,25 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.Seed (storage.SealSeed) (struct) + // t.Seed (storage.SealSeed) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Seed")))); err != nil { + return err + } + if _, err := w.Write([]byte("Seed")); err != nil { + return err + } + if err := t.Seed.MarshalCBOR(w); err != nil { return err } - // t.t.CommitMessage (cid.Cid) (struct) + // t.CommitMessage (cid.Cid) (struct) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommitMessage")))); err != nil { + return err + } + if _, err := w.Write([]byte("CommitMessage")); err != nil { + return err + } if t.CommitMessage == nil { if _, err := w.Write(cbg.CborNull); err != nil { @@ -342,7 +547,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.t.LastErr (string) (string) + // t.LastErr (string) (string) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("LastErr")))); err != nil { + return err + } + if _, err := w.Write([]byte("LastErr")); err != nil { + return err + } + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.LastErr)))); err != nil { return err } @@ -359,15 +571,30 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if maj != cbg.MajArray { - return fmt.Errorf("cbor input should be of type array") + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") } - if extra != 14 { + if extra != 12 { return fmt.Errorf("cbor input had wrong number of fields") } - // t.t.State (uint64) (uint64) + var name string + + // t.State (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "State" { + return fmt.Errorf("expected struct map entry %s to be State", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -377,7 +604,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.State = uint64(extra) - // t.t.SectorID (uint64) (uint64) + // t.SectorID (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "SectorID" { + return fmt.Errorf("expected struct map entry %s to be SectorID", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -387,7 +627,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.SectorID = uint64(extra) - // t.t.Nonce (uint64) (uint64) + // t.Nonce (uint64) (uint64) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Nonce" { + return fmt.Errorf("expected struct map entry %s to be Nonce", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { @@ -397,13 +650,27 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("wrong type for uint64 field") } t.Nonce = uint64(extra) - // t.t.Pieces ([]storage.Piece) (slice) + // t.Pieces ([]storage.Piece) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Pieces" { + return fmt.Errorf("expected struct map entry %s to be Pieces", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Pieces: array too large (%d)", extra) } @@ -423,33 +690,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { t.Pieces[i] = v } - // t.t.Pad0 ([]uint8) (slice) + // t.CommD ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "CommD" { + return fmt.Errorf("expected struct map entry %s to be CommD", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Pad0: array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.CommD: byte array too large (%d)", extra) } - t.Pad0 = make([]byte, extra) - if _, err := io.ReadFull(br, t.Pad0); err != nil { - return err - } - // t.t.CommD ([]uint8) (slice) - - maj, extra, err = cbg.CborReadHeader(br) - if err != nil { - return err - } - if extra > 8192 { - return fmt.Errorf("t.CommD: array too large (%d)", extra) - } - if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -457,16 +720,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.CommD); err != nil { return err } - // t.t.CommR ([]uint8) (slice) + // t.CommR ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "CommR" { + return fmt.Errorf("expected struct map entry %s to be CommR", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.CommR: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.CommR: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -474,33 +750,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.CommR); err != nil { return err } - // t.t.Pad1 ([]uint8) (slice) + // t.Proof ([]uint8) (slice) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Proof" { + return fmt.Errorf("expected struct map entry %s to be Proof", name) + } maj, extra, err = cbg.CborReadHeader(br) if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Pad1: array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) } - t.Pad1 = make([]byte, extra) - if _, err := io.ReadFull(br, t.Pad1); err != nil { - return err - } - // t.t.Proof ([]uint8) (slice) - - maj, extra, err = cbg.CborReadHeader(br) - if err != nil { - return err - } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } - if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -508,7 +780,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { if _, err := io.ReadFull(br, t.Proof); err != nil { return err } - // t.t.Ticket (storage.SealTicket) (struct) + // t.Ticket (storage.SealTicket) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Ticket" { + return fmt.Errorf("expected struct map entry %s to be Ticket", name) + } { @@ -517,7 +802,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.PreCommitMessage (cid.Cid) (struct) + // t.PreCommitMessage (cid.Cid) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "PreCommitMessage" { + return fmt.Errorf("expected struct map entry %s to be PreCommitMessage", name) + } { @@ -541,7 +839,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.Seed (storage.SealSeed) (struct) + // t.Seed (storage.SealSeed) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "Seed" { + return fmt.Errorf("expected struct map entry %s to be Seed", name) + } { @@ -550,7 +861,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.CommitMessage (cid.Cid) (struct) + // t.CommitMessage (cid.Cid) (struct) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "CommitMessage" { + return fmt.Errorf("expected struct map entry %s to be CommitMessage", name) + } { @@ -574,7 +898,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error { } } - // t.t.LastErr (string) (string) + // t.LastErr (string) (string) + + { + sval, err := cbg.ReadString(br) + if err != nil { + return err + } + + name = string(sval) + } + + if name != "LastErr" { + return fmt.Errorf("expected struct map entry %s to be LastErr", name) + } { sval, err := cbg.ReadString(br)