-
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
Fix power reduction test cast int64 #7897
Fix power reduction test cast int64 #7897
Conversation
…date CreateValidator, CreateValidatorMsg, Delegate helper functions to fix int64 overflow
…onsensusPower to consider PowerReduction
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
func init() { |
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.
Why do we need these init calls? Isn't sdk.PowerReduction
already set to this value?
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.
For staking, we want to test it in PowerReduction = 10^18, to check overflow cases. cc. @sunnya97
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.
PowerReduction is set to 10^6
by default.
But we want to run the tests with a PowerReduction of 10^18
, in order to make sure they work with a value that would overflow an int64
.
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.
I see. Makes sense!
float32(a.Amount.Int64()), | ||
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)}, | ||
) | ||
if a.Amount.IsInt64() { |
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.
Thank you for fixing all of these 🙏
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.
👍
…reduction_test_cast_int64
Codecov Report
@@ Coverage Diff @@
## master #7897 +/- ##
==========================================
- Coverage 54.15% 54.14% -0.01%
==========================================
Files 612 612
Lines 39023 39029 +6
==========================================
Hits 21134 21134
- Misses 15714 15720 +6
Partials 2175 2175 |
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.
utACK, thanks!
@antstalepresh please merge master in |
Description
This resolves testing issues on PowerReduction change
closes: #7655
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