mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
ere-risc0: allocator alignments test (#120)
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
13
tests/risc0/allocs_alignment/Cargo.toml
Normal file
13
tests/risc0/allocs_alignment/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "ere-test-risc0-allocs-alignment"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
risc0-zkvm = { version = "3.0.1", default-features = false, features = [
|
||||
"std",
|
||||
"unstable",
|
||||
] }
|
||||
risc0-zkvm-platform = { version = "=2.0.4" }
|
||||
11
tests/risc0/allocs_alignment/src/main.rs
Normal file
11
tests/risc0/allocs_alignment/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use risc0_zkvm::guest::env;
|
||||
|
||||
fn main() {
|
||||
let alignment = env::read::<usize>();
|
||||
|
||||
let layout = std::alloc::Layout::from_size_align(1, alignment).unwrap();
|
||||
let ptr = unsafe { std::alloc::alloc(layout) };
|
||||
if ptr.is_null() {
|
||||
panic!("allocation failed");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user