github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/builtin/market/cbor_gen.go (about)

     1  // Code generated by github.com/whyrusleeping/cbor-gen. DO NOT EDIT.
     2  
     3  package market
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  
     9  	abi "github.com/filecoin-project/go-state-types/abi"
    10  	cbg "github.com/whyrusleeping/cbor-gen"
    11  	xerrors "golang.org/x/xerrors"
    12  )
    13  
    14  var _ = xerrors.Errorf
    15  
    16  var lengthBufState = []byte{139}
    17  
    18  func (t *State) MarshalCBOR(w io.Writer) error {
    19  	if t == nil {
    20  		_, err := w.Write(cbg.CborNull)
    21  		return err
    22  	}
    23  	if _, err := w.Write(lengthBufState); err != nil {
    24  		return err
    25  	}
    26  
    27  	scratch := make([]byte, 9)
    28  
    29  	// t.Proposals (cid.Cid) (struct)
    30  
    31  	if err := cbg.WriteCidBuf(scratch, w, t.Proposals); err != nil {
    32  		return xerrors.Errorf("failed to write cid field t.Proposals: %w", err)
    33  	}
    34  
    35  	// t.States (cid.Cid) (struct)
    36  
    37  	if err := cbg.WriteCidBuf(scratch, w, t.States); err != nil {
    38  		return xerrors.Errorf("failed to write cid field t.States: %w", err)
    39  	}
    40  
    41  	// t.PendingProposals (cid.Cid) (struct)
    42  
    43  	if err := cbg.WriteCidBuf(scratch, w, t.PendingProposals); err != nil {
    44  		return xerrors.Errorf("failed to write cid field t.PendingProposals: %w", err)
    45  	}
    46  
    47  	// t.EscrowTable (cid.Cid) (struct)
    48  
    49  	if err := cbg.WriteCidBuf(scratch, w, t.EscrowTable); err != nil {
    50  		return xerrors.Errorf("failed to write cid field t.EscrowTable: %w", err)
    51  	}
    52  
    53  	// t.LockedTable (cid.Cid) (struct)
    54  
    55  	if err := cbg.WriteCidBuf(scratch, w, t.LockedTable); err != nil {
    56  		return xerrors.Errorf("failed to write cid field t.LockedTable: %w", err)
    57  	}
    58  
    59  	// t.NextID (abi.DealID) (uint64)
    60  
    61  	if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.NextID)); err != nil {
    62  		return err
    63  	}
    64  
    65  	// t.DealOpsByEpoch (cid.Cid) (struct)
    66  
    67  	if err := cbg.WriteCidBuf(scratch, w, t.DealOpsByEpoch); err != nil {
    68  		return xerrors.Errorf("failed to write cid field t.DealOpsByEpoch: %w", err)
    69  	}
    70  
    71  	// t.LastCron (abi.ChainEpoch) (int64)
    72  	if t.LastCron >= 0 {
    73  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.LastCron)); err != nil {
    74  			return err
    75  		}
    76  	} else {
    77  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.LastCron-1)); err != nil {
    78  			return err
    79  		}
    80  	}
    81  
    82  	// t.TotalClientLockedCollateral (big.Int) (struct)
    83  	if err := t.TotalClientLockedCollateral.MarshalCBOR(w); err != nil {
    84  		return err
    85  	}
    86  
    87  	// t.TotalProviderLockedCollateral (big.Int) (struct)
    88  	if err := t.TotalProviderLockedCollateral.MarshalCBOR(w); err != nil {
    89  		return err
    90  	}
    91  
    92  	// t.TotalClientStorageFee (big.Int) (struct)
    93  	if err := t.TotalClientStorageFee.MarshalCBOR(w); err != nil {
    94  		return err
    95  	}
    96  	return nil
    97  }
    98  
    99  func (t *State) UnmarshalCBOR(r io.Reader) error {
   100  	*t = State{}
   101  
   102  	br := cbg.GetPeeker(r)
   103  	scratch := make([]byte, 8)
   104  
   105  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   106  	if err != nil {
   107  		return err
   108  	}
   109  	if maj != cbg.MajArray {
   110  		return fmt.Errorf("cbor input should be of type array")
   111  	}
   112  
   113  	if extra != 11 {
   114  		return fmt.Errorf("cbor input had wrong number of fields")
   115  	}
   116  
   117  	// t.Proposals (cid.Cid) (struct)
   118  
   119  	{
   120  
   121  		c, err := cbg.ReadCid(br)
   122  		if err != nil {
   123  			return xerrors.Errorf("failed to read cid field t.Proposals: %w", err)
   124  		}
   125  
   126  		t.Proposals = c
   127  
   128  	}
   129  	// t.States (cid.Cid) (struct)
   130  
   131  	{
   132  
   133  		c, err := cbg.ReadCid(br)
   134  		if err != nil {
   135  			return xerrors.Errorf("failed to read cid field t.States: %w", err)
   136  		}
   137  
   138  		t.States = c
   139  
   140  	}
   141  	// t.PendingProposals (cid.Cid) (struct)
   142  
   143  	{
   144  
   145  		c, err := cbg.ReadCid(br)
   146  		if err != nil {
   147  			return xerrors.Errorf("failed to read cid field t.PendingProposals: %w", err)
   148  		}
   149  
   150  		t.PendingProposals = c
   151  
   152  	}
   153  	// t.EscrowTable (cid.Cid) (struct)
   154  
   155  	{
   156  
   157  		c, err := cbg.ReadCid(br)
   158  		if err != nil {
   159  			return xerrors.Errorf("failed to read cid field t.EscrowTable: %w", err)
   160  		}
   161  
   162  		t.EscrowTable = c
   163  
   164  	}
   165  	// t.LockedTable (cid.Cid) (struct)
   166  
   167  	{
   168  
   169  		c, err := cbg.ReadCid(br)
   170  		if err != nil {
   171  			return xerrors.Errorf("failed to read cid field t.LockedTable: %w", err)
   172  		}
   173  
   174  		t.LockedTable = c
   175  
   176  	}
   177  	// t.NextID (abi.DealID) (uint64)
   178  
   179  	{
   180  
   181  		maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
   182  		if err != nil {
   183  			return err
   184  		}
   185  		if maj != cbg.MajUnsignedInt {
   186  			return fmt.Errorf("wrong type for uint64 field")
   187  		}
   188  		t.NextID = abi.DealID(extra)
   189  
   190  	}
   191  	// t.DealOpsByEpoch (cid.Cid) (struct)
   192  
   193  	{
   194  
   195  		c, err := cbg.ReadCid(br)
   196  		if err != nil {
   197  			return xerrors.Errorf("failed to read cid field t.DealOpsByEpoch: %w", err)
   198  		}
   199  
   200  		t.DealOpsByEpoch = c
   201  
   202  	}
   203  	// t.LastCron (abi.ChainEpoch) (int64)
   204  	{
   205  		maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   206  		var extraI int64
   207  		if err != nil {
   208  			return err
   209  		}
   210  		switch maj {
   211  		case cbg.MajUnsignedInt:
   212  			extraI = int64(extra)
   213  			if extraI < 0 {
   214  				return fmt.Errorf("int64 positive overflow")
   215  			}
   216  		case cbg.MajNegativeInt:
   217  			extraI = int64(extra)
   218  			if extraI < 0 {
   219  				return fmt.Errorf("int64 negative oveflow")
   220  			}
   221  			extraI = -1 - extraI
   222  		default:
   223  			return fmt.Errorf("wrong type for int64 field: %d", maj)
   224  		}
   225  
   226  		t.LastCron = abi.ChainEpoch(extraI)
   227  	}
   228  	// t.TotalClientLockedCollateral (big.Int) (struct)
   229  
   230  	{
   231  
   232  		if err := t.TotalClientLockedCollateral.UnmarshalCBOR(br); err != nil {
   233  			return xerrors.Errorf("unmarshaling t.TotalClientLockedCollateral: %w", err)
   234  		}
   235  
   236  	}
   237  	// t.TotalProviderLockedCollateral (big.Int) (struct)
   238  
   239  	{
   240  
   241  		if err := t.TotalProviderLockedCollateral.UnmarshalCBOR(br); err != nil {
   242  			return xerrors.Errorf("unmarshaling t.TotalProviderLockedCollateral: %w", err)
   243  		}
   244  
   245  	}
   246  	// t.TotalClientStorageFee (big.Int) (struct)
   247  
   248  	{
   249  
   250  		if err := t.TotalClientStorageFee.UnmarshalCBOR(br); err != nil {
   251  			return xerrors.Errorf("unmarshaling t.TotalClientStorageFee: %w", err)
   252  		}
   253  
   254  	}
   255  	return nil
   256  }
   257  
   258  var lengthBufVerifyDealsForActivationParams = []byte{129}
   259  
   260  func (t *VerifyDealsForActivationParams) MarshalCBOR(w io.Writer) error {
   261  	if t == nil {
   262  		_, err := w.Write(cbg.CborNull)
   263  		return err
   264  	}
   265  	if _, err := w.Write(lengthBufVerifyDealsForActivationParams); err != nil {
   266  		return err
   267  	}
   268  
   269  	scratch := make([]byte, 9)
   270  
   271  	// t.Sectors ([]market.SectorDeals) (slice)
   272  	if len(t.Sectors) > cbg.MaxLength {
   273  		return xerrors.Errorf("Slice value in field t.Sectors was too long")
   274  	}
   275  
   276  	if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.Sectors))); err != nil {
   277  		return err
   278  	}
   279  	for _, v := range t.Sectors {
   280  		if err := v.MarshalCBOR(w); err != nil {
   281  			return err
   282  		}
   283  	}
   284  	return nil
   285  }
   286  
   287  func (t *VerifyDealsForActivationParams) UnmarshalCBOR(r io.Reader) error {
   288  	*t = VerifyDealsForActivationParams{}
   289  
   290  	br := cbg.GetPeeker(r)
   291  	scratch := make([]byte, 8)
   292  
   293  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   294  	if err != nil {
   295  		return err
   296  	}
   297  	if maj != cbg.MajArray {
   298  		return fmt.Errorf("cbor input should be of type array")
   299  	}
   300  
   301  	if extra != 1 {
   302  		return fmt.Errorf("cbor input had wrong number of fields")
   303  	}
   304  
   305  	// t.Sectors ([]market.SectorDeals) (slice)
   306  
   307  	maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
   308  	if err != nil {
   309  		return err
   310  	}
   311  
   312  	if extra > cbg.MaxLength {
   313  		return fmt.Errorf("t.Sectors: array too large (%d)", extra)
   314  	}
   315  
   316  	if maj != cbg.MajArray {
   317  		return fmt.Errorf("expected cbor array")
   318  	}
   319  
   320  	if extra > 0 {
   321  		t.Sectors = make([]SectorDeals, extra)
   322  	}
   323  
   324  	for i := 0; i < int(extra); i++ {
   325  
   326  		var v SectorDeals
   327  		if err := v.UnmarshalCBOR(br); err != nil {
   328  			return err
   329  		}
   330  
   331  		t.Sectors[i] = v
   332  	}
   333  
   334  	return nil
   335  }
   336  
   337  var lengthBufVerifyDealsForActivationReturn = []byte{129}
   338  
   339  func (t *VerifyDealsForActivationReturn) MarshalCBOR(w io.Writer) error {
   340  	if t == nil {
   341  		_, err := w.Write(cbg.CborNull)
   342  		return err
   343  	}
   344  	if _, err := w.Write(lengthBufVerifyDealsForActivationReturn); err != nil {
   345  		return err
   346  	}
   347  
   348  	scratch := make([]byte, 9)
   349  
   350  	// t.Sectors ([]market.SectorWeights) (slice)
   351  	if len(t.Sectors) > cbg.MaxLength {
   352  		return xerrors.Errorf("Slice value in field t.Sectors was too long")
   353  	}
   354  
   355  	if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.Sectors))); err != nil {
   356  		return err
   357  	}
   358  	for _, v := range t.Sectors {
   359  		if err := v.MarshalCBOR(w); err != nil {
   360  			return err
   361  		}
   362  	}
   363  	return nil
   364  }
   365  
   366  func (t *VerifyDealsForActivationReturn) UnmarshalCBOR(r io.Reader) error {
   367  	*t = VerifyDealsForActivationReturn{}
   368  
   369  	br := cbg.GetPeeker(r)
   370  	scratch := make([]byte, 8)
   371  
   372  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   373  	if err != nil {
   374  		return err
   375  	}
   376  	if maj != cbg.MajArray {
   377  		return fmt.Errorf("cbor input should be of type array")
   378  	}
   379  
   380  	if extra != 1 {
   381  		return fmt.Errorf("cbor input had wrong number of fields")
   382  	}
   383  
   384  	// t.Sectors ([]market.SectorWeights) (slice)
   385  
   386  	maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
   387  	if err != nil {
   388  		return err
   389  	}
   390  
   391  	if extra > cbg.MaxLength {
   392  		return fmt.Errorf("t.Sectors: array too large (%d)", extra)
   393  	}
   394  
   395  	if maj != cbg.MajArray {
   396  		return fmt.Errorf("expected cbor array")
   397  	}
   398  
   399  	if extra > 0 {
   400  		t.Sectors = make([]SectorWeights, extra)
   401  	}
   402  
   403  	for i := 0; i < int(extra); i++ {
   404  
   405  		var v SectorWeights
   406  		if err := v.UnmarshalCBOR(br); err != nil {
   407  			return err
   408  		}
   409  
   410  		t.Sectors[i] = v
   411  	}
   412  
   413  	return nil
   414  }
   415  
   416  var lengthBufSectorDeals = []byte{130}
   417  
   418  func (t *SectorDeals) MarshalCBOR(w io.Writer) error {
   419  	if t == nil {
   420  		_, err := w.Write(cbg.CborNull)
   421  		return err
   422  	}
   423  	if _, err := w.Write(lengthBufSectorDeals); err != nil {
   424  		return err
   425  	}
   426  
   427  	scratch := make([]byte, 9)
   428  
   429  	// t.SectorExpiry (abi.ChainEpoch) (int64)
   430  	if t.SectorExpiry >= 0 {
   431  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.SectorExpiry)); err != nil {
   432  			return err
   433  		}
   434  	} else {
   435  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.SectorExpiry-1)); err != nil {
   436  			return err
   437  		}
   438  	}
   439  
   440  	// t.DealIDs ([]abi.DealID) (slice)
   441  	if len(t.DealIDs) > cbg.MaxLength {
   442  		return xerrors.Errorf("Slice value in field t.DealIDs was too long")
   443  	}
   444  
   445  	if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.DealIDs))); err != nil {
   446  		return err
   447  	}
   448  	for _, v := range t.DealIDs {
   449  		if err := cbg.CborWriteHeader(w, cbg.MajUnsignedInt, uint64(v)); err != nil {
   450  			return err
   451  		}
   452  	}
   453  	return nil
   454  }
   455  
   456  func (t *SectorDeals) UnmarshalCBOR(r io.Reader) error {
   457  	*t = SectorDeals{}
   458  
   459  	br := cbg.GetPeeker(r)
   460  	scratch := make([]byte, 8)
   461  
   462  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   463  	if err != nil {
   464  		return err
   465  	}
   466  	if maj != cbg.MajArray {
   467  		return fmt.Errorf("cbor input should be of type array")
   468  	}
   469  
   470  	if extra != 2 {
   471  		return fmt.Errorf("cbor input had wrong number of fields")
   472  	}
   473  
   474  	// t.SectorExpiry (abi.ChainEpoch) (int64)
   475  	{
   476  		maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   477  		var extraI int64
   478  		if err != nil {
   479  			return err
   480  		}
   481  		switch maj {
   482  		case cbg.MajUnsignedInt:
   483  			extraI = int64(extra)
   484  			if extraI < 0 {
   485  				return fmt.Errorf("int64 positive overflow")
   486  			}
   487  		case cbg.MajNegativeInt:
   488  			extraI = int64(extra)
   489  			if extraI < 0 {
   490  				return fmt.Errorf("int64 negative oveflow")
   491  			}
   492  			extraI = -1 - extraI
   493  		default:
   494  			return fmt.Errorf("wrong type for int64 field: %d", maj)
   495  		}
   496  
   497  		t.SectorExpiry = abi.ChainEpoch(extraI)
   498  	}
   499  	// t.DealIDs ([]abi.DealID) (slice)
   500  
   501  	maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
   502  	if err != nil {
   503  		return err
   504  	}
   505  
   506  	if extra > cbg.MaxLength {
   507  		return fmt.Errorf("t.DealIDs: array too large (%d)", extra)
   508  	}
   509  
   510  	if maj != cbg.MajArray {
   511  		return fmt.Errorf("expected cbor array")
   512  	}
   513  
   514  	if extra > 0 {
   515  		t.DealIDs = make([]abi.DealID, extra)
   516  	}
   517  
   518  	for i := 0; i < int(extra); i++ {
   519  
   520  		maj, val, err := cbg.CborReadHeaderBuf(br, scratch)
   521  		if err != nil {
   522  			return xerrors.Errorf("failed to read uint64 for t.DealIDs slice: %w", err)
   523  		}
   524  
   525  		if maj != cbg.MajUnsignedInt {
   526  			return xerrors.Errorf("value read for array t.DealIDs was not a uint, instead got %d", maj)
   527  		}
   528  
   529  		t.DealIDs[i] = abi.DealID(val)
   530  	}
   531  
   532  	return nil
   533  }
   534  
   535  var lengthBufSectorWeights = []byte{131}
   536  
   537  func (t *SectorWeights) MarshalCBOR(w io.Writer) error {
   538  	if t == nil {
   539  		_, err := w.Write(cbg.CborNull)
   540  		return err
   541  	}
   542  	if _, err := w.Write(lengthBufSectorWeights); err != nil {
   543  		return err
   544  	}
   545  
   546  	scratch := make([]byte, 9)
   547  
   548  	// t.DealSpace (uint64) (uint64)
   549  
   550  	if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.DealSpace)); err != nil {
   551  		return err
   552  	}
   553  
   554  	// t.DealWeight (big.Int) (struct)
   555  	if err := t.DealWeight.MarshalCBOR(w); err != nil {
   556  		return err
   557  	}
   558  
   559  	// t.VerifiedDealWeight (big.Int) (struct)
   560  	if err := t.VerifiedDealWeight.MarshalCBOR(w); err != nil {
   561  		return err
   562  	}
   563  	return nil
   564  }
   565  
   566  func (t *SectorWeights) UnmarshalCBOR(r io.Reader) error {
   567  	*t = SectorWeights{}
   568  
   569  	br := cbg.GetPeeker(r)
   570  	scratch := make([]byte, 8)
   571  
   572  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   573  	if err != nil {
   574  		return err
   575  	}
   576  	if maj != cbg.MajArray {
   577  		return fmt.Errorf("cbor input should be of type array")
   578  	}
   579  
   580  	if extra != 3 {
   581  		return fmt.Errorf("cbor input had wrong number of fields")
   582  	}
   583  
   584  	// t.DealSpace (uint64) (uint64)
   585  
   586  	{
   587  
   588  		maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
   589  		if err != nil {
   590  			return err
   591  		}
   592  		if maj != cbg.MajUnsignedInt {
   593  			return fmt.Errorf("wrong type for uint64 field")
   594  		}
   595  		t.DealSpace = uint64(extra)
   596  
   597  	}
   598  	// t.DealWeight (big.Int) (struct)
   599  
   600  	{
   601  
   602  		if err := t.DealWeight.UnmarshalCBOR(br); err != nil {
   603  			return xerrors.Errorf("unmarshaling t.DealWeight: %w", err)
   604  		}
   605  
   606  	}
   607  	// t.VerifiedDealWeight (big.Int) (struct)
   608  
   609  	{
   610  
   611  		if err := t.VerifiedDealWeight.UnmarshalCBOR(br); err != nil {
   612  			return xerrors.Errorf("unmarshaling t.VerifiedDealWeight: %w", err)
   613  		}
   614  
   615  	}
   616  	return nil
   617  }
   618  
   619  var lengthBufDealState = []byte{131}
   620  
   621  func (t *DealState) MarshalCBOR(w io.Writer) error {
   622  	if t == nil {
   623  		_, err := w.Write(cbg.CborNull)
   624  		return err
   625  	}
   626  	if _, err := w.Write(lengthBufDealState); err != nil {
   627  		return err
   628  	}
   629  
   630  	scratch := make([]byte, 9)
   631  
   632  	// t.SectorStartEpoch (abi.ChainEpoch) (int64)
   633  	if t.SectorStartEpoch >= 0 {
   634  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.SectorStartEpoch)); err != nil {
   635  			return err
   636  		}
   637  	} else {
   638  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.SectorStartEpoch-1)); err != nil {
   639  			return err
   640  		}
   641  	}
   642  
   643  	// t.LastUpdatedEpoch (abi.ChainEpoch) (int64)
   644  	if t.LastUpdatedEpoch >= 0 {
   645  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.LastUpdatedEpoch)); err != nil {
   646  			return err
   647  		}
   648  	} else {
   649  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.LastUpdatedEpoch-1)); err != nil {
   650  			return err
   651  		}
   652  	}
   653  
   654  	// t.SlashEpoch (abi.ChainEpoch) (int64)
   655  	if t.SlashEpoch >= 0 {
   656  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.SlashEpoch)); err != nil {
   657  			return err
   658  		}
   659  	} else {
   660  		if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.SlashEpoch-1)); err != nil {
   661  			return err
   662  		}
   663  	}
   664  	return nil
   665  }
   666  
   667  func (t *DealState) UnmarshalCBOR(r io.Reader) error {
   668  	*t = DealState{}
   669  
   670  	br := cbg.GetPeeker(r)
   671  	scratch := make([]byte, 8)
   672  
   673  	maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   674  	if err != nil {
   675  		return err
   676  	}
   677  	if maj != cbg.MajArray {
   678  		return fmt.Errorf("cbor input should be of type array")
   679  	}
   680  
   681  	if extra != 3 {
   682  		return fmt.Errorf("cbor input had wrong number of fields")
   683  	}
   684  
   685  	// t.SectorStartEpoch (abi.ChainEpoch) (int64)
   686  	{
   687  		maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   688  		var extraI int64
   689  		if err != nil {
   690  			return err
   691  		}
   692  		switch maj {
   693  		case cbg.MajUnsignedInt:
   694  			extraI = int64(extra)
   695  			if extraI < 0 {
   696  				return fmt.Errorf("int64 positive overflow")
   697  			}
   698  		case cbg.MajNegativeInt:
   699  			extraI = int64(extra)
   700  			if extraI < 0 {
   701  				return fmt.Errorf("int64 negative oveflow")
   702  			}
   703  			extraI = -1 - extraI
   704  		default:
   705  			return fmt.Errorf("wrong type for int64 field: %d", maj)
   706  		}
   707  
   708  		t.SectorStartEpoch = abi.ChainEpoch(extraI)
   709  	}
   710  	// t.LastUpdatedEpoch (abi.ChainEpoch) (int64)
   711  	{
   712  		maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   713  		var extraI int64
   714  		if err != nil {
   715  			return err
   716  		}
   717  		switch maj {
   718  		case cbg.MajUnsignedInt:
   719  			extraI = int64(extra)
   720  			if extraI < 0 {
   721  				return fmt.Errorf("int64 positive overflow")
   722  			}
   723  		case cbg.MajNegativeInt:
   724  			extraI = int64(extra)
   725  			if extraI < 0 {
   726  				return fmt.Errorf("int64 negative oveflow")
   727  			}
   728  			extraI = -1 - extraI
   729  		default:
   730  			return fmt.Errorf("wrong type for int64 field: %d", maj)
   731  		}
   732  
   733  		t.LastUpdatedEpoch = abi.ChainEpoch(extraI)
   734  	}
   735  	// t.SlashEpoch (abi.ChainEpoch) (int64)
   736  	{
   737  		maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
   738  		var extraI int64
   739  		if err != nil {
   740  			return err
   741  		}
   742  		switch maj {
   743  		case cbg.MajUnsignedInt:
   744  			extraI = int64(extra)
   745  			if extraI < 0 {
   746  				return fmt.Errorf("int64 positive overflow")
   747  			}
   748  		case cbg.MajNegativeInt:
   749  			extraI = int64(extra)
   750  			if extraI < 0 {
   751  				return fmt.Errorf("int64 negative oveflow")
   752  			}
   753  			extraI = -1 - extraI
   754  		default:
   755  			return fmt.Errorf("wrong type for int64 field: %d", maj)
   756  		}
   757  
   758  		t.SlashEpoch = abi.ChainEpoch(extraI)
   759  	}
   760  	return nil
   761  }