diff --git a/backend/README.md b/backend/README.md index 2e38bad8..18a755d3 100644 --- a/backend/README.md +++ b/backend/README.md @@ -104,7 +104,7 @@ Note that the `verifier_params.json` file can be used in any other round unless This is the final step in the Summa process and the only part that occurs on the user side. -Users receive the proof and commitment for a specific round along with the verifier parameters. Unlike the commitment and proof, the verifier parameters are independent of the round. +Users receive the proof and commitment for a specific round along with the verifier parameters. Unlike the commitment and proof, the verifier parameters are independent of the round. Moreover, users have the option to generate the verifier parameters themselves, instead of fetching them from the CEX. In this step, the user has to: diff --git a/backend/examples/summa_solvency_flow.rs b/backend/examples/summa_solvency_flow.rs index 80814110..44a59a7d 100644 --- a/backend/examples/summa_solvency_flow.rs +++ b/backend/examples/summa_solvency_flow.rs @@ -45,14 +45,14 @@ fn main() { let circuit = SummaHyperplonk::::init(entries.to_vec()); let num_vars = K; - let circuit_fn = |num_vars| { + let circuit_fn = |num_vars, initialized_circuit| { let circuit = Halo2Circuit::>::new::< ProvingBackend, - >(num_vars, circuit.clone()); + >(num_vars, initialized_circuit); (circuit.circuit_info().unwrap(), circuit) }; - let (circuit_info, circuit) = circuit_fn(num_vars as usize); + let (circuit_info, circuit) = circuit_fn(num_vars as usize, circuit); let instances = circuit.instances(); let param = ProvingBackend::setup_custom("../backend/ptau/hyperplonk-srs-17").unwrap(); @@ -117,11 +117,20 @@ fn main() { // 3. Verify Inclusion Proof // - // Load the commitment and verifier parameters from the files - let commitment: KZGProof = load_from_file(commitment_proof_filename).unwrap(); - let verifier_params: HyperPlonkVerifierParam> = + // Users can generate verifier parameters using only the configurations for "N_CURRENCIES" and "N_USERS", along with the SRS. + let dummy_circuit = SummaHyperplonk::::init_empty(); + + let (circuit_info, _) = circuit_fn(num_vars as usize, dummy_circuit); + + let param = ProvingBackend::setup_custom("../backend/ptau/hyperplonk-srs-17").unwrap(); + let (_, verifier_params) = ProvingBackend::preprocess(¶m, &circuit_info).unwrap(); + + let loaded_verifier_params: HyperPlonkVerifierParam> = load_from_file(vp_filename).unwrap(); + // Load the commitment from the files + let commitment: KZGProof = load_from_file(commitment_proof_filename).unwrap(); + // When verifying the inclusion proof from the user's perspective, the user have to fetch `proof`. // Assume that the `proof` file has been downloaded from the CEX along with commitment and verifier parameters. let proof: KZGProof = load_from_file(format!("user_{}_proof.json", USER_INDEX))