Refactor - TransactionProcessingCallback#7381
Conversation
TransactionProcessingCallback
| .0 | ||
| .and_then(|account| owners.iter().position(|entry| entry == account.owner())) | ||
| fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<(AccountSharedData, Slot)> { | ||
| self.do_load(pubkey).0.map(|account| (account, 0)) |
There was a problem hiding this comment.
This is a path used in production. Would you mind explaining here why the slot does not matter?
There was a problem hiding this comment.
Explaining = adding a comment in the code.
There was a problem hiding this comment.
It will matter, but not in this PR. It is only to get the interface changes at the v3.0 version bump. So for now, the slot is a dummy. I did add a comment in the last commit.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7381 +/- ##
=======================================
Coverage 83.2% 83.2%
=======================================
Files 796 796
Lines 361890 361875 -15
=======================================
+ Hits 301326 301388 +62
+ Misses 60564 60487 -77 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
I think this feels like maybe the wrong approach. What about introducing a new method that has the desired return type of Option<(AccountSharedData, Slot)> and just using it in program cache operations?
Adding a dummy value to a method that's currently used on the hot path (as @LucasSte said) by things like account loader seems like an anti-pattern. Account loader & friends can just use get_account_shared_data as it's written and implemented, and this new method can use a dummy because it can be explicitly labeled as unused in account loader. Wdyt?
|
There is no way to "just using it in program cache operations" because the program cache will need to get this info from the accounts-db, it can not come up with it on its own. Also, Hana worked really hard so that we do not directly access the accounts-db for transaction loading anymore and instead go via |
So you're telling me it's impossible to only use Point being, non-programs wouldn't need a dummy/discarded value. |
|
Just yesterday we removed most special handling around |
Problem
With #6036 merged we don't need
TransactionProcessingCallback::account_matches_owners()anymore and we can finally start working on the simplification of the global program cache index structure by using the last modified slot of the accounts-db. To do so we would have to add that as part of the return value ofTransactionProcessingCallback::get_account_shared_data().Summary of Changes
This is a breaking change to the interface (
TransactionProcessingCallback) of the SVM:Slotto return type ofTransactionProcessingCallback::get_account_shared_data().TransactionProcessingCallback::account_matches_owners().