@aztec/txe 0.0.1-commit.9b94fc1 → 0.0.1-commit.c7c42ec

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 (72) hide show
  1. package/dest/index.d.ts +1 -1
  2. package/dest/index.d.ts.map +1 -1
  3. package/dest/index.js +3 -2
  4. package/dest/oracle/interfaces.d.ts +9 -6
  5. package/dest/oracle/interfaces.d.ts.map +1 -1
  6. package/dest/oracle/txe_oracle_public_context.d.ts +5 -5
  7. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  8. package/dest/oracle/txe_oracle_public_context.js +4 -6
  9. package/dest/oracle/txe_oracle_top_level_context.d.ts +20 -12
  10. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_top_level_context.js +77 -54
  12. package/dest/rpc_translator.d.ts +11 -5
  13. package/dest/rpc_translator.d.ts.map +1 -1
  14. package/dest/rpc_translator.js +57 -15
  15. package/dest/state_machine/archiver.d.ts +26 -10
  16. package/dest/state_machine/archiver.d.ts.map +1 -1
  17. package/dest/state_machine/archiver.js +105 -17
  18. package/dest/state_machine/dummy_p2p_client.d.ts +1 -1
  19. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  20. package/dest/state_machine/dummy_p2p_client.js +3 -1
  21. package/dest/state_machine/global_variable_builder.d.ts +5 -4
  22. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  23. package/dest/state_machine/global_variable_builder.js +12 -0
  24. package/dest/state_machine/index.d.ts +5 -5
  25. package/dest/state_machine/index.d.ts.map +1 -1
  26. package/dest/state_machine/index.js +14 -20
  27. package/dest/state_machine/synchronizer.d.ts +5 -4
  28. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  29. package/dest/state_machine/synchronizer.js +5 -4
  30. package/dest/txe_session.d.ts +19 -13
  31. package/dest/txe_session.d.ts.map +1 -1
  32. package/dest/txe_session.js +50 -38
  33. package/dest/util/encoding.d.ts +610 -11
  34. package/dest/util/encoding.d.ts.map +1 -1
  35. package/dest/util/encoding.js +1 -1
  36. package/dest/util/txe_account_store.d.ts +10 -0
  37. package/dest/util/txe_account_store.d.ts.map +1 -0
  38. package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
  39. package/dest/util/txe_contract_store.d.ts +12 -0
  40. package/dest/util/txe_contract_store.d.ts.map +1 -0
  41. package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
  42. package/dest/util/txe_public_contract_data_source.d.ts +7 -6
  43. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  44. package/dest/util/txe_public_contract_data_source.js +11 -11
  45. package/dest/utils/block_creation.d.ts +19 -4
  46. package/dest/utils/block_creation.d.ts.map +1 -1
  47. package/dest/utils/block_creation.js +23 -2
  48. package/dest/utils/tx_effect_creation.d.ts +4 -3
  49. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  50. package/dest/utils/tx_effect_creation.js +1 -1
  51. package/package.json +17 -17
  52. package/src/index.ts +15 -12
  53. package/src/oracle/interfaces.ts +8 -5
  54. package/src/oracle/txe_oracle_public_context.ts +6 -11
  55. package/src/oracle/txe_oracle_top_level_context.ts +109 -80
  56. package/src/rpc_translator.ts +82 -12
  57. package/src/state_machine/archiver.ts +136 -25
  58. package/src/state_machine/dummy_p2p_client.ts +3 -1
  59. package/src/state_machine/global_variable_builder.ts +20 -3
  60. package/src/state_machine/index.ts +19 -18
  61. package/src/state_machine/synchronizer.ts +8 -7
  62. package/src/txe_session.ts +107 -68
  63. package/src/util/encoding.ts +1 -1
  64. package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
  65. package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
  66. package/src/util/txe_public_contract_data_source.ts +13 -12
  67. package/src/utils/block_creation.ts +34 -3
  68. package/src/utils/tx_effect_creation.ts +3 -2
  69. package/dest/util/txe_account_data_provider.d.ts +0 -10
  70. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  71. package/dest/util/txe_contract_data_provider.d.ts +0 -12
  72. package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
