lotus/chain/actors/cbor_gen.go
2019-10-31 09:55:35 -07:00

3774 lines
72 KiB
Go

package actors
import (
"fmt"
"io"
"github.com/filecoin-project/lotus/chain/address"
"github.com/filecoin-project/lotus/chain/types"
"github.com/libp2p/go-libp2p-core/peer"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
)
/* This file was generated by github.com/whyrusleeping/cbor-gen */
var _ = xerrors.Errorf
func (t *InitActorState) 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.AddressMap (cid.Cid)
if err := cbg.WriteCid(w, t.AddressMap); err != nil {
return xerrors.Errorf("failed to write cid field t.AddressMap: %w", err)
}
// t.t.NextID (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.NextID)); err != nil {
return err
}
return nil
}
func (t *InitActorState) 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.AddressMap (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.AddressMap: %w", err)
}
t.AddressMap = c
}
// t.t.NextID (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.NextID = extra
return nil
}
func (t *ExecParams) 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.Code (cid.Cid)
if err := cbg.WriteCid(w, t.Code); err != nil {
return xerrors.Errorf("failed to write cid field t.Code: %w", err)
}
// t.t.Params ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil {
return err
}
if _, err := w.Write(t.Params); err != nil {
return err
}
return nil
}
func (t *ExecParams) 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.Code (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Code: %w", err)
}
t.Code = c
}
// t.t.Params ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Params = make([]byte, extra)
if _, err := io.ReadFull(br, t.Params); err != nil {
return err
}
return nil
}
func (t *AccountActorState) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Address (address.Address)
if err := t.Address.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *AccountActorState) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Address (address.Address)
{
if err := t.Address.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *StorageMinerActorState) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{139}); err != nil {
return err
}
// t.t.PreCommittedSectors (map[string]*actors.UnprovenSector)
if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.PreCommittedSectors))); err != nil {
return err
}
for k, v := range t.PreCommittedSectors {
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)
if err := cbg.WriteCid(w, t.Sectors); err != nil {
return xerrors.Errorf("failed to write cid field t.Sectors: %w", err)
}
// t.t.ProvingSet (cid.Cid)
if err := cbg.WriteCid(w, t.ProvingSet); err != nil {
return xerrors.Errorf("failed to write cid field t.ProvingSet: %w", err)
}
// t.t.Info (cid.Cid)
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)
if err := t.CurrentFaultSet.MarshalCBOR(w); err != nil {
return err
}
// t.t.NextFaultSet (types.BitField)
if err := t.NextFaultSet.MarshalCBOR(w); err != nil {
return err
}
// t.t.NextDoneSet (types.BitField)
if err := t.NextDoneSet.MarshalCBOR(w); err != nil {
return err
}
// t.t.Power (types.BigInt)
if err := t.Power.MarshalCBOR(w); err != nil {
return err
}
// t.t.SlashedAt (types.BigInt)
if err := t.SlashedAt.MarshalCBOR(w); err != nil {
return err
}
// t.t.OwedStorageCollateral (types.BigInt)
if err := t.OwedStorageCollateral.MarshalCBOR(w); err != nil {
return err
}
// t.t.ProvingPeriodEnd (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.ProvingPeriodEnd)); err != nil {
return err
}
return nil
}
func (t *StorageMinerActorState) 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 != 11 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.PreCommittedSectors (map[string]*actors.UnprovenSector)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajMap {
return fmt.Errorf("expected a map (major type 5)")
}
if extra > 4096 {
return fmt.Errorf("t.PreCommittedSectors: map too large")
}
t.PreCommittedSectors = make(map[string]*UnprovenSector, extra)
for i, l := 0, int(extra); i < l; i++ {
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)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Sectors: %w", err)
}
t.Sectors = c
}
// t.t.ProvingSet (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.ProvingSet: %w", err)
}
t.ProvingSet = c
}
// t.t.Info (cid.Cid)
{
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)
{
if err := t.CurrentFaultSet.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.NextFaultSet (types.BitField)
{
if err := t.NextFaultSet.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.NextDoneSet (types.BitField)
{
if err := t.NextDoneSet.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Power (types.BigInt)
{
if err := t.Power.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.SlashedAt (types.BigInt)
{
if err := t.SlashedAt.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.OwedStorageCollateral (types.BigInt)
{
if err := t.OwedStorageCollateral.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ProvingPeriodEnd (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.ProvingPeriodEnd = extra
return nil
}
func (t *StorageMinerConstructorParams) 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.Owner (address.Address)
if err := t.Owner.MarshalCBOR(w); err != nil {
return err
}
// t.t.Worker (address.Address)
if err := t.Worker.MarshalCBOR(w); err != nil {
return err
}
// t.t.SectorSize (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SectorSize)); err != nil {
return err
}
// t.t.PeerID (peer.ID)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil {
return err
}
if _, err := w.Write([]byte(t.PeerID)); err != nil {
return err
}
return nil
}
func (t *StorageMinerConstructorParams) 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.Owner (address.Address)
{
if err := t.Owner.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Worker (address.Address)
{
if err := t.Worker.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.SectorSize (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 = extra
// t.t.PeerID (peer.ID)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
t.PeerID = peer.ID(sval)
}
return nil
}
func (t *SectorPreCommitInfo) 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)
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)
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.Epoch (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Epoch)); err != nil {
return err
}
// t.t.SectorNumber (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SectorNumber)); err != nil {
return err
}
return nil
}
func (t *SectorPreCommitInfo) 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)
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)
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.Epoch (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.Epoch = extra
// t.t.SectorNumber (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.SectorNumber = extra
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)
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)
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)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SubmitHeight)); err != nil {
return err
}
// t.t.TicketEpoch (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, 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)
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)
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)
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 = extra
// t.t.TicketEpoch (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 = extra
return nil
}
func (t *MinerInfo) 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.Owner (address.Address)
if err := t.Owner.MarshalCBOR(w); err != nil {
return err
}
// t.t.Worker (address.Address)
if err := t.Worker.MarshalCBOR(w); err != nil {
return err
}
// t.t.PeerID (peer.ID)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil {
return err
}
if _, err := w.Write([]byte(t.PeerID)); err != nil {
return err
}
// t.t.SectorSize (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SectorSize)); err != nil {
return err
}
return nil
}
func (t *MinerInfo) 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.Owner (address.Address)
{
if err := t.Owner.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Worker (address.Address)
{
if err := t.Worker.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.PeerID (peer.ID)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
t.PeerID = peer.ID(sval)
}
// t.t.SectorSize (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 = extra
return nil
}
func (t *SubmitPoStParams) 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.Proof ([]uint8)
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.DoneSet (types.BitField)
if err := t.DoneSet.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *SubmitPoStParams) 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.Proof ([]uint8)
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.DoneSet (types.BitField)
{
if err := t.DoneSet.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *PaymentVerifyParams) 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.Extra ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Extra)))); err != nil {
return err
}
if _, err := w.Write(t.Extra); err != nil {
return err
}
// t.t.Proof ([]uint8)
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
}
return nil
}
func (t *PaymentVerifyParams) 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.Extra ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Extra: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Extra = make([]byte, extra)
if _, err := io.ReadFull(br, t.Extra); err != nil {
return err
}
// t.t.Proof ([]uint8)
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
}
return nil
}
func (t *UpdatePeerIDParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.PeerID (peer.ID)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil {
return err
}
if _, err := w.Write([]byte(t.PeerID)); err != nil {
return err
}
return nil
}
func (t *UpdatePeerIDParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.PeerID (peer.ID)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
t.PeerID = peer.ID(sval)
}
return nil
}
func (t *MultiSigActorState) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{135}); err != nil {
return err
}
// t.t.Signers ([]address.Address)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Signers)))); err != nil {
return err
}
for _, v := range t.Signers {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
// t.t.Required (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Required)); err != nil {
return err
}
// t.t.NextTxID (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.NextTxID)); err != nil {
return err
}
// t.t.InitialBalance (types.BigInt)
if err := t.InitialBalance.MarshalCBOR(w); err != nil {
return err
}
// t.t.StartingBlock (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.StartingBlock)); err != nil {
return err
}
// t.t.UnlockDuration (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.UnlockDuration)); err != nil {
return err
}
// t.t.Transactions ([]actors.MTransaction)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Transactions)))); err != nil {
return err
}
for _, v := range t.Transactions {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
return nil
}
func (t *MultiSigActorState) 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 != 7 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Signers ([]address.Address)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Signers: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Signers = make([]address.Address, extra)
}
for i := 0; i < int(extra); i++ {
var v address.Address
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Signers[i] = v
}
// t.t.Required (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.Required = extra
// t.t.NextTxID (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.NextTxID = extra
// t.t.InitialBalance (types.BigInt)
{
if err := t.InitialBalance.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.StartingBlock (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.StartingBlock = extra
// t.t.UnlockDuration (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.UnlockDuration = extra
// t.t.Transactions ([]actors.MTransaction)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Transactions: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Transactions = make([]MTransaction, extra)
}
for i := 0; i < int(extra); i++ {
var v MTransaction
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Transactions[i] = v
}
return nil
}
func (t *MultiSigConstructorParams) 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.Signers ([]address.Address)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Signers)))); err != nil {
return err
}
for _, v := range t.Signers {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
// t.t.Required (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Required)); err != nil {
return err
}
// t.t.UnlockDuration (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.UnlockDuration)); err != nil {
return err
}
return nil
}
func (t *MultiSigConstructorParams) 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.Signers ([]address.Address)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Signers: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Signers = make([]address.Address, extra)
}
for i := 0; i < int(extra); i++ {
var v address.Address
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Signers[i] = v
}
// t.t.Required (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.Required = extra
// t.t.UnlockDuration (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.UnlockDuration = extra
return nil
}
func (t *MultiSigProposeParams) 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.To (address.Address)
if err := t.To.MarshalCBOR(w); err != nil {
return err
}
// t.t.Value (types.BigInt)
if err := t.Value.MarshalCBOR(w); err != nil {
return err
}
// t.t.Method (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Method)); err != nil {
return err
}
// t.t.Params ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil {
return err
}
if _, err := w.Write(t.Params); err != nil {
return err
}
return nil
}
func (t *MultiSigProposeParams) 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.To (address.Address)
{
if err := t.To.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Value (types.BigInt)
{
if err := t.Value.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Method (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.Method = extra
// t.t.Params ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Params = make([]byte, extra)
if _, err := io.ReadFull(br, t.Params); err != nil {
return err
}
return nil
}
func (t *MultiSigTxID) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.TxID (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.TxID)); err != nil {
return err
}
return nil
}
func (t *MultiSigTxID) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.TxID (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.TxID = extra
return nil
}
func (t *MultiSigSwapSignerParams) 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.From (address.Address)
if err := t.From.MarshalCBOR(w); err != nil {
return err
}
// t.t.To (address.Address)
if err := t.To.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *MultiSigSwapSignerParams) 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.From (address.Address)
{
if err := t.From.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.To (address.Address)
{
if err := t.To.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *MultiSigChangeReqParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Req (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Req)); err != nil {
return err
}
return nil
}
func (t *MultiSigChangeReqParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Req (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.Req = extra
return nil
}
func (t *MTransaction) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{138}); err != nil {
return err
}
// t.t.Created (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Created)); err != nil {
return err
}
// t.t.TxID (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.TxID)); err != nil {
return err
}
// t.t.To (address.Address)
if err := t.To.MarshalCBOR(w); err != nil {
return err
}
// t.t.Value (types.BigInt)
if err := t.Value.MarshalCBOR(w); err != nil {
return err
}
// t.t.Method (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Method)); err != nil {
return err
}
// t.t.Params ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Params)))); err != nil {
return err
}
if _, err := w.Write(t.Params); err != nil {
return err
}
// t.t.Approved ([]address.Address)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Approved)))); err != nil {
return err
}
for _, v := range t.Approved {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
// t.t.Complete (bool)
if err := cbg.WriteBool(w, t.Complete); err != nil {
return err
}
// t.t.Canceled (bool)
if err := cbg.WriteBool(w, t.Canceled); err != nil {
return err
}
// t.t.RetCode (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.RetCode)); err != nil {
return err
}
return nil
}
func (t *MTransaction) 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 != 10 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Created (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.Created = extra
// t.t.TxID (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.TxID = extra
// t.t.To (address.Address)
{
if err := t.To.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Value (types.BigInt)
{
if err := t.Value.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Method (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.Method = extra
// t.t.Params ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Params: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Params = make([]byte, extra)
if _, err := io.ReadFull(br, t.Params); err != nil {
return err
}
// t.t.Approved ([]address.Address)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Approved: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Approved = make([]address.Address, extra)
}
for i := 0; i < int(extra); i++ {
var v address.Address
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Approved[i] = v
}
// t.t.Complete (bool)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Complete = false
case 21:
t.Complete = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.t.Canceled (bool)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Canceled = false
case 21:
t.Canceled = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.t.RetCode (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.RetCode = extra
return nil
}
func (t *MultiSigRemoveSignerParam) 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.Signer (address.Address)
if err := t.Signer.MarshalCBOR(w); err != nil {
return err
}
// t.t.Decrease (bool)
if err := cbg.WriteBool(w, t.Decrease); err != nil {
return err
}
return nil
}
func (t *MultiSigRemoveSignerParam) 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.Signer (address.Address)
{
if err := t.Signer.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Decrease (bool)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Decrease = false
case 21:
t.Decrease = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
return nil
}
func (t *MultiSigAddSignerParam) 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.Signer (address.Address)
if err := t.Signer.MarshalCBOR(w); err != nil {
return err
}
// t.t.Increase (bool)
if err := cbg.WriteBool(w, t.Increase); err != nil {
return err
}
return nil
}
func (t *MultiSigAddSignerParam) 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.Signer (address.Address)
{
if err := t.Signer.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Increase (bool)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Increase = false
case 21:
t.Increase = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
return nil
}
func (t *PaymentChannelActorState) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{134}); err != nil {
return err
}
// t.t.From (address.Address)
if err := t.From.MarshalCBOR(w); err != nil {
return err
}
// t.t.To (address.Address)
if err := t.To.MarshalCBOR(w); err != nil {
return err
}
// t.t.ToSend (types.BigInt)
if err := t.ToSend.MarshalCBOR(w); err != nil {
return err
}
// t.t.ClosingAt (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.ClosingAt)); err != nil {
return err
}
// t.t.MinCloseHeight (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.MinCloseHeight)); err != nil {
return err
}
// t.t.LaneStates (map[string]*actors.LaneState)
if err := cbg.CborWriteHeader(w, cbg.MajMap, uint64(len(t.LaneStates))); err != nil {
return err
}
for k, v := range t.LaneStates {
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
}
}
return nil
}
func (t *PaymentChannelActorState) 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 != 6 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.From (address.Address)
{
if err := t.From.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.To (address.Address)
{
if err := t.To.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ToSend (types.BigInt)
{
if err := t.ToSend.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ClosingAt (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.ClosingAt = extra
// t.t.MinCloseHeight (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.MinCloseHeight = extra
// t.t.LaneStates (map[string]*actors.LaneState)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajMap {
return fmt.Errorf("expected a map (major type 5)")
}
if extra > 4096 {
return fmt.Errorf("t.LaneStates: map too large")
}
t.LaneStates = make(map[string]*LaneState, extra)
for i, l := 0, int(extra); i < l; i++ {
var k string
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
k = string(sval)
}
var v *LaneState
{
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(LaneState)
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
}
}
t.LaneStates[k] = v
}
return nil
}
func (t *PCAConstructorParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.To (address.Address)
if err := t.To.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *PCAConstructorParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.To (address.Address)
{
if err := t.To.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *LaneState) 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.Closed (bool)
if err := cbg.WriteBool(w, t.Closed); err != nil {
return err
}
// t.t.Redeemed (types.BigInt)
if err := t.Redeemed.MarshalCBOR(w); err != nil {
return err
}
// t.t.Nonce (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Nonce)); err != nil {
return err
}
return nil
}
func (t *LaneState) 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.Closed (bool)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if maj != cbg.MajOther {
return fmt.Errorf("booleans must be major type 7")
}
switch extra {
case 20:
t.Closed = false
case 21:
t.Closed = true
default:
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
}
// t.t.Redeemed (types.BigInt)
{
if err := t.Redeemed.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Nonce (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.Nonce = extra
return nil
}
func (t *PCAUpdateChannelStateParams) 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.Sv (types.SignedVoucher)
if err := t.Sv.MarshalCBOR(w); err != nil {
return err
}
// t.t.Secret ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.Secret)))); err != nil {
return err
}
if _, err := w.Write(t.Secret); err != nil {
return err
}
// t.t.Proof ([]uint8)
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
}
return nil
}
func (t *PCAUpdateChannelStateParams) 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.Sv (types.SignedVoucher)
{
if err := t.Sv.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Secret ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Secret: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.Secret = make([]byte, extra)
if _, err := io.ReadFull(br, t.Secret); err != nil {
return err
}
// t.t.Proof ([]uint8)
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
}
return nil
}
func (t *PaymentInfo) 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.PayChActor (address.Address)
if err := t.PayChActor.MarshalCBOR(w); err != nil {
return err
}
// t.t.Payer (address.Address)
if err := t.Payer.MarshalCBOR(w); err != nil {
return err
}
// t.t.ChannelMessage (cid.Cid)
if t.ChannelMessage == nil {
if _, err := w.Write(cbg.CborNull); err != nil {
return err
}
} else {
if err := cbg.WriteCid(w, *t.ChannelMessage); err != nil {
return xerrors.Errorf("failed to write cid field t.ChannelMessage: %w", err)
}
}
// t.t.Vouchers ([]*types.SignedVoucher)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Vouchers)))); err != nil {
return err
}
for _, v := range t.Vouchers {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
return nil
}
func (t *PaymentInfo) 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.PayChActor (address.Address)
{
if err := t.PayChActor.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Payer (address.Address)
{
if err := t.Payer.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ChannelMessage (cid.Cid)
{
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 {
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.ChannelMessage: %w", err)
}
t.ChannelMessage = &c
}
}
// t.t.Vouchers ([]*types.SignedVoucher)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Vouchers: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Vouchers = make([]*types.SignedVoucher, extra)
}
for i := 0; i < int(extra); i++ {
var v types.SignedVoucher
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Vouchers[i] = &v
}
return nil
}
func (t *StoragePowerState) 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.Miners (cid.Cid)
if err := cbg.WriteCid(w, t.Miners); err != nil {
return xerrors.Errorf("failed to write cid field t.Miners: %w", err)
}
// t.t.MinerCount (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.MinerCount)); err != nil {
return err
}
// t.t.TotalStorage (types.BigInt)
if err := t.TotalStorage.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *StoragePowerState) 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.Miners (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Miners: %w", err)
}
t.Miners = c
}
// t.t.MinerCount (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.MinerCount = extra
// t.t.TotalStorage (types.BigInt)
{
if err := t.TotalStorage.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *CreateStorageMinerParams) 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.Owner (address.Address)
if err := t.Owner.MarshalCBOR(w); err != nil {
return err
}
// t.t.Worker (address.Address)
if err := t.Worker.MarshalCBOR(w); err != nil {
return err
}
// t.t.SectorSize (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.SectorSize)); err != nil {
return err
}
// t.t.PeerID (peer.ID)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajTextString, uint64(len(t.PeerID)))); err != nil {
return err
}
if _, err := w.Write([]byte(t.PeerID)); err != nil {
return err
}
return nil
}
func (t *CreateStorageMinerParams) 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.Owner (address.Address)
{
if err := t.Owner.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Worker (address.Address)
{
if err := t.Worker.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.SectorSize (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 = extra
// t.t.PeerID (peer.ID)
{
sval, err := cbg.ReadString(br)
if err != nil {
return err
}
t.PeerID = peer.ID(sval)
}
return nil
}
func (t *IsMinerParam) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Addr (address.Address)
if err := t.Addr.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *IsMinerParam) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Addr (address.Address)
{
if err := t.Addr.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *PowerLookupParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Miner (address.Address)
if err := t.Miner.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *PowerLookupParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Miner (address.Address)
{
if err := t.Miner.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *UpdateStorageParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Delta (types.BigInt)
if err := t.Delta.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *UpdateStorageParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Delta (types.BigInt)
{
if err := t.Delta.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *ArbitrateConsensusFaultParams) 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.Block1 (types.BlockHeader)
if err := t.Block1.MarshalCBOR(w); err != nil {
return err
}
// t.t.Block2 (types.BlockHeader)
if err := t.Block2.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *ArbitrateConsensusFaultParams) 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.Block1 (types.BlockHeader)
{
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 {
t.Block1 = new(types.BlockHeader)
if err := t.Block1.UnmarshalCBOR(br); err != nil {
return err
}
}
}
// t.t.Block2 (types.BlockHeader)
{
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 {
t.Block2 = new(types.BlockHeader)
if err := t.Block2.UnmarshalCBOR(br); err != nil {
return err
}
}
}
return nil
}
func (t *PledgeCollateralParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Size (types.BigInt)
if err := t.Size.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *PledgeCollateralParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Size (types.BigInt)
{
if err := t.Size.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *MinerSlashConsensusFault) 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.Slasher (address.Address)
if err := t.Slasher.MarshalCBOR(w); err != nil {
return err
}
// t.t.AtHeight (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.AtHeight)); err != nil {
return err
}
// t.t.SlashedCollateral (types.BigInt)
if err := t.SlashedCollateral.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *MinerSlashConsensusFault) 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.Slasher (address.Address)
{
if err := t.Slasher.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.AtHeight (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.AtHeight = extra
// t.t.SlashedCollateral (types.BigInt)
{
if err := t.SlashedCollateral.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *StorageParticipantBalance) 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.Locked (types.BigInt)
if err := t.Locked.MarshalCBOR(w); err != nil {
return err
}
// t.t.Available (types.BigInt)
if err := t.Available.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *StorageParticipantBalance) 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.Locked (types.BigInt)
{
if err := t.Locked.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Available (types.BigInt)
{
if err := t.Available.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *StorageMarketState) 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.Balances (cid.Cid)
if err := cbg.WriteCid(w, t.Balances); err != nil {
return xerrors.Errorf("failed to write cid field t.Balances: %w", err)
}
// t.t.Deals (cid.Cid)
if err := cbg.WriteCid(w, t.Deals); err != nil {
return xerrors.Errorf("failed to write cid field t.Deals: %w", err)
}
// t.t.NextDealID (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.NextDealID)); err != nil {
return err
}
return nil
}
func (t *StorageMarketState) 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.Balances (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Balances: %w", err)
}
t.Balances = c
}
// t.t.Deals (cid.Cid)
{
c, err := cbg.ReadCid(br)
if err != nil {
return xerrors.Errorf("failed to read cid field t.Deals: %w", err)
}
t.Deals = c
}
// t.t.NextDealID (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.NextDealID = extra
return nil
}
func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Balance (types.BigInt)
if err := t.Balance.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *WithdrawBalanceParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Balance (types.BigInt)
{
if err := t.Balance.UnmarshalCBOR(br); err != nil {
return err
}
}
return nil
}
func (t *StorageDealProposal) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{138}); err != nil {
return err
}
// t.t.PieceRef ([]uint8)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(t.PieceRef)))); err != nil {
return err
}
if _, err := w.Write(t.PieceRef); err != nil {
return err
}
// t.t.PieceSize (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.PieceSize)); err != nil {
return err
}
// t.t.PieceSerialization (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.PieceSerialization)); err != nil {
return err
}
// t.t.Client (address.Address)
if err := t.Client.MarshalCBOR(w); err != nil {
return err
}
// t.t.Provider (address.Address)
if err := t.Provider.MarshalCBOR(w); err != nil {
return err
}
// t.t.ProposalExpiration (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.ProposalExpiration)); err != nil {
return err
}
// t.t.Duration (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.Duration)); err != nil {
return err
}
// t.t.StoragePricePerEpoch (types.BigInt)
if err := t.StoragePricePerEpoch.MarshalCBOR(w); err != nil {
return err
}
// t.t.StorageCollateral (types.BigInt)
if err := t.StorageCollateral.MarshalCBOR(w); err != nil {
return err
}
// t.t.ProposerSignature (types.Signature)
if err := t.ProposerSignature.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *StorageDealProposal) 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 != 10 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.PieceRef ([]uint8)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.PieceRef: array too large (%d)", extra)
}
if maj != cbg.MajByteString {
return fmt.Errorf("expected byte array")
}
t.PieceRef = make([]byte, extra)
if _, err := io.ReadFull(br, t.PieceRef); err != nil {
return err
}
// t.t.PieceSize (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.PieceSize = extra
// t.t.PieceSerialization (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.PieceSerialization = extra
// t.t.Client (address.Address)
{
if err := t.Client.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.Provider (address.Address)
{
if err := t.Provider.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ProposalExpiration (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.ProposalExpiration = extra
// t.t.Duration (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.Duration = extra
// t.t.StoragePricePerEpoch (types.BigInt)
{
if err := t.StoragePricePerEpoch.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.StorageCollateral (types.BigInt)
{
if err := t.StorageCollateral.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ProposerSignature (types.Signature)
{
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 {
t.ProposerSignature = new(types.Signature)
if err := t.ProposerSignature.UnmarshalCBOR(br); err != nil {
return err
}
}
}
return nil
}
func (t *StorageDeal) 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.Proposal (actors.StorageDealProposal)
if err := t.Proposal.MarshalCBOR(w); err != nil {
return err
}
// t.t.CounterSignature (types.Signature)
if err := t.CounterSignature.MarshalCBOR(w); err != nil {
return err
}
return nil
}
func (t *StorageDeal) 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.Proposal (actors.StorageDealProposal)
{
if err := t.Proposal.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.CounterSignature (types.Signature)
{
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 {
t.CounterSignature = new(types.Signature)
if err := t.CounterSignature.UnmarshalCBOR(br); err != nil {
return err
}
}
}
return nil
}
func (t *PublishStorageDealsParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Deals ([]actors.StorageDeal)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Deals)))); err != nil {
return err
}
for _, v := range t.Deals {
if err := v.MarshalCBOR(w); err != nil {
return err
}
}
return nil
}
func (t *PublishStorageDealsParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Deals ([]actors.StorageDeal)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Deals: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Deals = make([]StorageDeal, extra)
}
for i := 0; i < int(extra); i++ {
var v StorageDeal
if err := v.UnmarshalCBOR(br); err != nil {
return err
}
t.Deals[i] = v
}
return nil
}
func (t *PublishStorageDealResponse) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.DealIDs ([]uint64)
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 *PublishStorageDealResponse) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.DealIDs ([]uint64)
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
}
func (t *ActivateStorageDealsParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.Deals ([]uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajArray, uint64(len(t.Deals)))); err != nil {
return err
}
for _, v := range t.Deals {
if err := cbg.CborWriteHeader(w, cbg.MajUnsignedInt, v); err != nil {
return err
}
}
return nil
}
func (t *ActivateStorageDealsParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.Deals ([]uint64)
maj, extra, err = cbg.CborReadHeader(br)
if err != nil {
return err
}
if extra > 8192 {
return fmt.Errorf("t.Deals: array too large (%d)", extra)
}
if maj != cbg.MajArray {
return fmt.Errorf("expected cbor array")
}
if extra > 0 {
t.Deals = make([]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.Deals slice: %w", err)
}
if maj != cbg.MajUnsignedInt {
return xerrors.Errorf("value read for array t.Deals was not a uint, instead got %d", maj)
}
t.Deals[i] = val
}
return nil
}
func (t *ProcessStorageDealsPaymentParams) MarshalCBOR(w io.Writer) error {
if t == nil {
_, err := w.Write(cbg.CborNull)
return err
}
if _, err := w.Write([]byte{129}); err != nil {
return err
}
// t.t.DealIDs ([]uint64)
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 *ProcessStorageDealsPaymentParams) 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 != 1 {
return fmt.Errorf("cbor input had wrong number of fields")
}
// t.t.DealIDs ([]uint64)
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
}
func (t *OnChainDeal) 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.Deal (actors.StorageDeal)
if err := t.Deal.MarshalCBOR(w); err != nil {
return err
}
// t.t.ActivationEpoch (uint64)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, t.ActivationEpoch)); err != nil {
return err
}
return nil
}
func (t *OnChainDeal) 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.Deal (actors.StorageDeal)
{
if err := t.Deal.UnmarshalCBOR(br); err != nil {
return err
}
}
// t.t.ActivationEpoch (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.ActivationEpoch = extra
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)
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)
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, 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)
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)
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 = extra
return nil
}