Cosmos-sdk: Can't build on 32 bit

Created on 4 May 2020  Â·  7Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

../../go/pkg/mod/github.com/cosmos/[email protected]/x/ibc/07-tendermint/types/test_utils.go:31:39: constant 9223372036854775807 overflows int

Version

Version v0.34.4-0.20200430150743-930802e7a13c

Steps to Reproduce

Clone Gaia and run make install


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
bug

Most helpful comment

feature, not bug :-p

All 7 comments

This may come from Tendermint as well. Currently, we do not support 32 bit OS

I can confirm this is a bug: MakeBlockID(make([]byte, tmhash.Size), int(math.MaxInt64), make([]byte, tmhash.Size)), is a mistake nonetheless, as MakeBlockID() expects int yet the code explicitly passes an int64.

This is not a bug. Tendermint does not support 32-bit systems.

feature, not bug :-p

feature, not bug :-p

LOL

This is not a bug. Tendermint does not support 32-bit systems.

I know that, though when you pick the int type you essentially delegate to the compiler the responsibility of choosing the best signed integer type, and that makes your variable length machine-dependent. I'm not saying that this is necessarily a bug in the sdk (it definitely sounds more like something that should be amended/clarified in the tendermint data type), quite the opposite. So we should either:

  1. file a bug in tendermint and ask for PartSetHeader.Total to be turned into an int64
    or
  2. compute and use the max intand instead of math.MaxInt64.

Note:
The machine-dependent MaxInt can be calculated as follows:

const MaxInt = int(^uint(0) >> 1)

Reference: https://groups.google.com/forum/#!msg/golang-nuts/a9PitPAHSSU/ziQw1-QHw3EJ

Tendermint is migrating away from unsized ints. It is a breaking change so it will have to wait to 0.34.

An issue to track this specifically could be useful.

Was this page helpful?
0 / 5 - 0 ratings