chore: update go-state-types with empty big.Int{} handling (#12936)

This commit is contained in:
Rod Vagg
2025-03-11 07:49:41 +11:00
committed by GitHub
parent 241ce6da70
commit 5307183f45
10 changed files with 346 additions and 240 deletions

View File

@ -21,6 +21,7 @@
- feat: add a `LOTUS_DISABLE_F3_ACTIVATION` enviroment variable allowing disabling F3 activation for a specific contract address or epoch ([filecoin-project/lotus#12920](https://github.com/filecoin-project/lotus/pull/12920)). The `LOTUS_DISABLE_F3` env-var has been renamed to `LOTUS_DISABLE_F3_SUBSYSTEM` to distinguish it from the other F3-related environment variables: `LOTUS_DISABLE_F3_PASSIVE_TESTING` and `LOTUS_DISABLE_F3_ACTIVATION`.
- feat: add `GenesisTimestamp` field to `StateGetNetworkParams` response ([filecoin-project/lotus#12925](https://github.com/filecoin-project/lotus/pull/12925))
- chore: upgrade drand client
- chore: upgrade go-state-types with big.Int{} change that means an empty big.Int is now treated as zero for all operations ([filecoin-project/lotus#12936](https://github.com/filecoin-project/lotus/pull/12936))
# UNRELEASED v.1.32.0

View File

@ -119,21 +119,24 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("PaymentInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 12)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Channel (address.Address) (struct)
case "Channel":
@ -209,7 +212,9 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -301,21 +306,24 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SealedRef: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 8)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Size (abi.UnpaddedPieceSize) (uint64)
case "Size":
@ -364,7 +372,9 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -433,21 +443,24 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SealedRefs: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 4)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Refs ([]api.SealedRef) (slice)
case "Refs":
@ -490,7 +503,9 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -580,21 +595,24 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SealTicket: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 5)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
@ -646,7 +664,9 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -736,21 +756,24 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SealSeed: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 5)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Epoch (abi.ChainEpoch) (int64)
case "Epoch":
{
@ -802,7 +825,9 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -877,21 +902,24 @@ func (t *SectorPiece) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SectorPiece: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 8)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Piece (abi.PieceInfo) (struct)
case "Piece":
@ -925,7 +953,9 @@ func (t *SectorPiece) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

View File

@ -82,21 +82,24 @@ func (t *CarbNode) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("CarbNode: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 3)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Sub ([]cid.Cid) (slice)
case "Sub":
@ -142,7 +145,9 @@ func (t *CarbNode) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -234,21 +239,24 @@ func (t *DatastoreEntry) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("DatastoreEntry: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 5)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Key ([]uint8) (slice)
case "Key":
@ -297,7 +305,9 @@ func (t *DatastoreEntry) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

6
go.mod
View File

@ -51,7 +51,7 @@ require (
github.com/filecoin-project/go-jsonrpc v0.7.0
github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.16.0-rc3 // dependency-check-ignore: unknown
github.com/filecoin-project/go-state-types v0.16.0-rc3.0.20250306021323-9c8991feee47 // dependency-check-ignore: unknown
github.com/filecoin-project/go-statemachine v1.0.3
github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0
@ -137,7 +137,7 @@ require (
github.com/triplewz/poseidon v0.0.2
github.com/urfave/cli/v2 v2.27.5
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
github.com/whyrusleeping/cbor-gen v0.2.0
github.com/whyrusleeping/cbor-gen v0.3.0
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
github.com/xeipuuv/gojsonschema v1.2.0
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542 // dependency-check-ignore: unknown
@ -155,7 +155,7 @@ require (
go.uber.org/fx v1.23.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.33.0
golang.org/x/crypto v0.35.0
golang.org/x/mod v0.23.0
golang.org/x/net v0.35.0
golang.org/x/sync v0.11.0

12
go.sum
View File

@ -305,8 +305,8 @@ github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.16.0-rc3 h1:V56ahdMNmAbr/9MdIqxT8w3p2SCsn94u02Zc1sMsDCk=
github.com/filecoin-project/go-state-types v0.16.0-rc3/go.mod h1:W/l8gYD5JNIwEjp4dOiHuJh9dYjwpckjSlaZvSESkbQ=
github.com/filecoin-project/go-state-types v0.16.0-rc3.0.20250306021323-9c8991feee47 h1:T4FROWJdLMagJDKLzZqOlJMCw/tMolhFbi8niQB2sfk=
github.com/filecoin-project/go-state-types v0.16.0-rc3.0.20250306021323-9c8991feee47/go.mod h1:1UK6Rsz0oWbzb4IPuyEVuNVRk13JSlnUmmxrzLZjBpg=
github.com/filecoin-project/go-statemachine v1.0.3 h1:N07o6alys+V1tNoSTi4WuuoeNC4erS/6jE74+NsgQuk=
github.com/filecoin-project/go-statemachine v1.0.3/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
@ -1317,8 +1317,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:f
github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.2.0 h1:v8DREoK/1qQBSc6/UZ4OgU06+9FkywTh8glX0Hi+jkc=
github.com/whyrusleeping/cbor-gen v0.2.0/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
github.com/whyrusleeping/cbor-gen v0.3.0 h1:BR7/2RPYdqzGyHsJvC/lm+g8qTlm4SD9GHA8++CJT8o=
github.com/whyrusleeping/cbor-gen v0.3.0/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
@ -1471,8 +1471,8 @@ golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=

View File

@ -114,21 +114,24 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("VoucherInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Proof ([]uint8) (slice)
case "Proof":
@ -193,7 +196,9 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -489,21 +494,24 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("ChannelInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 22)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Amount (big.Int) (struct)
case "Amount":
@ -741,7 +749,9 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -862,21 +872,24 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("MsgInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Err (string) (string)
case "Err":
@ -933,7 +946,9 @@ func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

View File

@ -879,21 +879,24 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SectorInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 25)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Log ([]sealing.Log) (slice)
case "Log":
@ -1708,7 +1711,9 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -1837,21 +1842,24 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("Log: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 9)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Kind (string) (string)
case "Kind":
@ -1903,7 +1911,9 @@ func (t *Log) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

View File

@ -161,21 +161,24 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("PieceDealInfo: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 23)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.DealID (abi.DealID) (uint64)
case "DealID":
@ -285,7 +288,9 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -373,21 +378,24 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("DealSchedule: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 10)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.EndEpoch (abi.ChainEpoch) (int64)
case "EndEpoch":
{
@ -443,7 +451,9 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

View File

@ -128,21 +128,24 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("Call: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 7)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.ID (storiface.CallID) (struct)
case "ID":
@ -202,7 +205,9 @@ func (t *Call) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -368,21 +373,24 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("WorkState: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 14)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.ID (sealer.WorkID) (struct)
case "ID":
@ -465,7 +473,9 @@ func (t *WorkState) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -554,21 +564,24 @@ func (t *WorkID) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("WorkID: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 6)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Method (sealtasks.TaskType) (string)
case "Method":
@ -594,7 +607,9 @@ func (t *WorkID) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}

View File

@ -95,21 +95,24 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("CallID: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 6)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.ID (uuid.UUID) (array)
case "ID":
@ -145,7 +148,9 @@ func (t *CallID) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -234,21 +239,24 @@ func (t *SecDataHttpHeader) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SecDataHttpHeader: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 5)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.Key (string) (string)
case "Key":
@ -274,7 +282,9 @@ func (t *SecDataHttpHeader) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}
@ -382,21 +392,24 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) {
return fmt.Errorf("SectorLocation: map struct too large (%d)", extra)
}
var name string
n := extra
nameBuf := make([]byte, 7)
for i := uint64(0); i < n; i++ {
{
sval, err := cbg.ReadStringWithMax(cr, 8192)
if err != nil {
return err
}
name = string(sval)
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 8192)
if err != nil {
return err
}
switch name {
if !ok {
// Field doesn't exist on this type, so ignore it
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
return err
}
continue
}
switch string(nameBuf[:nameLen]) {
// t.URL (string) (string)
case "URL":
@ -468,7 +481,9 @@ func (t *SectorLocation) UnmarshalCBOR(r io.Reader) (err error) {
default:
// Field doesn't exist on this type, so ignore it
cbg.ScanForLinks(r, func(cid.Cid) {})
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
return err
}
}
}