program log pubkey as base58 (#12901)

This commit is contained in:
Jack May
2020-10-15 09:11:54 -07:00
committed by GitHub
parent b1b2c6ee7b
commit 3f9e6a600b
10 changed files with 142 additions and 34 deletions

View File

@ -65,6 +65,10 @@ pub mod cumulative_rent_related_fixes {
solana_sdk::declare_id!("FtjnuAtJTWwX3Kx9m24LduNEhzaGuuPfDW6e14SX2Fy5");
}
pub mod pubkey_log_syscall_enabled {
solana_sdk::declare_id!("MoqiU1vryuCGQSxFKA1SZ316JdLEFFhoAu6cKUNk7dN");
}
lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@ -83,6 +87,7 @@ lazy_static! {
(max_program_call_depth_64::id(), "max program call depth 64"),
(timestamp_correction::id(), "correct bank timestamps"),
(cumulative_rent_related_fixes::id(), "rent fixes (#10206, #10468, #11342)"),
(pubkey_log_syscall_enabled::id(), "pubkey log syscall"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()

View File

@ -1,5 +1,6 @@
use crate::feature_set::{
compute_budget_balancing, max_invoke_depth_4, max_program_call_depth_64, FeatureSet,
compute_budget_balancing, max_invoke_depth_4, max_program_call_depth_64,
pubkey_log_syscall_enabled, FeatureSet,
};
use solana_sdk::{
account::{Account, KeyedAccount},
@ -85,19 +86,21 @@ pub struct ComputeBudget {
pub log_64_units: u64,
/// Number of compute units consumed by a create_program_address call
pub create_program_address_units: u64,
/// Number of compute units consumed by an invoke call (not including the cost incured by
/// Number of compute units consumed by an invoke call (not including the cost incurred by
/// the called program)
pub invoke_units: u64,
/// Maximum cross-program invocation depth allowed including the orignal caller
/// Maximum cross-program invocation depth allowed including the original caller
pub max_invoke_depth: usize,
/// Base number of compute units consumed to call sha256
/// Base number of compute units consumed to call SHA256
pub sha256_base_cost: u64,
/// Incremental number of units consumed by sha256 (based on bytes)
/// Incremental number of units consumed by SHA256 (based on bytes)
pub sha256_byte_cost: u64,
/// Maximum BPF to BPF call depth
pub max_call_depth: usize,
/// Size of a stack frame in bytes, must match the size specified in the LLVM BPF backend
pub stack_frame_size: usize,
/// Number of compute units consumed by logging a `Pubkey`
pub log_pubkey_units: u64,
}
impl Default for ComputeBudget {
fn default() -> Self {
@ -119,6 +122,7 @@ impl ComputeBudget {
sha256_byte_cost: 1,
max_call_depth: 20,
stack_frame_size: 4_096,
log_pubkey_units: 0,
};
if feature_set.is_active(&compute_budget_balancing::id()) {
@ -144,6 +148,12 @@ impl ComputeBudget {
..compute_budget
};
}
if feature_set.is_active(&pubkey_log_syscall_enabled::id()) {
compute_budget = ComputeBudget {
log_pubkey_units: 100,
..compute_budget
};
}
compute_budget
}
}