test: svm_inspect_account helpers #5842
Merged
+75
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
AccountLoader
inspects accounts every timeload_account()
is called. thesvm_inspect_account
test asserts that an account was inspected a specific number of times, in a specific order, with specific states, rather than a looser pattern where it only checks eg "this was inspected as write at least once." based on several previous conversations, it would be undesirable to relax either of these conditionsthis means any time we change how
AccountLoader
is used in svm, this test breaks. there are several past and future prs that cause accounts to be inspected several times per transaction:every time this happens i have to go through the test again and fix it
Summary of Changes
add some helpers so i can just increment an integer when account inspection frequency changes
if youd rather change the test to
.find()
the records it needs in the actual inspections, id be happy to approve that pr. changingAccountLoader
to only inspect accounts it gets from accounts-db is not an option, because it may load and inspect an account as read-only and then later take it as write(the original draft of
AccountLoader
had a mechanism to avoid re-inspecting accounts, but we collectively decided to remove this since inspection is supposed to signal "svm is looking at this account btw" and its up to the implementor of the trait [in this caseBank
] to decide whether it cares or not, hence why multiple inspection happens in the first place)