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(rpc-calls): Calculate gas for empty accounts #3653

Merged
merged 2 commits into from
Jan 14, 2024

Conversation

breathx
Copy link
Member

@breathx breathx commented Jan 11, 2024

Bug description

Sometimes it happened that user couldn't calculate if his balance is zero. Especially it caused vouchers consumers.

This was happening despite the fact that the balance is mocked to suit the requirements of the call.

Bug mechanic

In order to increase accuracy of required gas measurement, the measurement is done twice:

  • First time we run message with maximum gas limit, receiving some minimal limit
  • Second time we run message with minimal limit from previous step to receive even smaller gas amount in case of gas-dependency of the message execution.

It happened that minimal limit (in gas) can has value equivalent less than existential deposit, so our balance mocking using deposit_creating occurred no-op.

Bug fix

Always add up existential deposit in calculate gas rpc call balance mock.

NOTE: Minor refactoring is done as well

@breathx breathx added A0-pleasereview PR is ready to be reviewed by the team D2-node Gear Node C0-bug Something isn't working labels Jan 11, 2024
Copy link
Contributor

@shamilsan shamilsan left a comment

Choose a reason for hiding this comment

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

👍

@breathx breathx merged commit 9307800 into master Jan 14, 2024
25 checks passed
@breathx breathx deleted the dn-fix-calculate-gas-zero-balance branch January 14, 2024 14:08
@shamilsan shamilsan added the B1-releasenotes The feature deserves to be added to the Release Notes label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team B1-releasenotes The feature deserves to be added to the Release Notes C0-bug Something isn't working D2-node Gear Node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants