Skip to content

Commit

Permalink
builtin default cost: sort builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Nov 26, 2024
1 parent 8f4e39a commit 2115687
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions builtins-default-costs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,45 @@ lazy_static! {
/// https://github.com/solana-labs/solana/issues/29595.
static ref BUILTIN_INSTRUCTION_COSTS: AHashMap<Pubkey, BuiltinCost> = [
(
solana_stake_program::id(),
solana_system_program::id(),
BuiltinCost {
native_cost: solana_stake_program::stake_instruction::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[2].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_system_program::system_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[0].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
solana_config_program::id(),
solana_vote_program::id(),
BuiltinCost {
native_cost: solana_config_program::config_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[3].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[1].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
solana_vote_program::id(),
solana_stake_program::id(),
BuiltinCost {
native_cost: solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[1].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_stake_program::stake_instruction::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[2].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
solana_system_program::id(),
solana_config_program::id(),
BuiltinCost {
native_cost: solana_system_program::system_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[0].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_config_program::config_processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[3].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
compute_budget::id(),
bpf_loader_deprecated::id(),
BuiltinCost {
native_cost: solana_compute_budget_program::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[7].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_bpf_loader_program::DEPRECATED_LOADER_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[4].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
address_lookup_table::program::id(),
bpf_loader::id(),
BuiltinCost {
native_cost: solana_address_lookup_table_program::processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[8].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_bpf_loader_program::DEFAULT_LOADER_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[5].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
Expand All @@ -83,26 +83,29 @@ lazy_static! {
},
),
(
bpf_loader_deprecated::id(),
compute_budget::id(),
BuiltinCost {
native_cost: solana_bpf_loader_program::DEPRECATED_LOADER_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[4].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_compute_budget_program::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[7].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
(
bpf_loader::id(),
address_lookup_table::program::id(),
BuiltinCost {
native_cost: solana_bpf_loader_program::DEFAULT_LOADER_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[5].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
native_cost: solana_address_lookup_table_program::processor::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[8].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
// zk-token-proof-program
(
loader_v4::id(),
BuiltinCost {
native_cost: solana_loader_v4_program::DEFAULT_COMPUTE_UNITS,
core_bpf_migration_feature: BUILTINS[10].core_bpf_migration_config.as_ref().map(|c| c.feature_id),
},
),
// zk-elgamal-proof-program

// Note: These are precompile, run directly in bank during sanitizing;
(
secp256k1_program::id(),
Expand Down

0 comments on commit 2115687

Please sign in to comment.