Repository navigation
runtime: narrow check_and_store() to AccountSharedData - #15398
Conversation
| accounts.account_for_geyser(i, |pubkey, account| { | ||
| self.stakes_cache | ||
| .check_and_store(pubkey, account, new_warmup_cooldown_rate_epoch) |
There was a problem hiding this comment.
obviously i would want to rename this
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #15398 +/- ##
=======================================
Coverage 82.2% 82.3%
=======================================
Files 930 930
Lines 369589 369587 -2
=======================================
+ Hits 304133 304174 +41
+ Misses 65456 65413 -43 🚀 New features to boost your workflow:
|
brooksprumo
left a comment
There was a problem hiding this comment.
![]()
Looks good to me. Can merge as-is, or add a comment first.
| accounts.account_for_geyser(i, |pubkey, account| { | ||
| self.stakes_cache | ||
| .check_and_store(pubkey, account, new_warmup_cooldown_rate_epoch) |
There was a problem hiding this comment.
I like this idea!
I have a long-standing TODO to remove the StorableAccounts stuff from everything outside the accounts-db crate. But I don't want to block this PR on that work. (I also intend to remove account_for_geyser() once the geyser crates are removed from the monorepo.)
An alternative could be to do this:
let pubkey = accounts.pubkey(i);
accounts.account(i, |account| {
self.stakes_cache.check_and_store(
pubkey,
&account.take_account(),
new_warmup_cooldown_rate_epoch,
);
});All callers are creating the StorableAccounts from AccountSharedDatas already, so we can leverage that here without needing to (re/ab)use the account_from_geyer() fn.
However, the .take_account() will end up doing the AccountSharedData::clone(). That's not the worst, but I don't want to unconditionally clone if we can avoid it.
So I say let's go with your impl as-is, and then once I cleanup the StorableAccounts stuff, I'll also be responsible for cleaning this up.
It may be helpful to add a comment on the account_for_gyser() call indicating why we are using it. E.g.:
// We're not using this for geyser, but it is the only api that
// let's us get a ref to the underlying AccountSharedData *without*
// cloning/allocating first.
accounts.account_for_geyser(i, |pubkey, account| {There was a problem hiding this comment.
ok i added a comment and will open an issue to assign to you, i just want something linked to this pr to show this is AccountsDB Approved(tm) and not laziness/negligence on my part 😅
6f7d132 to
b59ad2d
Compare
|
Backports to release branches are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
Problem
the stakes cache store flow is generic over
ReadableAccount, which requires us to deep copy account data, but the existing bank caller hasAccountSharedDataSummary of Changes
just make it
AccountSharedData. this makes stakes case stores ~30% faster and vote case stores ~60% faster