This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Return the accounts data len delta after processing messages#22986
Merged
brooksprumo merged 1 commit intosolana-labs:masterfrom Feb 9, 2022
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22986 +/- ##
=========================================
- Coverage 81.2% 81.2% -0.1%
=========================================
Files 563 563
Lines 152938 152946 +8
=========================================
- Hits 124328 124306 -22
- Misses 28610 28640 +30 |
29 tasks
jackcmay
reviewed
Feb 9, 2022
| /// amount of accounts data space used. If `amount` is negative, we are *decreasing* the | ||
| /// amount of accounts data space used. | ||
| pub fn consume(&mut self, amount: i64) -> Result<(), InstructionError> { | ||
| if amount == 0 { |
Contributor
There was a problem hiding this comment.
nit: I found the name of this function and it's description like reading double negatives. Maybe consume is not the best name for this function because we are not just using up a resource, but also replenishing it. Maybe rename to adjust_delta, adjust_remaining or something along those lines?
Contributor
Author
There was a problem hiding this comment.
Yah, I definitely agree with you. Since this function is not new, I will address this in a subsequent PR (and so I don't need to have CI run again on this PR). Let me know if that's not ok.
jackcmay
approved these changes
Feb 9, 2022
Contributor
jackcmay
left a comment
There was a problem hiding this comment.
Looks great besides the nit
mergify Bot
pushed a commit
that referenced
this pull request
Feb 9, 2022
(cherry picked from commit 869cfc9)
jeffwashington
pushed a commit
to jeffwashington/solana
that referenced
this pull request
Feb 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Tracking and consuming from
Bank::accounts_data_lencould race if multiple threads callBank::process_message(). The original behavior in #21807 was correct, and #21813 introduced the race.Summary of Changes
AccountsDataMeterto track the accounts data len deltaRelated to #21604