-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
6622d40
to
9027e19
Compare
frame/system/src/lib.rs
Outdated
let existed = Account::<T>::contains_key(k); | ||
Account::<T>::insert(k, (T::Index::default(), t)); | ||
Account::<T>::insert(k, AccountInfo{ nonce: Default::default(), refcount: 0, data }); |
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.
Why is refcount/nonce returning to zero here?
The goal is just to insert some account data onto the user?
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 looks indeed bad. good catch 👍
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.
Account::<T>::insert(k, AccountInfo{ nonce: Default::default(), refcount: 0, data }); | |
Account::<T>::mutate(k, |a| a.data = data); |
This is what you want, right?
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.
I am going to commit this suggestion.
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
/bench Some final spam :) |
Finished benchmark for branch: gav-lazy-reaping MASTER RESULTimport block/Wasm time: import block/Native time: BRANCH RESULTimport block/Wasm time: import block/Native time: |
concerning that the benchmark is consistently reporting that this branch is slower. what is it actually benchmarking? this should be waaay faster (and i believe @shawn already showed that it was). |
Well, it is just 2-3% (it is inside benchmark variance, so don't pay much attention, until it shows > 5-6% difference) This benchmark is just doing import of block with 100 random transfers, and I believe code path of this pr is not touched, I mostly tested the bot on pr more or less related to performance. I will be happy to add benchmark that should show improvements on this, btw. |
* Squash and rebase from gav-lazy-reaping * Bump version * Bump runtime again * Docs. * Remove old functions * Update frame/balances/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/contracts/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Warnings * Bump runtime version * Update frame/democracy/src/lib.rs Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/system/src/lib.rs * Clean up OnReapAccount * Use frame_support debug * Bump spec * Renames and fix * Fix * Fix rename * Fix * Increase time for test Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
This mostly removes the functionality of
OnReapAccount
and introduces reference-counting on accounts to ensure that data structures referring to an account whose economic defence is the account's ED must be cleaned up before the ED is liquidated.It's a followup/alternative to #4820