diff --git a/prover/src/rpc.rs b/prover/src/rpc.rs index 2c10b170..07d9d993 100644 --- a/prover/src/rpc.rs +++ b/prover/src/rpc.rs @@ -13,7 +13,6 @@ use lightclient_circuits::{ }; use preprocessor::{rotation_args_from_update, step_args_from_finality_update}; use snark_verifier_sdk::{evm::evm_verify, halo2::aggregation::AggregationCircuit, Snark}; -use std::io::Write; use std::path::{Path, PathBuf}; use std::sync::Arc; @@ -21,8 +20,7 @@ pub type JsonRpcServerState = Arc>; use crate::rpc_api::{ AggregatedEvmProofResult, EvmProofResult, GenProofRotationWithWitnessParams, - GenProofStepWithWitnessParams, EVM_PROOF_ROTATION_CIRCUIT_WITH_WITNESS, - EVM_PROOF_STEP_CIRCUIT_WITH_WITNESS, + GenProofStepWithWitnessParams, RPC_EVM_PROOF_ROTATION_CIRCUIT, RPC_EVM_PROOF_STEP_CIRCUIT, }; fn gen_committee_update_snark( @@ -61,11 +59,9 @@ fn gen_evm_proof( let (proof, instances) = C::gen_evm_proof_shplonk(¶ms, &pk, &config_path, None, &witness) .map_err(|e| eyre::eyre!("Failed to generate calldata: {}", e))?; - println!("Proof size: {}", proof.len()); if let Some(deployment_code_path) = yul_path_if_verify { let deployment_code = C::gen_evm_verifier_shplonk(¶ms, &pk, Some(deployment_code_path), &witness)?; - println!("Deployment code size: {}", deployment_code.len()); evm_verify(deployment_code, instances.clone(), proof.clone()); } Ok((proof, instances)) @@ -158,12 +154,6 @@ pub(crate) async fn gen_evm_proof_rotation_circuit_with_witness_handler( public_inputs, }; - // Write proof to file for debugging - std::fs::File::create("proof.json") - .unwrap() - .write_all(serde_json::to_string(&res).unwrap().as_bytes()) - .unwrap(); - Ok(res) } @@ -230,11 +220,11 @@ pub(crate) async fn gen_evm_proof_step_circuit_with_witness_handler( pub(crate) fn jsonrpc_server() -> JsonRpcServer { JsonRpcServer::new() .with_method( - EVM_PROOF_ROTATION_CIRCUIT_WITH_WITNESS, + RPC_EVM_PROOF_ROTATION_CIRCUIT, gen_evm_proof_rotation_circuit_with_witness_handler, ) .with_method( - EVM_PROOF_STEP_CIRCUIT_WITH_WITNESS, + RPC_EVM_PROOF_STEP_CIRCUIT, gen_evm_proof_step_circuit_with_witness_handler, ) .finish_unwrapped() diff --git a/prover/src/rpc_api.rs b/prover/src/rpc_api.rs index b3ff1d7d..3289a858 100644 --- a/prover/src/rpc_api.rs +++ b/prover/src/rpc_api.rs @@ -2,6 +2,9 @@ use crate::args; use primitive_types::U256; use serde::{Deserialize, Serialize}; +pub const RPC_EVM_PROOF_STEP_CIRCUIT: &str = "genEvmProof_SyncStep"; +pub const RPC_EVM_PROOF_ROTATION_CIRCUIT: &str = "genEvmProof_CommitteeUpdate"; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GenProofRotationParams { pub spec: args::Spec, @@ -64,14 +67,3 @@ pub struct SyncCommitteePoseidonResult { fn default_beacon_api() -> String { String::from("http://127.0.0.1:5052") } - -pub const EVM_PROOF_STEP_CIRCUIT: &str = "genEvmProofAndInstancesStepSyncCircuit"; -pub const EVM_PROOF_ROTATION_CIRCUIT: &str = "genEvmProofAndInstancesRotationCircuit"; - -pub const EVM_PROOF_STEP_CIRCUIT_WITH_WITNESS: &str = - "genEvmProofAndInstancesStepSyncCircuitWithWitness"; -pub const EVM_PROOF_ROTATION_CIRCUIT_WITH_WITNESS: &str = - "genEvmProofAndInstancesRotationCircuitWithWitness"; - -pub const SYNC_COMMITTEE_POSEIDON_COMPRESSED: &str = "syncCommitteePoseidonCompressed"; -pub const SYNC_COMMITTEE_POSEIDON_UNCOMPRESSED: &str = "syncCommitteePoseidonUncompressed"; diff --git a/prover/src/rpc_client.rs b/prover/src/rpc_client.rs index cbf94c95..c0422796 100644 --- a/prover/src/rpc_client.rs +++ b/prover/src/rpc_client.rs @@ -5,11 +5,8 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; use url::Url; use crate::rpc_api::{ - EvmProofResult, GenProofRotationParams, GenProofRotationWithWitnessParams, GenProofStepParams, - GenProofStepWithWitnessParams, SyncCommitteePoseidonParams, SyncCommitteePoseidonResult, - EVM_PROOF_ROTATION_CIRCUIT, EVM_PROOF_ROTATION_CIRCUIT_WITH_WITNESS, EVM_PROOF_STEP_CIRCUIT, - EVM_PROOF_STEP_CIRCUIT_WITH_WITNESS, SYNC_COMMITTEE_POSEIDON_COMPRESSED, - SYNC_COMMITTEE_POSEIDON_UNCOMPRESSED, + EvmProofResult, GenProofRotationParams, GenProofStepParams, RPC_EVM_PROOF_ROTATION_CIRCUIT, + RPC_EVM_PROOF_STEP_CIRCUIT, }; /// Error object in a response @@ -48,51 +45,19 @@ impl Client { } } /// Generates a proof along with instance values for committee Rotation circuit - pub async fn gen_evm_proof_rotation_circuit( + pub async fn gen_evm_proof_committee_update( &self, params: GenProofRotationParams, ) -> Result { - self.call(EVM_PROOF_ROTATION_CIRCUIT, params).await + self.call(RPC_EVM_PROOF_ROTATION_CIRCUIT, params).await } /// Generates a proof along with instance values for Step circuit - pub async fn gen_evm_proof_step_circuit( + pub async fn gen_evm_proof_step( &self, params: GenProofStepParams, ) -> Result { - self.call(EVM_PROOF_STEP_CIRCUIT, params).await - } - - /// Generates a proof along with instance values for committee Rotation circuit - pub async fn gen_evm_proof_rotation_circuit_with_witness( - &self, - params: GenProofRotationWithWitnessParams, - ) -> Result { - self.call(EVM_PROOF_ROTATION_CIRCUIT_WITH_WITNESS, params) - .await - } - - /// Generates a proof along with instance values for Step circuit - pub async fn gen_evm_proof_step_circuit_with_witness( - &self, - params: GenProofStepWithWitnessParams, - ) -> Result { - self.call(EVM_PROOF_STEP_CIRCUIT_WITH_WITNESS, params).await - } - - pub async fn sync_committee_poseidon_compressed( - &self, - params: SyncCommitteePoseidonParams, - ) -> Result { - self.call(SYNC_COMMITTEE_POSEIDON_COMPRESSED, params).await - } - - pub async fn sync_committee_poseidon_uncompressed( - &self, - params: SyncCommitteePoseidonParams, - ) -> Result { - self.call(SYNC_COMMITTEE_POSEIDON_UNCOMPRESSED, params) - .await + self.call(RPC_EVM_PROOF_STEP_CIRCUIT, params).await } /// Utility method for sending RPC requests over HTTP @@ -137,7 +102,7 @@ mod test { beacon_api: String::from("http://65.109.55.120:9596"), }; - let r = client.gen_evm_proof_step_circuit(p).await; + let r = client.gen_evm_proof_step(p).await; match r { Ok(r) => {