@aztec/txe 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0

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 (175) hide show
  1. package/dest/AuthRegistry-QVGDDH5X.js +3 -0
  2. package/dest/AuthRegistry-QVGDDH5X.js.map +7 -0
  3. package/dest/ContractClassRegistry-VWR3F42P.js +3 -0
  4. package/dest/ContractClassRegistry-VWR3F42P.js.map +7 -0
  5. package/dest/ContractInstanceRegistry-FHIWE33X.js +3 -0
  6. package/dest/ContractInstanceRegistry-FHIWE33X.js.map +7 -0
  7. package/dest/FeeJuice-SAOWVGG7.js +3 -0
  8. package/dest/FeeJuice-SAOWVGG7.js.map +7 -0
  9. package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
  10. package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
  11. package/dest/MultiCallEntrypoint-QG5H33ZZ.js +3 -0
  12. package/dest/MultiCallEntrypoint-QG5H33ZZ.js.map +7 -0
  13. package/dest/SchnorrAccount-NME3E45O.js +3 -0
  14. package/dest/SchnorrAccount-NME3E45O.js.map +7 -0
  15. package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js +3 -0
  16. package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js.map +7 -0
  17. package/dest/bin/check_txe_oracle_version.d.ts +2 -0
  18. package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
  19. package/dest/bin/check_txe_oracle_version.js +53 -0
  20. package/dest/bin/index.js +3 -30
  21. package/dest/bin/index.js.map +7 -0
  22. package/dest/bin/oracle_test_server.d.ts +3 -0
  23. package/dest/bin/oracle_test_server.d.ts.map +1 -0
  24. package/dest/bin/oracle_test_server.js +41 -0
  25. package/dest/chunk-32UHX7YY.js +3 -0
  26. package/dest/chunk-32UHX7YY.js.map +7 -0
  27. package/dest/chunk-GSUKUCKV.js +260 -0
  28. package/dest/chunk-GSUKUCKV.js.map +7 -0
  29. package/dest/chunk-UP4KKUVA.js +304 -0
  30. package/dest/chunk-UP4KKUVA.js.map +7 -0
  31. package/dest/constants.d.ts +7 -0
  32. package/dest/constants.d.ts.map +1 -0
  33. package/dest/constants.js +10 -0
  34. package/dest/dispatcher_pool.d.ts +67 -0
  35. package/dest/dispatcher_pool.d.ts.map +1 -0
  36. package/dest/dispatcher_pool.js +286 -0
  37. package/dest/index.d.ts +51 -7
  38. package/dest/index.d.ts.map +1 -1
  39. package/dest/index.js +75 -158
  40. package/dest/metafile.json +38759 -0
  41. package/dest/msgpackr_fr_extension.d.ts +2 -0
  42. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  43. package/dest/msgpackr_fr_extension.js +21 -0
  44. package/dest/oracle/interfaces.d.ts +71 -30
  45. package/dest/oracle/interfaces.d.ts.map +1 -1
  46. package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
  47. package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
  48. package/dest/oracle/tagging_secret_strategy.js +12 -0
  49. package/dest/oracle/test-resolver/default_fixtures.d.ts +16 -0
  50. package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
  51. package/dest/oracle/test-resolver/default_fixtures.js +200 -0
  52. package/dest/oracle/test-resolver/index.d.ts +9 -0
  53. package/dest/oracle/test-resolver/index.d.ts.map +1 -0
  54. package/dest/oracle/test-resolver/index.js +32 -0
  55. package/dest/oracle/test-resolver/resolver.d.ts +48 -0
  56. package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
  57. package/dest/oracle/test-resolver/resolver.js +181 -0
  58. package/dest/oracle/txe_oracle_public_context.d.ts +40 -16
  59. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  60. package/dest/oracle/txe_oracle_public_context.js +69 -23
  61. package/dest/oracle/txe_oracle_registry.d.ts +172 -0
  62. package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
  63. package/dest/oracle/txe_oracle_registry.js +767 -0
  64. package/dest/oracle/txe_oracle_top_level_context.d.ts +79 -30
  65. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  66. package/dest/oracle/txe_oracle_top_level_context.js +653 -285
  67. package/dest/oracle/txe_oracle_version.d.ts +17 -0
  68. package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
  69. package/dest/oracle/txe_oracle_version.js +14 -0
  70. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  71. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  72. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  73. package/dest/rpc_server.d.ts +14 -0
  74. package/dest/rpc_server.d.ts.map +1 -0
  75. package/dest/rpc_server.js +78 -0
  76. package/dest/rpc_translator.d.ts +115 -216
  77. package/dest/rpc_translator.d.ts.map +1 -1
  78. package/dest/rpc_translator.js +901 -560
  79. package/dest/server.bundle.js +3 -0
  80. package/dest/server.bundle.js.map +7 -0
  81. package/dest/state_machine/archiver.d.ts +23 -58
  82. package/dest/state_machine/archiver.d.ts.map +1 -1
  83. package/dest/state_machine/archiver.js +76 -112
  84. package/dest/state_machine/dummy_p2p_client.d.ts +31 -17
  85. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  86. package/dest/state_machine/dummy_p2p_client.js +63 -25
  87. package/dest/state_machine/global_variable_builder.d.ts +10 -5
  88. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  89. package/dest/state_machine/global_variable_builder.js +20 -5
  90. package/dest/state_machine/index.d.ts +14 -8
  91. package/dest/state_machine/index.d.ts.map +1 -1
  92. package/dest/state_machine/index.js +84 -27
  93. package/dest/state_machine/mock_epoch_cache.d.ts +24 -8
  94. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  95. package/dest/state_machine/mock_epoch_cache.js +43 -9
  96. package/dest/state_machine/synchronizer.d.ts +14 -6
  97. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  98. package/dest/state_machine/synchronizer.js +23 -10
  99. package/dest/txe_session.d.ts +102 -20
  100. package/dest/txe_session.d.ts.map +1 -1
  101. package/dest/txe_session.js +442 -75
  102. package/dest/utils/block_creation.d.ts +20 -6
  103. package/dest/utils/block_creation.d.ts.map +1 -1
  104. package/dest/utils/block_creation.js +40 -6
  105. package/dest/utils/encoding.d.ts +192 -0
  106. package/dest/utils/encoding.d.ts.map +1 -0
  107. package/dest/{util → utils}/encoding.js +8 -3
  108. package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
  109. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  110. package/dest/utils/tx_effect_creation.d.ts +2 -3
  111. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  112. package/dest/utils/tx_effect_creation.js +3 -7
  113. package/dest/utils/txe_account_store.d.ts +10 -0
  114. package/dest/utils/txe_account_store.d.ts.map +1 -0
  115. package/dest/{util/txe_account_data_provider.js → utils/txe_account_store.js} +1 -1
  116. package/dest/utils/txe_artifact_resolver.d.ts +37 -0
  117. package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
  118. package/dest/utils/txe_artifact_resolver.js +161 -0
  119. package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
  120. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
  121. package/dest/utils/txe_public_contract_data_source.js +51 -0
  122. package/dest/worker.bundle.js +3 -0
  123. package/dest/worker.bundle.js.map +7 -0
  124. package/dest/worker.d.ts +2 -0
  125. package/dest/worker.d.ts.map +1 -0
  126. package/dest/worker.js +92 -0
  127. package/package.json +39 -22
  128. package/src/bin/check_txe_oracle_version.ts +67 -0
  129. package/src/bin/index.ts +11 -2
  130. package/src/bin/oracle_test_server.ts +51 -0
  131. package/src/constants.ts +13 -0
  132. package/src/dispatcher_pool.ts +317 -0
  133. package/src/index.ts +113 -201
  134. package/src/msgpackr_fr_extension.ts +23 -0
  135. package/src/oracle/interfaces.ts +77 -35
  136. package/src/oracle/tagging_secret_strategy.ts +25 -0
  137. package/src/oracle/test-resolver/default_fixtures.ts +271 -0
  138. package/src/oracle/test-resolver/index.ts +44 -0
  139. package/src/oracle/test-resolver/resolver.ts +245 -0
  140. package/src/oracle/txe_oracle_public_context.ts +82 -27
  141. package/src/oracle/txe_oracle_registry.ts +556 -0
  142. package/src/oracle/txe_oracle_top_level_context.ts +555 -189
  143. package/src/oracle/txe_oracle_version.ts +17 -0
  144. package/src/oracle/txe_private_execution_oracle.ts +30 -0
  145. package/src/rpc_server.ts +87 -0
  146. package/src/rpc_translator.ts +1115 -923
  147. package/src/state_machine/archiver.ts +81 -132
  148. package/src/state_machine/dummy_p2p_client.ts +96 -38
  149. package/src/state_machine/global_variable_builder.ts +28 -10
  150. package/src/state_machine/index.ts +118 -44
  151. package/src/state_machine/mock_epoch_cache.ts +53 -14
  152. package/src/state_machine/synchronizer.ts +32 -12
  153. package/src/txe_session.ts +727 -123
  154. package/src/utils/block_creation.ts +50 -16
  155. package/src/{util → utils}/encoding.ts +9 -3
  156. package/src/utils/tx_effect_creation.ts +3 -13
  157. package/src/{util/txe_account_data_provider.ts → utils/txe_account_store.ts} +1 -1
  158. package/src/utils/txe_artifact_resolver.ts +217 -0
  159. package/src/utils/txe_public_contract_data_source.ts +60 -0
  160. package/src/worker.ts +98 -0
  161. package/dest/util/encoding.d.ts +0 -121
  162. package/dest/util/encoding.d.ts.map +0 -1
  163. package/dest/util/expected_failure_error.d.ts.map +0 -1
  164. package/dest/util/txe_account_data_provider.d.ts +0 -10
  165. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  166. package/dest/util/txe_contract_data_provider.d.ts +0 -12
  167. package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
  168. package/dest/util/txe_contract_data_provider.js +0 -22
  169. package/dest/util/txe_public_contract_data_source.d.ts +0 -21
  170. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  171. package/dest/util/txe_public_contract_data_source.js +0 -67
  172. package/src/util/txe_contract_data_provider.ts +0 -36
  173. package/src/util/txe_public_contract_data_source.ts +0 -86
  174. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  175. /package/src/{util → utils}/expected_failure_error.ts +0 -0
