Skip to content

Commit

Permalink
v2.1: runtime: migrate stake program to core bpf (backport of #3655) (#…
Browse files Browse the repository at this point in the history
…3714)

runtime: migrate stake program to core bpf (#3655)

(cherry picked from commit 14bb15f)

Co-authored-by: hana <[email protected]>
  • Loading branch information
mergify[bot] and 2501babe authored Nov 21, 2024
1 parent da67a77 commit 4804ee8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
42 changes: 15 additions & 27 deletions runtime/src/bank/builtins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ pub static BUILTINS: &[BuiltinPrototype] = &[
program_id: solana_vote_program::id(),
entrypoint: solana_vote_program::vote_processor::Entrypoint::vm,
}),
testable_prototype!(BuiltinPrototype {
core_bpf_migration_config: None,
name: stake_program,
BuiltinPrototype {
core_bpf_migration_config: Some(CoreBpfMigrationConfig {
source_buffer_address: buffer_accounts::stake_program::id(),
upgrade_authority_address: None,
feature_id: solana_feature_set::migrate_stake_program_to_core_bpf::id(),
migration_target: core_bpf_migration::CoreBpfMigrationTargetType::Builtin,
datapoint_name: "migrate_builtin_to_core_bpf_stake_program",
}),
name: "stake_program",
enable_feature_id: None,
program_id: solana_stake_program::id(),
entrypoint: solana_stake_program::stake_instruction::Entrypoint::vm,
}),
},
BuiltinPrototype {
core_bpf_migration_config: Some(CoreBpfMigrationConfig {
source_buffer_address: buffer_accounts::config_program::id(),
Expand Down Expand Up @@ -153,6 +159,9 @@ mod buffer_accounts {
pub mod feature_gate_program {
solana_sdk::declare_id!("3D3ydPWvmEszrSjrickCtnyRSJm1rzbbSsZog8Ub6vLh");
}
pub mod stake_program {
solana_sdk::declare_id!("8t3vv6v99tQA6Gp7fVdsBH66hQMaswH5qsJVqJqo8xvG");
}
}

// This module contains a number of arbitrary addresses used for testing Core
Expand Down Expand Up @@ -203,25 +212,6 @@ mod test_only {
};
}

pub mod stake_program {
pub mod feature {
solana_sdk::declare_id!("5gp5YKtNEirX45igBvp39bN6nEwhkNMRS7m2c63D1xPM");
}
pub mod source_buffer {
solana_sdk::declare_id!("2a3XnUr4Xfxd8hBST8wd4D3Qbiu339XKessYsDwabCED");
}
pub mod upgrade_authority {
solana_sdk::declare_id!("F7K7ADSDzReQAgXYL1KE3u1UBjBtytxQ8bke7BF1Uegg");
}
pub const CONFIG: super::CoreBpfMigrationConfig = super::CoreBpfMigrationConfig {
source_buffer_address: source_buffer::id(),
upgrade_authority_address: Some(upgrade_authority::id()),
feature_id: feature::id(),
migration_target: super::CoreBpfMigrationTargetType::Builtin,
datapoint_name: "migrate_builtin_to_core_bpf_stake_program",
};
}

pub mod solana_bpf_loader_deprecated_program {
pub mod feature {
solana_sdk::declare_id!("8gpakCv5Pk5PZGv9RUjzdkk2GVQPGx12cNRUDMQ3bP86");
Expand Down Expand Up @@ -371,10 +361,8 @@ mod tests {
&super::BUILTINS[1].core_bpf_migration_config,
&Some(super::test_only::vote_program::CONFIG)
);
assert_eq!(
&super::BUILTINS[2].core_bpf_migration_config,
&Some(super::test_only::stake_program::CONFIG)
);
// Stake has a live migration config, so it has no test-only configs
// to test here.
// Config has a live migration config, so it has no test-only configs
// to test here.
assert_eq!(
Expand Down
5 changes: 5 additions & 0 deletions sdk/feature-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ pub mod enable_secp256r1_precompile {
solana_pubkey::declare_id!("sr11RdZWgbHTHxSroPALe6zgaT5A1K9LcE4nfsZS4gi");
}

pub mod migrate_stake_program_to_core_bpf {
solana_pubkey::declare_id!("6M4oQ6eXneVhtLoiAr4yRYQY43eVLjrKbiDZDJc892yk");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -1091,6 +1095,7 @@ lazy_static! {
(reenable_sbpf_v1_execution::id(), "Re-enables execution of SBPFv1 programs"),
(disable_account_loader_special_case::id(), "Disable account loader special case #3513"),
(enable_secp256r1_precompile::id(), "Enable secp256r1 precompile SIMD-0075"),
(migrate_stake_program_to_core_bpf::id(), "Migrate Stake program to Core BPF SIMD-0196 #3655"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down

0 comments on commit 4804ee8

Please sign in to comment.