From 490ee45c6fb0c69f600d71cbe1f3889952c620c1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 18 Feb 2025 15:33:50 +0200 Subject: [PATCH 1/3] fix: switch program template to i32 --- account/template/src/lib.rs | 1 + program/template/src/lib.rs | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/account/template/src/lib.rs b/account/template/src/lib.rs index de7d43c..5d32677 100644 --- a/account/template/src/lib.rs +++ b/account/template/src/lib.rs @@ -12,6 +12,7 @@ static ALLOC: BumpAlloc = miden::BumpAlloc::new(); // Required for no-std crates +#[cfg(not(test))] #[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} diff --git a/program/template/src/lib.rs b/program/template/src/lib.rs index 0937e45..2010e5e 100644 --- a/program/template/src/lib.rs +++ b/program/template/src/lib.rs @@ -12,21 +12,20 @@ static ALLOC: BumpAlloc = miden::BumpAlloc::new(); // Required for no-std crates +#[cfg(not(test))] #[panic_handler] fn my_panic(_info: &core::panic::PanicInfo) -> ! { loop {} } -use miden::*; - -// Pass up to 16 Felt inputs as entrypoint function parameters. -// The output is temporarely limited to 1 Felt value +// Pass up to 16 i32 inputs as entrypoint function parameters. +// The output is temporarely limited to 1 i32 value // // NOTE: // The name of the entrypoint function is expected to be `entrypoint`. Do not remove the // `#[no_mangle]` attribute, otherwise, the rustc will mangle the name and it'll not be recognized // by the Miden compiler. #[no_mangle] -pub fn entrypoint(a: Felt, b: Felt) -> Felt { +pub fn entrypoint(a: i32, b: i32) -> i32 { a + b } From 9c4eb0450816de0729cab9119b3e379716ec0983 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 18 Feb 2025 15:50:55 +0200 Subject: [PATCH 2/3] chore: comment out global_allocator (needed only when using `miden` crate) --- program/template/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/program/template/src/lib.rs b/program/template/src/lib.rs index 2010e5e..65102be 100644 --- a/program/template/src/lib.rs +++ b/program/template/src/lib.rs @@ -8,8 +8,8 @@ // use alloc::vec::Vec; // // Global allocator to use heap memory in no-std environment -#[global_allocator] -static ALLOC: BumpAlloc = miden::BumpAlloc::new(); +// #[global_allocator] +// static ALLOC: miden::BumpAlloc = miden::BumpAlloc::new(); // Required for no-std crates #[cfg(not(test))] From 0f492205ef634449b55a653d4c0762bfb493845a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 18 Feb 2025 16:24:48 +0200 Subject: [PATCH 3/3] chore: add inputs.toml --- program/inputs.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 program/inputs.toml diff --git a/program/inputs.toml b/program/inputs.toml new file mode 100644 index 0000000..0570ba2 --- /dev/null +++ b/program/inputs.toml @@ -0,0 +1,2 @@ +[inputs] +stack = [2, 3]