Skip to content
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

runtime: simplify account saver filter #2992

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

2501babe
Copy link
Member

Problem

negation inside a bracketed OR makes the filter predicate used to select what accounts need to be saved unusually difficult to understand for what is essentially one line of code

Summary of Changes

rewrite in a more straightforward imperative style. the logic itself is unchanged

@2501babe
Copy link
Member Author

honestly i thought it was a me problem for a bit that i needed to write out in words what this did every time i read it, but then i remembered a conversation a couple weeks ago where myself and the other person discussed this function for several minutes only to realize we both had it backwards

@2501babe 2501babe marked this pull request as ready for review September 27, 2024 07:33
@2501babe 2501babe self-assigned this Sep 27, 2024
@2501babe 2501babe requested a review from jstarry September 27, 2024 07:33
}
})
{
for (i, (address, account)) in transaction_accounts.iter().enumerate() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to limit the iteration to transaction.account_keys().len() because transaction_accounts includes some appended program accounts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

youre right, thank you for catching that

unrelated to this pr, but do you know a reason i might have missed re: why we would need to append them? the extra loaders added in load_transaction_accounts(), which i believe is the only place accounts are added. i forgot we do it because i havent been doing it in my new account loader, and it doesnt seem to cause any problems in testing. ProgramCacheForTxBatch is populated with all builtins and as best i can tell invoke context always gets loaders from there

(to be clear i still count them against data size limits)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure at this point whether it's necessary to append them or not. The program cache came later so it's very possible it alleviates the need to do this unintuitive appending behavior.

@2501babe 2501babe merged commit 9c20984 into anza-xyz:master Sep 28, 2024
40 checks passed
@2501babe 2501babe deleted the 20240926_saver_filter branch September 28, 2024 05:03
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants