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

[storage] Balance Exemption Overhaul #205

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Oct 26, 2020

Because many blockchains apply rewards after the parent block is processed (usually before transactions in the next block are applied), adjusting the computed balance to equal the live balance of the parent block before applying balance changes doesn't guarantee that a computed account balance won't go negative (if a transaction in the new block spends the new rewards). This PR modifies the balance exemption logic to compare the computed balance after applying operations but before being checked for a negative value.

Changes

  • Compare computed balance with exemptions after new operations are applied
  • Add a negative intermediate value test

@coveralls
Copy link

coveralls commented Oct 26, 2020

Pull Request Test Coverage Report for Build 9810

  • 30 of 37 (81.08%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 78.358%

Changes Missing Coverage Covered Lines Changed/Added Lines %
storage/balance_storage.go 30 37 81.08%
Files with Coverage Reduction New Missed Lines %
storage/balance_storage.go 1 76.09%
Totals Coverage Status
Change from base Build 9783: 0.04%
Covered Lines: 7053
Relevant Lines: 9001

💛 - Coveralls

@patrick-ogrady patrick-ogrady merged commit 39bc21f into master Oct 26, 2020
@patrick-ogrady patrick-ogrady deleted the patrick/balance-exemption-overhaul branch October 26, 2020 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants