tendermint / go-amino

Protobuf3 with Interface support - Designed for blockchains (deterministic, upgradeable, fast, and compact)
Other
260 stars 78 forks source link

'decoder.go / encoder.go' overflows int issue when cross compile c(for android) #245

Closed Lunagram closed 5 years ago

Lunagram commented 5 years ago

I've cross-compile cosmos-sdk v0.26.1-rc1 with c(androideabi). However, an error has occurred.

[Got message] ../../../../vendor/github.com/tendermint/go-amino/decoder.go:246:44: constant -62135596800 overflows int ../../../../vendor/github.com/tendermint/go-amino/decoder.go:246:44: constant 253402300800 overflows int ../../../../vendor/github.com/tendermint/go-amino/encoder.go:147:38: constant -62135596800 overflows int ../../../../vendor/github.com/tendermint/go-amino/encoder.go:147:38: constant 253402300800 overflows int

[Please change both files.] 1. go-amino/decoder.go:246 return 0, n, InvalidTimeErr(fmt.Sprintf("seconds have to be > %d and < %d, got: %d", minSeconds, maxSeconds, res))

to

return 0, n, InvalidTimeErr(fmt.Sprintf("seconds have to be > %d and < %d, got: %d", int64(minSeconds), int64(maxSeconds), res))

2. go-amino/encoder.go:147 return InvalidTimeErr(fmt.Sprintf("seconds have to be >= %d and < %d, got: %d", minSeconds, maxSeconds, s))

to

return InvalidTimeErr(fmt.Sprintf("seconds have to be >= %d and < %d, got: %d", int64(minSeconds), int64(maxSeconds), s))

Thank you for your hard work.

liamsi commented 5 years ago

Thanks for raising this issue! This should have been fixed with #242 though. Did you try to cross-compile amino from the latest master, or the tagged release 0.14.1? Thanks again!

liamsi commented 5 years ago

OK, I see. cosmos-sdk v0.26.1-rc1 uses v0.14.0: https://github.com/cosmos/cosmos-sdk/blob/bb54a0de127e45713f272217f578c0abe53a5b21/Gopkg.toml#L29-L31

Lunagram commented 5 years ago

I'm, sorry. I accidentally made a pull request to the master brench.

liamsi commented 5 years ago

No problem. We can change the base branch to develop. Thanks! I'm still sure this problem doesn't exist in the latest release though. Can you try to cross-compile amino 0.14.1? Does the problem still persist?

Lunagram commented 5 years ago

The issue has been resolved with 0.14.1! Thank you!