@@ -1,169 +1,118 @@
1
- import { ArchiverStoreHelper, KVArchiverDataStore, type PublishedL2Block } 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
+ 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
6
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
7
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import type { L2Block, L2BlockSource, L2Tips, ValidateBlockResult } from '@aztec/stdlib/block';
9
- import type { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
10
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
11
- import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
12
- import type { BlockHeader } from '@aztec/stdlib/tx';
13
- import type { UInt64 } from '@aztec/stdlib/types';
14
-
15
- // We are extending the ArchiverDataStoreHelper here because it provides most of the endpoints needed by the
16
- // node for reading from and writing to state, without needing any of the extra overhead that the Archiver itself
17
- // requires (i.e. an L1 client)
18
- export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
7
+ import {
8
+ type CheckpointId,
9
+ GENESIS_BLOCK_HEADER_HASH,
10
+ type L2BlockId,
11
+ type L2TipId,
12
+ type L2Tips,
13
+ type ValidateCheckpointResult,
14
+ } from '@aztec/stdlib/block';
15
+ import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
16
+ import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
17
+ import { BlockHeader } from '@aztec/stdlib/tx';
18
+
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);
26
+
19
27
  constructor(db: AztecAsyncKVStore) {
20
- super(new KVArchiverDataStore(db, 9999));
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
+ );
21
35
  }
