Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add crate sdk-prover, and add functionality to get self_prog_id within #1701

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"examples-builder",
"expr",
"node",
"prover-sdk",
"recproofs",
"runner",
"signatures",
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ clap = { version = "4.5", features = [
] }
mozak-circuits = { path = "../circuits", features = ["test"] }
mozak-node = { path = "../node", features = ["std"] }
mozak-prover-sdk = { path = "../prover-sdk" }
mozak-runner = { path = "../runner", features = ["test"] }
mozak-sdk = { path = "../sdk", features = ["std"] }
# TODO(Matthias): implement shell completion for CLI via clap_complete
Expand Down
30 changes: 25 additions & 5 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use mozak_circuits::test_utils::{prove_and_verify_mozak_stark, C, D, F, S};
use mozak_cli::cli_benches::benches::BenchArgs;
use mozak_cli::runner::{deserialize_system_tape, load_program, raw_tapes_from_system_tape};
use mozak_node::types::{Attestation, Transaction};
use mozak_prover_sdk::prog_id::ProgId;
use mozak_runner::state::{RawTapes, State};
use mozak_runner::vm::step;
use mozak_sdk::common::types::{CrossProgramCall, ProgramIdentifier, SystemTape};
Expand Down Expand Up @@ -78,7 +79,9 @@ pub struct ProveArgs {
#[derive(Clone, Debug, Subcommand)]
enum Command {
/// Decode a given ELF and prints the program
Decode { elf: Input },
Decode {
elf: Input,
},
/// Decode and execute a given ELF. Prints the final state of
/// the registers
Run(RunArgs),
Expand All @@ -87,9 +90,14 @@ enum Command {
/// Prove the execution of given ELF and write proof to file.
Prove(ProveArgs),
/// Verify the given proof from file.
Verify { proof: Input },
Verify {
proof: Input,
},
/// Verify the given recursive proof from file.
VerifyRecursiveProof { proof: Input, verifier_key: Input },
VerifyRecursiveProof {
proof: Input,
verifier_key: Input,
},
/// Builds a transaction bundle.
BundleTransaction {
/// System tape generated from native execution.
Expand All @@ -100,11 +108,18 @@ enum Command {
bundle: Output,
},
/// Compute the Program Rom Hash of the given ELF.
ProgramRomHash { elf: Input },
ProgramRomHash {
elf: Input,
},
/// Compute the Memory Init Hash of the given ELF.
MemoryInitHash { elf: Input },
MemoryInitHash {
elf: Input,
},
/// Bench the function with given parameters
Bench(BenchArgs),
SelfProgId {
elf: Input,
},
}

/// Run me eg like `cargo run -- -vvv run vm/tests/testdata/rv32ui-p-addi
Expand Down Expand Up @@ -435,6 +450,11 @@ fn main() -> Result<()> {
let time_taken = bench.bench()?.as_secs_f64();
println!("{time_taken}");
}
Command::SelfProgId { elf } => {
let elf_path = elf.path().to_str().unwrap();
let prog_id: ProgramIdentifier = ProgId::from_elf(elf_path)?.into();
println!("{prog_id:?}");
}
}
Ok(())
}
Loading
Loading