From 22d33f816f9059b0aa9ac0e07c820765dd2ae753 Mon Sep 17 00:00:00 2001 From: joii2020 <87224197+joii2020@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:29:38 +0800 Subject: [PATCH] Fix bug when contract not has features: native-simulatorg (#129) * Fix bug when contract not has features: native-simulatorg --- contracts/exec-callee/src/entry.rs | 1 + src/debug.rs | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/contracts/exec-callee/src/entry.rs b/contracts/exec-callee/src/entry.rs index 29e0137..c356c43 100644 --- a/contracts/exec-callee/src/entry.rs +++ b/contracts/exec-callee/src/entry.rs @@ -5,6 +5,7 @@ use core::result::Result; // https://nervosnetwork.github.io/ckb-std/riscv64imac-unknown-none-elf/doc/ckb_std/index.html use crate::error::Error; +extern crate alloc; pub fn main() -> Result<(), Error> { let argv = ckb_std::env::argv(); diff --git a/src/debug.rs b/src/debug.rs index c56d093..ee437df 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -32,15 +32,11 @@ #[macro_export] macro_rules! debug { ($fmt:literal) => { - #[cfg(all(debug_assertions, feature = "native-simulator"))] - $crate::syscalls::debug(format!($fmt)); - #[cfg(all(debug_assertions, not(feature = "native-simulator")))] + #[cfg(debug_assertions)] $crate::syscalls::debug(alloc::format!($fmt)); }; ($fmt:literal, $($args:expr),+) => { - #[cfg(all(debug_assertions, feature = "native-simulator"))] - $crate::syscalls::debug(format!($fmt, $($args), +)); - #[cfg(all(debug_assertions, not(feature = "native-simulator")))] + #[cfg(debug_assertions)] $crate::syscalls::debug(alloc::format!($fmt, $($args), +)); }; }