@aztec/txe 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240

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 (138) hide show
  1. package/dest/ContractClassRegistry-KKNT527R.js +3 -0
  2. package/dest/ContractClassRegistry-KKNT527R.js.map +7 -0
  3. package/dest/ContractInstanceRegistry-GSKBNL3Q.js +3 -0
  4. package/dest/ContractInstanceRegistry-GSKBNL3Q.js.map +7 -0
  5. package/dest/FeeJuice-GUJ5O6GB.js +3 -0
  6. package/dest/FeeJuice-GUJ5O6GB.js.map +7 -0
  7. package/dest/MultiCallEntrypoint-ZQPCKVKL.js +3 -0
  8. package/dest/MultiCallEntrypoint-ZQPCKVKL.js.map +7 -0
  9. package/dest/SchnorrAccount-QIXE5DXA.js +3 -0
  10. package/dest/SchnorrAccount-QIXE5DXA.js.map +7 -0
  11. package/dest/bin/check_txe_oracle_version.d.ts +2 -0
  12. package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
  13. package/dest/bin/check_txe_oracle_version.js +32 -0
  14. package/dest/bin/index.js +3 -30
  15. package/dest/bin/index.js.map +7 -0
  16. package/dest/chunk-BJVAAXNA.js +3 -0
  17. package/dest/chunk-BJVAAXNA.js.map +7 -0
  18. package/dest/chunk-DF6RMOC6.js +304 -0
  19. package/dest/chunk-DF6RMOC6.js.map +7 -0
  20. package/dest/chunk-PPJTNNUG.js +265 -0
  21. package/dest/chunk-PPJTNNUG.js.map +7 -0
  22. package/dest/constants.d.ts +3 -2
  23. package/dest/constants.d.ts.map +1 -1
  24. package/dest/constants.js +5 -1
  25. package/dest/dispatcher_pool.d.ts +67 -0
  26. package/dest/dispatcher_pool.d.ts.map +1 -0
  27. package/dest/dispatcher_pool.js +284 -0
  28. package/dest/index.d.ts +188 -7
  29. package/dest/index.d.ts.map +1 -1
  30. package/dest/index.js +148 -75
  31. package/dest/metafile.json +38147 -0
  32. package/dest/msgpackr_fr_extension.d.ts +2 -0
  33. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  34. package/dest/msgpackr_fr_extension.js +21 -0
  35. package/dest/oracle/interfaces.d.ts +40 -28
  36. package/dest/oracle/interfaces.d.ts.map +1 -1
  37. package/dest/oracle/txe_oracle_public_context.d.ts +18 -13
  38. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  39. package/dest/oracle/txe_oracle_public_context.js +31 -16
  40. package/dest/oracle/txe_oracle_top_level_context.d.ts +39 -23
  41. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  42. package/dest/oracle/txe_oracle_top_level_context.js +225 -89
  43. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  44. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  45. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  46. package/dest/rpc_server.d.ts +14 -0
  47. package/dest/rpc_server.d.ts.map +1 -0
  48. package/dest/rpc_server.js +78 -0
  49. package/dest/rpc_translator.d.ts +144 -82
  50. package/dest/rpc_translator.d.ts.map +1 -1
  51. package/dest/rpc_translator.js +599 -238
  52. package/dest/server.bundle.js +3 -0
  53. package/dest/server.bundle.js.map +7 -0
  54. package/dest/state_machine/archiver.d.ts +20 -69
  55. package/dest/state_machine/archiver.d.ts.map +1 -1
  56. package/dest/state_machine/archiver.js +47 -187
  57. package/dest/state_machine/dummy_p2p_client.d.ts +26 -16
  58. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  59. package/dest/state_machine/dummy_p2p_client.js +44 -20
  60. package/dest/state_machine/global_variable_builder.d.ts +9 -4
  61. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  62. package/dest/state_machine/global_variable_builder.js +9 -3
  63. package/dest/state_machine/index.d.ts +10 -6
  64. package/dest/state_machine/index.d.ts.map +1 -1
  65. package/dest/state_machine/index.js +55 -14
  66. package/dest/state_machine/mock_epoch_cache.d.ts +25 -8
  67. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  68. package/dest/state_machine/mock_epoch_cache.js +46 -9
  69. package/dest/state_machine/synchronizer.d.ts +6 -6
  70. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  71. package/dest/state_machine/synchronizer.js +4 -4
  72. package/dest/txe_oracle_version.d.ts +17 -0
  73. package/dest/txe_oracle_version.d.ts.map +1 -0
  74. package/dest/txe_oracle_version.js +14 -0
  75. package/dest/txe_session.d.ts +73 -10
  76. package/dest/txe_session.d.ts.map +1 -1
  77. package/dest/txe_session.js +242 -39
  78. package/dest/utils/block_creation.d.ts +4 -4
  79. package/dest/utils/block_creation.d.ts.map +1 -1
  80. package/dest/utils/block_creation.js +18 -4
  81. package/dest/utils/encoding.d.ts +191 -0
  82. package/dest/utils/encoding.d.ts.map +1 -0
  83. package/dest/{util → utils}/encoding.js +7 -2
  84. package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
  85. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  86. package/dest/utils/tx_effect_creation.d.ts +2 -3
  87. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  88. package/dest/utils/tx_effect_creation.js +3 -6
  89. package/dest/{util → utils}/txe_account_store.d.ts +1 -1
  90. package/dest/utils/txe_account_store.d.ts.map +1 -0
  91. package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
  92. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
  93. package/dest/{util → utils}/txe_public_contract_data_source.js +6 -25
  94. package/dest/worker.bundle.js +3 -0
  95. package/dest/worker.bundle.js.map +7 -0
  96. package/dest/worker.d.ts +2 -0
  97. package/dest/worker.d.ts.map +1 -0
  98. package/dest/worker.js +92 -0
  99. package/package.json +38 -22
  100. package/src/bin/check_txe_oracle_version.ts +37 -0
  101. package/src/bin/index.ts +11 -2
  102. package/src/constants.ts +6 -1
  103. package/src/dispatcher_pool.ts +316 -0
  104. package/src/index.ts +166 -80
  105. package/src/msgpackr_fr_extension.ts +23 -0
  106. package/src/oracle/interfaces.ts +48 -34
  107. package/src/oracle/txe_oracle_public_context.ts +46 -18
  108. package/src/oracle/txe_oracle_top_level_context.ts +282 -151
  109. package/src/oracle/txe_private_execution_oracle.ts +30 -0
  110. package/src/rpc_server.ts +87 -0
  111. package/src/rpc_translator.ts +687 -326
  112. package/src/state_machine/archiver.ts +53 -235
  113. package/src/state_machine/dummy_p2p_client.ts +70 -32
  114. package/src/state_machine/global_variable_builder.ts +18 -3
  115. package/src/state_machine/index.ts +72 -15
  116. package/src/state_machine/mock_epoch_cache.ts +57 -14
  117. package/src/state_machine/synchronizer.ts +6 -6
  118. package/src/txe_oracle_version.ts +17 -0
  119. package/src/txe_session.ts +352 -104
  120. package/src/utils/block_creation.ts +19 -16
  121. package/src/{util → utils}/encoding.ts +8 -2
  122. package/src/utils/tx_effect_creation.ts +3 -11
  123. package/src/{util → utils}/txe_public_contract_data_source.ts +10 -38
  124. package/src/worker.ts +98 -0
  125. package/dest/util/encoding.d.ts +0 -720
  126. package/dest/util/encoding.d.ts.map +0 -1
  127. package/dest/util/expected_failure_error.d.ts.map +0 -1
  128. package/dest/util/txe_account_store.d.ts.map +0 -1
  129. package/dest/util/txe_contract_store.d.ts +0 -12
  130. package/dest/util/txe_contract_store.d.ts.map +0 -1
  131. package/dest/util/txe_contract_store.js +0 -22
  132. package/dest/util/txe_public_contract_data_source.d.ts +0 -21
  133. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  134. package/src/util/txe_contract_store.ts +0 -36
  135. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  136. /package/dest/{util → utils}/txe_account_store.js +0 -0
  137. /package/src/{util → utils}/expected_failure_error.ts +0 -0
  138. /package/src/{util → utils}/txe_account_store.ts +0 -0
