Cleanup ledger builtins (#14083)
This commit is contained in:
parent
1e977ac025
commit
582418de5e
|
@ -12,41 +12,31 @@ macro_rules! to_builtin {
|
|||
|
||||
/// Builtin programs that are always available
|
||||
fn genesis_builtins(cluster_type: ClusterType, bpf_jit: bool) -> Vec<Builtin> {
|
||||
let mut builtins = vec![
|
||||
to_builtin!(solana_bpf_loader_deprecated_program!()),
|
||||
if bpf_jit {
|
||||
to_builtin!(solana_bpf_loader_program_with_jit!())
|
||||
} else {
|
||||
to_builtin!(solana_bpf_loader_program!())
|
||||
},
|
||||
];
|
||||
if cluster_type != ClusterType::MainnetBeta {
|
||||
vec![
|
||||
to_builtin!(solana_bpf_loader_deprecated_program!()),
|
||||
if bpf_jit {
|
||||
to_builtin!(solana_bpf_loader_program_with_jit!())
|
||||
} else {
|
||||
to_builtin!(solana_bpf_loader_program!())
|
||||
},
|
||||
if bpf_jit {
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program_with_jit!())
|
||||
} else {
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program!())
|
||||
},
|
||||
]
|
||||
} else {
|
||||
// Remove this `else` block and the `cluster_type` argument to this function once
|
||||
// `feature_set::bpf_loader2_program::id()` is active on Mainnet Beta
|
||||
vec![to_builtin!(solana_bpf_loader_deprecated_program!())]
|
||||
builtins.push(if bpf_jit {
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program_with_jit!())
|
||||
} else {
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program!())
|
||||
});
|
||||
}
|
||||
builtins
|
||||
}
|
||||
|
||||
/// Builtin programs activated dynamically by feature
|
||||
fn feature_builtins() -> Vec<(Builtin, Pubkey, ActivationType)> {
|
||||
vec![
|
||||
(
|
||||
to_builtin!(solana_bpf_loader_program!()),
|
||||
feature_set::bpf_loader2_program::id(),
|
||||
ActivationType::NewProgram,
|
||||
),
|
||||
(
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program!()),
|
||||
feature_set::bpf_loader_upgradeable_program::id(),
|
||||
ActivationType::NewProgram,
|
||||
),
|
||||
]
|
||||
vec![(
|
||||
to_builtin!(solana_bpf_loader_upgradeable_program!()),
|
||||
feature_set::bpf_loader_upgradeable_program::id(),
|
||||
ActivationType::NewProgram,
|
||||
)]
|
||||
}
|
||||
|
||||
pub(crate) fn get(cluster_type: ClusterType, bpf_jit: bool) -> Builtins {
|
||||
|
|
|
@ -783,6 +783,7 @@ fn test_mainnet_beta_cluster_type() {
|
|||
&solana_stake_program::id(),
|
||||
&solana_vote_program::id(),
|
||||
&solana_sdk::bpf_loader_deprecated::id(),
|
||||
&solana_sdk::bpf_loader::id(),
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
|
@ -798,7 +799,12 @@ fn test_mainnet_beta_cluster_type() {
|
|||
}
|
||||
|
||||
// Programs that are not available at epoch 0
|
||||
for program_id in [&solana_sdk::bpf_loader::id(), &solana_vest_program::id()].iter() {
|
||||
for program_id in [
|
||||
&solana_sdk::bpf_loader_upgradeable::id(),
|
||||
&solana_vest_program::id(),
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
assert_eq!(
|
||||
(
|
||||
program_id,
|
||||
|
|
Loading…
Reference in New Issue