Skip to content

Commit

Permalink
Merge b965227 into 4bfeb83
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant authored Oct 14, 2024
2 parents 4bfeb83 + b965227 commit 0c925dc
Show file tree
Hide file tree
Showing 65 changed files with 405 additions and 1,752 deletions.
4 changes: 3 additions & 1 deletion l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ library Constants {
uint256 internal constant BLOCK_MERGE_ROLLUP_INDEX = 15;
uint256 internal constant ROOT_ROLLUP_INDEX = 16;
uint256 internal constant BLOCK_ROOT_ROLLUP_EMPTY_INDEX = 17;
uint256 internal constant TUBE_INDEX = 18;
uint256 internal constant PRIVATE_KERNEL_RESET_INDEX = 20;
uint256 internal constant FUNCTION_SELECTOR_NUM_BYTES = 4;
uint256 internal constant INITIALIZATION_SLOT_SEPARATOR = 1000000000;
Expand Down Expand Up @@ -228,7 +229,8 @@ library Constants {
uint256 internal constant RECURSIVE_PROOF_LENGTH = 463;
uint256 internal constant NESTED_RECURSIVE_PROOF_LENGTH = 463;
uint256 internal constant TUBE_PROOF_LENGTH = 463;
uint256 internal constant VERIFICATION_KEY_LENGTH_IN_FIELDS = 128;
uint256 internal constant HONK_VERIFICATION_KEY_LENGTH_IN_FIELDS = 128;
uint256 internal constant CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS = 145;
uint256 internal constant MEM_TAG_U1 = 1;
uint256 internal constant MEM_TAG_U8 = 2;
uint256 internal constant MEM_TAG_U16 = 3;
Expand Down
6 changes: 4 additions & 2 deletions noir-projects/mega_honk_circuits.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[
"private_kernel.*",
"empty_nested"
"private_kernel_init",
"private_kernel_inner",
"private_kernel_reset.*",
"private_kernel_tail.*"
]
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use dep::types::{
traits::Empty,
recursion::{verification_key::VerificationKey, proof::RecursiveProof, traits::Verifiable},
recursion::{verification_key::{VerificationKey, HonkVerificationKey}, proof::RecursiveProof, traits::Verifiable},
constants::{BASE_PARITY_INDEX, VK_TREE_HEIGHT}, merkle_tree::membership::assert_check_membership
};
use crate::parity_public_inputs::ParityPublicInputs;

pub struct RootParityInput {
proof: RecursiveProof,
verification_key: VerificationKey,
verification_key: HonkVerificationKey,
vk_path: [Field; VK_TREE_HEIGHT],
public_inputs: ParityPublicInputs,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ impl RootParityInputs {
//TODO: Do we need to validate this following hash
//assert(hash(self.children[i].verification_key) == self.children[i].verification_key.hash);
self.children[i].verify();
// TODO(#7410) we need the tube vk to reinstate this
// self.children[i].validate_in_vk_tree();
self.children[i].validate_in_vk_tree();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use dep::types::{
traits::Empty,
recursion::{verification_key::VerificationKey, proof::NestedRecursiveProof, traits::Verifiable},
recursion::{
verification_key::{VerificationKey, HonkVerificationKey}, proof::NestedRecursiveProof,
traits::Verifiable
},
constants::{ROOT_PARITY_INDEX, VK_TREE_HEIGHT}, merkle_tree::membership::assert_check_membership
};
use crate::parity_public_inputs::ParityPublicInputs;

pub struct RootRollupParityInput {
proof: NestedRecursiveProof,
verification_key: VerificationKey,
verification_key: HonkVerificationKey,
vk_path: [Field; VK_TREE_HEIGHT],
public_inputs: ParityPublicInputs,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ impl PreviousKernelValidator {
PreviousKernelValidator { previous_kernel, hints }
}

pub fn validate_proof<let N: u32>(_self: Self, _allowed_indices: [u32; N]) {
pub fn validate_proof<let N: u32>(self: Self, allowed_indices: [u32; N]) {
if !dep::std::runtime::is_unconstrained() {
// TODO(#7410) currently stubbed out until tube vk handled
// self.previous_kernel.validate_in_vk_tree(allowed_indices);
self.previous_kernel.validate_in_vk_tree(allowed_indices);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use dep::types::{
header::Header, KernelCircuitPublicInputs, traits::Empty,
recursion::{verification_key::VerificationKey, proof::RecursiveProof, traits::Verifiable}
recursion::{verification_key::{VerificationKey, HonkVerificationKey}, proof::RecursiveProof, traits::Verifiable}
};

pub struct EmptyNestedCircuitPublicInputs {
proof: RecursiveProof,
vk: VerificationKey,
vk: HonkVerificationKey,
}

impl Verifiable for EmptyNestedCircuitPublicInputs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mod tests {
use crate::private_kernel_inner::{PrivateKernelInnerCircuitPrivateInputs, ALLOWED_PREVIOUS_CIRCUITS};
use dep::types::{
abis::{kernel_circuit_public_inputs::PrivateKernelCircuitPublicInputs},
constants::PRIVATE_KERNEL_INIT_INDEX,
constants::{PRIVATE_KERNEL_INIT_INDEX, BASE_ROLLUP_INDEX},
tests::{fixture_builder::FixtureBuilder, utils::assert_array_eq}
};

Expand Down Expand Up @@ -155,11 +155,11 @@ mod tests {
let _res = builder.execute();
}
}
// TODO(#7410) we need the tube vk to reinstate this
// #[test(should_fail_with="Invalid vk index")]
// fn invalid_previous_kernel() {
// let mut builder = PrivateKernelInnerInputsBuilder::new();
// builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
// let _res = builder.execute();
// }

#[test(should_fail_with="Invalid vk index")]
fn invalid_previous_kernel() {
let mut builder = PrivateKernelInnerInputsBuilder::new();
builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
let _res = builder.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ mod tests {
};
use dep::types::constants::{
MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_TX,
GENERATOR_INDEX__OVSK_M, PRIVATE_KERNEL_INNER_INDEX
GENERATOR_INDEX__OVSK_M, PRIVATE_KERNEL_INNER_INDEX, BASE_ROLLUP_INDEX
};
use dep::types::{
abis::{
Expand Down Expand Up @@ -609,11 +609,11 @@ mod tests {
// The 2nd nullifier has been siloed
assert(output_nullifiers[2].value() != nullifiers[2].value());
}
// TODO(#7410) we need the tube vk to reinstate this
// #[test(should_fail_with="Invalid vk index")]
// fn invalid_previous_kernel() {
// let mut builder = PrivateKernelResetInputsBuilder::new();
// builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
// let _res = builder.execute();
// }

#[test(should_fail_with="Invalid vk index")]
fn invalid_previous_kernel() {
let mut builder = PrivateKernelResetInputsBuilder::new();
builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
let _res = builder.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod tests {
use crate::private_kernel_tail::{PrivateKernelTailCircuitPrivateInputs, ALLOWED_PREVIOUS_CIRCUITS};
use dep::types::constants::{
DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE, GENERATOR_INDEX__IVSK_M, L2_GAS_PER_LOG_BYTE,
L2_GAS_PER_NULLIFIER, PRIVATE_KERNEL_INNER_INDEX
L2_GAS_PER_NULLIFIER, PRIVATE_KERNEL_INNER_INDEX, BASE_ROLLUP_INDEX
};
use dep::types::{
abis::{
Expand Down Expand Up @@ -310,11 +310,11 @@ mod tests {
let _res = builder.execute();
}
}
// TODO(#7410) we need the tube vk to reinstate this
// #[test(should_fail_with="Invalid vk index")]
// fn invalid_previous_kernel() {
// let mut builder = PrivateKernelTailInputsBuilder::new();
// builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
// let _res = builder.execute();
// }

#[test(should_fail_with="Invalid vk index")]
fn invalid_previous_kernel() {
let mut builder = PrivateKernelTailInputsBuilder::new();
builder.previous_kernel = builder.previous_kernel.in_vk_tree(BASE_ROLLUP_INDEX);
let _res = builder.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ impl PreviousKernelValidator {
PreviousKernelValidator { previous_kernel }
}

pub fn validate_proof<let N: u32>(self, _allowed_indices: [u32; N]) {
pub fn validate_proof<let N: u32>(self, allowed_indices: [u32; N]) {
if !dep::std::runtime::is_unconstrained() {
// Recursively verify the tube proof or a previous public kernel proof
self.previous_kernel.verify();
// TODO(#7410) currently stubbed out until tube vk handled
// self.previous_kernel.validate_in_vk_tree(allowed_indices);
self.previous_kernel.validate_in_vk_tree(allowed_indices);
}
}

Expand Down
Loading

0 comments on commit 0c925dc

Please sign in to comment.