@@ -1,233 +1,81 @@
1
- import { ArchiverStoreHelper, KVArchiverDataStore } from '@aztec/archiver';
1
+ import { ArchiverDataSourceBase, ArchiverDataStoreUpdater, createArchiverDataStores } from '@aztec/archiver';
2
2
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
3
- import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { CheckpointNumber, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
4
4
  import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import type { EthAddress } from '@aztec/foundation/eth-address';
6
- import { isDefined } from '@aztec/foundation/types';
7
6
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
8
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9
7
  import {
10
8
  type CheckpointId,
11
- CommitteeAttestation,
12
- L2Block,
9
+ GENESIS_BLOCK_HEADER_HASH,
13
10
  type L2BlockId,
14
- type L2BlockNew,
15
- type L2BlockSource,
16
11
  type L2TipId,
17
12
  type L2Tips,
18
- PublishedL2Block,
19
13
  type ValidateCheckpointResult,
20
14
  } from '@aztec/stdlib/block';
21
- import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
22
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
15
+ import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
23
16
  import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
24
- import type { BlockHeader } from '@aztec/stdlib/tx';
25
- import type { UInt64 } from '@aztec/stdlib/types';
17
+ import { BlockHeader } from '@aztec/stdlib/tx';
26
18
 
27
- // We are extending the ArchiverDataStoreHelper here because it provides most of the endpoints needed by the
28
- // node for reading from and writing to state, without needing any of the extra overhead that the Archiver itself
29
- // requires (i.e. an L1 client)
30
- export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
31
- constructor(db: AztecAsyncKVStore) {
32
- super(new KVArchiverDataStore(db, 9999));
33
- }
34
-
35
- public async getBlock(number: BlockNumber): Promise<L2Block | undefined> {
36
- if (number === 0) {
37
- return undefined;
38
- }
39
- const publishedBlocks = await this.getPublishedBlocks(number, 1);
40
- if (publishedBlocks.length === 0) {
41
- return undefined;
42
- }
43
- return publishedBlocks[0].block;
44
- }
45
-
46
- public async getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]> {
47
- const publishedBlocks = await this.getPublishedBlocks(from, limit, proven);
48
- return publishedBlocks.map(x => x.block);
49
- }
50
-
51
- public override async addCheckpoints(
52
- checkpoints: PublishedCheckpoint[],
53
- _result?: ValidateCheckpointResult,
54
- ): Promise<boolean> {
55
- const allBlocks = checkpoints.flatMap(ch => ch.checkpoint.blocks);
56
- const opResults = await Promise.all([this.store.addLogs(allBlocks), this.store.addCheckpoints(checkpoints)]);
57
-
58
- return opResults.every(Boolean);
59
- }
60
-
61
- /**
62
- * Gets the number of the latest L2 block processed by the block source implementation.
63
- * @returns The number of the latest L2 block processed by the block source implementation.
64
- */
65
- public getBlockNumber(): Promise<BlockNumber> {
66
- return this.store.getLatestBlockNumber();
67
- }
68
-
69
- /**
70
- * Gets the number of the latest L2 block proven seen by the block source implementation.
71
- * @returns The number of the latest L2 block proven seen by the block source implementation.
72
- */
73
- public override getProvenBlockNumber(): Promise<BlockNumber> {
74
- return this.store.getProvenBlockNumber();
75
- }
76
-
77
- /**
78
- * Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
79
- * @param number - The block number to return (inclusive).
80
- * @returns The requested L2 block.
81
- */
82
- public async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
83
- // If the number provided is -ve, then return the latest block.
84
- if (number < 0) {
85
- number = await this.store.getLatestBlockNumber();
86
- }
87
- if (number == 0) {
88
- return undefined;
89
- }
90
- const publishedBlocks = await this.retrievePublishedBlocks(BlockNumber(number), 1);
91
- return publishedBlocks.length === 0 ? undefined : publishedBlocks[0];
92
- }
93
-
94
- getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]> {
95
- return this.retrievePublishedBlocks(from, limit, proven);
96
- }
97
-
98
- async getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]> {
99
- const blocks = await this.store.getBlocks(from, limit);
19
+ /**
20
+ * TXE Archiver implementation.
21
+ * Provides most of the endpoints needed by the node for reading from and writing to state,
22
+ * without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
23
+ */
24
+ export class TXEArchiver extends ArchiverDataSourceBase {
25
+ private readonly updater = new ArchiverDataStoreUpdater(this.stores);
100
26
 
101
- if (proven === true) {
102
- const provenBlockNumber = await this.store.getProvenBlockNumber();
103
- return blocks.filter(b => b.number <= provenBlockNumber);
104
- }
105
- return blocks;
106
- }
107
-
108
- private async retrievePublishedBlocks(
109
- from: BlockNumber,
110
- limit: number,
111
- proven?: boolean,
112
- ): Promise<PublishedL2Block[]> {
113
- const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
114
- const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
115
- const blocks = (
116
- await Promise.all(checkpoints.map(ch => this.store.getBlocksForCheckpoint(ch.checkpointNumber)))
117
- ).filter(isDefined);
118
-
119
- const olbBlocks: PublishedL2Block[] = [];
120
- for (let i = 0; i < checkpoints.length; i++) {
121
- const blockForCheckpoint = blocks[i][0];
122
- const checkpoint = checkpoints[i];
123
- if (proven === true && checkpoint.checkpointNumber > provenCheckpointNumber) {
124
- continue;
125
- }
126
- const oldCheckpoint = new Checkpoint(
127
- blockForCheckpoint.archive,
128
- checkpoint.header,
129
- [blockForCheckpoint],
130
- checkpoint.checkpointNumber,
131
- );
132
- const oldBlock = L2Block.fromCheckpoint(oldCheckpoint);
133
- const publishedBlock = new PublishedL2Block(
134
- oldBlock,
135
- checkpoint.l1,
136
- checkpoint.attestations.map(x => CommitteeAttestation.fromBuffer(x)),
137
- );
138
- olbBlocks.push(publishedBlock);
139
- }
140
- return olbBlocks;
141
- }
142
-
143
- /**
144
- * Gets an l2 block. If a negative number is passed, the block returned is the most recent.
145
- * @param number - The block number to return (inclusive).
146
- * @returns The requested L2 block.
147
- */
148
- public getL2Block(number: BlockNumber | 'latest'): Promise<L2Block | undefined> {
149
- return this.getPublishedBlock(number != 'latest' ? number : -1).then(b => b?.block);
150
- }
151
-
152
- /**
153
- * Gets an L2 block (new format).
154
- * @param number - The block number to return.
155
- * @returns The requested L2 block.
156
- */
157
- public getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined> {
158
- if (number === 0) {
159
- return Promise.resolve(undefined);
160
- }
161
- return this.store.getBlock(number);
162
- }
163
-
164
- /**
165
- * Gets an l2 block header.
166
- * @param number - The block number to return or 'latest' for the most recent one.
167
- * @returns The requested L2 block header.
168
- */
169
- public async getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {
170
- if (number === 'latest') {
171
- number = await this.store.getLatestBlockNumber();
172
- }
173
- if (number === 0) {
174
- return undefined;
175
- }
176
- const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
177
- return headers.length === 0 ? undefined : headers[0];
178
- }
179
-
180
- public getBlockRange(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
181
- return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
182
- }
183
-
184
- public getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]> {
185
- throw new Error('TXE Archiver does not implement "getPublishedCheckpoints"');
186
- }
187
-
188
- public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
189
- throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
27
+ constructor(db: AztecAsyncKVStore) {
28
+ super(
29
+ createArchiverDataStores(db, GENESIS_BLOCK_HEADER_HASH),
30
+ undefined,
31
+ BlockHeader.empty(),
32
+ GENESIS_BLOCK_HEADER_HASH,
33
+ new Fr(GENESIS_ARCHIVE_ROOT),
34
+ );
190
35
  }
