@aztec/txe 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1

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 (89) hide show
  1. package/dest/bin/index.d.ts +1 -1
  2. package/dest/bin/index.js +1 -1
  3. package/dest/index.d.ts +1 -1
  4. package/dest/index.d.ts.map +1 -1
  5. package/dest/index.js +5 -2
  6. package/dest/oracle/interfaces.d.ts +55 -0
  7. package/dest/oracle/interfaces.d.ts.map +1 -0
  8. package/dest/oracle/interfaces.js +3 -0
  9. package/dest/oracle/txe_oracle_public_context.d.ts +11 -11
  10. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  11. package/dest/oracle/txe_oracle_public_context.js +30 -32
  12. package/dest/oracle/txe_oracle_top_level_context.d.ts +57 -0
  13. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
  14. package/dest/oracle/txe_oracle_top_level_context.js +432 -0
  15. package/dest/{txe_service/txe_service.d.ts → rpc_translator.d.ts} +40 -31
  16. package/dest/rpc_translator.d.ts.map +1 -0
  17. package/dest/{txe_service/txe_service.js → rpc_translator.js} +172 -125
  18. package/dest/state_machine/archiver.d.ts +18 -9
  19. package/dest/state_machine/archiver.d.ts.map +1 -1
  20. package/dest/state_machine/archiver.js +21 -4
  21. package/dest/state_machine/dummy_p2p_client.d.ts +5 -2
  22. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  23. package/dest/state_machine/dummy_p2p_client.js +6 -0
  24. package/dest/state_machine/global_variable_builder.d.ts +3 -15
  25. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  26. package/dest/state_machine/global_variable_builder.js +3 -22
  27. package/dest/state_machine/index.d.ts +2 -2
  28. package/dest/state_machine/index.d.ts.map +1 -1
  29. package/dest/state_machine/index.js +8 -6
  30. package/dest/state_machine/mock_epoch_cache.d.ts +6 -5
  31. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  32. package/dest/state_machine/mock_epoch_cache.js +8 -7
  33. package/dest/state_machine/synchronizer.d.ts +5 -4
  34. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  35. package/dest/state_machine/synchronizer.js +5 -4
  36. package/dest/txe_session.d.ts +36 -46
  37. package/dest/txe_session.d.ts.map +1 -1
  38. package/dest/txe_session.js +200 -82
  39. package/dest/util/encoding.d.ts +24 -24
  40. package/dest/util/encoding.d.ts.map +1 -1
  41. package/dest/util/encoding.js +1 -1
  42. package/dest/util/expected_failure_error.d.ts +1 -1
  43. package/dest/util/expected_failure_error.d.ts.map +1 -1
  44. package/dest/util/txe_account_data_provider.d.ts +1 -1
  45. package/dest/util/txe_account_data_provider.d.ts.map +1 -1
  46. package/dest/util/txe_contract_data_provider.d.ts +3 -2
  47. package/dest/util/txe_contract_data_provider.d.ts.map +1 -1
  48. package/dest/util/txe_contract_data_provider.js +1 -1
  49. package/dest/util/txe_public_contract_data_source.d.ts +8 -6
  50. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  51. package/dest/util/txe_public_contract_data_source.js +14 -12
  52. package/dest/utils/block_creation.d.ts +14 -0
  53. package/dest/utils/block_creation.d.ts.map +1 -0
  54. package/dest/utils/block_creation.js +24 -0
  55. package/dest/utils/tx_effect_creation.d.ts +6 -0
  56. package/dest/utils/tx_effect_creation.d.ts.map +1 -0
  57. package/dest/utils/tx_effect_creation.js +16 -0
  58. package/package.json +18 -17
  59. package/src/bin/index.ts +1 -1
  60. package/src/index.ts +5 -8
  61. package/src/oracle/interfaces.ts +84 -0
  62. package/src/oracle/txe_oracle_public_context.ts +38 -71
  63. package/src/oracle/txe_oracle_top_level_context.ts +667 -0
  64. package/src/{txe_service/txe_service.ts → rpc_translator.ts} +222 -128
  65. package/src/state_machine/archiver.ts +33 -13
  66. package/src/state_machine/dummy_p2p_client.ts +10 -1
  67. package/src/state_machine/global_variable_builder.ts +7 -41
  68. package/src/state_machine/index.ts +10 -8
  69. package/src/state_machine/mock_epoch_cache.ts +12 -11
  70. package/src/state_machine/synchronizer.ts +8 -7
  71. package/src/txe_session.ts +305 -92
  72. package/src/util/encoding.ts +1 -1
  73. package/src/util/txe_contract_data_provider.ts +2 -1
  74. package/src/util/txe_public_contract_data_source.ts +16 -13
  75. package/src/utils/block_creation.ts +64 -0
  76. package/src/utils/tx_effect_creation.ts +38 -0
  77. package/dest/oracle/txe_oracle.d.ts +0 -124
  78. package/dest/oracle/txe_oracle.d.ts.map +0 -1
  79. package/dest/oracle/txe_oracle.js +0 -770
  80. package/dest/oracle/txe_typed_oracle.d.ts +0 -42
  81. package/dest/oracle/txe_typed_oracle.d.ts.map +0 -1
  82. package/dest/oracle/txe_typed_oracle.js +0 -83
  83. package/dest/txe_constants.d.ts +0 -2
  84. package/dest/txe_constants.d.ts.map +0 -1
  85. package/dest/txe_constants.js +0 -7
  86. package/dest/txe_service/txe_service.d.ts.map +0 -1
  87. package/src/oracle/txe_oracle.ts +0 -1287
  88. package/src/oracle/txe_typed_oracle.ts +0 -142
  89. package/src/txe_constants.ts +0 -9