22
36
 
23
- public override async addBlocks(blocks: PublishedL2Block[]): Promise<boolean> {
24
- const opResults = await Promise.all([
25
- this.store.addLogs(blocks.map(block => block.block)),
26
- this.store.addBlocks(blocks),
27
- ]);
37
+ public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
38
+ await this.updater.addCheckpoints(checkpoints, result);
39
+ }
28
40
 
29
- return opResults.every(Boolean);
41
+ public getRollupAddress(): Promise<EthAddress> {
42
+ throw new Error('TXE Archiver does not implement "getRollupAddress"');
30
43
  }
31
44
 
32
- /**
33
- * Gets the number of the latest L2 block processed by the block source implementation.
34
- * @returns The number of the latest L2 block processed by the block source implementation.
35
- */
36
- public getBlockNumber(): Promise<BlockNumber> {
37
- return this.store.getSynchedL2BlockNumber();
45
+ public getRegistryAddress(): Promise<EthAddress> {
46
+ throw new Error('TXE Archiver does not implement "getRegistryAddress"');
38
47
  }
39
48
 
40
- /**
41
- * Gets the number of the latest L2 block proven seen by the block source implementation.
42
- * @returns The number of the latest L2 block proven seen by the block source implementation.
43
- */
44
- public getProvenBlockNumber(): Promise<BlockNumber> {
45
- return this.store.getSynchedL2BlockNumber();
49
+ public getL1Constants(): Promise<L1RollupConstants> {
50
+ // The TXE has no L1, so it serves the empty constants (epochDuration=1) used throughout the TXE state machine
51
+ // (see mock_epoch_cache). The node calls this when assembling a mined tx receipt to derive the epoch number.
52
+ return Promise.resolve(EmptyL1RollupConstants);
46
53
  }
47
54
 
48
- /**
49
- * Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
50
- * @param number - The block number to return (inclusive).
51
- * @returns The requested L2 block.
52
- */
53
- public override async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
54
- // If the number provided is -ve, then return the latest block.
55
- if (number < 0) {
56
- number = await this.store.getSynchedL2BlockNumber();
57
- }
58
- if (number == 0) {
59
- return undefined;
60
- }
61
- const blocks = await this.store.getPublishedBlocks(BlockNumber(number), 1);
62
- return blocks.length === 0 ? undefined : blocks[0];
55
+ public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
56
+ return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
63
57
  }
64
58
 
65
- /**
66
- * Gets an l2 block. If a negative number is passed, the block returned is the most recent.
67
- * @param number - The block number to return (inclusive).
68
- * @returns The requested L2 block.
69
- */
70
- public getBlock(number: number | 'latest'): Promise<L2Block | undefined> {
71
- return this.getPublishedBlock(number != 'latest' ? number : -1).then(block => block?.block);
59
+ public getL1Timestamp(): Promise<bigint | undefined> {
60
+ throw new Error('TXE Archiver does not implement "getL1Timestamp"');
72
61
  }
73
62
 
74
- /**
75
- * Gets an l2 block header.
76
- * @param number - The block number to return or 'latest' for the most recent one.
77
- * @returns The requested L2 block header.
78
- */
79
- public async getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {
80
- if (number === 'latest') {
81
- number = await this.store.getSynchedL2BlockNumber();
63
+ public async getL2Tips(): Promise<L2Tips> {
64
+ // In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
65
+ // and 'finalized' to the latest block.
66
+ const latestBlockNumber = await this.stores.blocks.getLatestL2BlockNumber();
67
+ if (latestBlockNumber === 0) {
68
+ throw new Error('L2Tips requested from TXE Archiver but no block found');
82
69
  }
83
- if (number === 0) {
84
- return undefined;
70
+ const latestBlockData = await this.stores.blocks.getBlockData({ number: latestBlockNumber });
71
+ if (!latestBlockData) {
72
+ throw new Error('L2Tips requested from TXE Archiver but no block header found');
85
73
  }
86
- const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
87
- return headers.length === 0 ? undefined : headers[0];
88
- }
89
74
 
90
- public getBlocks(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
91
- return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
92
- }
93
-
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> {
103
- throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
104
- }
105
-
106
- public getL2EpochNumber(): Promise<EpochNumber> {
107
- throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
108
- }
75
+ const number = latestBlockData.header.globalVariables.blockNumber;
76
+ const hash = latestBlockData.blockHash.toString();
109
77
 
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[]> {
115
- throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
78
+ // TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
79
+ // This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
80
+ const checkpoint = await this.stores.blocks.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
81
+ if (checkpoint.length === 0) {
82
+ throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
83
+ }
84
+ const blockId: L2BlockId = { number, hash };
85
+ const checkpointId: CheckpointId = {
86
+ number: checkpoint[0].checkpointNumber,
87
+ hash: checkpoint[0].header.hash().toString(),
88
+ };
89
+ const tipId: L2TipId = { block: blockId, checkpoint: checkpointId };
90
+ return {
91
+ proposed: blockId,
92
+ proven: tipId,
93
+ finalized: tipId,
94
+ checkpointed: tipId,
95
+ };
116
96
  }
117
97
 
118
- public getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]> {
119
- throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
98
+ public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
99
+ throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
120
100
  }
121
101
 
122
- public getL1ToL2MessagesForCheckpoint(_checkpointNumber: CheckpointNumber): Promise<Fr[]> {
123
- throw new Error('TXE Archiver does not implement "getL1ToL2MessagesForCheckpoint"');
102
+ public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
103
+ throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
124
104
  }
125
105
 
126
106
  public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
127
107
  throw new Error('TXE Archiver does not implement "isEpochComplete"');
128
108
  }
129
109
 
130
- public getL2Tips(): Promise<L2Tips> {
131
- throw new Error('TXE Archiver does not implement "getL2Tips"');
132
- }
133
-
134
- public getL1Constants(): Promise<L1RollupConstants> {
135
- throw new Error('TXE Archiver does not implement "getL2Constants"');
136
- }
137
-
138
- public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
139
- return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
140
- }
141
-
142
110
  public syncImmediate(): Promise<void> {
143
111
  throw new Error('TXE Archiver does not implement "syncImmediate"');
144
112
  }
145
113
 
146
- public getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined> {
147
- throw new Error('TXE Archiver does not implement "getContract"');
148
- }
149
-
150
- public getRollupAddress(): Promise<EthAddress> {
151
- throw new Error('TXE Archiver does not implement "getRollupAddress"');
152
- }
153
-
154
- public getRegistryAddress(): Promise<EthAddress> {
155
- throw new Error('TXE Archiver does not implement "getRegistryAddress"');
156
- }
157
-
158
- public getL1Timestamp(): Promise<bigint> {
159
- throw new Error('TXE Archiver does not implement "getL1Timestamp"');
160
- }
161
-
162
- public isPendingChainInvalid(): Promise<boolean> {
163
- return Promise.resolve(false);
164
- }
165
-
166
- public override getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
167
- return Promise.resolve({ valid: true });
114
+ public getL2ToL1MembershipWitness(): Promise<undefined> {
115
+ // TXE doesn't drive the L2-to-L1 message flow through this archiver.
116
+ return Promise.resolve(undefined);
168
117
  }
169
118
  }
@@ -1,28 +1,34 @@
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,
8
+ P2PCheckpointReceivedCallback,
7
9
  P2PConfig,
10
+ P2PDuplicateAttestationCallback,
11
+ P2PDuplicateProposalCallback,
12
+ P2POversizedProposalCallback,
8
13
  P2PSyncState,
9
14
  PeerId,
10
15
  ReqRespSubProtocol,
11
16
  ReqRespSubProtocolHandler,
12
- ReqRespSubProtocolValidators,
13
17
  StatusMessage,
14
18
  } from '@aztec/p2p';
