diff --git a/api/cbor_gen.go b/api/cbor_gen.go index a90ea8b21..8889e6021 100644 --- a/api/cbor_gen.go +++ b/api/cbor_gen.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/builtin/paych" + abi "github.com/filecoin-project/specs-actors/actors/abi" + paych "github.com/filecoin-project/specs-actors/actors/builtin/paych" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) diff --git a/chain/blocksync/cbor_gen.go b/chain/blocksync/cbor_gen.go index ad8e1de7f..cd43f4a64 100644 --- a/chain/blocksync/cbor_gen.go +++ b/chain/blocksync/cbor_gen.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/filecoin-project/lotus/chain/types" - "github.com/ipfs/go-cid" + types "github.com/filecoin-project/lotus/chain/types" + cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index 451971aca..35abf2828 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -6,10 +6,10 @@ import ( "fmt" "io" - "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/crypto" - "github.com/filecoin-project/specs-actors/actors/runtime/exitcode" - "github.com/ipfs/go-cid" + abi "github.com/filecoin-project/specs-actors/actors/abi" + crypto "github.com/filecoin-project/specs-actors/actors/crypto" + exitcode "github.com/filecoin-project/specs-actors/actors/runtime/exitcode" + cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) @@ -637,15 +637,10 @@ func (t *Message) MarshalCBOR(w io.Writer) error { scratch := make([]byte, 9) - // t.Version (int64) (int64) - if t.Version >= 0 { - if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Version)); err != nil { - return err - } - } else { - if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.Version-1)); err != nil { - return err - } + // t.Version (uint64) (uint64) + + if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Version)); err != nil { + return err } // t.To (address.Address) (struct) @@ -729,30 +724,19 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - // t.Version (int64) (int64) + // t.Version (uint64) (uint64) + { - maj, extra, err := cbg.CborReadHeaderBuf(br, scratch) - var extraI int64 + + maj, extra, err = cbg.CborReadHeaderBuf(br, scratch) if err != nil { return err } - switch maj { - case cbg.MajUnsignedInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 positive overflow") - } - case cbg.MajNegativeInt: - extraI = int64(extra) - if extraI < 0 { - return fmt.Errorf("int64 negative oveflow") - } - extraI = -1 - extraI - default: - return fmt.Errorf("wrong type for int64 field: %d", maj) + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") } + t.Version = uint64(extra) - t.Version = int64(extraI) } // t.To (address.Address) (struct) diff --git a/chain/types/message.go b/chain/types/message.go index e9d932ac2..288fcf6d9 100644 --- a/chain/types/message.go +++ b/chain/types/message.go @@ -25,7 +25,7 @@ type ChainMsg interface { } type Message struct { - Version int64 + Version uint64 To address.Address From address.Address diff --git a/node/hello/cbor_gen.go b/node/hello/cbor_gen.go index e28d5c1b4..48d111c6b 100644 --- a/node/hello/cbor_gen.go +++ b/node/hello/cbor_gen.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/ipfs/go-cid" + abi "github.com/filecoin-project/specs-actors/actors/abi" + cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) diff --git a/paychmgr/cbor_gen.go b/paychmgr/cbor_gen.go index aa86bc106..1a6d17783 100644 --- a/paychmgr/cbor_gen.go +++ b/paychmgr/cbor_gen.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/specs-actors/actors/builtin/paych" + address "github.com/filecoin-project/go-address" + paych "github.com/filecoin-project/specs-actors/actors/builtin/paych" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" )