Skip to content
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

Merged
merged 14 commits into from
Nov 16, 2020

Conversation

antstalepresh
Copy link
Contributor

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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

sdk "github.com/cosmos/cosmos-sdk/types"
)

func init() {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Member

@sunnya97 sunnya97 Nov 11, 2020

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.

Copy link
Contributor

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() {
Copy link
Contributor

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 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #7897 (479ad6b) into master (be10bcb) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            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              

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK, thanks!

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 13, 2020
@alessio
Copy link
Contributor

alessio commented Nov 13, 2020

@antstalepresh please merge master in

@sunnya97 sunnya97 merged commit 10d5ce3 into cosmos:master Nov 16, 2020
@sunnya97 sunnya97 deleted the fix_power_reduction_test_cast_int64 branch November 16, 2020 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix tests to not cast staked tokens amounts to int64
6 participants