191
36
 
192
- public getL2SlotNumber(): Promise<SlotNumber | undefined> {
193
- throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
37
+ public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
38
+ await this.updater.addCheckpoints(checkpoints, result);
194
39
  }
195
40
 
196
- public getL2EpochNumber(): Promise<EpochNumber> {
197
- throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
41
+ public getRollupAddress(): Promise<EthAddress> {
42
+ throw new Error('TXE Archiver does not implement "getRollupAddress"');
198
43
  }
199
44
 
200
- public getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]> {
201
- throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
45
+ public getRegistryAddress(): Promise<EthAddress> {
46
+ throw new Error('TXE Archiver does not implement "getRegistryAddress"');
202
47
  }
203
48
 
204
- public getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]> {
205
- throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
49
+ public getL1Constants(): Promise<L1RollupConstants> {
50
+ throw new Error('TXE Archiver does not implement "getL1Constants"');
206
51
  }
207
52
 
208
- public getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]> {
209
- throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
53
+ public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
54
+ return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
210
55
  }
211
56
 
212
- public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
213
- throw new Error('TXE Archiver does not implement "isEpochComplete"');
57
+ public getL1Timestamp(): Promise<bigint | undefined> {
58
+ throw new Error('TXE Archiver does not implement "getL1Timestamp"');
214
59
  }
