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

Test Validator: Set deployment slot to 0 for cloned upgradeable programs #501

Merged

Conversation

buffalojoec
Copy link

@buffalojoec buffalojoec commented Mar 29, 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

@buffalojoec buffalojoec force-pushed the test-validator-clone-prog-issue branch from cc6db45 to 52586ad Compare March 29, 2024 13:32
@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.8%. Comparing base (b1e1799) to head (77f34cb).

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #501     +/-   ##
=========================================
- Coverage    81.8%    81.8%   -0.1%     
=========================================
  Files         842      842             
  Lines      228462   228462             
=========================================
- Hits       187084   187043     -41     
- Misses      41378    41419     +41     

@buffalojoec buffalojoec force-pushed the test-validator-clone-prog-issue branch from 52586ad to 77f34cb Compare March 29, 2024 15:46
@buffalojoec buffalojoec marked this pull request as ready for review March 29, 2024 15:46
@buffalojoec buffalojoec merged commit 4b0e7d6 into anza-xyz:master Mar 29, 2024
37 checks passed
@joncinque
Copy link

Is there any intention to backport this? Since it's only impacting dev tools and fixing a bug, I think it would be best to backport.

Copy link

mergify bot commented Apr 1, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify bot pushed a commit that referenced this pull request Apr 1, 2024
…grams (#501)

test-validator: clone upgradeable programs with slot 0
(cherry picked from commit 4b0e7d6)
buffalojoec added a commit that referenced this pull request Apr 1, 2024
…ble programs (backport of #501) (#518)

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

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

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

Successfully merging this pull request may close these issues.

test-validator: Cloned upgradeable programs don't work
4 participants