@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 { type AccountWallet, type AztecNode, type CompleteAddress, type Logger, 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
|
|
|
6
6
|
import { jest } from '@jest/globals';
|
|
@@ -27,7 +27,7 @@ export class TokenContractTest {
|
|
|
27
27
|
accounts: CompleteAddress[] = [];
|
|
28
28
|
asset!: TokenContract;
|
|
29
29
|
tokenSim!: TokenSimulator;
|
|
30
|
-
badAccount!:
|
|
30
|
+
badAccount!: InvalidAccountContract;
|
|
31
31
|
node!: AztecNode;
|
|
32
32
|
|
|
33
33
|
constructor(testName: string) {
|
|
@@ -77,7 +77,7 @@ export class TokenContractTest {
|
|
|
77
77
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
78
78
|
|
|
79
79
|
this.logger.verbose(`Deploying bad account...`);
|
|
80
|
-
this.badAccount = await
|
|
80
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallets[0]).send().deployed();
|
|
81
81
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
82
82
|
|
|
83
83
|
return { tokenContractAddress: asset.address, badAccountAddress: this.badAccount.address };
|
|
@@ -94,7 +94,7 @@ export class TokenContractTest {
|
|
|
94
94
|
this.accounts.map(a => a.address),
|
|
95
95
|
);
|
|
96
96
|
|
|
97
|
-
this.badAccount = await
|
|
97
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
|
|
98
98
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
99
99
|
|
|
100
100
|
expect(await this.asset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
|
|
|
18
18
|
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'self + other'";
|
|
19
19
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
20
20
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
21
|
-
export const DUPLICATE_NULLIFIER_ERROR = /dropped|
|
|
21
|
+
export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
|
|
22
22
|
export const NO_L1_TO_L2_MSG_ERROR =
|
|
23
23
|
/No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
|
|
24
24
|
export const STATIC_CALL_STATE_MODIFICATION_ERROR =
|
|
@@ -414,7 +414,7 @@ async function setupFromFresh(
|
|
|
414
414
|
{
|
|
415
415
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
416
416
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
417
|
-
|
|
417
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
418
418
|
port: blobSinkPort,
|
|
419
419
|
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
420
420
|
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
|
@@ -537,7 +537,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
537
537
|
{
|
|
538
538
|
l1ChainId: aztecNodeConfig.l1ChainId,
|
|
539
539
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
540
|
-
|
|
540
|
+
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
541
541
|
port: blobSinkPort,
|
|
542
542
|
dataDirectory: statePath,
|
|
543
543
|
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -491,7 +491,7 @@ export async function setup(
|
|
|
491
491
|
{
|
|
492
492
|
l1ChainId: config.l1ChainId,
|
|
493
493
|
l1RpcUrls: config.l1RpcUrls,
|
|
494
|
-
|
|
494
|
+
l1Contracts: config.l1Contracts,
|
|
495
495
|
port: blobSinkPort,
|
|
496
496
|
dataDirectory: config.dataDirectory,
|
|
497
497
|
dataStoreMapSizeKB: config.dataStoreMapSizeKB,
|
|
@@ -22,24 +22,14 @@ const logger = createLogger('e2e:capture-private-execution-steps');
|
|
|
22
22
|
// Longer term we won't use this hacked together msgpack format
|
|
23
23
|
// Leaving duplicated as this eventually bb will provide a serialization
|
|
24
24
|
// helper for passing to a generic msgpack RPC endpoint.
|
|
25
|
-
async function _createClientIvcProofFiles(
|
|
26
|
-
directory: string,
|
|
27
|
-
executionSteps: PrivateExecutionStep[],
|
|
28
|
-
rawWitnesses: boolean = false,
|
|
29
|
-
) {
|
|
25
|
+
async function _createClientIvcProofFiles(directory: string, executionSteps: PrivateExecutionStep[]) {
|
|
30
26
|
const acirPath = path.join(directory, 'acir.msgpack');
|
|
31
27
|
const witnessPath = path.join(directory, 'witnesses.msgpack');
|
|
32
28
|
await fs.writeFile(acirPath, encode(executionSteps.map(map => map.bytecode)));
|
|
33
29
|
await fs.writeFile(witnessPath, encode(executionSteps.map(map => serializeWitness(map.witness))));
|
|
34
|
-
let rawWitnessesPath;
|
|
35
|
-
if (rawWitnesses) {
|
|
36
|
-
rawWitnessesPath = path.join(directory, 'witnesses.json');
|
|
37
|
-
await fs.writeFile(rawWitnessesPath, JSON.stringify(executionSteps.map(step => Object.fromEntries(step.witness))));
|
|
38
|
-
}
|
|
39
30
|
return {
|
|
40
31
|
acirPath,
|
|
41
32
|
witnessPath,
|
|
42
|
-
rawWitnessesPath,
|
|
43
33
|
};
|
|
44
34
|
}
|
|
45
35
|
|
|
@@ -51,21 +41,24 @@ export async function capturePrivateExecutionStepsIfEnvSet(
|
|
|
51
41
|
) {
|
|
52
42
|
// Not included in env_var.ts as internal to e2e tests.
|
|
53
43
|
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
54
|
-
if (ivcFolder) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
if (!ivcFolder) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const profileMode = ['execution-steps', 'full'].includes(process.env.PROFILE_MODE ?? '')
|
|
48
|
+
? (process.env.PROFILE_MODE as 'full' | 'execution-steps')
|
|
49
|
+
: 'execution-steps';
|
|
50
|
+
logger.info(`Capturing client ivc execution profile for ${label} in mode ${profileMode}`);
|
|
51
|
+
const result = await interaction.profile({ ...opts, profileMode });
|
|
52
|
+
if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
|
|
53
|
+
throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
|
|
54
|
+
}
|
|
55
|
+
const resultsDirectory = path.join(ivcFolder, label);
|
|
56
|
+
logger.info(`Writing private execution steps to ${resultsDirectory}`);
|
|
57
|
+
await fs.mkdir(resultsDirectory, { recursive: true });
|
|
58
|
+
// Write the client IVC files read by the prover.
|
|
59
|
+
await _createClientIvcProofFiles(resultsDirectory, result.executionSteps);
|
|
60
|
+
if (profileMode === 'full') {
|
|
61
|
+
// If we have gate counts, write the steps in human-readable format.
|
|
69
62
|
await fs.writeFile(
|
|
70
63
|
path.join(resultsDirectory, 'steps.json'),
|
|
71
64
|
JSON.stringify(
|
|
@@ -74,7 +67,11 @@ export async function capturePrivateExecutionStepsIfEnvSet(
|
|
|
74
67
|
2,
|
|
75
68
|
),
|
|
76
69
|
);
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
// In full mode, we also write the raw witnesses in a more human-readable format.
|
|
71
|
+
await fs.writeFile(
|
|
72
|
+
path.join(resultsDirectory, 'witnesses.json'),
|
|
73
|
+
JSON.stringify(result.executionSteps.map(step => Object.fromEntries(step.witness))),
|
|
74
|
+
);
|
|
79
75
|
}
|
|
76
|
+
logger.info(`Wrote private execution steps to ${resultsDirectory}`);
|
|
80
77
|
}
|
|
@@ -232,8 +232,10 @@ export class CrossChainTestHarness {
|
|
|
232
232
|
address: this.l1TokenManager.tokenAddress.toString(),
|
|
233
233
|
client: this.walletClient,
|
|
234
234
|
});
|
|
235
|
-
await
|
|
236
|
-
|
|
235
|
+
const balanceBefore = await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString());
|
|
236
|
+
const hash = await contract.write.mint([this.ethAccount.toString(), amount]);
|
|
237
|
+
await this.publicClient.waitForTransactionReceipt({ hash });
|
|
238
|
+
expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(balanceBefore + amount);
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
getL1BalanceOf(address: EthAddress) {
|
|
@@ -73,7 +73,8 @@ export async function deployTestWalletWithTokens(
|
|
|
73
73
|
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
-
// Progress by
|
|
76
|
+
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
77
|
+
await advanceL2Block(node);
|
|
77
78
|
await advanceL2Block(node);
|
|
78
79
|
await advanceL2Block(node);
|
|
79
80
|
|