215
60
 
216
61
  public async getL2Tips(): Promise<L2Tips> {
217
62
  // In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
218
63
  // and 'finalized' to the latest block.
219
- const blockHeader = await this.getBlockHeader('latest');
220
- if (!blockHeader) {
64
+ const latestBlockNumber = await this.stores.blocks.getLatestL2BlockNumber();
65
+ if (latestBlockNumber === 0) {
66
+ throw new Error('L2Tips requested from TXE Archiver but no block found');
67
+ }
68
+ const latestBlockData = await this.stores.blocks.getBlockData({ number: latestBlockNumber });
69
+ if (!latestBlockData) {
221
70
  throw new Error('L2Tips requested from TXE Archiver but no block header found');
222
71
  }
223
72
 
224
- const number = blockHeader.globalVariables.blockNumber;
225
- const hash = (await blockHeader.hash()).toString();
226
- const checkpointedBlock = await this.getCheckpointedBlock(number);
227
- if (!checkpointedBlock) {
228
- throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
229
- }
230
- const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber(number), 1);
73
+ const number = latestBlockData.header.globalVariables.blockNumber;
74
+ const hash = latestBlockData.blockHash.toString();
75
+
76
+ // TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
77
+ // This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
78
+ const checkpoint = await this.stores.blocks.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
231
79
  if (checkpoint.length === 0) {
232
80
  throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
233
81
  }
@@ -242,53 +90,23 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
242
90
  proven: tipId,
243
91
  finalized: tipId,
244
92
  checkpointed: tipId,
93
+ proposedCheckpoint: tipId,
245
94
  };
