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(state-viewer): fix balance overflow in state-dump command #9546

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

marcelo-gonzalez
Copy link
Contributor

The state-dump command changes the amounts of validator accounts to match the epoch we're dumping state in, in case a validator stakes during that epoch, and the locked amount is different than the stake. The new locked amount computation is correct if a validator staked more, but overflows if the locked amount is smaller than the stake plus amount, which actually does occur on mainnet

The state-dump command changes the amounts of validator accounts to
match the epoch we're dumping state in, in case a validator stakes
during that epoch, and the locked amount is different than the stake.
The new locked amount computation is correct if a validator staked more,
but overflows if the locked amount is smaller than the stake plus amount,
which actually does occur on mainnet
Copy link
Contributor

@nikurt nikurt left a comment

Choose a reason for hiding this comment

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

Would you please add a unit test?

@marcelo-gonzalez
Copy link
Contributor Author

Would you please add a unit test?

will do, but will take me a bit. I think to write a good test in the style of the other ones in this file, I need to understand how it is even possible that the stake for a validator is greater than the amount + locked on its account. no idea how that actually happened at the moment...

@marcelo-gonzalez
Copy link
Contributor Author

@nikurt going to just merge this now, after discussion here: https://near.zulipchat.com/#narrow/stream/297873-pagoda.2Fnode/topic/view-state.20dump-state.20crashing/near/393663390

but will try to figure out how it happened so I can add a test later

@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue Sep 28, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 28, 2023
@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue Sep 28, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 28, 2023
@nikurt nikurt added this pull request to the merge queue Oct 2, 2023
Merged via the queue into near:master with commit bfbea18 Oct 2, 2023
13 checks passed
nikurt pushed a commit that referenced this pull request Oct 2, 2023
The state-dump command changes the amounts of validator accounts to
match the epoch we're dumping state in, in case a validator stakes
during that epoch, and the locked amount is different than the stake.
The new locked amount computation is correct if a validator staked more,
but overflows if the locked amount is smaller than the stake plus
amount, which actually does occur on mainnet
nikurt pushed a commit that referenced this pull request Oct 11, 2023
The state-dump command changes the amounts of validator accounts to
match the epoch we're dumping state in, in case a validator stakes
during that epoch, and the locked amount is different than the stake.
The new locked amount computation is correct if a validator staked more,
but overflows if the locked amount is smaller than the stake plus
amount, which actually does occur on mainnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants