From 9d273c17904a9ef8d7fdf14d56470a19f0e155c1 Mon Sep 17 00:00:00 2001 From: jeanmon Date: Fri, 13 Sep 2024 15:12:04 +0000 Subject: [PATCH] 7791: review comments and fixing build --- .../crates/mock-public-kernel/src/main.nr | 7 ++++--- .../crates/types/src/constants.nr | 8 ++++++++ noir/noir-repo/noir_stdlib/src/lib.nr | 15 +-------------- yarn-project/ivc-integration/src/index.ts | 5 +++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/noir-projects/mock-protocol-circuits/crates/mock-public-kernel/src/main.nr b/noir-projects/mock-protocol-circuits/crates/mock-public-kernel/src/main.nr index 922ab112ee3c..b66b27da5672 100644 --- a/noir-projects/mock-protocol-circuits/crates/mock-public-kernel/src/main.nr +++ b/noir-projects/mock-protocol-circuits/crates/mock-public-kernel/src/main.nr @@ -1,8 +1,9 @@ -use dep::types::constants::{AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS, AVM_PROOF_LENGTH_IN_FIELDS}; +use dep::types::constants::{AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS, AVM_PROOF_LENGTH_IN_FIELDS, PROOF_TYPE_AVM}; fn main( verification_key: [Field; AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS], proof: [Field; AVM_PROOF_LENGTH_IN_FIELDS] -) { - std::verify_proof_with_type(verification_key, proof, [], 0, std::PROOF_TYPE_AVM); +) -> pub u8 { + std::verify_proof_with_type(verification_key, proof, [], 0, PROOF_TYPE_AVM); + 1 // Dummy value to return for the mock kernel as void function creates some pain. } diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 5b04dc8cea94..dc33af1d58e0 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -529,3 +529,11 @@ global AVM_PEDERSENCOMMITMENT_DYN_L2_GAS: u16 = 0; global AVM_TORADIXLE_DYN_L2_GAS: u16 = 200; global AVM_SHA256COMPRESSION_DYN_L2_GAS: u16 = 0; global AVM_KECCAKF1600_DYN_L2_GAS: u16 = 0; + +// Constants related to proof type of a recursive proof verification. +// Keep following constants in sync with the enum acir_format::PROOF_TYPE in recursion_constraint.hpp +global PROOF_TYPE_PLONK : u32 = 0; +global PROOF_TYPE_HONK : u32 = 1; +global PROOF_TYPE_OINK : u32 = 2; +global PROOF_TYPE_PG : u32 = 3; +global PROOF_TYPE_AVM : u32 = 4; diff --git a/noir/noir-repo/noir_stdlib/src/lib.nr b/noir/noir-repo/noir_stdlib/src/lib.nr index 4e5c7176d9c8..714079d306a1 100644 --- a/noir/noir-repo/noir_stdlib/src/lib.nr +++ b/noir/noir-repo/noir_stdlib/src/lib.nr @@ -30,13 +30,6 @@ mod append; mod mem; mod panic; -// Keep following constants in sync with the enum acir_format::PROOF_TYPE in recursion_constraint.hpp -global PROOF_TYPE_PLONK : u32 = 0; -global PROOF_TYPE_HONK : u32 = 1; -global PROOF_TYPE_OINK : u32 = 2; -global PROOF_TYPE_PG : u32 = 3; -global PROOF_TYPE_AVM : u32 = 4; - // Oracle calls are required to be wrapped in an unconstrained function // Thus, the only argument to the `println` oracle is expected to always be an ident #[oracle(print)] @@ -64,13 +57,7 @@ pub fn verify_proof( public_inputs: [Field; K], key_hash: Field ) { - verify_proof_internal( - verification_key, - proof, - public_inputs, - key_hash, - PROOF_TYPE_PLONK - ); + verify_proof_internal(verification_key, proof, public_inputs, key_hash, 0); } pub fn verify_proof_with_type( diff --git a/yarn-project/ivc-integration/src/index.ts b/yarn-project/ivc-integration/src/index.ts index f85a6d5ca141..dac0fd16ea82 100644 --- a/yarn-project/ivc-integration/src/index.ts +++ b/yarn-project/ivc-integration/src/index.ts @@ -18,6 +18,7 @@ import type { MockPrivateKernelTailInputType, MockPublicKernelInputType, PrivateKernelPublicInputs, + u8, } from './types/index.js'; // Re export the circuit jsons @@ -110,11 +111,11 @@ export async function witnessGenMockPrivateKernelTailCircuit( export async function witnessGenMockPublicKernelCircuit( args: MockPublicKernelInputType, -): Promise> { +): Promise> { const program = new Noir(MockPublicKernelCircuit); const { witness, returnValue } = await program.execute(args, foreignCallHandler); return { witness, - publicInputs: returnValue as null, + publicInputs: returnValue as u8, }; }