246
95
  }
247
96
 
248
- public getL1Constants(): Promise<L1RollupConstants> {
249
- throw new Error('TXE Archiver does not implement "getL2Constants"');
250
- }
251
-
252
- public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
253
- return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
254
- }
255
-
256
- public syncImmediate(): Promise<void> {
257
- throw new Error('TXE Archiver does not implement "syncImmediate"');
258
- }
259
-
260
- public getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined> {
261
- throw new Error('TXE Archiver does not implement "getContract"');
97
+ public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
98
+ throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
262
99
  }
263
100
 
264
- public getRollupAddress(): Promise<EthAddress> {
265
- throw new Error('TXE Archiver does not implement "getRollupAddress"');
101
+ public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
102
+ throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
266
103
  }
267
104
 
268
- public getRegistryAddress(): Promise<EthAddress> {
269
- throw new Error('TXE Archiver does not implement "getRegistryAddress"');
270
- }
271
-
272
- public getL1Timestamp(): Promise<bigint> {
273
- throw new Error('TXE Archiver does not implement "getL1Timestamp"');
274
- }
275
-
276
- public isPendingChainInvalid(): Promise<boolean> {
277
- return Promise.resolve(false);
278
- }
279
-
280
- public override getPendingChainValidationStatus(): Promise<ValidateCheckpointResult> {
281
- return Promise.resolve({ valid: true });
282
- }
283
-
284
- getPublishedBlockByHash(_blockHash: Fr): Promise<PublishedL2Block | undefined> {
285
- throw new Error('Method not implemented.');
286
- }
287
- getPublishedBlockByArchive(_archive: Fr): Promise<PublishedL2Block | undefined> {
288
- throw new Error('Method not implemented.');
105
+ public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
106
+ throw new Error('TXE Archiver does not implement "isEpochComplete"');
289
107
  }
