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

v2.1: Fix - SVM account_loader tests (backport of #3448) #3520

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Nov 7, 2024

Problem

Some tests in svm/src/account_loader.rs currently do test situations which are impossible to construct in production and do miss cases which are. The issue is a slightly incorrect setup of the program accounts involved. The tests assume that the program cache of the program cache is protocol relevant, which it is not, instead the SVM program loader is.

Otherwise these tests (introduced in #3045) are pretty good, so shout-out to Hana for writing them!

Summary of Changes

  • Fixes test_load_transaction_accounts_program_account_executable_bypass:
    Now constructs a loader-v2 tombstone, instead of an impossible program cache entry (a closed built-in) which would not be produced by the SVM program loader. This also changes the expected owner of the loaded program account from the native_loader to bpf_loader and thus inserts bpf_loader in the list of loaded accounts.

  • Fixes test_load_transaction_accounts_data_sizes:
    Now initializes the loader-v3 program with a valid UpgradeableLoaderState::Program pointing to a programdata account containing UpgradeableLoaderState::ProgramData and an ELF. Before the test simply forced in an impossible program cache entry (a closed built-in) which would not be produced by the SVM program loader. Also, uses the correctly initialized program cache for all tests now. Before it had some with an empty cache, which again can't happen in production because the cache is replenished before the account loader runs. Furthermore, adds two test cases for write lock demotion of loader-v3.

  • Removes test_load_transaction_accounts_program_account_not_found_but_loaded:
    The test constructs a scenario in which the program cache contains an entry even tough the accounts database has no account at the given key. This is not possible because the program cache only has entries for accounts owned by the loaders. A non existent account can not be owned by a loader.

Fixes #


This is an automatic backport of pull request #3448 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner November 7, 2024 16:23
@mergify mergify bot assigned Lichtso Nov 7, 2024
@Lichtso
Copy link

Lichtso commented Nov 7, 2024

CI is broken because of solana-labs/solana-program-library#7465

* Fixes test_load_transaction_accounts_program_account_executable_bypass.

* Fixes test_load_transaction_accounts_data_sizes().

* Removes test_load_transaction_accounts_program_account_not_found_but_loaded().

(cherry picked from commit 7403549)
@Lichtso Lichtso merged commit ee92535 into v2.1 Nov 8, 2024
28 checks passed
@Lichtso Lichtso deleted the mergify/bp/v2.1/pr-3448 branch November 8, 2024 15:57
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.

3 participants