* Charge compute budget for bytes passed via cpi (#15874)
(cherry picked from commit ad9901d7c6
)
# Conflicts:
# programs/bpf_loader/src/syscalls.rs
# sdk/src/feature_set.rs
# sdk/src/process_instruction.rs
* fix conflicts
* nudge
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@@ -171,6 +171,10 @@ pub mod check_program_owner {
|
||||
solana_sdk::declare_id!("5XnbR5Es9YXEARRuP6mdvoxiW3hx5atNNeBmwVd8P3QD");
|
||||
}
|
||||
|
||||
pub mod cpi_data_cost {
|
||||
solana_sdk::declare_id!("Hrg5bXePPGiAVWZfDHbvjqytSeyBDPAGAQ7v6N5i4gCX");
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
@@ -213,7 +217,8 @@ lazy_static! {
|
||||
(warp_timestamp_again::id(), "warp timestamp again, adjust bounding to 25% fast 80% slow #15204"),
|
||||
(per_byte_logging_cost::id(), "charge the compute budget per byte for logging"),
|
||||
(check_init_vote_data::id(), "check initialized Vote data"),
|
||||
(check_program_owner::id(), "limit programs to operating on accounts owned by itself")
|
||||
(check_program_owner::id(), "limit programs to operating on accounts owned by itself"),
|
||||
(cpi_data_cost::id(), "charge the compute budger for data passed via CPI"),
|
||||
/*************** ADD NEW FEATURES HERE ***************/
|
||||
]
|
||||
.iter()
|
||||
|
@@ -124,6 +124,8 @@ pub struct BpfComputeBudget {
|
||||
pub log_pubkey_units: u64,
|
||||
/// Maximum cross-program invocation instruction size
|
||||
pub max_cpi_instruction_size: usize,
|
||||
/// Number of account data bytes per conpute unit charged during a cross-program invocation
|
||||
pub cpi_bytes_per_unit: u64,
|
||||
}
|
||||
impl Default for BpfComputeBudget {
|
||||
fn default() -> Self {
|
||||
@@ -147,6 +149,7 @@ impl BpfComputeBudget {
|
||||
stack_frame_size: 4_096,
|
||||
log_pubkey_units: 0,
|
||||
max_cpi_instruction_size: std::usize::MAX,
|
||||
cpi_bytes_per_unit: 250,
|
||||
};
|
||||
|
||||
if feature_set.is_active(&bpf_compute_budget_balancing::id()) {
|
||||
|
Reference in New Issue
Block a user