Update cbor-gen post-merge

This commit is contained in:
Łukasz Magiera 2019-11-05 19:02:28 +01:00
parent ed5ccfd750
commit bcf9778b18
3 changed files with 426 additions and 143 deletions

View File

@ -197,24 +197,28 @@ func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{140}); err != nil { if _, err := w.Write([]byte{139}); err != nil {
return err return err
} }
// t.t.Info (cid.Cid) (struct) // t.t.PreCommittedSectors (map[string]*actors.UnprovenSector) (map)
if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.PreCommittedSectors))); err != nil {
if err := cbg.WriteCid(w, t.Info); err != nil {
return xerrors.Errorf("failed to write cid field t.Info: %w", err)
}
// t.t.DePledgedCollateral (types.BigInt) (struct)
if err := t.DePledgedCollateral.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.DePledgeTime (types.BigInt) (struct) for k, v := range t.PreCommittedSectors {
if err := t.DePledgeTime.MarshalCBOR(w); err != nil {
return err if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(k)))); err != nil {
return err
}
if _, err := w.Write([]byte(k)); err != nil {
return err
}
if err := v.MarshalCBOR(w); err != nil {
return err
}
} }
// t.t.Sectors (cid.Cid) (struct) // t.t.Sectors (cid.Cid) (struct)
@ -229,6 +233,12 @@ func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error {
return xerrors.Errorf("failed to write cid field t.ProvingSet: %w", err) return xerrors.Errorf("failed to write cid field t.ProvingSet: %w", err)
} }
// t.t.Info (cid.Cid) (struct)
if err := cbg.WriteCid(w, t.Info); err != nil {
return xerrors.Errorf("failed to write cid field t.Info: %w", err)
}
// t.t.CurrentFaultSet (types.BitField) (struct) // t.t.CurrentFaultSet (types.BitField) (struct)
if err := t.CurrentFaultSet.MarshalCBOR(w); err != nil { if err := t.CurrentFaultSet.MarshalCBOR(w); err != nil {
return err return err
@ -277,39 +287,62 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type array")
} }
if extra != 12 { if extra != 11 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.t.Info (cid.Cid) (struct) // t.t.PreCommittedSectors (map[string]*actors.UnprovenSector) (map)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Info: %w", err)
}
t.Info = c
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
} }
// t.t.DePledgedCollateral (types.BigInt) (struct) if maj != cbg.MajMap {
return fmt.Errorf("expected a map (major type 5)")
{ }
if extra > 4096 {
if err := t.DePledgedCollateral.UnmarshalCBOR(br); err != nil { return fmt.Errorf("t.PreCommittedSectors: map too large")
return err
}
} }
// t.t.DePledgeTime (types.BigInt) (struct)
{ t.PreCommittedSectors = make(map[string]*UnprovenSector, extra)
if err := t.DePledgeTime.UnmarshalCBOR(br); err != nil { for i, l := 0, int(extra); i < l; i++ {
return err
var k string
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
k = string(sval)
} }
var v *UnprovenSector
{
pb, err := br.PeekByte()
if err != nil {
return err
}
if pb == cbg.CborNull[0] {
var nbuf [1]byte
if _, err := br.Read(nbuf[:]); err != nil {
return err
}
} else {
v = new(UnprovenSector)
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
}
}
t.PreCommittedSectors[k] = v
} }
// t.t.Sectors (cid.Cid) (struct) // t.t.Sectors (cid.Cid) (struct)
@ -334,6 +367,18 @@ func (t *StorageMinerActorState) UnmarshalCBOR(r io.Reader) error {
t.ProvingSet = c t.ProvingSet = c
}
// t.t.Info (cid.Cid) (struct)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Info: %w", err)
}
t.Info = c
} }
// t.t.CurrentFaultSet (types.BitField) (struct) // t.t.CurrentFaultSet (types.BitField) (struct)
@ -492,12 +537,12 @@ func (t *StorageMinerConstructorParams) UnmarshalCBOR(r io.Reader) error {
return nil return nil
} }
func (t *OnChainSealVerifyInfo) MarshalCBOR(w io.Writer) error { func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error {
if t == nil { if t == nil {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
return err return err
} }
if _, err := w.Write([]byte{134}); err != nil { if _, err := w.Write([]byte{132}); err != nil {
return err return err
} }
@ -522,24 +567,6 @@ func (t *OnChainSealVerifyInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Proof ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil {
return err
}
if _, err := w.Write(t.Proof); err != nil {
return err
}
// t.t.DealIDs ([]uint64) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil {
return err
}
for _, v := range t.DealIDs {
if err := cbg.CborWriteHeader(w, cbg.MajUnsignedInt, v); err != nil {
return err
}
}
// t.t.SectorNumber (uint64) (uint64) // t.t.SectorNumber (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorNumber))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorNumber))); err != nil {
return err return err
@ -547,7 +574,7 @@ func (t *OnChainSealVerifyInfo) MarshalCBOR(w io.Writer) error {
return nil return nil
} }
func (t *OnChainSealVerifyInfo) UnmarshalCBOR(r io.Reader) error { func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error {
br := cbg.GetPeeker(r) br := cbg.GetPeeker(r)
maj, extra, err := cbg.CborReadHeader(br) maj, extra, err := cbg.CborReadHeader(br)
@ -558,7 +585,7 @@ func (t *OnChainSealVerifyInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input should be of type array") return fmt.Errorf("cbor input should be of type array")
} }
if extra != 6 { if extra != 4 {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
@ -606,53 +633,6 @@ func (t *OnChainSealVerifyInfo) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Epoch = uint64(extra) t.Epoch = uint64(extra)
// t.t.Proof ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Proof = make([]byte, extra)
if _, err := io.ReadFull(br, t.Proof); err != nil {
return err
}
// t.t.DealIDs ([]uint64) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.DealIDs = make([]uint64, extra)
}
for i := 0; i < int(extra); i++ {
maj, val, err := cbg.CborReadHeader(br)
if err != nil {
return xerrors.Errorf("failed to read uint64 for t.DealIDs slice: %w", err)
}
if maj != cbg.MajUnsignedInt {
return xerrors.Errorf("value read for array t.DealIDs was not a uint, instead got %d", maj)
}
t.DealIDs[i] = val
}
// t.t.SectorNumber (uint64) (uint64) // t.t.SectorNumber (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
@ -666,6 +646,115 @@ func (t *OnChainSealVerifyInfo) UnmarshalCBOR(r io.Reader) error {
return nil return nil
} }
func (t *UnprovenSector) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{132}); err != nil {
return err
}
// t.t.CommD ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommD)))); err != nil {
return err
}
if _, err := w.Write(t.CommD); err != nil {
return err
}
// t.t.CommR ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.CommR)))); err != nil {
return err
}
if _, err := w.Write(t.CommR); err != nil {
return err
}
// t.t.SubmitHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SubmitHeight))); err != nil {
return err
}
// t.t.TicketEpoch (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.TicketEpoch))); err != nil {
return err
}
return nil
}
func (t *UnprovenSector) UnmarshalCBOR(r io.Reader) error {
br := cbg.GetPeeker(r)
maj, extra, err := cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 4 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.CommD ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.CommD: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.CommD = make([]byte, extra)
if _, err := io.ReadFull(br, t.CommD); err != nil {
return err
}
// t.t.CommR ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.CommR: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.CommR = make([]byte, extra)
if _, err := io.ReadFull(br, t.CommR); err != nil {
return err
}
// t.t.SubmitHeight (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.SubmitHeight = uint64(extra)
// t.t.TicketEpoch (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.TicketEpoch = uint64(extra)
return nil
}
func (t *MinerInfo) MarshalCBOR(w io.Writer) error { func (t *MinerInfo) MarshalCBOR(w io.Writer) error {
if t == nil { if t == nil {
_, err := w.Write(cbg.CborNull) _, err := w.Write(cbg.CborNull)
@ -3598,3 +3687,196 @@ func (t *OnChainDeal) UnmarshalCBOR(r io.Reader) error {
t.ActivationEpoch = uint64(extra) t.ActivationEpoch = uint64(extra)
return nil return nil
} }
func (t *ComputeDataCommitmentParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{130}); err != nil {
return err
}
// t.t.DealIDs ([]uint64) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil {
return err
}
for _, v := range t.DealIDs {
if err := cbg.CborWriteHeader(w, cbg.MajUnsignedInt, v); err != nil {
return err
}
}
// t.t.SectorSize (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorSize))); err != nil {
return err
}
return nil
}
func (t *ComputeDataCommitmentParams) UnmarshalCBOR(r io.Reader) error {
br := cbg.GetPeeker(r)
maj, extra, err := cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 2 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.DealIDs ([]uint64) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.DealIDs = make([]uint64, extra)
}
for i := 0; i < int(extra); i++ {
maj, val, err := cbg.CborReadHeader(br)
if err != nil {
return xerrors.Errorf("failed to read uint64 for t.DealIDs slice: %w", err)
}
if maj != cbg.MajUnsignedInt {
return xerrors.Errorf("value read for array t.DealIDs was not a uint, instead got %d", maj)
}
t.DealIDs[i] = val
}
// t.t.SectorSize (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.SectorSize = uint64(extra)
return nil
}
func (t *SectorProveCommitInfo) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{131}); err != nil {
return err
}
// t.t.Proof ([]uint8) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Proof)))); err != nil {
return err
}
if _, err := w.Write(t.Proof); err != nil {
return err
}
// t.t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil {
return err
}
// t.t.DealIDs ([]uint64) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.DealIDs)))); err != nil {
return err
}
for _, v := range t.DealIDs {
if err := cbg.CborWriteHeader(w, cbg.MajUnsignedInt, v); err != nil {
return err
}
}
return nil
}
func (t *SectorProveCommitInfo) UnmarshalCBOR(r io.Reader) error {
br := cbg.GetPeeker(r)
maj, extra, err := cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajArray {
return fmt.Errorf("cbor input should be of type array")
}
if extra != 3 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Proof ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Proof: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Proof = make([]byte, extra)
if _, err := io.ReadFull(br, t.Proof); err != nil {
return err
}
// t.t.SectorID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field")
}
t.SectorID = uint64(extra)
// t.t.DealIDs ([]uint64) (slice)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.DealIDs = make([]uint64, extra)
}
for i := 0; i < int(extra); i++ {
maj, val, err := cbg.CborReadHeader(br)
if err != nil {
return xerrors.Errorf("failed to read uint64 for t.DealIDs slice: %w", err)
}
if maj != cbg.MajUnsignedInt {
return xerrors.Errorf("value read for array t.DealIDs was not a uint, instead got %d", maj)
}
t.DealIDs[i] = val
}
return nil
}

