@aztec/txe 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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-QVGDDH5X.js +3 -0
- package/dest/AuthRegistry-QVGDDH5X.js.map +7 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js +3 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js.map +7 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js +3 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js.map +7 -0
- package/dest/FeeJuice-MAQJU53K.js +3 -0
- package/dest/FeeJuice-MAQJU53K.js.map +7 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js +3 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js.map +7 -0
- package/dest/SchnorrAccount-ADD65DYA.js +3 -0
- package/dest/SchnorrAccount-ADD65DYA.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js +3 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.js +9 -19
- package/dest/bin/index.js +1 -1
- 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-32UHX7YY.js +3 -0
- package/dest/{chunk-DF6RMOC6.js → chunk-RVEPNDEP.js} +2 -2
- package/dest/{chunk-DF6RMOC6.js.map → chunk-RVEPNDEP.js.map} +3 -3
- package/dest/chunk-XWIMXLKD.js +258 -0
- package/dest/chunk-XWIMXLKD.js.map +7 -0
- package/dest/constants.d.ts +3 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +5 -2
- package/dest/dispatcher_pool.d.ts +2 -2
- package/dest/dispatcher_pool.d.ts.map +1 -1
- package/dest/dispatcher_pool.js +5 -3
- package/dest/index.d.ts +6 -143
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +12 -169
- package/dest/metafile.json +10267 -9581
- package/dest/oracle/interfaces.d.ts +38 -11
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
- package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
- package/dest/oracle/tagging_secret_strategy.js +12 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts +16 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/default_fixtures.js +200 -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 +181 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +25 -6
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +34 -1
- package/dest/oracle/txe_oracle_registry.d.ts +172 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +767 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +39 -14
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +489 -289
- package/dest/{txe_oracle_version.d.ts → oracle/txe_oracle_version.d.ts} +5 -5
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/{txe_oracle_version.js → oracle/txe_oracle_version.js} +4 -4
- package/dest/rpc_translator.d.ts +116 -284
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +809 -860
- package/dest/server.bundle.js +1 -1
- package/dest/state_machine/archiver.d.ts +3 -2
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +9 -3
- package/dest/state_machine/dummy_p2p_client.d.ts +5 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +9 -0
- package/dest/state_machine/global_variable_builder.d.ts +3 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +0 -3
- package/dest/state_machine/index.d.ts +8 -6
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +41 -19
- package/dest/state_machine/mock_epoch_cache.d.ts +2 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +3 -6
- package/dest/state_machine/synchronizer.d.ts +10 -2
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +18 -5
- package/dest/txe_session.d.ts +43 -28
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +183 -47
- 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 +8 -5
- package/dest/utils/encoding.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.d.ts +1 -1
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +0 -1
- 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 +1 -1
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/utils/txe_public_contract_data_source.js +7 -4
- package/dest/worker.bundle.js +1 -1
- package/package.json +18 -17
- package/src/bin/check_txe_oracle_version.ts +11 -17
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +6 -2
- package/src/dispatcher_pool.ts +4 -3
- package/src/index.ts +21 -198
- package/src/oracle/interfaces.ts +35 -9
- package/src/oracle/tagging_secret_strategy.ts +25 -0
- package/src/oracle/test-resolver/default_fixtures.ts +271 -0
- package/src/oracle/test-resolver/index.ts +44 -0
- package/src/oracle/test-resolver/resolver.ts +245 -0
- package/src/oracle/txe_oracle_public_context.ts +36 -4
- package/src/oracle/txe_oracle_registry.ts +556 -0
- package/src/oracle/txe_oracle_top_level_context.ts +249 -66
- package/src/{txe_oracle_version.ts → oracle/txe_oracle_version.ts} +4 -4
- package/src/rpc_translator.ts +850 -1065
- package/src/state_machine/archiver.ts +9 -3
- package/src/state_machine/dummy_p2p_client.ts +13 -0
- package/src/state_machine/global_variable_builder.ts +2 -16
- package/src/state_machine/index.ts +50 -34
- package/src/state_machine/mock_epoch_cache.ts +4 -8
- package/src/state_machine/synchronizer.ts +26 -5
- package/src/txe_session.ts +325 -56
- package/src/utils/block_creation.ts +2 -1
- package/src/utils/tx_effect_creation.ts +0 -2
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/utils/txe_public_contract_data_source.ts +6 -4
- package/dest/ContractClassRegistry-KKNT527R.js +0 -3
- package/dest/ContractClassRegistry-KKNT527R.js.map +0 -7
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js +0 -3
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js.map +0 -7
- package/dest/FeeJuice-GUJ5O6GB.js +0 -3
- package/dest/FeeJuice-GUJ5O6GB.js.map +0 -7
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js +0 -3
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js.map +0 -7
- package/dest/SchnorrAccount-QIXE5DXA.js +0 -3
- package/dest/SchnorrAccount-QIXE5DXA.js.map +0 -7
- package/dest/chunk-BJVAAXNA.js +0 -3
- package/dest/chunk-PPJTNNUG.js +0 -265
- package/dest/chunk-PPJTNNUG.js.map +0 -7
- package/dest/txe_oracle_version.d.ts.map +0 -1
- /package/dest/{chunk-BJVAAXNA.js.map → chunk-32UHX7YY.js.map} +0 -0
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type ValidateCheckpointResult,
|
|
14
14
|
} from '@aztec/stdlib/block';
|
|
15
15
|
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
16
|
-
import type
|
|
16
|
+
import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
17
17
|
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -47,7 +47,9 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
public getL1Constants(): Promise<L1RollupConstants> {
|
|
50
|
-
|
|
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);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
@@ -90,7 +92,6 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
90
92
|
proven: tipId,
|
|
91
93
|
finalized: tipId,
|
|
92
94
|
checkpointed: tipId,
|
|
93
|
-
proposedCheckpoint: tipId,
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -109,4 +110,9 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
109
110
|
public syncImmediate(): Promise<void> {
|
|
110
111
|
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
111
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
|
+
}
|
|
112
118
|
}
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
P2PConfig,
|
|
10
10
|
P2PDuplicateAttestationCallback,
|
|
11
11
|
P2PDuplicateProposalCallback,
|
|
12
|
+
P2POversizedProposalCallback,
|
|
12
13
|
P2PSyncState,
|
|
13
14
|
PeerId,
|
|
14
15
|
ReqRespSubProtocol,
|
|
@@ -121,6 +122,10 @@ export class DummyP2P implements P2P {
|
|
|
121
122
|
throw new Error('DummyP2P does not implement "getPendingTxCount"');
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
public hasEligiblePendingTxs(_minCount: number): Promise<boolean> {
|
|
126
|
+
throw new Error('DummyP2P does not implement "hasEligiblePendingTxs"');
|
|
127
|
+
}
|
|
128
|
+
|
|
124
129
|
public start(): Promise<void> {
|
|
125
130
|
throw new Error('DummyP2P does not implement "start"');
|
|
126
131
|
}
|
|
@@ -171,6 +176,10 @@ export class DummyP2P implements P2P {
|
|
|
171
176
|
return Promise.resolve({ blockProposals: [], checkpointProposals: [] });
|
|
172
177
|
}
|
|
173
178
|
|
|
179
|
+
public hasCheckpointProposalForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
180
|
+
return Promise.resolve(false);
|
|
181
|
+
}
|
|
182
|
+
|
|
174
183
|
public getL2BlockHash(_number: number): Promise<string | undefined> {
|
|
175
184
|
throw new Error('DummyP2P does not implement "getL2BlockHash"');
|
|
176
185
|
}
|
|
@@ -233,6 +242,10 @@ export class DummyP2P implements P2P {
|
|
|
233
242
|
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
234
243
|
}
|
|
235
244
|
|
|
245
|
+
public registerOversizedProposalCallback(_callback: P2POversizedProposalCallback): void {
|
|
246
|
+
throw new Error('DummyP2P does not implement "registerOversizedProposalCallback"');
|
|
247
|
+
}
|
|
248
|
+
|
|
236
249
|
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
|
|
237
250
|
throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
|
|
238
251
|
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
|
|
2
|
-
import {
|
|
2
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { times } from '@aztec/foundation/collection';
|
|
4
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
6
|
import { FEE_ORACLE_LAG, GasFees } from '@aztec/stdlib/gas';
|
|
7
7
|
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
8
|
-
import {
|
|
9
|
-
type CheckpointGlobalVariables,
|
|
10
|
-
type FeeProvider,
|
|
11
|
-
type GlobalVariableBuilder,
|
|
12
|
-
GlobalVariables,
|
|
13
|
-
} from '@aztec/stdlib/tx';
|
|
8
|
+
import type { CheckpointGlobalVariables, FeeProvider, GlobalVariableBuilder } from '@aztec/stdlib/tx';
|
|
14
9
|
|
|
15
10
|
/** Simple FeeProvider for TXE that returns zero fees. */
|
|
16
11
|
export class TXEFeeProvider implements FeeProvider {
|
|
@@ -24,15 +19,6 @@ export class TXEFeeProvider implements FeeProvider {
|
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
27
|
-
public buildGlobalVariables(
|
|
28
|
-
_blockNumber: BlockNumber,
|
|
29
|
-
_coinbase: EthAddress,
|
|
30
|
-
_feeRecipient: AztecAddress,
|
|
31
|
-
_slotNumber?: SlotNumber,
|
|
32
|
-
): Promise<GlobalVariables> {
|
|
33
|
-
return Promise.resolve(makeGlobalVariables());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
22
|
public buildCheckpointGlobalVariables(
|
|
37
23
|
_coinbase: EthAddress,
|
|
38
24
|
_feeRecipient: AztecAddress,
|
|
@@ -3,8 +3,14 @@ import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
|
3
3
|
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
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
type AnchorBlockStore,
|
|
8
|
+
ContractClassService,
|
|
9
|
+
type ContractStore,
|
|
10
|
+
ContractSyncService,
|
|
11
|
+
type NoteStore,
|
|
12
|
+
} from '@aztec/pxe/server';
|
|
13
|
+
import { TxResolverService } from '@aztec/pxe/simulator';
|
|
8
14
|
import { L2Block, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
9
15
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
16
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -29,7 +35,8 @@ export class TXEStateMachine {
|
|
|
29
35
|
public archiver: TXEArchiver,
|
|
30
36
|
public anchorBlockStore: AnchorBlockStore,
|
|
31
37
|
public contractSyncService: ContractSyncService,
|
|
32
|
-
public
|
|
38
|
+
public contractClassService: ContractClassService,
|
|
39
|
+
public txResolver: TxResolverService,
|
|
33
40
|
) {}
|
|
34
41
|
|
|
35
42
|
public static async create(
|
|
@@ -42,55 +49,63 @@ export class TXEStateMachine {
|
|
|
42
49
|
const aztecNodeConfig = {} as AztecNodeConfig;
|
|
43
50
|
|
|
44
51
|
const log = createLogger('txe_node');
|
|
45
|
-
const node = new AztecNodeService(
|
|
46
|
-
aztecNodeConfig,
|
|
47
|
-
new DummyP2P(),
|
|
48
|
-
archiver,
|
|
49
|
-
archiver,
|
|
50
|
-
archiver,
|
|
51
|
-
archiver,
|
|
52
|
-
synchronizer,
|
|
53
|
-
undefined,
|
|
54
|
-
undefined,
|
|
55
|
-
undefined,
|
|
56
|
-
undefined,
|
|
57
|
-
async () => {},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
new TXEGlobalVariablesBuilder(),
|
|
61
|
-
|
|
62
|
-
new
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
new TestCircuitVerifier(),
|
|
66
|
-
|
|
52
|
+
const node = new AztecNodeService({
|
|
53
|
+
config: aztecNodeConfig,
|
|
54
|
+
p2pClient: new DummyP2P(),
|
|
55
|
+
blockSource: archiver,
|
|
56
|
+
logsSource: archiver,
|
|
57
|
+
contractDataSource: archiver,
|
|
58
|
+
l1ToL2MessageSource: archiver,
|
|
59
|
+
worldStateSynchronizer: synchronizer,
|
|
60
|
+
sequencer: undefined,
|
|
61
|
+
proverNode: undefined,
|
|
62
|
+
slasherClient: undefined,
|
|
63
|
+
validatorsSentinel: undefined,
|
|
64
|
+
stopStartedWatchers: async () => {},
|
|
65
|
+
l1ChainId: CHAIN_ID,
|
|
66
|
+
version: VERSION,
|
|
67
|
+
globalVariableBuilder: new TXEGlobalVariablesBuilder(),
|
|
68
|
+
rollupContract: undefined,
|
|
69
|
+
feeProvider: new TXEFeeProvider(),
|
|
70
|
+
epochCache: new MockEpochCache(),
|
|
71
|
+
packageVersion: PACKAGE_VERSION,
|
|
72
|
+
peerProofVerifier: new TestCircuitVerifier(),
|
|
73
|
+
rpcProofVerifier: new TestCircuitVerifier(),
|
|
74
|
+
telemetry: undefined,
|
|
67
75
|
log,
|
|
68
|
-
);
|
|
76
|
+
});
|
|
69
77
|
|
|
78
|
+
const contractClassService = new ContractClassService(node, contractStore);
|
|
70
79
|
const contractSyncService = new ContractSyncService(
|
|
71
80
|
node,
|
|
72
81
|
contractStore,
|
|
82
|
+
contractClassService,
|
|
73
83
|
noteStore,
|
|
74
84
|
createLogger('txe:contract_sync'),
|
|
75
85
|
);
|
|
76
86
|
|
|
77
|
-
const
|
|
87
|
+
const txResolver = new TxResolverService(node);
|
|
78
88
|
|
|
79
|
-
return new this(
|
|
89
|
+
return new this(
|
|
90
|
+
node,
|
|
91
|
+
synchronizer,
|
|
92
|
+
archiver,
|
|
93
|
+
anchorBlockStore,
|
|
94
|
+
contractSyncService,
|
|
95
|
+
contractClassService,
|
|
96
|
+
txResolver,
|
|
97
|
+
);
|
|
80
98
|
}
|
|
81
99
|
|
|
82
100
|
/** Returns an {@link L2TipsProvider} backed by this node's chain tips. */
|
|
83
101
|
public get l2TipsProvider(): L2TipsProvider {
|
|
84
102
|
const node = this.node;
|
|
85
103
|
return {
|
|
86
|
-
getL2Tips:
|
|
87
|
-
const tips = await node.getChainTips();
|
|
88
|
-
return { ...tips, proposedCheckpoint: tips.checkpointed };
|
|
89
|
-
},
|
|
104
|
+
getL2Tips: () => node.getChainTips(),
|
|
90
105
|
};
|
|
91
106
|
}
|
|
92
107
|
|
|
93
|
-
public async handleL2Block(block: L2Block) {
|
|
108
|
+
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
|
|
94
109
|
// Create a checkpoint from the block manually.
|
|
95
110
|
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
96
111
|
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
@@ -109,6 +124,7 @@ export class TXEStateMachine {
|
|
|
109
124
|
feeRecipient: block.header.globalVariables.feeRecipient,
|
|
110
125
|
gasFees: block.header.globalVariables.gasFees,
|
|
111
126
|
totalManaUsed: block.header.totalManaUsed,
|
|
127
|
+
accumulatedFees: block.header.totalFees,
|
|
112
128
|
}),
|
|
113
129
|
[block],
|
|
114
130
|
checkpointNumber,
|
|
@@ -127,7 +143,7 @@ export class TXEStateMachine {
|
|
|
127
143
|
this.contractSyncService.wipe();
|
|
128
144
|
|
|
129
145
|
await Promise.all([
|
|
130
|
-
this.synchronizer.handleL2Block(block),
|
|
146
|
+
this.synchronizer.handleL2Block(block, l1ToL2Messages),
|
|
131
147
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|
|
132
148
|
this.anchorBlockStore.setHeader(block.header),
|
|
133
149
|
]);
|
|
@@ -55,14 +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
|
-
pipeliningOffset(): number {
|
|
63
|
-
return 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
58
|
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
|
|
67
59
|
return '0x00';
|
|
68
60
|
}
|
|
@@ -112,4 +104,8 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
112
104
|
getL1Constants(): L1RollupConstants {
|
|
113
105
|
return EmptyL1RollupConstants;
|
|
114
106
|
}
|
|
107
|
+
|
|
108
|
+
getLagInEpochsForValidatorSet(): number {
|
|
109
|
+
return 0;
|
|
110
|
+
}
|
|
115
111
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
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';
|
|
5
|
+
import { AvmSimulatorPool } from '@aztec/simulator/server';
|
|
4
6
|
import type { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
5
7
|
import type {
|
|
6
8
|
MerkleTreeReadOperations,
|
|
@@ -15,18 +17,27 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
15
17
|
// This works when set to 1 as well.
|
|
16
18
|
private blockNumber = BlockNumber.ZERO;
|
|
17
19
|
|
|
20
|
+
/** AVM execution backend (simulator pool + CDB server) shared across all public simulations. */
|
|
21
|
+
public avmSimulator!: AvmSimulatorPool;
|
|
22
|
+
|
|
18
23
|
constructor(public nativeWorldStateService: NativeWorldStateService) {}
|
|
19
24
|
|
|
20
25
|
static async create() {
|
|
21
26
|
const nativeWorldStateService = await NativeWorldStateService.ephemeral();
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
const synchronizer = new this(nativeWorldStateService);
|
|
29
|
+
|
|
30
|
+
synchronizer.avmSimulator = await AvmSimulatorPool.spawn({
|
|
31
|
+
wsdbIpcPath: nativeWorldStateService.getIpcPath(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return synchronizer;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
public async handleL2Block(block: L2Block) {
|
|
37
|
+
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
|
|
27
38
|
await this.nativeWorldStateService.handleL2BlockAndMessages(
|
|
28
39
|
block,
|
|
29
|
-
|
|
40
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
30
41
|
);
|
|
31
42
|
|
|
32
43
|
this.blockNumber = block.header.globalVariables.blockNumber;
|
|
@@ -57,6 +68,11 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
57
68
|
return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
|
|
58
69
|
}
|
|
59
70
|
|
|
71
|
+
/** Gets a snapshot at the given block number. The TXE has no reorgs, so the fork hash is not verified. */
|
|
72
|
+
public getVerifiedSnapshot(blockNumber: number, _blockHash: BlockHash): Promise<MerkleTreeReadOperations> {
|
|
73
|
+
return Promise.resolve(this.getSnapshot(blockNumber));
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
/** Backups the db to the target path. */
|
|
61
77
|
public backupTo(dstPath: string, compact?: boolean): Promise<Record<Exclude<SnapshotDataKeys, 'archiver'>, string>> {
|
|
62
78
|
return this.nativeWorldStateService.backupTo(dstPath, compact);
|
|
@@ -70,8 +86,8 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
70
86
|
throw new Error('TXE Synchronizer does not implement "status"');
|
|
71
87
|
}
|
|
72
88
|
|
|
73
|
-
public stop(): Promise<void> {
|
|
74
|
-
|
|
89
|
+
public async stop(): Promise<void> {
|
|
90
|
+
await this.closeIpc();
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
public stopSync(): Promise<void> {
|
|
@@ -85,4 +101,9 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
85
101
|
public clear(): Promise<void> {
|
|
86
102
|
throw new Error('TXE Synchronizer does not implement "clear"');
|
|
87
103
|
}
|
|
104
|
+
|
|
105
|
+
/** Clean up IPC resources. */
|
|
106
|
+
public async closeIpc(): Promise<void> {
|
|
107
|
+
await this.avmSimulator?.[Symbol.asyncDispose]();
|
|
108
|
+
}
|
|
88
109
|
}
|