15
19
  import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
16
- import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
17
- import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
18
- import type { Tx, TxHash } from '@aztec/stdlib/tx';
20
+ import type { ITxProvider, PeerInfo } from '@aztec/stdlib/interfaces/server';
21
+ import type {
22
+ BlockProposal,
23
+ CheckpointAttestation,
24
+ CheckpointProposal,
25
+ CheckpointProposalCore,
26
+ TopicType,
27
+ } from '@aztec/stdlib/p2p';
28
+ import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
19
29
 
20
30
  export class DummyP2P implements P2P {
21
- public broadcastAttestations(_attestations: BlockAttestation[]): Promise<void> {
22
- return Promise.resolve();
23
- }
24
-
25
- public validate(_txs: Tx[]): Promise<void> {
31
+ public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
26
32
  return Promise.resolve();
27
33
  }
28
34
 
@@ -42,14 +48,34 @@ export class DummyP2P implements P2P {
42
48
  throw new Error('DummyP2P does not implement "getPeers"');
43
49
  }
44
50
 
51
+ public getGossipMeshPeerCount(_topicType: TopicType): Promise<number> {
52
+ return Promise.resolve(0);
53
+ }
54
+
45
55
  public broadcastProposal(_proposal: BlockProposal): Promise<void> {
46
56
  throw new Error('DummyP2P does not implement "broadcastProposal"');
47
57
  }
48
58
 
59
+ public broadcastCheckpointProposal(_proposal: CheckpointProposal): Promise<void> {
60
+ throw new Error('DummyP2P does not implement "broadcastCheckpointProposal"');
61
+ }
62
+
63
+ public broadcastCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
64
+ throw new Error('DummyP2P does not implement "broadcastCheckpointAttestations"');
65
+ }
66
+
49
67
  public registerBlockProposalHandler(_handler: P2PBlockReceivedCallback): void {
50
68
  throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
51
69
  }
