feat: upgrade ziren & pico & miden (#247)

Co-authored-by: Han <tinghan0110@gmail.com>
This commit is contained in:
Paul
2025-12-15 12:13:49 +08:00
committed by GitHub
parent 19d90f8276
commit d15d36aa0a
16 changed files with 460 additions and 451 deletions

842
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -93,12 +93,12 @@ jolt-core = { git = "https://github.com/a16z/jolt.git", tag = "v0.3.0-alpha" }
jolt-sdk = { git = "https://github.com/a16z/jolt.git", tag = "v0.3.0-alpha", default-features = false }
# Miden dependencies
miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-core = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-processor = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-prover = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-stdlib = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-verifier = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.19.1" }
miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
miden-core = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
miden-processor = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
miden-prover = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
miden-core-lib = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
miden-verifier = { git = "https://github.com/0xPolygonMiden/miden-vm.git", tag = "v0.20.0" }
# Nexus dependencies
nexus-core = { git = "https://github.com/nexus-xyz/nexus-zkvm.git", tag = "v0.3.5" }
@@ -116,9 +116,9 @@ openvm-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.2", default-features = false }
# Pico dependencies
pico-p3-field = { git = "https://github.com/brevis-network/Plonky3.git", package = "p3-field", rev = "a4d376b" }
pico-vm = { git = "https://github.com/brevis-network/pico.git", tag = "v1.1.10" }
pico-sdk = { git = "https://github.com/brevis-network/pico", tag = "v1.1.10" }
pico-p3-field = { git = "https://github.com/brevis-network/Plonky3.git", package = "p3-field", rev = "411a80d" }
pico-vm = { git = "https://github.com/brevis-network/pico.git", tag = "v1.2.0" }
pico-sdk = { git = "https://github.com/brevis-network/pico", tag = "v1.2.0" }
# Risc0 dependencies
risc0-binfmt = { version = "3.0.3", default-features = false }
@@ -132,8 +132,8 @@ sp1-sdk = "5.2.3"
sp1-zkvm = "5.2.3"
# Ziren dependencies
zkm-sdk = { git = "https://github.com/ProjectZKM/Ziren.git", tag = "v1.2.2" }
zkm-zkvm = { git = "https://github.com/ProjectZKM/Ziren.git", tag = "v1.2.2" }
zkm-sdk = { git = "https://github.com/ProjectZKM/Ziren.git", tag = "v1.2.3" }
zkm-zkvm = { git = "https://github.com/ProjectZKM/Ziren.git", tag = "v1.2.3" }
# ZisK dependencies
ziskos = { git = "https://github.com/0xPolygonHermez/zisk.git", tag = "v0.14.0" }

View File

@@ -176,13 +176,13 @@ OutputHashedPlatform::<OpenVMPlatform, Sha256>::write_whole_output(&large_output
| --------- | ---------------------------------------------------------------------- | --- |
| Airbender | [`0.5.1`](https://github.com/matter-labs/zksync-airbender/tree/v0.5.1) | Yes |
| Jolt | [`0.3.0-alpha`](https://github.com/a16z/jolt/tree/v0.3.0-alpha) | No |
| Miden | [`0.19.1`](https://github.com/0xMiden/miden-vm/tree/v0.19.1) | No |
| Miden | [`0.20.0`](https://github.com/0xMiden/miden-vm/tree/v0.20.0) | No |
| Nexus | [`0.3.5`](https://github.com/nexus-xyz/nexus-zkvm/tree/v0.3.5) | No |
| OpenVM | [`1.4.2`](https://github.com/openvm-org/openvm/tree/v1.4.2) | Yes |
| Pico | [`1.1.10`](https://github.com/brevis-network/pico/tree/v1.1.10) | No |
| Pico | [`1.2.0`](https://github.com/brevis-network/pico/tree/v1.2.0) | No |
| Risc0 | [`3.0.4`](https://github.com/risc0/risc0/tree/v3.0.4) | Yes |
| SP1 | [`5.2.3`](https://github.com/succinctlabs/sp1/tree/v5.2.3) | Yes |
| Ziren | [`1.2.2`](https://github.com/ProjectZKM/Ziren/tree/v1.2.2) | No |
| Ziren | [`1.2.3`](https://github.com/ProjectZKM/Ziren/tree/v1.2.3) | No |
| Zisk | [`0.13.0`](https://github.com/0xPolygonHermez/zisk/tree/v0.13.0) | Yes |
## Examples

View File

@@ -15,7 +15,7 @@ miden-assembly = { workspace = true, features = ["std"] }
miden-core = { workspace = true, features = ["std"] }
miden-processor = { workspace = true, features = ["std"], optional = true }
miden-prover = { workspace = true, features = ["std"], optional = true }
miden-stdlib = { workspace = true, features = ["std"] }
miden-core-lib = { workspace = true, features = ["std"] }
miden-verifier = { workspace = true, optional = true }
# Local dependencies

View File

@@ -20,8 +20,8 @@ pub enum Error {
err: std::io::Error,
},
#[error("Failed to load Miden standard library: {0}")]
LoadStdLibrary(Report),
#[error("Failed to load Miden core library: {0}")]
LoadCoreLibrary(Report),
#[error("Miden assembly compilation failed: {0}")]
AssemblyCompilation(Report),

View File

@@ -4,8 +4,8 @@ use crate::{
};
use ere_zkvm_interface::compiler::Compiler;
use miden_assembly::Assembler;
use miden_stdlib::StdLibrary;
use std::{env, fs, path::Path};
use miden_core_lib::CoreLibrary;
use std::{fs, path::Path};
/// Compiler for Miden assembly guest program.
pub struct MidenAsm;
@@ -34,11 +34,10 @@ impl Compiler for MidenAsm {
})?;
// Compile using Miden assembler
let mut assembler =
Assembler::default().with_debug_mode(env::var_os("MIDEN_DEBUG").is_some());
let mut assembler = Assembler::default();
assembler
.link_dynamic_library(StdLibrary::default())
.map_err(Error::LoadStdLibrary)?;
.link_dynamic_library(CoreLibrary::default())
.map_err(Error::LoadCoreLibrary)?;
let program = assembler
.assemble_program(&source)

View File

@@ -8,13 +8,13 @@ use miden_core::{
Program,
utils::{Deserializable, Serializable},
};
use miden_core_lib::CoreLibrary;
use miden_processor::{
DefaultHost, ExecutionOptions, ProgramInfo, StackInputs, StackOutputs, execute as miden_execute,
};
use miden_prover::{
AdviceInputs, ExecutionProof, HashFunction, ProvingOptions, prove as miden_prove,
};
use miden_stdlib::StdLibrary;
use miden_verifier::verify as miden_verify;
use std::{env, time::Instant};
@@ -48,7 +48,7 @@ impl EreMiden {
fn setup_host() -> Result<DefaultHost, Error> {
let mut host = DefaultHost::default();
host.load_library(&StdLibrary::default())
host.load_library(&CoreLibrary::default())
.map_err(Error::Execute)?;
Ok(host)

View File

@@ -4,7 +4,7 @@ use ere_zkvm_interface::compiler::Compiler;
use std::{env, path::Path};
const TARGET_TRIPLE: &str = "riscv32ima-unknown-none-elf";
// According to https://github.com/brevis-network/pico/blob/v1.1.10/sdk/cli/src/build/build.rs#L104
// According to https://github.com/brevis-network/pico/blob/v1.2.0/sdk/cli/src/build/build.rs#L104
const RUSTFLAGS: &[&str] = &[
// Replace atomic ops with nonatomic versions since the guest is single threaded.
"-C",

View File

@@ -1,4 +1,4 @@
// Copied and modified from https://github.com/brevis-network/pico/blob/v1.1.10/sdk/sdk/src/client.rs.
// Copied and modified from https://github.com/brevis-network/pico/blob/v1.2.0/sdk/sdk/src/client.rs.
// The `EmbedProver` is removed because we don't need the proof to be verified
// on chain. Issue for tracking: https://github.com/eth-act/ere/issues/140.

View File

@@ -5,6 +5,6 @@ FROM $BASE_IMAGE
RUN rustup default 1.90.0
# Miden Configuration
ENV MIDEN_VERSION="v0.19.1"
ENV MIDEN_VERSION="v0.20.0"
CMD ["/bin/bash"]

View File

@@ -14,7 +14,7 @@ RUN rustup default nightly
COPY --chmod=755 scripts/sdk_installers/install_ziren_sdk.sh /tmp/install_ziren_sdk.sh
# The install_ziren_sdk.sh script will respect these ENV variables.
ENV ZIREM_VERSION="1.2.2"
ENV ZIREM_VERSION="1.2.3"
# Run the Ziren SDK installation script
RUN /tmp/install_ziren_sdk.sh && rm /tmp/install_ziren_sdk.sh

View File

@@ -29,7 +29,7 @@ ensure_tool_installed "git" "to install pico-cli from a git repository"
ensure_tool_installed "cargo" "to build and install Rust packages"
PICO_TOOLCHAIN_VERSION="nightly-2025-08-04"
PICO_CLI_VERSION_TAG="v1.1.10"
PICO_CLI_VERSION_TAG="v1.2.0"
# Install the specific nightly toolchain for Pico
echo "Installing Pico-specific Rust toolchain: ${PICO_TOOLCHAIN_VERSION}..."

View File

@@ -28,7 +28,7 @@ echo "Installing ZKM Toolchain using zkmup (latest release versions)..."
ensure_tool_installed "curl" "to download the zkmup installer"
ensure_tool_installed "sh" "as the zkmup installer script uses sh"
ZIREM_VERSION="1.2.2"
ZIREM_VERSION="1.2.3"
# Step 1: Download and run the script that installs the zkmup binary itself.
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ProjectZKM/toolchain/refs/heads/main/setup.sh | sh

View File

@@ -1,6 +1,6 @@
# Adds two numbers from advice stack
# Input: advice_stack contains second_number, first_number
use.std::sys
use miden::core::sys
begin
adv_push.1

View File

@@ -1,7 +1,7 @@
# Fibonacci
# Reads three u64 values from advice stack: fib_a, fib_b, n
# Returns nth fibonacci number
use.std::sys
use miden::core::sys
begin
# Read inputs from advice stack

View File

@@ -34,9 +34,9 @@ fn __start(_argc: isize, _argv: *const *const u8) -> isize {
}
/// Halts the program with the given exit code.
/// According to https://github.com/brevis-network/pico/blob/v1.1.10/sdk/sdk/src/riscv_ecalls/halt.rs#L15
/// According to https://github.com/brevis-network/pico/blob/v1.2.0/sdk/sdk/src/riscv_ecalls/halt.rs#L15
/// TODO: Check what `coprocessor` feature does and integrate here.
/// Contex https://github.com/brevis-network/pico/blob/v1.1.10/sdk/sdk/src/riscv_ecalls/halt.rs#L18
/// Contex https://github.com/brevis-network/pico/blob/v1.2.0/sdk/sdk/src/riscv_ecalls/halt.rs#L18
#[allow(unused_variables)]
pub extern "C" fn syscall_halt(exit_code: u8) -> ! {
unsafe {