From 8e692c18ef3c5231718840f46243299cba46ab60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bene=C5=A1?= Date: Thu, 4 Jan 2024 18:29:42 +0100 Subject: [PATCH] fix: issue with `run_nargo_fmt.sh` + minor yellow paper naming improvements (#3833) When input param was not set (which is expected when we want to apply the changes) the script failed with > ./run_nargo_fmt.sh: line 31: $1: unbound variable I decided to solve this by allowing for unbound vars. Other than this I sneaked in a few changes I discussed with Lasse: 1. Renamed content hash as body hash because we have a struct called body and the hash is hash of body so it makes it a bit more clear of what the hash is. 2. Renamed `l1_to_l2_message_tree` as `l1_to_l2_messages_tree` in the yellow paper to make it consistent with our codebase. --- .../src/aztec3/circuits/abis/block_header.hpp | 26 ++++++------ .../abis/rollup/root/root_rollup_inputs.hpp | 8 ++-- .../rollup/root/root_rollup_public_inputs.hpp | 24 +++++------ circuits/cpp/src/aztec3/circuits/hash.hpp | 12 +++--- .../aztec3/circuits/kernel/public/.test.cpp | 4 +- .../src/aztec3/circuits/rollup/base/.test.cpp | 24 +++++------ .../base/native_base_rollup_circuit.cpp | 4 +- .../src/aztec3/circuits/rollup/root/.test.cpp | 28 ++++++------- .../root/native_root_rollup_circuit.cpp | 12 +++--- .../circuits/rollup/test_utils/utils.cpp | 14 +++---- .../acir-simulator/src/acvm/serialize.ts | 8 ++-- .../src/client/view_data_oracle.ts | 4 +- yarn-project/acir-simulator/src/public/db.ts | 2 +- .../src/public/public_execution_context.ts | 2 +- .../aztec-node/src/aztec-node/server.ts | 12 +++--- yarn-project/aztec-nr/aztec/src/context.nr | 6 +-- yarn-project/circuits.js/src/abis/abis.ts | 4 +- .../src/structs/kernel/block_header.ts | 10 ++--- .../src/structs/rollup/root_rollup.ts | 16 ++++---- .../circuits.js/src/tests/factories.ts | 4 +- .../src/__snapshots__/index.test.ts.snap | 6 +-- .../src/crates/rollup-lib/src/hash.nr | 4 +- .../src/crates/rollup-lib/src/root.nr | 12 +++--- .../rollup-lib/src/root/root_rollup_inputs.nr | 4 +- .../src/root/root_rollup_public_inputs.nr | 4 +- .../src/tests/root_rollup_inputs.nr | 10 ++--- .../src/crates/types/src/abis/block_header.nr | 10 ++--- .../src/crates/types/src/tests/fixtures.nr | 2 +- .../src/type_conversion.ts | 16 ++++---- .../src/types/private_kernel_init_types.ts | 2 +- .../src/types/private_kernel_inner_types.ts | 2 +- .../types/private_kernel_ordering_types.ts | 2 +- .../public_kernel_private_previous_types.ts | 2 +- .../public_kernel_public_previous_types.ts | 2 +- .../src/types/rollup_base_types.ts | 2 +- .../src/types/rollup_root_types.ts | 8 ++-- .../pxe/src/database/kv_pxe_database.ts | 6 +-- yarn-project/pxe/src/database/memory_db.ts | 4 +- .../src/database/pxe_database_test_suite.ts | 2 +- .../pxe/src/simulator_oracle/index.ts | 2 +- .../pxe/src/synchronizer/synchronizer.test.ts | 2 +- .../pxe/src/synchronizer/synchronizer.ts | 2 +- yarn-project/run_nargo_fmt.sh | 2 +- .../block_builder/solo_block_builder.test.ts | 14 +++---- .../src/block_builder/solo_block_builder.ts | 34 ++++++++-------- .../src/block_builder/types.ts | 2 +- .../sequencer-client/src/sequencer/utils.ts | 4 +- .../src/simulator/public_executor.ts | 4 +- yarn-project/types/src/l2_block.ts | 40 +++++++++---------- yarn-project/types/src/merkle_tree_id.ts | 2 +- .../server_world_state_synchronizer.test.ts | 4 +- .../world-state-db/merkle_tree_operations.ts | 2 +- .../merkle_tree_snapshot_operations_facade.ts | 4 +- .../src/world-state-db/merkle_trees.ts | 18 ++++----- yellow-paper/docs/contracts/index.md | 4 +- .../docs/public-vm/gen/_InstructionSet.mdx | 8 ++-- .../docs/rollup-circuits/base_rollup.md | 4 +- yellow-paper/docs/rollup-circuits/index.md | 16 ++++---- .../docs/rollup-circuits/root_rollup.md | 6 +-- yellow-paper/docs/state/archive.md | 4 +- yellow-paper/docs/state/index.md | 4 +- yellow-paper/docs/transactions/tx-object.md | 2 +- .../InstructionSet/InstructionSet.js | 4 +- 63 files changed, 256 insertions(+), 256 deletions(-) diff --git a/circuits/cpp/src/aztec3/circuits/abis/block_header.hpp b/circuits/cpp/src/aztec3/circuits/abis/block_header.hpp index c1e37ae856d..a843a94ff5b 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/block_header.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/block_header.hpp @@ -25,7 +25,7 @@ template struct BlockHeader { fr note_hash_tree_root = 0; fr nullifier_tree_root = 0; fr contract_tree_root = 0; - fr l1_to_l2_messages_tree_root = 0; + fr l1_to_l2_message_tree_root = 0; fr archive_root = 0; fr private_kernel_vk_tree_root = 0; // TODO: future enhancement @@ -37,7 +37,7 @@ template struct BlockHeader { MSGPACK_FIELDS(note_hash_tree_root, nullifier_tree_root, contract_tree_root, - l1_to_l2_messages_tree_root, + l1_to_l2_message_tree_root, archive_root, private_kernel_vk_tree_root, public_data_tree_root, @@ -47,7 +47,7 @@ template struct BlockHeader { { return note_hash_tree_root == other.note_hash_tree_root && nullifier_tree_root == other.nullifier_tree_root && contract_tree_root == other.contract_tree_root && - l1_to_l2_messages_tree_root == other.l1_to_l2_messages_tree_root && archive_root == other.archive_root && + l1_to_l2_message_tree_root == other.l1_to_l2_message_tree_root && archive_root == other.archive_root && private_kernel_vk_tree_root == other.private_kernel_vk_tree_root && public_data_tree_root == other.public_data_tree_root && global_variables_hash == other.global_variables_hash; @@ -60,7 +60,7 @@ template struct BlockHeader { note_hash_tree_root.assert_is_zero(); nullifier_tree_root.assert_is_zero(); contract_tree_root.assert_is_zero(); - l1_to_l2_messages_tree_root.assert_is_zero(); + l1_to_l2_message_tree_root.assert_is_zero(); archive_root.assert_is_zero(); private_kernel_vk_tree_root.assert_is_zero(); public_data_tree_root.assert_is_zero(); @@ -75,9 +75,9 @@ template struct BlockHeader { auto to_ct = [&](auto& e) { return aztec3::utils::types::to_ct(builder, e); }; BlockHeader> data = { - to_ct(note_hash_tree_root), to_ct(nullifier_tree_root), to_ct(contract_tree_root), - to_ct(l1_to_l2_messages_tree_root), to_ct(archive_root), to_ct(private_kernel_vk_tree_root), - to_ct(public_data_tree_root), to_ct(global_variables_hash), + to_ct(note_hash_tree_root), to_ct(nullifier_tree_root), to_ct(contract_tree_root), + to_ct(l1_to_l2_message_tree_root), to_ct(archive_root), to_ct(private_kernel_vk_tree_root), + to_ct(public_data_tree_root), to_ct(global_variables_hash), }; return data; @@ -89,9 +89,9 @@ template struct BlockHeader { auto to_nt = [&](auto& e) { return aztec3::utils::types::to_nt(e); }; BlockHeader data = { - to_nt(note_hash_tree_root), to_nt(nullifier_tree_root), to_nt(contract_tree_root), - to_nt(l1_to_l2_messages_tree_root), to_nt(archive_root), to_nt(private_kernel_vk_tree_root), - to_nt(public_data_tree_root), to_nt(global_variables_hash), + to_nt(note_hash_tree_root), to_nt(nullifier_tree_root), to_nt(contract_tree_root), + to_nt(l1_to_l2_message_tree_root), to_nt(archive_root), to_nt(private_kernel_vk_tree_root), + to_nt(public_data_tree_root), to_nt(global_variables_hash), }; return data; @@ -104,7 +104,7 @@ template struct BlockHeader { note_hash_tree_root.set_public(); nullifier_tree_root.set_public(); contract_tree_root.set_public(); - l1_to_l2_messages_tree_root.set_public(); + l1_to_l2_message_tree_root.set_public(); archive_root.set_public(); private_kernel_vk_tree_root.set_public(); public_data_tree_root.set_public(); @@ -116,7 +116,7 @@ template struct BlockHeader { return { note_hash_tree_root, nullifier_tree_root, contract_tree_root, - l1_to_l2_messages_tree_root, + l1_to_l2_message_tree_root, archive_root, // TODO(#3441) Note private_kernel_vk_tree_root, is not included yet as // it is not present in noir, public_data_tree_root, @@ -130,7 +130,7 @@ template struct BlockHeader { note_hash_tree_root, nullifier_tree_root, contract_tree_root, - l1_to_l2_messages_tree_root, + l1_to_l2_message_tree_root, public_data_tree_root); } }; diff --git a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_inputs.hpp index f57aa95da7a..ce1993e6194 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_inputs.hpp @@ -20,9 +20,9 @@ template struct RootRollupInputs { // inputs required to process l1 to l2 messages std::array new_l1_to_l2_messages{}; - std::array new_l1_to_l2_messages_tree_root_sibling_path{}; + std::array new_l1_to_l2_message_tree_root_sibling_path{}; - AppendOnlyTreeSnapshot start_l1_to_l2_messages_tree_snapshot{}; + AppendOnlyTreeSnapshot start_l1_to_l2_message_tree_snapshot{}; // inputs required to add the block hash AppendOnlyTreeSnapshot start_archive_snapshot{}; @@ -31,8 +31,8 @@ template struct RootRollupInputs { // For serialization, update with new fields MSGPACK_FIELDS(previous_rollup_data, new_l1_to_l2_messages, - new_l1_to_l2_messages_tree_root_sibling_path, - start_l1_to_l2_messages_tree_snapshot, + new_l1_to_l2_message_tree_root_sibling_path, + start_l1_to_l2_message_tree_snapshot, start_archive_snapshot, new_archive_sibling_path); bool operator==(RootRollupInputs const&) const = default; diff --git a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp index 4392632b69b..bf2525c27d8 100644 --- a/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp +++ b/circuits/cpp/src/aztec3/circuits/abis/rollup/root/root_rollup_public_inputs.hpp @@ -37,11 +37,11 @@ template struct RootRollupPublicInputs { AppendOnlyTreeSnapshot start_tree_of_historical_contract_tree_roots_snapshot{}; AppendOnlyTreeSnapshot end_tree_of_historical_contract_tree_roots_snapshot{}; - AppendOnlyTreeSnapshot start_l1_to_l2_messages_tree_snapshot{}; - AppendOnlyTreeSnapshot end_l1_to_l2_messages_tree_snapshot{}; + AppendOnlyTreeSnapshot start_l1_to_l2_message_tree_snapshot{}; + AppendOnlyTreeSnapshot end_l1_to_l2_message_tree_snapshot{}; - AppendOnlyTreeSnapshot start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot{}; - AppendOnlyTreeSnapshot end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot{}; + AppendOnlyTreeSnapshot start_tree_of_historical_l1_to_l2_message_tree_roots_snapshot{}; + AppendOnlyTreeSnapshot end_tree_of_historical_l1_to_l2_message_tree_roots_snapshot{}; AppendOnlyTreeSnapshot start_archive_snapshot{}; AppendOnlyTreeSnapshot end_archive_snapshot{}; @@ -64,10 +64,10 @@ template struct RootRollupPublicInputs { end_tree_of_historical_note_hash_tree_roots_snapshot, start_tree_of_historical_contract_tree_roots_snapshot, end_tree_of_historical_contract_tree_roots_snapshot, - start_l1_to_l2_messages_tree_snapshot, - end_l1_to_l2_messages_tree_snapshot, - start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot, - end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot, + start_l1_to_l2_message_tree_snapshot, + end_l1_to_l2_message_tree_snapshot, + start_tree_of_historical_l1_to_l2_message_tree_roots_snapshot, + end_tree_of_historical_l1_to_l2_message_tree_roots_snapshot, start_archive_snapshot, end_archive_snapshot, calldata_hash, @@ -86,8 +86,8 @@ template struct RootRollupPublicInputs { write(buf, start_tree_of_historical_note_hash_tree_roots_snapshot); write(buf, start_tree_of_historical_contract_tree_roots_snapshot); write(buf, start_public_data_tree_root); - write(buf, start_l1_to_l2_messages_tree_snapshot); - write(buf, start_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot); + write(buf, start_l1_to_l2_message_tree_snapshot); + write(buf, start_tree_of_historical_l1_to_l2_message_tree_roots_snapshot); write(buf, start_archive_snapshot); write(buf, end_note_hash_tree_snapshot); write(buf, end_nullifier_tree_snapshot); @@ -95,8 +95,8 @@ template struct RootRollupPublicInputs { write(buf, end_tree_of_historical_note_hash_tree_roots_snapshot); write(buf, end_tree_of_historical_contract_tree_roots_snapshot); write(buf, end_public_data_tree_root); - write(buf, end_l1_to_l2_messages_tree_snapshot); - write(buf, end_tree_of_historical_l1_to_l2_messages_tree_roots_snapshot); + write(buf, end_l1_to_l2_message_tree_snapshot); + write(buf, end_tree_of_historical_l1_to_l2_message_tree_roots_snapshot); write(buf, end_archive_snapshot); // Stitching calldata hash together diff --git a/circuits/cpp/src/aztec3/circuits/hash.hpp b/circuits/cpp/src/aztec3/circuits/hash.hpp index ee6aac67a14..241271f1925 100644 --- a/circuits/cpp/src/aztec3/circuits/hash.hpp +++ b/circuits/cpp/src/aztec3/circuits/hash.hpp @@ -130,14 +130,14 @@ template typename NCT::fr compute_block_hash(typename NCT::fr con typename NCT::fr const& note_hash_tree_root, typename NCT::fr const& nullifier_tree_root, typename NCT::fr const& contract_tree_root, - typename NCT::fr const& l1_to_l2_messages_tree_root, + typename NCT::fr const& l1_to_l2_message_tree_root, typename NCT::fr const& public_data_tree_root) { using fr = typename NCT::fr; std::vector const inputs = { - globals_hash, note_hash_tree_root, nullifier_tree_root, - contract_tree_root, l1_to_l2_messages_tree_root, public_data_tree_root, + globals_hash, note_hash_tree_root, nullifier_tree_root, + contract_tree_root, l1_to_l2_message_tree_root, public_data_tree_root, }; return NCT::hash(inputs, aztec3::GeneratorIndex::BLOCK_HASH); @@ -148,14 +148,14 @@ typename NCT::fr compute_block_hash_with_globals(abis::GlobalVariables cons typename NCT::fr const& note_hash_tree_root, typename NCT::fr const& nullifier_tree_root, typename NCT::fr const& contract_tree_root, - typename NCT::fr const& l1_to_l2_messages_tree_root, + typename NCT::fr const& l1_to_l2_message_tree_root, typename NCT::fr const& public_data_tree_root) { using fr = typename NCT::fr; std::vector const inputs = { - globals.hash(), note_hash_tree_root, nullifier_tree_root, - contract_tree_root, l1_to_l2_messages_tree_root, public_data_tree_root, + globals.hash(), note_hash_tree_root, nullifier_tree_root, + contract_tree_root, l1_to_l2_message_tree_root, public_data_tree_root, }; return NCT::hash(inputs, aztec3::GeneratorIndex::BLOCK_HASH); diff --git a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp index 66614035e65..c87630c2191 100644 --- a/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/kernel/public/.test.cpp @@ -332,7 +332,7 @@ PublicKernelInputs get_kernel_inputs_with_previous_kernel(NT::boolean privat .note_hash_tree_root = ++seed, .nullifier_tree_root = ++seed, .contract_tree_root = ++seed, - .l1_to_l2_messages_tree_root = ++seed, + .l1_to_l2_message_tree_root = ++seed, .archive_root = ++seed, .private_kernel_vk_tree_root = ++seed, .public_data_tree_root = ++seed, @@ -372,7 +372,7 @@ PublicKernelInputs get_kernel_inputs_with_previous_kernel(NT::boolean privat [[maybe_unused]] BlockHeader const historical_tree_roots = { .note_hash_tree_root = 1000, .contract_tree_root = 2000, - .l1_to_l2_messages_tree_root = 3000, + .l1_to_l2_message_tree_root = 3000, .private_kernel_vk_tree_root = 4000, }; diff --git a/circuits/cpp/src/aztec3/circuits/rollup/base/.test.cpp b/circuits/cpp/src/aztec3/circuits/rollup/base/.test.cpp index 1a5952cc4c4..fab2b6c9a08 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/base/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/base/.test.cpp @@ -741,8 +741,8 @@ TEST_F(base_rollup_tests, native_single_public_state_read) MemoryStore public_data_tree_store; MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); - MemoryStore l1_to_l2_messages_tree_store; - MerkleTree l1_to_l2_messages_tree(l1_to_l2_messages_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); + MemoryStore l1_to_l2_message_tree_store; + MerkleTree l1_to_l2_message_tree(l1_to_l2_message_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); auto data_read = abis::PublicDataRead{ .leaf_index = fr(1), @@ -752,7 +752,7 @@ TEST_F(base_rollup_tests, native_single_public_state_read) std::array, 2> kernel_data = { get_empty_kernel(), get_empty_kernel() }; kernel_data[0].public_inputs.end.public_data_reads[0] = data_read; auto inputs = test_utils::utils::base_rollup_inputs_from_kernels( - kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_messages_tree); + kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_message_tree); BaseOrMergeRollupPublicInputs outputs = aztec3::circuits::rollup::native_base_rollup::base_rollup_circuit(builder, inputs); @@ -777,8 +777,8 @@ TEST_F(base_rollup_tests, native_single_public_state_write) MemoryStore public_data_tree_store; MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); - MemoryStore l1_to_l2_messages_tree_store; - MerkleTree l1_to_l2_messages_tree(l1_to_l2_messages_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); + MemoryStore l1_to_l2_message_tree_store; + MerkleTree l1_to_l2_message_tree(l1_to_l2_message_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); auto data_write = abis::PublicDataUpdateRequest{ @@ -791,7 +791,7 @@ TEST_F(base_rollup_tests, native_single_public_state_write) kernel_data[0].public_inputs.end.public_data_update_requests[0] = data_write; auto inputs = test_utils::utils::base_rollup_inputs_from_kernels( - kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_messages_tree); + kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_message_tree); BaseOrMergeRollupPublicInputs outputs = aztec3::circuits::rollup::native_base_rollup::base_rollup_circuit(builder, inputs); @@ -816,8 +816,8 @@ TEST_F(base_rollup_tests, native_multiple_public_state_read_writes) MemoryStore public_data_tree_store; MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); - MemoryStore l1_to_l2_messages_tree_store; - MerkleTree l1_to_l2_messages_tree(l1_to_l2_messages_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); + MemoryStore l1_to_l2_message_tree_store; + MerkleTree l1_to_l2_message_tree(l1_to_l2_message_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); std::array, 2> kernel_data = { get_empty_kernel(), get_empty_kernel() }; @@ -840,7 +840,7 @@ TEST_F(base_rollup_tests, native_multiple_public_state_read_writes) make_public_data_update_request(fr(4), fr(204), fr(304)); auto inputs = test_utils::utils::base_rollup_inputs_from_kernels( - kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_messages_tree); + kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_message_tree); BaseOrMergeRollupPublicInputs outputs = aztec3::circuits::rollup::native_base_rollup::base_rollup_circuit(builder, inputs); @@ -868,8 +868,8 @@ TEST_F(base_rollup_tests, native_multiple_public_state_read_writes) // MemoryStore public_data_tree_store; // MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); -// MemoryStore l1_to_l2_messages_tree_store; -// MerkleTree l1_to_l2_messages_tree(l1_to_l2_messages_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); +// MemoryStore l1_to_l2_message_tree_store; +// MerkleTree l1_to_l2_message_tree(l1_to_l2_message_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); // auto data_read = abis::PublicDataRead{ // .leaf_index = fr(1), @@ -879,7 +879,7 @@ TEST_F(base_rollup_tests, native_multiple_public_state_read_writes) // std::array, 2> kernel_data = { get_empty_kernel(), get_empty_kernel() }; // kernel_data[0].public_inputs.end.public_data_reads[0] = data_read; // auto inputs = test_utils::utils::base_rollup_inputs_from_kernels( -// kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_messages_tree); +// kernel_data, note_hash_tree, contract_tree, public_data_tree, l1_to_l2_message_tree); // // We change the initial tree root so the read value does not match // public_data_tree.update_element(1, fr(43)); diff --git a/circuits/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp b/circuits/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp index d6a7cb4af0e..47f3da86036 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/base/native_base_rollup_circuit.cpp @@ -145,14 +145,14 @@ void perform_archive_membership_checks(DummyBuilder& builder, BaseRollupInputs c auto note_hash_tree_root = historical_block.note_hash_tree_root; auto nullifier_tree_root = historical_block.nullifier_tree_root; auto contract_tree_root = historical_block.contract_tree_root; - auto l1_to_l2_messages_tree_root = historical_block.l1_to_l2_messages_tree_root; + auto l1_to_l2_message_tree_root = historical_block.l1_to_l2_message_tree_root; auto public_data_tree_root = historical_block.public_data_tree_root; auto previous_block_hash = compute_block_hash(historical_block.global_variables_hash, note_hash_tree_root, nullifier_tree_root, contract_tree_root, - l1_to_l2_messages_tree_root, + l1_to_l2_message_tree_root, public_data_tree_root); abis::MembershipWitness const historical_root_witness = diff --git a/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp b/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp index 50f85996946..6be0e29b6c5 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp @@ -167,8 +167,8 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) MemoryStore contract_tree_store; MerkleTree contract_tree(contract_tree_store, CONTRACT_TREE_HEIGHT); - MemoryStore l1_to_l2_messages_tree_store; - MerkleTree l1_to_l2_messages_tree(l1_to_l2_messages_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); + MemoryStore l1_to_l2_message_tree_store; + MerkleTree l1_to_l2_message_tree(l1_to_l2_message_tree_store, L1_TO_L2_MSG_TREE_HEIGHT); MemoryStore public_store; MerkleTree public_data_tree(public_store, PUBLIC_DATA_TREE_HEIGHT); @@ -190,7 +190,7 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) note_hash_tree.root(), nullifier_tree.root(), contract_tree.root(), - l1_to_l2_messages_tree.root(), + l1_to_l2_message_tree.root(), public_data_tree.root()); archive.update_element(0, start_block_hash); AppendOnlyTreeSnapshot start_archive_snapshot = { .root = archive.root(), .next_available_leaf_index = 1 }; @@ -227,12 +227,12 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) kernels[2].public_inputs.end.new_contracts[0] = new_contract; // l1 to l2 messages snapshot - AppendOnlyTreeSnapshot const start_l1_to_l2_messages_tree_snapshot = { .root = l1_to_l2_messages_tree.root(), - .next_available_leaf_index = 0 }; + AppendOnlyTreeSnapshot const start_l1_to_l2_message_tree_snapshot = { .root = l1_to_l2_message_tree.root(), + .next_available_leaf_index = 0 }; - // Create 16 empty l1 to l2 messages, and update the l1_to_l2 messages tree + // Create 16 empty l1 to l2 messages, and update the l1_to_l2 message tree for (size_t i = 0; i < l1_to_l2_messages.size(); i++) { - l1_to_l2_messages_tree.update_element(i, l1_to_l2_messages[i]); + l1_to_l2_message_tree.update_element(i, l1_to_l2_messages[i]); } // Get the block hash after. @@ -240,15 +240,15 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) note_hash_tree.root(), nullifier_tree.root(), contract_tree.root(), - l1_to_l2_messages_tree.root(), + l1_to_l2_message_tree.root(), public_data_tree.root()); archive.update_element(1, end_block_hash); AppendOnlyTreeSnapshot end_archive_snapshot = { .root = archive.root(), .next_available_leaf_index = 2 }; // Compute the end snapshot - AppendOnlyTreeSnapshot const end_l1_to_l2_messages_tree_snapshot = { .root = l1_to_l2_messages_tree.root(), - .next_available_leaf_index = - NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP }; + AppendOnlyTreeSnapshot const end_l1_to_l2_message_tree_snapshot = { .root = l1_to_l2_message_tree.root(), + .next_available_leaf_index = + NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP }; RootRollupInputs rootRollupInputs = get_root_rollup_inputs(builder, kernels, l1_to_l2_messages); RootRollupPublicInputs outputs = @@ -282,13 +282,13 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) // @todo @LHerskind: Check nullifier trees - // Check l1 to l2 messages trees - ASSERT_EQ(outputs.start_l1_to_l2_messages_tree_snapshot, start_l1_to_l2_messages_tree_snapshot); + // Check l1 to l2 message trees + ASSERT_EQ(outputs.start_l1_to_l2_message_tree_snapshot, start_l1_to_l2_message_tree_snapshot); ASSERT_EQ(outputs.start_contract_tree_snapshot, rootRollupInputs.previous_rollup_data[0].base_or_merge_rollup_public_inputs.start_contract_tree_snapshot); ASSERT_EQ(outputs.end_contract_tree_snapshot, rootRollupInputs.previous_rollup_data[1].base_or_merge_rollup_public_inputs.end_contract_tree_snapshot); - ASSERT_EQ(outputs.end_l1_to_l2_messages_tree_snapshot, end_l1_to_l2_messages_tree_snapshot); + ASSERT_EQ(outputs.end_l1_to_l2_message_tree_snapshot, end_l1_to_l2_message_tree_snapshot); ASSERT_EQ(outputs.start_archive_snapshot, start_archive_snapshot); ASSERT_EQ(outputs.end_archive_snapshot, end_archive_snapshot); diff --git a/circuits/cpp/src/aztec3/circuits/rollup/root/native_root_rollup_circuit.cpp b/circuits/cpp/src/aztec3/circuits/rollup/root/native_root_rollup_circuit.cpp index b4f876263d9..da9a256b812 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/root/native_root_rollup_circuit.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/root/native_root_rollup_circuit.cpp @@ -96,10 +96,10 @@ RootRollupPublicInputs root_rollup_circuit(DummyBuilder& builder, RootRollupInpu // Insert subtree into the l1 to l2 data tree const auto empty_l1_to_l2_subtree_root = components::calculate_empty_tree_root(L1_TO_L2_MSG_SUBTREE_HEIGHT); - auto new_l1_to_l2_messages_tree_snapshot = components::insert_subtree_to_snapshot_tree( + auto new_l1_to_l2_message_tree_snapshot = components::insert_subtree_to_snapshot_tree( builder, - rootRollupInputs.start_l1_to_l2_messages_tree_snapshot, - rootRollupInputs.new_l1_to_l2_messages_tree_root_sibling_path, + rootRollupInputs.start_l1_to_l2_message_tree_snapshot, + rootRollupInputs.new_l1_to_l2_message_tree_root_sibling_path, empty_l1_to_l2_subtree_root, l1_to_l2_subtree_root, L1_TO_L2_MSG_SUBTREE_HEIGHT, @@ -112,7 +112,7 @@ RootRollupPublicInputs root_rollup_circuit(DummyBuilder& builder, RootRollupInpu right.end_note_hash_tree_snapshot.root, right.end_nullifier_tree_snapshot.root, right.end_contract_tree_snapshot.root, - new_l1_to_l2_messages_tree_snapshot.root, + new_l1_to_l2_message_tree_snapshot.root, right.end_public_data_tree_root); // Update the blocks tree @@ -138,8 +138,8 @@ RootRollupPublicInputs root_rollup_circuit(DummyBuilder& builder, RootRollupInpu .end_contract_tree_snapshot = right.end_contract_tree_snapshot, .start_public_data_tree_root = left.start_public_data_tree_root, .end_public_data_tree_root = right.end_public_data_tree_root, - .start_l1_to_l2_messages_tree_snapshot = rootRollupInputs.start_l1_to_l2_messages_tree_snapshot, - .end_l1_to_l2_messages_tree_snapshot = new_l1_to_l2_messages_tree_snapshot, + .start_l1_to_l2_message_tree_snapshot = rootRollupInputs.start_l1_to_l2_message_tree_snapshot, + .end_l1_to_l2_message_tree_snapshot = new_l1_to_l2_message_tree_snapshot, .start_archive_snapshot = rootRollupInputs.start_archive_snapshot, .end_archive_snapshot = end_archive_snapshot, .calldata_hash = components::compute_calldata_hash(rootRollupInputs.previous_rollup_data), diff --git a/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp b/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp index 8526c02dd68..7fa9db9203a 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp @@ -175,7 +175,7 @@ BaseRollupInputs base_rollup_inputs_from_kernels(std::array kerne kernel_data[i].public_inputs.constants.block_header.nullifier_tree_root = nullifier_tree.root(); kernel_data[i].public_inputs.constants.block_header.nullifier_tree_root = nullifier_tree.root(); kernel_data[i].public_inputs.constants.block_header.contract_tree_root = contract_tree.root(); - kernel_data[i].public_inputs.constants.block_header.l1_to_l2_messages_tree_root = l1_to_l2_msg_tree.root(); + kernel_data[i].public_inputs.constants.block_header.l1_to_l2_message_tree_root = l1_to_l2_msg_tree.root(); kernel_data[i].public_inputs.constants.block_header.archive_root = archive.root(); kernel_data[i].public_inputs.constants.block_header.public_data_tree_root = public_data_tree.root(); kernel_data[i].public_inputs.constants.block_header.global_variables_hash = prev_global_variables_hash; @@ -226,14 +226,14 @@ BaseRollupInputs base_rollup_inputs_from_kernels(std::array kerne MemoryStore contract_tree_store; MerkleTree contract_tree = MerkleTree(contract_tree_store, CONTRACT_TREE_HEIGHT); MemoryStore l1_to_l2_messages_store; - MerkleTree l1_to_l2_messages_tree = MerkleTree(l1_to_l2_messages_store, L1_TO_L2_MSG_TREE_HEIGHT); + MerkleTree l1_to_l2_message_tree = MerkleTree(l1_to_l2_messages_store, L1_TO_L2_MSG_TREE_HEIGHT); MemoryStore public_data_tree_store; MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); return base_rollup_inputs_from_kernels( - std::move(kernel_data), note_hash_tree, contract_tree, public_data_tree, l1_to_l2_messages_tree); + std::move(kernel_data), note_hash_tree, contract_tree, public_data_tree, l1_to_l2_message_tree); } BaseRollupInputs base_rollup_inputs_from_kernels(std::array kernel_data, @@ -246,7 +246,7 @@ BaseRollupInputs base_rollup_inputs_from_kernels(std::array kerne MemoryStore contract_tree_store; MerkleTree contract_tree = MerkleTree(contract_tree_store, CONTRACT_TREE_HEIGHT); MemoryStore l1_to_l2_messages_store; - MerkleTree l1_to_l2_messages_tree = MerkleTree(l1_to_l2_messages_store, L1_TO_L2_MSG_TREE_HEIGHT); + MerkleTree l1_to_l2_message_tree = MerkleTree(l1_to_l2_messages_store, L1_TO_L2_MSG_TREE_HEIGHT); MemoryStore public_data_tree_store; MerkleTree public_data_tree(public_data_tree_store, PUBLIC_DATA_TREE_HEIGHT); @@ -258,7 +258,7 @@ BaseRollupInputs base_rollup_inputs_from_kernels(std::array kerne nullifier_tree, contract_tree, public_data_tree, - l1_to_l2_messages_tree); + l1_to_l2_message_tree); } BaseRollupInputs base_rollup_inputs_from_kernels(std::array kernel_data, @@ -411,8 +411,8 @@ RootRollupInputs get_root_rollup_inputs(utils::DummyBuilder& builder, RootRollupInputs rootRollupInputs = { .previous_rollup_data = get_previous_rollup_data(builder, std::move(kernel_data)), .new_l1_to_l2_messages = l1_to_l2_messages, - .new_l1_to_l2_messages_tree_root_sibling_path = l1_to_l2_tree_sibling_path, - .start_l1_to_l2_messages_tree_snapshot = start_l1_to_l2_msg_tree_snapshot, + .new_l1_to_l2_message_tree_root_sibling_path = l1_to_l2_tree_sibling_path, + .start_l1_to_l2_message_tree_snapshot = start_l1_to_l2_msg_tree_snapshot, .start_archive_snapshot = start_archive_snapshot, .new_archive_sibling_path = archive_sibling_path, }; diff --git a/yarn-project/acir-simulator/src/acvm/serialize.ts b/yarn-project/acir-simulator/src/acvm/serialize.ts index 3c577e161ea..1877bf264d9 100644 --- a/yarn-project/acir-simulator/src/acvm/serialize.ts +++ b/yarn-project/acir-simulator/src/acvm/serialize.ts @@ -111,7 +111,7 @@ export function toACVMBlockHeader(blockHeader: BlockHeader): ACVMField[] { toACVMField(blockHeader.noteHashTreeRoot), toACVMField(blockHeader.nullifierTreeRoot), toACVMField(blockHeader.contractTreeRoot), - toACVMField(blockHeader.l1ToL2MessagesTreeRoot), + toACVMField(blockHeader.l1ToL2MessageTreeRoot), toACVMField(blockHeader.archiveRoot), toACVMField(blockHeader.publicDataTreeRoot), toACVMField(blockHeader.globalVariablesHash), @@ -199,18 +199,18 @@ export function toAcvmEnqueuePublicFunctionResult(item: PublicCallRequest): ACVM /** * Converts the result of loading messages to ACVM fields. * @param messageLoadOracleInputs - The result of loading messages to convert. - * @param l1ToL2MessagesTreeRoot - The L1 to L2 messages tree root + * @param l1ToL2MessageTreeRoot - The L1 to L2 message tree root * @returns The Message Oracle Fields. */ export function toAcvmL1ToL2MessageLoadOracleInputs( messageLoadOracleInputs: MessageLoadOracleInputs, - l1ToL2MessagesTreeRoot: Fr, + l1ToL2MessageTreeRoot: Fr, ): ACVMField[] { return [ ...messageLoadOracleInputs.message.map(f => toACVMField(f)), toACVMField(messageLoadOracleInputs.index), ...messageLoadOracleInputs.siblingPath.map(f => toACVMField(f)), - toACVMField(l1ToL2MessagesTreeRoot), + toACVMField(l1ToL2MessageTreeRoot), ]; } diff --git a/yarn-project/acir-simulator/src/client/view_data_oracle.ts b/yarn-project/acir-simulator/src/client/view_data_oracle.ts index 8297c63c5a1..c75a224b32b 100644 --- a/yarn-project/acir-simulator/src/client/view_data_oracle.ts +++ b/yarn-project/acir-simulator/src/client/view_data_oracle.ts @@ -123,7 +123,7 @@ export class ViewDataOracle extends TypedOracle { block.endNoteHashTreeSnapshot.root, block.endNullifierTreeSnapshot.root, block.endContractTreeSnapshot.root, - block.endL1ToL2MessagesTreeSnapshot.root, + block.endL1ToL2MessageTreeSnapshot.root, block.endArchiveSnapshot.root, new Fr(0), // TODO(#3441) privateKernelVkTreeRoot is not present in L2Block and it's not yet populated in noir block.endPublicDataTreeSnapshot.root, @@ -241,7 +241,7 @@ export class ViewDataOracle extends TypedOracle { */ public async getL1ToL2Message(msgKey: Fr) { const message = await this.db.getL1ToL2Message(msgKey); - return { ...message, root: this.blockHeader.l1ToL2MessagesTreeRoot }; + return { ...message, root: this.blockHeader.l1ToL2MessageTreeRoot }; } /** diff --git a/yarn-project/acir-simulator/src/public/db.ts b/yarn-project/acir-simulator/src/public/db.ts index 0f7823dcb12..a001a4d4ab8 100644 --- a/yarn-project/acir-simulator/src/public/db.ts +++ b/yarn-project/acir-simulator/src/public/db.ts @@ -66,7 +66,7 @@ export interface PublicContractsDB { getPortalContractAddress(address: AztecAddress): Promise; } -/** Database interface for providing access to commitment tree and l1 to l2 messages tree (append only data trees). */ +/** Database interface for providing access to commitment tree and l1 to l2 message tree (append only data trees). */ export interface CommitmentsDB { /** * Gets a confirmed L1 to L2 message for the given message key. diff --git a/yarn-project/acir-simulator/src/public/public_execution_context.ts b/yarn-project/acir-simulator/src/public/public_execution_context.ts index 705c380b7ee..8f6a40e8a50 100644 --- a/yarn-project/acir-simulator/src/public/public_execution_context.ts +++ b/yarn-project/acir-simulator/src/public/public_execution_context.ts @@ -104,7 +104,7 @@ export class PublicExecutionContext extends TypedOracle { public async getL1ToL2Message(msgKey: Fr) { // l1 to l2 messages in public contexts TODO: https://github.com/AztecProtocol/aztec-packages/issues/616 const message = await this.commitmentsDb.getL1ToL2Message(msgKey); - return { ...message, root: this.blockHeader.l1ToL2MessagesTreeRoot }; + return { ...message, root: this.blockHeader.l1ToL2MessageTreeRoot }; } /** diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index cf0952abb42..36d19ed675f 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -371,7 +371,7 @@ export class AztecNodeService implements AztecNode { */ public async getL1ToL2MessageAndIndex(messageKey: Fr): Promise { // todo: #697 - make this one lookup. - const index = (await this.findLeafIndex('latest', MerkleTreeId.L1_TO_L2_MESSAGES_TREE, messageKey))!; + const index = (await this.findLeafIndex('latest', MerkleTreeId.L1_TO_L2_MESSAGE_TREE, messageKey))!; const message = await this.l1ToL2MessageSource.getConfirmedL1ToL2Message(messageKey); return Promise.resolve(new L1ToL2MessageAndIndex(index, message)); } @@ -387,7 +387,7 @@ export class AztecNodeService implements AztecNode { leafIndex: bigint, ): Promise> { const committedDb = await this.#getWorldState(blockNumber); - return committedDb.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, leafIndex); + return committedDb.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, leafIndex); } /** @@ -536,11 +536,11 @@ export class AztecNodeService implements AztecNode { const committedDb = await this.#getWorldState('latest'); const getTreeRoot = async (id: MerkleTreeId) => Fr.fromBuffer((await committedDb.getTreeInfo(id)).root); - const [noteHashTree, nullifierTree, contractTree, l1ToL2MessagesTree, archive, publicDataTree] = await Promise.all([ + const [noteHashTree, nullifierTree, contractTree, l1ToL2MessageTree, archive, publicDataTree] = await Promise.all([ getTreeRoot(MerkleTreeId.NOTE_HASH_TREE), getTreeRoot(MerkleTreeId.NULLIFIER_TREE), getTreeRoot(MerkleTreeId.CONTRACT_TREE), - getTreeRoot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE), + getTreeRoot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE), getTreeRoot(MerkleTreeId.ARCHIVE), getTreeRoot(MerkleTreeId.PUBLIC_DATA_TREE), ]); @@ -550,7 +550,7 @@ export class AztecNodeService implements AztecNode { [MerkleTreeId.NOTE_HASH_TREE]: noteHashTree, [MerkleTreeId.NULLIFIER_TREE]: nullifierTree, [MerkleTreeId.PUBLIC_DATA_TREE]: publicDataTree, - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: l1ToL2MessagesTree, + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: l1ToL2MessageTree, [MerkleTreeId.ARCHIVE]: archive, }; } @@ -567,7 +567,7 @@ export class AztecNodeService implements AztecNode { roots[MerkleTreeId.NOTE_HASH_TREE], roots[MerkleTreeId.NULLIFIER_TREE], roots[MerkleTreeId.CONTRACT_TREE], - roots[MerkleTreeId.L1_TO_L2_MESSAGES_TREE], + roots[MerkleTreeId.L1_TO_L2_MESSAGE_TREE], roots[MerkleTreeId.ARCHIVE], Fr.ZERO, // TODO(#3441) roots[MerkleTreeId.PUBLIC_DATA_TREE], diff --git a/yarn-project/aztec-nr/aztec/src/context.nr b/yarn-project/aztec-nr/aztec/src/context.nr index bd5f3acdb20..39bab7bce95 100644 --- a/yarn-project/aztec-nr/aztec/src/context.nr +++ b/yarn-project/aztec-nr/aztec/src/context.nr @@ -222,7 +222,7 @@ impl PrivateContext { ) // docs:end:context_consume_l1_to_l2_message { - let nullifier = process_l1_to_l2_message(self.block_header.l1_to_l2_messages_tree_root, self.this_address(), self.this_portal_address(), self.chain_id(), self.version(), msg_key, content, secret); + let nullifier = process_l1_to_l2_message(self.block_header.l1_to_l2_message_tree_root, self.this_address(), self.this_portal_address(), self.chain_id(), self.version(), msg_key, content, secret); // Push nullifier (and the "commitment" corresponding to this can be "empty") self.push_new_nullifier(nullifier, 0) @@ -310,7 +310,7 @@ impl PrivateContext { note_hash_tree_root : reader.read(), nullifier_tree_root : reader.read(), contract_tree_root : reader.read(), - l1_to_l2_messages_tree_root : reader.read(), + l1_to_l2_message_tree_root : reader.read(), archive_root : reader.read(), public_data_tree_root: reader.read(), global_variables_hash: reader.read(), @@ -579,7 +579,7 @@ impl PublicContext { // Note this returns self to get around an issue where mutable structs do not maintain mutations unless reassigned pub fn consume_l1_to_l2_message(&mut self, msg_key: Field, content: Field, secret: Field) { let this = (*self).this_address(); - let nullifier = process_l1_to_l2_message(self.block_header.l1_to_l2_messages_tree_root, this, self.this_portal_address(), self.chain_id(), self.version(), msg_key, content, secret); + let nullifier = process_l1_to_l2_message(self.block_header.l1_to_l2_message_tree_root, this, self.this_portal_address(), self.chain_id(), self.version(), msg_key, content, secret); // Push nullifier (and the "commitment" corresponding to this can be "empty") self.push_new_nullifier(nullifier, 0) diff --git a/yarn-project/circuits.js/src/abis/abis.ts b/yarn-project/circuits.js/src/abis/abis.ts index fb343965154..37d3d2d70c2 100644 --- a/yarn-project/circuits.js/src/abis/abis.ts +++ b/yarn-project/circuits.js/src/abis/abis.ts @@ -555,7 +555,7 @@ function computePrivateInputsHash(input: PrivateCircuitPublicInputs) { input.blockHeader.noteHashTreeRoot.toBuffer(), input.blockHeader.nullifierTreeRoot.toBuffer(), input.blockHeader.contractTreeRoot.toBuffer(), - input.blockHeader.l1ToL2MessagesTreeRoot.toBuffer(), + input.blockHeader.l1ToL2MessageTreeRoot.toBuffer(), input.blockHeader.archiveRoot.toBuffer(), input.blockHeader.publicDataTreeRoot.toBuffer(), input.blockHeader.globalVariablesHash.toBuffer(), @@ -641,7 +641,7 @@ export function computePublicInputsHash(input: PublicCircuitPublicInputs) { input.blockHeader.noteHashTreeRoot.toBuffer(), input.blockHeader.nullifierTreeRoot.toBuffer(), input.blockHeader.contractTreeRoot.toBuffer(), - input.blockHeader.l1ToL2MessagesTreeRoot.toBuffer(), + input.blockHeader.l1ToL2MessageTreeRoot.toBuffer(), input.blockHeader.archiveRoot.toBuffer(), input.blockHeader.publicDataTreeRoot.toBuffer(), input.blockHeader.globalVariablesHash.toBuffer(), diff --git a/yarn-project/circuits.js/src/structs/kernel/block_header.ts b/yarn-project/circuits.js/src/structs/kernel/block_header.ts index f7059e64b60..16f124e29db 100644 --- a/yarn-project/circuits.js/src/structs/kernel/block_header.ts +++ b/yarn-project/circuits.js/src/structs/kernel/block_header.ts @@ -27,9 +27,9 @@ export class BlockHeader { */ public contractTreeRoot: Fr, /** - * Root of the l1 to l2 messages tree at the time of when this information was assembled. + * Root of the l1 to l2 message tree at the time of when this information was assembled. */ - public l1ToL2MessagesTreeRoot: Fr, + public l1ToL2MessageTreeRoot: Fr, /** * Root of the state roots tree (archive) at the block prior to when this information was assembled. */ @@ -70,7 +70,7 @@ export class BlockHeader { fields.noteHashTreeRoot, fields.nullifierTreeRoot, fields.contractTreeRoot, - fields.l1ToL2MessagesTreeRoot, + fields.l1ToL2MessageTreeRoot, fields.archiveRoot, fields.privateKernelVkTreeRoot, fields.publicDataTreeRoot, @@ -96,7 +96,7 @@ export class BlockHeader { this.noteHashTreeRoot, this.nullifierTreeRoot, this.contractTreeRoot, - this.l1ToL2MessagesTreeRoot, + this.l1ToL2MessageTreeRoot, this.archiveRoot, // TODO(#3441) Note private_kernel_vk_tree_root, is not included yet as // it is not present in noir, this.publicDataTreeRoot, @@ -127,7 +127,7 @@ export class BlockHeader { this.noteHashTreeRoot.isZero() && this.nullifierTreeRoot.isZero() && this.contractTreeRoot.isZero() && - this.l1ToL2MessagesTreeRoot.isZero() && + this.l1ToL2MessageTreeRoot.isZero() && this.archiveRoot.isZero() && this.privateKernelVkTreeRoot.isZero() && this.publicDataTreeRoot.isZero() && diff --git a/yarn-project/circuits.js/src/structs/rollup/root_rollup.ts b/yarn-project/circuits.js/src/structs/rollup/root_rollup.ts index 1c590cd1582..fe629182e84 100644 --- a/yarn-project/circuits.js/src/structs/rollup/root_rollup.ts +++ b/yarn-project/circuits.js/src/structs/rollup/root_rollup.ts @@ -31,11 +31,11 @@ export class RootRollupInputs { /** * Sibling path of the new L1 to L2 message tree root. */ - public newL1ToL2MessagesTreeRootSiblingPath: Tuple, + public newL1ToL2MessageTreeRootSiblingPath: Tuple, /** * Snapshot of the L1 to L2 message tree at the start of the rollup. */ - public startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, + public startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, /** * Snapshot of the historical block roots tree at the start of the rollup. */ @@ -58,8 +58,8 @@ export class RootRollupInputs { return [ fields.previousRollupData, fields.newL1ToL2Messages, - fields.newL1ToL2MessagesTreeRootSiblingPath, - fields.startL1ToL2MessagesTreeSnapshot, + fields.newL1ToL2MessageTreeRootSiblingPath, + fields.startL1ToL2MessageTreeSnapshot, fields.startArchiveSnapshot, fields.newArchiveSiblingPath, ] as const; @@ -122,11 +122,11 @@ export class RootRollupPublicInputs { /** * Snapshot of the L1 to L2 message tree at the start of the rollup. */ - public startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, + public startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, /** * Snapshot of the L1 to L2 message tree at the end of the rollup. */ - public endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, + public endL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, /** * Snapshot of the blocks tree roots tree at the start of the rollup. @@ -159,8 +159,8 @@ export class RootRollupPublicInputs { fields.endContractTreeSnapshot, fields.startPublicDataTreeSnapshot, fields.endPublicDataTreeSnapshot, - fields.startL1ToL2MessagesTreeSnapshot, - fields.endL1ToL2MessagesTreeSnapshot, + fields.startL1ToL2MessageTreeSnapshot, + fields.endL1ToL2MessageTreeSnapshot, fields.startArchiveSnapshot, fields.endArchiveSnapshot, fields.calldataHash, diff --git a/yarn-project/circuits.js/src/tests/factories.ts b/yarn-project/circuits.js/src/tests/factories.ts index 15131f04e31..1fa052237e0 100644 --- a/yarn-project/circuits.js/src/tests/factories.ts +++ b/yarn-project/circuits.js/src/tests/factories.ts @@ -884,8 +884,8 @@ export function makeRootRollupPublicInputs( endContractTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), startPublicDataTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), endPublicDataTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), - startL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), - endL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), + startL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), + endL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), startArchiveSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), endArchiveSnapshot: makeAppendOnlyTreeSnapshot((seed += 0x100)), calldataHash: [new Fr(1n), new Fr(2n)], diff --git a/yarn-project/noir-protocol-circuits/src/__snapshots__/index.test.ts.snap b/yarn-project/noir-protocol-circuits/src/__snapshots__/index.test.ts.snap index b5a6325e15c..914862b4c8b 100644 --- a/yarn-project/noir-protocol-circuits/src/__snapshots__/index.test.ts.snap +++ b/yarn-project/noir-protocol-circuits/src/__snapshots__/index.test.ts.snap @@ -224,7 +224,7 @@ KernelCircuitPublicInputs { "type": "Buffer", }, }, - "l1ToL2MessagesTreeRoot": Fr { + "l1ToL2MessageTreeRoot": Fr { "asBigInt": 11033938207523021649122316027295742559227608161317650429835019071130941169536n, "asBuffer": { "data": [ @@ -32748,7 +32748,7 @@ KernelCircuitPublicInputs { "type": "Buffer", }, }, - "l1ToL2MessagesTreeRoot": Fr { + "l1ToL2MessageTreeRoot": Fr { "asBigInt": 11033938207523021649122316027295742559227608161317650429835019071130941169536n, "asBuffer": { "data": [ @@ -65272,7 +65272,7 @@ KernelCircuitPublicInputsFinal { "type": "Buffer", }, }, - "l1ToL2MessagesTreeRoot": Fr { + "l1ToL2MessageTreeRoot": Fr { "asBigInt": 11033938207523021649122316027295742559227608161317650429835019071130941169536n, "asBuffer": { "data": [ diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr index 76ddcde1060..8a0ed2193a8 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/hash.nr @@ -6,11 +6,11 @@ pub fn compute_block_hash_with_globals( note_hash_tree_root: Field, nullifier_tree_root: Field, contract_tree_root: Field, - l1_to_l2_messages_tree_root: Field, + l1_to_l2_message_tree_root: Field, public_data_tree_root: Field ) -> Field { let inputs = [ - globals.hash(), note_hash_tree_root, nullifier_tree_root, contract_tree_root, l1_to_l2_messages_tree_root, public_data_tree_root + globals.hash(), note_hash_tree_root, nullifier_tree_root, contract_tree_root, l1_to_l2_message_tree_root, public_data_tree_root ]; dep::std::hash::pedersen_hash_with_separator(inputs, GENERATOR_INDEX__BLOCK_HASH) diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr index f8937f2dada..ad73ed6ab21 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root.nr @@ -26,9 +26,9 @@ impl RootRollupInputs { // Insert subtree into the l1 to l2 data tree let empty_l1_to_l2_subtree_root = calculate_empty_tree_root(L1_TO_L2_MSG_SUBTREE_HEIGHT); - let new_l1_to_l2_messages_tree_snapshot = components::insert_subtree_to_snapshot_tree( - self.start_l1_to_l2_messages_tree_snapshot, - self.new_l1_to_l2_messages_tree_root_sibling_path, + let new_l1_to_l2_message_tree_snapshot = components::insert_subtree_to_snapshot_tree( + self.start_l1_to_l2_message_tree_snapshot, + self.new_l1_to_l2_message_tree_root_sibling_path, empty_l1_to_l2_subtree_root, l1_to_l2_subtree_root, // TODO(Kev): For now we can add a test that this fits inside of @@ -42,7 +42,7 @@ impl RootRollupInputs { right.end_note_hash_tree_snapshot.root, right.end_nullifier_tree_snapshot.root, right.end_contract_tree_snapshot.root, - new_l1_to_l2_messages_tree_snapshot.root, + new_l1_to_l2_message_tree_snapshot.root, right.end_public_data_tree_snapshot.root); // Update the archive @@ -70,8 +70,8 @@ impl RootRollupInputs { end_contract_tree_snapshot : right.end_contract_tree_snapshot, start_public_data_tree_snapshot : left.start_public_data_tree_snapshot, end_public_data_tree_snapshot : right.end_public_data_tree_snapshot, - start_l1_to_l2_messages_tree_snapshot : self.start_l1_to_l2_messages_tree_snapshot, - end_l1_to_l2_messages_tree_snapshot : new_l1_to_l2_messages_tree_snapshot, + start_l1_to_l2_message_tree_snapshot : self.start_l1_to_l2_message_tree_snapshot, + end_l1_to_l2_message_tree_snapshot : new_l1_to_l2_message_tree_snapshot, start_archive_snapshot : self.start_archive_snapshot, end_archive_snapshot : end_archive_snapshot, calldata_hash : components::compute_calldata_hash(self.previous_rollup_data), diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr index 2df3c4a6d71..791ef29b7c5 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_inputs.nr @@ -17,9 +17,9 @@ struct RootRollupInputs { // inputs required to process l1 to l2 messages new_l1_to_l2_messages : [Field; NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP], - new_l1_to_l2_messages_tree_root_sibling_path : [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], + new_l1_to_l2_message_tree_root_sibling_path : [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH], - start_l1_to_l2_messages_tree_snapshot : AppendOnlyTreeSnapshot, + start_l1_to_l2_message_tree_snapshot : AppendOnlyTreeSnapshot, // inputs required to add the block hash start_archive_snapshot : AppendOnlyTreeSnapshot, diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr index c8cf7f30a2d..3446eaef1a6 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/root/root_rollup_public_inputs.nr @@ -27,8 +27,8 @@ struct RootRollupPublicInputs { start_public_data_tree_snapshot : AppendOnlyTreeSnapshot, end_public_data_tree_snapshot : AppendOnlyTreeSnapshot, - start_l1_to_l2_messages_tree_snapshot : AppendOnlyTreeSnapshot, - end_l1_to_l2_messages_tree_snapshot : AppendOnlyTreeSnapshot, + start_l1_to_l2_message_tree_snapshot : AppendOnlyTreeSnapshot, + end_l1_to_l2_message_tree_snapshot : AppendOnlyTreeSnapshot, start_archive_snapshot : AppendOnlyTreeSnapshot, end_archive_snapshot : AppendOnlyTreeSnapshot, diff --git a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr index dc5e3668f71..bedce518ae5 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/rollup-lib/src/tests/root_rollup_inputs.nr @@ -15,15 +15,15 @@ use crate::tests::merkle_tree_utils::compute_zero_hashes; pub fn compute_l1_l2_empty_snapshot() -> (AppendOnlyTreeSnapshot, [Field; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]) { let zero_hashes = compute_zero_hashes([0; L1_TO_L2_MSG_TREE_HEIGHT]); - let mut new_l1_to_l2_messages_tree_root_sibling_path = [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]; + let mut new_l1_to_l2_message_tree_root_sibling_path = [0; L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH]; for i in 0..L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH { let index = L1_TO_L2_MSG_SUBTREE_HEIGHT + i - 1; - new_l1_to_l2_messages_tree_root_sibling_path[i] = zero_hashes[index]; + new_l1_to_l2_message_tree_root_sibling_path[i] = zero_hashes[index]; } ( - AppendOnlyTreeSnapshot { root: zero_hashes[zero_hashes.len() - 1], next_available_leaf_index: 0 }, new_l1_to_l2_messages_tree_root_sibling_path + AppendOnlyTreeSnapshot { root: zero_hashes[zero_hashes.len() - 1], next_available_leaf_index: 0 }, new_l1_to_l2_message_tree_root_sibling_path ) } @@ -42,8 +42,8 @@ pub fn default_root_rollup_inputs() -> RootRollupInputs { let mut inputs: RootRollupInputs = dep::std::unsafe::zeroed(); let (l1_l2_empty_snapshot, l1_l2_empty_sibling_path) = compute_l1_l2_empty_snapshot(); - inputs.new_l1_to_l2_messages_tree_root_sibling_path = l1_l2_empty_sibling_path; - inputs.start_l1_to_l2_messages_tree_snapshot = l1_l2_empty_snapshot; + inputs.new_l1_to_l2_message_tree_root_sibling_path = l1_l2_empty_sibling_path; + inputs.start_l1_to_l2_message_tree_snapshot = l1_l2_empty_snapshot; let (blocks_snapshot, blocks_sibling_path) = compute_archive_snapshot(); diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/block_header.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/block_header.nr index abcee907241..78218b09f3f 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/block_header.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/abis/block_header.nr @@ -11,7 +11,7 @@ struct BlockHeader { note_hash_tree_root : Field, nullifier_tree_root : Field, contract_tree_root : Field, - l1_to_l2_messages_tree_root : Field, + l1_to_l2_message_tree_root : Field, archive_root: Field, public_data_tree_root: Field, global_variables_hash: Field, @@ -23,7 +23,7 @@ impl BlockHeader { assert(self.note_hash_tree_root == 0); assert(self.nullifier_tree_root == 0); assert(self.contract_tree_root == 0); - assert(self.l1_to_l2_messages_tree_root == 0); + assert(self.l1_to_l2_message_tree_root == 0); assert(self.archive_root == 0); assert(self.public_data_tree_root == 0); } @@ -37,7 +37,7 @@ impl BlockHeader { self.note_hash_tree_root, self.nullifier_tree_root, self.contract_tree_root, - self.l1_to_l2_messages_tree_root, + self.l1_to_l2_message_tree_root, self.archive_root, self.public_data_tree_root, self.global_variables_hash @@ -49,7 +49,7 @@ impl BlockHeader { note_hash_tree_root: deserialized[0], nullifier_tree_root: deserialized[1], contract_tree_root: deserialized[2], - l1_to_l2_messages_tree_root: deserialized[3], + l1_to_l2_message_tree_root: deserialized[3], archive_root: deserialized[4], public_data_tree_root: deserialized[5], global_variables_hash: deserialized[6], @@ -73,7 +73,7 @@ impl BlockHeader { self.note_hash_tree_root, self.nullifier_tree_root, self.contract_tree_root, - self.l1_to_l2_messages_tree_root, + self.l1_to_l2_message_tree_root, self.public_data_tree_root, ], GENERATOR_INDEX__BLOCK_HASH) } diff --git a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures.nr b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures.nr index b499d6b1051..39f729e7032 100644 --- a/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures.nr +++ b/yarn-project/noir-protocol-circuits/src/crates/types/src/tests/fixtures.nr @@ -17,7 +17,7 @@ global BLOCK_HEADER = BlockHeader { note_hash_tree_root: fixtures::note_hash_tree::ROOT, nullifier_tree_root: 0, contract_tree_root: fixtures::contract_tree::ROOT, - l1_to_l2_messages_tree_root: 0, + l1_to_l2_message_tree_root: 0, archive_root: 0, public_data_tree_root: 0, global_variables_hash: 0, diff --git a/yarn-project/noir-protocol-circuits/src/type_conversion.ts b/yarn-project/noir-protocol-circuits/src/type_conversion.ts index ae18fef11c1..4a250ab6eec 100644 --- a/yarn-project/noir-protocol-circuits/src/type_conversion.ts +++ b/yarn-project/noir-protocol-circuits/src/type_conversion.ts @@ -510,7 +510,7 @@ export function mapBlockHeaderToNoir(blockHeader: BlockHeader): BlockHeaderNoir note_hash_tree_root: mapFieldToNoir(blockHeader.noteHashTreeRoot), nullifier_tree_root: mapFieldToNoir(blockHeader.nullifierTreeRoot), contract_tree_root: mapFieldToNoir(blockHeader.contractTreeRoot), - l1_to_l2_messages_tree_root: mapFieldToNoir(blockHeader.l1ToL2MessagesTreeRoot), + l1_to_l2_message_tree_root: mapFieldToNoir(blockHeader.l1ToL2MessageTreeRoot), archive_root: mapFieldToNoir(blockHeader.archiveRoot), public_data_tree_root: mapFieldToNoir(blockHeader.publicDataTreeRoot), global_variables_hash: mapFieldToNoir(blockHeader.globalVariablesHash), @@ -528,7 +528,7 @@ export function mapBlockHeaderFromNoir(blockHeader: BlockHeaderNoir): BlockHeade mapFieldFromNoir(blockHeader.note_hash_tree_root), mapFieldFromNoir(blockHeader.nullifier_tree_root), mapFieldFromNoir(blockHeader.contract_tree_root), - mapFieldFromNoir(blockHeader.l1_to_l2_messages_tree_root), + mapFieldFromNoir(blockHeader.l1_to_l2_message_tree_root), mapFieldFromNoir(blockHeader.archive_root), Fr.zero(), // TODO(#3441) mapFieldFromNoir(blockHeader.public_data_tree_root), @@ -1294,12 +1294,12 @@ export function mapRootRollupInputsToNoir(rootRollupInputs: RootRollupInputs): R return { previous_rollup_data: mapTuple(rootRollupInputs.previousRollupData, mapPreviousRollupDataToNoir), new_l1_to_l2_messages: mapTuple(rootRollupInputs.newL1ToL2Messages, mapFieldToNoir), - new_l1_to_l2_messages_tree_root_sibling_path: mapTuple( - rootRollupInputs.newL1ToL2MessagesTreeRootSiblingPath, + new_l1_to_l2_message_tree_root_sibling_path: mapTuple( + rootRollupInputs.newL1ToL2MessageTreeRootSiblingPath, mapFieldToNoir, ), - start_l1_to_l2_messages_tree_snapshot: mapAppendOnlyTreeSnapshotToNoir( - rootRollupInputs.startL1ToL2MessagesTreeSnapshot, + start_l1_to_l2_message_tree_snapshot: mapAppendOnlyTreeSnapshotToNoir( + rootRollupInputs.startL1ToL2MessageTreeSnapshot, ), start_archive_snapshot: mapAppendOnlyTreeSnapshotToNoir(rootRollupInputs.startArchiveSnapshot), new_archive_sibling_path: mapTuple(rootRollupInputs.newArchiveSiblingPath, mapFieldToNoir), @@ -1325,8 +1325,8 @@ export function mapRootRollupPublicInputsFromNoir( mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_contract_tree_snapshot), mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_public_data_tree_snapshot), mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_public_data_tree_snapshot), - mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_l1_to_l2_messages_tree_snapshot), - mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_l1_to_l2_messages_tree_snapshot), + mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_l1_to_l2_message_tree_snapshot), + mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_l1_to_l2_message_tree_snapshot), mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.start_archive_snapshot), mapAppendOnlyTreeSnapshotFromNoir(rootRollupPublicInputs.end_archive_snapshot), mapTupleFromNoir(rootRollupPublicInputs.calldata_hash, 2, mapFieldFromNoir), diff --git a/yarn-project/noir-protocol-circuits/src/types/private_kernel_init_types.ts b/yarn-project/noir-protocol-circuits/src/types/private_kernel_init_types.ts index 7136810817f..014514bdbd2 100644 --- a/yarn-project/noir-protocol-circuits/src/types/private_kernel_init_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/private_kernel_init_types.ts @@ -81,7 +81,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/private_kernel_inner_types.ts b/yarn-project/noir-protocol-circuits/src/types/private_kernel_inner_types.ts index f7cc09a9a8a..3305c67df49 100644 --- a/yarn-project/noir-protocol-circuits/src/types/private_kernel_inner_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/private_kernel_inner_types.ts @@ -102,7 +102,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/private_kernel_ordering_types.ts b/yarn-project/noir-protocol-circuits/src/types/private_kernel_ordering_types.ts index a8be9f52b73..b26501d646b 100644 --- a/yarn-project/noir-protocol-circuits/src/types/private_kernel_ordering_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/private_kernel_ordering_types.ts @@ -102,7 +102,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/public_kernel_private_previous_types.ts b/yarn-project/noir-protocol-circuits/src/types/public_kernel_private_previous_types.ts index e1d22f2a387..9b5836579b1 100644 --- a/yarn-project/noir-protocol-circuits/src/types/public_kernel_private_previous_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/public_kernel_private_previous_types.ts @@ -102,7 +102,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/public_kernel_public_previous_types.ts b/yarn-project/noir-protocol-circuits/src/types/public_kernel_public_previous_types.ts index 15846483a46..3be8bcf5fa4 100644 --- a/yarn-project/noir-protocol-circuits/src/types/public_kernel_public_previous_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/public_kernel_public_previous_types.ts @@ -102,7 +102,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/rollup_base_types.ts b/yarn-project/noir-protocol-circuits/src/types/rollup_base_types.ts index 0bb0ed9ddec..5958cb3e182 100644 --- a/yarn-project/noir-protocol-circuits/src/types/rollup_base_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/rollup_base_types.ts @@ -102,7 +102,7 @@ export interface BlockHeader { note_hash_tree_root: Field; nullifier_tree_root: Field; contract_tree_root: Field; - l1_to_l2_messages_tree_root: Field; + l1_to_l2_message_tree_root: Field; archive_root: Field; public_data_tree_root: Field; global_variables_hash: Field; diff --git a/yarn-project/noir-protocol-circuits/src/types/rollup_root_types.ts b/yarn-project/noir-protocol-circuits/src/types/rollup_root_types.ts index 550b57bc13e..ef8427a33e6 100644 --- a/yarn-project/noir-protocol-circuits/src/types/rollup_root_types.ts +++ b/yarn-project/noir-protocol-circuits/src/types/rollup_root_types.ts @@ -66,8 +66,8 @@ export interface PreviousRollupData { export interface RootRollupInputs { previous_rollup_data: FixedLengthArray; new_l1_to_l2_messages: FixedLengthArray; - new_l1_to_l2_messages_tree_root_sibling_path: FixedLengthArray; - start_l1_to_l2_messages_tree_snapshot: AppendOnlyTreeSnapshot; + new_l1_to_l2_message_tree_root_sibling_path: FixedLengthArray; + start_l1_to_l2_message_tree_snapshot: AppendOnlyTreeSnapshot; start_archive_snapshot: AppendOnlyTreeSnapshot; new_archive_sibling_path: FixedLengthArray; } @@ -83,8 +83,8 @@ export interface RootRollupPublicInputs { end_contract_tree_snapshot: AppendOnlyTreeSnapshot; start_public_data_tree_snapshot: AppendOnlyTreeSnapshot; end_public_data_tree_snapshot: AppendOnlyTreeSnapshot; - start_l1_to_l2_messages_tree_snapshot: AppendOnlyTreeSnapshot; - end_l1_to_l2_messages_tree_snapshot: AppendOnlyTreeSnapshot; + start_l1_to_l2_message_tree_snapshot: AppendOnlyTreeSnapshot; + end_l1_to_l2_message_tree_snapshot: AppendOnlyTreeSnapshot; start_archive_snapshot: AppendOnlyTreeSnapshot; end_archive_snapshot: AppendOnlyTreeSnapshot; calldata_hash: FixedLengthArray; diff --git a/yarn-project/pxe/src/database/kv_pxe_database.ts b/yarn-project/pxe/src/database/kv_pxe_database.ts index 9c8768ad904..402599f7d83 100644 --- a/yarn-project/pxe/src/database/kv_pxe_database.ts +++ b/yarn-project/pxe/src/database/kv_pxe_database.ts @@ -186,7 +186,7 @@ export class KVPxeDatabase implements PxeDatabase { return { [MerkleTreeId.ARCHIVE]: Fr.fromString(roots[MerkleTreeId.ARCHIVE]), [MerkleTreeId.CONTRACT_TREE]: Fr.fromString(roots[MerkleTreeId.CONTRACT_TREE].toString()), - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: Fr.fromString(roots[MerkleTreeId.L1_TO_L2_MESSAGES_TREE].toString()), + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: Fr.fromString(roots[MerkleTreeId.L1_TO_L2_MESSAGE_TREE].toString()), [MerkleTreeId.NOTE_HASH_TREE]: Fr.fromString(roots[MerkleTreeId.NOTE_HASH_TREE].toString()), [MerkleTreeId.PUBLIC_DATA_TREE]: Fr.fromString(roots[MerkleTreeId.PUBLIC_DATA_TREE].toString()), [MerkleTreeId.NULLIFIER_TREE]: Fr.fromString(roots[MerkleTreeId.NULLIFIER_TREE].toString()), @@ -201,7 +201,7 @@ export class KVPxeDatabase implements PxeDatabase { [MerkleTreeId.NOTE_HASH_TREE]: blockHeader.noteHashTreeRoot.toString(), [MerkleTreeId.NULLIFIER_TREE]: blockHeader.nullifierTreeRoot.toString(), [MerkleTreeId.CONTRACT_TREE]: blockHeader.contractTreeRoot.toString(), - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: blockHeader.l1ToL2MessagesTreeRoot.toString(), + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: blockHeader.l1ToL2MessageTreeRoot.toString(), [MerkleTreeId.ARCHIVE]: blockHeader.archiveRoot.toString(), [MerkleTreeId.PUBLIC_DATA_TREE]: blockHeader.publicDataTreeRoot.toString(), }, @@ -222,7 +222,7 @@ export class KVPxeDatabase implements PxeDatabase { Fr.fromString(value.roots[MerkleTreeId.NOTE_HASH_TREE]), Fr.fromString(value.roots[MerkleTreeId.NULLIFIER_TREE]), Fr.fromString(value.roots[MerkleTreeId.CONTRACT_TREE]), - Fr.fromString(value.roots[MerkleTreeId.L1_TO_L2_MESSAGES_TREE]), + Fr.fromString(value.roots[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]), Fr.fromString(value.roots[MerkleTreeId.ARCHIVE]), Fr.ZERO, // todo: private kernel vk tree root Fr.fromString(value.roots[MerkleTreeId.PUBLIC_DATA_TREE]), diff --git a/yarn-project/pxe/src/database/memory_db.ts b/yarn-project/pxe/src/database/memory_db.ts index 2cacfd651b9..e06ef3e8a5b 100644 --- a/yarn-project/pxe/src/database/memory_db.ts +++ b/yarn-project/pxe/src/database/memory_db.ts @@ -128,7 +128,7 @@ export class MemoryDB extends MemoryContractDatabase implements PxeDatabase { roots[MerkleTreeId.NOTE_HASH_TREE], roots[MerkleTreeId.NULLIFIER_TREE], roots[MerkleTreeId.CONTRACT_TREE], - roots[MerkleTreeId.L1_TO_L2_MESSAGES_TREE], + roots[MerkleTreeId.L1_TO_L2_MESSAGE_TREE], roots[MerkleTreeId.ARCHIVE], Fr.ZERO, // todo: private kernel vk tree root roots[MerkleTreeId.PUBLIC_DATA_TREE], @@ -143,7 +143,7 @@ export class MemoryDB extends MemoryContractDatabase implements PxeDatabase { [MerkleTreeId.NOTE_HASH_TREE]: blockHeader.noteHashTreeRoot, [MerkleTreeId.NULLIFIER_TREE]: blockHeader.nullifierTreeRoot, [MerkleTreeId.CONTRACT_TREE]: blockHeader.contractTreeRoot, - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: blockHeader.l1ToL2MessagesTreeRoot, + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: blockHeader.l1ToL2MessageTreeRoot, [MerkleTreeId.ARCHIVE]: blockHeader.archiveRoot, [MerkleTreeId.PUBLIC_DATA_TREE]: blockHeader.publicDataTreeRoot, }); diff --git a/yarn-project/pxe/src/database/pxe_database_test_suite.ts b/yarn-project/pxe/src/database/pxe_database_test_suite.ts index 9f705256b9d..5726dd293cd 100644 --- a/yarn-project/pxe/src/database/pxe_database_test_suite.ts +++ b/yarn-project/pxe/src/database/pxe_database_test_suite.ts @@ -166,7 +166,7 @@ export function describePxeDatabase(getDatabase: () => PxeDatabase) { [MerkleTreeId.NOTE_HASH_TREE]: blockHeader.noteHashTreeRoot, [MerkleTreeId.NULLIFIER_TREE]: blockHeader.nullifierTreeRoot, [MerkleTreeId.CONTRACT_TREE]: blockHeader.contractTreeRoot, - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: blockHeader.l1ToL2MessagesTreeRoot, + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: blockHeader.l1ToL2MessageTreeRoot, [MerkleTreeId.ARCHIVE]: blockHeader.archiveRoot, [MerkleTreeId.PUBLIC_DATA_TREE]: blockHeader.publicDataTreeRoot, }); diff --git a/yarn-project/pxe/src/simulator_oracle/index.ts b/yarn-project/pxe/src/simulator_oracle/index.ts index f228aa8fe8c..0d97403040f 100644 --- a/yarn-project/pxe/src/simulator_oracle/index.ts +++ b/yarn-project/pxe/src/simulator_oracle/index.ts @@ -116,7 +116,7 @@ export class SimulatorOracle implements DBOracle { * * @param msgKey - The key of the message to be retrieved * @returns A promise that resolves to the message data, a sibling path and the - * index of the message in the l1ToL2MessagesTree + * index of the message in the l1ToL2MessageTree */ async getL1ToL2Message(msgKey: Fr): Promise { const messageAndIndex = await this.stateInfoProvider.getL1ToL2MessageAndIndex(msgKey); diff --git a/yarn-project/pxe/src/synchronizer/synchronizer.test.ts b/yarn-project/pxe/src/synchronizer/synchronizer.test.ts index 5270b0d7d1e..36f9202588a 100644 --- a/yarn-project/pxe/src/synchronizer/synchronizer.test.ts +++ b/yarn-project/pxe/src/synchronizer/synchronizer.test.ts @@ -25,7 +25,7 @@ describe('Synchronizer', () => { [MerkleTreeId.NOTE_HASH_TREE]: blockHeader.noteHashTreeRoot, [MerkleTreeId.NULLIFIER_TREE]: blockHeader.nullifierTreeRoot, [MerkleTreeId.PUBLIC_DATA_TREE]: blockHeader.publicDataTreeRoot, - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE]: blockHeader.l1ToL2MessagesTreeRoot, + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: blockHeader.l1ToL2MessageTreeRoot, [MerkleTreeId.ARCHIVE]: blockHeader.archiveRoot, }; diff --git a/yarn-project/pxe/src/synchronizer/synchronizer.ts b/yarn-project/pxe/src/synchronizer/synchronizer.ts index 434b7de0c91..61257d01047 100644 --- a/yarn-project/pxe/src/synchronizer/synchronizer.ts +++ b/yarn-project/pxe/src/synchronizer/synchronizer.ts @@ -201,7 +201,7 @@ export class Synchronizer { block.endNoteHashTreeSnapshot.root, block.endNullifierTreeSnapshot.root, block.endContractTreeSnapshot.root, - block.endL1ToL2MessagesTreeSnapshot.root, + block.endL1ToL2MessageTreeSnapshot.root, block.endArchiveSnapshot.root, Fr.ZERO, // todo: private kernel vk tree root block.endPublicDataTreeSnapshot.root, diff --git a/yarn-project/run_nargo_fmt.sh b/yarn-project/run_nargo_fmt.sh index 03642a32a23..f1cd5033a69 100755 --- a/yarn-project/run_nargo_fmt.sh +++ b/yarn-project/run_nargo_fmt.sh @@ -3,7 +3,7 @@ # Note: This script formats the files multiple times when the given project is included in a workspace. # Tackling this became a time sink, so I decided to leave it as is for now. -set -eu +set -e # We set the executable path as if we were in CI nargo_executable="/usr/src/noir/target/release/nargo" diff --git a/yarn-project/sequencer-client/src/block_builder/solo_block_builder.test.ts b/yarn-project/sequencer-client/src/block_builder/solo_block_builder.test.ts index 109244aaec1..91051118cbb 100644 --- a/yarn-project/sequencer-client/src/block_builder/solo_block_builder.test.ts +++ b/yarn-project/sequencer-client/src/block_builder/solo_block_builder.test.ts @@ -150,9 +150,9 @@ describe('sequencer/solo_block_builder', () => { } }; - const updateL1ToL2MessagesTree = async (l1ToL2Messages: Fr[]) => { + const updateL1ToL2MessageTree = async (l1ToL2Messages: Fr[]) => { const asBuffer = l1ToL2Messages.map(m => m.toBuffer()); - await expectsDb.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, asBuffer); + await expectsDb.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, asBuffer); }; const updateArchive = async () => { @@ -161,7 +161,7 @@ describe('sequencer/solo_block_builder', () => { rootRollupOutput.endNoteHashTreeSnapshot.root, rootRollupOutput.endNullifierTreeSnapshot.root, rootRollupOutput.endContractTreeSnapshot.root, - rootRollupOutput.endL1ToL2MessagesTreeSnapshot.root, + rootRollupOutput.endL1ToL2MessageTreeSnapshot.root, rootRollupOutput.endPublicDataTreeSnapshot.root, ); await expectsDb.appendLeaves(MerkleTreeId.ARCHIVE, [blockHash.toBuffer()]); @@ -205,13 +205,13 @@ describe('sequencer/solo_block_builder', () => { // Update l1 to l2 data tree // And update the root trees now to create proper output to the root rollup circuit - await updateL1ToL2MessagesTree(mockL1ToL2Messages); + await updateL1ToL2MessageTree(mockL1ToL2Messages); rootRollupOutput.endContractTreeSnapshot = await getTreeSnapshot(MerkleTreeId.CONTRACT_TREE); rootRollupOutput.endNullifierTreeSnapshot = await getTreeSnapshot(MerkleTreeId.NULLIFIER_TREE); rootRollupOutput.endNoteHashTreeSnapshot = await getTreeSnapshot(MerkleTreeId.NOTE_HASH_TREE); rootRollupOutput.endPublicDataTreeSnapshot = await getTreeSnapshot(MerkleTreeId.PUBLIC_DATA_TREE); - rootRollupOutput.endL1ToL2MessagesTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE); + rootRollupOutput.endL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE); // Calculate block hash rootRollupOutput.globalVariables = globalVariables; @@ -242,8 +242,8 @@ describe('sequencer/solo_block_builder', () => { endContractTreeSnapshot: rootRollupOutput.endContractTreeSnapshot, startPublicDataTreeSnapshot: rootRollupOutput.startPublicDataTreeSnapshot, endPublicDataTreeSnapshot: rootRollupOutput.endPublicDataTreeSnapshot, - startL1ToL2MessagesTreeSnapshot: rootRollupOutput.startL1ToL2MessagesTreeSnapshot, - endL1ToL2MessagesTreeSnapshot: rootRollupOutput.endL1ToL2MessagesTreeSnapshot, + startL1ToL2MessageTreeSnapshot: rootRollupOutput.startL1ToL2MessageTreeSnapshot, + endL1ToL2MessageTreeSnapshot: rootRollupOutput.endL1ToL2MessageTreeSnapshot, startArchiveSnapshot: rootRollupOutput.startArchiveSnapshot, endArchiveSnapshot: rootRollupOutput.endArchiveSnapshot, newCommitments: newCommitments.map((sideeffect: SideEffect) => sideeffect.value), diff --git a/yarn-project/sequencer-client/src/block_builder/solo_block_builder.ts b/yarn-project/sequencer-client/src/block_builder/solo_block_builder.ts index f612fc00432..51e0fca0395 100644 --- a/yarn-project/sequencer-client/src/block_builder/solo_block_builder.ts +++ b/yarn-project/sequencer-client/src/block_builder/solo_block_builder.ts @@ -112,7 +112,7 @@ export class SoloBlockBuilder implements BlockBuilder { MerkleTreeId.NULLIFIER_TREE, MerkleTreeId.CONTRACT_TREE, MerkleTreeId.PUBLIC_DATA_TREE, - MerkleTreeId.L1_TO_L2_MESSAGES_TREE, + MerkleTreeId.L1_TO_L2_MESSAGE_TREE, MerkleTreeId.ARCHIVE, ].map(tree => this.getTreeSnapshot(tree)), ); @@ -128,7 +128,7 @@ export class SoloBlockBuilder implements BlockBuilder { endNullifierTreeSnapshot, endContractTreeSnapshot, endPublicDataTreeSnapshot, - endL1ToL2MessagesTreeSnapshot, + endL1ToL2MessageTreeSnapshot, endArchiveSnapshot, } = circuitsOutput; @@ -167,8 +167,8 @@ export class SoloBlockBuilder implements BlockBuilder { endContractTreeSnapshot, startPublicDataTreeSnapshot, endPublicDataTreeSnapshot, - startL1ToL2MessagesTreeSnapshot: startL1ToL2MessageTreeSnapshot, - endL1ToL2MessagesTreeSnapshot, + startL1ToL2MessageTreeSnapshot: startL1ToL2MessageTreeSnapshot, + endL1ToL2MessageTreeSnapshot, startArchiveSnapshot, endArchiveSnapshot, newCommitments: newCommitments.map((c: SideEffect) => c.value), @@ -199,7 +199,7 @@ export class SoloBlockBuilder implements BlockBuilder { 'noteHashTreeRoot', 'contractTreeRoot', 'nullifierTreeRoot', - 'l1ToL2MessagesTreeRoot', + 'l1ToL2MessageTreeRoot', ] as const) { if (tx.data.constants.blockHeader[historicalTreeRoot].isZero()) { throw new Error(`Empty ${historicalTreeRoot} for tx: ${toFriendlyJSON(tx)}`); @@ -299,7 +299,7 @@ export class SoloBlockBuilder implements BlockBuilder { // Update the local trees to include the new l1 to l2 messages await this.db.appendLeaves( - MerkleTreeId.L1_TO_L2_MESSAGES_TREE, + MerkleTreeId.L1_TO_L2_MESSAGE_TREE, newL1ToL2Messages.map(m => m.toBuffer()), ); @@ -334,7 +334,7 @@ export class SoloBlockBuilder implements BlockBuilder { MerkleTreeId.NULLIFIER_TREE, MerkleTreeId.CONTRACT_TREE, MerkleTreeId.PUBLIC_DATA_TREE, - MerkleTreeId.L1_TO_L2_MESSAGES_TREE, + MerkleTreeId.L1_TO_L2_MESSAGE_TREE, ].map(tree => this.getTreeSnapshot(tree)), ) ).map(r => r.root); @@ -365,7 +365,7 @@ export class SoloBlockBuilder implements BlockBuilder { await Promise.all([ this.validateTrees(rootOutput), this.validateTree(rootOutput, MerkleTreeId.ARCHIVE, 'Archive'), - this.validateTree(rootOutput, MerkleTreeId.L1_TO_L2_MESSAGES_TREE, 'L1ToL2MessagesTree'), + this.validateTree(rootOutput, MerkleTreeId.L1_TO_L2_MESSAGE_TREE, 'L1ToL2MessageTree'), ]); } @@ -425,20 +425,20 @@ export class SoloBlockBuilder implements BlockBuilder { return path.toFieldArray(); }; - const newL1ToL2MessagesTreeRootSiblingPathArray = await this.getSubtreeSiblingPath( - MerkleTreeId.L1_TO_L2_MESSAGES_TREE, + const newL1ToL2MessageTreeRootSiblingPathArray = await this.getSubtreeSiblingPath( + MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, ); - const newL1ToL2MessagesTreeRootSiblingPath = makeTuple( + const newL1ToL2MessageTreeRootSiblingPath = makeTuple( L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, i => - i < newL1ToL2MessagesTreeRootSiblingPathArray.length ? newL1ToL2MessagesTreeRootSiblingPathArray[i] : Fr.ZERO, + i < newL1ToL2MessageTreeRootSiblingPathArray.length ? newL1ToL2MessageTreeRootSiblingPathArray[i] : Fr.ZERO, 0, ); // Get tree snapshots - const startL1ToL2MessagesTreeSnapshot = await this.getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE); + const startL1ToL2MessageTreeSnapshot = await this.getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE); // Get blocks tree const startArchiveSnapshot = await this.getTreeSnapshot(MerkleTreeId.ARCHIVE); @@ -453,8 +453,8 @@ export class SoloBlockBuilder implements BlockBuilder { return RootRollupInputs.from({ previousRollupData, newL1ToL2Messages, - newL1ToL2MessagesTreeRootSiblingPath, - startL1ToL2MessagesTreeSnapshot, + newL1ToL2MessageTreeRootSiblingPath, + startL1ToL2MessageTreeSnapshot, startArchiveSnapshot, newArchiveSiblingPath, }); @@ -515,14 +515,14 @@ export class SoloBlockBuilder implements BlockBuilder { protected getHistoricalTreesMembershipWitnessFor(tx: ProcessedTx) { const blockHeader = tx.data.constants.blockHeader; - const { noteHashTreeRoot, nullifierTreeRoot, contractTreeRoot, l1ToL2MessagesTreeRoot, publicDataTreeRoot } = + const { noteHashTreeRoot, nullifierTreeRoot, contractTreeRoot, l1ToL2MessageTreeRoot, publicDataTreeRoot } = blockHeader; const blockHash = computeBlockHash( blockHeader.globalVariablesHash, noteHashTreeRoot, nullifierTreeRoot, contractTreeRoot, - l1ToL2MessagesTreeRoot, + l1ToL2MessageTreeRoot, publicDataTreeRoot, ); return this.getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT); diff --git a/yarn-project/sequencer-client/src/block_builder/types.ts b/yarn-project/sequencer-client/src/block_builder/types.ts index 9f1715febb7..caf3ff47c94 100644 --- a/yarn-project/sequencer-client/src/block_builder/types.ts +++ b/yarn-project/sequencer-client/src/block_builder/types.ts @@ -7,7 +7,7 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public /** * Type representing the names of the trees. */ -export type TreeNames = BaseTreeNames | 'L1ToL2MessagesTree' | 'Archive'; +export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive'; /** * Type to assert that only the correct trees are checked when validating rollup tree outputs. diff --git a/yarn-project/sequencer-client/src/sequencer/utils.ts b/yarn-project/sequencer-client/src/sequencer/utils.ts index d315146837f..bf02db4c98f 100644 --- a/yarn-project/sequencer-client/src/sequencer/utils.ts +++ b/yarn-project/sequencer-client/src/sequencer/utils.ts @@ -3,7 +3,7 @@ import { computeGlobalsHash } from '@aztec/circuits.js/abis'; import { MerkleTreeOperations } from '@aztec/world-state'; /** - * Fetches the private, nullifier, contract tree and l1 to l2 messages tree roots from a given db and assembles a CombinedHistoricalTreeRoots object. + * Fetches the private, nullifier, contract tree and l1 to l2 message tree roots from a given db and assembles a CombinedHistoricalTreeRoots object. */ export async function getBlockHeader( db: MerkleTreeOperations, @@ -16,7 +16,7 @@ export async function getBlockHeader( Fr.fromBuffer(roots.noteHashTreeRoot), Fr.fromBuffer(roots.nullifierTreeRoot), Fr.fromBuffer(roots.contractDataTreeRoot), - Fr.fromBuffer(roots.l1Tol2MessagesTreeRoot), + Fr.fromBuffer(roots.l1Tol2MessageTreeRoot), Fr.fromBuffer(roots.archiveRoot), Fr.ZERO, Fr.fromBuffer(roots.publicDataTreeRoot), diff --git a/yarn-project/sequencer-client/src/simulator/public_executor.ts b/yarn-project/sequencer-client/src/simulator/public_executor.ts index f8a8ce6e382..d17ffa36758 100644 --- a/yarn-project/sequencer-client/src/simulator/public_executor.ts +++ b/yarn-project/sequencer-client/src/simulator/public_executor.ts @@ -147,8 +147,8 @@ export class WorldStateDB implements CommitmentsDB { public async getL1ToL2Message(messageKey: Fr): Promise { // todo: #697 - make this one lookup. const message = await this.l1ToL2MessageSource.getConfirmedL1ToL2Message(messageKey); - const index = (await this.db.findLeafIndex(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, messageKey.toBuffer()))!; - const siblingPath = await this.db.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGES_TREE, index); + const index = (await this.db.findLeafIndex(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, messageKey.toBuffer()))!; + const siblingPath = await this.db.getSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, index); return { message: message.toFieldArray(), diff --git a/yarn-project/types/src/l2_block.ts b/yarn-project/types/src/l2_block.ts index 2a84683a063..a8caf012445 100644 --- a/yarn-project/types/src/l2_block.ts +++ b/yarn-project/types/src/l2_block.ts @@ -84,7 +84,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the start of the rollup. */ - public startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, + public startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, /** * The tree snapshot of the archive at the start of the rollup. */ @@ -108,7 +108,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the end of the rollup. */ - public endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, + public endL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, /** * The tree snapshot of the archive at the end of the rollup. */ @@ -215,13 +215,13 @@ export class L2Block { startNullifierTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startContractTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startPublicDataTreeSnapshot: makeAppendOnlyTreeSnapshot(0), - startL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot(0), + startL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startArchiveSnapshot: makeAppendOnlyTreeSnapshot(0), endNoteHashTreeSnapshot: makeAppendOnlyTreeSnapshot(newCommitments.length), endNullifierTreeSnapshot: makeAppendOnlyTreeSnapshot(newNullifiers.length), endContractTreeSnapshot: makeAppendOnlyTreeSnapshot(newContracts.length), endPublicDataTreeSnapshot: makeAppendOnlyTreeSnapshot(0), - endL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot(1), + endL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot(1), endArchiveSnapshot: makeAppendOnlyTreeSnapshot(1), newCommitments, newNullifiers, @@ -275,7 +275,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the start of the rollup. */ - startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot; + startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot; /** * The tree snapshot of the archive at the start of the rollup. */ @@ -299,7 +299,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the end of the rollup. */ - endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot; + endL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot; /** * The tree snapshot of the archive at the end of the rollup. */ @@ -351,13 +351,13 @@ export class L2Block { fields.startNullifierTreeSnapshot, fields.startContractTreeSnapshot, fields.startPublicDataTreeSnapshot, - fields.startL1ToL2MessagesTreeSnapshot, + fields.startL1ToL2MessageTreeSnapshot, fields.startArchiveSnapshot, fields.endNoteHashTreeSnapshot, fields.endNullifierTreeSnapshot, fields.endContractTreeSnapshot, fields.endPublicDataTreeSnapshot, - fields.endL1ToL2MessagesTreeSnapshot, + fields.endL1ToL2MessageTreeSnapshot, fields.endArchiveSnapshot, fields.newCommitments, fields.newNullifiers, @@ -386,13 +386,13 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeSnapshot, - this.startL1ToL2MessagesTreeSnapshot, + this.startL1ToL2MessageTreeSnapshot, this.startArchiveSnapshot, this.endNoteHashTreeSnapshot, this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeSnapshot, - this.endL1ToL2MessagesTreeSnapshot, + this.endL1ToL2MessageTreeSnapshot, this.endArchiveSnapshot, this.newCommitments.length, this.newCommitments, @@ -448,13 +448,13 @@ export class L2Block { const startNullifierTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startContractTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startPublicDataTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); - const startL1ToL2MessagesTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); + const startL1ToL2MessageTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startArchiveSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endNoteHashTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endNullifierTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endContractTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endPublicDataTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); - const endL1ToL2MessagesTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); + const endL1ToL2MessageTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endArchiveSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const newCommitments = reader.readVector(Fr); const newNullifiers = reader.readVector(Fr); @@ -472,13 +472,13 @@ export class L2Block { startNullifierTreeSnapshot, startContractTreeSnapshot, startPublicDataTreeSnapshot, - startL1ToL2MessagesTreeSnapshot: startL1ToL2MessagesTreeSnapshot, + startL1ToL2MessageTreeSnapshot: startL1ToL2MessageTreeSnapshot, startArchiveSnapshot, endNoteHashTreeSnapshot, endNullifierTreeSnapshot, endContractTreeSnapshot, endPublicDataTreeSnapshot, - endL1ToL2MessagesTreeSnapshot, + endL1ToL2MessageTreeSnapshot, endArchiveSnapshot, newCommitments, newNullifiers, @@ -588,13 +588,13 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeSnapshot, - this.startL1ToL2MessagesTreeSnapshot, + this.startL1ToL2MessageTreeSnapshot, this.startArchiveSnapshot, this.endNoteHashTreeSnapshot, this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeSnapshot, - this.endL1ToL2MessagesTreeSnapshot, + this.endL1ToL2MessageTreeSnapshot, this.endArchiveSnapshot, this.getCalldataHash(), this.getL1ToL2MessagesHash(), @@ -614,7 +614,7 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeSnapshot, - this.startL1ToL2MessagesTreeSnapshot, + this.startL1ToL2MessageTreeSnapshot, this.startArchiveSnapshot, ); return sha256(inputValue); @@ -631,7 +631,7 @@ export class L2Block { this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeSnapshot, - this.endL1ToL2MessagesTreeSnapshot, + this.endL1ToL2MessageTreeSnapshot, this.endArchiveSnapshot, ); return sha256(inputValue); @@ -835,14 +835,14 @@ export class L2Block { `startNullifierTreeSnapshot: ${inspectTreeSnapshot(this.startNullifierTreeSnapshot)}`, `startContractTreeSnapshot: ${inspectTreeSnapshot(this.startContractTreeSnapshot)}`, `startPublicDataTreeSnapshot: ${this.startPublicDataTreeSnapshot.toString()}`, - `startL1ToL2MessagesTreeSnapshot: ${inspectTreeSnapshot(this.startL1ToL2MessagesTreeSnapshot)}`, + `startL1ToL2MessageTreeSnapshot: ${inspectTreeSnapshot(this.startL1ToL2MessageTreeSnapshot)}`, `startArchiveSnapshot: ${inspectTreeSnapshot(this.startArchiveSnapshot)}`, `endNoteHashTreeSnapshot: ${inspectTreeSnapshot(this.endNoteHashTreeSnapshot)}`, `endNullifierTreeSnapshot: ${inspectTreeSnapshot(this.endNullifierTreeSnapshot)}`, `endContractTreeSnapshot: ${inspectTreeSnapshot(this.endContractTreeSnapshot)}`, `endPublicDataTreeSnapshot: ${this.endPublicDataTreeSnapshot.toString()}`, `endPublicDataTreeSnapshot: ${this.endPublicDataTreeSnapshot.toString()}`, - `endL1ToL2MessagesTreeSnapshot: ${inspectTreeSnapshot(this.endL1ToL2MessagesTreeSnapshot)}`, + `endL1ToL2MessageTreeSnapshot: ${inspectTreeSnapshot(this.endL1ToL2MessageTreeSnapshot)}`, `endArchiveSnapshot: ${inspectTreeSnapshot(this.endArchiveSnapshot)}`, `newCommitments: ${inspectFrArray(this.newCommitments)}`, `newNullifiers: ${inspectFrArray(this.newNullifiers)}`, diff --git a/yarn-project/types/src/merkle_tree_id.ts b/yarn-project/types/src/merkle_tree_id.ts index 85937da0391..0279f60b89f 100644 --- a/yarn-project/types/src/merkle_tree_id.ts +++ b/yarn-project/types/src/merkle_tree_id.ts @@ -7,7 +7,7 @@ export enum MerkleTreeId { NULLIFIER_TREE = 1, NOTE_HASH_TREE = 2, PUBLIC_DATA_TREE = 3, - L1_TO_L2_MESSAGES_TREE = 4, + L1_TO_L2_MESSAGE_TREE = 4, ARCHIVE = 5, } diff --git a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts index 6a5ccda9f33..df0903a880b 100644 --- a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts +++ b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts @@ -71,13 +71,13 @@ const getMockBlock = (blockNumber: number, newContractsCommitments?: Buffer[]) = startNullifierTreeSnapshot: getMockTreeSnapshot(), startContractTreeSnapshot: getMockTreeSnapshot(), startPublicDataTreeSnapshot: getMockTreeSnapshot(), - startL1ToL2MessagesTreeSnapshot: getMockTreeSnapshot(), + startL1ToL2MessageTreeSnapshot: getMockTreeSnapshot(), startArchiveSnapshot: getMockTreeSnapshot(), endNoteHashTreeSnapshot: getMockTreeSnapshot(), endNullifierTreeSnapshot: getMockTreeSnapshot(), endContractTreeSnapshot: getMockTreeSnapshot(), endPublicDataTreeSnapshot: getMockTreeSnapshot(), - endL1ToL2MessagesTreeSnapshot: getMockTreeSnapshot(), + endL1ToL2MessageTreeSnapshot: getMockTreeSnapshot(), endArchiveSnapshot: getMockTreeSnapshot(), newCommitments: times(MAX_NEW_COMMITMENTS_PER_TX, Fr.random), newNullifiers: times(MAX_NEW_NULLIFIERS_PER_TX, Fr.random), diff --git a/yarn-project/world-state/src/world-state-db/merkle_tree_operations.ts b/yarn-project/world-state/src/world-state-db/merkle_tree_operations.ts index f016914c3ce..ee57f8eaf54 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_tree_operations.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_tree_operations.ts @@ -42,7 +42,7 @@ export type CurrentTreeRoots = { /** Contract data tree root. */ contractDataTreeRoot: Buffer; /** L1 to L2 Messages data tree root. */ - l1Tol2MessagesTreeRoot: Buffer; + l1Tol2MessageTreeRoot: Buffer; /** Nullifier data tree root. */ nullifierTreeRoot: Buffer; /** Archive root. */ diff --git a/yarn-project/world-state/src/world-state-db/merkle_tree_snapshot_operations_facade.ts b/yarn-project/world-state/src/world-state-db/merkle_tree_snapshot_operations_facade.ts index 3f284d9ddb9..c5217164fce 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_tree_snapshot_operations_facade.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_tree_snapshot_operations_facade.ts @@ -91,14 +91,14 @@ export class MerkleTreeSnapshotOperationsFacade implements MerkleTreeOperations this.#getTreeSnapshot(MerkleTreeId.NULLIFIER_TREE), this.#getTreeSnapshot(MerkleTreeId.NOTE_HASH_TREE), this.#getTreeSnapshot(MerkleTreeId.PUBLIC_DATA_TREE), - this.#getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE), + this.#getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE), this.#getTreeSnapshot(MerkleTreeId.ARCHIVE), ]); return { archiveRoot: snapshots[MerkleTreeId.ARCHIVE].getRoot(), contractDataTreeRoot: snapshots[MerkleTreeId.CONTRACT_TREE].getRoot(), - l1Tol2MessagesTreeRoot: snapshots[MerkleTreeId.L1_TO_L2_MESSAGES_TREE].getRoot(), + l1Tol2MessageTreeRoot: snapshots[MerkleTreeId.L1_TO_L2_MESSAGE_TREE].getRoot(), noteHashTreeRoot: snapshots[MerkleTreeId.NOTE_HASH_TREE].getRoot(), nullifierTreeRoot: snapshots[MerkleTreeId.NULLIFIER_TREE].getRoot(), publicDataTreeRoot: snapshots[MerkleTreeId.PUBLIC_DATA_TREE].getRoot(), diff --git a/yarn-project/world-state/src/world-state-db/merkle_trees.ts b/yarn-project/world-state/src/world-state-db/merkle_trees.ts index 31cc2446e34..6765c71fb09 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_trees.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_trees.ts @@ -126,11 +126,11 @@ export class MerkleTrees implements MerkleTreeDb { PUBLIC_DATA_TREE_HEIGHT, INITIAL_PUBLIC_DATA_TREE_SIZE, ); - const l1Tol2MessagesTree: AppendOnlyTree = await initializeTree( + const l1Tol2MessageTree: AppendOnlyTree = await initializeTree( StandardTree, this.db, hasher, - `${MerkleTreeId[MerkleTreeId.L1_TO_L2_MESSAGES_TREE]}`, + `${MerkleTreeId[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]}`, L1_TO_L2_MSG_TREE_HEIGHT, ); const archive: AppendOnlyTree = await initializeTree( @@ -140,7 +140,7 @@ export class MerkleTrees implements MerkleTreeDb { `${MerkleTreeId[MerkleTreeId.ARCHIVE]}`, ARCHIVE_HEIGHT, ); - this.trees = [contractTree, nullifierTree, noteHashTree, publicDataTree, l1Tol2MessagesTree, archive]; + this.trees = [contractTree, nullifierTree, noteHashTree, publicDataTree, l1Tol2MessageTree, archive]; this.jobQueue.start(); @@ -195,8 +195,8 @@ export class MerkleTrees implements MerkleTreeDb { } /** - * Inserts into the roots trees (CONTRACT_TREE_ROOTS_TREE, NOTE_HASH_TREE_ROOTS_TREE, L1_TO_L2_MESSAGES_TREE_ROOTS_TREE) - * the current roots of the corresponding trees (CONTRACT_TREE, NOTE_HASH_TREE, L1_TO_L2_MESSAGES_TREE). + * Inserts into the roots trees (CONTRACT_TREE_ROOTS_TREE, NOTE_HASH_TREE_ROOTS_TREE, L1_TO_L2_MESSAGE_TREE_ROOTS_TREE) + * the current roots of the corresponding trees (CONTRACT_TREE, NOTE_HASH_TREE, L1_TO_L2_MESSAGE_TREE). * @param globalsHash - The current global variables hash. * @param includeUncommitted - Indicates whether to include uncommitted data. */ @@ -242,7 +242,7 @@ export class MerkleTrees implements MerkleTreeDb { noteHashTreeRoot: roots[0], nullifierTreeRoot: roots[1], contractDataTreeRoot: roots[2], - l1Tol2MessagesTreeRoot: roots[3], + l1Tol2MessageTreeRoot: roots[3], publicDataTreeRoot: roots[4], archiveRoot: roots[5], }; @@ -258,7 +258,7 @@ export class MerkleTrees implements MerkleTreeDb { MerkleTreeId.NOTE_HASH_TREE, MerkleTreeId.NULLIFIER_TREE, MerkleTreeId.CONTRACT_TREE, - MerkleTreeId.L1_TO_L2_MESSAGES_TREE, + MerkleTreeId.L1_TO_L2_MESSAGE_TREE, MerkleTreeId.PUBLIC_DATA_TREE, MerkleTreeId.ARCHIVE, ].map(tree => this.trees[tree].getRoot(includeUncommitted)); @@ -555,7 +555,7 @@ export class MerkleTrees implements MerkleTreeDb { [l2Block.endNullifierTreeSnapshot.root, MerkleTreeId.NULLIFIER_TREE], [l2Block.endNoteHashTreeSnapshot.root, MerkleTreeId.NOTE_HASH_TREE], [l2Block.endPublicDataTreeSnapshot.root, MerkleTreeId.PUBLIC_DATA_TREE], - [l2Block.endL1ToL2MessagesTreeSnapshot.root, MerkleTreeId.L1_TO_L2_MESSAGES_TREE], + [l2Block.endL1ToL2MessageTreeSnapshot.root, MerkleTreeId.L1_TO_L2_MESSAGE_TREE], [l2Block.endArchiveSnapshot.root, MerkleTreeId.ARCHIVE], ] as const; const compareRoot = (root: Fr, treeId: MerkleTreeId) => { @@ -574,7 +574,7 @@ export class MerkleTrees implements MerkleTreeDb { for (const [tree, leaves] of [ [MerkleTreeId.CONTRACT_TREE, l2Block.newContracts], [MerkleTreeId.NOTE_HASH_TREE, l2Block.newCommitments], - [MerkleTreeId.L1_TO_L2_MESSAGES_TREE, l2Block.newL1ToL2Messages], + [MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l2Block.newL1ToL2Messages], ] as const) { await this._appendLeaves( tree, diff --git a/yellow-paper/docs/contracts/index.md b/yellow-paper/docs/contracts/index.md index f17b2733f96..348cfa6ef9f 100644 --- a/yellow-paper/docs/contracts/index.md +++ b/yellow-paper/docs/contracts/index.md @@ -105,7 +105,7 @@ class StateTransitioner: def body_available( self, - content_hash: Fr, + body_hash: Fr, txs_hash: Fr, l1_to_l2_msgs: Fr[], l2_to_l1_msgs: Fr[] @@ -113,7 +113,7 @@ class StateTransitioner: assert self.registry.availability_oracle.is_available(txs_hash) in_hash = SHA256(pad(l1_to_l2_msgs)) out_hash = MerkleTree(pad(l2_to_l1_msgs), SHA256) - return content_hash == SHA256(txs_hash, out_hash, in_hash) + return body_hash == SHA256(txs_hash, out_hash, in_hash) ) def validate_header( diff --git a/yellow-paper/docs/public-vm/gen/_InstructionSet.mdx b/yellow-paper/docs/public-vm/gen/_InstructionSet.mdx index 2c1cc93dd04..60047658fa7 100644 --- a/yellow-paper/docs/public-vm/gen/_InstructionSet.mdx +++ b/yellow-paper/docs/public-vm/gen/_InstructionSet.mdx @@ -327,10 +327,10 @@ Click on an instruction name to jump to its section. 0x27 [`MSGSROOT`](#isa-section-msgsroot) - Get the historical l1-to-l2 messages tree root as of the specified block number. + Get the historical l1-to-l2 message tree root as of the specified block number. 88 { - `M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_messages_tree_root` + `M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_message_tree_root` } @@ -1186,7 +1186,7 @@ Get the historical contracts tree root as of the specified block number. [![](./images/bit-formats/CONTRACTSROOT.png)](./images/bit-formats/CONTRACTSROOT.png) ### `MSGSROOT` (0x27) -Get the historical l1-to-l2 messages tree root as of the specified block number. +Get the historical l1-to-l2 message tree root as of the specified block number. [See in table.](#isa-table-msgsroot) @@ -1196,7 +1196,7 @@ Get the historical l1-to-l2 messages tree root as of the specified block number. - **Args**: - **blockNumOffset**: memory offset of the block number input - **dstOffset**: memory offset specifying where to store operation's result -- **Expression**: `M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_messages_tree_root` +- **Expression**: `M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_message_tree_root` - **Tag updates**: `T[dstOffset] = field` - **Bit-size**: 88 diff --git a/yellow-paper/docs/rollup-circuits/base_rollup.md b/yellow-paper/docs/rollup-circuits/base_rollup.md index e489e2400eb..89a5c8bb075 100644 --- a/yellow-paper/docs/rollup-circuits/base_rollup.md +++ b/yellow-paper/docs/rollup-circuits/base_rollup.md @@ -44,11 +44,11 @@ class GlobalVariables { class Header { last_archive: Snapshot - content_hash: Fr[2] + body_hash: Fr[2] state: StateReference global_variables: GlobalVariables } -Header *.. Body : content_hash +Header *.. Body : body_hash Header *-- StateReference : state Header *-- GlobalVariables : global_variables diff --git a/yellow-paper/docs/rollup-circuits/index.md b/yellow-paper/docs/rollup-circuits/index.md index 6b58c6d1413..29bbf7caddf 100644 --- a/yellow-paper/docs/rollup-circuits/index.md +++ b/yellow-paper/docs/rollup-circuits/index.md @@ -120,11 +120,11 @@ class GlobalVariables { class Header { last_archive: Snapshot - content_hash: Fr[2] + body_hash: Fr[2] state: StateReference global_variables: GlobalVariables } -Header *.. Body : content_hash +Header *.. Body : body_hash Header *-- StateReference : state Header *-- GlobalVariables : global_variables @@ -372,11 +372,11 @@ graph LR ``` #### State availability -To ensure that state is made available, we could broadcast all of a block's input data as public inputs of the final root rollup proof, but a proof with so many public inputs would be very expensive to verify onchain. Instead we reduce the proof's public inputs by committing to the block's body by iteratively computing a `TxsHash` and `OutHash` at each rollup circuit iteration. AT the final iteration a `content_hash` is computed committing to the complete body. +To ensure that state is made available, we could broadcast all of a block's input data as public inputs of the final root rollup proof, but a proof with so many public inputs would be very expensive to verify onchain. Instead we reduce the proof's public inputs by committing to the block's body by iteratively computing a `TxsHash` and `OutHash` at each rollup circuit iteration. AT the final iteration a `body_hash` is computed committing to the complete body. -To check that this body is published an Aztec node can reconstruct the `content_hash` from available data. Since we define finality as the point where the block is validated and included in the state of the [validating light node](./../contracts/index.md), we can define a block as being "available" if the validating light node can reconstruct the commitment `content_hash`. +To check that this body is published an Aztec node can reconstruct the `body_hash` from available data. Since we define finality as the point where the block is validated and included in the state of the [validating light node](./../contracts/index.md), we can define a block as being "available" if the validating light node can reconstruct the commitment `body_hash`. -Since we strive to minimize the compute requirements to prove blocks, we amortize the commitment cost across the full tree. We can do so by building merkle trees of partial "commitments", whose roots are ultimately computed in the final root rollup circuit. The `content_hash` is then computed from the roots of these trees, together with incoming messages. +Since we strive to minimize the compute requirements to prove blocks, we amortize the commitment cost across the full tree. We can do so by building merkle trees of partial "commitments", whose roots are ultimately computed in the final root rollup circuit. The `body_hash` is then computed from the roots of these trees, together with incoming messages. Below, we outline the `TxsHash` merkle tree that is based on the `TxEffect`s and a `OutHash` which is based on the `l2_to_l1_msgs` (cross-chain messages) for each transaction. While the `TxsHash` implicitly includes the `l2_to_l1_msgs` we construct it separately since the `l2_to_l1_msgs` must be available to the L1 contract directly and not just proven available. This is not a concern when using L1 calldata as the data layer, but is a concern when using alternative data layers such as [Celestia](https://celestia.org/) or [Blobs](https://eips.ethereum.org/EIPS/eip-4844). ```mermaid @@ -448,10 +448,10 @@ graph BT K7 --> B3 ``` - The roots of these trees, together with incoming messages, makes up the `content_hash`. + The roots of these trees, together with incoming messages, makes up the `body_hash`. ```mermaid graph BT - R[content_hash] + R[body_hash] M0[TxsHash] M1[OutHash] M2[InHash] @@ -465,7 +465,7 @@ graph BT ``` ```python -def content_hash(body: Body): +def body_hash(body: Body): txs_hash = merkle_tree(body.txs, SHA256).root out_hash = merkle_tree([tx.l1_to_l2_msgs for tx in body.txs], SHA256).root in_hash = SHA256(body.l1_to_l2_messages) diff --git a/yellow-paper/docs/rollup-circuits/root_rollup.md b/yellow-paper/docs/rollup-circuits/root_rollup.md index b3c2005aced..16bbbb83a92 100644 --- a/yellow-paper/docs/rollup-circuits/root_rollup.md +++ b/yellow-paper/docs/rollup-circuits/root_rollup.md @@ -46,11 +46,11 @@ class GlobalVariables { class Header { last_archive: Snapshot - content_hash: Fr[2] + body_hash: Fr[2] state: StateReference global_variables: GlobalVariables } -Header *.. Body : content_hash +Header *.. Body : body_hash Header *-- StateReference : state Header *-- GlobalVariables : global_variables @@ -186,7 +186,7 @@ def RootRollupCircuit( header = Header( last_archive = left.inputs.constants.last_archive, - content_hash = SHA256(txs_hash | out_hash | SHA256(l1_to_l2_msgs)), + body_hash = SHA256(txs_hash | out_hash | SHA256(l1_to_l2_msgs)), state = StateReference( l1_to_l2_message_tree = l1_to_l2_msg_tree, partial = right.inputs.end, diff --git a/yellow-paper/docs/state/archive.md b/yellow-paper/docs/state/archive.md index 3517a2c8026..472752094fb 100644 --- a/yellow-paper/docs/state/archive.md +++ b/yellow-paper/docs/state/archive.md @@ -38,11 +38,11 @@ class GlobalVariables { class Header { last_archive: Snapshot - content_hash: Fr[2] + body_hash: Fr[2] state: StateReference global_variables: GlobalVariables } -Header *.. Body : content_hash +Header *.. Body : body_hash Header *-- StateReference : state Header *-- GlobalVariables : global_variables diff --git a/yellow-paper/docs/state/index.md b/yellow-paper/docs/state/index.md index 51bbde05b3b..a6b5e4352d6 100644 --- a/yellow-paper/docs/state/index.md +++ b/yellow-paper/docs/state/index.md @@ -84,11 +84,11 @@ class GlobalVariables { class Header { last_archive: Snapshot - content_hash: Fr[2] + body_hash: Fr[2] state: StateReference global_variables: GlobalVariables } -Header *.. Body : content_hash +Header *.. Body : body_hash Header *-- StateReference : state Header *-- GlobalVariables : global_variables diff --git a/yellow-paper/docs/transactions/tx-object.md b/yellow-paper/docs/transactions/tx-object.md index 95b736766c4..a5cca0f2485 100644 --- a/yellow-paper/docs/transactions/tx-object.md +++ b/yellow-paper/docs/transactions/tx-object.md @@ -44,7 +44,7 @@ Output of the last iteration of the private kernel circuit. Includes _accumulate | noteHashTreeRoot | Field | Root of the note hash tree at the time of when this information was assembled. | | nullifierTreeRoot | Field | Root of the nullifier tree at the time of when this information was assembled. | | contractTreeRoot | Field | Root of the contract tree at the time of when this information was assembled. | -| l1ToL2MessagesTreeRoot | Field | Root of the L1 to L2 messages tree at the time of when this information was assembled. | +| l1ToL2MessageTreeRoot | Field | Root of the L1 to L2 message tree at the time of when this information was assembled. | | archiveRoot | Field | Root of the archive at the time of when this information was assembled. | | privateKernelVkTreeRoot | Field | Root of the private kernel VK tree at the time of when this information was assembled (future enhancement). | | publicDataTreeRoot | Field | Current public state tree hash. | diff --git a/yellow-paper/src/preprocess/InstructionSet/InstructionSet.js b/yellow-paper/src/preprocess/InstructionSet/InstructionSet.js index 19acb3759ed..4dfd2ed34a6 100644 --- a/yellow-paper/src/preprocess/InstructionSet/InstructionSet.js +++ b/yellow-paper/src/preprocess/InstructionSet/InstructionSet.js @@ -809,8 +809,8 @@ T[retOffset:retOffset+retSize] = field {"name": "blockNumOffset", "description": "memory offset of the block number input"}, {"name": "dstOffset", "description": "memory offset specifying where to store operation's result"}, ], - "Expression": "`M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_messages_tree_root`", - "Summary": "Get the historical l1-to-l2 messages tree root as of the specified block number.", + "Expression": "`M[dstOffset] = HistoricalBlockData[M[blockNumOffset]].l1_to_l2_message_tree_root`", + "Summary": "Get the historical l1-to-l2 message tree root as of the specified block number.", "Details": "", "Tag checks": "", "Tag updates": "`T[dstOffset] = field`",