diff --git a/.circleci/template.yml b/.circleci/template.yml index 133984c3916..32f50c161de 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -7,12 +7,12 @@ executors: golang: docker: # Must match GO_VERSION_MIN in project root - - image: cimg/go:1.18.8 + - image: cimg/go:1.19.7 resource_class: medium+ golang-2xl: docker: # Must match GO_VERSION_MIN in project root - - image: cimg/go:1.18.8 + - image: cimg/go:1.19.7 resource_class: 2xlarge ubuntu: docker: diff --git a/api/api_storage.go b/api/api_storage.go index fab047a143c..9e65c1ced7d 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -212,9 +212,11 @@ type StorageMiner interface { StorageDetachLocal(ctx context.Context, path string) error //perm:admin StorageRedeclareLocal(ctx context.Context, id *storiface.ID, dropMissing bool) error //perm:admin - MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write - MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read - MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) //perm:read + MarketImportDealData(ctx context.Context, propcid cid.Cid, path string) error //perm:write + MarketListDeals(ctx context.Context) ([]*MarketDeal, error) //perm:read + + // MarketListRetrievalDeals is deprecated, returns empty list + MarketListRetrievalDeals(ctx context.Context) ([]struct{}, error) //perm:read MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) //perm:read MarketListIncompleteDeals(ctx context.Context) ([]storagemarket.MinerDeal, error) //perm:read MarketSetAsk(ctx context.Context, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin diff --git a/api/cbor_gen.go b/api/cbor_gen.go index efa1cd1a15a..80392b2127b 100644 --- a/api/cbor_gen.go +++ b/api/cbor_gen.go @@ -50,22 +50,6 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { return err } - // t.WaitSentinel (cid.Cid) (struct) - if len("WaitSentinel") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"WaitSentinel\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("WaitSentinel")); err != nil { - return err - } - - if err := cbg.WriteCid(cw, t.WaitSentinel); err != nil { - return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err) - } - // t.Vouchers ([]*paych.SignedVoucher) (slice) if len("Vouchers") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Vouchers\" was too long") @@ -90,6 +74,23 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error { return err } } + + // t.WaitSentinel (cid.Cid) (struct) + if len("WaitSentinel") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"WaitSentinel\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("WaitSentinel")); err != nil { + return err + } + + if err := cbg.WriteCid(cw, t.WaitSentinel); err != nil { + return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err) + } + return nil } @@ -140,19 +141,6 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) { return xerrors.Errorf("unmarshaling t.Channel: %w", err) } - } - // t.WaitSentinel (cid.Cid) (struct) - case "WaitSentinel": - - { - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err) - } - - t.WaitSentinel = c - } // t.Vouchers ([]*paych.SignedVoucher) (slice) case "Vouchers": @@ -184,6 +172,20 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Vouchers[i] = &v } + // t.WaitSentinel (cid.Cid) (struct) + case "WaitSentinel": + + { + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err) + } + + t.WaitSentinel = c + + } + default: // Field doesn't exist on this type, so ignore it cbg.ScanForLinks(r, func(cid.Cid) {}) @@ -204,19 +206,19 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { return err } - // t.SectorID (abi.SectorNumber) (uint64) - if len("SectorID") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"SectorID\" was too long") + // t.Size (abi.UnpaddedPieceSize) (uint64) + if len("Size") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Size\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorID"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Size"))); err != nil { return err } - if _, err := io.WriteString(w, string("SectorID")); err != nil { + if _, err := io.WriteString(w, string("Size")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { return err } @@ -236,19 +238,19 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error { return err } - // t.Size (abi.UnpaddedPieceSize) (uint64) - if len("Size") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Size\" was too long") + // t.SectorID (abi.SectorNumber) (uint64) + if len("SectorID") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"SectorID\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Size"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorID"))); err != nil { return err } - if _, err := io.WriteString(w, string("Size")); err != nil { + if _, err := io.WriteString(w, string("SectorID")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil { return err } @@ -293,8 +295,8 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.SectorID (abi.SectorNumber) (uint64) - case "SectorID": + // t.Size (abi.UnpaddedPieceSize) (uint64) + case "Size": { @@ -305,7 +307,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.SectorID = abi.SectorNumber(extra) + t.Size = abi.UnpaddedPieceSize(extra) } // t.Offset (abi.PaddedPieceSize) (uint64) @@ -323,8 +325,8 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) { t.Offset = abi.PaddedPieceSize(extra) } - // t.Size (abi.UnpaddedPieceSize) (uint64) - case "Size": + // t.SectorID (abi.SectorNumber) (uint64) + case "SectorID": { @@ -335,7 +337,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.Size = abi.UnpaddedPieceSize(extra) + t.SectorID = abi.SectorNumber(extra) } @@ -474,6 +476,28 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { return err } + // t.Epoch (abi.ChainEpoch) (int64) + if len("Epoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Epoch\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("Epoch")); err != nil { + return err + } + + if t.Epoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil { + return err + } + } + // t.Value (abi.SealRandomness) (slice) if len("Value") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Value\" was too long") @@ -497,28 +521,6 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error { if _, err := cw.Write(t.Value[:]); err != nil { return err } - - // t.Epoch (abi.ChainEpoch) (int64) - if len("Epoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Epoch\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("Epoch")); err != nil { - return err - } - - if t.Epoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil { - return err - } - } return nil } @@ -560,29 +562,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Value (abi.SealRandomness) (slice) - case "Value": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Value: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.Value = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.Value[:]); err != nil { - return err - } - // t.Epoch (abi.ChainEpoch) (int64) + // t.Epoch (abi.ChainEpoch) (int64) case "Epoch": { maj, extra, err := cr.ReadHeader() @@ -599,7 +579,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -608,6 +588,28 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) { t.Epoch = abi.ChainEpoch(extraI) } + // t.Value (abi.SealRandomness) (slice) + case "Value": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Value: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Value = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Value[:]); err != nil { + return err + } default: // Field doesn't exist on this type, so ignore it @@ -629,6 +631,28 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { return err } + // t.Epoch (abi.ChainEpoch) (int64) + if len("Epoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Epoch\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("Epoch")); err != nil { + return err + } + + if t.Epoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil { + return err + } + } + // t.Value (abi.InteractiveSealRandomness) (slice) if len("Value") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Value\" was too long") @@ -652,28 +676,6 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error { if _, err := cw.Write(t.Value[:]); err != nil { return err } - - // t.Epoch (abi.ChainEpoch) (int64) - if len("Epoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Epoch\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("Epoch")); err != nil { - return err - } - - if t.Epoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil { - return err - } - } return nil } @@ -715,29 +717,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Value (abi.InteractiveSealRandomness) (slice) - case "Value": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Value: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.Value = make([]uint8, extra) - } - - if _, err := io.ReadFull(cr, t.Value[:]); err != nil { - return err - } - // t.Epoch (abi.ChainEpoch) (int64) + // t.Epoch (abi.ChainEpoch) (int64) case "Epoch": { maj, extra, err := cr.ReadHeader() @@ -754,7 +734,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -763,6 +743,28 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) { t.Epoch = abi.ChainEpoch(extraI) } + // t.Value (abi.InteractiveSealRandomness) (slice) + case "Value": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Value: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.Value = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Value[:]); err != nil { + return err + } default: // Field doesn't exist on this type, so ignore it @@ -784,6 +786,22 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { return err } + // t.DealID (abi.DealID) (uint64) + if len("DealID") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"DealID\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealID"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("DealID")); err != nil { + return err + } + + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.DealID)); err != nil { + return err + } + // t.PublishCid (cid.Cid) (struct) if len("PublishCid") > cbg.MaxLength { return xerrors.Errorf("Value in field \"PublishCid\" was too long") @@ -806,22 +824,6 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error { } } - // t.DealID (abi.DealID) (uint64) - if len("DealID") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"DealID\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealID"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("DealID")); err != nil { - return err - } - - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.DealID)); err != nil { - return err - } - // t.DealProposal (market.DealProposal) (struct) if len("DealProposal") > cbg.MaxLength { return xerrors.Errorf("Value in field \"DealProposal\" was too long") @@ -910,7 +912,22 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.PublishCid (cid.Cid) (struct) + // t.DealID (abi.DealID) (uint64) + case "DealID": + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.DealID = abi.DealID(extra) + + } + // t.PublishCid (cid.Cid) (struct) case "PublishCid": { @@ -932,21 +949,6 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) { t.PublishCid = &c } - } - // t.DealID (abi.DealID) (uint64) - case "DealID": - - { - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.DealID = abi.DealID(extra) - } // t.DealProposal (market.DealProposal) (struct) case "DealProposal": @@ -1140,46 +1142,46 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error { return err } - // t.StartEpoch (abi.ChainEpoch) (int64) - if len("StartEpoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"StartEpoch\" was too long") + // t.EndEpoch (abi.ChainEpoch) (int64) + if len("EndEpoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"EndEpoch\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartEpoch"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("EndEpoch"))); err != nil { return err } - if _, err := io.WriteString(w, string("StartEpoch")); err != nil { + if _, err := io.WriteString(w, string("EndEpoch")); err != nil { return err } - if t.StartEpoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil { + if t.EndEpoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.EndEpoch)); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.EndEpoch-1)); err != nil { return err } } - // t.EndEpoch (abi.ChainEpoch) (int64) - if len("EndEpoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"EndEpoch\" was too long") + // t.StartEpoch (abi.ChainEpoch) (int64) + if len("StartEpoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"StartEpoch\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("EndEpoch"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartEpoch"))); err != nil { return err } - if _, err := io.WriteString(w, string("EndEpoch")); err != nil { + if _, err := io.WriteString(w, string("StartEpoch")); err != nil { return err } - if t.EndEpoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.EndEpoch)); err != nil { + if t.StartEpoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.EndEpoch-1)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil { return err } } @@ -1224,8 +1226,8 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.StartEpoch (abi.ChainEpoch) (int64) - case "StartEpoch": + // t.EndEpoch (abi.ChainEpoch) (int64) + case "EndEpoch": { maj, extra, err := cr.ReadHeader() var extraI int64 @@ -1241,17 +1243,17 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.StartEpoch = abi.ChainEpoch(extraI) + t.EndEpoch = abi.ChainEpoch(extraI) } - // t.EndEpoch (abi.ChainEpoch) (int64) - case "EndEpoch": + // t.StartEpoch (abi.ChainEpoch) (int64) + case "StartEpoch": { maj, extra, err := cr.ReadHeader() var extraI int64 @@ -1267,14 +1269,14 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.EndEpoch = abi.ChainEpoch(extraI) + t.StartEpoch = abi.ChainEpoch(extraI) } default: diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 9b0c8c80ca4..aa423c5740f 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -947,7 +947,7 @@ type StorageMinerMethods struct { MarketListIncompleteDeals func(p0 context.Context) ([]storagemarket.MinerDeal, error) `perm:"read"` - MarketListRetrievalDeals func(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) `perm:"read"` + MarketListRetrievalDeals func(p0 context.Context) ([]struct{}, error) `perm:"read"` MarketPendingDeals func(p0 context.Context) (PendingDealInfo, error) `perm:"write"` @@ -5645,15 +5645,15 @@ func (s *StorageMinerStub) MarketListIncompleteDeals(p0 context.Context) ([]stor return *new([]storagemarket.MinerDeal), ErrNotSupported } -func (s *StorageMinerStruct) MarketListRetrievalDeals(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) { +func (s *StorageMinerStruct) MarketListRetrievalDeals(p0 context.Context) ([]struct{}, error) { if s.Internal.MarketListRetrievalDeals == nil { - return *new([]retrievalmarket.ProviderDealState), ErrNotSupported + return *new([]struct{}), ErrNotSupported } return s.Internal.MarketListRetrievalDeals(p0) } -func (s *StorageMinerStub) MarketListRetrievalDeals(p0 context.Context) ([]retrievalmarket.ProviderDealState, error) { - return *new([]retrievalmarket.ProviderDealState), ErrNotSupported +func (s *StorageMinerStub) MarketListRetrievalDeals(p0 context.Context) ([]struct{}, error) { + return *new([]struct{}), ErrNotSupported } func (s *StorageMinerStruct) MarketPendingDeals(p0 context.Context) (PendingDealInfo, error) { diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index b23389baf84..9d872fbdea0 100644 Binary files a/build/openrpc/miner.json.gz and b/build/openrpc/miner.json.gz differ diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index 814482b475e..5006ad0a814 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -12,6 +12,7 @@ import ( "github.com/ipfs/go-cid" blocks "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log/v2" + "github.com/ipni/storetheindex/announce/message" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/connmgr" "github.com/libp2p/go-libp2p/core/peer" @@ -20,7 +21,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-address" - "github.com/ipni/storetheindex/announce/message" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain" diff --git a/chain/sub/incoming_test.go b/chain/sub/incoming_test.go index b44b78e61d8..03f880c581f 100644 --- a/chain/sub/incoming_test.go +++ b/chain/sub/incoming_test.go @@ -9,12 +9,12 @@ import ( "github.com/golang/mock/gomock" "github.com/ipfs/go-cid" blocks "github.com/ipfs/go-libipfs/blocks" + "github.com/ipni/storetheindex/announce/message" pubsub "github.com/libp2p/go-libp2p-pubsub" pb "github.com/libp2p/go-libp2p-pubsub/pb" "github.com/libp2p/go-libp2p/core/peer" "github.com/filecoin-project/go-address" - "github.com/ipni/storetheindex/announce/message" "github.com/filecoin-project/lotus/api/mocks" "github.com/filecoin-project/lotus/chain/types" diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index c22cf3e2024..90d1a14c598 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -340,7 +340,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -618,7 +618,7 @@ func (t *ElectionProof) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -828,7 +828,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -1591,7 +1591,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -2202,7 +2202,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -2227,7 +2227,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -2252,7 +2252,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -2277,7 +2277,7 @@ func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -2534,7 +2534,7 @@ func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: diff --git a/cmd/lotus-miner/info_all.go b/cmd/lotus-miner/info_all.go index 3ec0de9cc42..2cf07385c00 100644 --- a/cmd/lotus-miner/info_all.go +++ b/cmd/lotus-miner/info_all.go @@ -150,11 +150,6 @@ var infoAllCmd = &cli.Command{ } } - fmt.Println("\n#: Retrieval Deals") - if err := retrievalDealsListCmd.Action(cctx); err != nil { - fmt.Println("ERROR: ", err) - } - fmt.Println("\n#: Data Transfers") { fs := &flag.FlagSet{} diff --git a/cmd/lotus-miner/retrieval-deals.go b/cmd/lotus-miner/retrieval-deals.go index abf2b37d364..42b0fa1f6f8 100644 --- a/cmd/lotus-miner/retrieval-deals.go +++ b/cmd/lotus-miner/retrieval-deals.go @@ -3,13 +3,11 @@ package main import ( "fmt" "os" - "sort" "text/tabwriter" "github.com/docker/go-units" "github.com/urfave/cli/v2" - "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/chain/types" @@ -21,7 +19,6 @@ var retrievalDealsCmd = &cli.Command{ Usage: "Manage retrieval deals and related configuration", Subcommands: []*cli.Command{ retrievalDealSelectionCmd, - retrievalDealsListCmd, retrievalSetAskCmd, retrievalGetAskCmd, }, @@ -124,47 +121,6 @@ var retrievalDealSelectionRejectCmd = &cli.Command{ }, } -var retrievalDealsListCmd = &cli.Command{ - Name: "list", - Usage: "List all active retrieval deals for this miner", - Action: func(cctx *cli.Context) error { - api, closer, err := lcli.GetMarketsAPI(cctx) - if err != nil { - return err - } - defer closer() - - deals, err := api.MarketListRetrievalDeals(lcli.DaemonContext(cctx)) - if err != nil { - return err - } - - sort.Slice(deals, func(i, j int) bool { - return deals[i].ID < deals[j].ID - }) - - w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0) - - _, _ = fmt.Fprintf(w, "Receiver\tDealID\tPayload\tState\tPricePerByte\tMessage\n") - - for _, deal := range deals { - payloadCid := deal.PayloadCID.String() - - _, _ = fmt.Fprintf(w, - "%s\t%d\t%s\t%s\t%s\t%s\n", - deal.Receiver.String(), - deal.ID, - "..."+payloadCid[len(payloadCid)-8:], - retrievalmarket.DealStatuses[deal.Status], - deal.PricePerByte.String(), - deal.Message, - ) - } - - return w.Flush() - }, -} - var retrievalSetAskCmd = &cli.Command{ Name: "set-ask", Usage: "Configure the provider's retrieval ask", diff --git a/conformance/chaos/cbor_gen.go b/conformance/chaos/cbor_gen.go index 2deaaa53f57..5da16e16ff5 100644 --- a/conformance/chaos/cbor_gen.go +++ b/conformance/chaos/cbor_gen.go @@ -223,7 +223,7 @@ func (t *CallerValidationArgs) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -712,7 +712,7 @@ func (t *SendReturn) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -812,7 +812,7 @@ func (t *MutateStateArgs) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -907,7 +907,7 @@ func (t *AbortWithArgs) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -1064,7 +1064,7 @@ func (t *InspectRuntimeReturn) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: diff --git a/documentation/en/api-v0-methods-miner.md b/documentation/en/api-v0-methods-miner.md index d18be03f5b9..1a149930502 100644 --- a/documentation/en/api-v0-methods-miner.md +++ b/documentation/en/api-v0-methods-miner.md @@ -1506,6 +1506,7 @@ Response: ``` ### MarketListRetrievalDeals +MarketListRetrievalDeals is deprecated, returns empty list Perms: read @@ -1515,48 +1516,7 @@ Inputs: `null` Response: ```json [ - { - "PayloadCID": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - }, - "ID": 5, - "Selector": { - "Raw": "Ynl0ZSBhcnJheQ==" - }, - "PieceCID": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - }, - "PricePerByte": "0", - "PaymentInterval": 42, - "PaymentIntervalIncrease": 42, - "UnsealPrice": "0", - "StoreID": 42, - "ChannelID": { - "Initiator": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", - "Responder": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", - "ID": 3 - }, - "PieceInfo": { - "PieceCID": { - "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" - }, - "Deals": [ - { - "DealID": 5432, - "SectorID": 9, - "Offset": 1032, - "Length": 1032 - } - ] - }, - "Status": 0, - "Receiver": "12D3KooWGzxzKZYveHXtpG6AsrUJBcWxHBFS2HsEoGTxrMLvKXtf", - "TotalSent": 42, - "FundsReceived": "0", - "Message": "string value", - "CurrentInterval": 42, - "LegacyProtocol": true - } + {} ] ``` diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index cedb422ecec..f3595dcc1dc 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -839,7 +839,6 @@ USAGE: COMMANDS: selection Configure acceptance criteria for retrieval deal proposals - list List all active retrieval deals for this miner set-ask Configure the provider's retrieval ask get-ask Get the provider's current retrieval ask configured by the provider in the ask-store using the set-ask CLI command help, h Shows a list of commands or help for one command @@ -908,19 +907,6 @@ OPTIONS: ``` -### lotus-miner retrieval-deals list -``` -NAME: - lotus-miner retrieval-deals list - List all active retrieval deals for this miner - -USAGE: - lotus-miner retrieval-deals list [command options] [arguments...] - -OPTIONS: - --help, -h show help (default: false) - -``` - ### lotus-miner retrieval-deals set-ask ``` NAME: diff --git a/node/hello/cbor_gen.go b/node/hello/cbor_gen.go index 81a1774c17e..5b0697f556c 100644 --- a/node/hello/cbor_gen.go +++ b/node/hello/cbor_gen.go @@ -140,7 +140,7 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -250,7 +250,7 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: @@ -275,7 +275,7 @@ func (t *LatencyMessage) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 18a5e179ad3..44ef7ee6a36 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -539,20 +539,8 @@ func (sm *StorageMinerAPI) MarketListDeals(ctx context.Context) ([]*api.MarketDe return sm.listDeals(ctx) } -func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]retrievalmarket.ProviderDealState, error) { - var out []retrievalmarket.ProviderDealState - deals := sm.RetrievalProvider.ListDeals() - - for _, deal := range deals { - if deal.ChannelID != nil { - if deal.ChannelID.Initiator == "" || deal.ChannelID.Responder == "" { - deal.ChannelID = nil // don't try to push unparsable peer IDs over jsonrpc - } - } - out = append(out, deal) - } - - return out, nil +func (sm *StorageMinerAPI) MarketListRetrievalDeals(ctx context.Context) ([]struct{}, error) { + return []struct{}{}, nil } func (sm *StorageMinerAPI) MarketGetDealUpdates(ctx context.Context) (<-chan storagemarket.MinerDeal, error) { diff --git a/paychmgr/cbor_gen.go b/paychmgr/cbor_gen.go index 78a55488ea2..b3880aa1067 100644 --- a/paychmgr/cbor_gen.go +++ b/paychmgr/cbor_gen.go @@ -33,22 +33,6 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { return err } - // t.Voucher (paych.SignedVoucher) (struct) - if len("Voucher") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Voucher\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Voucher"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("Voucher")); err != nil { - return err - } - - if err := t.Voucher.MarshalCBOR(cw); err != nil { - return err - } - // t.Proof ([]uint8) (slice) if len("Proof") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Proof\" was too long") @@ -73,6 +57,22 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error { return err } + // t.Voucher (paych.SignedVoucher) (struct) + if len("Voucher") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Voucher\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Voucher"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("Voucher")); err != nil { + return err + } + + if err := t.Voucher.MarshalCBOR(cw); err != nil { + return err + } + // t.Submitted (bool) (bool) if len("Submitted") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Submitted\" was too long") @@ -129,27 +129,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Voucher (paych.SignedVoucher) (struct) - case "Voucher": - - { - - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.Voucher = new(paych.SignedVoucher) - if err := t.Voucher.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Voucher pointer: %w", err) - } - } - - } - // t.Proof ([]uint8) (slice) + // t.Proof ([]uint8) (slice) case "Proof": maj, extra, err = cr.ReadHeader() @@ -171,6 +151,26 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) { if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { return err } + // t.Voucher (paych.SignedVoucher) (struct) + case "Voucher": + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.Voucher = new(paych.SignedVoucher) + if err := t.Voucher.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Voucher pointer: %w", err) + } + } + + } // t.Submitted (bool) (bool) case "Submitted": @@ -210,26 +210,35 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - // t.ChannelID (string) (string) - if len("ChannelID") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"ChannelID\" was too long") + // t.Amount (big.Int) (struct) + if len("Amount") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Amount\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Amount"))); err != nil { return err } - if _, err := io.WriteString(w, string("ChannelID")); err != nil { + if _, err := io.WriteString(w, string("Amount")); err != nil { return err } - if len(t.ChannelID) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.ChannelID was too long") + if err := t.Amount.MarshalCBOR(cw); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil { + // t.Target (address.Address) (struct) + if len("Target") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Target\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Target"))); err != nil { return err } - if _, err := io.WriteString(w, string(t.ChannelID)); err != nil { + if _, err := io.WriteString(w, string("Target")); err != nil { + return err + } + + if err := t.Target.MarshalCBOR(cw); err != nil { return err } @@ -265,35 +274,35 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - // t.Target (address.Address) (struct) - if len("Target") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Target\" was too long") + // t.NextLane (uint64) (uint64) + if len("NextLane") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"NextLane\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Target"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("NextLane"))); err != nil { return err } - if _, err := io.WriteString(w, string("Target")); err != nil { + if _, err := io.WriteString(w, string("NextLane")); err != nil { return err } - if err := t.Target.MarshalCBOR(cw); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.NextLane)); err != nil { return err } - // t.Direction (uint64) (uint64) - if len("Direction") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Direction\" was too long") + // t.Settling (bool) (bool) + if len("Settling") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Settling\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Direction"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Settling"))); err != nil { return err } - if _, err := io.WriteString(w, string("Direction")); err != nil { + if _, err := io.WriteString(w, string("Settling")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Direction)); err != nil { + if err := cbg.WriteBool(w, t.Settling); err != nil { return err } @@ -322,68 +331,87 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { } } - // t.NextLane (uint64) (uint64) - if len("NextLane") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"NextLane\" was too long") + // t.ChannelID (string) (string) + if len("ChannelID") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"ChannelID\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("NextLane"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil { return err } - if _, err := io.WriteString(w, string("NextLane")); err != nil { + if _, err := io.WriteString(w, string("ChannelID")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.NextLane)); err != nil { + if len(t.ChannelID) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.ChannelID was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil { + return err + } + if _, err := io.WriteString(w, string(t.ChannelID)); err != nil { return err } - // t.Amount (big.Int) (struct) - if len("Amount") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Amount\" was too long") + // t.CreateMsg (cid.Cid) (struct) + if len("CreateMsg") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CreateMsg\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Amount"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreateMsg"))); err != nil { return err } - if _, err := io.WriteString(w, string("Amount")); err != nil { + if _, err := io.WriteString(w, string("CreateMsg")); err != nil { return err } - if err := t.Amount.MarshalCBOR(cw); err != nil { - return err + if t.CreateMsg == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if err := cbg.WriteCid(cw, *t.CreateMsg); err != nil { + return xerrors.Errorf("failed to write cid field t.CreateMsg: %w", err) + } } - // t.AvailableAmount (big.Int) (struct) - if len("AvailableAmount") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"AvailableAmount\" was too long") + // t.Direction (uint64) (uint64) + if len("Direction") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Direction\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AvailableAmount"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Direction"))); err != nil { return err } - if _, err := io.WriteString(w, string("AvailableAmount")); err != nil { + if _, err := io.WriteString(w, string("Direction")); err != nil { return err } - if err := t.AvailableAmount.MarshalCBOR(cw); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Direction)); err != nil { return err } - // t.PendingAvailableAmount (big.Int) (struct) - if len("PendingAvailableAmount") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PendingAvailableAmount\" was too long") + // t.AddFundsMsg (cid.Cid) (struct) + if len("AddFundsMsg") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"AddFundsMsg\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PendingAvailableAmount"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AddFundsMsg"))); err != nil { return err } - if _, err := io.WriteString(w, string("PendingAvailableAmount")); err != nil { + if _, err := io.WriteString(w, string("AddFundsMsg")); err != nil { return err } - if err := t.PendingAvailableAmount.MarshalCBOR(cw); err != nil { - return err + if t.AddFundsMsg == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if err := cbg.WriteCid(cw, *t.AddFundsMsg); err != nil { + return xerrors.Errorf("failed to write cid field t.AddFundsMsg: %w", err) + } } // t.PendingAmount (big.Int) (struct) @@ -402,63 +430,35 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error { return err } - // t.CreateMsg (cid.Cid) (struct) - if len("CreateMsg") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CreateMsg\" was too long") + // t.AvailableAmount (big.Int) (struct) + if len("AvailableAmount") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"AvailableAmount\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreateMsg"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AvailableAmount"))); err != nil { return err } - if _, err := io.WriteString(w, string("CreateMsg")); err != nil { + if _, err := io.WriteString(w, string("AvailableAmount")); err != nil { return err } - if t.CreateMsg == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if err := cbg.WriteCid(cw, *t.CreateMsg); err != nil { - return xerrors.Errorf("failed to write cid field t.CreateMsg: %w", err) - } - } - - // t.AddFundsMsg (cid.Cid) (struct) - if len("AddFundsMsg") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"AddFundsMsg\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("AddFundsMsg"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("AddFundsMsg")); err != nil { + if err := t.AvailableAmount.MarshalCBOR(cw); err != nil { return err } - if t.AddFundsMsg == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if err := cbg.WriteCid(cw, *t.AddFundsMsg); err != nil { - return xerrors.Errorf("failed to write cid field t.AddFundsMsg: %w", err) - } - } - - // t.Settling (bool) (bool) - if len("Settling") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Settling\" was too long") + // t.PendingAvailableAmount (big.Int) (struct) + if len("PendingAvailableAmount") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PendingAvailableAmount\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Settling"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PendingAvailableAmount"))); err != nil { return err } - if _, err := io.WriteString(w, string("Settling")); err != nil { + if _, err := io.WriteString(w, string("PendingAvailableAmount")); err != nil { return err } - if err := cbg.WriteBool(w, t.Settling); err != nil { + if err := t.PendingAvailableAmount.MarshalCBOR(cw); err != nil { return err } return nil @@ -502,16 +502,25 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.ChannelID (string) (string) - case "ChannelID": + // t.Amount (big.Int) (struct) + case "Amount": { - sval, err := cbg.ReadString(cr) - if err != nil { - return err + + if err := t.Amount.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Amount: %w", err) + } + + } + // t.Target (address.Address) (struct) + case "Target": + + { + + if err := t.Target.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Target: %w", err) } - t.ChannelID = string(sval) } // t.Channel (address.Address) (struct) case "Channel": @@ -543,18 +552,8 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.Target (address.Address) (struct) - case "Target": - - { - - if err := t.Target.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Target: %w", err) - } - - } - // t.Direction (uint64) (uint64) - case "Direction": + // t.NextLane (uint64) (uint64) + case "NextLane": { @@ -565,9 +564,27 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.Direction = uint64(extra) + t.NextLane = uint64(extra) } + // t.Settling (bool) (bool) + case "Settling": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.Settling = false + case 21: + t.Settling = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } // t.Vouchers ([]*paychmgr.VoucherInfo) (slice) case "Vouchers": @@ -598,60 +615,16 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Vouchers[i] = &v } - // t.NextLane (uint64) (uint64) - case "NextLane": + // t.ChannelID (string) (string) + case "ChannelID": { - - maj, extra, err = cr.ReadHeader() + sval, err := cbg.ReadString(cr) if err != nil { return err } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.NextLane = uint64(extra) - - } - // t.Amount (big.Int) (struct) - case "Amount": - - { - - if err := t.Amount.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Amount: %w", err) - } - - } - // t.AvailableAmount (big.Int) (struct) - case "AvailableAmount": - - { - - if err := t.AvailableAmount.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.AvailableAmount: %w", err) - } - - } - // t.PendingAvailableAmount (big.Int) (struct) - case "PendingAvailableAmount": - - { - - if err := t.PendingAvailableAmount.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.PendingAvailableAmount: %w", err) - } - - } - // t.PendingAmount (big.Int) (struct) - case "PendingAmount": - - { - - if err := t.PendingAmount.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.PendingAmount: %w", err) - } + t.ChannelID = string(sval) } // t.CreateMsg (cid.Cid) (struct) case "CreateMsg": @@ -675,6 +648,21 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { t.CreateMsg = &c } + } + // t.Direction (uint64) (uint64) + case "Direction": + + { + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Direction = uint64(extra) + } // t.AddFundsMsg (cid.Cid) (struct) case "AddFundsMsg": @@ -699,23 +687,35 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.Settling (bool) (bool) - case "Settling": + // t.PendingAmount (big.Int) (struct) + case "PendingAmount": + + { + + if err := t.PendingAmount.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.PendingAmount: %w", err) + } - maj, extra, err = cr.ReadHeader() - if err != nil { - return err } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") + // t.AvailableAmount (big.Int) (struct) + case "AvailableAmount": + + { + + if err := t.AvailableAmount.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.AvailableAmount: %w", err) + } + } - switch extra { - case 20: - t.Settling = false - case 21: - t.Settling = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + // t.PendingAvailableAmount (big.Int) (struct) + case "PendingAvailableAmount": + + { + + if err := t.PendingAvailableAmount.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.PendingAvailableAmount: %w", err) + } + } default: @@ -738,26 +738,26 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { return err } - // t.ChannelID (string) (string) - if len("ChannelID") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"ChannelID\" was too long") + // t.Err (string) (string) + if len("Err") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Err\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Err"))); err != nil { return err } - if _, err := io.WriteString(w, string("ChannelID")); err != nil { + if _, err := io.WriteString(w, string("Err")); err != nil { return err } - if len(t.ChannelID) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.ChannelID was too long") + if len(t.Err) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.Err was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Err))); err != nil { return err } - if _, err := io.WriteString(w, string(t.ChannelID)); err != nil { + if _, err := io.WriteString(w, string(t.Err)); err != nil { return err } @@ -793,26 +793,26 @@ func (t *MsgInfo) MarshalCBOR(w io.Writer) error { return err } - // t.Err (string) (string) - if len("Err") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Err\" was too long") + // t.ChannelID (string) (string) + if len("ChannelID") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"ChannelID\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Err"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ChannelID"))); err != nil { return err } - if _, err := io.WriteString(w, string("Err")); err != nil { + if _, err := io.WriteString(w, string("ChannelID")); err != nil { return err } - if len(t.Err) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.Err was too long") + if len(t.ChannelID) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.ChannelID was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Err))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.ChannelID))); err != nil { return err } - if _, err := io.WriteString(w, string(t.Err)); err != nil { + if _, err := io.WriteString(w, string(t.ChannelID)); err != nil { return err } return nil @@ -856,8 +856,8 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.ChannelID (string) (string) - case "ChannelID": + // t.Err (string) (string) + case "Err": { sval, err := cbg.ReadString(cr) @@ -865,7 +865,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.ChannelID = string(sval) + t.Err = string(sval) } // t.MsgCid (cid.Cid) (struct) case "MsgCid": @@ -898,8 +898,8 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.Err (string) (string) - case "Err": + // t.ChannelID (string) (string) + case "ChannelID": { sval, err := cbg.ReadString(cr) @@ -907,7 +907,7 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) { return err } - t.Err = string(sval) + t.ChannelID = string(sval) } default: diff --git a/storage/pipeline/cbor_gen.go b/storage/pipeline/cbor_gen.go index 88dac5d6424..d14611c6a34 100644 --- a/storage/pipeline/cbor_gen.go +++ b/storage/pipeline/cbor_gen.go @@ -35,87 +35,120 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.State (sealing.SectorState) (string) - if len("State") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"State\" was too long") + // t.Log ([]sealing.Log) (slice) + if len("Log") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Log\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("State"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Log"))); err != nil { return err } - if _, err := io.WriteString(w, string("State")); err != nil { + if _, err := io.WriteString(w, string("Log")); err != nil { return err } - if len(t.State) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.State was too long") + if len(t.Log) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.Log was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Log))); err != nil { return err } - if _, err := io.WriteString(w, string(t.State)); err != nil { - return err + for _, v := range t.Log { + if err := v.MarshalCBOR(cw); err != nil { + return err + } } - // t.SectorNumber (abi.SectorNumber) (uint64) - if len("SectorNumber") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"SectorNumber\" was too long") + // t.CommD (cid.Cid) (struct) + if len("CommD") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CommD\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorNumber"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CommD"))); err != nil { return err } - if _, err := io.WriteString(w, string("SectorNumber")); err != nil { + if _, err := io.WriteString(w, string("CommD")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { - return err + if t.CommD == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if err := cbg.WriteCid(cw, *t.CommD); err != nil { + return xerrors.Errorf("failed to write cid field t.CommD: %w", err) + } } - // t.SectorType (abi.RegisteredSealProof) (int64) - if len("SectorType") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"SectorType\" was too long") + // t.CommR (cid.Cid) (struct) + if len("CommR") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CommR\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorType"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CommR"))); err != nil { return err } - if _, err := io.WriteString(w, string("SectorType")); err != nil { + if _, err := io.WriteString(w, string("CommR")); err != nil { return err } - if t.SectorType >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorType)); err != nil { + if t.CommR == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.SectorType-1)); err != nil { - return err + if err := cbg.WriteCid(cw, *t.CommR); err != nil { + return xerrors.Errorf("failed to write cid field t.CommR: %w", err) } } - // t.CreationTime (int64) (int64) - if len("CreationTime") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CreationTime\" was too long") + // t.Proof ([]uint8) (slice) + if len("Proof") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Proof\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreationTime"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Proof"))); err != nil { return err } - if _, err := io.WriteString(w, string("CreationTime")); err != nil { + if _, err := io.WriteString(w, string("Proof")); err != nil { return err } - if t.CreationTime >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.CreationTime)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.CreationTime-1)); err != nil { - return err - } + if len(t.Proof) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.Proof was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Proof))); err != nil { + return err + } + + if _, err := cw.Write(t.Proof[:]); err != nil { + return err + } + + // t.State (sealing.SectorState) (string) + if len("State") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"State\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("State"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("State")); err != nil { + return err + } + + if len(t.State) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.State was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.State))); err != nil { + return err + } + if _, err := io.WriteString(w, string(t.State)); err != nil { + return err } // t.Pieces ([]api.SectorPiece) (slice) @@ -143,257 +176,286 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.TicketValue (abi.SealRandomness) (slice) - if len("TicketValue") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"TicketValue\" was too long") + // t.Return (sealing.ReturnState) (string) + if len("Return") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Return\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TicketValue"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Return"))); err != nil { return err } - if _, err := io.WriteString(w, string("TicketValue")); err != nil { + if _, err := io.WriteString(w, string("Return")); err != nil { return err } - if len(t.TicketValue) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.TicketValue was too long") + if len(t.Return) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.Return was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.TicketValue))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Return))); err != nil { return err } - - if _, err := cw.Write(t.TicketValue[:]); err != nil { + if _, err := io.WriteString(w, string(t.Return)); err != nil { return err } - // t.TicketEpoch (abi.ChainEpoch) (int64) - if len("TicketEpoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"TicketEpoch\" was too long") + // t.LastErr (string) (string) + if len("LastErr") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"LastErr\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TicketEpoch"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("LastErr"))); err != nil { return err } - if _, err := io.WriteString(w, string("TicketEpoch")); err != nil { + if _, err := io.WriteString(w, string("LastErr")); err != nil { return err } - if t.TicketEpoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TicketEpoch)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TicketEpoch-1)); err != nil { - return err - } - } - - // t.PreCommit1Out (storiface.PreCommit1Out) (slice) - if len("PreCommit1Out") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long") + if len(t.LastErr) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.LastErr was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommit1Out"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LastErr))); err != nil { return err } - if _, err := io.WriteString(w, string("PreCommit1Out")); err != nil { + if _, err := io.WriteString(w, string(t.LastErr)); err != nil { return err } - if len(t.PreCommit1Out) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.PreCommit1Out was too long") + // t.CCPieces ([]api.SectorPiece) (slice) + if len("CCPieces") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CCPieces\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.PreCommit1Out))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CCPieces"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("CCPieces")); err != nil { return err } - if _, err := cw.Write(t.PreCommit1Out[:]); err != nil { + if len(t.CCPieces) > cbg.MaxLength { + return xerrors.Errorf("Slice value in field t.CCPieces was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.CCPieces))); err != nil { return err } + for _, v := range t.CCPieces { + if err := v.MarshalCBOR(cw); err != nil { + return err + } + } - // t.CommD (cid.Cid) (struct) - if len("CommD") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CommD\" was too long") + // t.CCUpdate (bool) (bool) + if len("CCUpdate") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CCUpdate\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CommD"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CCUpdate"))); err != nil { return err } - if _, err := io.WriteString(w, string("CommD")); err != nil { + if _, err := io.WriteString(w, string("CCUpdate")); err != nil { return err } - if t.CommD == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if err := cbg.WriteCid(cw, *t.CommD); err != nil { - return xerrors.Errorf("failed to write cid field t.CommD: %w", err) - } + if err := cbg.WriteBool(w, t.CCUpdate); err != nil { + return err } - // t.CommR (cid.Cid) (struct) - if len("CommR") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CommR\" was too long") + // t.SeedEpoch (abi.ChainEpoch) (int64) + if len("SeedEpoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"SeedEpoch\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CommR"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SeedEpoch"))); err != nil { return err } - if _, err := io.WriteString(w, string("CommR")); err != nil { + if _, err := io.WriteString(w, string("SeedEpoch")); err != nil { return err } - if t.CommR == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { + if t.SeedEpoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SeedEpoch)); err != nil { return err } } else { - if err := cbg.WriteCid(cw, *t.CommR); err != nil { - return xerrors.Errorf("failed to write cid field t.CommR: %w", err) + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.SeedEpoch-1)); err != nil { + return err } } - // t.Proof ([]uint8) (slice) - if len("Proof") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Proof\" was too long") + // t.SeedValue (abi.InteractiveSealRandomness) (slice) + if len("SeedValue") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"SeedValue\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Proof"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SeedValue"))); err != nil { return err } - if _, err := io.WriteString(w, string("Proof")); err != nil { + if _, err := io.WriteString(w, string("SeedValue")); err != nil { return err } - if len(t.Proof) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.Proof was too long") + if len(t.SeedValue) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.SeedValue was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Proof))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.SeedValue))); err != nil { return err } - if _, err := cw.Write(t.Proof[:]); err != nil { + if _, err := cw.Write(t.SeedValue[:]); err != nil { return err } - // t.PreCommitDeposit (big.Int) (struct) - if len("PreCommitDeposit") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PreCommitDeposit\" was too long") + // t.SectorType (abi.RegisteredSealProof) (int64) + if len("SectorType") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"SectorType\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitDeposit"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorType"))); err != nil { return err } - if _, err := io.WriteString(w, string("PreCommitDeposit")); err != nil { + if _, err := io.WriteString(w, string("SectorType")); err != nil { return err } - if err := t.PreCommitDeposit.MarshalCBOR(cw); err != nil { - return err + if t.SectorType >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorType)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.SectorType-1)); err != nil { + return err + } } - // t.PreCommitMessage (cid.Cid) (struct) - if len("PreCommitMessage") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PreCommitMessage\" was too long") + // t.TicketEpoch (abi.ChainEpoch) (int64) + if len("TicketEpoch") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"TicketEpoch\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitMessage"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TicketEpoch"))); err != nil { return err } - if _, err := io.WriteString(w, string("PreCommitMessage")); err != nil { + if _, err := io.WriteString(w, string("TicketEpoch")); err != nil { return err } - if t.PreCommitMessage == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { + if t.TicketEpoch >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TicketEpoch)); err != nil { return err } } else { - if err := cbg.WriteCid(cw, *t.PreCommitMessage); err != nil { - return xerrors.Errorf("failed to write cid field t.PreCommitMessage: %w", err) + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TicketEpoch-1)); err != nil { + return err } } - // t.PreCommitTipSet (types.TipSetKey) (struct) - if len("PreCommitTipSet") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long") + // t.TicketValue (abi.SealRandomness) (slice) + if len("TicketValue") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"TicketValue\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitTipSet"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TicketValue"))); err != nil { return err } - if _, err := io.WriteString(w, string("PreCommitTipSet")); err != nil { + if _, err := io.WriteString(w, string("TicketValue")); err != nil { return err } - if err := t.PreCommitTipSet.MarshalCBOR(cw); err != nil { + if len(t.TicketValue) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.TicketValue was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.TicketValue))); err != nil { return err } - // t.PreCommit2Fails (uint64) (uint64) - if len("PreCommit2Fails") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"PreCommit2Fails\" was too long") + if _, err := cw.Write(t.TicketValue[:]); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommit2Fails"))); err != nil { + // t.CreationTime (int64) (int64) + if len("CreationTime") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"CreationTime\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CreationTime"))); err != nil { return err } - if _, err := io.WriteString(w, string("PreCommit2Fails")); err != nil { + if _, err := io.WriteString(w, string("CreationTime")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PreCommit2Fails)); err != nil { - return err + if t.CreationTime >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.CreationTime)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.CreationTime-1)); err != nil { + return err + } } - // t.SeedValue (abi.InteractiveSealRandomness) (slice) - if len("SeedValue") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"SeedValue\" was too long") + // t.SectorNumber (abi.SectorNumber) (uint64) + if len("SectorNumber") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"SectorNumber\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SeedValue"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorNumber"))); err != nil { return err } - if _, err := io.WriteString(w, string("SeedValue")); err != nil { + if _, err := io.WriteString(w, string("SectorNumber")); err != nil { return err } - if len(t.SeedValue) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.SeedValue was too long") + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorNumber)); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.SeedValue))); err != nil { - return err + // t.TerminatedAt (abi.ChainEpoch) (int64) + if len("TerminatedAt") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"TerminatedAt\" was too long") } - if _, err := cw.Write(t.SeedValue[:]); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TerminatedAt"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("TerminatedAt")); err != nil { return err } - // t.SeedEpoch (abi.ChainEpoch) (int64) - if len("SeedEpoch") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"SeedEpoch\" was too long") + if t.TerminatedAt >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TerminatedAt)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TerminatedAt-1)); err != nil { + return err + } } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SeedEpoch"))); err != nil { + // t.UpdateSealed (cid.Cid) (struct) + if len("UpdateSealed") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"UpdateSealed\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("UpdateSealed"))); err != nil { return err } - if _, err := io.WriteString(w, string("SeedEpoch")); err != nil { + if _, err := io.WriteString(w, string("UpdateSealed")); err != nil { return err } - if t.SeedEpoch >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SeedEpoch)); err != nil { + if t.UpdateSealed == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.SeedEpoch-1)); err != nil { - return err + if err := cbg.WriteCid(cw, *t.UpdateSealed); err != nil { + return xerrors.Errorf("failed to write cid field t.UpdateSealed: %w", err) } } @@ -435,66 +497,49 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.CCUpdate (bool) (bool) - if len("CCUpdate") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CCUpdate\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CCUpdate"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("CCUpdate")); err != nil { - return err - } - - if err := cbg.WriteBool(w, t.CCUpdate); err != nil { - return err - } - - // t.CCPieces ([]api.SectorPiece) (slice) - if len("CCPieces") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"CCPieces\" was too long") + // t.PreCommit1Out (storiface.PreCommit1Out) (slice) + if len("PreCommit1Out") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("CCPieces"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommit1Out"))); err != nil { return err } - if _, err := io.WriteString(w, string("CCPieces")); err != nil { + if _, err := io.WriteString(w, string("PreCommit1Out")); err != nil { return err } - if len(t.CCPieces) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.CCPieces was too long") + if len(t.PreCommit1Out) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.PreCommit1Out was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.CCPieces))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.PreCommit1Out))); err != nil { return err } - for _, v := range t.CCPieces { - if err := v.MarshalCBOR(cw); err != nil { - return err - } + + if _, err := cw.Write(t.PreCommit1Out[:]); err != nil { + return err } - // t.UpdateSealed (cid.Cid) (struct) - if len("UpdateSealed") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"UpdateSealed\" was too long") + // t.FaultReportMsg (cid.Cid) (struct) + if len("FaultReportMsg") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"FaultReportMsg\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("UpdateSealed"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("FaultReportMsg"))); err != nil { return err } - if _, err := io.WriteString(w, string("UpdateSealed")); err != nil { + if _, err := io.WriteString(w, string("FaultReportMsg")); err != nil { return err } - if t.UpdateSealed == nil { + if t.FaultReportMsg == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cbg.WriteCid(cw, *t.UpdateSealed); err != nil { - return xerrors.Errorf("failed to write cid field t.UpdateSealed: %w", err) + if err := cbg.WriteCid(cw, *t.FaultReportMsg); err != nil { + return xerrors.Errorf("failed to write cid field t.FaultReportMsg: %w", err) } } @@ -520,94 +565,105 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) - if len("ReplicaUpdateProof") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long") + // t.PreCommit2Fails (uint64) (uint64) + if len("PreCommit2Fails") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PreCommit2Fails\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ReplicaUpdateProof"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommit2Fails"))); err != nil { return err } - if _, err := io.WriteString(w, string("ReplicaUpdateProof")); err != nil { + if _, err := io.WriteString(w, string("PreCommit2Fails")); err != nil { return err } - if len(t.ReplicaUpdateProof) > cbg.ByteArrayMaxLen { - return xerrors.Errorf("Byte array in field t.ReplicaUpdateProof was too long") + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PreCommit2Fails)); err != nil { + return err } - if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.ReplicaUpdateProof))); err != nil { + // t.PreCommitTipSet (types.TipSetKey) (struct) + if len("PreCommitTipSet") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitTipSet"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("PreCommitTipSet")); err != nil { return err } - if _, err := cw.Write(t.ReplicaUpdateProof[:]); err != nil { + if err := t.PreCommitTipSet.MarshalCBOR(cw); err != nil { return err } - // t.ReplicaUpdateMessage (cid.Cid) (struct) - if len("ReplicaUpdateMessage") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"ReplicaUpdateMessage\" was too long") + // t.RemoteDataCache (storiface.SectorLocation) (struct) + if len("RemoteDataCache") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteDataCache\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ReplicaUpdateMessage"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataCache"))); err != nil { return err } - if _, err := io.WriteString(w, string("ReplicaUpdateMessage")); err != nil { + if _, err := io.WriteString(w, string("RemoteDataCache")); err != nil { return err } - if t.ReplicaUpdateMessage == nil { - if _, err := cw.Write(cbg.CborNull); err != nil { - return err - } - } else { - if err := cbg.WriteCid(cw, *t.ReplicaUpdateMessage); err != nil { - return xerrors.Errorf("failed to write cid field t.ReplicaUpdateMessage: %w", err) - } + if err := t.RemoteDataCache.MarshalCBOR(cw); err != nil { + return err } - // t.FaultReportMsg (cid.Cid) (struct) - if len("FaultReportMsg") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"FaultReportMsg\" was too long") + // t.PreCommitDeposit (big.Int) (struct) + if len("PreCommitDeposit") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PreCommitDeposit\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("FaultReportMsg"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitDeposit"))); err != nil { return err } - if _, err := io.WriteString(w, string("FaultReportMsg")); err != nil { + if _, err := io.WriteString(w, string("PreCommitDeposit")); err != nil { return err } - if t.FaultReportMsg == nil { + if err := t.PreCommitDeposit.MarshalCBOR(cw); err != nil { + return err + } + + // t.PreCommitMessage (cid.Cid) (struct) + if len("PreCommitMessage") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"PreCommitMessage\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PreCommitMessage"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("PreCommitMessage")); err != nil { + return err + } + + if t.PreCommitMessage == nil { if _, err := cw.Write(cbg.CborNull); err != nil { return err } } else { - if err := cbg.WriteCid(cw, *t.FaultReportMsg); err != nil { - return xerrors.Errorf("failed to write cid field t.FaultReportMsg: %w", err) + if err := cbg.WriteCid(cw, *t.PreCommitMessage); err != nil { + return xerrors.Errorf("failed to write cid field t.PreCommitMessage: %w", err) } } - // t.Return (sealing.ReturnState) (string) - if len("Return") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Return\" was too long") + // t.RemoteDataSealed (storiface.SectorLocation) (struct) + if len("RemoteDataSealed") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteDataSealed\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Return"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataSealed"))); err != nil { return err } - if _, err := io.WriteString(w, string("Return")); err != nil { + if _, err := io.WriteString(w, string("RemoteDataSealed")); err != nil { return err } - if len(t.Return) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.Return was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Return))); err != nil { - return err - } - if _, err := io.WriteString(w, string(t.Return)); err != nil { + if err := t.RemoteDataSealed.MarshalCBOR(cw); err != nil { return err } @@ -633,28 +689,6 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.TerminatedAt (abi.ChainEpoch) (int64) - if len("TerminatedAt") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"TerminatedAt\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("TerminatedAt"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("TerminatedAt")); err != nil { - return err - } - - if t.TerminatedAt >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.TerminatedAt)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.TerminatedAt-1)); err != nil { - return err - } - } - // t.RemoteDataUnsealed (storiface.SectorLocation) (struct) if len("RemoteDataUnsealed") > cbg.MaxLength { return xerrors.Errorf("Value in field \"RemoteDataUnsealed\" was too long") @@ -671,169 +705,135 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { return err } - // t.RemoteDataSealed (storiface.SectorLocation) (struct) - if len("RemoteDataSealed") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteDataSealed\" was too long") + // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) + if len("ReplicaUpdateProof") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataSealed"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteDataSealed")); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ReplicaUpdateProof"))); err != nil { return err } - - if err := t.RemoteDataSealed.MarshalCBOR(cw); err != nil { + if _, err := io.WriteString(w, string("ReplicaUpdateProof")); err != nil { return err } - // t.RemoteDataCache (storiface.SectorLocation) (struct) - if len("RemoteDataCache") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteDataCache\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataCache"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteDataCache")); err != nil { - return err + if len(t.ReplicaUpdateProof) > cbg.ByteArrayMaxLen { + return xerrors.Errorf("Byte array in field t.ReplicaUpdateProof was too long") } - if err := t.RemoteDataCache.MarshalCBOR(cw); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.ReplicaUpdateProof))); err != nil { return err } - // t.RemoteCommit1Endpoint (string) (string) - if len("RemoteCommit1Endpoint") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteCommit1Endpoint\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteCommit1Endpoint"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteCommit1Endpoint")); err != nil { + if _, err := cw.Write(t.ReplicaUpdateProof[:]); err != nil { return err } - if len(t.RemoteCommit1Endpoint) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.RemoteCommit1Endpoint was too long") + // t.RemoteDataFinalized (bool) (bool) + if len("RemoteDataFinalized") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteDataFinalized\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteCommit1Endpoint))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataFinalized"))); err != nil { return err } - if _, err := io.WriteString(w, string(t.RemoteCommit1Endpoint)); err != nil { + if _, err := io.WriteString(w, string("RemoteDataFinalized")); err != nil { return err } - // t.RemoteCommit2Endpoint (string) (string) - if len("RemoteCommit2Endpoint") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteCommit2Endpoint\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteCommit2Endpoint"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteCommit2Endpoint")); err != nil { + if err := cbg.WriteBool(w, t.RemoteDataFinalized); err != nil { return err } - if len(t.RemoteCommit2Endpoint) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.RemoteCommit2Endpoint was too long") + // t.ReplicaUpdateMessage (cid.Cid) (struct) + if len("ReplicaUpdateMessage") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"ReplicaUpdateMessage\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteCommit2Endpoint))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ReplicaUpdateMessage"))); err != nil { return err } - if _, err := io.WriteString(w, string(t.RemoteCommit2Endpoint)); err != nil { + if _, err := io.WriteString(w, string("ReplicaUpdateMessage")); err != nil { return err } - // t.RemoteSealingDoneEndpoint (string) (string) - if len("RemoteSealingDoneEndpoint") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteSealingDoneEndpoint\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteSealingDoneEndpoint"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteSealingDoneEndpoint")); err != nil { - return err + if t.ReplicaUpdateMessage == nil { + if _, err := cw.Write(cbg.CborNull); err != nil { + return err + } + } else { + if err := cbg.WriteCid(cw, *t.ReplicaUpdateMessage); err != nil { + return xerrors.Errorf("failed to write cid field t.ReplicaUpdateMessage: %w", err) + } } - if len(t.RemoteSealingDoneEndpoint) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.RemoteSealingDoneEndpoint was too long") + // t.RemoteCommit1Endpoint (string) (string) + if len("RemoteCommit1Endpoint") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteCommit1Endpoint\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteSealingDoneEndpoint))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteCommit1Endpoint"))); err != nil { return err } - if _, err := io.WriteString(w, string(t.RemoteSealingDoneEndpoint)); err != nil { + if _, err := io.WriteString(w, string("RemoteCommit1Endpoint")); err != nil { return err } - // t.RemoteDataFinalized (bool) (bool) - if len("RemoteDataFinalized") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RemoteDataFinalized\" was too long") + if len(t.RemoteCommit1Endpoint) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.RemoteCommit1Endpoint was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteDataFinalized"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RemoteDataFinalized")); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteCommit1Endpoint))); err != nil { return err } - - if err := cbg.WriteBool(w, t.RemoteDataFinalized); err != nil { + if _, err := io.WriteString(w, string(t.RemoteCommit1Endpoint)); err != nil { return err } - // t.LastErr (string) (string) - if len("LastErr") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"LastErr\" was too long") + // t.RemoteCommit2Endpoint (string) (string) + if len("RemoteCommit2Endpoint") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteCommit2Endpoint\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("LastErr"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteCommit2Endpoint"))); err != nil { return err } - if _, err := io.WriteString(w, string("LastErr")); err != nil { + if _, err := io.WriteString(w, string("RemoteCommit2Endpoint")); err != nil { return err } - if len(t.LastErr) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.LastErr was too long") + if len(t.RemoteCommit2Endpoint) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.RemoteCommit2Endpoint was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.LastErr))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteCommit2Endpoint))); err != nil { return err } - if _, err := io.WriteString(w, string(t.LastErr)); err != nil { + if _, err := io.WriteString(w, string(t.RemoteCommit2Endpoint)); err != nil { return err } - // t.Log ([]sealing.Log) (slice) - if len("Log") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Log\" was too long") + // t.RemoteSealingDoneEndpoint (string) (string) + if len("RemoteSealingDoneEndpoint") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RemoteSealingDoneEndpoint\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Log"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RemoteSealingDoneEndpoint"))); err != nil { return err } - if _, err := io.WriteString(w, string("Log")); err != nil { + if _, err := io.WriteString(w, string("RemoteSealingDoneEndpoint")); err != nil { return err } - if len(t.Log) > cbg.MaxLength { - return xerrors.Errorf("Slice value in field t.Log was too long") + if len(t.RemoteSealingDoneEndpoint) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.RemoteSealingDoneEndpoint was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Log))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RemoteSealingDoneEndpoint))); err != nil { return err } - for _, v := range t.Log { - if err := v.MarshalCBOR(cw); err != nil { - return err - } + if _, err := io.WriteString(w, string(t.RemoteSealingDoneEndpoint)); err != nil { + return err } return nil } @@ -876,83 +876,114 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.State (sealing.SectorState) (string) - case "State": + // t.Log ([]sealing.Log) (slice) + case "Log": - { - sval, err := cbg.ReadString(cr) - if err != nil { + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > cbg.MaxLength { + return fmt.Errorf("t.Log: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.Log = make([]Log, extra) + } + + for i := 0; i < int(extra); i++ { + + var v Log + if err := v.UnmarshalCBOR(cr); err != nil { return err } - t.State = SectorState(sval) + t.Log[i] = v } - // t.SectorNumber (abi.SectorNumber) (uint64) - case "SectorNumber": + + // t.CommD (cid.Cid) (struct) + case "CommD": { - maj, extra, err = cr.ReadHeader() + b, err := cr.ReadByte() if err != nil { return err } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.CommD: %w", err) + } + + t.CommD = &c } - t.SectorNumber = abi.SectorNumber(extra) } - // t.SectorType (abi.RegisteredSealProof) (int64) - case "SectorType": + // t.CommR (cid.Cid) (struct) + case "CommR": + { - maj, extra, err := cr.ReadHeader() - var extraI int64 + + b, err := cr.ReadByte() if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.CommR: %w", err) } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) + + t.CommR = &c } - t.SectorType = abi.RegisteredSealProof(extraI) } - // t.CreationTime (int64) (int64) - case "CreationTime": + // t.Proof ([]uint8) (slice) + case "Proof": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + 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") + } + + if extra > 0 { + t.Proof = make([]uint8, extra) + } + + if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + return err + } + // t.State (sealing.SectorState) (string) + case "State": + { - maj, extra, err := cr.ReadHeader() - var extraI int64 + sval, err := cbg.ReadString(cr) if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - t.CreationTime = int64(extraI) + t.State = SectorState(sval) } // t.Pieces ([]api.SectorPiece) (slice) case "Pieces": @@ -984,30 +1015,78 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { t.Pieces[i] = v } - // t.TicketValue (abi.SealRandomness) (slice) - case "TicketValue": + // t.Return (sealing.ReturnState) (string) + case "Return": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.Return = ReturnState(sval) + } + // t.LastErr (string) (string) + case "LastErr": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.LastErr = string(sval) + } + // t.CCPieces ([]api.SectorPiece) (slice) + case "CCPieces": maj, extra, err = cr.ReadHeader() if err != nil { return err } - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.TicketValue: byte array too large (%d)", extra) + if extra > cbg.MaxLength { + return fmt.Errorf("t.CCPieces: array too large (%d)", extra) } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") } if extra > 0 { - t.TicketValue = make([]uint8, extra) + t.CCPieces = make([]api.SectorPiece, extra) } - if _, err := io.ReadFull(cr, t.TicketValue[:]); err != nil { + for i := 0; i < int(extra); i++ { + + var v api.SectorPiece + if err := v.UnmarshalCBOR(cr); err != nil { + return err + } + + t.CCPieces[i] = v + } + + // t.CCUpdate (bool) (bool) + case "CCUpdate": + + maj, extra, err = cr.ReadHeader() + if err != nil { return err } - // t.TicketEpoch (abi.ChainEpoch) (int64) - case "TicketEpoch": + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.CCUpdate = false + case 21: + t.CCUpdate = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.SeedEpoch (abi.ChainEpoch) (int64) + case "SeedEpoch": { maj, extra, err := cr.ReadHeader() var extraI int64 @@ -1023,17 +1102,17 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.TicketEpoch = abi.ChainEpoch(extraI) + t.SeedEpoch = abi.ChainEpoch(extraI) } - // t.PreCommit1Out (storiface.PreCommit1Out) (slice) - case "PreCommit1Out": + // t.SeedValue (abi.InteractiveSealRandomness) (slice) + case "SeedValue": maj, extra, err = cr.ReadHeader() if err != nil { @@ -1041,67 +1120,73 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.PreCommit1Out: byte array too large (%d)", extra) + return fmt.Errorf("t.SeedValue: byte array too large (%d)", extra) } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } if extra > 0 { - t.PreCommit1Out = make([]uint8, extra) + t.SeedValue = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.PreCommit1Out[:]); err != nil { + if _, err := io.ReadFull(cr, t.SeedValue[:]); err != nil { return err } - // t.CommD (cid.Cid) (struct) - case "CommD": - + // t.SectorType (abi.RegisteredSealProof) (int64) + case "SectorType": { - - b, err := cr.ReadByte() + maj, extra, err := cr.ReadHeader() + var extraI int64 if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") } - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.CommD: %w", err) + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") } - - t.CommD = &c + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) } + t.SectorType = abi.RegisteredSealProof(extraI) } - // t.CommR (cid.Cid) (struct) - case "CommR": - + // t.TicketEpoch (abi.ChainEpoch) (int64) + case "TicketEpoch": { - - b, err := cr.ReadByte() + maj, extra, err := cr.ReadHeader() + var extraI int64 if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") } - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.CommR: %w", err) + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") } - - t.CommR = &c + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) } + t.TicketEpoch = abi.ChainEpoch(extraI) } - // t.Proof ([]uint8) (slice) - case "Proof": + // t.TicketValue (abi.SealRandomness) (slice) + case "TicketValue": maj, extra, err = cr.ReadHeader() if err != nil { @@ -1109,64 +1194,47 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + return fmt.Errorf("t.TicketValue: byte array too large (%d)", extra) } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } if extra > 0 { - t.Proof = make([]uint8, extra) + t.TicketValue = make([]uint8, extra) } - if _, err := io.ReadFull(cr, t.Proof[:]); err != nil { + if _, err := io.ReadFull(cr, t.TicketValue[:]); err != nil { return err } - // t.PreCommitDeposit (big.Int) (struct) - case "PreCommitDeposit": - - { - - if err := t.PreCommitDeposit.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.PreCommitDeposit: %w", err) - } - - } - // t.PreCommitMessage (cid.Cid) (struct) - case "PreCommitMessage": - + // t.CreationTime (int64) (int64) + case "CreationTime": { - - b, err := cr.ReadByte() + maj, extra, err := cr.ReadHeader() + var extraI int64 if err != nil { return err } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") } - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.PreCommitMessage: %w", err) + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") } - - t.PreCommitMessage = &c - } - - } - // t.PreCommitTipSet (types.TipSetKey) (struct) - case "PreCommitTipSet": - - { - - if err := t.PreCommitTipSet.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.PreCommitTipSet: %w", err) + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) } + t.CreationTime = int64(extraI) } - // t.PreCommit2Fails (uint64) (uint64) - case "PreCommit2Fails": + // t.SectorNumber (abi.SectorNumber) (uint64) + case "SectorNumber": { @@ -1177,33 +1245,11 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { if maj != cbg.MajUnsignedInt { return fmt.Errorf("wrong type for uint64 field") } - t.PreCommit2Fails = uint64(extra) - - } - // t.SeedValue (abi.InteractiveSealRandomness) (slice) - case "SeedValue": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.SeedValue: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } - - if extra > 0 { - t.SeedValue = make([]uint8, extra) - } + t.SectorNumber = abi.SectorNumber(extra) - if _, err := io.ReadFull(cr, t.SeedValue[:]); err != nil { - return err } - // t.SeedEpoch (abi.ChainEpoch) (int64) - case "SeedEpoch": + // t.TerminatedAt (abi.ChainEpoch) (int64) + case "TerminatedAt": { maj, extra, err := cr.ReadHeader() var extraI int64 @@ -1219,14 +1265,37 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { case cbg.MajNegativeInt: extraI = int64(extra) if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") + return fmt.Errorf("int64 negative overflow") } extraI = -1 - extraI default: return fmt.Errorf("wrong type for int64 field: %d", maj) } - t.SeedEpoch = abi.ChainEpoch(extraI) + t.TerminatedAt = abi.ChainEpoch(extraI) + } + // t.UpdateSealed (cid.Cid) (struct) + case "UpdateSealed": + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.UpdateSealed: %w", err) + } + + t.UpdateSealed = &c + } + } // t.CommitMessage (cid.Cid) (struct) case "CommitMessage": @@ -1266,56 +1335,30 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { t.InvalidProofs = uint64(extra) } - // t.CCUpdate (bool) (bool) - case "CCUpdate": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.CCUpdate = false - case 21: - t.CCUpdate = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.CCPieces ([]api.SectorPiece) (slice) - case "CCPieces": + // t.PreCommit1Out (storiface.PreCommit1Out) (slice) + case "PreCommit1Out": maj, extra, err = cr.ReadHeader() if err != nil { return err } - if extra > cbg.MaxLength { - return fmt.Errorf("t.CCPieces: array too large (%d)", extra) + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.PreCommit1Out: byte array too large (%d)", extra) } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") } if extra > 0 { - t.CCPieces = make([]api.SectorPiece, extra) + t.PreCommit1Out = make([]uint8, extra) } - for i := 0; i < int(extra); i++ { - - var v api.SectorPiece - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.CCPieces[i] = v + if _, err := io.ReadFull(cr, t.PreCommit1Out[:]); err != nil { + return err } - - // t.UpdateSealed (cid.Cid) (struct) - case "UpdateSealed": + // t.FaultReportMsg (cid.Cid) (struct) + case "FaultReportMsg": { @@ -1330,10 +1373,10 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { c, err := cbg.ReadCid(cr) if err != nil { - return xerrors.Errorf("failed to read cid field t.UpdateSealed: %w", err) + return xerrors.Errorf("failed to read cid field t.FaultReportMsg: %w", err) } - t.UpdateSealed = &c + t.FaultReportMsg = &c } } @@ -1360,30 +1403,33 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) - case "ReplicaUpdateProof": + // t.PreCommit2Fails (uint64) (uint64) + case "PreCommit2Fails": - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } + { - if extra > cbg.ByteArrayMaxLen { - return fmt.Errorf("t.ReplicaUpdateProof: byte array too large (%d)", extra) - } - if maj != cbg.MajByteString { - return fmt.Errorf("expected byte array") - } + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.PreCommit2Fails = uint64(extra) - if extra > 0 { - t.ReplicaUpdateProof = make([]uint8, extra) } + // t.PreCommitTipSet (types.TipSetKey) (struct) + case "PreCommitTipSet": + + { + + if err := t.PreCommitTipSet.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.PreCommitTipSet: %w", err) + } - if _, err := io.ReadFull(cr, t.ReplicaUpdateProof[:]); err != nil { - return err } - // t.ReplicaUpdateMessage (cid.Cid) (struct) - case "ReplicaUpdateMessage": + // t.RemoteDataCache (storiface.SectorLocation) (struct) + case "RemoteDataCache": { @@ -1395,18 +1441,25 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - - c, err := cbg.ReadCid(cr) - if err != nil { - return xerrors.Errorf("failed to read cid field t.ReplicaUpdateMessage: %w", err) + t.RemoteDataCache = new(storiface.SectorLocation) + if err := t.RemoteDataCache.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.RemoteDataCache pointer: %w", err) } + } - t.ReplicaUpdateMessage = &c + } + // t.PreCommitDeposit (big.Int) (struct) + case "PreCommitDeposit": + + { + + if err := t.PreCommitDeposit.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.PreCommitDeposit: %w", err) } } - // t.FaultReportMsg (cid.Cid) (struct) - case "FaultReportMsg": + // t.PreCommitMessage (cid.Cid) (struct) + case "PreCommitMessage": { @@ -1421,23 +1474,32 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { c, err := cbg.ReadCid(cr) if err != nil { - return xerrors.Errorf("failed to read cid field t.FaultReportMsg: %w", err) + return xerrors.Errorf("failed to read cid field t.PreCommitMessage: %w", err) } - t.FaultReportMsg = &c + t.PreCommitMessage = &c } } - // t.Return (sealing.ReturnState) (string) - case "Return": + // t.RemoteDataSealed (storiface.SectorLocation) (struct) + case "RemoteDataSealed": { - sval, err := cbg.ReadString(cr) + + b, err := cr.ReadByte() if err != nil { return err } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.RemoteDataSealed = new(storiface.SectorLocation) + if err := t.RemoteDataSealed.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.RemoteDataSealed pointer: %w", err) + } + } - t.Return = ReturnState(sval) } // t.TerminateMessage (cid.Cid) (struct) case "TerminateMessage": @@ -1462,32 +1524,6 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.TerminatedAt (abi.ChainEpoch) (int64) - case "TerminatedAt": - { - maj, extra, err := cr.ReadHeader() - var extraI int64 - if err != nil { - return err - } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - - t.TerminatedAt = abi.ChainEpoch(extraI) - } // t.RemoteDataUnsealed (storiface.SectorLocation) (struct) case "RemoteDataUnsealed": @@ -1508,28 +1544,48 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.RemoteDataSealed (storiface.SectorLocation) (struct) - case "RemoteDataSealed": + // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) + case "ReplicaUpdateProof": - { + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } - b, err := cr.ReadByte() - if err != nil { - return err - } - if b != cbg.CborNull[0] { - if err := cr.UnreadByte(); err != nil { - return err - } - t.RemoteDataSealed = new(storiface.SectorLocation) - if err := t.RemoteDataSealed.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.RemoteDataSealed pointer: %w", err) - } - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.ReplicaUpdateProof: byte array too large (%d)", extra) + } + if maj != cbg.MajByteString { + return fmt.Errorf("expected byte array") + } + + if extra > 0 { + t.ReplicaUpdateProof = make([]uint8, extra) + } + if _, err := io.ReadFull(cr, t.ReplicaUpdateProof[:]); err != nil { + return err } - // t.RemoteDataCache (storiface.SectorLocation) (struct) - case "RemoteDataCache": + // t.RemoteDataFinalized (bool) (bool) + case "RemoteDataFinalized": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + if maj != cbg.MajOther { + return fmt.Errorf("booleans must be major type 7") + } + switch extra { + case 20: + t.RemoteDataFinalized = false + case 21: + t.RemoteDataFinalized = true + default: + return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) + } + // t.ReplicaUpdateMessage (cid.Cid) (struct) + case "ReplicaUpdateMessage": { @@ -1541,10 +1597,13 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { if err := cr.UnreadByte(); err != nil { return err } - t.RemoteDataCache = new(storiface.SectorLocation) - if err := t.RemoteDataCache.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.RemoteDataCache pointer: %w", err) + + c, err := cbg.ReadCid(cr) + if err != nil { + return xerrors.Errorf("failed to read cid field t.ReplicaUpdateMessage: %w", err) } + + t.ReplicaUpdateMessage = &c } } @@ -1581,64 +1640,6 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { t.RemoteSealingDoneEndpoint = string(sval) } - // t.RemoteDataFinalized (bool) (bool) - case "RemoteDataFinalized": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - if maj != cbg.MajOther { - return fmt.Errorf("booleans must be major type 7") - } - switch extra { - case 20: - t.RemoteDataFinalized = false - case 21: - t.RemoteDataFinalized = true - default: - return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) - } - // t.LastErr (string) (string) - case "LastErr": - - { - sval, err := cbg.ReadString(cr) - if err != nil { - return err - } - - t.LastErr = string(sval) - } - // t.Log ([]sealing.Log) (slice) - case "Log": - - maj, extra, err = cr.ReadHeader() - if err != nil { - return err - } - - if extra > cbg.MaxLength { - return fmt.Errorf("t.Log: array too large (%d)", extra) - } - - if maj != cbg.MajArray { - return fmt.Errorf("expected cbor array") - } - - if extra > 0 { - t.Log = make([]Log, extra) - } - - for i := 0; i < int(extra); i++ { - - var v Log - if err := v.UnmarshalCBOR(cr); err != nil { - return err - } - - t.Log[i] = v - } default: // Field doesn't exist on this type, so ignore it @@ -1660,19 +1661,26 @@ func (t *Log) MarshalCBOR(w io.Writer) error { return err } - // t.Timestamp (uint64) (uint64) - if len("Timestamp") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Timestamp\" was too long") + // t.Kind (string) (string) + if len("Kind") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Kind\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Timestamp"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Kind"))); err != nil { return err } - if _, err := io.WriteString(w, string("Timestamp")); err != nil { + if _, err := io.WriteString(w, string("Kind")); err != nil { return err } - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Timestamp)); err != nil { + if len(t.Kind) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.Kind was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Kind))); err != nil { + return err + } + if _, err := io.WriteString(w, string(t.Kind)); err != nil { return err } @@ -1722,28 +1730,22 @@ func (t *Log) MarshalCBOR(w io.Writer) error { return err } - // t.Kind (string) (string) - if len("Kind") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Kind\" was too long") + // t.Timestamp (uint64) (uint64) + if len("Timestamp") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Timestamp\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Kind"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Timestamp"))); err != nil { return err } - if _, err := io.WriteString(w, string("Kind")); err != nil { + if _, err := io.WriteString(w, string("Timestamp")); err != nil { return err } - if len(t.Kind) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.Kind was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Kind))); err != nil { - return err - } - if _, err := io.WriteString(w, string(t.Kind)); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Timestamp)); err != nil { return err } + return nil } @@ -1785,20 +1787,16 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Timestamp (uint64) (uint64) - case "Timestamp": + // t.Kind (string) (string) + case "Kind": { - - maj, extra, err = cr.ReadHeader() + sval, err := cbg.ReadString(cr) if err != nil { return err } - if maj != cbg.MajUnsignedInt { - return fmt.Errorf("wrong type for uint64 field") - } - t.Timestamp = uint64(extra) + t.Kind = string(sval) } // t.Trace (string) (string) case "Trace": @@ -1822,16 +1820,20 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) { t.Message = string(sval) } - // t.Kind (string) (string) - case "Kind": + // t.Timestamp (uint64) (uint64) + case "Timestamp": { - sval, err := cbg.ReadString(cr) + + maj, extra, err = cr.ReadHeader() if err != nil { return err } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.Timestamp = uint64(extra) - t.Kind = string(sval) } default: diff --git a/storage/sealer/cbor_gen.go b/storage/sealer/cbor_gen.go index 48bf0146a45..4fa7fd98042 100644 --- a/storage/sealer/cbor_gen.go +++ b/storage/sealer/cbor_gen.go @@ -48,29 +48,6 @@ func (t *Call) MarshalCBOR(w io.Writer) error { return err } - // t.RetType (sealer.ReturnType) (string) - if len("RetType") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"RetType\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RetType"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("RetType")); err != nil { - return err - } - - if len(t.RetType) > cbg.MaxLength { - return xerrors.Errorf("Value in field t.RetType was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RetType))); err != nil { - return err - } - if _, err := io.WriteString(w, string(t.RetType)); err != nil { - return err - } - // t.State (sealer.CallState) (uint64) if len("State") > cbg.MaxLength { return xerrors.Errorf("Value in field \"State\" was too long") @@ -102,6 +79,29 @@ func (t *Call) MarshalCBOR(w io.Writer) error { if err := t.Result.MarshalCBOR(cw); err != nil { return err } + + // t.RetType (sealer.ReturnType) (string) + if len("RetType") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"RetType\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("RetType"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("RetType")); err != nil { + return err + } + + if len(t.RetType) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.RetType was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.RetType))); err != nil { + return err + } + if _, err := io.WriteString(w, string(t.RetType)); err != nil { + return err + } return nil } @@ -153,17 +153,6 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.RetType (sealer.ReturnType) (string) - case "RetType": - - { - sval, err := cbg.ReadString(cr) - if err != nil { - return err - } - - t.RetType = ReturnType(sval) - } // t.State (sealer.CallState) (uint64) case "State": @@ -199,6 +188,17 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) { } } + // t.RetType (sealer.ReturnType) (string) + case "RetType": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.RetType = ReturnType(sval) + } default: // Field doesn't exist on this type, so ignore it @@ -259,20 +259,26 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { return err } - // t.WorkerCall (storiface.CallID) (struct) - if len("WorkerCall") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"WorkerCall\" was too long") + // t.StartTime (int64) (int64) + if len("StartTime") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"StartTime\" was too long") } - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WorkerCall"))); err != nil { + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartTime"))); err != nil { return err } - if _, err := io.WriteString(w, string("WorkerCall")); err != nil { + if _, err := io.WriteString(w, string("StartTime")); err != nil { return err } - if err := t.WorkerCall.MarshalCBOR(cw); err != nil { - return err + if t.StartTime >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartTime)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartTime-1)); err != nil { + return err + } } // t.WorkError (string) (string) @@ -298,6 +304,22 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { return err } + // t.WorkerCall (storiface.CallID) (struct) + if len("WorkerCall") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"WorkerCall\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WorkerCall"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("WorkerCall")); err != nil { + return err + } + + if err := t.WorkerCall.MarshalCBOR(cw); err != nil { + return err + } + // t.WorkerHostname (string) (string) if len("WorkerHostname") > cbg.MaxLength { return xerrors.Errorf("Value in field \"WorkerHostname\" was too long") @@ -320,28 +342,6 @@ func (t *WorkState) MarshalCBOR(w io.Writer) error { if _, err := io.WriteString(w, string(t.WorkerHostname)); err != nil { return err } - - // t.StartTime (int64) (int64) - if len("StartTime") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"StartTime\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartTime"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("StartTime")); err != nil { - return err - } - - if t.StartTime >= 0 { - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartTime)); err != nil { - return err - } - } else { - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartTime-1)); err != nil { - return err - } - } return nil } @@ -404,15 +404,31 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { t.Status = WorkStatus(sval) } - // t.WorkerCall (storiface.CallID) (struct) - case "WorkerCall": - + // t.StartTime (int64) (int64) + case "StartTime": { - - if err := t.WorkerCall.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.WorkerCall: %w", err) + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) } + t.StartTime = int64(extraI) } // t.WorkError (string) (string) case "WorkError": @@ -425,42 +441,26 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) { t.WorkError = string(sval) } - // t.WorkerHostname (string) (string) - case "WorkerHostname": + // t.WorkerCall (storiface.CallID) (struct) + case "WorkerCall": { - sval, err := cbg.ReadString(cr) - if err != nil { - return err + + if err := t.WorkerCall.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.WorkerCall: %w", err) } - t.WorkerHostname = string(sval) } - // t.StartTime (int64) (int64) - case "StartTime": + // t.WorkerHostname (string) (string) + case "WorkerHostname": + { - maj, extra, err := cr.ReadHeader() - var extraI int64 + sval, err := cbg.ReadString(cr) if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) - } - t.StartTime = int64(extraI) + t.WorkerHostname = string(sval) } default: diff --git a/storage/sealer/storiface/cbor_gen.go b/storage/sealer/storiface/cbor_gen.go index 73a299dec74..2f82da3e6ef 100644 --- a/storage/sealer/storiface/cbor_gen.go +++ b/storage/sealer/storiface/cbor_gen.go @@ -30,22 +30,6 @@ func (t *CallID) MarshalCBOR(w io.Writer) error { return err } - // t.Sector (abi.SectorID) (struct) - if len("Sector") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Sector\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Sector"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("Sector")); err != nil { - return err - } - - if err := t.Sector.MarshalCBOR(cw); err != nil { - return err - } - // t.ID (uuid.UUID) (array) if len("ID") > cbg.MaxLength { return xerrors.Errorf("Value in field \"ID\" was too long") @@ -69,6 +53,22 @@ func (t *CallID) MarshalCBOR(w io.Writer) error { if _, err := cw.Write(t.ID[:]); err != nil { return err } + + // t.Sector (abi.SectorID) (struct) + if len("Sector") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Sector\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Sector"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("Sector")); err != nil { + return err + } + + if err := t.Sector.MarshalCBOR(cw); err != nil { + return err + } return nil } @@ -110,17 +110,7 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Sector (abi.SectorID) (struct) - case "Sector": - - { - - if err := t.Sector.UnmarshalCBOR(cr); err != nil { - return xerrors.Errorf("unmarshaling t.Sector: %w", err) - } - - } - // t.ID (uuid.UUID) (array) + // t.ID (uuid.UUID) (array) case "ID": maj, extra, err = cr.ReadHeader() @@ -144,6 +134,16 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) { if _, err := io.ReadFull(cr, t.ID[:]); err != nil { return err } + // t.Sector (abi.SectorID) (struct) + case "Sector": + + { + + if err := t.Sector.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.Sector: %w", err) + } + + } default: // Field doesn't exist on this type, so ignore it @@ -294,22 +294,6 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { return err } - // t.Local (bool) (bool) - if len("Local") > cbg.MaxLength { - return xerrors.Errorf("Value in field \"Local\" was too long") - } - - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Local"))); err != nil { - return err - } - if _, err := io.WriteString(w, string("Local")); err != nil { - return err - } - - if err := cbg.WriteBool(w, t.Local); err != nil { - return err - } - // t.URL (string) (string) if len("URL") > cbg.MaxLength { return xerrors.Errorf("Value in field \"URL\" was too long") @@ -333,6 +317,22 @@ func (t *SectorLocation) MarshalCBOR(w io.Writer) error { return err } + // t.Local (bool) (bool) + if len("Local") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"Local\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Local"))); err != nil { + return err + } + if _, err := io.WriteString(w, string("Local")); err != nil { + return err + } + + if err := cbg.WriteBool(w, t.Local); err != nil { + return err + } + // t.Headers ([]storiface.SecDataHttpHeader) (slice) if len("Headers") > cbg.MaxLength { return xerrors.Errorf("Value in field \"Headers\" was too long") @@ -398,7 +398,18 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) { } switch name { - // t.Local (bool) (bool) + // t.URL (string) (string) + case "URL": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.URL = string(sval) + } + // t.Local (bool) (bool) case "Local": maj, extra, err = cr.ReadHeader() @@ -416,17 +427,6 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) { default: return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra) } - // t.URL (string) (string) - case "URL": - - { - sval, err := cbg.ReadString(cr) - if err != nil { - return err - } - - t.URL = string(sval) - } // t.Headers ([]storiface.SecDataHttpHeader) (slice) case "Headers":