@aztec/txe 5.0.0-private.20260319 → 5.0.0-rc.2
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.
- package/dest/AuthRegistry-URXCCPYF.js +3 -0
- package/dest/AuthRegistry-URXCCPYF.js.map +7 -0
- package/dest/ContractClassRegistry-5RDBM6TC.js +3 -0
- package/dest/ContractClassRegistry-5RDBM6TC.js.map +7 -0
- package/dest/ContractInstanceRegistry-GCR4G4D7.js +3 -0
- package/dest/ContractInstanceRegistry-GCR4G4D7.js.map +7 -0
- package/dest/FeeJuice-O3KOSZO5.js +3 -0
- package/dest/FeeJuice-O3KOSZO5.js.map +7 -0
- package/dest/HandshakeRegistry-TXSMHMNY.js +3 -0
- package/dest/HandshakeRegistry-TXSMHMNY.js.map +7 -0
- package/dest/MultiCallEntrypoint-P4FSRXAD.js +3 -0
- package/dest/MultiCallEntrypoint-P4FSRXAD.js.map +7 -0
- package/dest/SchnorrAccount-AQZX7ROU.js +3 -0
- package/dest/SchnorrAccount-AQZX7ROU.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js +3 -0
- package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.d.ts +2 -0
- package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_txe_oracle_version.js +61 -0
- package/dest/bin/index.js +3 -30
- package/dest/bin/index.js.map +7 -0
- package/dest/bin/oracle_test_server.d.ts +3 -0
- package/dest/bin/oracle_test_server.d.ts.map +1 -0
- package/dest/bin/oracle_test_server.js +41 -0
- package/dest/chunk-BJVAAXNA.js +3 -0
- package/dest/chunk-BJVAAXNA.js.map +7 -0
- package/dest/chunk-I6DL4FT2.js +304 -0
- package/dest/chunk-I6DL4FT2.js.map +7 -0
- package/dest/chunk-IAO54JS2.js +266 -0
- package/dest/chunk-IAO54JS2.js.map +7 -0
- package/dest/constants.d.ts +5 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +9 -1
- package/dest/dispatcher_pool.d.ts +67 -0
- package/dest/dispatcher_pool.d.ts.map +1 -0
- package/dest/dispatcher_pool.js +286 -0
- package/dest/index.d.ts +51 -7
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +70 -190
- package/dest/metafile.json +39364 -0
- package/dest/msgpackr_fr_extension.d.ts +2 -0
- package/dest/msgpackr_fr_extension.d.ts.map +1 -0
- package/dest/msgpackr_fr_extension.js +21 -0
- package/dest/oracle/interfaces.d.ts +38 -8
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/test-resolver/default_fixtures.d.ts +9 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/default_fixtures.js +164 -0
- package/dest/oracle/test-resolver/index.d.ts +9 -0
- package/dest/oracle/test-resolver/index.d.ts.map +1 -0
- package/dest/oracle/test-resolver/index.js +32 -0
- package/dest/oracle/test-resolver/resolver.d.ts +48 -0
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
- package/dest/oracle/test-resolver/resolver.js +144 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +26 -2
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +43 -1
- package/dest/oracle/txe_oracle_registry.d.ts +167 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +715 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +42 -17
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +205 -70
- package/dest/oracle/txe_oracle_version.d.ts +17 -0
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_version.js +14 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
- package/dest/oracle/txe_private_execution_oracle.js +15 -0
- package/dest/rpc_server.d.ts +14 -0
- package/dest/rpc_server.d.ts.map +1 -0
- package/dest/rpc_server.js +78 -0
- package/dest/rpc_translator.d.ts +111 -233
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +759 -636
- package/dest/server.bundle.js +3 -0
- package/dest/server.bundle.js.map +7 -0
- package/dest/state_machine/archiver.d.ts +4 -3
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +24 -14
- package/dest/state_machine/dummy_p2p_client.d.ts +15 -7
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +22 -4
- package/dest/state_machine/global_variable_builder.d.ts +10 -6
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +8 -5
- package/dest/state_machine/index.d.ts +9 -6
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +45 -12
- package/dest/state_machine/mock_epoch_cache.d.ts +1 -2
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +0 -3
- package/dest/state_machine/synchronizer.d.ts +3 -2
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +4 -3
- package/dest/txe_session.d.ts +89 -20
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +289 -64
- package/dest/utils/block_creation.d.ts +2 -2
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +2 -2
- package/dest/utils/encoding.d.ts +191 -0
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/{util → utils}/encoding.js +7 -2
- package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
- package/dest/utils/expected_failure_error.d.ts.map +1 -0
- package/dest/{util → utils}/txe_account_store.d.ts +1 -1
- package/dest/utils/txe_account_store.d.ts.map +1 -0
- package/dest/utils/txe_artifact_resolver.d.ts +37 -0
- package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
- package/dest/utils/txe_artifact_resolver.js +161 -0
- package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
- package/dest/{util → utils}/txe_public_contract_data_source.js +1 -3
- package/dest/worker.bundle.js +3 -0
- package/dest/worker.bundle.js.map +7 -0
- package/dest/worker.d.ts +2 -0
- package/dest/worker.d.ts.map +1 -0
- package/dest/worker.js +92 -0
- package/package.json +38 -21
- package/src/bin/check_txe_oracle_version.ts +70 -0
- package/src/bin/index.ts +11 -2
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +11 -1
- package/src/dispatcher_pool.ts +317 -0
- package/src/index.ts +97 -227
- package/src/msgpackr_fr_extension.ts +23 -0
- package/src/oracle/interfaces.ts +35 -7
- package/src/oracle/test-resolver/default_fixtures.ts +226 -0
- package/src/oracle/test-resolver/index.ts +44 -0
- package/src/oracle/test-resolver/resolver.ts +198 -0
- package/src/oracle/txe_oracle_public_context.ts +60 -0
- package/src/oracle/txe_oracle_registry.ts +494 -0
- package/src/oracle/txe_oracle_top_level_context.ts +245 -81
- package/src/oracle/txe_oracle_version.ts +17 -0
- package/src/oracle/txe_private_execution_oracle.ts +30 -0
- package/src/rpc_server.ts +87 -0
- package/src/rpc_translator.ts +845 -905
- package/src/state_machine/archiver.ts +37 -16
- package/src/state_machine/dummy_p2p_client.ts +40 -11
- package/src/state_machine/global_variable_builder.ts +12 -11
- package/src/state_machine/index.ts +44 -30
- package/src/state_machine/mock_epoch_cache.ts +0 -4
- package/src/state_machine/synchronizer.ts +4 -3
- package/src/txe_session.ts +496 -80
- package/src/utils/block_creation.ts +2 -1
- package/src/{util → utils}/encoding.ts +8 -2
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/{util → utils}/txe_public_contract_data_source.ts +0 -2
- package/src/worker.ts +98 -0
- package/dest/util/encoding.d.ts +0 -720
- package/dest/util/encoding.d.ts.map +0 -1
- package/dest/util/expected_failure_error.d.ts.map +0 -1
- package/dest/util/txe_account_store.d.ts.map +0 -1
- package/dest/util/txe_public_contract_data_source.d.ts +0 -20
- package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
- /package/dest/{util → utils}/expected_failure_error.js +0 -0
- /package/dest/{util → utils}/txe_account_store.js +0 -0
- /package/src/{util → utils}/expected_failure_error.ts +0 -0
- /package/src/{util → utils}/txe_account_store.ts +0 -0
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater,
|
|
1
|
+
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater, createArchiverDataStores } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
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
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
7
|
-
import
|
|
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';
|
|
8
15
|
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
9
|
-
import type
|
|
16
|
+
import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
17
|
+
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
10
18
|
|
|
11
19
|
/**
|
|
12
20
|
* TXE Archiver implementation.
|
|
@@ -14,11 +22,16 @@ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
|
14
22
|
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
15
23
|
*/
|
|
16
24
|
export class TXEArchiver extends ArchiverDataSourceBase {
|
|
17
|
-
private readonly updater = new ArchiverDataStoreUpdater(this.
|
|
25
|
+
private readonly updater = new ArchiverDataStoreUpdater(this.stores);
|
|
18
26
|
|
|
19
27
|
constructor(db: AztecAsyncKVStore) {
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
);
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
|
|
@@ -34,7 +47,9 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
public getL1Constants(): Promise<L1RollupConstants> {
|
|
37
|
-
|
|
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);
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
@@ -48,20 +63,21 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
48
63
|
public async getL2Tips(): Promise<L2Tips> {
|
|
49
64
|
// In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
|
|
50
65
|
// and 'finalized' to the latest block.
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
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');
|
|
69
|
+
}
|
|
70
|
+
const latestBlockData = await this.stores.blocks.getBlockData({ number: latestBlockNumber });
|
|
71
|
+
if (!latestBlockData) {
|
|
53
72
|
throw new Error('L2Tips requested from TXE Archiver but no block header found');
|
|
54
73
|
}
|
|
55
74
|
|
|
56
|
-
const number =
|
|
57
|
-
const hash =
|
|
58
|
-
|
|
59
|
-
if (!checkpointedBlock) {
|
|
60
|
-
throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
|
|
61
|
-
}
|
|
75
|
+
const number = latestBlockData.header.globalVariables.blockNumber;
|
|
76
|
+
const hash = latestBlockData.blockHash.toString();
|
|
77
|
+
|
|
62
78
|
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
63
79
|
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
64
|
-
const checkpoint = await this.
|
|
80
|
+
const checkpoint = await this.stores.blocks.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
65
81
|
if (checkpoint.length === 0) {
|
|
66
82
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
67
83
|
}
|
|
@@ -94,4 +110,9 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
94
110
|
public syncImmediate(): Promise<void> {
|
|
95
111
|
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
96
112
|
}
|
|
113
|
+
|
|
114
|
+
public getL2ToL1MembershipWitness(): Promise<undefined> {
|
|
115
|
+
// TXE doesn't drive the L2-to-L1 message flow through this archiver.
|
|
116
|
+
return Promise.resolve(undefined);
|
|
117
|
+
}
|
|
97
118
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
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,
|
|
9
10
|
P2PDuplicateAttestationCallback,
|
|
10
11
|
P2PDuplicateProposalCallback,
|
|
12
|
+
P2POversizedProposalCallback,
|
|
11
13
|
P2PSyncState,
|
|
12
14
|
PeerId,
|
|
13
15
|
ReqRespSubProtocol,
|
|
14
16
|
ReqRespSubProtocolHandler,
|
|
15
|
-
ReqRespSubProtocolValidators,
|
|
16
17
|
StatusMessage,
|
|
17
18
|
} from '@aztec/p2p';
|
|
18
19
|
import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
|
|
19
20
|
import type { ITxProvider, PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
20
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
BlockProposal,
|
|
23
|
+
CheckpointAttestation,
|
|
24
|
+
CheckpointProposal,
|
|
25
|
+
CheckpointProposalCore,
|
|
26
|
+
TopicType,
|
|
27
|
+
} from '@aztec/stdlib/p2p';
|
|
21
28
|
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
22
29
|
|
|
23
30
|
export class DummyP2P implements P2P {
|
|
@@ -61,8 +68,12 @@ export class DummyP2P implements P2P {
|
|
|
61
68
|
throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
public
|
|
65
|
-
throw new Error('DummyP2P does not implement "
|
|
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"');
|
|
66
77
|
}
|
|
67
78
|
|
|
68
79
|
public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
@@ -143,7 +154,10 @@ export class DummyP2P implements P2P {
|
|
|
143
154
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
144
155
|
}
|
|
145
156
|
|
|
146
|
-
public getCheckpointAttestationsForSlot(
|
|
157
|
+
public getCheckpointAttestationsForSlot(
|
|
158
|
+
_slot: SlotNumber,
|
|
159
|
+
_proposalPayloadHash?: CheckpointProposalHash,
|
|
160
|
+
): Promise<CheckpointAttestation[]> {
|
|
147
161
|
throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
|
|
148
162
|
}
|
|
149
163
|
|
|
@@ -151,6 +165,17 @@ export class DummyP2P implements P2P {
|
|
|
151
165
|
throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
|
|
152
166
|
}
|
|
153
167
|
|
|
168
|
+
public getProposalsForSlot(_slot: SlotNumber): Promise<{
|
|
169
|
+
blockProposals: BlockProposal[];
|
|
170
|
+
checkpointProposals: CheckpointProposalCore[];
|
|
171
|
+
}> {
|
|
172
|
+
return Promise.resolve({ blockProposals: [], checkpointProposals: [] });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public hasCheckpointProposalForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
176
|
+
return Promise.resolve(false);
|
|
177
|
+
}
|
|
178
|
+
|
|
154
179
|
public getL2BlockHash(_number: number): Promise<string | undefined> {
|
|
155
180
|
throw new Error('DummyP2P does not implement "getL2BlockHash"');
|
|
156
181
|
}
|
|
@@ -199,11 +224,7 @@ export class DummyP2P implements P2P {
|
|
|
199
224
|
return Promise.resolve();
|
|
200
225
|
}
|
|
201
226
|
|
|
202
|
-
addReqRespSubProtocol(
|
|
203
|
-
_subProtocol: ReqRespSubProtocol,
|
|
204
|
-
_handler: ReqRespSubProtocolHandler,
|
|
205
|
-
_validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
|
|
206
|
-
): Promise<void> {
|
|
227
|
+
addReqRespSubProtocol(_subProtocol: ReqRespSubProtocol, _handler: ReqRespSubProtocolHandler): Promise<void> {
|
|
207
228
|
throw new Error('DummyP2P does not implement "addReqRespSubProtocol".');
|
|
208
229
|
}
|
|
209
230
|
handleAuthRequestFromPeer(_authRequest: AuthRequest, _peerId: PeerId): Promise<StatusMessage> {
|
|
@@ -217,10 +238,18 @@ export class DummyP2P implements P2P {
|
|
|
217
238
|
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
218
239
|
}
|
|
219
240
|
|
|
241
|
+
public registerOversizedProposalCallback(_callback: P2POversizedProposalCallback): void {
|
|
242
|
+
throw new Error('DummyP2P does not implement "registerOversizedProposalCallback"');
|
|
243
|
+
}
|
|
244
|
+
|
|
220
245
|
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
|
|
221
246
|
throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
|
|
222
247
|
}
|
|
223
248
|
|
|
249
|
+
public registerCheckpointAttestationCallback(_callback: P2PCheckpointAttestationCallback): void {
|
|
250
|
+
throw new Error('DummyP2P does not implement "registerCheckpointAttestationCallback"');
|
|
251
|
+
}
|
|
252
|
+
|
|
224
253
|
public hasBlockProposalsForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
225
254
|
throw new Error('DummyP2P does not implement "hasBlockProposalsForSlot"');
|
|
226
255
|
}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
8
|
+
import type { CheckpointGlobalVariables, FeeProvider, GlobalVariableBuilder } from '@aztec/stdlib/tx';
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
/** Simple FeeProvider for TXE that returns zero fees. */
|
|
11
|
+
export class TXEFeeProvider implements FeeProvider {
|
|
9
12
|
public getCurrentMinFees(): Promise<GasFees> {
|
|
10
13
|
return Promise.resolve(new GasFees(0, 0));
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
public
|
|
14
|
-
|
|
15
|
-
_coinbase: EthAddress,
|
|
16
|
-
_feeRecipient: AztecAddress,
|
|
17
|
-
_slotNumber?: SlotNumber,
|
|
18
|
-
): Promise<GlobalVariables> {
|
|
19
|
-
return Promise.resolve(makeGlobalVariables());
|
|
16
|
+
public getPredictedMinFees(): Promise<GasFees[]> {
|
|
17
|
+
return Promise.resolve(times(FEE_ORACLE_LAG, () => new GasFees(0, 0)));
|
|
20
18
|
}
|
|
19
|
+
}
|
|
21
20
|
|
|
21
|
+
export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
22
22
|
public buildCheckpointGlobalVariables(
|
|
23
23
|
_coinbase: EthAddress,
|
|
24
24
|
_feeRecipient: AztecAddress,
|
|
25
25
|
_slotNumber: SlotNumber,
|
|
26
|
+
_simulationOverridesPlan?: SimulationOverridesPlan,
|
|
26
27
|
): Promise<CheckpointGlobalVariables> {
|
|
27
28
|
const vars = makeGlobalVariables();
|
|
28
29
|
return Promise.resolve({
|
|
@@ -4,21 +4,23 @@ import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
|
|
7
|
-
import {
|
|
8
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
7
|
+
import { TxResolverService } from '@aztec/pxe/simulator';
|
|
8
|
+
import { L2Block, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
9
9
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
10
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
12
|
-
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
13
12
|
|
|
14
13
|
import { TXEArchiver } from './archiver.js';
|
|
15
14
|
import { DummyP2P } from './dummy_p2p_client.js';
|
|
16
|
-
import { TXEGlobalVariablesBuilder } from './global_variable_builder.js';
|
|
15
|
+
import { TXEFeeProvider, TXEGlobalVariablesBuilder } from './global_variable_builder.js';
|
|
17
16
|
import { MockEpochCache } from './mock_epoch_cache.js';
|
|
18
17
|
import { TXESynchronizer } from './synchronizer.js';
|
|
19
18
|
|
|
20
19
|
const VERSION = 1;
|
|
21
20
|
const CHAIN_ID = 1;
|
|
21
|
+
// Hardcoded so the bundled TXE doesn't try to read stdlib's package.json at a relative path
|
|
22
|
+
// that becomes invalid once bundled
|
|
23
|
+
const PACKAGE_VERSION = 'txe';
|
|
22
24
|
|
|
23
25
|
export class TXEStateMachine {
|
|
24
26
|
constructor(
|
|
@@ -27,7 +29,7 @@ export class TXEStateMachine {
|
|
|
27
29
|
public archiver: TXEArchiver,
|
|
28
30
|
public anchorBlockStore: AnchorBlockStore,
|
|
29
31
|
public contractSyncService: ContractSyncService,
|
|
30
|
-
public
|
|
32
|
+
public txResolver: TxResolverService,
|
|
31
33
|
) {}
|
|
32
34
|
|
|
33
35
|
public static async create(
|
|
@@ -40,28 +42,31 @@ export class TXEStateMachine {
|
|
|
40
42
|
const aztecNodeConfig = {} as AztecNodeConfig;
|
|
41
43
|
|
|
42
44
|
const log = createLogger('txe_node');
|
|
43
|
-
const node = new AztecNodeService(
|
|
44
|
-
aztecNodeConfig,
|
|
45
|
-
new DummyP2P(),
|
|
46
|
-
archiver,
|
|
47
|
-
archiver,
|
|
48
|
-
archiver,
|
|
49
|
-
archiver,
|
|
50
|
-
synchronizer,
|
|
51
|
-
undefined,
|
|
52
|
-
undefined,
|
|
53
|
-
undefined,
|
|
54
|
-
undefined,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
new TXEGlobalVariablesBuilder(),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
new
|
|
62
|
-
|
|
45
|
+
const node = new AztecNodeService({
|
|
46
|
+
config: aztecNodeConfig,
|
|
47
|
+
p2pClient: new DummyP2P(),
|
|
48
|
+
blockSource: archiver,
|
|
49
|
+
logsSource: archiver,
|
|
50
|
+
contractDataSource: archiver,
|
|
51
|
+
l1ToL2MessageSource: archiver,
|
|
52
|
+
worldStateSynchronizer: synchronizer,
|
|
53
|
+
sequencer: undefined,
|
|
54
|
+
proverNode: undefined,
|
|
55
|
+
slasherClient: undefined,
|
|
56
|
+
validatorsSentinel: undefined,
|
|
57
|
+
stopStartedWatchers: async () => {},
|
|
58
|
+
l1ChainId: CHAIN_ID,
|
|
59
|
+
version: VERSION,
|
|
60
|
+
globalVariableBuilder: new TXEGlobalVariablesBuilder(),
|
|
61
|
+
rollupContract: undefined,
|
|
62
|
+
feeProvider: new TXEFeeProvider(),
|
|
63
|
+
epochCache: new MockEpochCache(),
|
|
64
|
+
packageVersion: PACKAGE_VERSION,
|
|
65
|
+
peerProofVerifier: new TestCircuitVerifier(),
|
|
66
|
+
rpcProofVerifier: new TestCircuitVerifier(),
|
|
67
|
+
telemetry: undefined,
|
|
63
68
|
log,
|
|
64
|
-
);
|
|
69
|
+
});
|
|
65
70
|
|
|
66
71
|
const contractSyncService = new ContractSyncService(
|
|
67
72
|
node,
|
|
@@ -70,12 +75,20 @@ export class TXEStateMachine {
|
|
|
70
75
|
createLogger('txe:contract_sync'),
|
|
71
76
|
);
|
|
72
77
|
|
|
73
|
-
const
|
|
78
|
+
const txResolver = new TxResolverService(node);
|
|
79
|
+
|
|
80
|
+
return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService, txResolver);
|
|
81
|
+
}
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
/** Returns an {@link L2TipsProvider} backed by this node's chain tips. */
|
|
84
|
+
public get l2TipsProvider(): L2TipsProvider {
|
|
85
|
+
const node = this.node;
|
|
86
|
+
return {
|
|
87
|
+
getL2Tips: () => node.getChainTips(),
|
|
88
|
+
};
|
|
76
89
|
}
|
|
77
90
|
|
|
78
|
-
public async handleL2Block(block: L2Block) {
|
|
91
|
+
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
|
|
79
92
|
// Create a checkpoint from the block manually.
|
|
80
93
|
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
81
94
|
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
@@ -94,6 +107,7 @@ export class TXEStateMachine {
|
|
|
94
107
|
feeRecipient: block.header.globalVariables.feeRecipient,
|
|
95
108
|
gasFees: block.header.globalVariables.gasFees,
|
|
96
109
|
totalManaUsed: block.header.totalManaUsed,
|
|
110
|
+
accumulatedFees: block.header.totalFees,
|
|
97
111
|
}),
|
|
98
112
|
[block],
|
|
99
113
|
checkpointNumber,
|
|
@@ -112,7 +126,7 @@ export class TXEStateMachine {
|
|
|
112
126
|
this.contractSyncService.wipe();
|
|
113
127
|
|
|
114
128
|
await Promise.all([
|
|
115
|
-
this.synchronizer.handleL2Block(block),
|
|
129
|
+
this.synchronizer.handleL2Block(block, l1ToL2Messages),
|
|
116
130
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|
|
117
131
|
this.anchorBlockStore.setHeader(block.header),
|
|
118
132
|
]);
|
|
@@ -55,10 +55,6 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
55
55
|
return this.getEpochAndSlotInNextL1Slot();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
isProposerPipeliningEnabled(): boolean {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
58
|
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
|
|
63
59
|
return '0x00';
|
|
64
60
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
2
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import type { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
5
6
|
import type {
|
|
@@ -18,15 +19,15 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
18
19
|
constructor(public nativeWorldStateService: NativeWorldStateService) {}
|
|
19
20
|
|
|
20
21
|
static async create() {
|
|
21
|
-
const nativeWorldStateService = await NativeWorldStateService.
|
|
22
|
+
const nativeWorldStateService = await NativeWorldStateService.ephemeral();
|
|
22
23
|
|
|
23
24
|
return new this(nativeWorldStateService);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
public async handleL2Block(block: L2Block) {
|
|
27
|
+
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
|
|
27
28
|
await this.nativeWorldStateService.handleL2BlockAndMessages(
|
|
28
29
|
block,
|
|
29
|
-
|
|
30
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
30
31
|
);
|
|
31
32
|
|
|
32
33
|
this.blockNumber = block.header.globalVariables.blockNumber;
|