Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ library Constants {
uint256 internal constant MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 4;
uint256 internal constant NUM_ENCRYPTED_LOGS_HASHES_PER_TX = 1;
uint256 internal constant NUM_UNENCRYPTED_LOGS_HASHES_PER_TX = 1;
uint256 internal constant MAX_PUBLIC_DATA_HINTS = 64;
uint256 internal constant NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP = 16;
uint256 internal constant VK_TREE_HEIGHT = 3;
uint256 internal constant FUNCTION_TREE_HEIGHT = 5;
Expand Down
1 change: 1 addition & 0 deletions noir-projects/noir-protocol-circuits/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"crates/public-kernel-teardown-simulated",
"crates/public-kernel-tail",
"crates/public-kernel-tail-simulated",
"crates/reset-kernel-lib",
"crates/rollup-lib",
"crates/rollup-merge",
"crates/rollup-base",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod tests {
use crate::private_kernel_tail::PrivateKernelTailCircuitPrivateInputs;
use dep::reset_kernel_lib::{
tests::nullifier_read_request_hints_builder::NullifierReadRequestHintsBuilder,
read_request_reset::{PendingReadHint, ReadRequestState, ReadRequestStatus}
reset::read_request::{PendingReadHint, ReadRequestState, ReadRequestStatus}
};
use dep::types::constants::{
MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX,
Expand Down Expand Up @@ -177,6 +177,14 @@ mod tests {
}
}

#[test]
unconstrained fn execution_succeeded() {
let mut builder = PrivateKernelTailInputsBuilder::new();
let public_inputs = builder.execute();

assert(is_empty(public_inputs.start_state));
}

#[test]
unconstrained fn native_matching_one_read_request_to_commitment_works() {
let mut builder = PrivateKernelTailInputsBuilder::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod tests {
use crate::private_kernel_tail_to_public::PrivateKernelTailToPublicCircuitPrivateInputs;
use dep::reset_kernel_lib::{
tests::nullifier_read_request_hints_builder::NullifierReadRequestHintsBuilder,
read_request_reset::{PendingReadHint, ReadRequestState, ReadRequestStatus}
reset::read_request::{PendingReadHint, ReadRequestState, ReadRequestStatus}
};
use dep::types::constants::{
MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NEW_NOTE_HASHES_PER_TX, MAX_NEW_NULLIFIERS_PER_TX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,8 @@ pub fn initialize_emitted_end_values(
circuit_outputs.end_non_revertible.encrypted_logs_hash = start_non_revertible.encrypted_logs_hash;
circuit_outputs.end_non_revertible.encrypted_log_preimages_length = start_non_revertible.encrypted_log_preimages_length;

// TODO - should be propagated only in initialize_end_values() and clear them in the tail circuit. The
// max_block_number must be propagated to the rollup however as a RollupValidationRequest.
let start = previous_kernel.public_inputs.validation_requests;
circuit_outputs.validation_requests.max_block_number = start.for_rollup.max_block_number;
circuit_outputs.validation_requests.public_data_reads = array_to_bounded_vec(start.public_data_reads);
}

// Initialises the circuit outputs with the end state of the previous iteration.
Expand All @@ -110,6 +107,7 @@ pub fn initialize_end_values(
circuit_outputs.validation_requests.max_block_number = previous_kernel.public_inputs.validation_requests.for_rollup.max_block_number;
circuit_outputs.validation_requests.nullifier_read_requests = array_to_bounded_vec(start.nullifier_read_requests);
circuit_outputs.validation_requests.nullifier_non_existent_read_requests = array_to_bounded_vec(start.nullifier_non_existent_read_requests);
circuit_outputs.validation_requests.public_data_reads = array_to_bounded_vec(start.public_data_reads);
}

fn perform_static_call_checks(public_call: PublicCallData) {
Expand Down Expand Up @@ -244,7 +242,7 @@ pub fn update_public_end_non_revertible_values(

propagate_new_nullifiers_non_revertible(public_call, circuit_outputs);
propagate_new_note_hashes_non_revertible(public_call, circuit_outputs);
propagate_new_l2_to_l1_messages(public_call, circuit_outputs);
propagate_new_l2_to_l1_messages_non_revertible(public_call, circuit_outputs);
propagate_valid_non_revertible_public_data_update_requests(public_call, circuit_outputs);
}

Expand Down Expand Up @@ -457,6 +455,31 @@ fn propagate_new_nullifiers(
circuit_outputs.end.new_nullifiers.extend_from_bounded_vec(siloed_new_nullifiers);
}

fn propagate_new_l2_to_l1_messages_non_revertible(
public_call: PublicCallData,
public_inputs: &mut PublicKernelCircuitPublicInputsBuilder
) {
// new l2 to l1 messages
let public_call_public_inputs = public_call.call_stack_item.public_inputs;
let storage_contract_address = public_call_public_inputs.call_context.storage_contract_address;

let new_l2_to_l1_msgs = public_call_public_inputs.new_l2_to_l1_msgs;
let mut new_l2_to_l1_msgs_to_insert : BoundedVec<Field, MAX_NEW_L2_TO_L1_MSGS_PER_CALL> = BoundedVec::new();
for i in 0..MAX_NEW_L2_TO_L1_MSGS_PER_CALL {
let msg = new_l2_to_l1_msgs[i];
if !is_empty(msg) {
let new_l2_to_l1_msgs = compute_l2_to_l1_hash(
storage_contract_address,
public_inputs.constants.tx_context.version,
public_inputs.constants.tx_context.chain_id,
msg
);
new_l2_to_l1_msgs_to_insert.push(new_l2_to_l1_msgs)
}
}
public_inputs.end_non_revertible.new_l2_to_l1_msgs.extend_from_bounded_vec(new_l2_to_l1_msgs_to_insert);
}

fn propagate_new_l2_to_l1_messages(public_call: PublicCallData, public_inputs: &mut PublicKernelCircuitPublicInputsBuilder) {
// new l2 to l1 messages
let public_call_public_inputs = public_call.call_stack_item.public_inputs;
Expand Down
Loading