Add msg! macro for program logging, deprecate info! macro

This commit is contained in:
Michael Vines
2020-11-30 13:28:58 -08:00
parent 254790f8c8
commit 6705b5a98c
22 changed files with 162 additions and 141 deletions

View File

@ -1,6 +1,6 @@
//! @brief Example Rust-based BPF program that tests call depth and stack usage
use solana_program::{entrypoint::SUCCESS, info};
use solana_program::{entrypoint::SUCCESS, msg};
#[inline(never)]
pub fn recurse(data: &mut [u8]) {
@ -8,16 +8,16 @@ pub fn recurse(data: &mut [u8]) {
return;
}
recurse(&mut data[1..]);
info!(line!(), 0, 0, 0, data[0]);
msg!(line!(), 0, 0, 0, data[0]);
}
/// # Safety
#[inline(never)]
#[no_mangle]
pub unsafe extern "C" fn entrypoint(input: *mut u8) -> u64 {
info!("Call depth");
msg!("Call depth");
let depth = *(input.add(16) as *mut u8);
info!(line!(), 0, 0, 0, depth);
msg!(line!(), 0, 0, 0, depth);
let mut data = Vec::with_capacity(depth as usize);
for i in 0_u8..depth {
data.push(i);