@aztec/end-to-end 0.87.6 → 1.0.0-nightly.20250604
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/e2e_epochs/epochs_test.d.ts +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +13 -2
- package/dest/e2e_p2p/p2p_network.d.ts +7 -17
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +17 -24
- package/dest/fixtures/setup_p2p_test.d.ts +3 -4
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +9 -9
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +8 -6
- package/dest/fixtures/utils.d.ts +4 -3
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +5 -4
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +19 -6
- package/package.json +35 -34
- package/src/e2e_epochs/epochs_test.ts +9 -3
- package/src/e2e_p2p/p2p_network.ts +33 -27
- package/src/fixtures/setup_p2p_test.ts +7 -11
- package/src/fixtures/snapshot_manager.ts +7 -4
- package/src/fixtures/utils.ts +12 -11
- package/src/shared/uniswap_l1_l2.ts +29 -13
|
@@ -51,7 +51,7 @@ export declare class EpochsTestContext {
|
|
|
51
51
|
/** Waits until the end of the proof submission window for a given epoch. */
|
|
52
52
|
waitUntilEndOfProofSubmissionWindow(epochNumber: number | bigint): Promise<void>;
|
|
53
53
|
/** Waits for the aztec node to sync to the target block number. */
|
|
54
|
-
waitForNodeToSync(blockNumber: number, type: 'finalised' | 'historic'): Promise<void>;
|
|
54
|
+
waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalised' | 'historic'): Promise<void>;
|
|
55
55
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
56
56
|
verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean): Promise<void>;
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAM,KAAK,MAAM,EAA8D,MAAM,iBAAiB,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAkB,KAAK,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAGxG,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,6BAA6B,CAAC;AAK1G,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG,OAAO,CAClC,IAAI,CACF,YAAY,EACV,iBAAiB,GACjB,4BAA4B,GAC5B,oBAAoB,GACpB,mBAAmB,GACnB,0BAA0B,GAC1B,+BAA+B,GAC/B,kBAAkB,GAClB,sBAAsB,GACtB,mBAAmB,CACtB,CACF,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAiB;IACrB,OAAO,EAAG,eAAe,CAAC;IAC1B,QAAQ,EAAG,UAAU,CAAC;IACtB,MAAM,EAAG,cAAc,CAAC;IACxB,SAAS,EAAG,iBAAiB,CAAC;IAC9B,MAAM,EAAG,MA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IAC7E,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAO/C,sDAAsD;IACzC,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAK;IAShE,iEAAiE;IACpD,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,SAAK;IAUjE,4EAA4E;IAC/D,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAO7E,mEAAmE;IACtD,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU;IAoB7F,0EAA0E;IAC7D,mBAAmB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO;CAUtF"}
|
|
@@ -166,8 +166,19 @@ export const ARCHIVER_POLL_INTERVAL = 50;
|
|
|
166
166
|
let synched = false;
|
|
167
167
|
while(!synched){
|
|
168
168
|
await sleep(waitTime);
|
|
169
|
-
const syncState = await
|
|
170
|
-
|
|
169
|
+
const [syncState, tips] = await Promise.all([
|
|
170
|
+
this.context.aztecNode.getWorldStateSyncStatus(),
|
|
171
|
+
await this.context.aztecNode.getL2Tips()
|
|
172
|
+
]);
|
|
173
|
+
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, {
|
|
174
|
+
blockNumber,
|
|
175
|
+
type,
|
|
176
|
+
syncState,
|
|
177
|
+
tips
|
|
178
|
+
});
|
|
179
|
+
if (type === 'proven') {
|
|
180
|
+
synched = tips.proven.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
|
|
181
|
+
} else if (type === 'finalised') {
|
|
171
182
|
synched = syncState.finalisedBlockNumber >= blockNumber;
|
|
172
183
|
} else {
|
|
173
184
|
synched = syncState.oldestHistoricBlockNumber >= blockNumber;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import type
|
|
3
|
+
import { type AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
4
|
+
import { type Operator } from '@aztec/ethereum';
|
|
4
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
6
|
import { type Logger } from '@aztec/foundation/log';
|
|
6
7
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
@@ -43,37 +44,26 @@ export declare class P2PNetworkTest {
|
|
|
43
44
|
ctx: SubsystemsContext;
|
|
44
45
|
attesterPrivateKeys: `0x${string}`[];
|
|
45
46
|
attesterPublicKeys: string[];
|
|
46
|
-
proposerPrivateKeys: `0x${string}`[];
|
|
47
47
|
peerIdPrivateKeys: string[];
|
|
48
|
-
validators:
|
|
49
|
-
attester: `0x${string}`;
|
|
50
|
-
proposer: `0x${string}`;
|
|
51
|
-
withdrawer: `0x${string}`;
|
|
52
|
-
amount: bigint;
|
|
53
|
-
}[];
|
|
48
|
+
validators: Operator[];
|
|
54
49
|
deployedAccounts: InitialAccountData[];
|
|
55
50
|
prefilledPublicData: PublicDataTreeLeaf[];
|
|
56
51
|
wallet?: AccountWalletWithSecretKey;
|
|
57
52
|
spamContract?: SpamContract;
|
|
58
53
|
bootstrapNode?: BootstrapNode;
|
|
59
|
-
constructor(testName: string, bootstrapNodeEnr: string, bootNodePort: number, numberOfNodes: number, initialValidatorConfig: AztecNodeConfig, metricsPort?: number | undefined);
|
|
60
|
-
static create({ testName, numberOfNodes, basePort, metricsPort, initialConfig, }: {
|
|
54
|
+
constructor(testName: string, bootstrapNodeEnr: string, bootNodePort: number, numberOfNodes: number, initialValidatorConfig: AztecNodeConfig, metricsPort?: number | undefined, startProverNode?: boolean);
|
|
55
|
+
static create({ testName, numberOfNodes, basePort, metricsPort, initialConfig, startProverNode, }: {
|
|
61
56
|
testName: string;
|
|
62
57
|
numberOfNodes: number;
|
|
63
58
|
basePort?: number;
|
|
64
59
|
metricsPort?: number;
|
|
65
60
|
initialConfig?: Partial<AztecNodeConfig>;
|
|
61
|
+
startProverNode?: boolean;
|
|
66
62
|
}): Promise<P2PNetworkTest>;
|
|
67
63
|
get fundedAccount(): InitialAccountData;
|
|
68
64
|
addBootstrapNode(): Promise<void>;
|
|
69
65
|
getValidators(): {
|
|
70
|
-
validators:
|
|
71
|
-
readonly attester: `0x${string}`;
|
|
72
|
-
readonly proposer: `0x${string}`;
|
|
73
|
-
readonly withdrawer: `0x${string}`;
|
|
74
|
-
readonly amount: bigint;
|
|
75
|
-
}[];
|
|
76
|
-
proposerEOAs: string[];
|
|
66
|
+
validators: Operator[];
|
|
77
67
|
};
|
|
78
68
|
applyBaseSnapshots(): Promise<void>;
|
|
79
69
|
setupAccount(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"p2p_network.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/p2p_network.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,KAAK,0BAA0B,EAAc,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAGL,KAAK,QAAQ,EAKd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA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QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;QACzC,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B;IAsBD,IAAI,aAAa,uBAKhB;IAEK,gBAAgB;IActB,aAAa;;;IAgBP,kBAAkB;IAkElB,YAAY;IAYZ,kBAAkB;IAoBlB,iBAAiB;IAgBjB,WAAW;;;;YAIH,YAAY;IAQpB,KAAK;IAaL,SAAS,CAAC,KAAK,EAAE,gBAAgB,EAAE;IAanC,QAAQ;CAKf"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
|
-
import {
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js';
|
|
3
|
+
import { L1TxUtils, RollupContract, deployL1Contract, getL1ContractsConfigEnvVars, l1Artifacts } from '@aztec/ethereum';
|
|
3
4
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
4
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import {
|
|
6
|
+
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
6
7
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
7
8
|
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
8
9
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
9
10
|
import getPort from 'get-port';
|
|
10
11
|
import { getContract } from 'viem';
|
|
11
12
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
12
|
-
import { ATTESTER_PRIVATE_KEYS_START_INDEX,
|
|
13
|
+
import { ATTESTER_PRIVATE_KEYS_START_INDEX, createValidatorConfig, generatePrivateKeys } from '../fixtures/setup_p2p_test.js';
|
|
13
14
|
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
14
15
|
import { getPrivateKeyFromIndex, getSponsoredFPCAddress } from '../fixtures/utils.js';
|
|
15
16
|
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
@@ -35,7 +36,6 @@ export class P2PNetworkTest {
|
|
|
35
36
|
ctx;
|
|
36
37
|
attesterPrivateKeys;
|
|
37
38
|
attesterPublicKeys;
|
|
38
|
-
proposerPrivateKeys;
|
|
39
39
|
peerIdPrivateKeys;
|
|
40
40
|
validators;
|
|
41
41
|
deployedAccounts;
|
|
@@ -45,14 +45,13 @@ export class P2PNetworkTest {
|
|
|
45
45
|
spamContract;
|
|
46
46
|
bootstrapNode;
|
|
47
47
|
constructor(testName, bootstrapNodeEnr, bootNodePort, numberOfNodes, initialValidatorConfig, // If set enable metrics collection
|
|
48
|
-
metricsPort){
|
|
48
|
+
metricsPort, startProverNode){
|
|
49
49
|
this.bootstrapNodeEnr = bootstrapNodeEnr;
|
|
50
50
|
this.bootNodePort = bootNodePort;
|
|
51
51
|
this.numberOfNodes = numberOfNodes;
|
|
52
52
|
this.metricsPort = metricsPort;
|
|
53
53
|
this.attesterPrivateKeys = [];
|
|
54
54
|
this.attesterPublicKeys = [];
|
|
55
|
-
this.proposerPrivateKeys = [];
|
|
56
55
|
this.peerIdPrivateKeys = [];
|
|
57
56
|
this.validators = [];
|
|
58
57
|
this.deployedAccounts = [];
|
|
@@ -61,7 +60,6 @@ export class P2PNetworkTest {
|
|
|
61
60
|
// Set up the base account and node private keys for the initial network deployment
|
|
62
61
|
this.baseAccountPrivateKey = `0x${getPrivateKeyFromIndex(1).toString('hex')}`;
|
|
63
62
|
this.baseAccount = privateKeyToAccount(this.baseAccountPrivateKey);
|
|
64
|
-
this.proposerPrivateKeys = generatePrivateKeys(PROPOSER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
65
63
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
66
64
|
this.attesterPublicKeys = this.attesterPrivateKeys.map((privateKey)=>privateKeyToAccount(privateKey).address);
|
|
67
65
|
this.snapshotManager = createSnapshotManager(`e2e_p2p_network/${testName}`, process.env.E2E_DATA_PATH, {
|
|
@@ -72,7 +70,8 @@ export class P2PNetworkTest {
|
|
|
72
70
|
aztecProofSubmissionWindow: initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
|
|
73
71
|
salt: 420,
|
|
74
72
|
metricsPort: metricsPort,
|
|
75
|
-
numberOfInitialFundedAccounts: 2
|
|
73
|
+
numberOfInitialFundedAccounts: 2,
|
|
74
|
+
startProverNode
|
|
76
75
|
}, {
|
|
77
76
|
...initialValidatorConfig,
|
|
78
77
|
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
@@ -82,12 +81,12 @@ export class P2PNetworkTest {
|
|
|
82
81
|
initialValidators: []
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
|
-
static async create({ testName, numberOfNodes, basePort, metricsPort, initialConfig }) {
|
|
84
|
+
static async create({ testName, numberOfNodes, basePort, metricsPort, initialConfig, startProverNode }) {
|
|
86
85
|
const port = basePort || await getPort();
|
|
87
86
|
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
|
|
88
87
|
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
|
|
89
88
|
const initialValidatorConfig = await createValidatorConfig(initialConfig ?? {}, bootstrapNodeEnr);
|
|
90
|
-
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfNodes, initialValidatorConfig, metricsPort);
|
|
89
|
+
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfNodes, initialValidatorConfig, metricsPort, startProverNode);
|
|
91
90
|
}
|
|
92
91
|
get fundedAccount() {
|
|
93
92
|
if (!this.deployedAccounts[0]) {
|
|
@@ -105,25 +104,16 @@ export class P2PNetworkTest {
|
|
|
105
104
|
}
|
|
106
105
|
getValidators() {
|
|
107
106
|
const validators = [];
|
|
108
|
-
const proposerEOAs = [];
|
|
109
107
|
for(let i = 0; i < this.numberOfNodes; i++){
|
|
110
108
|
const attester = privateKeyToAccount(this.attesterPrivateKeys[i]);
|
|
111
|
-
const proposerEOA = privateKeyToAccount(this.proposerPrivateKeys[i]);
|
|
112
|
-
proposerEOAs.push(proposerEOA.address);
|
|
113
|
-
const forwarder = getExpectedAddress(ForwarderAbi, ForwarderBytecode, [
|
|
114
|
-
proposerEOA.address
|
|
115
|
-
], proposerEOA.address).address;
|
|
116
109
|
validators.push({
|
|
117
|
-
attester: attester.address,
|
|
118
|
-
|
|
119
|
-
withdrawer: attester.address,
|
|
120
|
-
amount: l1ContractsConfig.minimumStake
|
|
110
|
+
attester: EthAddress.fromString(attester.address),
|
|
111
|
+
withdrawer: EthAddress.fromString(attester.address)
|
|
121
112
|
});
|
|
122
|
-
this.logger.info(`Adding attester ${attester.address}
|
|
113
|
+
this.logger.info(`Adding attester ${attester.address} as validator`);
|
|
123
114
|
}
|
|
124
115
|
return {
|
|
125
|
-
validators
|
|
126
|
-
proposerEOAs
|
|
116
|
+
validators
|
|
127
117
|
};
|
|
128
118
|
}
|
|
129
119
|
async applyBaseSnapshots() {
|
|
@@ -162,7 +152,10 @@ export class P2PNetworkTest {
|
|
|
162
152
|
this.validators = validators;
|
|
163
153
|
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
164
154
|
hash: await multiAdder.write.addValidators([
|
|
165
|
-
this.validators
|
|
155
|
+
this.validators.map((v)=>({
|
|
156
|
+
attester: v.attester.toString(),
|
|
157
|
+
withdrawer: v.withdrawer.toString()
|
|
158
|
+
}))
|
|
166
159
|
])
|
|
167
160
|
});
|
|
168
161
|
const timestamp = await cheatCodes.rollup.advanceToEpoch(2n);
|
|
@@ -7,8 +7,7 @@ import type { DateProvider } from '@aztec/foundation/timer';
|
|
|
7
7
|
import type { PXEService } from '@aztec/pxe/server';
|
|
8
8
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
9
9
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 1001;
|
|
10
|
+
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 2;
|
|
12
11
|
export interface NodeContext {
|
|
13
12
|
node: AztecNodeService;
|
|
14
13
|
pxeService: PXEService;
|
|
@@ -16,6 +15,6 @@ export interface NodeContext {
|
|
|
16
15
|
}
|
|
17
16
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
18
17
|
export declare function createNodes(config: AztecNodeConfig, dateProvider: DateProvider, bootstrapNodeEnr: string, numNodes: number, bootNodePort: number, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number): Promise<AztecNodeService[]>;
|
|
19
|
-
export declare function createNode(config: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined,
|
|
20
|
-
export declare function createValidatorConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number,
|
|
18
|
+
export declare function createNode(config: AztecNodeConfig, dateProvider: DateProvider, tcpPort: number, bootstrapNode: string | undefined, addressIndex: number, prefilledPublicData?: PublicDataTreeLeaf[], dataDirectory?: string, metricsPort?: number, loggerIdStorage?: AsyncLocalStorage<string>): Promise<AztecNodeService>;
|
|
19
|
+
export declare function createValidatorConfig(config: AztecNodeConfig, bootstrapNodeEnr?: string, port?: number, addressIndex?: number, dataDirectory?: string): Promise<AztecNodeConfig>;
|
|
21
20
|
//# sourceMappingURL=setup_p2p_test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_p2p_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_p2p_test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,E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AQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,EAC1C,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA4B7B;AAGD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,YAAY,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,EAC1C,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,MAAM,EACpB,eAAe,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,6BAQ5C;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,eAAe,EACvB,gBAAgB,CAAC,EAAE,MAAM,EACzB,IAAI,CAAC,EAAE,MAAM,EACb,YAAY,GAAE,MAAU,EACxB,aAAa,CAAC,EAAE,MAAM,4BAuBvB"}
|
|
@@ -9,8 +9,7 @@ import { getPrivateKeyFromIndex } from './utils.js';
|
|
|
9
9
|
import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
10
10
|
// Setup snapshots will create a node with index 0, and run extra bootstrap with
|
|
11
11
|
// index 1, so all of our loops here need to start from 2 to avoid running validators with the same key
|
|
12
|
-
export const
|
|
13
|
-
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 1001;
|
|
12
|
+
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 2;
|
|
14
13
|
export function generatePrivateKeys(startIndex, numberOfKeys) {
|
|
15
14
|
const privateKeys = [];
|
|
16
15
|
// Do not start from 0 as it is used during setup
|
|
@@ -36,9 +35,9 @@ export async function createNodes(config, dateProvider, bootstrapNodeEnr, numNod
|
|
|
36
35
|
return nodes;
|
|
37
36
|
}
|
|
38
37
|
// creates a P2P enabled instance of Aztec Node Service
|
|
39
|
-
export async function createNode(config, dateProvider, tcpPort, bootstrapNode,
|
|
38
|
+
export async function createNode(config, dateProvider, tcpPort, bootstrapNode, addressIndex, prefilledPublicData, dataDirectory, metricsPort, loggerIdStorage) {
|
|
40
39
|
const createNode = async ()=>{
|
|
41
|
-
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort,
|
|
40
|
+
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
42
41
|
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
43
42
|
return await AztecNodeService.createAndSync(validatorConfig, {
|
|
44
43
|
telemetry,
|
|
@@ -49,12 +48,13 @@ export async function createNode(config, dateProvider, tcpPort, bootstrapNode, a
|
|
|
49
48
|
};
|
|
50
49
|
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
|
|
51
50
|
}
|
|
52
|
-
export async function createValidatorConfig(config, bootstrapNodeEnr, port,
|
|
51
|
+
export async function createValidatorConfig(config, bootstrapNodeEnr, port, addressIndex = 1, dataDirectory) {
|
|
53
52
|
port = port ?? await getPort();
|
|
54
|
-
const attesterPrivateKey = `0x${getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX +
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const attesterPrivateKey = `0x${getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex).toString('hex')}`;
|
|
54
|
+
config.validatorPrivateKeys = [
|
|
55
|
+
attesterPrivateKey
|
|
56
|
+
];
|
|
57
|
+
config.publisherPrivateKey = attesterPrivateKey;
|
|
58
58
|
const nodeConfig = {
|
|
59
59
|
...config,
|
|
60
60
|
p2pIp: `127.0.0.1`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_manager.d.ts","sourceRoot":"","sources":["../../src/fixtures/snapshot_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,K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A4CnG;;;;OAIG;IACU,KAAK;IA0BlB;;OAEG;IACU,QAAQ;CAKtB;AAsVD;;;GAGG;AACH,eAAO,MAAM,cAAc,GACxB,kBAAkB,MAAM,EAAE,QAAQ,MAAM,EAAE,yBAAuB,MAC3D,gCAAgC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,qBAAqB,EAAE,kBAAkB,EAAE,CAAA;CAAE;;EAe/F,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,CAAC,eAAe,GAAG,YAAY,CAAC,EAAE,EACpD,eAAe,UAAQ,EACvB,SAAS,CAAC,EAAE,GAAG,GAAG,SAAS,iBAyB5B"}
|
|
@@ -245,14 +245,16 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
245
245
|
// Deploy our L1 contracts.
|
|
246
246
|
logger.verbose('Deploying L1 contracts...');
|
|
247
247
|
const hdAccount = mnemonicToAccount(MNEMONIC, {
|
|
248
|
-
|
|
248
|
+
addressIndex: 0
|
|
249
249
|
});
|
|
250
250
|
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
251
251
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
252
252
|
const validatorPrivKey = getPrivateKeyFromIndex(0);
|
|
253
253
|
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
254
254
|
aztecNodeConfig.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
|
|
255
|
-
aztecNodeConfig.
|
|
255
|
+
aztecNodeConfig.validatorPrivateKeys = [
|
|
256
|
+
`0x${validatorPrivKey.toString('hex')}`
|
|
257
|
+
];
|
|
256
258
|
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
257
259
|
if (opts.l1StartTime) {
|
|
258
260
|
await ethCheatCodes.warp(opts.l1StartTime);
|
|
@@ -293,7 +295,8 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
293
295
|
});
|
|
294
296
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
295
297
|
}
|
|
296
|
-
const
|
|
298
|
+
const dateProvider = new TestDateProvider();
|
|
299
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
297
300
|
await watcher.start();
|
|
298
301
|
const acvmConfig = await getACVMConfig(logger);
|
|
299
302
|
if (acvmConfig) {
|
|
@@ -317,7 +320,6 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
317
320
|
}, telemetry);
|
|
318
321
|
await blobSink.start();
|
|
319
322
|
logger.verbose('Creating and synching an aztec node...');
|
|
320
|
-
const dateProvider = new TestDateProvider();
|
|
321
323
|
const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, {
|
|
322
324
|
telemetry,
|
|
323
325
|
dateProvider
|
|
@@ -398,10 +400,10 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
398
400
|
}
|
|
399
401
|
logger.verbose('Creating ETH clients...');
|
|
400
402
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
401
|
-
const
|
|
403
|
+
const dateProvider = new TestDateProvider();
|
|
404
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls), aztecNodeConfig.l1Contracts.rollupAddress, l1Client, dateProvider);
|
|
402
405
|
await watcher.start();
|
|
403
406
|
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
404
|
-
const dateProvider = new TestDateProvider();
|
|
405
407
|
const blobSink = await createBlobSinkServer({
|
|
406
408
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
407
409
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
package/dest/fixtures/utils.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { type AztecNodeConfig } from '@aztec/aztec-node';
|
|
|
3
3
|
import { type AccountWalletWithSecretKey, type AztecAddress, type AztecNode, type ContractMethod, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
4
4
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
5
5
|
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
6
|
-
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType, ForwarderContract } from '@aztec/ethereum';
|
|
6
|
+
import { type DeployL1ContractsArgs, type DeployL1ContractsReturnType, ForwarderContract, type Operator } from '@aztec/ethereum';
|
|
7
7
|
import { startAnvil } from '@aztec/ethereum/test';
|
|
8
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
10
9
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
11
10
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
@@ -61,7 +60,9 @@ export type SetupOptions = {
|
|
|
61
60
|
/** Salt to use in L1 contract deployment */
|
|
62
61
|
salt?: number;
|
|
63
62
|
/** An initial set of validators */
|
|
64
|
-
initialValidators?:
|
|
63
|
+
initialValidators?: (Operator & {
|
|
64
|
+
privateKey: `0x${string}`;
|
|
65
|
+
})[];
|
|
65
66
|
/** Anvil Start time */
|
|
66
67
|
l1StartTime?: number;
|
|
67
68
|
/** The anvil time where we should at the earliest be seeing L2 blocks */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,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AChC,UAAU,EAAE,KAAK,MAAM,EAAE,EACzB,aAAa,EAAE,GAAG,8BAKnB"}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -192,6 +192,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
192
192
|
...getConfigEnvVars(),
|
|
193
193
|
...opts
|
|
194
194
|
};
|
|
195
|
+
// use initialValidators for the node config
|
|
196
|
+
config.validatorPrivateKeys = opts.initialValidators?.map((v)=>v.privateKey);
|
|
195
197
|
config.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
196
198
|
// For tests we only want proving enabled if specifically requested
|
|
197
199
|
config.realProofs = !!opts.realProofs;
|
|
@@ -248,8 +250,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
248
250
|
publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
249
251
|
config.publisherPrivateKey = `0x${publisherPrivKey.toString('hex')}`;
|
|
250
252
|
}
|
|
251
|
-
// Made as separate values such that keys can change, but for test they will be the same.
|
|
252
|
-
config.validatorPrivateKey = config.publisherPrivateKey;
|
|
253
253
|
if (PXE_URL) {
|
|
254
254
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
255
255
|
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
@@ -259,7 +259,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
259
259
|
const deployL1ContractsValues = opts.deployL1ContractsValues ?? await setupL1Contracts(config.l1RpcUrls, publisherHdAccount, logger, {
|
|
260
260
|
...opts,
|
|
261
261
|
genesisArchiveRoot,
|
|
262
|
-
feeJuicePortalInitialBalance: fundingNeeded
|
|
262
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
263
|
+
initialValidators: opts.initialValidators
|
|
263
264
|
}, chain);
|
|
264
265
|
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
265
266
|
if (opts.fundRewardDistributor) {
|
|
@@ -573,6 +574,6 @@ function createDelayedL1TxUtils(aztecNodeConfig, privateKey, logName) {
|
|
|
573
574
|
}
|
|
574
575
|
export async function createForwarderContract(aztecNodeConfig, privateKey, rollupAddress) {
|
|
575
576
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
576
|
-
const forwarderContract = await ForwarderContract.create(l1Client
|
|
577
|
+
const forwarderContract = await ForwarderContract.create(l1Client, createLogger('forwarder'), rollupAddress);
|
|
577
578
|
return forwarderContract;
|
|
578
579
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAsBzB,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,+CAA+C;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,wBAAwB;IACxB,WAAW,EAAE,aAAa,CAAC;IAC3B,0BAA0B;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,OAAO,CAAC,mBAAmB,CAAC,EACzC,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,gCAAkC,SA49BnC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { RollupContract, deployL1Contract, extractEvent } from '@aztec/ethereum'
|
|
|
3
3
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
4
4
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
5
5
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
6
|
+
import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
6
7
|
import { jest } from '@jest/globals';
|
|
7
8
|
import { getContract, parseEther, toFunctionSelector } from 'viem';
|
|
8
9
|
import { ensureAccountsPubliclyDeployed } from '../fixtures/utils.js';
|
|
@@ -163,8 +164,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
163
164
|
// 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
|
|
164
165
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
165
166
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(daiCrossChainHarness.tokenPortalAddress);
|
|
166
|
-
const
|
|
167
|
-
const
|
|
167
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, l2UniswapInteractionReceipt.blockNumber, swapPrivateLeaf);
|
|
168
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, l2UniswapInteractionReceipt.blockNumber, withdrawLeaf);
|
|
169
|
+
const swapPrivateL2MessageIndex = swapResult.l2MessageIndex;
|
|
170
|
+
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
171
|
+
const withdrawL2MessageIndex = withdrawResult.l2MessageIndex;
|
|
172
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
168
173
|
const withdrawMessageMetadata = {
|
|
169
174
|
_l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber),
|
|
170
175
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
@@ -551,8 +556,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
551
556
|
new Fr(l1Client.chain.id),
|
|
552
557
|
withdrawContent
|
|
553
558
|
]);
|
|
554
|
-
const
|
|
555
|
-
const
|
|
559
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, swapPrivateLeaf);
|
|
560
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, withdrawLeaf);
|
|
561
|
+
const swapPrivateL2MessageIndex = swapResult.l2MessageIndex;
|
|
562
|
+
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
563
|
+
const withdrawL2MessageIndex = withdrawResult.l2MessageIndex;
|
|
564
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
556
565
|
const withdrawMessageMetadata = {
|
|
557
566
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
|
|
558
567
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
@@ -631,8 +640,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
631
640
|
new Fr(l1Client.chain.id),
|
|
632
641
|
withdrawContent
|
|
633
642
|
]);
|
|
634
|
-
const
|
|
635
|
-
const
|
|
643
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, swapPublicLeaf);
|
|
644
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber, withdrawLeaf);
|
|
645
|
+
const swapPublicL2MessageIndex = swapResult.l2MessageIndex;
|
|
646
|
+
const swapPublicSiblingPath = swapResult.siblingPath;
|
|
647
|
+
const withdrawL2MessageIndex = withdrawResult.l2MessageIndex;
|
|
648
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
636
649
|
const withdrawMessageMetadata = {
|
|
637
650
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber),
|
|
638
651
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-nightly.20250604",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,39 +25,40 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "0.
|
|
29
|
-
"@aztec/archiver": "0.
|
|
30
|
-
"@aztec/aztec": "0.
|
|
31
|
-
"@aztec/aztec-node": "0.
|
|
32
|
-
"@aztec/aztec.js": "0.
|
|
33
|
-
"@aztec/bb-prover": "0.
|
|
34
|
-
"@aztec/blob-lib": "0.
|
|
35
|
-
"@aztec/blob-sink": "0.
|
|
36
|
-
"@aztec/bot": "0.
|
|
37
|
-
"@aztec/cli": "0.
|
|
38
|
-
"@aztec/constants": "0.
|
|
39
|
-
"@aztec/entrypoints": "0.
|
|
40
|
-
"@aztec/epoch-cache": "0.
|
|
41
|
-
"@aztec/ethereum": "0.
|
|
42
|
-
"@aztec/foundation": "0.
|
|
43
|
-
"@aztec/kv-store": "0.
|
|
44
|
-
"@aztec/l1-artifacts": "0.
|
|
45
|
-
"@aztec/merkle-tree": "0.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.
|
|
47
|
-
"@aztec/noir-noirc_abi": "0.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
49
|
-
"@aztec/noir-test-contracts.js": "0.
|
|
50
|
-
"@aztec/p2p": "0.
|
|
51
|
-
"@aztec/protocol-contracts": "0.
|
|
52
|
-
"@aztec/prover-client": "0.
|
|
53
|
-
"@aztec/prover-node": "0.
|
|
54
|
-
"@aztec/pxe": "0.
|
|
55
|
-
"@aztec/sequencer-client": "0.
|
|
56
|
-
"@aztec/simulator": "0.
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
59
|
-
"@aztec/
|
|
60
|
-
"@aztec/
|
|
28
|
+
"@aztec/accounts": "1.0.0-nightly.20250604",
|
|
29
|
+
"@aztec/archiver": "1.0.0-nightly.20250604",
|
|
30
|
+
"@aztec/aztec": "1.0.0-nightly.20250604",
|
|
31
|
+
"@aztec/aztec-node": "1.0.0-nightly.20250604",
|
|
32
|
+
"@aztec/aztec.js": "1.0.0-nightly.20250604",
|
|
33
|
+
"@aztec/bb-prover": "1.0.0-nightly.20250604",
|
|
34
|
+
"@aztec/blob-lib": "1.0.0-nightly.20250604",
|
|
35
|
+
"@aztec/blob-sink": "1.0.0-nightly.20250604",
|
|
36
|
+
"@aztec/bot": "1.0.0-nightly.20250604",
|
|
37
|
+
"@aztec/cli": "1.0.0-nightly.20250604",
|
|
38
|
+
"@aztec/constants": "1.0.0-nightly.20250604",
|
|
39
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250604",
|
|
40
|
+
"@aztec/epoch-cache": "1.0.0-nightly.20250604",
|
|
41
|
+
"@aztec/ethereum": "1.0.0-nightly.20250604",
|
|
42
|
+
"@aztec/foundation": "1.0.0-nightly.20250604",
|
|
43
|
+
"@aztec/kv-store": "1.0.0-nightly.20250604",
|
|
44
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250604",
|
|
45
|
+
"@aztec/merkle-tree": "1.0.0-nightly.20250604",
|
|
46
|
+
"@aztec/noir-contracts.js": "1.0.0-nightly.20250604",
|
|
47
|
+
"@aztec/noir-noirc_abi": "1.0.0-nightly.20250604",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.20250604",
|
|
49
|
+
"@aztec/noir-test-contracts.js": "1.0.0-nightly.20250604",
|
|
50
|
+
"@aztec/p2p": "1.0.0-nightly.20250604",
|
|
51
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250604",
|
|
52
|
+
"@aztec/prover-client": "1.0.0-nightly.20250604",
|
|
53
|
+
"@aztec/prover-node": "1.0.0-nightly.20250604",
|
|
54
|
+
"@aztec/pxe": "1.0.0-nightly.20250604",
|
|
55
|
+
"@aztec/sequencer-client": "1.0.0-nightly.20250604",
|
|
56
|
+
"@aztec/simulator": "1.0.0-nightly.20250604",
|
|
57
|
+
"@aztec/slasher": "1.0.0-nightly.20250604",
|
|
58
|
+
"@aztec/stdlib": "1.0.0-nightly.20250604",
|
|
59
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250604",
|
|
60
|
+
"@aztec/validator-client": "1.0.0-nightly.20250604",
|
|
61
|
+
"@aztec/world-state": "1.0.0-nightly.20250604",
|
|
61
62
|
"@iarna/toml": "^2.2.5",
|
|
62
63
|
"@jest/globals": "^29.5.0",
|
|
63
64
|
"@noble/curves": "^1.0.0",
|
|
@@ -232,13 +232,19 @@ export class EpochsTestContext {
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/** Waits for the aztec node to sync to the target block number. */
|
|
235
|
-
public async waitForNodeToSync(blockNumber: number, type: 'finalised' | 'historic') {
|
|
235
|
+
public async waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalised' | 'historic') {
|
|
236
236
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
237
237
|
let synched = false;
|
|
238
238
|
while (!synched) {
|
|
239
239
|
await sleep(waitTime);
|
|
240
|
-
const syncState = await
|
|
241
|
-
|
|
240
|
+
const [syncState, tips] = await Promise.all([
|
|
241
|
+
this.context.aztecNode.getWorldStateSyncStatus(),
|
|
242
|
+
await this.context.aztecNode.getL2Tips(),
|
|
243
|
+
]);
|
|
244
|
+
this.logger.info(`Wait for node synch ${blockNumber} ${type}`, { blockNumber, type, syncState, tips });
|
|
245
|
+
if (type === 'proven') {
|
|
246
|
+
synched = tips.proven.number >= blockNumber && syncState.latestBlockNumber >= blockNumber;
|
|
247
|
+
} else if (type === 'finalised') {
|
|
242
248
|
synched = syncState.finalisedBlockNumber >= blockNumber;
|
|
243
249
|
} else {
|
|
244
250
|
synched = syncState.oldestHistoricBlockNumber >= blockNumber;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
-
import type
|
|
4
|
+
import { type AccountWalletWithSecretKey, EthAddress } from '@aztec/aztec.js';
|
|
5
5
|
import {
|
|
6
6
|
type ExtendedViemWalletClient,
|
|
7
7
|
L1TxUtils,
|
|
8
|
+
type Operator,
|
|
8
9
|
RollupContract,
|
|
9
10
|
deployL1Contract,
|
|
10
|
-
getExpectedAddress,
|
|
11
11
|
getL1ContractsConfigEnvVars,
|
|
12
12
|
l1Artifacts,
|
|
13
13
|
} from '@aztec/ethereum';
|
|
14
14
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
15
15
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
16
|
-
import {
|
|
16
|
+
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
17
17
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
18
18
|
import type { BootstrapNode } from '@aztec/p2p/bootstrap';
|
|
19
19
|
import { createBootstrapNodeFromPrivateKey, getBootstrapNodeEnr } from '@aztec/p2p/test-helpers';
|
|
@@ -26,7 +26,6 @@ import { privateKeyToAccount } from 'viem/accounts';
|
|
|
26
26
|
|
|
27
27
|
import {
|
|
28
28
|
ATTESTER_PRIVATE_KEYS_START_INDEX,
|
|
29
|
-
PROPOSER_PRIVATE_KEYS_START_INDEX,
|
|
30
29
|
createValidatorConfig,
|
|
31
30
|
generatePrivateKeys,
|
|
32
31
|
} from '../fixtures/setup_p2p_test.js';
|
|
@@ -61,10 +60,8 @@ export class P2PNetworkTest {
|
|
|
61
60
|
public ctx!: SubsystemsContext;
|
|
62
61
|
public attesterPrivateKeys: `0x${string}`[] = [];
|
|
63
62
|
public attesterPublicKeys: string[] = [];
|
|
64
|
-
public proposerPrivateKeys: `0x${string}`[] = [];
|
|
65
63
|
public peerIdPrivateKeys: string[] = [];
|
|
66
|
-
public validators:
|
|
67
|
-
[];
|
|
64
|
+
public validators: Operator[] = [];
|
|
68
65
|
|
|
69
66
|
public deployedAccounts: InitialAccountData[] = [];
|
|
70
67
|
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
@@ -82,13 +79,13 @@ export class P2PNetworkTest {
|
|
|
82
79
|
initialValidatorConfig: AztecNodeConfig,
|
|
83
80
|
// If set enable metrics collection
|
|
84
81
|
private metricsPort?: number,
|
|
82
|
+
startProverNode?: boolean,
|
|
85
83
|
) {
|
|
86
84
|
this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
|
|
87
85
|
|
|
88
86
|
// Set up the base account and node private keys for the initial network deployment
|
|
89
87
|
this.baseAccountPrivateKey = `0x${getPrivateKeyFromIndex(1)!.toString('hex')}`;
|
|
90
88
|
this.baseAccount = privateKeyToAccount(this.baseAccountPrivateKey);
|
|
91
|
-
this.proposerPrivateKeys = generatePrivateKeys(PROPOSER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
92
89
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
93
90
|
this.attesterPublicKeys = this.attesterPrivateKeys.map(privateKey => privateKeyToAccount(privateKey).address);
|
|
94
91
|
|
|
@@ -105,6 +102,7 @@ export class P2PNetworkTest {
|
|
|
105
102
|
salt: 420,
|
|
106
103
|
metricsPort: metricsPort,
|
|
107
104
|
numberOfInitialFundedAccounts: 2,
|
|
105
|
+
startProverNode,
|
|
108
106
|
},
|
|
109
107
|
{
|
|
110
108
|
...initialValidatorConfig,
|
|
@@ -124,12 +122,14 @@ export class P2PNetworkTest {
|
|
|
124
122
|
basePort,
|
|
125
123
|
metricsPort,
|
|
126
124
|
initialConfig,
|
|
125
|
+
startProverNode,
|
|
127
126
|
}: {
|
|
128
127
|
testName: string;
|
|
129
128
|
numberOfNodes: number;
|
|
130
129
|
basePort?: number;
|
|
131
130
|
metricsPort?: number;
|
|
132
131
|
initialConfig?: Partial<AztecNodeConfig>;
|
|
132
|
+
startProverNode?: boolean;
|
|
133
133
|
}) {
|
|
134
134
|
const port = basePort || (await getPort());
|
|
135
135
|
|
|
@@ -141,7 +141,15 @@ export class P2PNetworkTest {
|
|
|
141
141
|
bootstrapNodeEnr,
|
|
142
142
|
);
|
|
143
143
|
|
|
144
|
-
return new P2PNetworkTest(
|
|
144
|
+
return new P2PNetworkTest(
|
|
145
|
+
testName,
|
|
146
|
+
bootstrapNodeEnr,
|
|
147
|
+
port,
|
|
148
|
+
numberOfNodes,
|
|
149
|
+
initialValidatorConfig,
|
|
150
|
+
metricsPort,
|
|
151
|
+
startProverNode,
|
|
152
|
+
);
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
get fundedAccount() {
|
|
@@ -166,29 +174,19 @@ export class P2PNetworkTest {
|
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
getValidators() {
|
|
169
|
-
const validators = [];
|
|
170
|
-
const proposerEOAs = [];
|
|
177
|
+
const validators: Operator[] = [];
|
|
171
178
|
|
|
172
179
|
for (let i = 0; i < this.numberOfNodes; i++) {
|
|
173
180
|
const attester = privateKeyToAccount(this.attesterPrivateKeys[i]!);
|
|
174
|
-
|
|
175
|
-
proposerEOAs.push(proposerEOA.address);
|
|
176
|
-
const forwarder = getExpectedAddress(
|
|
177
|
-
ForwarderAbi,
|
|
178
|
-
ForwarderBytecode,
|
|
179
|
-
[proposerEOA.address],
|
|
180
|
-
proposerEOA.address,
|
|
181
|
-
).address;
|
|
181
|
+
|
|
182
182
|
validators.push({
|
|
183
|
-
attester: attester.address,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
amount: l1ContractsConfig.minimumStake,
|
|
187
|
-
} as const);
|
|
183
|
+
attester: EthAddress.fromString(attester.address),
|
|
184
|
+
withdrawer: EthAddress.fromString(attester.address),
|
|
185
|
+
});
|
|
188
186
|
|
|
189
|
-
this.logger.info(`Adding attester ${attester.address}
|
|
187
|
+
this.logger.info(`Adding attester ${attester.address} as validator`);
|
|
190
188
|
}
|
|
191
|
-
return { validators
|
|
189
|
+
return { validators };
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
async applyBaseSnapshots() {
|
|
@@ -234,7 +232,15 @@ export class P2PNetworkTest {
|
|
|
234
232
|
this.validators = validators;
|
|
235
233
|
|
|
236
234
|
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
237
|
-
hash: await multiAdder.write.addValidators([
|
|
235
|
+
hash: await multiAdder.write.addValidators([
|
|
236
|
+
this.validators.map(
|
|
237
|
+
v =>
|
|
238
|
+
({
|
|
239
|
+
attester: v.attester.toString() as `0x${string}`,
|
|
240
|
+
withdrawer: v.withdrawer.toString() as `0x${string}`,
|
|
241
|
+
}) as const,
|
|
242
|
+
),
|
|
243
|
+
]),
|
|
238
244
|
});
|
|
239
245
|
|
|
240
246
|
const timestamp = await cheatCodes.rollup.advanceToEpoch(2n);
|
|
@@ -17,8 +17,7 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
17
17
|
|
|
18
18
|
// Setup snapshots will create a node with index 0, and run extra bootstrap with
|
|
19
19
|
// index 1, so all of our loops here need to start from 2 to avoid running validators with the same key
|
|
20
|
-
export const
|
|
21
|
-
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 1001;
|
|
20
|
+
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 2;
|
|
22
21
|
|
|
23
22
|
export interface NodeContext {
|
|
24
23
|
node: AztecNodeService;
|
|
@@ -80,14 +79,14 @@ export async function createNode(
|
|
|
80
79
|
dateProvider: DateProvider,
|
|
81
80
|
tcpPort: number,
|
|
82
81
|
bootstrapNode: string | undefined,
|
|
83
|
-
|
|
82
|
+
addressIndex: number,
|
|
84
83
|
prefilledPublicData?: PublicDataTreeLeaf[],
|
|
85
84
|
dataDirectory?: string,
|
|
86
85
|
metricsPort?: number,
|
|
87
86
|
loggerIdStorage?: AsyncLocalStorage<string>,
|
|
88
87
|
) {
|
|
89
88
|
const createNode = async () => {
|
|
90
|
-
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort,
|
|
89
|
+
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
|
|
91
90
|
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
|
|
92
91
|
return await AztecNodeService.createAndSync(validatorConfig, { telemetry, dateProvider }, { prefilledPublicData });
|
|
93
92
|
};
|
|
@@ -98,20 +97,17 @@ export async function createValidatorConfig(
|
|
|
98
97
|
config: AztecNodeConfig,
|
|
99
98
|
bootstrapNodeEnr?: string,
|
|
100
99
|
port?: number,
|
|
101
|
-
|
|
100
|
+
addressIndex: number = 1,
|
|
102
101
|
dataDirectory?: string,
|
|
103
102
|
) {
|
|
104
103
|
port = port ?? (await getPort());
|
|
105
104
|
|
|
106
105
|
const attesterPrivateKey: `0x${string}` = `0x${getPrivateKeyFromIndex(
|
|
107
|
-
ATTESTER_PRIVATE_KEYS_START_INDEX +
|
|
108
|
-
)!.toString('hex')}`;
|
|
109
|
-
const proposerPrivateKey: `0x${string}` = `0x${getPrivateKeyFromIndex(
|
|
110
|
-
PROPOSER_PRIVATE_KEYS_START_INDEX + accountIndex,
|
|
106
|
+
ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex,
|
|
111
107
|
)!.toString('hex')}`;
|
|
112
108
|
|
|
113
|
-
config.
|
|
114
|
-
config.publisherPrivateKey =
|
|
109
|
+
config.validatorPrivateKeys = [attesterPrivateKey];
|
|
110
|
+
config.publisherPrivateKey = attesterPrivateKey;
|
|
115
111
|
|
|
116
112
|
const nodeConfig: AztecNodeConfig = {
|
|
117
113
|
...config,
|
|
@@ -330,7 +330,7 @@ async function setupFromFresh(
|
|
|
330
330
|
|
|
331
331
|
// Deploy our L1 contracts.
|
|
332
332
|
logger.verbose('Deploying L1 contracts...');
|
|
333
|
-
const hdAccount = mnemonicToAccount(MNEMONIC, {
|
|
333
|
+
const hdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
|
|
334
334
|
const publisherPrivKeyRaw = hdAccount.getHdKey().privateKey;
|
|
335
335
|
const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
|
|
336
336
|
|
|
@@ -338,7 +338,7 @@ async function setupFromFresh(
|
|
|
338
338
|
const proverNodePrivateKey = getPrivateKeyFromIndex(0);
|
|
339
339
|
|
|
340
340
|
aztecNodeConfig.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`;
|
|
341
|
-
aztecNodeConfig.
|
|
341
|
+
aztecNodeConfig.validatorPrivateKeys = [`0x${validatorPrivKey!.toString('hex')}`];
|
|
342
342
|
|
|
343
343
|
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls);
|
|
344
344
|
|
|
@@ -387,10 +387,13 @@ async function setupFromFresh(
|
|
|
387
387
|
logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
const dateProvider = new TestDateProvider();
|
|
391
|
+
|
|
390
392
|
const watcher = new AnvilTestWatcher(
|
|
391
393
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
392
394
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
393
395
|
deployL1ContractsValues.l1Client,
|
|
396
|
+
dateProvider,
|
|
394
397
|
);
|
|
395
398
|
await watcher.start();
|
|
396
399
|
|
|
@@ -423,7 +426,6 @@ async function setupFromFresh(
|
|
|
423
426
|
await blobSink.start();
|
|
424
427
|
|
|
425
428
|
logger.verbose('Creating and synching an aztec node...');
|
|
426
|
-
const dateProvider = new TestDateProvider();
|
|
427
429
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
428
430
|
aztecNodeConfig,
|
|
429
431
|
{ telemetry, dateProvider },
|
|
@@ -523,15 +525,16 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
523
525
|
logger.verbose('Creating ETH clients...');
|
|
524
526
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
525
527
|
|
|
528
|
+
const dateProvider = new TestDateProvider();
|
|
526
529
|
const watcher = new AnvilTestWatcher(
|
|
527
530
|
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
528
531
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
529
532
|
l1Client,
|
|
533
|
+
dateProvider,
|
|
530
534
|
);
|
|
531
535
|
await watcher.start();
|
|
532
536
|
|
|
533
537
|
const telemetry = initTelemetryClient(getTelemetryConfig());
|
|
534
|
-
const dateProvider = new TestDateProvider();
|
|
535
538
|
const blobSink = await createBlobSinkServer(
|
|
536
539
|
{
|
|
537
540
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
type DeployL1ContractsReturnType,
|
|
34
34
|
ForwarderContract,
|
|
35
35
|
NULL_KEY,
|
|
36
|
+
type Operator,
|
|
36
37
|
createExtendedL1Client,
|
|
37
38
|
deployL1Contracts,
|
|
38
39
|
getL1ContractsConfigEnvVars,
|
|
@@ -280,7 +281,7 @@ export type SetupOptions = {
|
|
|
280
281
|
/** Salt to use in L1 contract deployment */
|
|
281
282
|
salt?: number;
|
|
282
283
|
/** An initial set of validators */
|
|
283
|
-
initialValidators?:
|
|
284
|
+
initialValidators?: (Operator & { privateKey: `0x${string}` })[];
|
|
284
285
|
/** Anvil Start time */
|
|
285
286
|
l1StartTime?: number;
|
|
286
287
|
/** The anvil time where we should at the earliest be seeing L2 blocks */
|
|
@@ -352,6 +353,9 @@ export async function setup(
|
|
|
352
353
|
let anvil: Anvil | undefined;
|
|
353
354
|
try {
|
|
354
355
|
const config = { ...getConfigEnvVars(), ...opts };
|
|
356
|
+
// use initialValidators for the node config
|
|
357
|
+
config.validatorPrivateKeys = opts.initialValidators?.map(v => v.privateKey);
|
|
358
|
+
|
|
355
359
|
config.peerCheckIntervalMS = TEST_PEER_CHECK_INTERVAL_MS;
|
|
356
360
|
// For tests we only want proving enabled if specifically requested
|
|
357
361
|
config.realProofs = !!opts.realProofs;
|
|
@@ -413,9 +417,6 @@ export async function setup(
|
|
|
413
417
|
config.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`;
|
|
414
418
|
}
|
|
415
419
|
|
|
416
|
-
// Made as separate values such that keys can change, but for test they will be the same.
|
|
417
|
-
config.validatorPrivateKey = config.publisherPrivateKey;
|
|
418
|
-
|
|
419
420
|
if (PXE_URL) {
|
|
420
421
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
421
422
|
return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
|
|
@@ -436,7 +437,12 @@ export async function setup(
|
|
|
436
437
|
config.l1RpcUrls,
|
|
437
438
|
publisherHdAccount!,
|
|
438
439
|
logger,
|
|
439
|
-
{
|
|
440
|
+
{
|
|
441
|
+
...opts,
|
|
442
|
+
genesisArchiveRoot,
|
|
443
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
444
|
+
initialValidators: opts.initialValidators,
|
|
445
|
+
},
|
|
440
446
|
chain,
|
|
441
447
|
));
|
|
442
448
|
|
|
@@ -836,11 +842,6 @@ export async function createForwarderContract(
|
|
|
836
842
|
rollupAddress: Hex,
|
|
837
843
|
) {
|
|
838
844
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
839
|
-
const forwarderContract = await ForwarderContract.create(
|
|
840
|
-
l1Client.account.address,
|
|
841
|
-
l1Client,
|
|
842
|
-
createLogger('forwarder'),
|
|
843
|
-
rollupAddress,
|
|
844
|
-
);
|
|
845
|
+
const forwarderContract = await ForwarderContract.create(l1Client, createLogger('forwarder'), rollupAddress);
|
|
845
846
|
return forwarderContract;
|
|
846
847
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
21
21
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
22
22
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
23
|
+
import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
23
24
|
|
|
24
25
|
import { jest } from '@jest/globals';
|
|
25
26
|
import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
|
|
@@ -277,16 +278,23 @@ export const uniswapL1L2TestSuite = (
|
|
|
277
278
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
|
|
278
279
|
daiCrossChainHarness.tokenPortalAddress,
|
|
279
280
|
);
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
const swapResult = await computeL2ToL1MembershipWitness(
|
|
282
|
+
aztecNode,
|
|
282
283
|
l2UniswapInteractionReceipt.blockNumber!,
|
|
283
284
|
swapPrivateLeaf,
|
|
284
285
|
);
|
|
285
|
-
const
|
|
286
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(
|
|
287
|
+
aztecNode,
|
|
286
288
|
l2UniswapInteractionReceipt.blockNumber!,
|
|
287
289
|
withdrawLeaf,
|
|
288
290
|
);
|
|
289
291
|
|
|
292
|
+
const swapPrivateL2MessageIndex = swapResult!.l2MessageIndex;
|
|
293
|
+
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
294
|
+
|
|
295
|
+
const withdrawL2MessageIndex = withdrawResult!.l2MessageIndex;
|
|
296
|
+
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
297
|
+
|
|
290
298
|
const withdrawMessageMetadata = {
|
|
291
299
|
_l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
|
|
292
300
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
@@ -852,15 +860,19 @@ export const uniswapL1L2TestSuite = (
|
|
|
852
860
|
withdrawContent,
|
|
853
861
|
]);
|
|
854
862
|
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
);
|
|
859
|
-
const [withdrawL2MessageIndex, withdrawSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(
|
|
863
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPrivateLeaf);
|
|
864
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(
|
|
865
|
+
aztecNode,
|
|
860
866
|
withdrawReceipt.blockNumber!,
|
|
861
867
|
withdrawLeaf,
|
|
862
868
|
);
|
|
863
869
|
|
|
870
|
+
const swapPrivateL2MessageIndex = swapResult!.l2MessageIndex;
|
|
871
|
+
const swapPrivateSiblingPath = swapResult!.siblingPath;
|
|
872
|
+
|
|
873
|
+
const withdrawL2MessageIndex = withdrawResult!.l2MessageIndex;
|
|
874
|
+
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
875
|
+
|
|
864
876
|
const withdrawMessageMetadata = {
|
|
865
877
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
866
878
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|
|
@@ -982,15 +994,19 @@ export const uniswapL1L2TestSuite = (
|
|
|
982
994
|
withdrawContent,
|
|
983
995
|
]);
|
|
984
996
|
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
);
|
|
989
|
-
const [withdrawL2MessageIndex, withdrawSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(
|
|
997
|
+
const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPublicLeaf);
|
|
998
|
+
const withdrawResult = await computeL2ToL1MembershipWitness(
|
|
999
|
+
aztecNode,
|
|
990
1000
|
withdrawReceipt.blockNumber!,
|
|
991
1001
|
withdrawLeaf,
|
|
992
1002
|
);
|
|
993
1003
|
|
|
1004
|
+
const swapPublicL2MessageIndex = swapResult!.l2MessageIndex;
|
|
1005
|
+
const swapPublicSiblingPath = swapResult!.siblingPath;
|
|
1006
|
+
|
|
1007
|
+
const withdrawL2MessageIndex = withdrawResult!.l2MessageIndex;
|
|
1008
|
+
const withdrawSiblingPath = withdrawResult!.siblingPath;
|
|
1009
|
+
|
|
994
1010
|
const withdrawMessageMetadata = {
|
|
995
1011
|
_l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
|
|
996
1012
|
_leafIndex: BigInt(withdrawL2MessageIndex),
|