@@ -1,11 +1,22 @@
1
- import { ArchiverStoreHelper, KVArchiverDataStore, type PublishedL2Block } from '@aztec/archiver';
1
+ import { ArchiverStoreHelper, KVArchiverDataStore } from '@aztec/archiver';
2
2
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
3
- import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import type { EthAddress } from '@aztec/foundation/eth-address';
5
- import { Fr } from '@aztec/foundation/fields';
6
+ import { isDefined } from '@aztec/foundation/types';
6
7
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
7
8
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import type { L2Block, L2BlockSource, L2Tips, ValidateBlockResult } from '@aztec/stdlib/block';
9
+ import {
10
+ CommitteeAttestation,
11
+ L2Block,
12
+ type L2BlockId,
13
+ type L2BlockNew,
14
+ type L2BlockSource,
15
+ type L2Tips,
16
+ PublishedL2Block,
17
+ type ValidateBlockResult,
18
+ } from '@aztec/stdlib/block';
19
+ import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
9
20
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
10
21
  import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
11
22
  import type { BlockHeader } from '@aztec/stdlib/tx';
@@ -19,11 +30,28 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
19
30
  super(new KVArchiverDataStore(db, 9999));
20
31
  }
21
32
 
22
- public override async addBlocks(blocks: PublishedL2Block[]): Promise<boolean> {
23
- const opResults = await Promise.all([
24
- this.store.addLogs(blocks.map(block => block.block)),
25
- this.store.addBlocks(blocks),
26
- ]);
33
+ public async getBlock(number: BlockNumber): Promise<L2Block | undefined> {
34
+ if (number === 0) {
35
+ return undefined;
36
+ }
37
+ const publishedBlocks = await this.getPublishedBlocks(number, 1);
38
+ if (publishedBlocks.length === 0) {
39
+ return undefined;
40
+ }
41
+ return publishedBlocks[0].block;
42
+ }
43
+
44
+ public async getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]> {
45
+ const publishedBlocks = await this.getPublishedBlocks(from, limit, proven);
46
+ return publishedBlocks.map(x => x.block);
47
+ }
48
+
49
+ public override async addCheckpoints(
50
+ checkpoints: PublishedCheckpoint[],
51
+ _result?: ValidateBlockResult,
52
+ ): Promise<boolean> {
53
+ const allBlocks = checkpoints.flatMap(ch => ch.checkpoint.blocks);
54
+ const opResults = await Promise.all([this.store.addLogs(allBlocks), this.store.addCheckpoints(checkpoints)]);
27
55
 
28
56
  return opResults.every(Boolean);
29
57
  }
@@ -32,16 +60,16 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
32
60
  * Gets the number of the latest L2 block processed by the block source implementation.
33
61
  * @returns The number of the latest L2 block processed by the block source implementation.
34
62
  */
35
- public getBlockNumber(): Promise<number> {
36
- return this.store.getSynchedL2BlockNumber();
63
+ public getBlockNumber(): Promise<BlockNumber> {
64
+ return this.store.getLatestBlockNumber();
37
65
  }
38
66
 
39
67
  /**
40
68
  * Gets the number of the latest L2 block proven seen by the block source implementation.
41
69
  * @returns The number of the latest L2 block proven seen by the block source implementation.
42
70
  */
43
- public getProvenBlockNumber(): Promise<number> {
44
- return this.store.getSynchedL2BlockNumber();
71
+ public override getProvenBlockNumber(): Promise<BlockNumber> {
72
+ return this.store.getProvenBlockNumber();
45
73
  }
46
74
 
47
75
  /**
@@ -49,16 +77,55 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
49
77
  * @param number - The block number to return (inclusive).
50
78
  * @returns The requested L2 block.
51
79
  */
52
- public override async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
80
+ public async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
53
81
  // If the number provided is -ve, then return the latest block.
54
82
  if (number < 0) {
55
- number = await this.store.getSynchedL2BlockNumber();
83
+ number = await this.store.getLatestBlockNumber();
56
84
  }
57
85
  if (number == 0) {
58
86
  return undefined;
59
87
  }
60
- const blocks = await this.store.getPublishedBlocks(number, 1);
61
- return blocks.length === 0 ? undefined : blocks[0];
88
+ const publishedBlocks = await this.retrievePublishedBlocks(BlockNumber(number), 1);
89
+ return publishedBlocks.length === 0 ? undefined : publishedBlocks[0];
90
+ }
91
+
92
+ getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]> {
93
+ return this.retrievePublishedBlocks(from, limit, proven);
94
+ }
95
+
96
+ private async retrievePublishedBlocks(
97
+ from: BlockNumber,
98
+ limit: number,
99
+ proven?: boolean,
100
+ ): Promise<PublishedL2Block[]> {
101
+ const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
102
+ const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
103
+ const blocks = (
104
+ await Promise.all(checkpoints.map(ch => this.store.getBlocksForCheckpoint(ch.checkpointNumber)))
105
+ ).filter(isDefined);
106
+
107
+ const olbBlocks: PublishedL2Block[] = [];
108
+ for (let i = 0; i < checkpoints.length; i++) {
109
+ const blockForCheckpoint = blocks[i][0];
110
+ const checkpoint = checkpoints[i];
111
+ if (proven === true && checkpoint.checkpointNumber > provenCheckpointNumber) {
112
+ continue;
113
+ }
114
+ const oldCheckpoint = new Checkpoint(
115
+ blockForCheckpoint.archive,
116
+ checkpoint.header,
117
+ [blockForCheckpoint],
118
+ checkpoint.checkpointNumber,
119
+ );
120
+ const oldBlock = L2Block.fromCheckpoint(oldCheckpoint);
121
+ const publishedBlock = new PublishedL2Block(
122
+ oldBlock,
123
+ checkpoint.l1,
124
+ checkpoint.attestations.map(x => CommitteeAttestation.fromBuffer(x)),
125
+ );
126
+ olbBlocks.push(publishedBlock);
127
+ }
128
+ return olbBlocks;
62
129
  }