52
70
 
71
+ public registerValidatorCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
72
+ throw new Error('DummyP2P does not implement "registerValidatorCheckpointProposalHandler"');
73
+ }
74
+
75
+ public registerAllNodesCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
76
+ throw new Error('DummyP2P does not implement "registerAllNodesCheckpointProposalHandler"');
77
+ }
78
+
53
79
  public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
54
80
  throw new Error('DummyP2P does not implement "requestTxs"');
55
81
  }
@@ -62,8 +88,8 @@ export class DummyP2P implements P2P {
62
88
  throw new Error('DummyP2P does not implement "sendTx"');
63
89
  }
64
90
 
65
- public deleteTxs(_txHashes: TxHash[]): Promise<void> {
66
- throw new Error('DummyP2P does not implement "deleteTxs"');
91
+ public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
92
+ throw new Error('DummyP2P does not implement "handleFailedExecution"');
67
93
  }
68
94
 
69
95
  public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
@@ -79,17 +105,27 @@ export class DummyP2P implements P2P {
79
105
  }
80
106
 
81
107
  public getTxStatus(_txHash: TxHash): Promise<'pending' | 'mined' | undefined> {
82
- throw new Error('DummyP2P does not implement "getTxStatus"');
108
+ // In TXE there is no concept of transactions but we need to implement this because of tagging. We return 'mined'
109
+ // tx status for any tx hash.
110
+ return Promise.resolve('mined');
83
111
  }
