* Native/builtin programs now receive an InvokeContext (cherry picked from commitdf8dab9d2b
) * Remove MessageProcessor::loaders (cherry picked from commit2664a1f7ef
) * Remove Entrypoint type (cherry picked from commit225bed11c7
) * Remove programs clone() (cherry picked from commit33884d847a
) * Add sol_log_compute_units syscall (cherry picked from commit66e51a7363
) * Add Bank::set_bpf_compute_budget() (cherry picked from commit7d686b72a0
) * Rebase Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@@ -96,3 +96,19 @@ pub fn sol_log_params(accounts: &[AccountInfo], data: &[u8]) {
|
||||
info!("Instruction data");
|
||||
sol_log_slice(data);
|
||||
}
|
||||
|
||||
/// Logs the current compute unit consumption
|
||||
#[inline]
|
||||
pub fn sol_log_compute_units() {
|
||||
#[cfg(target_arch = "bpf")]
|
||||
unsafe {
|
||||
sol_log_compute_units_();
|
||||
}
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
crate::program_stubs::sol_log_compute_units();
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "bpf")]
|
||||
extern "C" {
|
||||
fn sol_log_compute_units_();
|
||||
}
|
||||
|
@@ -19,6 +19,9 @@ pub trait SyscallStubs: Sync + Send {
|
||||
fn sol_log(&self, message: &str) {
|
||||
println!("{}", message);
|
||||
}
|
||||
fn sol_log_compute_units(&self) {
|
||||
sol_log("SyscallStubs: sol_log_compute_units() not available");
|
||||
}
|
||||
fn sol_invoke_signed(
|
||||
&self,
|
||||
_instruction: &Instruction,
|
||||
@@ -41,6 +44,10 @@ pub(crate) fn sol_log_64(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64)
|
||||
sol_log(&format!("{} {} {} {} {}", arg1, arg2, arg3, arg4, arg5));
|
||||
}
|
||||
|
||||
pub(crate) fn sol_log_compute_units() {
|
||||
SYSCALL_STUBS.read().unwrap().sol_log_compute_units();
|
||||
}
|
||||
|
||||
pub(crate) fn sol_invoke_signed(
|
||||
instruction: &Instruction,
|
||||
account_infos: &[AccountInfo],
|
||||
|
Reference in New Issue
Block a user