63
130
 
64
131
  /**
@@ -66,8 +133,20 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
66
133
  * @param number - The block number to return (inclusive).
67
134
  * @returns The requested L2 block.
68
135
  */
69
- public getBlock(number: number | 'latest'): Promise<L2Block | undefined> {
70
- return this.getPublishedBlock(number != 'latest' ? number : -1).then(block => block?.block);
136
+ public getL2Block(number: BlockNumber | 'latest'): Promise<L2Block | undefined> {
137
+ return this.getPublishedBlock(number != 'latest' ? number : -1).then(b => b?.block);
138
+ }
139
+
140
+ /**
141
+ * Gets an L2 block (new format).
142
+ * @param number - The block number to return.
143
+ * @returns The requested L2 block.
144
+ */
145
+ public getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined> {
146
+ if (number === 0) {
147
+ return Promise.resolve(undefined);
148
+ }
149
+ return this.store.getBlock(number);
71
150
  }
72
151
 
73
152
  /**
@@ -77,17 +156,25 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
77
156
  */
78
157
  public async getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {
79
158
  if (number === 'latest') {
80
- number = await this.store.getSynchedL2BlockNumber();
159
+ number = await this.store.getLatestBlockNumber();
81
160
  }
82
161
  if (number === 0) {
83
162
  return undefined;
84
163
  }
85
- const headers = await this.store.getBlockHeaders(number, 1);
164
+ const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
86
165
  return headers.length === 0 ? undefined : headers[0];
87
166
  }
88
167
 
89
- public getBlocks(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
90
- return this.getPublishedBlocks(from, limit).then(blocks => blocks.map(b => b.block));
168
+ public getBlockRange(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
169
+ return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
170
+ }
171
+
172
+ public getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]> {
173
+ throw new Error('TXE Archiver does not implement "getPublishedCheckpoints"');
174
+ }
175
+
176
+ public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
177
+ throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
91
178
  }
92
179
 
93
180
  public getL2SlotNumber(): Promise<SlotNumber | undefined> {
@@ -98,6 +185,10 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
98
185
  throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
99
186
  }
100
187
 
188
+ public getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]> {
189
+ throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
190
+ }
191
+
101
192
  public getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]> {
102
193
  throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
103
194
  }
@@ -110,8 +201,21 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
110
201
  throw new Error('TXE Archiver does not implement "isEpochComplete"');
111
202
  }
112
203
 