@@ -1,8 +1,12 @@
1
1
  import { ArchiverStoreHelper, KVArchiverDataStore, type PublishedL2Block } from '@aztec/archiver';
2
+ import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
3
+ import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
5
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
6
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
8
  import type { L2Block, L2BlockSource, L2Tips, ValidateBlockResult } from '@aztec/stdlib/block';
9
+ import type { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
6
10
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
7
11
  import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
8
12
  import type { BlockHeader } from '@aztec/stdlib/tx';
@@ -29,7 +33,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
29
33
  * Gets the number of the latest L2 block processed by the block source implementation.
30
34
  * @returns The number of the latest L2 block processed by the block source implementation.
31
35
  */
32
- public getBlockNumber(): Promise<number> {
36
+ public getBlockNumber(): Promise<BlockNumber> {
33
37
  return this.store.getSynchedL2BlockNumber();
34
38
  }
35
39
 
@@ -37,7 +41,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
37
41
  * Gets the number of the latest L2 block proven seen by the block source implementation.
38
42
  * @returns The number of the latest L2 block proven seen by the block source implementation.
39
43
  */
40
- public getProvenBlockNumber(): Promise<number> {
44
+ public getProvenBlockNumber(): Promise<BlockNumber> {
41
45
  return this.store.getSynchedL2BlockNumber();
42
46
  }
43
47
 
@@ -54,7 +58,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
54
58
  if (number == 0) {
55
59
  return undefined;
56
60
  }
57
- const blocks = await this.store.getPublishedBlocks(number, 1);
61
+ const blocks = await this.store.getPublishedBlocks(BlockNumber(number), 1);
58
62
  return blocks.length === 0 ? undefined : blocks[0];
59
63
  }
60
64
 
@@ -63,8 +67,8 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
63
67
  * @param number - The block number to return (inclusive).
64
68
  * @returns The requested L2 block.
65
69
  */
66
- public getBlock(number: number): Promise<L2Block | undefined> {
67
- return this.getPublishedBlock(number).then(block => block?.block);
70
+ public getBlock(number: number | 'latest'): Promise<L2Block | undefined> {
71
+ return this.getPublishedBlock(number != 'latest' ? number : -1).then(block => block?.block);
68
72
  }
69
73
 
70
74
  /**
@@ -79,31 +83,43 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
79
83
  if (number === 0) {
80
84
  return undefined;
81
85
  }
82
- const headers = await this.store.getBlockHeaders(number, 1);
86
+ const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
83
87
  return headers.length === 0 ? undefined : headers[0];
84
88
  }
85
89
 
86
90
  public getBlocks(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
87
- return this.getPublishedBlocks(from, limit).then(blocks => blocks.map(b => b.block));
91
+ return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
88
92
  }
89
93
 
90
- public getL2SlotNumber(): Promise<bigint> {
94
+ public getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]> {
95
+ throw new Error('TXE Archiver does not implement "getPublishedCheckpoints"');
96
+ }
97
+
98
+ public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
99
+ throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
100
+ }
101
+
102
+ public getL2SlotNumber(): Promise<SlotNumber | undefined> {
91
103
  throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
92
104
  }
93
105
 
94
- public getL2EpochNumber(): Promise<bigint> {
106
+ public getL2EpochNumber(): Promise<EpochNumber> {
95
107
  throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
96
108
  }
97
109
 
98
- public getBlocksForEpoch(_epochNumber: bigint): Promise<L2Block[]> {
110
+ public getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]> {
111
+ throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
112
+ }
113
+
114
+ public getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]> {
99
115
  throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
100
116
  }
101
117
 
102
- public getBlockHeadersForEpoch(_epochNumber: bigint): Promise<BlockHeader[]> {
118
+ public getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]> {
103
119
  throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
104
120
  }
105
121
 
106
- public isEpochComplete(_epochNumber: bigint): Promise<boolean> {
122
+ public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
107
123
  throw new Error('TXE Archiver does not implement "isEpochComplete"');
108
124
  }
109
125
 
@@ -115,6 +131,10 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
115
131
  throw new Error('TXE Archiver does not implement "getL2Constants"');
116
132
  }
117
133
 
134
+ public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
135
+ return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
136
+ }
137
+
118
138
  public syncImmediate(): Promise<void> {
119
139
  throw new Error('TXE Archiver does not implement "syncImmediate"');
120
140
  }
@@ -139,7 +159,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
139
159
  return Promise.resolve(false);
140
160
  }
141
161
 
142
- public getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
162
+ public override getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
143
163
  return Promise.resolve({ valid: true });
144
164
  }
145
165
  }
@@ -1,3 +1,4 @@
1
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import type {
2
3
  AuthRequest,
3
4
  ENR,
@@ -17,6 +18,10 @@ import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
17
18
  import type { Tx, TxHash } from '@aztec/stdlib/tx';
18
19
 
19
20
  export class DummyP2P implements P2P {
21
+ public broadcastAttestations(_attestations: BlockAttestation[]): Promise<void> {
22
+ return Promise.resolve();
23
+ }
24
+
20
25
  public validate(_txs: Tx[]): Promise<void> {
21
26
  return Promise.resolve();
22
27
  }
@@ -113,10 +118,14 @@ export class DummyP2P implements P2P {
113
118
  throw new Error('DummyP2P does not implement "getTxsByHash"');
114
119
  }
115
120
 
116
- public getAttestationsForSlot(_slot: bigint, _proposalId?: string): Promise<BlockAttestation[]> {
121
+ public getAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<BlockAttestation[]> {
117
122
  throw new Error('DummyP2P does not implement "getAttestationForSlot"');
118
123
  }
119
124
 
125
+ public deleteAttestation(_attestation: BlockAttestation): Promise<void> {
126
+ return Promise.resolve();
127
+ }
128
+
120
129
  public addAttestations(_attestations: BlockAttestation[]): Promise<void> {
121
130
  throw new Error('DummyP2P does not implement "addAttestations"');
122
131
  }
@@ -1,55 +1,21 @@
1
+ import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
- import { Fr } from '@aztec/foundation/fields';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { GasFees } from '@aztec/stdlib/gas';
5
+ import { makeGlobalVariables } from '@aztec/stdlib/testing';
5
6
  import { type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
6
7
 
7
8
  export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
8
- private timestamp = 1n;
9
- private slotNumber = 1n;
10
-
11
- // The version and chainId should match the one on txe_oracle
12
- private version = new Fr(1);
13
- private chainId = new Fr(1);
14
-
15
- constructor() {}
16
-
17
9
  public getCurrentBaseFees(): Promise<GasFees> {
18
10
  return Promise.resolve(new GasFees(0, 0));
19
11
  }
20
12
 
21
- /**
22
- * Simple builder of global variables that use the minimum time possible.
23
- * @param blockNumber - The block number to build global variables for.
24
- * @param coinbase - The address to receive block reward.
25
- * @param feeRecipient - The address to receive fees.
26
- * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
27
- * @returns The global variables for the given block number.
28
- */
29
13
  public buildGlobalVariables(
30
- blockNumber: number,
31
- coinbase: EthAddress,
32
- feeRecipient: AztecAddress,
33
- slotNumber?: bigint,
14
+ _blockNumber: BlockNumber,
15
+ _coinbase: EthAddress,
16
+ _feeRecipient: AztecAddress,
17
+ _slotNumber?: SlotNumber,
34
18
  ): Promise<GlobalVariables> {
35
- const gasFees = new GasFees(0, 0);
36
-
37
- slotNumber ??= this.slotNumber;
38
-
39
- const globalVariables = new GlobalVariables(
40
- this.chainId,
41
- this.version,
42
- blockNumber,
43
- Fr.fromString(slotNumber.toString()),
44
- this.timestamp,
45
- coinbase,
46
- feeRecipient,
47
- gasFees,
48
- );
49
-
50
- this.slotNumber++;
51
- this.timestamp = this.timestamp + 1n;
52
-
53
- return Promise.resolve(globalVariables);
19
+ return Promise.resolve(makeGlobalVariables());
54
20
  }
55
21
  }
@@ -3,7 +3,7 @@ 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
5
  import { SyncDataProvider } from '@aztec/pxe/server';
6
- import type { L2Block } from '@aztec/stdlib/block';
6
+ import { type L2Block, PublishedL2Block } from '@aztec/stdlib/block';
7
7
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
8
8
  import { getPackageVersion } from '@aztec/stdlib/update-checker';
9
9
 
@@ -13,6 +13,9 @@ import { TXEGlobalVariablesBuilder } from './global_variable_builder.js';
13
13
  import { MockEpochCache } from './mock_epoch_cache.js';
14
14
  import { TXESynchronizer } from './synchronizer.js';
15
15
 
16
+ const VERSION = 1;
17
+ const CHAIN_ID = 1;
18
+
16
19
  export class TXEStateMachine {
17
20
  constructor(
18
21
  public node: AztecNode,
@@ -41,9 +44,8 @@ export class TXEStateMachine {
41
44
  undefined,
42
45
  undefined,
43
46
  undefined,
44
- // version and chainId should match the ones in txe oracle
45
- 1,
46
- 1,
47
+ VERSION,
48
+ CHAIN_ID,
47
49
  new TXEGlobalVariablesBuilder(),
48
50
  new MockEpochCache(),
49
51
  getPackageVersion() ?? '',
@@ -57,9 +59,9 @@ export class TXEStateMachine {
57
59
 
58
60
  public async handleL2Block(block: L2Block) {
59
61
  await Promise.all([
60
- this.synchronizer.handleL2Block(block),
62
+ this.synchronizer.handleL2Block(block.toL2Block()),
61
63
  this.archiver.addBlocks([
62
- {
64
+ PublishedL2Block.fromFields({
63
65
  block,
64
66
  l1: {
65
67
  blockHash: block.header.globalVariables.blockNumber.toString(),
@@ -67,9 +69,9 @@ export class TXEStateMachine {
67
69
  timestamp: block.header.globalVariables.timestamp,
68
70
  },
69
71
  attestations: [],
70
- },
72
+ }),
71
73
  ]),
72
- this.syncDataProvider.setHeader(block.header),
74
+ this.syncDataProvider.setHeader(block.getBlockHeader()),
73
75
  ]);
74
76
  }
75
77
  }
@@ -1,4 +1,5 @@
1
1
  import type { EpochAndSlot, EpochCacheInterface, EpochCommitteeInfo, SlotTag } from '@aztec/epoch-cache';
2
+ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
 
4
5
  /**
@@ -10,46 +11,46 @@ export class MockEpochCache implements EpochCacheInterface {
10
11
  return Promise.resolve({
11
12
  committee: undefined,
12
13
  seed: 0n,
13
- epoch: 0n,
14
+ epoch: EpochNumber.ZERO,
14
15
  });
15
16
  }
16
17
 
17
18
  getEpochAndSlotNow(): EpochAndSlot {
18
19
  return {
19
- epoch: 0n,
20
- slot: 0n,
20
+ epoch: EpochNumber.ZERO,
21
+ slot: SlotNumber(0),
21
22
  ts: 0n,
22
23
  };
23
24
  }
24
25
 
25
26
  getEpochAndSlotInNextL1Slot(): EpochAndSlot & { now: bigint } {
26
27
  return {
27
- epoch: 0n,
28
- slot: 0n,
28
+ epoch: EpochNumber.ZERO,
29
+ slot: SlotNumber(0),
29
30
  ts: 0n,
30
31
  now: 0n,
31
32
  };
32
33
  }
33
34
 
34
- getProposerIndexEncoding(_epoch: bigint, _slot: bigint, _seed: bigint): `0x${string}` {
35
+ getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
35
36
  return '0x00';
36
37
  }
37
38
 
38
- computeProposerIndex(_slot: bigint, _epoch: bigint, _seed: bigint, _size: bigint): bigint {
39
+ computeProposerIndex(_slot: SlotNumber, _epoch: EpochNumber, _seed: bigint, _size: bigint): bigint {
39
40
  return 0n;
40
41
  }
41
42
 
42
43
  getProposerAttesterAddressInCurrentOrNextSlot(): Promise<{
43
44
  currentProposer: EthAddress | undefined;
44
45
  nextProposer: EthAddress | undefined;
45
- currentSlot: bigint;
46
- nextSlot: bigint;
46
+ currentSlot: SlotNumber;
47
+ nextSlot: SlotNumber;
47
48
  }> {
48
49
  return Promise.resolve({
49
50
  currentProposer: undefined,
50
51
  nextProposer: undefined,
51
- currentSlot: 0n,
52
- nextSlot: 0n,
52
+ currentSlot: SlotNumber(0),
53
+ nextSlot: SlotNumber(0),
53
54
  });
54
55
  }
55
56
 
@@ -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. */