84
112
 
85
113
  public iteratePendingTxs(): AsyncIterableIterator<Tx> {
86
114
  throw new Error('DummyP2P does not implement "iteratePendingTxs"');
87
115
  }
88
116
 
117
+ public iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
118
+ throw new Error('DummyP2P does not implement "iterateEligiblePendingTxs"');
119
+ }
120
+
89
121
  public getPendingTxCount(): Promise<number> {
90
122
  throw new Error('DummyP2P does not implement "getPendingTxCount"');
91
123
  }
92
124
 
125
+ public hasEligiblePendingTxs(_minCount: number): Promise<boolean> {
126
+ throw new Error('DummyP2P does not implement "hasEligiblePendingTxs"');
127
+ }
128
+
93
129
  public start(): Promise<void> {
94
130
  throw new Error('DummyP2P does not implement "start"');
95
131
  }
@@ -114,20 +150,34 @@ export class DummyP2P implements P2P {
114
150
  throw new Error('DummyP2P does not implement "isP2PClient"');
115
151
  }
116
152
 
153
+ public getTxProvider(): ITxProvider {
154
+ throw new Error('DummyP2P does not implement "getTxProvider"');
155
+ }
156
+
117
157
  public getTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
118
158
  throw new Error('DummyP2P does not implement "getTxsByHash"');
119
159
  }
120
160
 
121
- public getAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<BlockAttestation[]> {
122
- throw new Error('DummyP2P does not implement "getAttestationForSlot"');
161
+ public getCheckpointAttestationsForSlot(
162
+ _slot: SlotNumber,
163
+ _proposalPayloadHash?: CheckpointProposalHash,
164
+ ): Promise<CheckpointAttestation[]> {
165
+ throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
123
166
  }
124
167
 
125
- public deleteAttestation(_attestation: BlockAttestation): Promise<void> {
126
- return Promise.resolve();
168
+ public addOwnCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
169
+ throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
127
170
  }
128
171
 
129
- public addAttestations(_attestations: BlockAttestation[]): Promise<void> {
130
- throw new Error('DummyP2P does not implement "addAttestations"');
172
+ public getProposalsForSlot(_slot: SlotNumber): Promise<{
173
+ blockProposals: BlockProposal[];
174
+ checkpointProposals: CheckpointProposalCore[];
175
+ }> {
176
+ return Promise.resolve({ blockProposals: [], checkpointProposals: [] });
177
+ }
178
+
179
+ public hasCheckpointProposalForSlot(_slot: SlotNumber): Promise<boolean> {
180
+ return Promise.resolve(false);
131
181
  }
132
182
 
133
183
  public getL2BlockHash(_number: number): Promise<string | undefined> {
@@ -150,14 +200,6 @@ export class DummyP2P implements P2P {
150
200
  throw new Error('DummyP2P does not implement "sync"');
151
201
  }
152
202
 
153
- public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
154
- throw new Error('DummyP2P does not implement "requestTxsByHash"');
155
- }
156
-
157
- public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
158
- throw new Error('DummyP2P does not implement "getTxs"');
159
- }
160
-
161
203
  public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
162
204
  throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
163
205
  }
@@ -166,10 +208,6 @@ export class DummyP2P implements P2P {
166
208
  throw new Error('DummyP2P does not implement "hasTxsInPool"');
167
209
  }
168
210
 