290
108
 
291
- getCheckpointedBlocks(_from: BlockNumber, _limit: number, _proven?: boolean): Promise<never[]> {
292
- throw new Error('TXE Archiver does not implement "getCheckpointedBlocks"');
109
+ public syncImmediate(): Promise<void> {
110
+ throw new Error('TXE Archiver does not implement "syncImmediate"');
293
111
  }
294
112
  }
@@ -1,25 +1,33 @@
1
- import type { SlotNumber } from '@aztec/foundation/branded-types';
1
+ import type { CheckpointProposalHash, SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type {
3
3
  AuthRequest,
4
4
  ENR,
5
5
  P2P,
6
6
  P2PBlockReceivedCallback,
7
+ P2PCheckpointAttestationCallback,
7
8
  P2PCheckpointReceivedCallback,
8
9
  P2PConfig,
10
+ P2PDuplicateAttestationCallback,
11
+ P2PDuplicateProposalCallback,
9
12
  P2PSyncState,
10
13
  PeerId,
11
14
  ReqRespSubProtocol,
12
15
  ReqRespSubProtocolHandler,
13
- ReqRespSubProtocolValidators,
14
16
  StatusMessage,
15
17
  } from '@aztec/p2p';
16
18
  import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
17
- import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
18
- import type { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
19
- import type { Tx, TxHash } from '@aztec/stdlib/tx';
19
+ import type { ITxProvider, PeerInfo } from '@aztec/stdlib/interfaces/server';
20
+ import type {
21
+ BlockProposal,
22
+ CheckpointAttestation,
23
+ CheckpointProposal,
24
+ CheckpointProposalCore,
25
+ TopicType,
26
+ } from '@aztec/stdlib/p2p';
27
+ import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
20
28
 
21
29
  export class DummyP2P implements P2P {
22
- public validate(_txs: Tx[]): Promise<void> {
30
+ public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
23
31
  return Promise.resolve();
24
32
  }
25
33
 
@@ -39,6 +47,10 @@ export class DummyP2P implements P2P {
39
47
  throw new Error('DummyP2P does not implement "getPeers"');
40
48
  }
41
49
 
50
+ public getGossipMeshPeerCount(_topicType: TopicType): Promise<number> {
51
+ return Promise.resolve(0);
52
+ }
53
+
42
54
  public broadcastProposal(_proposal: BlockProposal): Promise<void> {
43
55
  throw new Error('DummyP2P does not implement "broadcastProposal"');
44
56
  }
@@ -55,8 +67,12 @@ export class DummyP2P implements P2P {
55
67
  throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
56
68
  }
57
69
 
58
- public registerCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
59
- throw new Error('DummyP2P does not implement "registerCheckpointProposalHandler"');
70
+ public registerValidatorCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
71
+ throw new Error('DummyP2P does not implement "registerValidatorCheckpointProposalHandler"');
72
+ }
73
+
74
+ public registerAllNodesCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
75
+ throw new Error('DummyP2P does not implement "registerAllNodesCheckpointProposalHandler"');
60
76
  }
61
77
 
62
78
  public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
@@ -71,8 +87,8 @@ export class DummyP2P implements P2P {
71
87
  throw new Error('DummyP2P does not implement "sendTx"');
72
88
  }
73
89
 
74
- public deleteTxs(_txHashes: TxHash[]): Promise<void> {
75
- throw new Error('DummyP2P does not implement "deleteTxs"');
90
+ public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
91
+ throw new Error('DummyP2P does not implement "handleFailedExecution"');
76
92
  }
77
93
 
78
94
  public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
@@ -97,6 +113,10 @@ export class DummyP2P implements P2P {
97
113
  throw new Error('DummyP2P does not implement "iteratePendingTxs"');
98
114
  }
99
115
 
116
+ public iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
117
+ throw new Error('DummyP2P does not implement "iterateEligiblePendingTxs"');
118
+ }
119
+
100
120
  public getPendingTxCount(): Promise<number> {
101
121
  throw new Error('DummyP2P does not implement "getPendingTxCount"');
102
122
  }
