Limit CPI instruction size (#14317)
This commit is contained in:
@ -118,6 +118,10 @@ pub mod stake_program_v3 {
|
||||
solana_sdk::declare_id!("Ego6nTu7WsBcZBvVqJQKp6Yku2N3mrfG8oYCfaLZkAeK");
|
||||
}
|
||||
|
||||
pub mod max_cpi_instruction_size_ipv6_mtu {
|
||||
solana_sdk::declare_id!("5WLtuUJA5VVA1Cc28qULPfGs8anhoBev8uNqaaXeasnf");
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
@ -149,6 +153,7 @@ lazy_static! {
|
||||
(try_find_program_address_syscall_enabled::id(), "add try_find_program_address syscall"),
|
||||
(warp_testnet_timestamp::id(), "warp testnet timestamp to current #14210"),
|
||||
(stake_program_v3::id(), "solana_stake_program v3"),
|
||||
(max_cpi_instruction_size_ipv6_mtu::id(), "Max cross-program invocation size 1280"),
|
||||
/*************** ADD NEW FEATURES HERE ***************/
|
||||
]
|
||||
.iter()
|
||||
|
@ -1,8 +1,8 @@
|
||||
use solana_sdk::{
|
||||
account::Account,
|
||||
feature_set::{
|
||||
bpf_compute_budget_balancing, max_invoke_depth_4, max_program_call_depth_64,
|
||||
pubkey_log_syscall_enabled, FeatureSet,
|
||||
bpf_compute_budget_balancing, max_cpi_instruction_size_ipv6_mtu, max_invoke_depth_4,
|
||||
max_program_call_depth_64, pubkey_log_syscall_enabled, FeatureSet,
|
||||
},
|
||||
instruction::{CompiledInstruction, Instruction, InstructionError},
|
||||
keyed_account::KeyedAccount,
|
||||
@ -91,6 +91,8 @@ pub struct BpfComputeBudget {
|
||||
pub stack_frame_size: usize,
|
||||
/// Number of compute units consumed by logging a `Pubkey`
|
||||
pub log_pubkey_units: u64,
|
||||
/// Maximum cross-program invocation instruction size
|
||||
pub max_cpi_instruction_size: usize,
|
||||
}
|
||||
impl Default for BpfComputeBudget {
|
||||
fn default() -> Self {
|
||||
@ -113,6 +115,7 @@ impl BpfComputeBudget {
|
||||
max_call_depth: 20,
|
||||
stack_frame_size: 4_096,
|
||||
log_pubkey_units: 0,
|
||||
max_cpi_instruction_size: std::usize::MAX,
|
||||
};
|
||||
|
||||
if feature_set.is_active(&bpf_compute_budget_balancing::id()) {
|
||||
@ -144,6 +147,12 @@ impl BpfComputeBudget {
|
||||
..bpf_compute_budget
|
||||
};
|
||||
}
|
||||
if feature_set.is_active(&max_cpi_instruction_size_ipv6_mtu::id()) {
|
||||
bpf_compute_budget = BpfComputeBudget {
|
||||
max_cpi_instruction_size: 1280, // IPv6 Min MTU size
|
||||
..bpf_compute_budget
|
||||
};
|
||||
}
|
||||
bpf_compute_budget
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user