View File

@ -1480,7 +1480,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Cids ([]cid.Cid) // t.t.Cids ([]cid.Cid) (slice)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Cids)))); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Cids)))); err != nil {
return err return err
} }
@ -1490,7 +1490,7 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Blocks ([]*types.BlockHeader) // t.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
} }
@ -1500,8 +1500,8 @@ func (t *ExpTipSet) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.Height (uint64) // t.t.Height (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Height)); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.Height))); err != nil {
return err return err
} }
return nil return nil
@ -1522,7 +1522,7 @@ func (t *ExpTipSet) 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.Cids ([]cid.Cid) // t.t.Cids ([]cid.Cid) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -1547,7 +1547,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error {
t.Cids[i] = c t.Cids[i] = c
} }
// t.t.Blocks ([]*types.BlockHeader) // t.t.Blocks ([]*types.BlockHeader) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -1573,7 +1573,7 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error {
t.Blocks[i] = &v t.Blocks[i] = &v
} }
// t.t.Height (uint64) // t.t.Height (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -1582,6 +1582,6 @@ func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajUnsignedInt { if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.Height = extra t.Height = uint64(extra)
return nil return nil
} }

View File

@ -2,10 +2,11 @@ package storage
import ( import (
"fmt" "fmt"
"io"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors" xerrors "golang.org/x/xerrors"
"io"
) )
/* This file was generated by github.com/whyrusleeping/cbor-gen */ /* This file was generated by github.com/whyrusleeping/cbor-gen */
@ -21,12 +22,12 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.BlockHeight (uint64) // t.t.BlockHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, 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) // t.t.TicketBytes ([]uint8) (slice)
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
} }
@ -51,7 +52,7 @@ func (t *SealTicket) 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.BlockHeight (uint64) // t.t.BlockHeight (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -60,8 +61,8 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajUnsignedInt { if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.BlockHeight = extra t.BlockHeight = uint64(extra)
// t.t.TicketBytes ([]uint8) // t.t.TicketBytes ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -90,17 +91,17 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.State (uint64) // t.t.State (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, 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) // t.t.SectorID (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SectorID)); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.SectorID))); err != nil {
return err return err
} }
// t.t.CommD ([]uint8) // 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
} }
@ -108,7 +109,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.CommR ([]uint8) // t.t.CommR ([]uint8) (slice)
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
} }
@ -116,12 +117,12 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
// t.t.Ticket (storage.SealTicket) // t.t.Ticket (storage.SealTicket) (struct)
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) // t.t.PreCommitMessage (cid.Cid) (struct)
if t.PreCommitMessage == nil { if t.PreCommitMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -133,17 +134,17 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
} }
} }
// t.t.RandHeight (uint64) // t.t.RandHeight (uint64) (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.RandHeight)); err != nil { if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.RandHeight))); err != nil {
return err return err
} }
// t.t.RandTs (types.TipSet) // t.t.RandTs (types.TipSet) (struct)
if err := t.RandTs.MarshalCBOR(w); err != nil { if err := t.RandTs.MarshalCBOR(w); err != nil {
return err return err
} }
// t.t.CommitMessage (cid.Cid) // t.t.CommitMessage (cid.Cid) (struct)
if t.CommitMessage == nil { if t.CommitMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil { if _, err := w.Write(cbg.CborNull); err != nil {
@ -173,7 +174,7 @@ func (t *SectorInfo) 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) // t.t.State (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -182,8 +183,8 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajUnsignedInt { if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.State = extra t.State = uint64(extra)
// t.t.SectorID (uint64) // t.t.SectorID (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -192,8 +193,8 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajUnsignedInt { if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.SectorID = extra t.SectorID = uint64(extra)
// t.t.CommD ([]uint8) // t.t.CommD ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -210,7 +211,7 @@ 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) // t.t.CommR ([]uint8) (slice)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -227,7 +228,7 @@ 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.Ticket (storage.SealTicket) // t.t.Ticket (storage.SealTicket) (struct)
{ {
@ -236,7 +237,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.PreCommitMessage (cid.Cid) // t.t.PreCommitMessage (cid.Cid) (struct)
{ {
@ -260,7 +261,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.RandHeight (uint64) // t.t.RandHeight (uint64) (uint64)
maj, extra, err = cbg.CborReadHeader(br) maj, extra, err = cbg.CborReadHeader(br)
if err != nil { if err != nil {
@ -269,8 +270,8 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
if maj != cbg.MajUnsignedInt { if maj != cbg.MajUnsignedInt {
return fmt.Errorf("wrong type for uint64 field") return fmt.Errorf("wrong type for uint64 field")
} }
t.RandHeight = extra t.RandHeight = uint64(extra)
// t.t.RandTs (types.TipSet) // t.t.RandTs (types.TipSet) (struct)
{ {
@ -291,7 +292,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
} }
} }
// t.t.CommitMessage (cid.Cid) // t.t.CommitMessage (cid.Cid) (struct)
{ {