@@ -125,16 +145,30 @@ export class DummyP2P implements P2P {
125
145
  throw new Error('DummyP2P does not implement "isP2PClient"');
126
146
  }
127
147
 
148
+ public getTxProvider(): ITxProvider {
149
+ throw new Error('DummyP2P does not implement "getTxProvider"');
150
+ }
151
+
128
152
  public getTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
129
153
  throw new Error('DummyP2P does not implement "getTxsByHash"');
130
154
  }
131
155
 
132
- public getCheckpointAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<CheckpointAttestation[]> {
156
+ public getCheckpointAttestationsForSlot(
157
+ _slot: SlotNumber,
158
+ _proposalPayloadHash?: CheckpointProposalHash,
159
+ ): Promise<CheckpointAttestation[]> {
133
160
  throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
134
161
  }
135
162
 
136
- public addCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
137
- throw new Error('DummyP2P does not implement "addCheckpointAttestations"');
163
+ public addOwnCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
164
+ throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
165
+ }
166
+
167
+ public getProposalsForSlot(_slot: SlotNumber): Promise<{
168
+ blockProposals: BlockProposal[];
169
+ checkpointProposals: CheckpointProposalCore[];
170
+ }> {
171
+ return Promise.resolve({ blockProposals: [], checkpointProposals: [] });
138
172
  }
139
173
 
140
174
  public getL2BlockHash(_number: number): Promise<string | undefined> {
@@ -157,14 +191,6 @@ export class DummyP2P implements P2P {
157
191
  throw new Error('DummyP2P does not implement "sync"');
158
192
  }
159
193
 
160
- public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
161
- throw new Error('DummyP2P does not implement "requestTxsByHash"');
162
- }
163
-
164
- public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
165
- throw new Error('DummyP2P does not implement "getTxs"');
166
- }
167
-
168
194
  public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
169
195
  throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
170
196
  }
@@ -173,10 +199,6 @@ export class DummyP2P implements P2P {
173
199
  throw new Error('DummyP2P does not implement "hasTxsInPool"');
174
200
  }
175
201
 
176
- public addTxsToPool(_txs: Tx[]): Promise<number> {
177
- throw new Error('DummyP2P does not implement "addTxs"');
178
- }
179
-
180
202
  public getSyncedLatestBlockNum(): Promise<number> {
181
203
  throw new Error('DummyP2P does not implement "getSyncedLatestBlockNum"');
182
204
  }
