From 1916038fd80afaaf29f205e308bd9b77d9ec282a Mon Sep 17 00:00:00 2001 From: jeanmon Date: Tue, 12 Sep 2023 07:41:17 +0000 Subject: [PATCH] 2117 - address feedback of David --- .../abis/rollup/root/root_rollup_inputs.hpp | 8 ++-- .../aztec3/circuits/rollup/merge/.test.cpp | 5 +++ .../src/aztec3/circuits/rollup/root/.test.cpp | 5 +++ .../root/native_root_rollup_circuit.cpp | 6 +-- .../circuits/rollup/test_utils/utils.cpp | 4 +- .../src/synchroniser/synchroniser.ts | 2 +- .../circuits.js/src/cbind/circuits.gen.ts | 28 ++++++------- .../__snapshots__/root_rollup.test.ts.snap | 4 +- .../src/structs/rollup/root_rollup.ts | 8 ++-- .../block_builder/solo_block_builder.test.ts | 4 +- .../src/block_builder/solo_block_builder.ts | 18 ++++----- yarn-project/types/src/l2_block.ts | 40 +++++++++---------- .../server_world_state_synchroniser.test.ts | 4 +- .../src/world-state-db/merkle_trees.ts | 2 +- 14 files changed, 74 insertions(+), 64 deletions(-) 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 b035e04eded..372390a8c05 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_message_tree_root_sibling_path{}; + std::array new_l1_to_l2_messages_tree_root_sibling_path{}; - AppendOnlyTreeSnapshot start_l1_to_l2_message_tree_snapshot{}; + AppendOnlyTreeSnapshot start_l1_to_l2_messages_tree_snapshot{}; // inputs required to add the block hash AppendOnlyTreeSnapshot start_historic_blocks_tree_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_message_tree_root_sibling_path, - start_l1_to_l2_message_tree_snapshot, + new_l1_to_l2_messages_tree_root_sibling_path, + start_l1_to_l2_messages_tree_snapshot, start_historic_blocks_tree_snapshot, new_historic_blocks_tree_sibling_path); bool operator==(RootRollupInputs const&) const = default; diff --git a/circuits/cpp/src/aztec3/circuits/rollup/merge/.test.cpp b/circuits/cpp/src/aztec3/circuits/rollup/merge/.test.cpp index 5aa4a30e619..b32cd6be371 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/merge/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/merge/.test.cpp @@ -28,6 +28,9 @@ class merge_rollup_tests : public ::testing::Test { protected: static void SetUpTestSuite() { barretenberg::srs::init_crs_factory("../barretenberg/cpp/srs_db/ignition"); } + // TODO(1998): uncomment once https://github.com/AztecProtocol/aztec-packages/issues/1998 is solved and + // use new pattern such as call_func_and_wrapper from test_helper.hpp + // static void run_cbind(MergeRollupInputs& merge_rollup_inputs, // BaseOrMergeRollupPublicInputs& expected_public_inputs, // bool compare_pubins = true) @@ -299,6 +302,8 @@ TEST_F(merge_rollup_tests, native_merge_cbind) ASSERT_FALSE(builder.failed()); BaseOrMergeRollupPublicInputs ignored_public_inputs; + + // TODO(1998): see above // run_cbind(inputs, ignored_public_inputs, false); } } // namespace aztec3::circuits::rollup::merge::native_merge_rollup_circuit diff --git a/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp b/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp index ded030ebcd5..aff8660d432 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/root/.test.cpp @@ -64,6 +64,9 @@ class root_rollup_tests : public ::testing::Test { protected: static void SetUpTestSuite() { barretenberg::srs::init_crs_factory("../barretenberg/cpp/srs_db/ignition"); } + // TODO(1998): uncomment once https://github.com/AztecProtocol/aztec-packages/issues/1998 is solved and + // use new pattern such as call_func_and_wrapper from test_helper.hpp + // static void run_cbind(RootRollupInputs& root_rollup_inputs, // RootRollupPublicInputs& expected_public_inputs, // bool compare_pubins = true) @@ -149,6 +152,7 @@ TEST_F(root_rollup_tests, native_check_block_hashes_empty_blocks) EXPECT_FALSE(builder.failed()); + // TODO(1998): see above // run_cbind(inputs, outputs, true); } @@ -300,6 +304,7 @@ TEST_F(root_rollup_tests, native_root_missing_nullifier_logic) EXPECT_FALSE(builder.failed()); + // TODO(1998): see above // run_cbind(rootRollupInputs, outputs, true); } 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 87115157dc9..3456108f791 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 @@ -98,8 +98,8 @@ RootRollupPublicInputs root_rollup_circuit(DummyBuilder& builder, RootRollupInpu 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( builder, - rootRollupInputs.start_l1_to_l2_message_tree_snapshot, - rootRollupInputs.new_l1_to_l2_message_tree_root_sibling_path, + rootRollupInputs.start_l1_to_l2_messages_tree_snapshot, + rootRollupInputs.new_l1_to_l2_messages_tree_root_sibling_path, empty_l1_to_l2_subtree_root, l1_to_l2_subtree_root, L1_TO_L2_MSG_SUBTREE_HEIGHT, @@ -138,7 +138,7 @@ 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_message_tree_snapshot, + .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_historic_blocks_tree_snapshot = rootRollupInputs.start_historic_blocks_tree_snapshot, .end_historic_blocks_tree_snapshot = end_historic_blocks_tree_snapshot, 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 5b18741ffa0..0727fe73ae8 100644 --- a/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp +++ b/circuits/cpp/src/aztec3/circuits/rollup/test_utils/utils.cpp @@ -413,8 +413,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_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, + .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, .start_historic_blocks_tree_snapshot = start_historic_blocks_tree_snapshot, .new_historic_blocks_tree_sibling_path = blocks_tree_sibling_path, }; diff --git a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts index f4e3a978b83..57a0471addb 100644 --- a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts +++ b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts @@ -199,7 +199,7 @@ export class Synchroniser { block.endPrivateDataTreeSnapshot.root, block.endNullifierTreeSnapshot.root, block.endContractTreeSnapshot.root, - block.endL1ToL2MessageTreeSnapshot.root, + block.endL1ToL2MessagesTreeSnapshot.root, block.endHistoricBlocksTreeSnapshot.root, Fr.ZERO, // todo: private kernel vk tree root block.endPublicDataTreeRoot, diff --git a/yarn-project/circuits.js/src/cbind/circuits.gen.ts b/yarn-project/circuits.js/src/cbind/circuits.gen.ts index 8daa35a5add..3a257d984b1 100644 --- a/yarn-project/circuits.js/src/cbind/circuits.gen.ts +++ b/yarn-project/circuits.js/src/cbind/circuits.gen.ts @@ -2579,8 +2579,8 @@ export function fromMergeRollupInputs(o: MergeRollupInputs): MsgpackMergeRollupI interface MsgpackRootRollupInputs { previous_rollup_data: Tuple; new_l1_to_l2_messages: Tuple; - new_l1_to_l2_message_tree_root_sibling_path: Tuple; - start_l1_to_l2_message_tree_snapshot: MsgpackAppendOnlyTreeSnapshot; + new_l1_to_l2_messages_tree_root_sibling_path: Tuple; + start_l1_to_l2_messages_tree_snapshot: MsgpackAppendOnlyTreeSnapshot; start_historic_blocks_tree_snapshot: MsgpackAppendOnlyTreeSnapshot; new_historic_blocks_tree_sibling_path: Tuple; } @@ -2592,11 +2592,11 @@ export function toRootRollupInputs(o: MsgpackRootRollupInputs): RootRollupInputs if (o.new_l1_to_l2_messages === undefined) { throw new Error('Expected new_l1_to_l2_messages in RootRollupInputs deserialization'); } - if (o.new_l1_to_l2_message_tree_root_sibling_path === undefined) { - throw new Error('Expected new_l1_to_l2_message_tree_root_sibling_path in RootRollupInputs deserialization'); + if (o.new_l1_to_l2_messages_tree_root_sibling_path === undefined) { + throw new Error('Expected new_l1_to_l2_messages_tree_root_sibling_path in RootRollupInputs deserialization'); } - if (o.start_l1_to_l2_message_tree_snapshot === undefined) { - throw new Error('Expected start_l1_to_l2_message_tree_snapshot in RootRollupInputs deserialization'); + if (o.start_l1_to_l2_messages_tree_snapshot === undefined) { + throw new Error('Expected start_l1_to_l2_messages_tree_snapshot in RootRollupInputs deserialization'); } if (o.start_historic_blocks_tree_snapshot === undefined) { throw new Error('Expected start_historic_blocks_tree_snapshot in RootRollupInputs deserialization'); @@ -2607,8 +2607,8 @@ export function toRootRollupInputs(o: MsgpackRootRollupInputs): RootRollupInputs return new RootRollupInputs( mapTuple(o.previous_rollup_data, (v: MsgpackPreviousRollupData) => toPreviousRollupData(v)), mapTuple(o.new_l1_to_l2_messages, (v: Buffer) => Fr.fromBuffer(v)), - mapTuple(o.new_l1_to_l2_message_tree_root_sibling_path, (v: Buffer) => Fr.fromBuffer(v)), - toAppendOnlyTreeSnapshot(o.start_l1_to_l2_message_tree_snapshot), + mapTuple(o.new_l1_to_l2_messages_tree_root_sibling_path, (v: Buffer) => Fr.fromBuffer(v)), + toAppendOnlyTreeSnapshot(o.start_l1_to_l2_messages_tree_snapshot), toAppendOnlyTreeSnapshot(o.start_historic_blocks_tree_snapshot), mapTuple(o.new_historic_blocks_tree_sibling_path, (v: Buffer) => Fr.fromBuffer(v)), ); @@ -2621,11 +2621,11 @@ export function fromRootRollupInputs(o: RootRollupInputs): MsgpackRootRollupInpu if (o.newL1ToL2Messages === undefined) { throw new Error('Expected newL1ToL2Messages in RootRollupInputs serialization'); } - if (o.newL1ToL2MessageTreeRootSiblingPath === undefined) { - throw new Error('Expected newL1ToL2MessageTreeRootSiblingPath in RootRollupInputs serialization'); + if (o.newL1ToL2MessagesTreeRootSiblingPath === undefined) { + throw new Error('Expected newL1ToL2MessagesTreeRootSiblingPath in RootRollupInputs serialization'); } - if (o.startL1ToL2MessageTreeSnapshot === undefined) { - throw new Error('Expected startL1ToL2MessageTreeSnapshot in RootRollupInputs serialization'); + if (o.startL1ToL2MessagesTreeSnapshot === undefined) { + throw new Error('Expected startL1ToL2MessagesTreeSnapshot in RootRollupInputs serialization'); } if (o.startHistoricBlocksTreeSnapshot === undefined) { throw new Error('Expected startHistoricBlocksTreeSnapshot in RootRollupInputs serialization'); @@ -2636,10 +2636,10 @@ export function fromRootRollupInputs(o: RootRollupInputs): MsgpackRootRollupInpu return { previous_rollup_data: mapTuple(o.previousRollupData, (v: PreviousRollupData) => fromPreviousRollupData(v)), new_l1_to_l2_messages: mapTuple(o.newL1ToL2Messages, (v: Fr) => toBuffer(v)), - new_l1_to_l2_message_tree_root_sibling_path: mapTuple(o.newL1ToL2MessageTreeRootSiblingPath, (v: Fr) => + new_l1_to_l2_messages_tree_root_sibling_path: mapTuple(o.newL1ToL2MessagesTreeRootSiblingPath, (v: Fr) => toBuffer(v), ), - start_l1_to_l2_message_tree_snapshot: fromAppendOnlyTreeSnapshot(o.startL1ToL2MessageTreeSnapshot), + start_l1_to_l2_messages_tree_snapshot: fromAppendOnlyTreeSnapshot(o.startL1ToL2MessagesTreeSnapshot), start_historic_blocks_tree_snapshot: fromAppendOnlyTreeSnapshot(o.startHistoricBlocksTreeSnapshot), new_historic_blocks_tree_sibling_path: mapTuple(o.newHistoricBlocksTreeSiblingPath, (v: Fr) => toBuffer(v)), }; diff --git a/yarn-project/circuits.js/src/structs/rollup/__snapshots__/root_rollup.test.ts.snap b/yarn-project/circuits.js/src/structs/rollup/__snapshots__/root_rollup.test.ts.snap index ab9d210c901..21421dd626f 100644 --- a/yarn-project/circuits.js/src/structs/rollup/__snapshots__/root_rollup.test.ts.snap +++ b/yarn-project/circuits.js/src/structs/rollup/__snapshots__/root_rollup.test.ts.snap @@ -131,8 +131,8 @@ sibling_path: [ 0x1120 0x1121 0x1122 0x1123 0x1124 0x1125 0x1126 0x1127 ] ] new_l1_to_l2_messages: [ 0x2100 0x2101 0x2102 0x2103 0x2104 0x2105 0x2106 0x2107 0x2108 0x2109 0x210a 0x210b 0x210c 0x210d 0x210e 0x210f ] -new_l1_to_l2_message_tree_root_sibling_path: [ 0x2100 0x2101 0x2102 0x2103 0x2104 0x2105 0x2106 0x2107 0x2108 0x2109 0x210a 0x210b ] -start_l1_to_l2_message_tree_snapshot: root: 0x2200 +new_l1_to_l2_messages_tree_root_sibling_path: [ 0x2100 0x2101 0x2102 0x2103 0x2104 0x2105 0x2106 0x2107 0x2108 0x2109 0x210a 0x210b ] +start_l1_to_l2_messages_tree_snapshot: root: 0x2200 next_available_leaf_index: 8704 start_historic_blocks_tree_snapshot: root: 0x2200 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 2c174a83fa7..4a3d98ef7ff 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 newL1ToL2MessageTreeRootSiblingPath: Tuple, + public newL1ToL2MessagesTreeRootSiblingPath: Tuple, /** * Snapshot of the L1 to L2 message tree at the start of the rollup. */ - public startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, + public startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, /** * Snapshot of the historic block roots tree at the start of the rollup. */ @@ -58,8 +58,8 @@ export class RootRollupInputs { return [ fields.previousRollupData, fields.newL1ToL2Messages, - fields.newL1ToL2MessageTreeRootSiblingPath, - fields.startL1ToL2MessageTreeSnapshot, + fields.newL1ToL2MessagesTreeRootSiblingPath, + fields.startL1ToL2MessagesTreeSnapshot, fields.startHistoricBlocksTreeSnapshot, fields.newHistoricBlocksTreeSiblingPath, ] as const; 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 42d566237ed..e675e093de9 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 @@ -241,8 +241,8 @@ describe('sequencer/solo_block_builder', () => { endContractTreeSnapshot: rootRollupOutput.endContractTreeSnapshot, startPublicDataTreeRoot: rootRollupOutput.startPublicDataTreeRoot, endPublicDataTreeRoot: rootRollupOutput.endPublicDataTreeRoot, - startL1ToL2MessageTreeSnapshot: rootRollupOutput.startL1ToL2MessagesTreeSnapshot, - endL1ToL2MessageTreeSnapshot: rootRollupOutput.endL1ToL2MessagesTreeSnapshot, + startL1ToL2MessagesTreeSnapshot: rootRollupOutput.startL1ToL2MessagesTreeSnapshot, + endL1ToL2MessagesTreeSnapshot: rootRollupOutput.endL1ToL2MessagesTreeSnapshot, startHistoricBlocksTreeSnapshot: rootRollupOutput.startHistoricBlocksTreeSnapshot, endHistoricBlocksTreeSnapshot: rootRollupOutput.endHistoricBlocksTreeSnapshot, newCommitments, 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 333c07adffa..10285ee6256 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 @@ -110,7 +110,7 @@ export class SoloBlockBuilder implements BlockBuilder { endNullifierTreeSnapshot, endContractTreeSnapshot, endPublicDataTreeRoot, - endL1ToL2MessagesTreeSnapshot: endL1ToL2MessageTreeSnapshot, + endL1ToL2MessagesTreeSnapshot, endHistoricBlocksTreeSnapshot, } = circuitsOutput; @@ -150,8 +150,8 @@ export class SoloBlockBuilder implements BlockBuilder { endContractTreeSnapshot, startPublicDataTreeRoot: startPublicDataTreeSnapshot.root, endPublicDataTreeRoot, - startL1ToL2MessageTreeSnapshot, - endL1ToL2MessageTreeSnapshot, + startL1ToL2MessagesTreeSnapshot: startL1ToL2MessageTreeSnapshot, + endL1ToL2MessagesTreeSnapshot, startHistoricBlocksTreeSnapshot, endHistoricBlocksTreeSnapshot, newCommitments, @@ -438,20 +438,20 @@ export class SoloBlockBuilder implements BlockBuilder { return path.toFieldArray(); }; - const newL1ToL2MessageTreeRootSiblingPathArray = await this.getSubtreeSiblingPath( + const newL1ToL2MessagesTreeRootSiblingPathArray = await this.getSubtreeSiblingPath( MerkleTreeId.L1_TO_L2_MESSAGES_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, ); - const newL1ToL2MessageTreeRootSiblingPath = makeTuple( + const newL1ToL2MessagesTreeRootSiblingPath = makeTuple( L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, i => - i < newL1ToL2MessageTreeRootSiblingPathArray.length ? newL1ToL2MessageTreeRootSiblingPathArray[i] : Fr.ZERO, + i < newL1ToL2MessagesTreeRootSiblingPathArray.length ? newL1ToL2MessagesTreeRootSiblingPathArray[i] : Fr.ZERO, 0, ); // Get tree snapshots - const startL1ToL2MessageTreeSnapshot = await this.getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE); + const startL1ToL2MessagesTreeSnapshot = await this.getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGES_TREE); // Get historic block tree roots const startHistoricBlocksTreeSnapshot = await this.getTreeSnapshot(MerkleTreeId.BLOCKS_TREE); @@ -466,8 +466,8 @@ export class SoloBlockBuilder implements BlockBuilder { return RootRollupInputs.from({ previousRollupData, newL1ToL2Messages, - newL1ToL2MessageTreeRootSiblingPath, - startL1ToL2MessageTreeSnapshot, + newL1ToL2MessagesTreeRootSiblingPath, + startL1ToL2MessagesTreeSnapshot, startHistoricBlocksTreeSnapshot, newHistoricBlocksTreeSiblingPath, }); diff --git a/yarn-project/types/src/l2_block.ts b/yarn-project/types/src/l2_block.ts index 5a552e593f4..a3a7c1e7a20 100644 --- a/yarn-project/types/src/l2_block.ts +++ b/yarn-project/types/src/l2_block.ts @@ -78,7 +78,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the start of the rollup. */ - public startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, + public startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, /** * The tree snapshot of the historic blocks tree at the start of the rollup. */ @@ -102,7 +102,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the end of the rollup. */ - public endL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, + public endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot, /** * The tree snapshot of the historic blocks tree at the end of the rollup. */ @@ -188,13 +188,13 @@ export class L2Block { startNullifierTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startContractTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startPublicDataTreeRoot: Fr.random(), - startL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot(0), + startL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot(0), startHistoricBlocksTreeSnapshot: makeAppendOnlyTreeSnapshot(0), endPrivateDataTreeSnapshot: makeAppendOnlyTreeSnapshot(newCommitments.length), endNullifierTreeSnapshot: makeAppendOnlyTreeSnapshot(newNullifiers.length), endContractTreeSnapshot: makeAppendOnlyTreeSnapshot(newContracts.length), endPublicDataTreeRoot: Fr.random(), - endL1ToL2MessageTreeSnapshot: makeAppendOnlyTreeSnapshot(1), + endL1ToL2MessagesTreeSnapshot: makeAppendOnlyTreeSnapshot(1), endHistoricBlocksTreeSnapshot: makeAppendOnlyTreeSnapshot(1), newCommitments, newNullifiers, @@ -243,7 +243,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the start of the rollup. */ - startL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot; + startL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot; /** * The tree snapshot of the historic blocks tree at the start of the rollup. */ @@ -267,7 +267,7 @@ export class L2Block { /** * The tree snapshot of the L2 message tree at the end of the rollup. */ - endL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot; + endL1ToL2MessagesTreeSnapshot: AppendOnlyTreeSnapshot; /** * The tree snapshot of the historic blocks tree at the end of the rollup. */ @@ -318,13 +318,13 @@ export class L2Block { fields.startNullifierTreeSnapshot, fields.startContractTreeSnapshot, fields.startPublicDataTreeRoot, - fields.startL1ToL2MessageTreeSnapshot, + fields.startL1ToL2MessagesTreeSnapshot, fields.startHistoricBlocksTreeSnapshot, fields.endPrivateDataTreeSnapshot, fields.endNullifierTreeSnapshot, fields.endContractTreeSnapshot, fields.endPublicDataTreeRoot, - fields.endL1ToL2MessageTreeSnapshot, + fields.endL1ToL2MessagesTreeSnapshot, fields.endHistoricBlocksTreeSnapshot, fields.newCommitments, fields.newNullifiers, @@ -354,13 +354,13 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeRoot, - this.startL1ToL2MessageTreeSnapshot, + this.startL1ToL2MessagesTreeSnapshot, this.startHistoricBlocksTreeSnapshot, this.endPrivateDataTreeSnapshot, this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeRoot, - this.endL1ToL2MessageTreeSnapshot, + this.endL1ToL2MessagesTreeSnapshot, this.endHistoricBlocksTreeSnapshot, this.newCommitments.length, this.newCommitments, @@ -401,13 +401,13 @@ export class L2Block { const startNullifierTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startContractTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startPublicDataTreeRoot = reader.readObject(Fr); - const startL1ToL2MessageTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); + const startL1ToL2MessagesTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const startHistoricBlocksTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endPrivateDataTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endNullifierTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endContractTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endPublicDataTreeRoot = reader.readObject(Fr); - const endL1ToL2MessageTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); + const endL1ToL2MessagesTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const endHistoricBlocksTreeSnapshot = reader.readObject(AppendOnlyTreeSnapshot); const newCommitments = reader.readVector(Fr); const newNullifiers = reader.readVector(Fr); @@ -427,13 +427,13 @@ export class L2Block { startNullifierTreeSnapshot, startContractTreeSnapshot, startPublicDataTreeRoot, - startL1ToL2MessageTreeSnapshot, + startL1ToL2MessagesTreeSnapshot: startL1ToL2MessagesTreeSnapshot, startHistoricBlocksTreeSnapshot, endPrivateDataTreeSnapshot, endNullifierTreeSnapshot, endContractTreeSnapshot, endPublicDataTreeRoot, - endL1ToL2MessageTreeSnapshot, + endL1ToL2MessagesTreeSnapshot, endHistoricBlocksTreeSnapshot, newCommitments, newNullifiers, @@ -502,13 +502,13 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeRoot, - this.startL1ToL2MessageTreeSnapshot, + this.startL1ToL2MessagesTreeSnapshot, this.startHistoricBlocksTreeSnapshot, this.endPrivateDataTreeSnapshot, this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeRoot, - this.endL1ToL2MessageTreeSnapshot, + this.endL1ToL2MessagesTreeSnapshot, this.endHistoricBlocksTreeSnapshot, this.getCalldataHash(), this.getL1ToL2MessagesHash(), @@ -528,7 +528,7 @@ export class L2Block { this.startNullifierTreeSnapshot, this.startContractTreeSnapshot, this.startPublicDataTreeRoot, - this.startL1ToL2MessageTreeSnapshot, + this.startL1ToL2MessagesTreeSnapshot, this.startHistoricBlocksTreeSnapshot, ); return sha256(inputValue); @@ -545,7 +545,7 @@ export class L2Block { this.endNullifierTreeSnapshot, this.endContractTreeSnapshot, this.endPublicDataTreeRoot, - this.endL1ToL2MessageTreeSnapshot, + this.endL1ToL2MessagesTreeSnapshot, this.endHistoricBlocksTreeSnapshot, ); return sha256(inputValue); @@ -741,14 +741,14 @@ export class L2Block { `startNullifierTreeSnapshot: ${inspectTreeSnapshot(this.startNullifierTreeSnapshot)}`, `startContractTreeSnapshot: ${inspectTreeSnapshot(this.startContractTreeSnapshot)}`, `startPublicDataTreeRoot: ${this.startPublicDataTreeRoot.toString()}`, - `startL1ToL2MessageTreeSnapshot: ${inspectTreeSnapshot(this.startL1ToL2MessageTreeSnapshot)}`, + `startL1ToL2MessagesTreeSnapshot: ${inspectTreeSnapshot(this.startL1ToL2MessagesTreeSnapshot)}`, `startHistoricBlocksTreeSnapshot: ${inspectTreeSnapshot(this.startHistoricBlocksTreeSnapshot)}`, `endPrivateDataTreeSnapshot: ${inspectTreeSnapshot(this.endPrivateDataTreeSnapshot)}`, `endNullifierTreeSnapshot: ${inspectTreeSnapshot(this.endNullifierTreeSnapshot)}`, `endContractTreeSnapshot: ${inspectTreeSnapshot(this.endContractTreeSnapshot)}`, `endPublicDataTreeRoot: ${this.endPublicDataTreeRoot.toString()}`, `endPublicDataTreeRoot: ${this.endPublicDataTreeRoot.toString()}`, - `endL1ToL2MessageTreeSnapshot: ${inspectTreeSnapshot(this.endL1ToL2MessageTreeSnapshot)}`, + `endL1ToL2MessagesTreeSnapshot: ${inspectTreeSnapshot(this.endL1ToL2MessagesTreeSnapshot)}`, `endHistoricBlocksTreeSnapshot: ${inspectTreeSnapshot(this.endHistoricBlocksTreeSnapshot)}`, `newCommitments: ${inspectFrArray(this.newCommitments)}`, `newNullifiers: ${inspectFrArray(this.newNullifiers)}`, diff --git a/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts b/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts index cdc1121a5e6..d4fafd16e3d 100644 --- a/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts +++ b/yarn-project/world-state/src/synchroniser/server_world_state_synchroniser.test.ts @@ -76,13 +76,13 @@ const getMockBlock = (blockNumber: number, newContractsCommitments?: Buffer[]) = startNullifierTreeSnapshot: getMockTreeSnapshot(), startContractTreeSnapshot: getMockTreeSnapshot(), startPublicDataTreeRoot: Fr.random(), - startL1ToL2MessageTreeSnapshot: getMockTreeSnapshot(), + startL1ToL2MessagesTreeSnapshot: getMockTreeSnapshot(), startHistoricBlocksTreeSnapshot: getMockTreeSnapshot(), endPrivateDataTreeSnapshot: getMockTreeSnapshot(), endNullifierTreeSnapshot: getMockTreeSnapshot(), endContractTreeSnapshot: getMockTreeSnapshot(), endPublicDataTreeRoot: Fr.random(), - endL1ToL2MessageTreeSnapshot: getMockTreeSnapshot(), + endL1ToL2MessagesTreeSnapshot: getMockTreeSnapshot(), endHistoricBlocksTreeSnapshot: 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_trees.ts b/yarn-project/world-state/src/world-state-db/merkle_trees.ts index 23166d50787..b4cd63846a7 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 @@ -536,7 +536,7 @@ export class MerkleTrees implements MerkleTreeDb { compareRoot(l2Block.endNullifierTreeSnapshot.root, MerkleTreeId.NULLIFIER_TREE), compareRoot(l2Block.endPrivateDataTreeSnapshot.root, MerkleTreeId.PRIVATE_DATA_TREE), compareRoot(l2Block.endPublicDataTreeRoot, MerkleTreeId.PUBLIC_DATA_TREE), - compareRoot(l2Block.endL1ToL2MessageTreeSnapshot.root, MerkleTreeId.L1_TO_L2_MESSAGES_TREE), + compareRoot(l2Block.endL1ToL2MessagesTreeSnapshot.root, MerkleTreeId.L1_TO_L2_MESSAGES_TREE), compareRoot(l2Block.endHistoricBlocksTreeSnapshot.root, MerkleTreeId.BLOCKS_TREE), ]; const ourBlock = rootChecks.every(x => x);