@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c
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/client_flows/benchmark.d.ts +60 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -27
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -43
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -7
- 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 +66 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +34 -53
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -6
- package/dest/e2e_epochs/epochs_test.d.ts +56 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +222 -42
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts +16 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +87 -88
- package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +132 -0
- package/dest/e2e_p2p/p2p_network.d.ts +56 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +154 -125
- package/dest/e2e_p2p/shared.d.ts +41 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +146 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +51 -24
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +8 -15
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +14 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +8 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +120 -104
- package/dest/fixtures/token_utils.d.ts +4 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +24 -7
- package/dest/fixtures/utils.d.ts +65 -22
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +439 -318
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +42 -0
- package/dest/shared/cross_chain_test_harness.d.ts +28 -18
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +97 -41
- package/dest/shared/gas_portal_test_harness.d.ts +23 -18
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +43 -25
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +5 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +136 -90
- package/dest/simulators/lending_simulator.d.ts +5 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +11 -15
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -22
- package/dest/spartan/utils.d.ts +60 -307
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +200 -115
- package/package.json +60 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +26 -52
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
- package/src/e2e_deploy_contract/deploy_test.ts +11 -8
- package/src/e2e_epochs/epochs_test.ts +276 -54
- package/src/e2e_fees/bridging_race.notest.ts +75 -0
- package/src/e2e_fees/fees_test.ts +121 -108
- package/src/e2e_l1_publisher/write_json.ts +74 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
- package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
- package/src/e2e_p2p/p2p_network.ts +212 -144
- package/src/e2e_p2p/shared.ts +234 -14
- package/src/e2e_token_contract/token_contract_test.ts +42 -38
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +2 -10
- package/src/fixtures/get_bb_config.ts +15 -11
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +5 -6
- package/src/fixtures/setup_p2p_test.ts +112 -30
- package/src/fixtures/snapshot_manager.ts +150 -102
- package/src/fixtures/token_utils.ts +33 -8
- package/src/fixtures/utils.ts +530 -352
- package/src/fixtures/web3signer.ts +46 -0
- package/src/guides/up_quick_start.sh +4 -4
- package/src/shared/cross_chain_test_harness.ts +92 -52
- package/src/shared/gas_portal_test_harness.ts +47 -31
- package/src/shared/uniswap_l1_l2.ts +127 -124
- package/src/simulators/lending_simulator.ts +11 -15
- package/src/simulators/token_simulator.ts +17 -12
- package/src/spartan/DEVELOP.md +116 -0
- package/src/spartan/setup_test_wallets.ts +144 -29
- package/src/spartan/utils.ts +194 -116
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
package/dest/spartan/utils.js
CHANGED
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger, sleep } from '@aztec/aztec.js';
|
|
2
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
3
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
4
|
+
import { createAztecNodeAdminClient, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
2
5
|
import { exec, execSync, spawn } from 'child_process';
|
|
3
6
|
import path from 'path';
|
|
4
7
|
import { promisify } from 'util';
|
|
8
|
+
import { createPublicClient, fallback, http } from 'viem';
|
|
5
9
|
import { z } from 'zod';
|
|
6
|
-
import { AlertChecker } from '../quality_of_service/alert_checker.js';
|
|
7
10
|
const execAsync = promisify(exec);
|
|
8
11
|
const logger = createLogger('e2e:k8s-utils');
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}), 'ETHEREUM_HOSTS must be a comma-separated list of valid URLs');
|
|
17
|
-
const k8sLocalConfigSchema = z.object({
|
|
18
|
-
ETHEREUM_SLOT_DURATION: z.coerce.number().min(1, 'ETHEREUM_SLOT_DURATION env variable must be set'),
|
|
19
|
-
AZTEC_SLOT_DURATION: z.coerce.number().min(1, 'AZTEC_SLOT_DURATION env variable must be set'),
|
|
20
|
-
AZTEC_EPOCH_DURATION: z.coerce.number().min(1, 'AZTEC_EPOCH_DURATION env variable must be set'),
|
|
21
|
-
AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().min(1, 'AZTEC_PROOF_SUBMISSION_WINDOW env variable must be set'),
|
|
22
|
-
INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
|
|
23
|
-
NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
|
|
24
|
-
CONTAINER_NODE_PORT: z.coerce.number().default(8080),
|
|
25
|
-
CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
|
|
26
|
-
CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
|
|
27
|
-
CONTAINER_PXE_PORT: z.coerce.number().default(8080),
|
|
28
|
-
CONTAINER_ETHEREUM_PORT: z.coerce.number().default(8545),
|
|
29
|
-
CONTAINER_METRICS_PORT: z.coerce.number().default(80),
|
|
30
|
-
GRAFANA_PASSWORD: z.string().optional(),
|
|
31
|
-
METRICS_API_PATH: z.string().default('/api/datasources/proxy/uid/spartan-metrics-prometheus/api/v1'),
|
|
32
|
-
SPARTAN_DIR: z.string().min(1, 'SPARTAN_DIR env variable must be set'),
|
|
33
|
-
ETHEREUM_HOSTS: ethereumHostsSchema.optional(),
|
|
34
|
-
L1_ACCOUNT_MNEMONIC: z.string().default('test test test test test test test test test test test junk'),
|
|
35
|
-
SEPOLIA_RUN: z.string().default('false'),
|
|
36
|
-
K8S: z.literal('local')
|
|
37
|
-
});
|
|
38
|
-
const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
|
|
39
|
-
K8S: z.literal('gcloud'),
|
|
40
|
-
CLUSTER_NAME: z.string().min(1, 'CLUSTER_NAME env variable must be set'),
|
|
41
|
-
REGION: z.string().min(1, 'REGION env variable must be set')
|
|
12
|
+
const testConfigSchema = z.object({
|
|
13
|
+
NAMESPACE: z.string().default('scenario'),
|
|
14
|
+
REAL_VERIFIER: schemas.Boolean.optional().default(true),
|
|
15
|
+
CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
|
|
16
|
+
L1_RPC_URLS_JSON: z.string().optional()
|
|
42
17
|
});
|
|
43
|
-
const directConfigSchema = z.object({
|
|
44
|
-
PXE_URL: z.string().url('PXE_URL must be a valid URL'),
|
|
45
|
-
NODE_URL: z.string().url('NODE_URL must be a valid URL'),
|
|
46
|
-
ETHEREUM_HOSTS: ethereumHostsSchema,
|
|
47
|
-
K8S: z.literal('false')
|
|
48
|
-
});
|
|
49
|
-
const envSchema = z.discriminatedUnion('K8S', [
|
|
50
|
-
k8sLocalConfigSchema,
|
|
51
|
-
k8sGCloudConfigSchema,
|
|
52
|
-
directConfigSchema
|
|
53
|
-
]);
|
|
54
|
-
export function isK8sConfig(config) {
|
|
55
|
-
return config.K8S === 'local' || config.K8S === 'gcloud';
|
|
56
|
-
}
|
|
57
|
-
export function isGCloudConfig(config) {
|
|
58
|
-
return config.K8S === 'gcloud';
|
|
59
|
-
}
|
|
60
18
|
export function setupEnvironment(env) {
|
|
61
|
-
const config =
|
|
62
|
-
|
|
63
|
-
const command = `gcloud container clusters get-credentials ${config.CLUSTER_NAME} --region=${config.REGION}`;
|
|
64
|
-
execSync(command);
|
|
65
|
-
}
|
|
19
|
+
const config = testConfigSchema.parse(env);
|
|
20
|
+
logger.warn(`Loaded env config`, config);
|
|
66
21
|
return config;
|
|
67
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @param path - The path to the script, relative to the project root
|
|
25
|
+
* @param args - The arguments to pass to the script
|
|
26
|
+
* @param logger - The logger to use
|
|
27
|
+
* @returns The exit code of the script
|
|
28
|
+
*/ function runScript(path, args, logger, env) {
|
|
29
|
+
const childProcess = spawn(path, args, {
|
|
30
|
+
stdio: [
|
|
31
|
+
'ignore',
|
|
32
|
+
'pipe',
|
|
33
|
+
'pipe'
|
|
34
|
+
],
|
|
35
|
+
env: env ? {
|
|
36
|
+
...process.env,
|
|
37
|
+
...env
|
|
38
|
+
} : process.env
|
|
39
|
+
});
|
|
40
|
+
return new Promise((resolve, reject)=>{
|
|
41
|
+
childProcess.on('close', (code)=>resolve(code ?? 0));
|
|
42
|
+
childProcess.on('error', reject);
|
|
43
|
+
childProcess.stdout?.on('data', (data)=>{
|
|
44
|
+
logger.info(data.toString());
|
|
45
|
+
});
|
|
46
|
+
childProcess.stderr?.on('data', (data)=>{
|
|
47
|
+
logger.error(data.toString());
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function getAztecBin() {
|
|
52
|
+
return path.join(getGitProjectRoot(), 'yarn-project/aztec/dest/bin/index.js');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Runs the Aztec binary
|
|
56
|
+
* @param args - The arguments to pass to the Aztec binary
|
|
57
|
+
* @param logger - The logger to use
|
|
58
|
+
* @param env - Optional environment variables to set for the process
|
|
59
|
+
* @returns The exit code of the Aztec binary
|
|
60
|
+
*/ export function runAztecBin(args, logger, env) {
|
|
61
|
+
return runScript('node', [
|
|
62
|
+
getAztecBin(),
|
|
63
|
+
...args
|
|
64
|
+
], logger, env);
|
|
65
|
+
}
|
|
66
|
+
export function runProjectScript(script, args, logger, env) {
|
|
67
|
+
const scriptPath = script.startsWith('/') ? script : path.join(getGitProjectRoot(), script);
|
|
68
|
+
return runScript(scriptPath, args, logger, env);
|
|
69
|
+
}
|
|
68
70
|
export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
|
|
69
71
|
const hostPortAsString = hostPort ? hostPort.toString() : '';
|
|
70
|
-
logger.
|
|
71
|
-
const
|
|
72
|
+
logger.debug(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
|
|
73
|
+
const process1 = spawn('kubectl', [
|
|
72
74
|
'port-forward',
|
|
73
75
|
'-n',
|
|
74
76
|
namespace,
|
|
@@ -85,61 +87,74 @@ export async function startPortForward({ resource, namespace, containerPort, hos
|
|
|
85
87
|
});
|
|
86
88
|
let isResolved = false;
|
|
87
89
|
const connected = new Promise((resolve)=>{
|
|
88
|
-
|
|
90
|
+
process1.stdout?.on('data', (data)=>{
|
|
89
91
|
const str = data.toString();
|
|
90
92
|
if (!isResolved && str.includes('Forwarding from')) {
|
|
91
93
|
isResolved = true;
|
|
92
|
-
logger.
|
|
94
|
+
logger.debug(`Port forward for ${resource}: ${str}`);
|
|
93
95
|
const port = str.search(/:\d+/);
|
|
94
96
|
if (port === -1) {
|
|
95
97
|
throw new Error('Port not found in port forward output');
|
|
96
98
|
}
|
|
97
99
|
const portNumber = parseInt(str.slice(port + 1));
|
|
98
|
-
logger.
|
|
99
|
-
logger.info(`Port forward connected: ${portNumber}`);
|
|
100
|
+
logger.verbose(`Port forwarded for ${resource} at ${portNumber}:${containerPort}`);
|
|
100
101
|
resolve(portNumber);
|
|
101
102
|
} else {
|
|
102
103
|
logger.silent(str);
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
|
-
|
|
106
|
-
logger.
|
|
106
|
+
process1.stderr?.on('data', (data)=>{
|
|
107
|
+
logger.verbose(`Port forward for ${resource}: ${data.toString()}`);
|
|
107
108
|
// It's a strange thing:
|
|
108
109
|
// If we don't pipe stderr, then the port forwarding does not work.
|
|
109
110
|
// Log to silent because this doesn't actually report errors,
|
|
110
111
|
// just extremely verbose debug logs.
|
|
111
112
|
logger.silent(data.toString());
|
|
112
113
|
});
|
|
113
|
-
|
|
114
|
+
process1.on('close', ()=>{
|
|
114
115
|
if (!isResolved) {
|
|
115
116
|
isResolved = true;
|
|
116
|
-
logger.warn(
|
|
117
|
+
logger.warn(`Port forward for ${resource} closed before connection established`);
|
|
117
118
|
resolve(0);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
|
|
121
|
-
logger.error(`Port forward error: ${error}`);
|
|
121
|
+
process1.on('error', (error)=>{
|
|
122
|
+
logger.error(`Port forward for ${resource} error: ${error}`);
|
|
122
123
|
resolve(0);
|
|
123
124
|
});
|
|
124
|
-
|
|
125
|
-
logger.
|
|
125
|
+
process1.on('exit', (code)=>{
|
|
126
|
+
logger.verbose(`Port forward for ${resource} exited with code ${code}`);
|
|
126
127
|
resolve(0);
|
|
127
128
|
});
|
|
128
129
|
});
|
|
129
130
|
const port = await connected;
|
|
130
131
|
return {
|
|
131
|
-
process,
|
|
132
|
+
process: process1,
|
|
132
133
|
port
|
|
133
134
|
};
|
|
134
135
|
}
|
|
136
|
+
export function startPortForwardForRPC(namespace) {
|
|
137
|
+
return startPortForward({
|
|
138
|
+
resource: `services/${namespace}-rpc-aztec-node`,
|
|
139
|
+
namespace,
|
|
140
|
+
containerPort: 8080
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export function startPortForwardForEthereum(namespace) {
|
|
144
|
+
return startPortForward({
|
|
145
|
+
resource: `services/${namespace}-eth-execution`,
|
|
146
|
+
namespace,
|
|
147
|
+
containerPort: 8545
|
|
148
|
+
});
|
|
149
|
+
}
|
|
135
150
|
export async function deleteResourceByName({ resource, namespace, name, force = false }) {
|
|
136
151
|
const command = `kubectl delete ${resource} ${name} -n ${namespace} --ignore-not-found=true --wait=true ${force ? '--force' : ''}`;
|
|
137
152
|
logger.info(`command: ${command}`);
|
|
138
153
|
const { stdout } = await execAsync(command);
|
|
139
154
|
return stdout;
|
|
140
155
|
}
|
|
141
|
-
export async function deleteResourceByLabel({ resource, namespace, label }) {
|
|
142
|
-
const command = `kubectl delete ${resource} -l ${label} -n ${namespace} --ignore-not-found=true --wait=true`;
|
|
156
|
+
export async function deleteResourceByLabel({ resource, namespace, label, timeout = '5m', force = false }) {
|
|
157
|
+
const command = `kubectl delete ${resource} -l ${label} -n ${namespace} --ignore-not-found=true --wait=true --timeout=${timeout} ${force ? '--force' : ''}`;
|
|
143
158
|
logger.info(`command: ${command}`);
|
|
144
159
|
const { stdout } = await execAsync(command);
|
|
145
160
|
return stdout;
|
|
@@ -192,13 +207,13 @@ async function execHelmCommand(args) {
|
|
|
192
207
|
const deleteArgs = {
|
|
193
208
|
resource: 'podchaos',
|
|
194
209
|
namespace: chaosMeshNamespace,
|
|
195
|
-
|
|
210
|
+
label: `app.kubernetes.io/instance=${instanceName}`
|
|
196
211
|
};
|
|
197
212
|
logger.info(`Deleting podchaos resource`);
|
|
198
|
-
await
|
|
213
|
+
await deleteResourceByLabel(deleteArgs).catch((e)=>{
|
|
199
214
|
logger.error(`Error deleting podchaos resource: ${e}`);
|
|
200
215
|
logger.info(`Force deleting podchaos resource`);
|
|
201
|
-
return
|
|
216
|
+
return deleteResourceByLabel({
|
|
202
217
|
...deleteArgs,
|
|
203
218
|
force: true
|
|
204
219
|
});
|
|
@@ -260,13 +275,14 @@ export function applyBootNodeFailure({ namespace, spartanDir, durationSeconds, l
|
|
|
260
275
|
logger
|
|
261
276
|
});
|
|
262
277
|
}
|
|
263
|
-
export function applyValidatorKill({ namespace, spartanDir, logger }) {
|
|
278
|
+
export function applyValidatorKill({ namespace, spartanDir, logger, values }) {
|
|
264
279
|
return installChaosMeshChart({
|
|
265
280
|
instanceName: 'validator-kill',
|
|
266
281
|
targetNamespace: namespace,
|
|
267
282
|
valuesFile: 'validator-kill.yaml',
|
|
268
283
|
helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
|
|
269
|
-
logger
|
|
284
|
+
logger,
|
|
285
|
+
values
|
|
270
286
|
});
|
|
271
287
|
}
|
|
272
288
|
export function applyNetworkShaping({ valuesFile, namespace, spartanDir, logger }) {
|
|
@@ -323,55 +339,107 @@ export async function enableValidatorDynamicBootNode(instanceName, namespace, sp
|
|
|
323
339
|
});
|
|
324
340
|
logger.info(`Validator dynamic boot node enabled`);
|
|
325
341
|
}
|
|
326
|
-
export async function runAlertCheck(config, alerts, logger) {
|
|
327
|
-
if (isK8sConfig(config)) {
|
|
328
|
-
const { process, port } = await startPortForward({
|
|
329
|
-
resource: `svc/metrics-grafana`,
|
|
330
|
-
namespace: 'metrics',
|
|
331
|
-
containerPort: config.CONTAINER_METRICS_PORT
|
|
332
|
-
});
|
|
333
|
-
const alertChecker = new AlertChecker(logger, {
|
|
334
|
-
grafanaEndpoint: `http://localhost:${port}${config.METRICS_API_PATH}`,
|
|
335
|
-
grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`
|
|
336
|
-
});
|
|
337
|
-
await alertChecker.runAlertCheck(alerts);
|
|
338
|
-
process.kill();
|
|
339
|
-
} else {
|
|
340
|
-
logger.info('Not running alert check in non-k8s environment');
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
export async function updateSequencerConfig(url, config) {
|
|
344
|
-
const node = createAztecNodeClient(url);
|
|
345
|
-
await node.setConfig(config);
|
|
346
|
-
}
|
|
347
342
|
export async function getSequencers(namespace) {
|
|
348
|
-
const command = `kubectl get pods -l app=validator -n ${namespace} -o jsonpath='{.items[*].metadata.name}'`;
|
|
343
|
+
const command = `kubectl get pods -l app.kubernetes.io/component=validator -n ${namespace} -o jsonpath='{.items[*].metadata.name}'`;
|
|
349
344
|
const { stdout } = await execAsync(command);
|
|
350
|
-
|
|
345
|
+
const sequencers = stdout.split(' ');
|
|
346
|
+
logger.verbose(`Found sequencer pods ${sequencers.join(', ')}`);
|
|
347
|
+
return sequencers;
|
|
348
|
+
}
|
|
349
|
+
export function updateSequencersConfig(env, config) {
|
|
350
|
+
return withSequencersAdmin(env, async (client)=>{
|
|
351
|
+
await client.setConfig(config);
|
|
352
|
+
return client.getConfig();
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
export function getSequencersConfig(env) {
|
|
356
|
+
return withSequencersAdmin(env, (client)=>client.getConfig());
|
|
351
357
|
}
|
|
352
|
-
export async function
|
|
353
|
-
const
|
|
358
|
+
export async function withSequencersAdmin(env, fn) {
|
|
359
|
+
const adminContainerPort = 8880;
|
|
360
|
+
const namespace = env.NAMESPACE;
|
|
354
361
|
const sequencers = await getSequencers(namespace);
|
|
362
|
+
const results = [];
|
|
355
363
|
for (const sequencer of sequencers){
|
|
356
|
-
const { process, port } = await startPortForward({
|
|
364
|
+
const { process: process1, port } = await startPortForward({
|
|
357
365
|
resource: `pod/${sequencer}`,
|
|
358
366
|
namespace,
|
|
359
|
-
containerPort
|
|
367
|
+
containerPort: adminContainerPort
|
|
360
368
|
});
|
|
361
369
|
const url = `http://localhost:${port}`;
|
|
362
|
-
await
|
|
363
|
-
|
|
370
|
+
await retry(()=>fetch(`${url}/status`).then((res)=>res.status === 200), 'forward node admin port', makeBackoff([
|
|
371
|
+
1,
|
|
372
|
+
1,
|
|
373
|
+
2,
|
|
374
|
+
6
|
|
375
|
+
]), logger, true);
|
|
376
|
+
const client = createAztecNodeAdminClient(url);
|
|
377
|
+
results.push(await fn(client));
|
|
378
|
+
process1.kill();
|
|
364
379
|
}
|
|
380
|
+
return results;
|
|
365
381
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Returns a public viem client to the eth execution node. If it was part of a local eth devnet,
|
|
384
|
+
* it first port-forwards the service and points to it. Otherwise, just uses the external RPC url.
|
|
385
|
+
*/ export async function getPublicViemClient(env, /** If set, will push the new process into it */ processes) {
|
|
386
|
+
const { NAMESPACE, CREATE_ETH_DEVNET, L1_RPC_URLS_JSON } = env;
|
|
387
|
+
if (CREATE_ETH_DEVNET) {
|
|
388
|
+
logger.info(`Creating port forward to eth execution node`);
|
|
389
|
+
const { process: process1, port } = await startPortForward({
|
|
390
|
+
resource: `svc/${NAMESPACE}-eth-execution`,
|
|
391
|
+
namespace: NAMESPACE,
|
|
392
|
+
containerPort: 8545
|
|
393
|
+
});
|
|
394
|
+
const url = `http://127.0.0.1:${port}`;
|
|
395
|
+
const client = createPublicClient({
|
|
396
|
+
transport: fallback([
|
|
397
|
+
http(url)
|
|
398
|
+
])
|
|
372
399
|
});
|
|
400
|
+
if (processes) {
|
|
401
|
+
processes.push(process1);
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
url,
|
|
405
|
+
client,
|
|
406
|
+
process: process1
|
|
407
|
+
};
|
|
373
408
|
} else {
|
|
374
|
-
|
|
409
|
+
logger.info(`Connecting to the eth execution node at ${L1_RPC_URLS_JSON}`);
|
|
410
|
+
if (!L1_RPC_URLS_JSON) {
|
|
411
|
+
throw new Error(`L1_RPC_URLS_JSON is not defined`);
|
|
412
|
+
}
|
|
413
|
+
const client = createPublicClient({
|
|
414
|
+
transport: fallback([
|
|
415
|
+
http(L1_RPC_URLS_JSON)
|
|
416
|
+
])
|
|
417
|
+
});
|
|
418
|
+
return {
|
|
419
|
+
url: L1_RPC_URLS_JSON,
|
|
420
|
+
client
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/** Queries an Aztec node for the L1 deployment addresses */ export async function getL1DeploymentAddresses(env) {
|
|
425
|
+
let forwardProcess;
|
|
426
|
+
try {
|
|
427
|
+
const [sequencer] = await getSequencers(env.NAMESPACE);
|
|
428
|
+
const { process: process1, port } = await startPortForward({
|
|
429
|
+
resource: `pod/${sequencer}`,
|
|
430
|
+
namespace: env.NAMESPACE,
|
|
431
|
+
containerPort: 8080
|
|
432
|
+
});
|
|
433
|
+
forwardProcess = process1;
|
|
434
|
+
const url = `http://127.0.0.1:${port}`;
|
|
435
|
+
const node = createAztecNodeClient(url);
|
|
436
|
+
return await retry(()=>node.getNodeInfo().then((i)=>i.l1ContractAddresses), 'get node info', makeBackoff([
|
|
437
|
+
1,
|
|
438
|
+
3,
|
|
439
|
+
6
|
|
440
|
+
]), logger);
|
|
441
|
+
} finally{
|
|
442
|
+
forwardProcess?.kill();
|
|
375
443
|
}
|
|
376
444
|
}
|
|
377
445
|
/**
|
|
@@ -443,3 +511,20 @@ export async function updateSequencersConfig(env, config) {
|
|
|
443
511
|
label: 'app=pxe'
|
|
444
512
|
});
|
|
445
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Returns the absolute path to the git repository root
|
|
516
|
+
*/ export function getGitProjectRoot() {
|
|
517
|
+
try {
|
|
518
|
+
const rootDir = execSync('git rev-parse --show-toplevel', {
|
|
519
|
+
encoding: 'utf-8',
|
|
520
|
+
stdio: [
|
|
521
|
+
'ignore',
|
|
522
|
+
'pipe',
|
|
523
|
+
'ignore'
|
|
524
|
+
]
|
|
525
|
+
}).trim();
|
|
526
|
+
return rootDir;
|
|
527
|
+
} catch (error) {
|
|
528
|
+
throw new Error(`Failed to determine git project root: ${error}`);
|
|
529
|
+
}
|
|
530
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1-fake-ceab37513c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"build": "yarn clean && tsc -b",
|
|
12
12
|
"build:dev": "tsc -b --watch",
|
|
13
13
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
14
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
15
14
|
"test:with-alerts": "./scripts/test-with-alerts.sh",
|
|
16
15
|
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
|
|
17
16
|
"test:e2e-docker": "./scripts/run_test.sh simple",
|
|
@@ -26,89 +25,92 @@
|
|
|
26
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.0.
|
|
30
|
-
"@aztec/archiver": "0.0.
|
|
31
|
-
"@aztec/aztec": "0.0.
|
|
32
|
-
"@aztec/aztec-node": "0.0.
|
|
33
|
-
"@aztec/aztec.js": "0.0.
|
|
34
|
-
"@aztec/bb-prover": "0.0.
|
|
35
|
-
"@aztec/blob-lib": "0.0.
|
|
36
|
-
"@aztec/blob-sink": "0.0.
|
|
37
|
-
"@aztec/bot": "0.0.
|
|
38
|
-
"@aztec/
|
|
39
|
-
"@aztec/
|
|
40
|
-
"@aztec/
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
28
|
+
"@aztec/accounts": "0.0.1-fake-ceab37513c",
|
|
29
|
+
"@aztec/archiver": "0.0.1-fake-ceab37513c",
|
|
30
|
+
"@aztec/aztec": "0.0.1-fake-ceab37513c",
|
|
31
|
+
"@aztec/aztec-node": "0.0.1-fake-ceab37513c",
|
|
32
|
+
"@aztec/aztec.js": "0.0.1-fake-ceab37513c",
|
|
33
|
+
"@aztec/bb-prover": "0.0.1-fake-ceab37513c",
|
|
34
|
+
"@aztec/blob-lib": "0.0.1-fake-ceab37513c",
|
|
35
|
+
"@aztec/blob-sink": "0.0.1-fake-ceab37513c",
|
|
36
|
+
"@aztec/bot": "0.0.1-fake-ceab37513c",
|
|
37
|
+
"@aztec/cli": "0.0.1-fake-ceab37513c",
|
|
38
|
+
"@aztec/constants": "0.0.1-fake-ceab37513c",
|
|
39
|
+
"@aztec/entrypoints": "0.0.1-fake-ceab37513c",
|
|
40
|
+
"@aztec/epoch-cache": "0.0.1-fake-ceab37513c",
|
|
41
|
+
"@aztec/ethereum": "0.0.1-fake-ceab37513c",
|
|
42
|
+
"@aztec/foundation": "0.0.1-fake-ceab37513c",
|
|
43
|
+
"@aztec/kv-store": "0.0.1-fake-ceab37513c",
|
|
44
|
+
"@aztec/l1-artifacts": "0.0.1-fake-ceab37513c",
|
|
45
|
+
"@aztec/merkle-tree": "0.0.1-fake-ceab37513c",
|
|
46
|
+
"@aztec/node-keystore": "0.0.1-fake-ceab37513c",
|
|
47
|
+
"@aztec/noir-contracts.js": "0.0.1-fake-ceab37513c",
|
|
48
|
+
"@aztec/noir-noirc_abi": "0.0.1-fake-ceab37513c",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-fake-ceab37513c",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "0.0.1-fake-ceab37513c",
|
|
51
|
+
"@aztec/p2p": "0.0.1-fake-ceab37513c",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-fake-ceab37513c",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-fake-ceab37513c",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-fake-ceab37513c",
|
|
55
|
+
"@aztec/pxe": "0.0.1-fake-ceab37513c",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-fake-ceab37513c",
|
|
57
|
+
"@aztec/simulator": "0.0.1-fake-ceab37513c",
|
|
58
|
+
"@aztec/slasher": "0.0.1-fake-ceab37513c",
|
|
59
|
+
"@aztec/stdlib": "0.0.1-fake-ceab37513c",
|
|
60
|
+
"@aztec/telemetry-client": "0.0.1-fake-ceab37513c",
|
|
61
|
+
"@aztec/validator-client": "0.0.1-fake-ceab37513c",
|
|
62
|
+
"@aztec/world-state": "0.0.1-fake-ceab37513c",
|
|
59
63
|
"@iarna/toml": "^2.2.5",
|
|
60
|
-
"@jest/globals": "^
|
|
61
|
-
"@noble/curves": "
|
|
64
|
+
"@jest/globals": "^30.0.0",
|
|
65
|
+
"@noble/curves": "=1.0.0",
|
|
62
66
|
"@swc/core": "^1.4.11",
|
|
63
67
|
"@swc/jest": "^0.2.36",
|
|
64
68
|
"@types/fs-extra": "^11.0.2",
|
|
65
|
-
"@types/jest": "^
|
|
66
|
-
"@types/koa": "^2.
|
|
69
|
+
"@types/jest": "^30.0.0",
|
|
70
|
+
"@types/koa": "^2.15.0",
|
|
67
71
|
"@types/koa-static": "^4.0.2",
|
|
68
|
-
"@types/levelup": "^5.1.2",
|
|
69
72
|
"@types/lodash.every": "^4.6.7",
|
|
70
|
-
"@types/
|
|
71
|
-
"@types/node": "^18.7.23",
|
|
73
|
+
"@types/node": "^22.15.17",
|
|
72
74
|
"@viem/anvil": "^0.0.9",
|
|
73
75
|
"buffer": "^6.0.3",
|
|
74
|
-
"crypto-browserify": "^3.12.
|
|
76
|
+
"crypto-browserify": "^3.12.1",
|
|
75
77
|
"fs-extra": "^11.2.0",
|
|
76
78
|
"get-port": "^7.1.0",
|
|
77
79
|
"glob": "^10.3.10",
|
|
78
|
-
"jest": "^
|
|
79
|
-
"jest-extended": "^
|
|
80
|
-
"jest-mock-extended": "^
|
|
81
|
-
"koa": "^2.
|
|
80
|
+
"jest": "^30.0.0",
|
|
81
|
+
"jest-extended": "^6.0.0",
|
|
82
|
+
"jest-mock-extended": "^4.0.0",
|
|
83
|
+
"koa": "^2.16.1",
|
|
82
84
|
"koa-static": "^5.0.0",
|
|
83
|
-
"levelup": "^5.1.1",
|
|
84
85
|
"lodash.chunk": "^4.2.0",
|
|
85
86
|
"lodash.compact": "^3.0.1",
|
|
86
87
|
"lodash.every": "^4.6.0",
|
|
87
88
|
"lodash.omit": "^4.5.0",
|
|
88
|
-
"
|
|
89
|
+
"msgpackr": "^1.11.2",
|
|
89
90
|
"process": "^0.11.10",
|
|
91
|
+
"snappy": "^7.2.2",
|
|
90
92
|
"stream-browserify": "^3.0.0",
|
|
91
93
|
"string-argv": "^0.3.2",
|
|
92
|
-
"ts-loader": "^9.
|
|
94
|
+
"ts-loader": "^9.5.4",
|
|
93
95
|
"ts-node": "^10.9.1",
|
|
94
96
|
"tslib": "^2.4.0",
|
|
95
|
-
"typescript": "^5.
|
|
97
|
+
"typescript": "^5.3.3",
|
|
96
98
|
"util": "^0.12.5",
|
|
97
|
-
"viem": "2.
|
|
99
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0",
|
|
98
100
|
"zod": "^3.23.8"
|
|
99
101
|
},
|
|
100
102
|
"devDependencies": {
|
|
101
103
|
"0x": "^5.7.0",
|
|
102
|
-
"@jest/globals": "^
|
|
103
|
-
"@types/jest": "^
|
|
104
|
+
"@jest/globals": "^30.0.0",
|
|
105
|
+
"@types/jest": "^30.0.0",
|
|
104
106
|
"@types/js-yaml": "^4.0.9",
|
|
105
107
|
"@types/lodash.chunk": "^4.2.9",
|
|
106
108
|
"concurrently": "^7.6.0",
|
|
107
|
-
"jest": "^
|
|
108
|
-
"jest-extended": "^
|
|
109
|
+
"jest": "^30.0.0",
|
|
110
|
+
"jest-extended": "^6.0.0",
|
|
109
111
|
"js-yaml": "^4.1.0",
|
|
110
112
|
"ts-node": "^10.9.1",
|
|
111
|
-
"typescript": "^5.
|
|
113
|
+
"typescript": "^5.3.3"
|
|
112
114
|
},
|
|
113
115
|
"files": [
|
|
114
116
|
"dest",
|
|
@@ -117,11 +119,12 @@
|
|
|
117
119
|
],
|
|
118
120
|
"types": "./dest/index.d.ts",
|
|
119
121
|
"engines": {
|
|
120
|
-
"node": ">=
|
|
122
|
+
"node": ">=20.10"
|
|
121
123
|
},
|
|
122
124
|
"jest": {
|
|
123
125
|
"slowTestThreshold": 300,
|
|
124
126
|
"setupFilesAfterEnv": [
|
|
127
|
+
"../../foundation/src/jest/setupAfterEnv.mjs",
|
|
125
128
|
"jest-extended/all",
|
|
126
129
|
"./shared/jest_setup.ts"
|
|
127
130
|
],
|
|
@@ -155,6 +158,7 @@
|
|
|
155
158
|
"testTimeout": 120000,
|
|
156
159
|
"setupFiles": [
|
|
157
160
|
"../../foundation/src/jest/setup.mjs"
|
|
158
|
-
]
|
|
161
|
+
],
|
|
162
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs"
|
|
159
163
|
}
|
|
160
164
|
}
|