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

svm: only inspect loaded accounts #3131

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

2501babe
Copy link
Member

@2501babe 2501babe commented Oct 10, 2024

Problem

as-written, inspect_account is called on every LoadedTransactionAccount produced by load_transaction_account, but some of these are pseudo-accounts. namely:

  • instructions sysvar: transient blob data produced for a specific transaction
  • account overrides: mocked-out account states used for transaction simulation
  • program cache entries: these are real accounts, but necessarily read-only, so they dont need to be inspected. but the AccountSharedData produced from the cache has an empty data vector and may erroneously be marked as executable, so it should not be pushed back to the bank

Summary of Changes

only call inspect_account on accounts that are retrieved from accounts-db, or accounts to be newly created

@2501babe 2501babe self-assigned this Oct 10, 2024
@2501babe 2501babe marked this pull request as ready for review October 10, 2024 11:22
@2501babe 2501babe marked this pull request as draft October 10, 2024 12:12
@2501babe
Copy link
Member Author

2501babe commented Oct 10, 2024

put back into draft until tests pass, my initial version of this i forgot accounts are inspected in validate_transaction_fee_payer too. im 70% sure account overrides is only for things that should never be seen by accounts-db, but i dont know the code where its used upstream from svm, so if there was a reason you were inspecting these please correct me. im 100% sure that program cache entries and instructions sysvar should never be inspected

Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

Code looks good to me.


im 70% sure account overrides is only for things that should never be seen by accounts-db, but i dont know the code where its used upstream from svm, so if there was a reason you were inspecting these please correct me.

I'm not familiar with account overrides, so I defer to your expertise here 😸

im 100% sure that program cache entries and instructions sysvar should never be inspected

👍

@2501babe 2501babe marked this pull request as ready for review October 10, 2024 13:07
Copy link

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

@2501babe 2501babe merged commit fda4def into anza-xyz:master Oct 10, 2024
38 checks passed
@2501babe 2501babe deleted the 20241010_inspectaccts branch October 10, 2024 14:49
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