169
- public addTxsToPool(_txs: Tx[]): Promise<number> {
170
- throw new Error('DummyP2P does not implement "addTxs"');
171
- }
172
-
173
211
  public getSyncedLatestBlockNum(): Promise<number> {
174
212
  throw new Error('DummyP2P does not implement "getSyncedLatestBlockNum"');
175
213
  }
@@ -182,15 +220,15 @@ export class DummyP2P implements P2P {
182
220
  throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
183
221
  }
184
222
 
185
- markTxsAsNonEvictable(_: TxHash[]): Promise<void> {
186
- throw new Error('DummyP2P does not implement "markTxsAsNonEvictable".');
223
+ protectTxs(_txHashes: TxHash[], _blockHeader: BlockHeader): Promise<TxHash[]> {
224
+ throw new Error('DummyP2P does not implement "protectTxs".');
225
+ }
226
+
227
+ prepareForSlot(_slotNumber: SlotNumber): Promise<void> {
228
+ return Promise.resolve();
187
229
  }
188
230
 
189
- addReqRespSubProtocol(
190
- _subProtocol: ReqRespSubProtocol,
191
- _handler: ReqRespSubProtocolHandler,
192
- _validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
193
- ): Promise<void> {
231
+ addReqRespSubProtocol(_subProtocol: ReqRespSubProtocol, _handler: ReqRespSubProtocolHandler): Promise<void> {
194
232
  throw new Error('DummyP2P does not implement "addReqRespSubProtocol".');
195
233
  }
196
234
  handleAuthRequestFromPeer(_authRequest: AuthRequest, _peerId: PeerId): Promise<StatusMessage> {
@@ -199,4 +237,24 @@ export class DummyP2P implements P2P {
199
237
 
200
238
  //This is no-op
201
239
  public registerThisValidatorAddresses(_address: EthAddress[]): void {}
240
+
241
+ public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
242
+ throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
243
+ }
244
+
245
+ public registerOversizedProposalCallback(_callback: P2POversizedProposalCallback): void {
246
+ throw new Error('DummyP2P does not implement "registerOversizedProposalCallback"');
247
+ }
248
+
249
+ public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
250
+ throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
251
+ }
252
+
253
+ public registerCheckpointAttestationCallback(_callback: P2PCheckpointAttestationCallback): void {
254
+ throw new Error('DummyP2P does not implement "registerCheckpointAttestationCallback"');
255
+ }
256
+
257
+ public hasBlockProposalsForSlot(_slot: SlotNumber): Promise<boolean> {
258
+ throw new Error('DummyP2P does not implement "hasBlockProposalsForSlot"');
259
+ }
202
260
  }
@@ -1,21 +1,39 @@
1
- import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
1
+ import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
2
+ import 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 GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
8
+ import type { CheckpointGlobalVariables, FeeProvider, GlobalVariableBuilder } from '@aztec/stdlib/tx';
7
9
 
8
- export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
9
- public getCurrentBaseFees(): Promise<GasFees> {
10
+ /** Simple FeeProvider for TXE that returns zero fees. */
11
+ export class TXEFeeProvider implements FeeProvider {
12
+ public getCurrentMinFees(): Promise<GasFees> {
10
13
  return Promise.resolve(new GasFees(0, 0));
11
14
  }
12
15
 
13
- public buildGlobalVariables(
14
- _blockNumber: BlockNumber,
16
+ public getPredictedMinFees(): Promise<GasFees[]> {
17
+ return Promise.resolve(times(FEE_ORACLE_LAG, () => new GasFees(0, 0)));
18
+ }
19
+ }
20
+
21
+ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
22
+ public buildCheckpointGlobalVariables(
15
23
  _coinbase: EthAddress,
16
24
  _feeRecipient: AztecAddress,
17
- _slotNumber?: SlotNumber,
18
- ): Promise<GlobalVariables> {
19
- return Promise.resolve(makeGlobalVariables());
25
+ _slotNumber: SlotNumber,
26
+ _simulationOverridesPlan?: SimulationOverridesPlan,
27
+ ): Promise<CheckpointGlobalVariables> {
28
+ const vars = makeGlobalVariables();
29
+ return Promise.resolve({
30
+ chainId: vars.chainId,
31
+ version: vars.version,
32
+ slotNumber: vars.slotNumber,
33
+ timestamp: vars.timestamp,
34
+ coinbase: vars.coinbase,
35
+ feeRecipient: vars.feeRecipient,
36
+ gasFees: vars.gasFees,
37
+ });
20
38
  }
21
39
  }