113
- public getL2Tips(): Promise<L2Tips> {
114
- throw new Error('TXE Archiver does not implement "getL2Tips"');
204
+ public async getL2Tips(): Promise<L2Tips> {
205
+ // In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
206
+ // and 'finalized' to the latest block.
207
+ const blockHeader = await this.getBlockHeader('latest');
208
+ if (!blockHeader) {
209
+ throw new Error('L2Tips requested from TXE Archiver but no block header found');
210
+ }
211
+
212
+ const number = blockHeader.globalVariables.blockNumber;
213
+ const hash = (await blockHeader.hash()).toString();
214
+ return {
215
+ latest: { number, hash } as L2BlockId,
216
+ proven: { number, hash } as L2BlockId,
217
+ finalized: { number, hash } as L2BlockId,
218
+ };
115
219
  }
116
220
 
117
221
  public getL1Constants(): Promise<L1RollupConstants> {
@@ -149,4 +253,11 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
149
253
  public override getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
150
254
  return Promise.resolve({ valid: true });
151
255
  }
256
+
257
+ getPublishedBlockByHash(_blockHash: Fr): Promise<PublishedL2Block | undefined> {
258
+ throw new Error('Method not implemented.');
259
+ }
260
+ getPublishedBlockByArchive(_archive: Fr): Promise<PublishedL2Block | undefined> {
261
+ throw new Error('Method not implemented.');
262
+ }
152
263
  }
@@ -79,7 +79,9 @@ export class DummyP2P implements P2P {
79
79
  }
80
80
 
81
81
  public getTxStatus(_txHash: TxHash): Promise<'pending' | 'mined' | undefined> {
82
- throw new Error('DummyP2P does not implement "getTxStatus"');
82
+ // In TXE there is no concept of transactions but we need to implement this because of tagging. We return 'mined'
83
+ // tx status for any tx hash.
84
+ return Promise.resolve('mined');
83
85
  }
84
86
 
