Use map encoders for some structs

This commit is contained in:
Łukasz Magiera 2019-12-09 17:40:15 +01:00
parent 1d7dd4711d
commit 94df2c656e
13 changed files with 1285 additions and 769 deletions

View File

@ -87,9 +87,9 @@ type SectorInfo struct {
Deals []uint64 Deals []uint64
Ticket sectorbuilder.SealTicket Ticket sectorbuilder.SealTicket
Seed sectorbuilder.SealSeed Seed sectorbuilder.SealSeed
Retries uint64 Retries uint64
LastErr string LastErr string
} }
type SealedRef struct { type SealedRef struct {

View File

@ -18,16 +18,29 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{131}); err != nil { if _, err := w.Write([]byte{163}); err != nil {
return err
}
// t.Channel (address.Address) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Channel")))); err != nil {
return err
}
if _, err := w.Write([]byte("Channel")); err != nil {
return err return err
} }
// t.t.Channel (address.Address) (struct)
if err := t.Channel.MarshalCBOR(w); err != nil { if err := t.Channel.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.ChannelMessage (cid.Cid) (struct) // t.ChannelMessage (cid.Cid) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("ChannelMessage")))); err != nil {
return err
}
if _, err := w.Write([]byte("ChannelMessage")); err != nil {
return err
}
if t.ChannelMessage == nil { if t.ChannelMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -39,7 +52,14 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Vouchers ([]*types.SignedVoucher) (slice) // t.Vouchers ([]*types.SignedVoucher) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Vouchers")))); err != nil {
return err
}
if _, err := w.Write([]byte("Vouchers")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil {
return err return err
} }
@ -58,15 +78,30 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 3 { if extra != 3 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Channel (address.Address) (struct) var name string
// t.Channel (address.Address) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Channel" {
return fmt.Errorf("expected struct map entry %s to be Channel", name)
}
{ {
@ -75,7 +110,20 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.ChannelMessage (cid.Cid) (struct) // t.ChannelMessage (cid.Cid) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "ChannelMessage" {
return fmt.Errorf("expected struct map entry %s to be ChannelMessage", name)
}
{ {
@ -99,13 +147,27 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Vouchers ([]*types.SignedVoucher) (slice) // t.Vouchers ([]*types.SignedVoucher) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Vouchers" {
return fmt.Errorf("expected struct map entry %s to be Vouchers", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra) return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
} }
@ -133,21 +195,42 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{131}); err != nil { if _, err := w.Write([]byte{163}); err != nil {
return err
}
// t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorID")))); err != nil {
return err
}
if _, err := w.Write([]byte("SectorID")); err != nil {
return err return err
} }
// t.t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil {
return err return err
} }
// t.t.Offset (uint64) (uint64) // t.Offset (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Offset")))); err != nil {
return err
}
if _, err := w.Write([]byte("Offset")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil {
return err return err
} }
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Size")))); err != nil {
return err
}
if _, err := w.Write([]byte("Size")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil {
return err return err
} }
@ -161,15 +244,30 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 3 { if extra != 3 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.SectorID (uint64) (uint64) var name string
// t.SectorID (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "SectorID" {
return fmt.Errorf("expected struct map entry %s to be SectorID", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -179,7 +277,20 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.SectorID = uint64(extra) t.SectorID = uint64(extra)
// t.t.Offset (uint64) (uint64) // t.Offset (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Offset" {
return fmt.Errorf("expected struct map entry %s to be Offset", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -189,7 +300,20 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Offset = uint64(extra) t.Offset = uint64(extra)
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Size" {
return fmt.Errorf("expected struct map entry %s to be Size", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -207,11 +331,18 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{129}); err != nil { if _, err := w.Write([]byte{161}); err != nil {
return err
}
// t.Refs ([]api.SealedRef) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Refs")))); err != nil {
return err
}
if _, err := w.Write([]byte("Refs")); err != nil {
return err return err
} }
// t.t.Refs ([]api.SealedRef) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Refs)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Refs)))); err != nil {
return err return err
} }
@ -230,21 +361,37 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 1 { if extra != 1 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Refs ([]api.SealedRef) (slice) var name string
// t.Refs ([]api.SealedRef) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Refs" {
return fmt.Errorf("expected struct map entry %s to be Refs", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Refs: array too large (%d)", extra) return fmt.Errorf("t.Refs: array too large (%d)", extra)
} }

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ func (t *BlockSyncRequest) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Start ([]cid.Cid) (slice) // t.Start ([]cid.Cid) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Start)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Start)))); err != nil {
return err return err
} }
@ -33,12 +33,12 @@ func (t *BlockSyncRequest) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.RequestLength (uint64) (uint64) // t.RequestLength (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.RequestLength))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.RequestLength))); err != nil {
return err return err
} }
// t.t.Options (uint64) (uint64) // t.Options (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Options))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Options))); err != nil {
return err return err
} }
@ -60,13 +60,14 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Start ([]cid.Cid) (slice) // t.Start ([]cid.Cid) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Start: array too large (%d)", extra) return fmt.Errorf("t.Start: array too large (%d)", extra)
} }
@ -85,7 +86,7 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error {
t.Start[i] = c t.Start[i] = c
} }
// t.t.RequestLength (uint64) (uint64) // t.RequestLength (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -95,7 +96,7 @@ func (t *BlockSyncRequest) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.RequestLength = uint64(extra) t.RequestLength = uint64(extra)
// t.t.Options (uint64) (uint64) // t.Options (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -117,7 +118,7 @@ func (t *BlockSyncResponse) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Chain ([]*blocksync.BSTipSet) (slice) // t.Chain ([]*blocksync.BSTipSet) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Chain)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Chain)))); err != nil {
return err return err
} }
@ -127,12 +128,12 @@ func (t *BlockSyncResponse) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Status (uint64) (uint64) // t.Status (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil {
return err return err
} }
// t.t.Message (string) (string) // t.Message (string) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil {
return err return err
} }
@ -157,13 +158,14 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Chain ([]*blocksync.BSTipSet) (slice) // t.Chain ([]*blocksync.BSTipSet) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Chain: array too large (%d)", extra) return fmt.Errorf("t.Chain: array too large (%d)", extra)
} }
@ -183,7 +185,7 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error {
t.Chain[i] = &v t.Chain[i] = &v
} }
// t.t.Status (uint64) (uint64) // t.Status (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -193,7 +195,7 @@ func (t *BlockSyncResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Status = uint64(extra) t.Status = uint64(extra)
// t.t.Message (string) (string) // t.Message (string) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -215,7 +217,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Blocks ([]*types.BlockHeader) (slice) // t.Blocks ([]*types.BlockHeader) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Blocks)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Blocks)))); err != nil {
return err return err
} }
@ -225,7 +227,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.BlsMessages ([]*types.Message) (slice) // t.BlsMessages ([]*types.Message) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMessages)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMessages)))); err != nil {
return err return err
} }
@ -235,7 +237,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.BlsMsgIncludes ([][]uint64) (slice) // t.BlsMsgIncludes ([][]uint64) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMsgIncludes)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.BlsMsgIncludes)))); err != nil {
return err return err
} }
@ -250,7 +252,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.SecpkMessages ([]*types.SignedMessage) (slice) // t.SecpkMessages ([]*types.SignedMessage) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMessages)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMessages)))); err != nil {
return err return err
} }
@ -260,7 +262,7 @@ func (t *BSTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.SecpkMsgIncludes ([][]uint64) (slice) // t.SecpkMsgIncludes ([][]uint64) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMsgIncludes)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.SecpkMsgIncludes)))); err != nil {
return err return err
} }
@ -292,13 +294,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Blocks ([]*types.BlockHeader) (slice) // t.Blocks ([]*types.BlockHeader) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Blocks: array too large (%d)", extra) return fmt.Errorf("t.Blocks: array too large (%d)", extra)
} }
@ -318,13 +321,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
t.Blocks[i] = &v t.Blocks[i] = &v
} }
// t.t.BlsMessages ([]*types.Message) (slice) // t.BlsMessages ([]*types.Message) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMessages: array too large (%d)", extra) return fmt.Errorf("t.BlsMessages: array too large (%d)", extra)
} }
@ -344,13 +348,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
t.BlsMessages[i] = &v t.BlsMessages[i] = &v
} }
// t.t.BlsMsgIncludes ([][]uint64) (slice) // t.BlsMsgIncludes ([][]uint64) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMsgIncludes: array too large (%d)", extra) return fmt.Errorf("t.BlsMsgIncludes: array too large (%d)", extra)
} }
@ -370,7 +375,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.BlsMsgIncludes[i]: array too large (%d)", extra) return fmt.Errorf("t.BlsMsgIncludes[i]: array too large (%d)", extra)
} }
@ -397,13 +403,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.SecpkMessages ([]*types.SignedMessage) (slice) // t.SecpkMessages ([]*types.SignedMessage) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra) return fmt.Errorf("t.SecpkMessages: array too large (%d)", extra)
} }
@ -423,13 +430,14 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
t.SecpkMessages[i] = &v t.SecpkMessages[i] = &v
} }
// t.t.SecpkMsgIncludes ([][]uint64) (slice) // t.SecpkMsgIncludes ([][]uint64) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMsgIncludes: array too large (%d)", extra) return fmt.Errorf("t.SecpkMsgIncludes: array too large (%d)", extra)
} }
@ -449,7 +457,8 @@ func (t *BSTipSet) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.SecpkMsgIncludes[i]: array too large (%d)", extra) return fmt.Errorf("t.SecpkMsgIncludes[i]: array too large (%d)", extra)
} }

