diff --git a/Makefile b/Makefile index 70c09ac7ce..ab09dbaf9b 100644 --- a/Makefile +++ b/Makefile @@ -175,6 +175,30 @@ start_proof_aggregator: is_aggregator_set ## Starts proof aggregator with provin start_proof_aggregator_gpu: is_aggregator_set ## Starts proof aggregator with proving + GPU acceleration (CUDA) AGGREGATOR=$(AGGREGATOR) SP1_PROVER=cuda cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove,gpu -- config-files/config-proof-aggregator.yaml +verify_aggregated_proof_sp1_holesky_stage: + @echo "Verifying SP1 in aggregated proofs on holesky..." + @cd batcher/aligned/ && \ + cargo run verify-agg-proof \ + --network holesky-stage \ + --from-block $(FROM_BLOCK) \ + --proving_system SP1 \ + --public_input ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.pub \ + --program-id-file ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.vk \ + --beacon_url $(BEACON_URL) \ + --rpc_url https://ethereum-holesky-rpc.publicnode.com + +verify_aggregated_proof_risc0_holesky_stage: + @echo "Verifying RISC0 in aggregated proofs on holesky..." + @cd batcher/aligned/ && \ + cargo run verify-agg-proof \ + --network holesky-stage \ + --from-block $(FROM_BLOCK) \ + --proving_system Risc0 \ + --program-id-file ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id_2_0.bin \ + --public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_2_0.pub \ + --beacon_url $(BEACON_URL) \ + --rpc_url https://ethereum-holesky-rpc.publicnode.com + install_aggregation_mode: ## Install the aggregation mode with proving enabled cargo install --path aggregation_mode --features prove diff --git a/batcher/aligned-sdk/src/sdk/aggregation.rs b/batcher/aligned-sdk/src/sdk/aggregation.rs index 673fccde40..552611d532 100644 --- a/batcher/aligned-sdk/src/sdk/aggregation.rs +++ b/batcher/aligned-sdk/src/sdk/aggregation.rs @@ -18,6 +18,10 @@ pub enum AggregationModeVerificationData { vk: [u8; 32], public_inputs: Vec, }, + Risc0 { + image_id: [u8; 32], + public_inputs: Vec, + }, } impl AggregationModeVerificationData { @@ -29,6 +33,15 @@ impl AggregationModeVerificationData { hasher.update(public_inputs); hasher.finalize().into() } + AggregationModeVerificationData::Risc0 { + image_id, + public_inputs, + } => { + let mut hasher = Keccak256::new(); + hasher.update(image_id); + hasher.update(public_inputs); + hasher.finalize().into() + } } } } diff --git a/batcher/aligned/src/main.rs b/batcher/aligned/src/main.rs index e97006142f..136977be95 100644 --- a/batcher/aligned/src/main.rs +++ b/batcher/aligned/src/main.rs @@ -325,8 +325,12 @@ pub struct VerifyProofInAggModeArgs { proving_system: ProvingSystemArg, #[arg(name = "Public input file name", long = "public_input")] pub_input_file_name: Option, - #[arg(name = "Verification key hash", long = "vk", required = true)] - verification_key_hash: PathBuf, + #[arg( + name = "Verification key hash", + long = "program-id-file", + required = true + )] + program_id_file: PathBuf, } #[derive(Args, Debug)] @@ -790,20 +794,25 @@ async fn main() -> Result<(), AlignedError> { return Ok(()); } AlignedCommands::VerifyProofInAggMode(args) => { - let proof_data = match args.proving_system { - ProvingSystemArg::SP1 => { - let vk = read_file(args.verification_key_hash)? - .try_into() - .expect("Invalid hexadecimal encoded vk hash"); + let program_id_key = read_file(args.program_id_file)? + .try_into() + .expect("Invalid hexadecimal encoded vk hash"); - let Some(pub_inputs_file_name) = args.pub_input_file_name else { - error!("Public input file not provided"); - return Ok(()); - }; - let public_inputs = read_file(pub_inputs_file_name)?; + let Some(pub_inputs_file_name) = args.pub_input_file_name else { + error!("Public input file not provided"); + return Ok(()); + }; + let public_inputs = read_file(pub_inputs_file_name)?; - AggregationModeVerificationData::SP1 { vk, public_inputs } - } + let proof_data = match args.proving_system { + ProvingSystemArg::SP1 => AggregationModeVerificationData::SP1 { + vk: program_id_key, + public_inputs, + }, + ProvingSystemArg::Risc0 => AggregationModeVerificationData::Risc0 { + image_id: program_id_key, + public_inputs, + }, _ => { error!("Proving system not supported in aggregation mode"); return Ok(());