-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix ProgramTestContext::set_account not updating programs #34780
Fix ProgramTestContext::set_account not updating programs #34780
Conversation
f28d2ba
to
d941dfe
Compare
@tiago18c Please have a look at this PR, updating program accounts never worked for me before. |
@andreisilviudragnea I might be missing something here, but have you tried I've run into a similar issue before when trying to add an upgradeable program using
|
@buffalojoec I am trying to re-use the same I want to be able to simulate Solana transactions on multiple versions of the same program as part of a Tokio web app. And it's not clear to me if |
I would say unless you specifically need to test the program in state A, then do an upgrade, then test it in state B, all within the same blockstore, then you should use separate I can't advise exactly how cheap they are to spin up, but we do this with all of SPL. Here's some examples. You can see in each test (here, here, and the rest), we're spinning up a new In your case, you'd just add a different program processor with |
As explained in #34728 (comment), you have to use the deployment instruction like this test does: solana/programs/sbf/tests/programs.rs Line 1724 in 8869d0c
That |
Problem
ProgramTestContext::warp_to_slot
ignoresProgramTestContext::set_account
program updates.Summary of Changes
This PR tries to fix this problem by using
BankForks::insert_from_ledger
(introduced in #31331) instead ofBankForks::insert
everywhere insideProgramTestContext
. From my investigations,ProgramTestContext::set_account
was never able to update program accounts, not even before #31331.I also added relevant unit tests which verify the bug fix. I did not know how to write them without using precompiled Solana programs. The 3 precompiled Solana programs are variations of the program from here.
Fixes #34728