-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with the ARM architecture #8396
Conversation
This PR adds the compatibility with the ARM architecture, by casting math.MaxInt64, math.MaxUint32 and math.MaxUint64 to uint64, uint32 and uint64 respectively.
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Why are you casting |
Cause the left side of the comparison is an |
You need to cast to ensure it won't ever be a problem. However, what exactly is the problem you're trying to solve here? Does the compiler emit warnings/errors when building for arm64? And if, so can you post the buildlog please? |
This is only the first error that raises. Once you solve that, you get similar ones for the rest of the cases I have fixed:
|
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Codecov Report
@@ Coverage Diff @@
## master #8396 +/- ##
=======================================
Coverage 61.47% 61.47%
=======================================
Files 630 630
Lines 36398 36398
=======================================
Hits 22377 22377
Misses 11671 11671
Partials 2350 2350
|
From: #8396 Thanks: @RiccardoM for the original patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Howdy @RiccardoM, thank you for this change! I have a question about what looks likes now an increase for height, which I believe would involve security changes and perhaps would first go through a design change; this change is related to casting but not changing limits of values; we also need a test to prevent such regressions.
@@ -711,9 +711,9 @@ func (rs *Store) Restore( | |||
if height == 0 { | |||
return sdkerrors.Wrap(sdkerrors.ErrLogic, "cannot restore snapshot at height 0") | |||
} | |||
if height > math.MaxInt64 { | |||
if height > uint64(math.MaxUint64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh oh, now height can be more than math.MaxInt64 aka >9223372036854775808, up until (1<<64 - 1) aka 18446744073709551615. That seems like a breaking change that's not related to ARM compatibility. The error message doesn't even match this check, plus I don't think there was a test to prevent such a regression. Please advise or revert this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #8396 (comment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
store/multistore: revert a height limit increase from #8396 See #8396 (comment)
From: #8396 #8466 Thanks: @RiccardoM for the original patch.
See cosmos/cosmos-sdk#8396 (comment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
See cosmos/cosmos-sdk#8396 (comment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
See cosmos/cosmos-sdk#8396 (comment) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Description
This PR adds the compatibility with the ARM architecture, by casting
math.MaxInt64
,math.MaxUint32
andmath.MaxUint64
touint64
,uint32
anduint64
respectively.It also adds a series of tests to make sure that the build is successful on a list of common platforms (
386
,arm
,arm64
andamd64
).The aim of this PR is to make the Cosmos SDK compatible with the ARM architecture. This is often used in single board computers like the Raspberry, which are often used by hobbyists to experiment with projects. By making the Cosmos SDK ARM-compatible, we could allow such people to get started with it by running a node on their Raspberry before moving to a safer environment.
Also, this might be particularly useful to all the Cosmos SDK-based projects that are currently running a testnet and would like to give their validators the opportunity to run a node in-house on the above-mentioned boards.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes