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

v1.18: Test Validator: Set deployment slot to 0 for cloned upgradeable programs (backport of #501) #518

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Apr 1, 2024

Problem

When an upgradeable program is cloned from another cluster into the test
validator's genesis config, its existing deployment slot is never modified. This
causes the program cache to fail when attempting to load this program.

On version 1.18, this is an error handled gracefully by the runtime:

Transaction simulation failed: This program may not be used for executing instructions

The change at solana-labs#34407 seems to have been where the bug was introduced to 1.18. The error is caused by the snippets I mentioned here: #436 (comment)

However, on the current tip, this is actually a panic.

[ ERROR solana_program_runtime::loaded_programs ] ProgramCache::assign_program() failed key=DwnyLgHGL7QLcHEJgLMRAhSBAXwzh3ueviPa3SQgyvBQ existing=[LoadedProgram { program: LoadedProgramType::LegacyV1, account_size: 19233, deployment_slot: 288251488, effective_slot: 288251489, tx_usage_counter: 1, ix_usage_counter: 0, latest_access_slot: 379 }] entry=LoadedProgram { program: LoadedProgramType::LegacyV1, account_size: 19233, deployment_slot: 288251488, effective_slot: 288251489, tx_usage_counter: 1, ix_usage_counter: 0, latest_access_slot: 379 }

thread 'solRpcEl' panicked at /Users/joesol/anza/solana-joe/program-runtime/src/loaded_programs.rs:791:25:
Unexpected replacement of an entry

// Something is wrong, I can feel it ...
error!("ProgramCache::assign_program() failed key={:?} existing={:?} entry={:?}", key, slot_versions, entry);
debug_assert!(false, "Unexpected replacement of an entry");

Summary of Changes

As we currently do with the SPL programs, when adding the programdata account
for a cloned upgradeable program, set the deployment slot to 0.

Closes #436


This is an automatic backport of pull request #501 done by Mergify.

…grams (#501)

test-validator: clone upgradeable programs with slot 0
(cherry picked from commit 4b0e7d6)
@buffalojoec
Copy link

As requested by @joncinque, I'm requesting this change be backported to v1.18 since it only changes the test validator and fixes a bug.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.5%. Comparing base (8d2ae41) to head (4dc64e1).

Additional details and impacted files
@@            Coverage Diff            @@
##            v1.18     #518     +/-   ##
=========================================
- Coverage    81.5%    81.5%   -0.1%     
=========================================
  Files         827      827             
  Lines      224793   224793             
=========================================
- Hits       183419   183375     -44     
- Misses      41374    41418     +44     

@buffalojoec buffalojoec merged commit 433f282 into v1.18 Apr 1, 2024
35 checks passed
@buffalojoec buffalojoec deleted the mergify/bp/v1.18/pr-501 branch April 1, 2024 16:10
anwayde pushed a commit to firedancer-io/agave that referenced this pull request Jul 23, 2024
…ble programs (backport of anza-xyz#501) (anza-xyz#518)

Test Validator: Set deployment slot to `0` for cloned upgradeable programs (anza-xyz#501)

test-validator: clone upgradeable programs with slot 0
(cherry picked from commit 4b0e7d6)

Co-authored-by: Joe C <[email protected]>
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