View File

@ -24,7 +24,7 @@ func (t *AskRequest) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Miner (address.Address) (struct) // t.Miner (address.Address) (struct)
if err := t.Miner.MarshalCBOR(w); err != nil { if err := t.Miner.MarshalCBOR(w); err != nil {
return err return err
} }
@ -46,7 +46,7 @@ func (t *AskRequest) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Miner (address.Address) (struct) // t.Miner (address.Address) (struct)
{ {
@ -67,7 +67,7 @@ func (t *AskResponse) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Ask (types.SignedStorageAsk) (struct) // t.Ask (types.SignedStorageAsk) (struct)
if err := t.Ask.MarshalCBOR(w); err != nil { if err := t.Ask.MarshalCBOR(w); err != nil {
return err return err
} }
@ -89,7 +89,7 @@ func (t *AskResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Ask (types.SignedStorageAsk) (struct) // t.Ask (types.SignedStorageAsk) (struct)
{ {
@ -122,12 +122,12 @@ func (t *Proposal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.DealProposal (actors.StorageDealProposal) (struct) // t.DealProposal (actors.StorageDealProposal) (struct)
if err := t.DealProposal.MarshalCBOR(w); err != nil { if err := t.DealProposal.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Piece (cid.Cid) (struct) // t.Piece (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Piece); err != nil { if err := cbg.WriteCid(w, t.Piece); err != nil {
return xerrors.Errorf("failed to write cid field t.Piece: %w", err) return xerrors.Errorf("failed to write cid field t.Piece: %w", err)
@ -151,7 +151,7 @@ func (t *Proposal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.DealProposal (actors.StorageDealProposal) (struct) // t.DealProposal (actors.StorageDealProposal) (struct)
{ {
@ -172,7 +172,7 @@ func (t *Proposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Piece (cid.Cid) (struct) // t.Piece (cid.Cid) (struct)
{ {
@ -196,12 +196,12 @@ func (t *Response) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil {
return err return err
} }
// t.t.Message (string) (string) // t.Message (string) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil {
return err return err
} }
@ -209,18 +209,18 @@ func (t *Response) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Proposal (cid.Cid) (struct) // t.Proposal (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Proposal); err != nil { if err := cbg.WriteCid(w, t.Proposal); err != nil {
return xerrors.Errorf("failed to write cid field t.Proposal: %w", err) return xerrors.Errorf("failed to write cid field t.Proposal: %w", err)
} }
// t.t.StorageDeal (actors.StorageDeal) (struct) // t.StorageDeal (actors.StorageDeal) (struct)
if err := t.StorageDeal.MarshalCBOR(w); err != nil { if err := t.StorageDeal.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.PublishMessage (cid.Cid) (struct) // t.PublishMessage (cid.Cid) (struct)
if t.PublishMessage == nil { if t.PublishMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -250,7 +250,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -260,7 +260,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.State = uint64(extra) t.State = uint64(extra)
// t.t.Message (string) (string) // t.Message (string) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -270,7 +270,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error {
t.Message = string(sval) t.Message = string(sval)
} }
// t.t.Proposal (cid.Cid) (struct) // t.Proposal (cid.Cid) (struct)
{ {
@ -282,7 +282,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error {
t.Proposal = c t.Proposal = c
} }
// t.t.StorageDeal (actors.StorageDeal) (struct) // t.StorageDeal (actors.StorageDeal) (struct)
{ {
@ -303,7 +303,7 @@ func (t *Response) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.PublishMessage (cid.Cid) (struct) // t.PublishMessage (cid.Cid) (struct)
{ {
@ -339,12 +339,12 @@ func (t *SignedResponse) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Response (deals.Response) (struct) // t.Response (deals.Response) (struct)
if err := t.Response.MarshalCBOR(w); err != nil { if err := t.Response.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Signature (types.Signature) (struct) // t.Signature (types.Signature) (struct)
if err := t.Signature.MarshalCBOR(w); err != nil { if err := t.Signature.MarshalCBOR(w); err != nil {
return err return err
} }
@ -366,7 +366,7 @@ func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Response (deals.Response) (struct) // t.Response (deals.Response) (struct)
{ {
@ -375,7 +375,7 @@ func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Signature (types.Signature) (struct) // t.Signature (types.Signature) (struct)
{ {
@ -408,43 +408,43 @@ func (t *ClientDealProposal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Data (cid.Cid) (struct) // t.Data (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Data); err != nil { if err := cbg.WriteCid(w, t.Data); err != nil {
return xerrors.Errorf("failed to write cid field t.Data: %w", err) return xerrors.Errorf("failed to write cid field t.Data: %w", err)
} }
// t.t.PricePerEpoch (types.BigInt) (struct) // t.PricePerEpoch (types.BigInt) (struct)
if err := t.PricePerEpoch.MarshalCBOR(w); err != nil { if err := t.PricePerEpoch.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.ProposalExpiration (uint64) (uint64) // t.ProposalExpiration (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ProposalExpiration))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.ProposalExpiration))); err != nil {
return err return err
} }
// t.t.Duration (uint64) (uint64) // t.Duration (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Duration))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Duration))); err != nil {
return err return err
} }
// t.t.ProviderAddress (address.Address) (struct) // t.ProviderAddress (address.Address) (struct)
if err := t.ProviderAddress.MarshalCBOR(w); err != nil { if err := t.ProviderAddress.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Client (address.Address) (struct) // t.Client (address.Address) (struct)
if err := t.Client.MarshalCBOR(w); err != nil { if err := t.Client.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.MinerWorker (address.Address) (struct) // t.MinerWorker (address.Address) (struct)
if err := t.MinerWorker.MarshalCBOR(w); err != nil { if err := t.MinerWorker.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.MinerID (peer.ID) (string) // t.MinerID (peer.ID) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.MinerID)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.MinerID)))); err != nil {
return err return err
} }
@ -469,7 +469,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Data (cid.Cid) (struct) // t.Data (cid.Cid) (struct)
{ {
@ -481,7 +481,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
t.Data = c t.Data = c
} }
// t.t.PricePerEpoch (types.BigInt) (struct) // t.PricePerEpoch (types.BigInt) (struct)
{ {
@ -490,7 +490,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.ProposalExpiration (uint64) (uint64) // t.ProposalExpiration (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -500,7 +500,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.ProposalExpiration = uint64(extra) t.ProposalExpiration = uint64(extra)
// t.t.Duration (uint64) (uint64) // t.Duration (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -510,7 +510,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Duration = uint64(extra) t.Duration = uint64(extra)
// t.t.ProviderAddress (address.Address) (struct) // t.ProviderAddress (address.Address) (struct)
{ {
@ -519,7 +519,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Client (address.Address) (struct) // t.Client (address.Address) (struct)
{ {
@ -528,7 +528,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.MinerWorker (address.Address) (struct) // t.MinerWorker (address.Address) (struct)
{ {
@ -537,7 +537,7 @@ func (t *ClientDealProposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.MinerID (peer.ID) (string) // t.MinerID (peer.ID) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -559,23 +559,23 @@ func (t *ClientDeal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.ProposalCid (cid.Cid) (struct) // t.ProposalCid (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.ProposalCid); err != nil { if err := cbg.WriteCid(w, t.ProposalCid); err != nil {
return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err) return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err)
} }
// t.t.Proposal (actors.StorageDealProposal) (struct) // t.Proposal (actors.StorageDealProposal) (struct)
if err := t.Proposal.MarshalCBOR(w); err != nil { if err := t.Proposal.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil {
return err return err
} }
// t.t.Miner (peer.ID) (string) // t.Miner (peer.ID) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Miner)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Miner)))); err != nil {
return err return err
} }
@ -583,17 +583,17 @@ func (t *ClientDeal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.MinerWorker (address.Address) (struct) // t.MinerWorker (address.Address) (struct)
if err := t.MinerWorker.MarshalCBOR(w); err != nil { if err := t.MinerWorker.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil {
return err return err
} }
// t.t.PublishMessage (cid.Cid) (struct) // t.PublishMessage (cid.Cid) (struct)
if t.PublishMessage == nil { if t.PublishMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -623,7 +623,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.ProposalCid (cid.Cid) (struct) // t.ProposalCid (cid.Cid) (struct)
{ {
@ -635,7 +635,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
t.ProposalCid = c t.ProposalCid = c
} }
// t.t.Proposal (actors.StorageDealProposal) (struct) // t.Proposal (actors.StorageDealProposal) (struct)
{ {
@ -644,7 +644,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -654,7 +654,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.State = uint64(extra) t.State = uint64(extra)
// t.t.Miner (peer.ID) (string) // t.Miner (peer.ID) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -664,7 +664,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
t.Miner = peer.ID(sval) t.Miner = peer.ID(sval)
} }
// t.t.MinerWorker (address.Address) (struct) // t.MinerWorker (address.Address) (struct)
{ {
@ -673,7 +673,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -683,7 +683,7 @@ func (t *ClientDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.DealID = uint64(extra) t.DealID = uint64(extra)
// t.t.PublishMessage (cid.Cid) (struct) // t.PublishMessage (cid.Cid) (struct)
{ {
@ -719,7 +719,7 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Client (peer.ID) (string) // t.Client (peer.ID) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Client)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Client)))); err != nil {
return err return err
} }
@ -727,34 +727,34 @@ func (t *MinerDeal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Proposal (actors.StorageDealProposal) (struct) // t.Proposal (actors.StorageDealProposal) (struct)
if err := t.Proposal.MarshalCBOR(w); err != nil { if err := t.Proposal.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.ProposalCid (cid.Cid) (struct) // t.ProposalCid (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.ProposalCid); err != nil { if err := cbg.WriteCid(w, t.ProposalCid); err != nil {
return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err) return xerrors.Errorf("failed to write cid field t.ProposalCid: %w", err)
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil {
return err return err
} }
// t.t.Ref (cid.Cid) (struct) // t.Ref (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Ref); err != nil { if err := cbg.WriteCid(w, t.Ref); err != nil {
return xerrors.Errorf("failed to write cid field t.Ref: %w", err) return xerrors.Errorf("failed to write cid field t.Ref: %w", err)
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil {
return err return err
} }
// t.t.SectorID (uint64) (uint64) // t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil {
return err return err
} }
@ -776,7 +776,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Client (peer.ID) (string) // t.Client (peer.ID) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -786,7 +786,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
t.Client = peer.ID(sval) t.Client = peer.ID(sval)
} }
// t.t.Proposal (actors.StorageDealProposal) (struct) // t.Proposal (actors.StorageDealProposal) (struct)
{ {
@ -795,7 +795,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.ProposalCid (cid.Cid) (struct) // t.ProposalCid (cid.Cid) (struct)
{ {
@ -807,7 +807,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
t.ProposalCid = c t.ProposalCid = c
} }
// t.t.State (uint64) (uint64) // t.State (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -817,7 +817,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.State = uint64(extra) t.State = uint64(extra)
// t.t.Ref (cid.Cid) (struct) // t.Ref (cid.Cid) (struct)
{ {
@ -829,7 +829,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
t.Ref = c t.Ref = c
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -839,7 +839,7 @@ func (t *MinerDeal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.DealID = uint64(extra) t.DealID = uint64(extra)
// t.t.SectorID (uint64) (uint64) // t.SectorID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -861,13 +861,13 @@ func (t *StorageDataTransferVoucher) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Proposal (cid.Cid) (struct) // t.Proposal (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Proposal); err != nil { if err := cbg.WriteCid(w, t.Proposal); err != nil {
return xerrors.Errorf("failed to write cid field t.Proposal: %w", err) return xerrors.Errorf("failed to write cid field t.Proposal: %w", err)
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil {
return err return err
} }
@ -889,7 +889,7 @@ func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Proposal (cid.Cid) (struct) // t.Proposal (cid.Cid) (struct)
{ {
@ -901,7 +901,7 @@ func (t *StorageDataTransferVoucher) UnmarshalCBOR(r io.Reader) error {
t.Proposal = c t.Proposal = c
} }
// t.t.DealID (uint64) (uint64) // t.DealID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ func main() {
os.Exit(1) os.Exit(1)
} }
err = gen.WriteTupleEncodersToFile("./api/cbor_gen.go", "api", err = gen.WriteMapEncodersToFile("./api/cbor_gen.go", "api",
api.PaymentInfo{}, api.PaymentInfo{},
api.SealedRef{}, api.SealedRef{},
api.SealedRefs{}, api.SealedRefs{},
@ -154,7 +154,7 @@ func main() {
os.Exit(1) os.Exit(1)
} }
err = gen.WriteTupleEncodersToFile("./storage/cbor_gen.go", "storage", err = gen.WriteMapEncodersToFile("./storage/cbor_gen.go", "storage",
storage.SealTicket{}, storage.SealTicket{},
storage.SealSeed{}, storage.SealSeed{},
storage.Piece{}, storage.Piece{},

2
go.mod
View File

@ -86,7 +86,7 @@ require (
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
github.com/stretchr/testify v1.4.0 github.com/stretchr/testify v1.4.0
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d
go.opencensus.io v0.22.1 go.opencensus.io v0.22.1

2
go.sum
View File

@ -586,6 +586,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20190910031516-c1cbffdb01bb/go.mod h1:x
github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo=
github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa h1:iuIvC21JR4TcHtdCtkXz2jG8KCAK9ZJQQQxbDkFxkNE=
github.com/whyrusleeping/cbor-gen v0.0.0-20191209162422-1c55bd7cf8aa/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=

View File

@ -167,7 +167,7 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid uint64) (api.S
Deals: deals, Deals: deals,
Ticket: info.Ticket.SB(), Ticket: info.Ticket.SB(),
Seed: info.Seed.SB(), Seed: info.Seed.SB(),
Retries: info.Nonce, Retries: info.Nonce,
LastErr: info.LastErr, LastErr: info.LastErr,
}, nil }, nil

View File

@ -22,12 +22,12 @@ func (t *VoucherInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Voucher (types.SignedVoucher) (struct) // t.Voucher (types.SignedVoucher) (struct)
if err := t.Voucher.MarshalCBOR(w); err != nil { if err := t.Voucher.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Proof ([]uint8) (slice) // t.Proof ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil {
return err return err
} }
@ -52,7 +52,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Voucher (types.SignedVoucher) (struct) // t.Voucher (types.SignedVoucher) (struct)
{ {
@ -73,16 +73,16 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Proof ([]uint8) (slice) // t.Proof ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -102,27 +102,27 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Channel (address.Address) (struct) // t.Channel (address.Address) (struct)
if err := t.Channel.MarshalCBOR(w); err != nil { if err := t.Channel.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Control (address.Address) (struct) // t.Control (address.Address) (struct)
if err := t.Control.MarshalCBOR(w); err != nil { if err := t.Control.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Target (address.Address) (struct) // t.Target (address.Address) (struct)
if err := t.Target.MarshalCBOR(w); err != nil { if err := t.Target.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Direction (uint64) (uint64) // t.Direction (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Direction))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Direction))); err != nil {
return err return err
} }
// t.t.Vouchers ([]*paych.VoucherInfo) (slice) // t.Vouchers ([]*paych.VoucherInfo) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil {
return err return err
} }
@ -132,7 +132,7 @@ func (t *ChannelInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.NextLane (uint64) (uint64) // t.NextLane (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextLane))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.NextLane))); err != nil {
return err return err
} }
@ -154,7 +154,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Channel (address.Address) (struct) // t.Channel (address.Address) (struct)
{ {
@ -163,7 +163,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Control (address.Address) (struct) // t.Control (address.Address) (struct)
{ {
@ -172,7 +172,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Target (address.Address) (struct) // t.Target (address.Address) (struct)
{ {
@ -181,7 +181,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Direction (uint64) (uint64) // t.Direction (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -191,13 +191,14 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Direction = uint64(extra) t.Direction = uint64(extra)
// t.t.Vouchers ([]*paych.VoucherInfo) (slice) // t.Vouchers ([]*paych.VoucherInfo) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra) return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
} }
@ -217,7 +218,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
t.Vouchers[i] = &v t.Vouchers[i] = &v
} }
// t.t.NextLane (uint64) (uint64) // t.NextLane (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {

View File

@ -21,7 +21,7 @@ func (t *RetParams) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Unixfs0 (retrieval.Unixfs0Offer) (struct) // t.Unixfs0 (retrieval.Unixfs0Offer) (struct)
if err := t.Unixfs0.MarshalCBOR(w); err != nil { if err := t.Unixfs0.MarshalCBOR(w); err != nil {
return err return err
} }
@ -43,7 +43,7 @@ func (t *RetParams) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Unixfs0 (retrieval.Unixfs0Offer) (struct) // t.Unixfs0 (retrieval.Unixfs0Offer) (struct)
{ {
@ -76,7 +76,7 @@ func (t *Query) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Piece (cid.Cid) (struct) // t.Piece (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Piece); err != nil { if err := cbg.WriteCid(w, t.Piece); err != nil {
return xerrors.Errorf("failed to write cid field t.Piece: %w", err) return xerrors.Errorf("failed to write cid field t.Piece: %w", err)
@ -100,7 +100,7 @@ func (t *Query) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Piece (cid.Cid) (struct) // t.Piece (cid.Cid) (struct)
{ {
@ -124,17 +124,17 @@ func (t *QueryResponse) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Status (retrieval.QueryResponseStatus) (uint64) // t.Status (retrieval.QueryResponseStatus) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil {
return err return err
} }
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil {
return err return err
} }
// t.t.MinPrice (types.BigInt) (struct) // t.MinPrice (types.BigInt) (struct)
if err := t.MinPrice.MarshalCBOR(w); err != nil { if err := t.MinPrice.MarshalCBOR(w); err != nil {
return err return err
} }
@ -156,7 +156,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Status (retrieval.QueryResponseStatus) (uint64) // t.Status (retrieval.QueryResponseStatus) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -166,7 +166,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Status = QueryResponseStatus(extra) t.Status = QueryResponseStatus(extra)
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -176,7 +176,7 @@ func (t *QueryResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Size = uint64(extra) t.Size = uint64(extra)
// t.t.MinPrice (types.BigInt) (struct) // t.MinPrice (types.BigInt) (struct)
{ {
@ -197,12 +197,12 @@ func (t *Unixfs0Offer) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Offset (uint64) (uint64) // t.Offset (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Offset))); err != nil {
return err return err
} }
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil {
return err return err
} }
@ -224,7 +224,7 @@ func (t *Unixfs0Offer) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Offset (uint64) (uint64) // t.Offset (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -234,7 +234,7 @@ func (t *Unixfs0Offer) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Offset = uint64(extra) t.Offset = uint64(extra)
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -256,18 +256,18 @@ func (t *DealProposal) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Payment (api.PaymentInfo) (struct) // t.Payment (api.PaymentInfo) (struct)
if err := t.Payment.MarshalCBOR(w); err != nil { if err := t.Payment.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.Ref (cid.Cid) (struct) // t.Ref (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Ref); err != nil { if err := cbg.WriteCid(w, t.Ref); err != nil {
return xerrors.Errorf("failed to write cid field t.Ref: %w", err) return xerrors.Errorf("failed to write cid field t.Ref: %w", err)
} }
// t.t.Params (retrieval.RetParams) (struct) // t.Params (retrieval.RetParams) (struct)
if err := t.Params.MarshalCBOR(w); err != nil { if err := t.Params.MarshalCBOR(w); err != nil {
return err return err
} }
@ -289,7 +289,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Payment (api.PaymentInfo) (struct) // t.Payment (api.PaymentInfo) (struct)
{ {
@ -298,7 +298,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Ref (cid.Cid) (struct) // t.Ref (cid.Cid) (struct)
{ {
@ -310,7 +310,7 @@ func (t *DealProposal) UnmarshalCBOR(r io.Reader) error {
t.Ref = c t.Ref = c
} }
// t.t.Params (retrieval.RetParams) (struct) // t.Params (retrieval.RetParams) (struct)
{ {
@ -331,12 +331,12 @@ func (t *DealResponse) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Status (uint64) (uint64) // t.Status (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Status))); err != nil {
return err return err
} }
// t.t.Message (string) (string) // t.Message (string) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.Message)))); err != nil {
return err return err
} }
@ -361,7 +361,7 @@ func (t *DealResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Status (uint64) (uint64) // t.Status (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -371,7 +371,7 @@ func (t *DealResponse) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Status = uint64(extra) t.Status = uint64(extra)
// t.t.Message (string) (string) // t.Message (string) (string)
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)
@ -393,7 +393,7 @@ func (t *Block) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Prefix ([]uint8) (slice) // t.Prefix ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Prefix)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Prefix)))); err != nil {
return err return err
} }
@ -401,7 +401,7 @@ func (t *Block) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Data ([]uint8) (slice) // t.Data ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Data)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Data)))); err != nil {
return err return err
} }
@ -426,16 +426,16 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Prefix ([]uint8) (slice) // t.Prefix ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Prefix: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Prefix: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -443,16 +443,16 @@ func (t *Block) UnmarshalCBOR(r io.Reader) error {
if _, err := io.ReadFull(br, t.Prefix); err != nil { if _, err := io.ReadFull(br, t.Prefix); err != nil {
return err return err
} }
// t.t.Data ([]uint8) (slice) // t.Data ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Data: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.Data: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }

View File

@ -17,16 +17,30 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{130}); err != nil { if _, err := w.Write([]byte{162}); err != nil {
return err
}
// t.BlockHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("BlockHeight")))); err != nil {
return err
}
if _, err := w.Write([]byte("BlockHeight")); err != nil {
return err return err
} }
// t.t.BlockHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil {
return err return err
} }
// t.t.TicketBytes ([]uint8) (slice) // t.TicketBytes ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("TicketBytes")))); err != nil {
return err
}
if _, err := w.Write([]byte("TicketBytes")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil {
return err return err
} }
@ -43,15 +57,30 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 2 { if extra != 2 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.BlockHeight (uint64) (uint64) var name string
// t.BlockHeight (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "BlockHeight" {
return fmt.Errorf("expected struct map entry %s to be BlockHeight", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -61,16 +90,29 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.BlockHeight = uint64(extra) t.BlockHeight = uint64(extra)
// t.t.TicketBytes ([]uint8) (slice) // t.TicketBytes ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "TicketBytes" {
return fmt.Errorf("expected struct map entry %s to be TicketBytes", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.TicketBytes: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -86,16 +128,30 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{130}); err != nil { if _, err := w.Write([]byte{162}); err != nil {
return err
}
// t.BlockHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("BlockHeight")))); err != nil {
return err
}
if _, err := w.Write([]byte("BlockHeight")); err != nil {
return err return err
} }
// t.t.BlockHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.BlockHeight))); err != nil {
return err return err
} }
// t.t.TicketBytes ([]uint8) (slice) // t.TicketBytes ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("TicketBytes")))); err != nil {
return err
}
if _, err := w.Write([]byte("TicketBytes")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.TicketBytes)))); err != nil {
return err return err
} }
@ -112,15 +168,30 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 2 { if extra != 2 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.BlockHeight (uint64) (uint64) var name string
// t.BlockHeight (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "BlockHeight" {
return fmt.Errorf("expected struct map entry %s to be BlockHeight", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -130,16 +201,29 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.BlockHeight = uint64(extra) t.BlockHeight = uint64(extra)
// t.t.TicketBytes ([]uint8) (slice) // t.TicketBytes ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "TicketBytes" {
return fmt.Errorf("expected struct map entry %s to be TicketBytes", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.TicketBytes: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.TicketBytes: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -155,21 +239,42 @@ func (t *Piece) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{131}); err != nil { if _, err := w.Write([]byte{163}); err != nil {
return err
}
// t.DealID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("DealID")))); err != nil {
return err
}
if _, err := w.Write([]byte("DealID")); err != nil {
return err return err
} }
// t.t.DealID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.DealID))); err != nil {
return err return err
} }
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Size")))); err != nil {
return err
}
if _, err := w.Write([]byte("Size")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Size))); err != nil {
return err return err
} }
// t.t.CommP ([]uint8) (slice) // t.CommP ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommP")))); err != nil {
return err
}
if _, err := w.Write([]byte("CommP")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommP)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommP)))); err != nil {
return err return err
} }
@ -186,15 +291,30 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 3 { if extra != 3 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.DealID (uint64) (uint64) var name string
// t.DealID (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "DealID" {
return fmt.Errorf("expected struct map entry %s to be DealID", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -204,7 +324,20 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.DealID = uint64(extra) t.DealID = uint64(extra)
// t.t.Size (uint64) (uint64) // t.Size (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Size" {
return fmt.Errorf("expected struct map entry %s to be Size", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -214,16 +347,29 @@ func (t *Piece) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Size = uint64(extra) t.Size = uint64(extra)
// t.t.CommP ([]uint8) (slice) // t.CommP ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "CommP" {
return fmt.Errorf("expected struct map entry %s to be CommP", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommP: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommP: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -239,26 +385,54 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{142}); err != nil { if _, err := w.Write([]byte{172}); err != nil {
return err
}
// t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("State")))); err != nil {
return err
}
if _, err := w.Write([]byte("State")); err != nil {
return err return err
} }
// t.t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.State))); err != nil {
return err return err
} }
// t.t.SectorID (uint64) (uint64) // t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("SectorID")))); err != nil {
return err
}
if _, err := w.Write([]byte("SectorID")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil {
return err return err
} }
// t.t.Nonce (uint64) (uint64) // t.Nonce (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Nonce")))); err != nil {
return err
}
if _, err := w.Write([]byte("Nonce")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Nonce))); err != nil {
return err return err
} }
// t.t.Pieces ([]storage.Piece) (slice) // t.Pieces ([]storage.Piece) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Pieces")))); err != nil {
return err
}
if _, err := w.Write([]byte("Pieces")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Pieces)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Pieces)))); err != nil {
return err return err
} }
@ -268,15 +442,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Pad0 ([]uint8) (slice) // t.CommD ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Pad0)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommD")))); err != nil {
return err return err
} }
if _, err := w.Write(t.Pad0); err != nil { if _, err := w.Write([]byte("CommD")); err != nil {
return err return err
} }
// t.t.CommD ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommD)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommD)))); err != nil {
return err return err
} }
@ -284,7 +457,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.CommR ([]uint8) (slice) // t.CommR ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommR")))); err != nil {
return err
}
if _, err := w.Write([]byte("CommR")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommR)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommR)))); err != nil {
return err return err
} }
@ -292,15 +472,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Pad1 ([]uint8) (slice) // t.Proof ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Pad1)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Proof")))); err != nil {
return err return err
} }
if _, err := w.Write(t.Pad1); err != nil { if _, err := w.Write([]byte("Proof")); err != nil {
return err return err
} }
// t.t.Proof ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil {
return err return err
} }
@ -308,12 +487,25 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Ticket (storage.SealTicket) (struct) // t.Ticket (storage.SealTicket) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Ticket")))); err != nil {
return err
}
if _, err := w.Write([]byte("Ticket")); err != nil {
return err
}
if err := t.Ticket.MarshalCBOR(w); err != nil { if err := t.Ticket.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.PreCommitMessage (cid.Cid) (struct) // t.PreCommitMessage (cid.Cid) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("PreCommitMessage")))); err != nil {
return err
}
if _, err := w.Write([]byte("PreCommitMessage")); err != nil {
return err
}
if t.PreCommitMessage == nil { if t.PreCommitMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -325,12 +517,25 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Seed (storage.SealSeed) (struct) // t.Seed (storage.SealSeed) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("Seed")))); err != nil {
return err
}
if _, err := w.Write([]byte("Seed")); err != nil {
return err
}
if err := t.Seed.MarshalCBOR(w); err != nil { if err := t.Seed.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.CommitMessage (cid.Cid) (struct) // t.CommitMessage (cid.Cid) (struct)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("CommitMessage")))); err != nil {
return err
}
if _, err := w.Write([]byte("CommitMessage")); err != nil {
return err
}
if t.CommitMessage == nil { if t.CommitMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -342,7 +547,14 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.LastErr (string) (string) // t.LastErr (string) (string)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len("LastErr")))); err != nil {
return err
}
if _, err := w.Write([]byte("LastErr")); err != nil {
return err
}
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.LastErr)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.LastErr)))); err != nil {
return err return err
} }
@ -359,15 +571,30 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
if maj != cbg.MajArray { if maj != cbg.MajMap {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type map")
} }
if extra != 14 { if extra != 12 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.State (uint64) (uint64) var name string
// t.State (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "State" {
return fmt.Errorf("expected struct map entry %s to be State", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -377,7 +604,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.State = uint64(extra) t.State = uint64(extra)
// t.t.SectorID (uint64) (uint64) // t.SectorID (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "SectorID" {
return fmt.Errorf("expected struct map entry %s to be SectorID", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -387,7 +627,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.SectorID = uint64(extra) t.SectorID = uint64(extra)
// t.t.Nonce (uint64) (uint64) // t.Nonce (uint64) (uint64)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Nonce" {
return fmt.Errorf("expected struct map entry %s to be Nonce", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -397,13 +650,27 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Nonce = uint64(extra) t.Nonce = uint64(extra)
// t.t.Pieces ([]storage.Piece) (slice) // t.Pieces ([]storage.Piece) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Pieces" {
return fmt.Errorf("expected struct map entry %s to be Pieces", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
if extra > cbg.MaxLength {
return fmt.Errorf("t.Pieces: array too large (%d)", extra) return fmt.Errorf("t.Pieces: array too large (%d)", extra)
} }
@ -423,33 +690,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
t.Pieces[i] = v t.Pieces[i] = v
} }
// t.t.Pad0 ([]uint8) (slice) // t.CommD ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "CommD" {
return fmt.Errorf("expected struct map entry %s to be CommD", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Pad0: array too large (%d)", extra)
}
if maj != cbg.MajByteString { if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("expected byte array") return fmt.Errorf("t.CommD: byte array too large (%d)", extra)
} }
t.Pad0 = make([]byte, extra)
if _, err := io.ReadFull(br, t.Pad0); err != nil {
return err
}
// t.t.CommD ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.CommD: array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -457,16 +720,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if _, err := io.ReadFull(br, t.CommD); err != nil { if _, err := io.ReadFull(br, t.CommD); err != nil {
return err return err
} }
// t.t.CommR ([]uint8) (slice) // t.CommR ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "CommR" {
return fmt.Errorf("expected struct map entry %s to be CommR", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.CommR: array too large (%d)", extra)
}
if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("t.CommR: byte array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -474,33 +750,29 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if _, err := io.ReadFull(br, t.CommR); err != nil { if _, err := io.ReadFull(br, t.CommR); err != nil {
return err return err
} }
// t.t.Pad1 ([]uint8) (slice) // t.Proof ([]uint8) (slice)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Proof" {
return fmt.Errorf("expected struct map entry %s to be Proof", name)
}
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
return err return err
} }
if extra > 8192 {
return fmt.Errorf("t.Pad1: array too large (%d)", extra)
}
if maj != cbg.MajByteString { if extra > cbg.ByteArrayMaxLen {
return fmt.Errorf("expected byte array") return fmt.Errorf("t.Proof: byte array too large (%d)", extra)
} }
t.Pad1 = make([]byte, extra)
if _, err := io.ReadFull(br, t.Pad1); err != nil {
return err
}
// t.t.Proof ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if maj != cbg.MajByteString { if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array") return fmt.Errorf("expected byte array")
} }
@ -508,7 +780,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if _, err := io.ReadFull(br, t.Proof); err != nil { if _, err := io.ReadFull(br, t.Proof); err != nil {
return err return err
} }
// t.t.Ticket (storage.SealTicket) (struct) // t.Ticket (storage.SealTicket) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Ticket" {
return fmt.Errorf("expected struct map entry %s to be Ticket", name)
}
{ {
@ -517,7 +802,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.PreCommitMessage (cid.Cid) (struct) // t.PreCommitMessage (cid.Cid) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "PreCommitMessage" {
return fmt.Errorf("expected struct map entry %s to be PreCommitMessage", name)
}
{ {
@ -541,7 +839,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.Seed (storage.SealSeed) (struct) // t.Seed (storage.SealSeed) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "Seed" {
return fmt.Errorf("expected struct map entry %s to be Seed", name)
}
{ {
@ -550,7 +861,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.CommitMessage (cid.Cid) (struct) // t.CommitMessage (cid.Cid) (struct)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "CommitMessage" {
return fmt.Errorf("expected struct map entry %s to be CommitMessage", name)
}
{ {
@ -574,7 +898,20 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.LastErr (string) (string) // t.LastErr (string) (string)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
name = string(sval)
}
if name != "LastErr" {
return fmt.Errorf("expected struct map entry %s to be LastErr", name)
}
{ {
sval, err := cbg.ReadString(br) sval, err := cbg.ReadString(br)