1

ProgramTestContext::set_account caches the first call for a program account, not allowing it to the updated again. I tried updating a program account in 3 ways:

  • by using a simple account with program data and bpf_loader::id() owner.
  • by using two accounts: UpgradeableLoaderState::Program and UpgradeableLoaderState::ProgramData and updating the first one.
  • by using two accounts: UpgradeableLoaderState::Program and UpgradeableLoaderState::ProgramData and updating the second one.

None of these options worked. Does anyone know how to do this? My trials can be consulted here.

1 Answer 1

1

Normally, you should be able to update the second one to update the program account.

As you noticed, there is some caching involved. The program cache, even in test environments, lasts at least 1 slot, so you cannot redeploy a program in the same slot twice.

To get around this, you should be able to warp the bank forward by one slot, by using ProgramTestContext::warp_to_slot, and then trying to use the program again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.