@aztec/world-state 0.0.1-commit.f504929 → 0.0.1-commit.f650c0a5c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dest/native/fork_checkpoint.d.ts +7 -1
  2. package/dest/native/fork_checkpoint.d.ts.map +1 -1
  3. package/dest/native/fork_checkpoint.js +15 -3
  4. package/dest/native/merkle_trees_facade.d.ts +4 -4
  5. package/dest/native/merkle_trees_facade.d.ts.map +1 -1
  6. package/dest/native/merkle_trees_facade.js +8 -5
  7. package/dest/native/message.d.ts +12 -4
  8. package/dest/native/message.d.ts.map +1 -1
  9. package/dest/native/native_world_state.d.ts +7 -5
  10. package/dest/native/native_world_state.d.ts.map +1 -1
  11. package/dest/native/native_world_state.js +14 -9
  12. package/dest/native/native_world_state_instance.d.ts +4 -4
  13. package/dest/native/native_world_state_instance.d.ts.map +1 -1
  14. package/dest/native/native_world_state_instance.js +7 -6
  15. package/dest/native/world_state_ops_queue.js +5 -5
  16. package/dest/synchronizer/factory.d.ts +5 -5
  17. package/dest/synchronizer/factory.d.ts.map +1 -1
  18. package/dest/synchronizer/factory.js +6 -5
  19. package/dest/synchronizer/server_world_state_synchronizer.d.ts +4 -4
  20. package/dest/synchronizer/server_world_state_synchronizer.d.ts.map +1 -1
  21. package/dest/synchronizer/server_world_state_synchronizer.js +59 -10
  22. package/dest/testing.d.ts +4 -3
  23. package/dest/testing.d.ts.map +1 -1
  24. package/dest/testing.js +10 -6
  25. package/dest/world-state-db/merkle_tree_db.d.ts +1 -10
  26. package/dest/world-state-db/merkle_tree_db.d.ts.map +1 -1
  27. package/package.json +9 -10
  28. package/src/native/fork_checkpoint.ts +19 -3
  29. package/src/native/merkle_trees_facade.ts +13 -6
  30. package/src/native/message.ts +13 -3
  31. package/src/native/native_world_state.ts +12 -18
  32. package/src/native/native_world_state_instance.ts +8 -4
  33. package/src/native/world_state_ops_queue.ts +5 -5
  34. package/src/synchronizer/factory.ts +7 -7
  35. package/src/synchronizer/server_world_state_synchronizer.ts +65 -13
  36. package/src/testing.ts +8 -9
  37. package/src/world-state-db/merkle_tree_db.ts +0 -10