@@ -189,15 +211,15 @@ export class DummyP2P implements P2P {
189
211
  throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
190
212
  }
191
213
 
192
- markTxsAsNonEvictable(_: TxHash[]): Promise<void> {
193
- throw new Error('DummyP2P does not implement "markTxsAsNonEvictable".');
214
+ protectTxs(_txHashes: TxHash[], _blockHeader: BlockHeader): Promise<TxHash[]> {
215
+ throw new Error('DummyP2P does not implement "protectTxs".');
194
216
  }
195
217
 
196
- addReqRespSubProtocol(
197
- _subProtocol: ReqRespSubProtocol,
198
- _handler: ReqRespSubProtocolHandler,
199
- _validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
200
- ): Promise<void> {
218
+ prepareForSlot(_slotNumber: SlotNumber): Promise<void> {
219
+ return Promise.resolve();
220
+ }
221
+
222
+ addReqRespSubProtocol(_subProtocol: ReqRespSubProtocol, _handler: ReqRespSubProtocolHandler): Promise<void> {
201
223
  throw new Error('DummyP2P does not implement "addReqRespSubProtocol".');
202
224
  }
203
225
  handleAuthRequestFromPeer(_authRequest: AuthRequest, _peerId: PeerId): Promise<StatusMessage> {
@@ -206,4 +228,20 @@ export class DummyP2P implements P2P {
206
228
 
207
229
  //This is no-op
208
230
  public registerThisValidatorAddresses(_address: EthAddress[]): void {}
231
+
232
+ public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
233
+ throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
234
+ }
235
+
236
+ public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
237
+ throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
238
+ }
239
+
240
+ public registerCheckpointAttestationCallback(_callback: P2PCheckpointAttestationCallback): void {
241
+ throw new Error('DummyP2P does not implement "registerCheckpointAttestationCallback"');
242
+ }
243
+
244
+ public hasBlockProposalsForSlot(_slot: SlotNumber): Promise<boolean> {
245
+ throw new Error('DummyP2P does not implement "hasBlockProposalsForSlot"');
246
+ }
209
247
  }
@@ -1,15 +1,29 @@
1
+ import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
1
2
  import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { times } from '@aztec/foundation/collection';
2
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { GasFees } from '@aztec/stdlib/gas';
6
+ import { FEE_ORACLE_LAG, GasFees } from '@aztec/stdlib/gas';
5
7
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
6
- import { type CheckpointGlobalVariables, type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
8
+ import {
9
+ type CheckpointGlobalVariables,
10
+ type FeeProvider,
11
+ type GlobalVariableBuilder,
12
+ GlobalVariables,
13
+ } from '@aztec/stdlib/tx';
7
14
 
8
- export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
15
+ /** Simple FeeProvider for TXE that returns zero fees. */
16
+ export class TXEFeeProvider implements FeeProvider {
9
17
  public getCurrentMinFees(): Promise<GasFees> {
10
18
  return Promise.resolve(new GasFees(0, 0));
11
19
  }
12
20
 
21
+ public getPredictedMinFees(): Promise<GasFees[]> {
22
+ return Promise.resolve(times(FEE_ORACLE_LAG, () => new GasFees(0, 0)));
23
+ }
24
+ }
25
+
26
+ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
13
27
  public buildGlobalVariables(
14
28
  _blockNumber: BlockNumber,
15
29
  _coinbase: EthAddress,
@@ -23,6 +37,7 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
23
37
  _coinbase: EthAddress,
24
38
  _feeRecipient: AztecAddress,
25
39
  _slotNumber: SlotNumber,
40
+ _simulationOverridesPlan?: SimulationOverridesPlan,
26
41
  ): Promise<CheckpointGlobalVariables> {
27
42
  const vars = makeGlobalVariables();
28
43
  return Promise.resolve({