-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Purge accounts with lamports=0 on rooted forks #6315
Purge accounts with lamports=0 on rooted forks #6315
Conversation
@rob-solana this is WIP, but I think this is what you meant? |
Codecov Report
@@ Coverage Diff @@
## master #6315 +/- ##
========================================
+ Coverage 78.7% 78.8% +0.1%
========================================
Files 217 217
Lines 41184 41276 +92
========================================
+ Hits 32424 32564 +140
+ Misses 8760 8712 -48 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is exactly what I meant.
Nice. now we just need to figure out where to call it. maybe for snapshots?
Yea that's not a bad idea, cleaning up makes sense before the snapshot and that's already async. I thought of that but thought they didn't really fit together, but as a cleanup to make the snapshot size smaller makes sense. |
1b09cb7
to
4bd6db3
Compare
Pull request has been modified.
d82b25c
to
05cb78e
Compare
05cb78e
to
fc4c8fb
Compare
fc4c8fb
to
67f08c3
Compare
@@ -746,6 +766,10 @@ impl AccountsDB { | |||
} | |||
|
|||
pub fn hash_account_data(fork: Fork, lamports: u64, data: &[u8], pubkey: &Pubkey) -> Hash { | |||
if lamports == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one's interesting, how come?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if we purge, we would not maintain the correct bank hash value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah!
Problem
Accounts with 0 lamports could never be purged from accounts_db, thus causing potential for resource exhaustion attacks.
Summary of Changes
Add a function to purge accounts with 0 lamports on rooted forks.
TODO:
hash_internal_state
Fixes #6299