@@ -11,7 +11,7 @@ import {
11
11
  import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
12
12
  import { NativeWorldState as BaseNativeWorldState, MsgpackChannel } from '@aztec/native';
13
13
  import { MerkleTreeId } from '@aztec/stdlib/trees';
14
- import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
14
+ import { EMPTY_GENESIS_DATA, type GenesisData } from '@aztec/stdlib/world-state';
15
15
 
16
16
  import assert from 'assert';
17
17
  import { cpus } from 'os';
@@ -55,7 +55,7 @@ export class NativeWorldState implements NativeWorldStateInstance {
55
55
  constructor(
56
56
  private readonly dataDir: string,
57
57
  private readonly wsTreeMapSizes: WorldStateTreeMapSizes,
58
- private readonly prefilledPublicData: PublicDataTreeLeaf[] = [],
58
+ private readonly genesis: GenesisData = EMPTY_GENESIS_DATA,
59
59
  private readonly instrumentation: WorldStateInstrumentation,
60
60
  bindings?: LoggerBindings,
61
61
  private readonly log: Logger = createLogger('world-state:database', bindings),
@@ -66,7 +66,10 @@ export class NativeWorldState implements NativeWorldStateInstance {
66
66
  wsTreeMapSizes,
67
67
  )} and ${threads} threads.`,
68
68
  );
69
- const prefilledPublicDataBufferArray = prefilledPublicData.map(d => [d.slot.toBuffer(), d.value.toBuffer()]);
69
+ const prefilledPublicDataBufferArray = genesis.prefilledPublicData.map(d => [
70
+ d.slot.toBuffer(),
71
+ d.value.toBuffer(),
72
+ ]);
70
73
  const ws = new BaseNativeWorldState(
71
74
  dataDir,
72
75
  {
@@ -82,6 +85,7 @@ export class NativeWorldState implements NativeWorldStateInstance {
82
85
  },
83
86
  prefilledPublicDataBufferArray,
84
87
  DomainSeparator.BLOCK_HEADER_HASH,
88
+ Number(genesis.genesisTimestamp),
85
89
  {
86
90
  [MerkleTreeId.NULLIFIER_TREE]: wsTreeMapSizes.nullifierTreeMapSizeKb,
87
91
  [MerkleTreeId.NOTE_HASH_TREE]: wsTreeMapSizes.noteHashTreeMapSizeKb,
@@ -104,7 +108,7 @@ export class NativeWorldState implements NativeWorldStateInstance {
104
108
  return new NativeWorldState(
105
109
  this.dataDir,
106
110
  this.wsTreeMapSizes,
107
- this.prefilledPublicData,
111
+ this.genesis,
108
112
  this.instrumentation,
109
113
  this.log.getBindings(),
110
114
  this.log,
@@ -96,7 +96,7 @@ export class WorldStateOpsQueue {
96
96
  // then send the request immediately
97
97
  // If a mutating request is in flight then we must wait
98
98
  // If a mutating request is not in flight but something is queued then it must be a mutating request
99
- if (this.inFlightMutatingCount == 0 && this.requests.length == 0) {
99
+ if (this.inFlightMutatingCount === 0 && this.requests.length === 0) {
100
100
  this.sendEnqueuedRequest(op);
101
101
  } else {
102
102
  this.requests.push(op);
@@ -122,7 +122,7 @@ export class WorldStateOpsQueue {
122
122
  --this.inFlightCount;
123
123
 
124
124
  // If there are still requests in flight then do nothing further
125
- if (this.inFlightCount != 0) {
125
+ if (this.inFlightCount !== 0) {
126
126
  return;
127
127
  }
128
128
 
@@ -134,7 +134,7 @@ export class WorldStateOpsQueue {
134
134
  while (this.requests.length > 0) {
135
135
  const next = this.requests[0];
136
136
  if (next.mutating) {
137
- if (this.inFlightCount == 0) {
137
+ if (this.inFlightCount === 0) {
138
138
  // send the mutating request
139
139
  this.requests.shift();
140
140
  this.sendEnqueuedRequest(next);
@@ -149,7 +149,7 @@ export class WorldStateOpsQueue {
149
149
  }
150
150
 
151
151
  // If the queue is empty, there is nothing in flight and we have been told to stop, then resolve the stop promise
152
- if (this.inFlightCount == 0 && this.stopResolve !== undefined) {
152
+ if (this.inFlightCount === 0 && this.stopResolve !== undefined) {
153
153
  this.stopResolve();
154
154
  }
155
155
  }
@@ -182,7 +182,7 @@ export class WorldStateOpsQueue {
182
182
  });
183
183
 
184
184
  // If no outstanding requests then immediately resolve the promise
185
- if (this.requests.length == 0 && this.inFlightCount == 0 && this.stopResolve !== undefined) {
185
+ if (this.requests.length === 0 && this.inFlightCount === 0 && this.stopResolve !== undefined) {
186
186
  this.stopResolve();
187
187
  }
188
188
  return this.stopPromise;
@@ -1,8 +1,8 @@
1
1
  import type { LoggerBindings } from '@aztec/foundation/log';
2
- import type { DataStoreConfig } from '@aztec/kv-store/config';
3
2
  import type { L2BlockSource } from '@aztec/stdlib/block';
3
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
4
4
  import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
5
- import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
5
+ import { EMPTY_GENESIS_DATA, type GenesisData } from '@aztec/stdlib/world-state';
6
6
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
7
7
 
8
8
  import { WorldStateInstrumentation } from '../instrumentation/instrumentation.js';
@@ -21,12 +21,12 @@ export interface WorldStateTreeMapSizes {
21
21
  export async function createWorldStateSynchronizer(
22
22
  config: WorldStateConfig & DataStoreConfig,
23
23
  l2BlockSource: L2BlockSource & L1ToL2MessageSource,
24
- prefilledPublicData: PublicDataTreeLeaf[] = [],
24
+ genesis: GenesisData = EMPTY_GENESIS_DATA,
25
25
  client: TelemetryClient = getTelemetryClient(),
26
26
  bindings?: LoggerBindings,
27
27
  ) {
28
28
  const instrumentation = new WorldStateInstrumentation(client);
29
- const merkleTrees = await createWorldState(config, prefilledPublicData, instrumentation, bindings);
29
+ const merkleTrees = await createWorldState(config, genesis, instrumentation, bindings);
30
30
  return new ServerWorldStateSynchronizer(merkleTrees, l2BlockSource, config, instrumentation);
31
31
  }
32
32
 
@@ -42,7 +42,7 @@ export async function createWorldState(
42
42
  | 'publicDataTreeMapSizeKb'
43
43
  > &
44
44
  Pick<DataStoreConfig, 'dataDirectory' | 'dataStoreMapSizeKb' | 'l1Contracts'>,
45
- prefilledPublicData: PublicDataTreeLeaf[] = [],
45
+ genesis: GenesisData = EMPTY_GENESIS_DATA,
46
46
  instrumentation: WorldStateInstrumentation = new WorldStateInstrumentation(getTelemetryClient()),
47
47
  bindings?: LoggerBindings,
48
48
  ) {
@@ -66,14 +66,14 @@ export async function createWorldState(
66
66
  config.l1Contracts.rollupAddress,
67
67
  dataDirectory,
68
68
  wsTreeMapSizes,
69
- prefilledPublicData,
69
+ genesis,
70
70
  instrumentation,
71
71
  bindings,
72
72
  )
73
73
  : await NativeWorldStateService.tmp(
74
74
  config.l1Contracts.rollupAddress,
75
75
  !['true', '1'].includes(process.env.DEBUG_WORLD_STATE!),
76
- prefilledPublicData,
76
+ genesis,
77
77
  instrumentation,
78
78
  bindings,
79
79
  );
@@ -1,10 +1,11 @@
1
- import { GENESIS_BLOCK_HEADER_HASH, INITIAL_L2_BLOCK_NUM, INITIAL_L2_CHECKPOINT_NUM } from '@aztec/constants';
1
+ import { GENESIS_BLOCK_HEADER_HASH, INITIAL_CHECKPOINT_NUMBER, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
2
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { type Logger, createLogger } from '@aztec/foundation/log';
5
5
  import { promiseWithResolvers } from '@aztec/foundation/promise';
6
6
  import { elapsed } from '@aztec/foundation/timer';
7
7
  import {
8
+ type BlockHash,
8
9
  GENESIS_CHECKPOINT_HEADER_HASH,
9
10
  type L2Block,
10
11
  type L2BlockId,
@@ -177,13 +178,10 @@ export class ServerWorldStateSynchronizer
177
178
  /**
178
179
  * Forces an immediate sync.
179
180
  * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
180
- * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
181
+ * @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash. On mismatch, triggers a resync (reorg detection).
181
182
  * @returns A promise that resolves with the block number the world state was synced to
182
183
  */
183
- public async syncImmediate(
184
- targetBlockNumber?: BlockNumber,
185
- skipThrowIfTargetNotReached?: boolean,
186
- ): Promise<BlockNumber> {
184
+ public async syncImmediate(targetBlockNumber?: BlockNumber, blockHash?: BlockHash): Promise<BlockNumber> {
187
185
  if (this.currentState !== WorldStateRunningState.RUNNING) {
188
186
  throw new Error(`World State is not running. Unable to perform sync.`);
189
187
  }
@@ -195,7 +193,19 @@ export class ServerWorldStateSynchronizer
195
193
  // If we have been given a block number to sync to and we have reached that number then return
196
194
  const currentBlockNumber = await this.getLatestBlockNumber();
197
195
  if (targetBlockNumber !== undefined && targetBlockNumber <= currentBlockNumber) {
198
- return currentBlockNumber;
196
+ if (blockHash === undefined) {
197
+ return currentBlockNumber;
198
+ }
199
+
200
+ // If a block hash was provided, verify we're on the expected fork
201
+ const currentHash = await this.getL2BlockHash(targetBlockNumber);
202
+ if (currentHash === blockHash.toString()) {
203
+ return currentBlockNumber;
204
+ }
205
+ // Hash mismatch: a reorg may have occurred, fall through to trigger sync
206
+ this.log.debug(
207
+ `World state block hash mismatch at ${targetBlockNumber} (expected ${blockHash}, got ${currentHash}). Triggering resync.`,
208
+ );
199
209
  }
200
210
  this.log.debug(`World State at ${currentBlockNumber} told to sync to ${targetBlockNumber ?? 'latest'}`);
201
211
 
@@ -213,7 +223,7 @@ export class ServerWorldStateSynchronizer
213
223
 
214
224
  // If we have been given a block number to sync to and we have not reached that number then fail
215
225
  const updatedBlockNumber = await this.getLatestBlockNumber();
216
- if (!skipThrowIfTargetNotReached && targetBlockNumber !== undefined && targetBlockNumber > updatedBlockNumber) {
226
+ if (targetBlockNumber !== undefined && targetBlockNumber > updatedBlockNumber) {
217
227
  throw new WorldStateSynchronizerError(
218
228
  `Unable to sync to block number ${targetBlockNumber} (last synced is ${updatedBlockNumber})`,
219
229
  {
@@ -227,6 +237,24 @@ export class ServerWorldStateSynchronizer
227
237
  );
228
238
  }
229
239
 
240
+ // If a block hash was provided, verify we're on the expected fork after syncing, throw otherwise
241
+ if (blockHash !== undefined && targetBlockNumber !== undefined) {
242
+ const updatedHash = await this.getL2BlockHash(targetBlockNumber);
243
+ if (updatedHash !== blockHash.toString()) {
244
+ throw new WorldStateSynchronizerError(
245
+ `Block hash mismatch at block ${targetBlockNumber} (expected ${blockHash} but got ${updatedHash})`,
246
+ {
247
+ cause: {
248
+ reason: 'block_hash_mismatch',
249
+ targetBlockNumber,
250
+ expectedHash: blockHash.toString(),
251
+ actualHash: updatedHash,
252
+ },
253
+ },
254
+ );
255
+ }
256
+ }
257
+
230
258
  return updatedBlockNumber;
231
259
  }
232
260
 
@@ -263,15 +291,19 @@ export class ServerWorldStateSynchronizer
263
291
  proposed: latestBlockId,
264
292
  checkpointed: {
265
293
  block: { number: INITIAL_L2_BLOCK_NUM, hash: GENESIS_BLOCK_HEADER_HASH.toString() },
266
- checkpoint: { number: INITIAL_L2_CHECKPOINT_NUM, hash: genesisCheckpointHeaderHash },
294
+ checkpoint: { number: INITIAL_CHECKPOINT_NUMBER, hash: genesisCheckpointHeaderHash },
295
+ },
296
+ proposedCheckpoint: {
297
+ block: { number: INITIAL_L2_BLOCK_NUM, hash: GENESIS_BLOCK_HEADER_HASH.toString() },
298
+ checkpoint: { number: INITIAL_CHECKPOINT_NUMBER, hash: genesisCheckpointHeaderHash },
267
299
  },
268
300
  finalized: {
269
301
  block: { number: status.finalizedBlockNumber, hash: finalizedBlockHash ?? '' },
270
- checkpoint: { number: INITIAL_L2_CHECKPOINT_NUM, hash: genesisCheckpointHeaderHash },
302
+ checkpoint: { number: INITIAL_CHECKPOINT_NUMBER, hash: genesisCheckpointHeaderHash },
271
303
  },
272
304
  proven: {
273
305
  block: { number: provenBlockNumber, hash: provenBlockHash ?? '' },
274
- checkpoint: { number: INITIAL_L2_CHECKPOINT_NUM, hash: genesisCheckpointHeaderHash },
306
+ checkpoint: { number: INITIAL_CHECKPOINT_NUMBER, hash: genesisCheckpointHeaderHash },
275
307
  },
276
308
  };
277
309
  }
@@ -360,6 +392,18 @@ export class ServerWorldStateSynchronizer
360
392
 
361
393
  private async handleChainFinalized(blockNumber: BlockNumber) {
362
394
  this.log.verbose(`Finalized chain is now at block ${blockNumber}`);
395
+ // If the finalized block number is older than the oldest available block in world state,
396
+ // skip entirely. The finalized block number can jump backwards (e.g. when the finalization
397
+ // heuristic changes) and try to read block data that has already been pruned. When this
398
+ // happens, there is nothing useful to do — the native world state is already finalized
399
+ // past this point and pruning has already happened.
400
+ const currentSummary = await this.merkleTreeDb.getStatusSummary();
401
+ if (blockNumber < currentSummary.oldestHistoricalBlock || blockNumber < 1) {
402
+ this.log.trace(
403
+ `Finalized block ${blockNumber} is older than the oldest available block ${currentSummary.oldestHistoricalBlock}. Skipping.`,
404
+ );
405
+ return;
406
+ }
363
407
  const summary = await this.merkleTreeDb.setFinalized(blockNumber);
364
408
  if (this.historyToKeep === undefined) {
365
409
  return;
@@ -393,6 +437,12 @@ export class ServerWorldStateSynchronizer
393
437
  }
394
438
  // Find the block at the start of the checkpoint and remove blocks up to this one
395
439
  const newHistoricBlock = historicCheckpoint.checkpoint.blocks[0];
440
+ if (newHistoricBlock.number <= currentSummary.oldestHistoricalBlock) {
441
+ this.log.debug(
442
+ `Historic block ${newHistoricBlock.number} is not newer than oldest available ${currentSummary.oldestHistoricalBlock}. Skipping prune.`,
443
+ );
444
+ return;
445
+ }
396
446
  this.log.verbose(`Pruning historic blocks to ${newHistoricBlock.number}`);
397
447
  const status = await this.merkleTreeDb.removeHistoricalBlocks(BlockNumber(newHistoricBlock.number));
398
448
  this.log.debug(`World state summary `, status.summary);
@@ -405,9 +455,11 @@ export class ServerWorldStateSynchronizer
405
455
  }
406
456
 
407
457
  private async handleChainPruned(blockNumber: BlockNumber) {
408
- this.log.warn(`Chain pruned to block ${blockNumber}`);
458
+ this.log.info(`Chain pruned to block ${blockNumber}`);
409
459
  const status = await this.merkleTreeDb.unwindBlocks(blockNumber);
410
- this.provenBlockNumber = undefined;
460
+ if (this.provenBlockNumber !== undefined && this.provenBlockNumber > blockNumber) {
461
+ this.provenBlockNumber = undefined;
462
+ }
411
463
  this.instrumentation.updateWorldStateMetrics(status);
412
464
  }
413
465
 
package/src/testing.ts CHANGED
@@ -3,22 +3,19 @@ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import { MerkleTreeId, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
6
+ import type { GenesisData } from '@aztec/stdlib/world-state';
6
7
 
7
8
  import { NativeWorldStateService } from './native/index.js';
8
9
 
9
- async function generateGenesisValues(prefilledPublicData: PublicDataTreeLeaf[]) {
10
- if (!prefilledPublicData.length) {
10
+ async function generateGenesisValues(genesis: GenesisData) {
11
+ if (!genesis.prefilledPublicData.length && genesis.genesisTimestamp === 0n) {
11
12
  return {
12
13
  genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT),
13
14
  };
14
15
  }
15
16
 
16
17
  // Create a temporary world state to compute the genesis values.
17
- const ws = await NativeWorldStateService.tmp(
18
- undefined /* rollupAddress */,
19
- true /* cleanupTmpDir */,
20
- prefilledPublicData,
21
- );
18
+ const ws = await NativeWorldStateService.tmp(undefined /* rollupAddress */, true /* cleanupTmpDir */, genesis);
22
19
  const genesisArchiveRoot = new Fr((await ws.getCommitted().getTreeInfo(MerkleTreeId.ARCHIVE)).root);
23
20
  await ws.close();
24
21
 
@@ -33,6 +30,7 @@ export async function getGenesisValues(
33
30
  initialAccounts: AztecAddress[],
34
31
  initialAccountFeeJuice = defaultInitialAccountFeeJuice,
35
32
  genesisPublicData: PublicDataTreeLeaf[] = [],
33
+ genesisTimestamp: bigint = 0n,
36
34
  ) {
37
35
  // Top up the accounts with fee juice.
38
36
  let prefilledPublicData = await Promise.all(
@@ -46,11 +44,12 @@ export async function getGenesisValues(
46
44
 
47
45
  prefilledPublicData.sort((a, b) => (b.slot.lt(a.slot) ? 1 : -1));
48
46
 
49
- const { genesisArchiveRoot } = await generateGenesisValues(prefilledPublicData);
47
+ const genesis: GenesisData = { prefilledPublicData, genesisTimestamp };
48
+ const { genesisArchiveRoot } = await generateGenesisValues(genesis);
50
49
 
51
50
  return {
52
51
  genesisArchiveRoot,
53
- prefilledPublicData,
52
+ genesis,
54
53
  fundingNeeded: BigInt(initialAccounts.length) * initialAccountFeeJuice.toBigInt(),
55
54
  };
56
55
  }
@@ -1,14 +1,12 @@
1
1
  import { MAX_NULLIFIERS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/constants';
2
2
  import type { BlockNumber } from '@aztec/foundation/branded-types';
3
3
  import type { Fr } from '@aztec/foundation/curves/bn254';
4
- import type { IndexedTreeSnapshot, TreeSnapshot } from '@aztec/merkle-tree';
5
4
  import type { L2Block } from '@aztec/stdlib/block';
6
5
  import type {
7
6
  ForkMerkleTreeOperations,
8
7
  MerkleTreeReadOperations,
9
8
  ReadonlyWorldStateAccess,
10
9
  } from '@aztec/stdlib/interfaces/server';
11
- import type { MerkleTreeId } from '@aztec/stdlib/trees';
12
10
 
13
11
  import type { WorldStateStatusFull, WorldStateStatusSummary } from '../native/message.js';
14
12
 
@@ -31,14 +29,6 @@ export const INITIAL_NULLIFIER_TREE_SIZE = 2 * MAX_NULLIFIERS_PER_TX;
31
29
 
32
30
  export const INITIAL_PUBLIC_DATA_TREE_SIZE = 2 * MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX;
33
31
 
34
- export type TreeSnapshots = {
35
- [MerkleTreeId.NULLIFIER_TREE]: IndexedTreeSnapshot;
36
- [MerkleTreeId.NOTE_HASH_TREE]: TreeSnapshot<Fr>;
37
- [MerkleTreeId.PUBLIC_DATA_TREE]: IndexedTreeSnapshot;
38
- [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: TreeSnapshot<Fr>;
39
- [MerkleTreeId.ARCHIVE]: TreeSnapshot<Fr>;
40
- };
41
-
42
32
  export interface MerkleTreeAdminDatabase extends ForkMerkleTreeOperations, ReadonlyWorldStateAccess {
43
33
  /**
44
34
  * Handles a single L2 block (i.e. Inserts the new note hashes into the merkle tree).