85
87
  public iteratePendingTxs(): AsyncIterableIterator<Tx> {
@@ -1,9 +1,9 @@
1
- import type { SlotNumber } from '@aztec/foundation/branded-types';
1
+ import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { GasFees } from '@aztec/stdlib/gas';
5
5
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
6
- import { type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
6
+ import { type CheckpointGlobalVariables, type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
7
7
 
8
8
  export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
9
9
  public getCurrentBaseFees(): Promise<GasFees> {
@@ -11,11 +11,28 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
11
11
  }
12
12
 
13
13
  public buildGlobalVariables(
14
- _blockNumber: number,
14
+ _blockNumber: BlockNumber,
15
15
  _coinbase: EthAddress,
16
16
  _feeRecipient: AztecAddress,
17
17
  _slotNumber?: SlotNumber,
18
18
  ): Promise<GlobalVariables> {
19
19
  return Promise.resolve(makeGlobalVariables());
20
20
  }
21
+
22
+ public buildCheckpointGlobalVariables(
23
+ _coinbase: EthAddress,
24
+ _feeRecipient: AztecAddress,
25
+ _slotNumber: SlotNumber,
26
+ ): Promise<CheckpointGlobalVariables> {
27
+ const vars = makeGlobalVariables();
28
+ return Promise.resolve({
29
+ chainId: vars.chainId,
30
+ version: vars.version,
31
+ slotNumber: vars.slotNumber,
32
+ timestamp: vars.timestamp,
33
+ coinbase: vars.coinbase,
34
+ feeRecipient: vars.feeRecipient,
35
+ gasFees: vars.gasFees,
36
+ });
37
+ }
21
38
  }
@@ -2,8 +2,9 @@ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
2
  import { TestCircuitVerifier } from '@aztec/bb-prover/test';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
- import { SyncDataProvider } from '@aztec/pxe/server';
6
- import { type L2Block, PublishedL2Block } from '@aztec/stdlib/block';
5
+ import { AnchorBlockStore } from '@aztec/pxe/server';
6
+ import { L2Block } from '@aztec/stdlib/block';
7
+ import { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
7
8
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
8
9
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
9
10
 
@@ -21,13 +22,13 @@ export class TXEStateMachine {
21
22
  public node: AztecNode,
22
23
  public synchronizer: TXESynchronizer,
23
24
  public archiver: TXEArchiver,
24
- public syncDataProvider: SyncDataProvider,
25
+ public anchorBlockStore: AnchorBlockStore,
25
26
  ) {}
26
27
 
27
28
  public static async create(db: AztecAsyncKVStore) {
28
29
  const archiver = new TXEArchiver(db);
29
30
  const synchronizer = await TXESynchronizer.create();
30
- const syncDataProvider = new SyncDataProvider(db);
31
+ const anchorBlockStore = new AnchorBlockStore(db);
31
32
 
32
33
  const aztecNodeConfig = {} as AztecNodeConfig;
33
34
 
@@ -54,24 +55,24 @@ export class TXEStateMachine {
54
55
  log,
55
56
  );
56
57
 
57
- return new this(node, synchronizer, archiver, syncDataProvider);
58
+ return new this(node, synchronizer, archiver, anchorBlockStore);
58
59
  }
59
60
 
60
61
  public async handleL2Block(block: L2Block) {
62
+ const checkpoint = block.toCheckpoint();
63
+ const publishedCheckpoint = new PublishedCheckpoint(
64
+ checkpoint,
65
+ new L1PublishedData(
66
+ BigInt(block.header.globalVariables.blockNumber),
67
+ block.header.globalVariables.timestamp,
68
+ block.header.globalVariables.blockNumber.toString(),
69
+ ),
70
+ [],
71
+ );
61
72
  await Promise.all([
62
- this.synchronizer.handleL2Block(block),
63
- this.archiver.addBlocks([
64
- PublishedL2Block.fromFields({
65
- block,
66
- l1: {
67
- blockHash: block.header.globalVariables.blockNumber.toString(),
68
- blockNumber: BigInt(block.header.globalVariables.blockNumber),
69
- timestamp: block.header.globalVariables.timestamp,
70
- },
71
- attestations: [],
72
- }),
73
- ]),
74
- this.syncDataProvider.setHeader(block.getBlockHeader()),
73
+ this.synchronizer.handleL2Block(block.toL2Block()),
74
+ this.archiver.addCheckpoints([publishedCheckpoint], undefined),
75
+ this.anchorBlockStore.setHeader(block.getBlockHeader()),
75
76
  ]);
76
77
  }
77
78
  }
@@ -1,6 +1,7 @@
1
1
  import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
3
- import type { L2Block } from '@aztec/stdlib/block';
2
+ import { BlockNumber } from '@aztec/foundation/branded-types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import type { L2BlockNew } from '@aztec/stdlib/block';
4
5
  import type {
5
6
  MerkleTreeReadOperations,
6
7
  MerkleTreeWriteOperations,
@@ -12,7 +13,7 @@ import { NativeWorldStateService } from '@aztec/world-state/native';
12
13
 
13
14
  export class TXESynchronizer implements WorldStateSynchronizer {
14
15
  // This works when set to 1 as well.
15
- private blockNumber = 0;
16
+ private blockNumber = BlockNumber.ZERO;
16
17
 
17
18
  constructor(public nativeWorldStateService: NativeWorldStateService) {}
18
19
 
@@ -22,7 +23,7 @@ export class TXESynchronizer implements WorldStateSynchronizer {
22
23
  return new this(nativeWorldStateService);
23
24
  }
24
25
 
25
- public async handleL2Block(block: L2Block) {
26
+ public async handleL2Block(block: L2BlockNew) {
26
27
  await this.nativeWorldStateService.handleL2BlockAndMessages(
27
28
  block,
28
29
  Array(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).fill(0).map(Fr.zero),
@@ -37,7 +38,7 @@ export class TXESynchronizer implements WorldStateSynchronizer {
37
38
  * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
38
39
  * @returns A promise that resolves with the block number the world state was synced to
39
40
  */
40
- public syncImmediate(_minBlockNumber?: number, _skipThrowIfTargetNotReached?: boolean): Promise<number> {
41
+ public syncImmediate(_minBlockNumber?: BlockNumber, _skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber> {
41
42
  return Promise.resolve(this.blockNumber);
42
43
  }
43
44
 
@@ -48,12 +49,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
48
49
 
49
50
  /** Forks the world state at the given block number, defaulting to the latest one. */
50
51
  public fork(block?: number): Promise<MerkleTreeWriteOperations> {
51
- return this.nativeWorldStateService.fork(block);
52
+ return this.nativeWorldStateService.fork(block ? BlockNumber(block) : undefined);
52
53
  }
53
54
 
54
55
  /** Gets a handle that allows reading the state as it was at the given block number. */
55
56
  public getSnapshot(blockNumber: number): MerkleTreeReadOperations {
56
- return this.nativeWorldStateService.getSnapshot(blockNumber);
57
+ return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
57
58
  }
58
59
 
59
60
  /** Backups the db to the target path. */