mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
feat: Add ere-zisk with only compile and execute utility. (#27)
* feat: add `ere-zisk` and `compile` functionality * fix: use `FixintEncoding` for `Input::as_bytes` to make it deterministic * feat: implement `zkVM::execute` * fix: make `install_zisk_sdk.sh` work with docker * chore: add comment why use `#[should_panic]` * feat: use command `cargo-zisk ...` for `compile`, `execute`, `prove` and `verify` * ci * fix: invalid proof
This commit is contained in:
9
tests/zisk/compile/basic/Cargo.toml
Normal file
9
tests/zisk/compile/basic/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "ere-test-zisk-guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
ziskos = { git = "https://github.com/0xPolygonHermez/zisk.git", rev = "f9a3655" }
|
||||
14
tests/zisk/compile/basic/src/main.rs
Normal file
14
tests/zisk/compile/basic/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
#![no_main]
|
||||
|
||||
ziskos::entrypoint!(main);
|
||||
|
||||
fn main() {
|
||||
// Read an input
|
||||
let n = u32::from_le_bytes(
|
||||
ziskos::read_input()
|
||||
.try_into()
|
||||
.expect("input to be 4 bytes"),
|
||||
);
|
||||
// Write n*2 to output
|
||||
ziskos::set_output(0, n * 2);
|
||||
}
|
||||
9
tests/zisk/execute/basic/Cargo.toml
Normal file
9
tests/zisk/execute/basic/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "ere-test-zisk-guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
ziskos = { git = "https://github.com/0xPolygonHermez/zisk.git", rev = "f9a3655" }
|
||||
16
tests/zisk/execute/basic/src/main.rs
Normal file
16
tests/zisk/execute/basic/src/main.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
#![no_main]
|
||||
|
||||
ziskos::entrypoint!(main);
|
||||
|
||||
fn main() {
|
||||
let input = ziskos::read_input();
|
||||
if input.len() != 6 {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
// Read an input
|
||||
let n = u32::from_le_bytes(input[..4].try_into().unwrap());
|
||||
let a = u16::from_le_bytes(input[4..6].try_into().unwrap()) as u32;
|
||||
|
||||
ziskos::set_output(0, (n + a) * 2);
|
||||
}
|
||||
9
tests/zisk/prove/basic/Cargo.toml
Normal file
9
tests/zisk/prove/basic/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "ere-test-zisk-guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
ziskos = { git = "https://github.com/0xPolygonHermez/zisk.git", rev = "f9a3655" }
|
||||
16
tests/zisk/prove/basic/src/main.rs
Normal file
16
tests/zisk/prove/basic/src/main.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
#![no_main]
|
||||
|
||||
ziskos::entrypoint!(main);
|
||||
|
||||
fn main() {
|
||||
let input = ziskos::read_input();
|
||||
if input.len() != 6 {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
// Read an input
|
||||
let n = u32::from_le_bytes(input[..4].try_into().unwrap());
|
||||
let a = u16::from_le_bytes(input[4..6].try_into().unwrap()) as u32;
|
||||
|
||||
ziskos::set_output(0, (n + a) * 2);
|
||||
}
|
||||
Reference in New Issue
Block a user