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

Feature - Adds UpgradeableLoaderInstruction::Migrate #4661

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

Lichtso
Copy link

@Lichtso Lichtso commented Jan 28, 2025

Problem

See SIMD-0167.

Summary of Changes

Feature Gate Issue: https://github.com/anza-xyz/feature-gate-tracker/issues/78

@Lichtso Lichtso requested a review from a team as a code owner January 28, 2025 13:00
Copy link

mergify bot commented Jan 28, 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/loader_v3_to_v4_migration branch 2 times, most recently from ba4a1ef to d9db125 Compare January 28, 2025 13:17
Copy link

@LucasSte LucasSte left a comment

Choose a reason for hiding this comment

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

The CI is failing.

programs/bpf_loader/src/lib.rs Outdated Show resolved Hide resolved
@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch from d9db125 to c526f4d Compare January 28, 2025 14:16
@Lichtso Lichtso marked this pull request as draft January 28, 2025 14:20
@Lichtso
Copy link
Author

Lichtso commented Jan 28, 2025

Yep, also still have to write a test for the new instruction.

@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch 5 times, most recently from a5b2de4 to a141a1a Compare January 29, 2025 15:47
@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch 5 times, most recently from 2ccc774 to e5f2665 Compare February 3, 2025 16:36
Copy link

mergify bot commented Feb 4, 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.

@joncinque
Copy link

This PR contains changes to the solana sdk, which will be moved to a new repo within the next week, when v2.2 is branched from master.

Please merge or close this PR as soon as possible, or re-create the sdk changes when the new repository is ready at https://github.com/anza-xyz/solana-sdk

@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch 5 times, most recently from 538e50e to ae58ed5 Compare February 5, 2025 23:20
Copy link

mergify bot commented Feb 5, 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/loader_v3_to_v4_migration branch 3 times, most recently from 2f9e218 to 7d0f4d0 Compare February 6, 2025 21:09
@Lichtso Lichtso marked this pull request as ready for review February 6, 2025 23:13
@Lichtso Lichtso requested a review from pgarg66 February 6, 2025 23:13
Copy link

@LucasSte LucasSte left a comment

Choose a reason for hiding this comment

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

This PR adds the new instruction in the loader and modifies the CLI. Would you mind splitting those into two PRs? One for the new instruction and another one for the CLI command.

cli/src/program.rs Outdated Show resolved Hide resolved
@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch from 7d0f4d0 to 68c8f8f Compare February 7, 2025 14:38
@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch from 68c8f8f to 48f11f4 Compare February 7, 2025 14:43
// Verify authority signature
if !migration_authority::check_id(&provided_authority_address)
&& provided_authority_address
!= upgrade_authority_address.unwrap_or(program_address)
Copy link

Choose a reason for hiding this comment

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

The SIMD mentions program signer. Is that the program address?

Check that the provided authority is either:
- the migration authority
(pubkey is 3Scf35jMNk2xXBD6areNjgMtXgp5ZspDhms8vdcbzC42)
- or the upgrade authority stored in the program data account
- or the program signer if the program is finalized, closed or
uninitialized

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it means the program address is also a signer.

Comment on lines +1432 to +1435
} else {
ic_logger_msg!(log_collector, "Invalid Program account");
return Err(InstructionError::InvalidAccountData);
}
Copy link

Choose a reason for hiding this comment

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

This else is not specified in the SIMD. It is necessary here, for sure. Should it be included in the instruction description in the SIMD?

Copy link
Author

Choose a reason for hiding this comment

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

I updated the SIMD

Comment on lines +13504 to +13645
InstructionError::InvalidInstructionData,
)),
),
(
uninitialized_programdata_account,
finalized_migration_transaction.clone(),
Err(TransactionError::InstructionError(
0,
InstructionError::InvalidInstructionData,
Copy link

Choose a reason for hiding this comment

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

You checked for two error cases only. Should we check for all error possibilities?

Copy link
Author

Choose a reason for hiding this comment

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

Added ten more test cases.

@Lichtso Lichtso force-pushed the feature/loader_v3_to_v4_migration branch from 48f11f4 to 66974b0 Compare February 7, 2025 18:19
@Lichtso Lichtso merged commit 11dfda5 into anza-xyz:master Feb 7, 2025
77 checks passed
@Lichtso Lichtso deleted the feature/loader_v3_to_v4_migration branch February 7, 2025 22:19
@joncinque
Copy link

Unfortunately, this PR was merged after the v2.2 branch was cut, which means that the v2.2 crates were published without this change.

Now it's blocking the removal of the SDK from the monorepo: https://buildkite.com/anza/agave/builds/19002#0194e28d-87cd-405a-bcec-8e65cb1600a3

Can we please revert this?

We'll have to apply the changes to the loader-v3 interface crate at https://github.com/anza-xyz/solana-sdk/tree/master/loader-v3-interface, publish a new major version, and then upgrade agave to use that new crate.

joncinque added a commit to joncinque/solana-sdk that referenced this pull request Feb 7, 2025
#### Problem

The SDK changes from anza-xyz/agave#4661 need to
be applied here.

See [SIMD-0167](solana-foundation/solana-improvement-documents#167).

#### Summary of Changes

Feature Gate Issue: anza-xyz/feature-gate-tracker#78
joncinque pushed a commit to joncinque/solana-sdk that referenced this pull request Feb 7, 2025
#### Problem

The SDK changes from anza-xyz/agave#4661 need to
be applied here.

See [SIMD-0167](solana-foundation/solana-improvement-documents#167).

#### Summary of Changes

Feature Gate Issue: anza-xyz/feature-gate-tracker#78
joncinque added a commit that referenced this pull request Feb 8, 2025
joncinque added a commit to anza-xyz/solana-sdk that referenced this pull request Feb 10, 2025
* loader-v3: Add `UpgradeableLoaderInstruction::Migrate`

#### Problem

The SDK changes from anza-xyz/agave#4661 need to
be applied here.

See [SIMD-0167](solana-foundation/solana-improvement-documents#167).

#### Summary of Changes

Feature Gate Issue: anza-xyz/feature-gate-tracker#78

* Avoid change in solana-program

---------

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants