Skip to content

Feature - UpgradeableLoaderInstruction::ExtendProgramChecked #6131

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

Merged
merged 7 commits into from
May 13, 2025

Conversation

Lichtso
Copy link

@Lichtso Lichtso commented May 6, 2025

See SIMD-0164.

Feature Gate Issue: #87

Copy link

mergify bot commented May 6, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch 6 times, most recently from e93ec72 to 435b3c6 Compare May 6, 2025 23:52
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a fly-by review, the program logic looks great to me, just some small comments on the CLI and tests

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch 3 times, most recently from 8e7ef1f to c79ac7a Compare May 7, 2025 14:00
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of last things, and thanks for fixing up the tests, they look great!

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch from c79ac7a to baba6ec Compare May 8, 2025 08:56
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the last bit from my side, then this is ready to go in!

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch 2 times, most recently from edf3150 to 6f70d23 Compare May 8, 2025 10:29
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's just some lockfile changes to commit, then this is good to go!

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch 3 times, most recently from 042ef6f to f64f03c Compare May 8, 2025 11:28
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2025

Codecov Report

Attention: Patch coverage is 6.02410% with 234 lines in your changes missing coverage. Please review.

Project coverage is 82.8%. Comparing base (3cf7845) to head (71e26b5).

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6131     +/-   ##
=========================================
- Coverage    82.8%    82.8%   -0.1%     
=========================================
  Files         843      843             
  Lines      378109   378209    +100     
=========================================
+ Hits       313134   313197     +63     
- Misses      64975    65012     +37     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

joncinque
joncinque previously approved these changes May 8, 2025
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks for addressing all the points!

@Lichtso Lichtso marked this pull request as ready for review May 12, 2025 09:03
@Lichtso Lichtso requested a review from a team as a code owner May 12, 2025 09:03
Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few small items from me!

Comment on lines +1159 to +1162
if invoke_context
.get_feature_set()
.enable_extend_program_checked
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to add a log message for the developer! I guess for either one.

Comment on lines 1364 to 1372
const PROGRAM_DATA_ACCOUNT_INDEX: IndexOfAccount = 0;
const PROGRAM_ACCOUNT_INDEX: IndexOfAccount = 1;
const AUTHORITY_ACCOUNT_INDEX: IndexOfAccount = 2;
let optional_payer_account_index = if check_authority { 4 } else { 3 };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some kind of note here about the system program being at index 2 or 3, based on the authority check, would be nice for other maintainers.

"additionalBytes": additional_bytes,
"programDataAccount": account_keys[instruction.accounts[0] as usize].to_string(),
"programAccount": account_keys[instruction.accounts[1] as usize].to_string(),
"authority": account_keys[instruction.accounts[2] as usize].to_string(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need a .len() > 2 check here, since the call to check_num_bpf_upgradeable_loader_accounts will only check loader v3 accounts, not the authority, which is most likely owned by System.

Copy link

@joncinque joncinque May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra check isn't necessary, the function is just poorly named. It checks for all accounts, not just ones owned by the loader program:

fn check_num_bpf_upgradeable_loader_accounts(
accounts: &[u8],
num: usize,
) -> Result<(), ParseInstructionError> {
check_num_accounts(accounts, num, ParsableProgram::BpfUpgradeableLoader)
}

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch from dae745e to 019ec1d Compare May 12, 2025 16:23
buffalojoec
buffalojoec previously approved these changes May 13, 2025
Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Lichtso Lichtso force-pushed the feature/extend_program_checked branch from 019ec1d to eb3e328 Compare May 13, 2025 08:46
@Lichtso Lichtso force-pushed the feature/extend_program_checked branch 2 times, most recently from 9f721b9 to fc57f4a Compare May 13, 2025 09:59
@Lichtso Lichtso force-pushed the feature/extend_program_checked branch from fc57f4a to 71e26b5 Compare May 13, 2025 10:30
@Lichtso Lichtso merged commit 94d70cd into anza-xyz:master May 13, 2025
58 checks passed
@Lichtso Lichtso deleted the feature/extend_program_checked branch May 13, 2025 12:01
@Lichtso Lichtso added the v2.2 Backport to v2.2 branch label May 13, 2025
Copy link

mergify bot commented May 13, 2025

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 May 13, 2025
* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)

# Conflicts:
#	Cargo.lock
#	feature-set/src/lib.rs
#	genesis/Cargo.toml
#	programs/bpf-loader-tests/tests/extend_program_ix.rs
#	programs/sbf/Cargo.lock
#	programs/sbf/Cargo.toml
#	runtime/Cargo.toml
#	svm-feature-set/src/lib.rs
#	svm/Cargo.toml
#	svm/examples/Cargo.lock
#	transaction-status/Cargo.toml
Lichtso added a commit that referenced this pull request May 13, 2025
* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)
Lichtso added a commit that referenced this pull request May 13, 2025
* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)
@Lichtso Lichtso added the feature-gate Pull Request adds or modifies a runtime feature gate label May 13, 2025
Lichtso added a commit that referenced this pull request May 15, 2025
* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)
Lichtso added a commit that referenced this pull request Jun 4, 2025
* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)
Lichtso added a commit that referenced this pull request Jun 6, 2025
…(backport of #6131) (#6217)

Feature - `UpgradeableLoaderInstruction::ExtendProgramChecked` (#6131)

* Bumps solana-loader-v3-interface version.

* Adds the feature.

* Adds feature gating logic.

* Adjusts transaction-status parser.

* Adjusts CLI manual extend and auto extend.

* Adds authority_signer_index to ProgramCliCommand::ExtendProgramChecked.

* Adjusts solana-bpf-loader-program-tests.

(cherry picked from commit 94d70cd)

Co-authored-by: Alexander Meißner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-gate Pull Request adds or modifies a runtime feature gate v2.2 Backport to v2.2 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants