@aztec/end-to-end 0.84.0 → 0.85.0
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/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +3 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +3 -3
- package/dest/e2e_epochs/epochs_test.d.ts +2 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +10 -5
- package/dest/e2e_p2p/p2p_network.d.ts +235 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +32 -18
- package/dest/e2e_p2p/shared.d.ts +7 -1
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +30 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +3 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +1 -1
- package/dest/fixtures/snapshot_manager.js +2 -2
- package/dest/fixtures/utils.js +1 -1
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +29 -28
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +6 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +2 -1
- package/package.json +36 -39
- package/src/bench/utils.ts +3 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +4 -4
- package/src/e2e_epochs/epochs_test.ts +13 -5
- package/src/e2e_p2p/p2p_network.ts +39 -26
- package/src/e2e_p2p/shared.ts +33 -7
- package/src/e2e_token_contract/token_contract_test.ts +4 -4
- package/src/fixtures/fixtures.ts +1 -1
- package/src/fixtures/snapshot_manager.ts +2 -2
- package/src/fixtures/utils.ts +1 -1
- package/src/guides/up_quick_start.sh +1 -0
- package/src/shared/capture_private_execution_steps.ts +25 -28
- package/src/shared/cross_chain_test_harness.ts +4 -2
- package/src/spartan/setup_test_wallets.ts +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { createLogger } from '@aztec/aztec.js';
|
|
3
|
-
import {
|
|
3
|
+
import { InvalidAccountContract } from '@aztec/noir-contracts.js/InvalidAccount';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
import { jest } from '@jest/globals';
|
|
6
6
|
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
@@ -46,7 +46,7 @@ export class TokenContractTest {
|
|
|
46
46
|
const asset = await TokenContract.deploy(this.wallets[0], this.accounts[0], TokenContractTest.TOKEN_NAME, TokenContractTest.TOKEN_SYMBOL, TokenContractTest.TOKEN_DECIMALS).send().deployed();
|
|
47
47
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
48
48
|
this.logger.verbose(`Deploying bad account...`);
|
|
49
|
-
this.badAccount = await
|
|
49
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallets[0]).send().deployed();
|
|
50
50
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
51
51
|
return {
|
|
52
52
|
tokenContractAddress: asset.address,
|
|
@@ -57,7 +57,7 @@ export class TokenContractTest {
|
|
|
57
57
|
this.asset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
|
|
58
58
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
59
59
|
this.tokenSim = new TokenSimulator(this.asset, this.wallets[0], this.logger, this.accounts.map((a)=>a.address));
|
|
60
|
-
this.badAccount = await
|
|
60
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
|
|
61
61
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
62
62
|
expect(await this.asset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
|
|
63
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":";;AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,QAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,QAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,uEAAuE,CAAC;AACzG,eAAO,MAAM,mBAAmB,kEAAkE,CAAC;AACnG,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":";;AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,QAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,QAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,uEAAuE,CAAC;AACzG,eAAO,MAAM,mBAAmB,kEAAkE,CAAC;AACnG,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AACvE,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAC+B,CAAC;AACjF,eAAO,MAAM,8BAA8B,QAAkE,CAAC;AAE9G,eAAO,MAAM,sBAAsB,SAAS,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
|
|
|
14
14
|
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
|
|
15
15
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
16
16
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
17
|
-
export const DUPLICATE_NULLIFIER_ERROR = /dropped|
|
|
17
|
+
export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
|
|
18
18
|
export const NO_L1_TO_L2_MSG_ERROR = /No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
|
|
19
19
|
export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
|
|
20
20
|
export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
|
|
@@ -311,7 +311,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
311
311
|
const blobSink = await createBlobSinkServer({
|
|
312
312
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
313
313
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
314
|
-
|
|
314
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
315
315
|
port: blobSinkPort,
|
|
316
316
|
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
317
317
|
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
|
|
@@ -404,7 +404,7 @@ export function createSnapshotManager(testName, dataPath, config = {}, deployL1C
|
|
|
404
404
|
const blobSink = await createBlobSinkServer({
|
|
405
405
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
406
406
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
407
|
-
|
|
407
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
408
408
|
port: blobSinkPort,
|
|
409
409
|
dataDirectory: statePath,
|
|
410
410
|
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -300,7 +300,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
300
300
|
const blobSink = await createBlobSinkServer({
|
|
301
301
|
l1ChainId: config.l1ChainId,
|
|
302
302
|
l1RpcUrls: config.l1RpcUrls,
|
|
303
|
-
|
|
303
|
+
l1Contracts: config.l1Contracts,
|
|
304
304
|
port: blobSinkPort,
|
|
305
305
|
dataDirectory: config.dataDirectory,
|
|
306
306
|
dataStoreMapSizeKB: config.dataStoreMapSizeKB
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture_private_execution_steps.d.ts","sourceRoot":"","sources":["../../src/shared/capture_private_execution_steps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,2BAA2B,EAC3B,YAAY,EACZ,aAAa,EACb,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"capture_private_execution_steps.d.ts","sourceRoot":"","sources":["../../src/shared/capture_private_execution_steps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EACV,2BAA2B,EAC3B,YAAY,EACZ,aAAa,EACb,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AA0BnC,wBAAsB,oCAAoC,CACxD,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,2BAA2B,GAAG,YAAY,EACvD,IAAI,CAAC,EAAE,IAAI,CAAC,oBAAoB,GAAG,aAAa,EAAE,aAAa,CAAC,EAChE,aAAa,CAAC,EAAE,MAAM,iBAqCvB"}
|
|
@@ -11,48 +11,49 @@ const logger = createLogger('e2e:capture-private-execution-steps');
|
|
|
11
11
|
// Longer term we won't use this hacked together msgpack format
|
|
12
12
|
// Leaving duplicated as this eventually bb will provide a serialization
|
|
13
13
|
// helper for passing to a generic msgpack RPC endpoint.
|
|
14
|
-
async function _createClientIvcProofFiles(directory, executionSteps
|
|
14
|
+
async function _createClientIvcProofFiles(directory, executionSteps) {
|
|
15
15
|
const acirPath = path.join(directory, 'acir.msgpack');
|
|
16
16
|
const witnessPath = path.join(directory, 'witnesses.msgpack');
|
|
17
17
|
await fs.writeFile(acirPath, encode(executionSteps.map((map)=>map.bytecode)));
|
|
18
18
|
await fs.writeFile(witnessPath, encode(executionSteps.map((map)=>serializeWitness(map.witness))));
|
|
19
|
-
let rawWitnessesPath;
|
|
20
|
-
if (rawWitnesses) {
|
|
21
|
-
rawWitnessesPath = path.join(directory, 'witnesses.json');
|
|
22
|
-
await fs.writeFile(rawWitnessesPath, JSON.stringify(executionSteps.map((step)=>Object.fromEntries(step.witness))));
|
|
23
|
-
}
|
|
24
19
|
return {
|
|
25
20
|
acirPath,
|
|
26
|
-
witnessPath
|
|
27
|
-
rawWitnessesPath
|
|
21
|
+
witnessPath
|
|
28
22
|
};
|
|
29
23
|
}
|
|
30
24
|
export async function capturePrivateExecutionStepsIfEnvSet(label, interaction, opts, expectedSteps) {
|
|
31
25
|
// Not included in env_var.ts as internal to e2e tests.
|
|
32
26
|
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
33
|
-
if (ivcFolder) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
if (!ivcFolder) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const profileMode = [
|
|
31
|
+
'execution-steps',
|
|
32
|
+
'full'
|
|
33
|
+
].includes(process.env.PROFILE_MODE ?? '') ? process.env.PROFILE_MODE : 'execution-steps';
|
|
34
|
+
logger.info(`Capturing client ivc execution profile for ${label} in mode ${profileMode}`);
|
|
35
|
+
const result = await interaction.profile({
|
|
36
|
+
...opts,
|
|
37
|
+
profileMode
|
|
38
|
+
});
|
|
39
|
+
if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
|
|
40
|
+
throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
|
|
41
|
+
}
|
|
42
|
+
const resultsDirectory = path.join(ivcFolder, label);
|
|
43
|
+
logger.info(`Writing private execution steps to ${resultsDirectory}`);
|
|
44
|
+
await fs.mkdir(resultsDirectory, {
|
|
45
|
+
recursive: true
|
|
46
|
+
});
|
|
47
|
+
// Write the client IVC files read by the prover.
|
|
48
|
+
await _createClientIvcProofFiles(resultsDirectory, result.executionSteps);
|
|
49
|
+
if (profileMode === 'full') {
|
|
50
|
+
// If we have gate counts, write the steps in human-readable format.
|
|
51
51
|
await fs.writeFile(path.join(resultsDirectory, 'steps.json'), JSON.stringify(result.executionSteps.map((step)=>({
|
|
52
52
|
fnName: step.functionName,
|
|
53
53
|
gateCount: step.gateCount
|
|
54
54
|
})), null, 2));
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// In full mode, we also write the raw witnesses in a more human-readable format.
|
|
56
|
+
await fs.writeFile(path.join(resultsDirectory, 'witnesses.json'), JSON.stringify(result.executionSteps.map((step)=>Object.fromEntries(step.witness))));
|
|
57
57
|
}
|
|
58
|
+
logger.info(`Wrote private execution steps to ${resultsDirectory}`);
|
|
58
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,YAAY,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;IAC5B,YAAY,EAAE,gBAAgB;IAErC,gDAAgD;IAChC,mBAAmB,EAAE,mBAAmB;IAExD,2BAA2B;IACX,WAAW,EAAE,aAAa;IAetC,cAAc,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EACV,KAAK,QAAQ,EACb,EAAE,EAGF,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAK7C;;;;;;;;;GASG;AACH,wBAAsB,0CAA0C,CAC9D,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,qBAAqB,EAAE,UAAU,EACjC,KAAK,EAAE,YAAY,EACnB,sBAAsB,EAAE,UAAU,GACjC,OAAO,CAAC;IACT;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC;IAC/B;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,eAAe,EAAE,GAAG,CAAC;CACtB,CAAC,CA+CD;AAG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Y;IAIzC,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAMrE,oBAAoB,CAAC,KAAK,EAAE,YAAY;IAIxC,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAKpE,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,GAAE,UAA4B,GAAG,OAAO,CAAC,EAAE,CAAC;IASzG,2BAA2B,CACzB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC;IAW5B,qBAAqB,CAAC,YAAY,EAAE,MAAM;IAK1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,KAAU;IAK1D;;;;;;OAMG;IACG,qBAAqB,CAAC,OAAO,EAAE,EAAE,GAAG,GAAG;IAS7C,mBAAmB,IAAI,iBAAiB;CAYzC"}
|
|
@@ -109,11 +109,15 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
109
109
|
address: this.l1TokenManager.tokenAddress.toString(),
|
|
110
110
|
client: this.walletClient
|
|
111
111
|
});
|
|
112
|
-
await
|
|
112
|
+
const balanceBefore = await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString());
|
|
113
|
+
const hash = await contract.write.mint([
|
|
113
114
|
this.ethAccount.toString(),
|
|
114
115
|
amount
|
|
115
116
|
]);
|
|
116
|
-
|
|
117
|
+
await this.publicClient.waitForTransactionReceipt({
|
|
118
|
+
hash
|
|
119
|
+
});
|
|
120
|
+
expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(balanceBefore + amount);
|
|
117
121
|
}
|
|
118
122
|
getL1BalanceOf(address) {
|
|
119
123
|
return this.l1TokenManager.getL1TokenBalance(address.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAKjB,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,gBAAgB,EAAE,aAAa,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,0BAA0B,CAAC;IAC5C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAMD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAKjB,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,gBAAgB,EAAE,aAAa,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,0BAA0B,CAAC;IAC5C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAMD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,WAAW,CAAC,CAqCtB;AA6DD,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,MAAM,EACN,cAAc,EACd,MAAM,GACP,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,iBAkBA"}
|
|
@@ -29,7 +29,8 @@ export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mne
|
|
|
29
29
|
const recipientWallet = await getSchnorrWalletWithSecretKey(pxe, recipient.secret, recipient.signingKey, recipient.salt);
|
|
30
30
|
const fundedAccounts = await Promise.all(funded.map((a)=>getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
|
|
31
31
|
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)));
|
|
32
|
-
// Progress by
|
|
32
|
+
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
33
|
+
await advanceL2Block(node);
|
|
33
34
|
await advanceL2Block(node);
|
|
34
35
|
await advanceL2Block(node);
|
|
35
36
|
const wallets = await Promise.all(fundedAccounts.map(async (a, i)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -26,37 +26,38 @@
|
|
|
26
26
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.
|
|
30
|
-
"@aztec/archiver": "0.
|
|
31
|
-
"@aztec/aztec": "0.
|
|
32
|
-
"@aztec/aztec-node": "0.
|
|
33
|
-
"@aztec/aztec.js": "0.
|
|
34
|
-
"@aztec/bb-prover": "0.
|
|
35
|
-
"@aztec/blob-lib": "0.
|
|
36
|
-
"@aztec/blob-sink": "0.
|
|
37
|
-
"@aztec/bot": "0.
|
|
38
|
-
"@aztec/
|
|
39
|
-
"@aztec/
|
|
40
|
-
"@aztec/
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/noir-
|
|
48
|
-
"@aztec/noir-
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/
|
|
52
|
-
"@aztec/prover-
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
59
|
-
"@aztec/
|
|
29
|
+
"@aztec/accounts": "0.85.0",
|
|
30
|
+
"@aztec/archiver": "0.85.0",
|
|
31
|
+
"@aztec/aztec": "0.85.0",
|
|
32
|
+
"@aztec/aztec-node": "0.85.0",
|
|
33
|
+
"@aztec/aztec.js": "0.85.0",
|
|
34
|
+
"@aztec/bb-prover": "0.85.0",
|
|
35
|
+
"@aztec/blob-lib": "0.85.0",
|
|
36
|
+
"@aztec/blob-sink": "0.85.0",
|
|
37
|
+
"@aztec/bot": "0.85.0",
|
|
38
|
+
"@aztec/cli": "0.85.0",
|
|
39
|
+
"@aztec/constants": "0.85.0",
|
|
40
|
+
"@aztec/entrypoints": "0.85.0",
|
|
41
|
+
"@aztec/epoch-cache": "0.85.0",
|
|
42
|
+
"@aztec/ethereum": "0.85.0",
|
|
43
|
+
"@aztec/foundation": "0.85.0",
|
|
44
|
+
"@aztec/kv-store": "0.85.0",
|
|
45
|
+
"@aztec/l1-artifacts": "0.85.0",
|
|
46
|
+
"@aztec/merkle-tree": "0.85.0",
|
|
47
|
+
"@aztec/noir-contracts.js": "0.85.0",
|
|
48
|
+
"@aztec/noir-noirc_abi": "0.85.0",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.85.0",
|
|
50
|
+
"@aztec/p2p": "0.85.0",
|
|
51
|
+
"@aztec/protocol-contracts": "0.85.0",
|
|
52
|
+
"@aztec/prover-client": "0.85.0",
|
|
53
|
+
"@aztec/prover-node": "0.85.0",
|
|
54
|
+
"@aztec/pxe": "0.85.0",
|
|
55
|
+
"@aztec/sequencer-client": "0.85.0",
|
|
56
|
+
"@aztec/simulator": "0.85.0",
|
|
57
|
+
"@aztec/stdlib": "0.85.0",
|
|
58
|
+
"@aztec/telemetry-client": "0.85.0",
|
|
59
|
+
"@aztec/validator-client": "0.85.0",
|
|
60
|
+
"@aztec/world-state": "0.85.0",
|
|
60
61
|
"@iarna/toml": "^2.2.5",
|
|
61
62
|
"@jest/globals": "^29.5.0",
|
|
62
63
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
@@ -65,29 +66,25 @@
|
|
|
65
66
|
"@swc/jest": "^0.2.36",
|
|
66
67
|
"@types/fs-extra": "^11.0.2",
|
|
67
68
|
"@types/jest": "^29.5.0",
|
|
68
|
-
"@types/koa": "^2.
|
|
69
|
+
"@types/koa": "^2.15.0",
|
|
69
70
|
"@types/koa-static": "^4.0.2",
|
|
70
|
-
"@types/levelup": "^5.1.2",
|
|
71
71
|
"@types/lodash.every": "^4.6.7",
|
|
72
|
-
"@types/memdown": "^3.0.3",
|
|
73
72
|
"@types/node": "^18.7.23",
|
|
74
73
|
"@viem/anvil": "^0.0.9",
|
|
75
74
|
"buffer": "^6.0.3",
|
|
76
|
-
"crypto-browserify": "^3.12.
|
|
75
|
+
"crypto-browserify": "^3.12.1",
|
|
77
76
|
"fs-extra": "^11.2.0",
|
|
78
77
|
"get-port": "^7.1.0",
|
|
79
78
|
"glob": "^10.3.10",
|
|
80
79
|
"jest": "^29.5.0",
|
|
81
80
|
"jest-extended": "^4.0.2",
|
|
82
81
|
"jest-mock-extended": "^3.0.5",
|
|
83
|
-
"koa": "^2.
|
|
82
|
+
"koa": "^2.16.1",
|
|
84
83
|
"koa-static": "^5.0.0",
|
|
85
|
-
"levelup": "^5.1.1",
|
|
86
84
|
"lodash.chunk": "^4.2.0",
|
|
87
85
|
"lodash.compact": "^3.0.1",
|
|
88
86
|
"lodash.every": "^4.6.0",
|
|
89
87
|
"lodash.omit": "^4.5.0",
|
|
90
|
-
"memdown": "^6.1.1",
|
|
91
88
|
"process": "^0.11.10",
|
|
92
89
|
"stream-browserify": "^3.0.0",
|
|
93
90
|
"string-argv": "^0.3.2",
|
package/src/bench/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { type AztecNode, BatchCall,
|
|
2
|
+
import { type AztecNode, BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js';
|
|
3
3
|
import { mean, stdDev, times } from '@aztec/foundation/collection';
|
|
4
4
|
import { BenchmarkingContract } from '@aztec/noir-contracts.js/Benchmarking';
|
|
5
5
|
import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
|
|
@@ -154,15 +154,11 @@ export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpt
|
|
|
154
154
|
* @param startingBlock - First l2 block to process.
|
|
155
155
|
* @returns The new PXE.
|
|
156
156
|
*/
|
|
157
|
-
export async function createNewPXE(
|
|
158
|
-
node: AztecNode,
|
|
159
|
-
contract: BenchmarkingContract,
|
|
160
|
-
startingBlock: number = INITIAL_L2_BLOCK_NUM,
|
|
161
|
-
): Promise<PXEService> {
|
|
157
|
+
export async function createNewPXE(node: AztecNode, contract: BenchmarkingContract): Promise<PXEService> {
|
|
162
158
|
const l1Contracts = await node.getL1ContractAddresses();
|
|
163
159
|
const { l1ChainId, rollupVersion } = await node.getNodeInfo();
|
|
164
160
|
const pxeConfig = {
|
|
165
|
-
|
|
161
|
+
l2BlockBatchSize: 200,
|
|
166
162
|
l2BlockPollingIntervalMS: 100,
|
|
167
163
|
dataDirectory: undefined,
|
|
168
164
|
dataStoreMapSizeKB: 1024 * 1024,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createLogger,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
13
|
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
14
|
-
import {
|
|
14
|
+
import { InvalidAccountContract } from '@aztec/noir-contracts.js/InvalidAccount';
|
|
15
15
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
16
16
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
17
17
|
|
|
@@ -67,7 +67,7 @@ export class BlacklistTokenContractTest {
|
|
|
67
67
|
accounts: CompleteAddress[] = [];
|
|
68
68
|
asset!: TokenBlacklistContract;
|
|
69
69
|
tokenSim!: TokenSimulator;
|
|
70
|
-
badAccount!:
|
|
70
|
+
badAccount!: InvalidAccountContract;
|
|
71
71
|
|
|
72
72
|
admin!: AccountWallet;
|
|
73
73
|
other!: AccountWallet;
|
|
@@ -119,7 +119,7 @@ export class BlacklistTokenContractTest {
|
|
|
119
119
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
120
120
|
|
|
121
121
|
this.logger.verbose(`Deploying bad account...`);
|
|
122
|
-
this.badAccount = await
|
|
122
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallets[0]).send().deployed();
|
|
123
123
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
124
124
|
|
|
125
125
|
await this.mineBlocks();
|
|
@@ -138,7 +138,7 @@ export class BlacklistTokenContractTest {
|
|
|
138
138
|
this.accounts.map(a => a.address),
|
|
139
139
|
);
|
|
140
140
|
|
|
141
|
-
this.badAccount = await
|
|
141
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
|
|
142
142
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
143
143
|
|
|
144
144
|
expect(await this.asset.methods.get_roles(this.admin.getAddress()).simulate()).toEqual(
|
|
@@ -24,13 +24,14 @@ import {
|
|
|
24
24
|
|
|
25
25
|
// This can be lowered to as much as 2s in non-CI
|
|
26
26
|
export const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8;
|
|
27
|
-
export const EPOCH_DURATION_IN_L2_SLOTS = 4;
|
|
28
27
|
export const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
29
28
|
export const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
30
29
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
31
30
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
32
31
|
|
|
33
|
-
export type EpochsTestOpts = Partial<
|
|
32
|
+
export type EpochsTestOpts = Partial<
|
|
33
|
+
Pick<SetupOptions, 'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs'>
|
|
34
|
+
>;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Tests building of epochs using fast block times and short epochs.
|
|
@@ -50,6 +51,8 @@ export class EpochsTestContext {
|
|
|
50
51
|
public proverNodes: ProverNode[] = [];
|
|
51
52
|
public nodes: AztecNodeService[] = [];
|
|
52
53
|
|
|
54
|
+
public epochDuration!: number;
|
|
55
|
+
|
|
53
56
|
public static async setup(opts: EpochsTestOpts = {}) {
|
|
54
57
|
const test = new EpochsTestContext();
|
|
55
58
|
await test.setup(opts);
|
|
@@ -59,19 +62,22 @@ export class EpochsTestContext {
|
|
|
59
62
|
public async setup(opts: EpochsTestOpts = {}) {
|
|
60
63
|
// Set up system without any account nor protocol contracts
|
|
61
64
|
// and with faster block times and shorter epochs.
|
|
65
|
+
const aztecEpochDuration = opts.aztecEpochDuration ?? 4;
|
|
66
|
+
const proofSubmissionWindow = opts.aztecProofSubmissionWindow ?? aztecEpochDuration * 2 - 1;
|
|
62
67
|
const context = await setup(0, {
|
|
63
68
|
checkIntervalMs: 50,
|
|
64
69
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
65
70
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
66
71
|
skipProtocolContracts: true,
|
|
67
72
|
salt: 1,
|
|
68
|
-
aztecEpochDuration
|
|
73
|
+
aztecEpochDuration,
|
|
69
74
|
aztecSlotDuration: L1_BLOCK_TIME_IN_S * L2_SLOT_DURATION_IN_L1_SLOTS,
|
|
70
75
|
ethereumSlotDuration: L1_BLOCK_TIME_IN_S,
|
|
71
|
-
aztecProofSubmissionWindow:
|
|
76
|
+
aztecProofSubmissionWindow: proofSubmissionWindow,
|
|
72
77
|
minTxsPerBlock: 0,
|
|
73
78
|
realProofs: false,
|
|
74
79
|
startProverNode: true,
|
|
80
|
+
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
75
81
|
// We use numeric incremental prover ids for simplicity, but we can switch to
|
|
76
82
|
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
77
83
|
proverId: Fr.fromString('1'),
|
|
@@ -106,12 +112,14 @@ export class EpochsTestContext {
|
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
// Constants used for time calculation
|
|
115
|
+
this.epochDuration = aztecEpochDuration;
|
|
109
116
|
this.constants = {
|
|
110
|
-
epochDuration:
|
|
117
|
+
epochDuration: aztecEpochDuration,
|
|
111
118
|
slotDuration: L1_BLOCK_TIME_IN_S * L2_SLOT_DURATION_IN_L1_SLOTS,
|
|
112
119
|
l1StartBlock: await this.rollup.getL1StartBlock(),
|
|
113
120
|
l1GenesisTime: await this.rollup.getL1GenesisTime(),
|
|
114
121
|
ethereumSlotDuration: L1_BLOCK_TIME_IN_S,
|
|
122
|
+
proofSubmissionWindow,
|
|
115
123
|
};
|
|
116
124
|
|
|
117
125
|
this.logger.info(
|
|
@@ -44,7 +44,8 @@ export const SHORTENED_BLOCK_TIME_CONFIG = {
|
|
|
44
44
|
|
|
45
45
|
export class P2PNetworkTest {
|
|
46
46
|
private snapshotManager: ISnapshotManager;
|
|
47
|
-
|
|
47
|
+
public baseAccountPrivateKey: `0x${string}`;
|
|
48
|
+
public baseAccount;
|
|
48
49
|
|
|
49
50
|
public logger: Logger;
|
|
50
51
|
public monitor!: ChainMonitor;
|
|
@@ -54,7 +55,8 @@ export class P2PNetworkTest {
|
|
|
54
55
|
public attesterPublicKeys: string[] = [];
|
|
55
56
|
public proposerPrivateKeys: `0x${string}`[] = [];
|
|
56
57
|
public peerIdPrivateKeys: string[] = [];
|
|
57
|
-
public validators: { attester: `0x${string}`; proposer: `0x${string}`; withdrawer: `0x${string}
|
|
58
|
+
public validators: { attester: `0x${string}`; proposer: `0x${string}`; withdrawer: `0x${string}`; amount: bigint }[] =
|
|
59
|
+
[];
|
|
58
60
|
|
|
59
61
|
public deployedAccounts: InitialAccountData[] = [];
|
|
60
62
|
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
@@ -80,7 +82,8 @@ export class P2PNetworkTest {
|
|
|
80
82
|
this.logger = createLogger(`e2e:e2e_p2p:${testName}`);
|
|
81
83
|
|
|
82
84
|
// Set up the base account and node private keys for the initial network deployment
|
|
83
|
-
this.
|
|
85
|
+
this.baseAccountPrivateKey = `0x${getPrivateKeyFromIndex(0)!.toString('hex')}`;
|
|
86
|
+
this.baseAccount = privateKeyToAccount(this.baseAccountPrivateKey);
|
|
84
87
|
this.proposerPrivateKeys = generatePrivateKeys(PROPOSER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
85
88
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX, numberOfNodes);
|
|
86
89
|
this.attesterPublicKeys = this.attesterPrivateKeys.map(privateKey => privateKeyToAccount(privateKey).address);
|
|
@@ -170,7 +173,7 @@ export class P2PNetworkTest {
|
|
|
170
173
|
dateProvider.setTime(Number(timestamp.timestamp) * 1000);
|
|
171
174
|
}
|
|
172
175
|
|
|
173
|
-
async
|
|
176
|
+
async addBootstrapNode() {
|
|
174
177
|
await this.snapshotManager.snapshot('add-bootstrap-node', async ({ aztecNodeConfig }) => {
|
|
175
178
|
const telemetry = getEndToEndTestTelemetryClient(this.metricsPort);
|
|
176
179
|
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(
|
|
@@ -182,6 +185,36 @@ export class P2PNetworkTest {
|
|
|
182
185
|
// Overwrite enr with updated info
|
|
183
186
|
this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
|
|
184
187
|
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
getValidators() {
|
|
191
|
+
const validators = [];
|
|
192
|
+
const proposerEOAs = [];
|
|
193
|
+
|
|
194
|
+
for (let i = 0; i < this.numberOfNodes; i++) {
|
|
195
|
+
const attester = privateKeyToAccount(this.attesterPrivateKeys[i]!);
|
|
196
|
+
const proposerEOA = privateKeyToAccount(this.proposerPrivateKeys[i]!);
|
|
197
|
+
proposerEOAs.push(proposerEOA.address);
|
|
198
|
+
const forwarder = getExpectedAddress(
|
|
199
|
+
ForwarderAbi,
|
|
200
|
+
ForwarderBytecode,
|
|
201
|
+
[proposerEOA.address],
|
|
202
|
+
proposerEOA.address,
|
|
203
|
+
).address;
|
|
204
|
+
validators.push({
|
|
205
|
+
attester: attester.address,
|
|
206
|
+
proposer: forwarder,
|
|
207
|
+
withdrawer: attester.address,
|
|
208
|
+
amount: l1ContractsConfig.minimumStake,
|
|
209
|
+
} as const);
|
|
210
|
+
|
|
211
|
+
this.logger.info(`Adding attester ${attester.address} proposer ${forwarder} as validator`);
|
|
212
|
+
}
|
|
213
|
+
return { validators, proposerEOAs };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async applyBaseSnapshots() {
|
|
217
|
+
await this.addBootstrapNode();
|
|
185
218
|
|
|
186
219
|
await this.snapshotManager.snapshot(
|
|
187
220
|
'add-validators',
|
|
@@ -214,30 +247,10 @@ export class P2PNetworkTest {
|
|
|
214
247
|
].map(txHash => deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash: txHash })),
|
|
215
248
|
);
|
|
216
249
|
|
|
217
|
-
const validators =
|
|
218
|
-
|
|
219
|
-
for (let i = 0; i < this.numberOfNodes; i++) {
|
|
220
|
-
const attester = privateKeyToAccount(this.attesterPrivateKeys[i]!);
|
|
221
|
-
const proposerEOA = privateKeyToAccount(this.proposerPrivateKeys[i]!);
|
|
222
|
-
const forwarder = getExpectedAddress(
|
|
223
|
-
ForwarderAbi,
|
|
224
|
-
ForwarderBytecode,
|
|
225
|
-
[proposerEOA.address],
|
|
226
|
-
proposerEOA.address,
|
|
227
|
-
).address;
|
|
228
|
-
validators.push({
|
|
229
|
-
attester: attester.address,
|
|
230
|
-
proposer: forwarder,
|
|
231
|
-
withdrawer: attester.address,
|
|
232
|
-
amount: l1ContractsConfig.minimumStake,
|
|
233
|
-
} as const);
|
|
234
|
-
|
|
235
|
-
this.logger.info(`Adding attester ${attester.address} proposer ${forwarder} as validator`);
|
|
236
|
-
}
|
|
237
|
-
|
|
250
|
+
const { validators } = this.getValidators();
|
|
238
251
|
this.validators = validators;
|
|
239
252
|
await deployL1ContractsValues.publicClient.waitForTransactionReceipt({
|
|
240
|
-
hash: await rollup.write.cheat__InitialiseValidatorSet([validators]),
|
|
253
|
+
hash: await rollup.write.cheat__InitialiseValidatorSet([this.validators]),
|
|
241
254
|
});
|
|
242
255
|
|
|
243
256
|
const slotsInEpoch = await rollup.read.getEpochDuration();
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
-
import { type Logger, type SentTx, TxStatus } from '@aztec/aztec.js';
|
|
4
|
+
import { Fr, type Logger, ProvenTx, type SentTx, TxStatus, getContractInstanceFromDeployParams } from '@aztec/aztec.js';
|
|
5
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
5
6
|
import type { SpamContract } from '@aztec/noir-contracts.js/Spam';
|
|
6
|
-
import {
|
|
7
|
+
import { TestContract, TestContractArtifact } from '@aztec/noir-contracts.js/Test';
|
|
8
|
+
import { PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
7
9
|
|
|
8
10
|
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
9
11
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
@@ -60,9 +62,33 @@ export const createPXEServiceAndSubmitTransactions = async (
|
|
|
60
62
|
const wallet = await account.getWallet();
|
|
61
63
|
|
|
62
64
|
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
63
|
-
return {
|
|
64
|
-
txs,
|
|
65
|
-
pxeService,
|
|
66
|
-
node,
|
|
67
|
-
};
|
|
65
|
+
return { txs, pxeService, node };
|
|
68
66
|
};
|
|
67
|
+
|
|
68
|
+
export async function createPXEServiceAndPrepareTransactions(
|
|
69
|
+
logger: Logger,
|
|
70
|
+
node: AztecNodeService,
|
|
71
|
+
numTxs: number,
|
|
72
|
+
fundedAccount: InitialAccountData,
|
|
73
|
+
): Promise<{ pxeService: PXEService; txs: ProvenTx[]; node: AztecNodeService }> {
|
|
74
|
+
const rpcConfig = getRpcConfig();
|
|
75
|
+
rpcConfig.proverEnabled = false;
|
|
76
|
+
const pxe = await createPXEService(node, rpcConfig, true);
|
|
77
|
+
|
|
78
|
+
const account = await getSchnorrAccount(pxe, fundedAccount.secret, fundedAccount.signingKey, fundedAccount.salt);
|
|
79
|
+
await account.register();
|
|
80
|
+
const wallet = await account.getWallet();
|
|
81
|
+
|
|
82
|
+
const testContractInstance = await getContractInstanceFromDeployParams(TestContractArtifact, {});
|
|
83
|
+
await wallet.registerContract({ instance: testContractInstance, artifact: TestContractArtifact });
|
|
84
|
+
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
85
|
+
|
|
86
|
+
const txs = await timesAsync(numTxs, async () => {
|
|
87
|
+
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ skipPublicSimulation: true });
|
|
88
|
+
const txHash = await tx.getTxHash();
|
|
89
|
+
logger.info(`Tx prepared with hash ${txHash}`);
|
|
90
|
+
return tx;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return { txs, pxeService: pxe, node };
|
|
94
|
+
}
|