Skip to content

Commit

Permalink
7791: review comments and fixing build
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Sep 13, 2024
1 parent ae33fee commit 9d273c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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.
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
15 changes: 1 addition & 14 deletions noir/noir-repo/noir_stdlib/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -64,13 +57,7 @@ pub fn verify_proof<let N: u32, let M: u32, let K: u32>(
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<let N: u32, let M: u32, let K: u32>(
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/ivc-integration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
MockPrivateKernelTailInputType,
MockPublicKernelInputType,
PrivateKernelPublicInputs,
u8,
} from './types/index.js';

// Re export the circuit jsons
Expand Down Expand Up @@ -110,11 +111,11 @@ export async function witnessGenMockPrivateKernelTailCircuit(

export async function witnessGenMockPublicKernelCircuit(
args: MockPublicKernelInputType,
): Promise<WitnessGenResult<null>> {
): Promise<WitnessGenResult<u8>> {
const program = new Noir(MockPublicKernelCircuit);
const { witness, returnValue } = await program.execute(args, foreignCallHandler);
return {
witness,
publicInputs: returnValue as null,
publicInputs: returnValue as u8,
};
}

0 comments on commit 9d273c1

Please sign in to comment.