Skip to content

Commit

Permalink
Adds switch_program_deployment_to_sbpf_v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Jun 28, 2023
1 parent 86521cf commit f1391b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use {
error_on_syscall_bpf_function_hash_collisions, last_restart_slot_sysvar,
libsecp256k1_0_5_upgrade_enabled, reject_callx_r10,
stop_sibling_instruction_search_at_parent, stop_truncating_strings_in_syscalls,
switch_to_new_elf_parser,
switch_program_deployment_to_sbpf_v2, switch_to_new_elf_parser,
},
hash::{Hasher, HASH_BYTES},
instruction::{
Expand Down Expand Up @@ -148,6 +148,8 @@ pub fn create_program_runtime_environment<'a>(
reject_deployment_of_broken_elfs: bool,
debugging_features: bool,
) -> Result<BuiltinProgram<InvokeContext<'a>>, Error> {
let switch_program_deployment_to_sbpf_v2 =
feature_set.is_active(&switch_program_deployment_to_sbpf_v2::id());
let enable_alt_bn128_syscall = feature_set.is_active(&enable_alt_bn128_syscall::id());
let enable_big_mod_exp_syscall = feature_set.is_active(&enable_big_mod_exp_syscall::id());
let blake3_syscall_enabled = feature_set.is_active(&blake3_syscall_enabled::id());
Expand All @@ -166,7 +168,7 @@ pub fn create_program_runtime_environment<'a>(
max_call_depth: compute_budget.max_call_depth,
stack_frame_size: compute_budget.stack_frame_size,
enable_address_translation: true,
enable_stack_frame_gaps: true,
enable_stack_frame_gaps: !switch_program_deployment_to_sbpf_v2,
instruction_meter_checkpoint_distance: 10000,
enable_instruction_meter: true,
enable_instruction_tracing: debugging_features,
Expand All @@ -181,8 +183,8 @@ pub fn create_program_runtime_environment<'a>(
external_internal_function_hash_collision: feature_set
.is_active(&error_on_syscall_bpf_function_hash_collisions::id()),
reject_callx_r10: feature_set.is_active(&reject_callx_r10::id()),
enable_sbpf_v1: true,
enable_sbpf_v2: false,
enable_sbpf_v1: !(switch_program_deployment_to_sbpf_v2 && reject_deployment_of_broken_elfs),
enable_sbpf_v2: switch_program_deployment_to_sbpf_v2,
optimize_rodata: false,
new_elf_parser: feature_set.is_active(&switch_to_new_elf_parser::id()),
aligned_memory_mapping: !feature_set.is_active(&bpf_account_data_direct_mapping::id()),
Expand Down
1 change: 1 addition & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8572,6 +8572,7 @@ impl Bank {
feature_set::switch_to_new_elf_parser::id(),
feature_set::bpf_account_data_direct_mapping::id(),
feature_set::enable_alt_bn128_syscall::id(),
feature_set::switch_program_deployment_to_sbpf_v2::id(),
];
if !only_apply_transitions_for_new_features
|| FEATURES_AFFECTING_RBPF
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ pub mod last_restart_slot_sysvar {
solana_sdk::declare_id!("HooKD5NC9QNxk25QuzCssB8ecrEzGt6eXEPBUxWp1LaR");
}

pub mod switch_program_deployment_to_sbpf_v2 {
solana_sdk::declare_id!("2URMmUo78tana2quSMcWBvc6tBMZP83zM9gUMjA6tJiv");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -835,6 +839,7 @@ lazy_static! {
(checked_arithmetic_in_fee_validation::id(), "checked arithmetic in fee validation #31273"),
(bpf_account_data_direct_mapping::id(), "use memory regions to map account data into the rbpf vm instead of copying the data"),
(last_restart_slot_sysvar::id(), "enable new sysvar last_restart_slot"),
(switch_program_deployment_to_sbpf_v2::id(), "switch program deployment to SBPFv2 #32314")
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down

0 comments on commit f1391b1

Please sign in to comment.