diff --git a/Cargo.lock b/Cargo.lock index 0897a93..dfc431a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] @@ -131,7 +131,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] @@ -350,14 +350,14 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -411,7 +411,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] @@ -423,7 +423,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] @@ -620,9 +620,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.92" +version = "2.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" +checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" dependencies = [ "proc-macro2", "quote", @@ -646,7 +646,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn 2.0.95", ] [[package]] diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 87cce83..10a58b5 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -90,6 +90,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "blake2" version = "0.10.6" @@ -549,6 +555,9 @@ version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ + "base64 0.22.1", + "chrono", + "hex", "serde", "serde_derive", "serde_with_macros 3.12.0", @@ -618,6 +627,25 @@ dependencies = [ "starknet-types-core", ] +[[package]] +name = "starknet-core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538240cbe6663c673fe77465f294da707080f39678dd7066761554899e46100" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 3.9.0", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + [[package]] name = "starknet-crypto" version = "0.7.3" @@ -677,6 +705,7 @@ name = "swiftness" version = "0.1.3" dependencies = [ "clap", + "starknet-core 0.12.0", "swiftness_air", "swiftness_commitment", "swiftness_fri", @@ -710,7 +739,7 @@ dependencies = [ "serde", "serde_with 3.12.0", "sha3", - "starknet-core", + "starknet-core 0.11.1", "starknet-crypto", "starknet-types-core", "swiftness_transcript", @@ -726,7 +755,7 @@ dependencies = [ "serde", "serde_with 3.12.0", "sha3", - "starknet-core", + "starknet-core 0.11.1", "starknet-crypto", "swiftness_commitment", "swiftness_transcript", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 307771f..7e1bd6b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -9,6 +9,7 @@ version = "0.1.3" [dependencies] clap = { version = "4.4.4", features = ["derive"] } +starknet-core = "0.12.0" swiftness_air = { path = "../crates/air", default-features = false, features = [ "std", @@ -68,4 +69,4 @@ blake2s_160_lsb = [ blake2s_248_lsb = [ "swiftness_air/blake2s_248_lsb", "swiftness_stark/blake2s_248_lsb", -] \ No newline at end of file +] diff --git a/cli/src/main.rs b/cli/src/main.rs index 0b1e4c0..2d22694 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -27,13 +27,24 @@ struct CairoVMVerifier { /// Path to proof JSON file #[clap(short, long)] proof: PathBuf, + /// Whether to print the pedersen hash of the output instead of the full output. + #[clap(short = 'o', long, num_args=0..=1, default_missing_value = "true")] + print_output_hash: Option, } fn main() -> Result<(), Box> { let cli = CairoVMVerifier::parse(); let stark_proof = parse(std::fs::read_to_string(cli.proof)?)?.transform_to(); let security_bits = stark_proof.config.security_bits(); - let result = stark_proof.verify::(security_bits)?; - println!("{:?}", result); + let (program_hash, program_output) = stark_proof.verify::(security_bits)?; + + println!("program hash: {:#x}", program_hash); + if let Some(true) = cli.print_output_hash { + let hash = starknet_core::crypto::compute_hash_on_elements(&program_output); + println!("program output hash: {:#x}", hash); + } else { + println!("program output: {:x?}", program_output); + } + Ok(()) }