@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +4 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +10 -30
- package/dest/bench/utils.d.ts +3 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +17 -37
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
- 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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
- 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 +35 -35
- package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +20 -12
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +36 -27
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +14 -11
- package/dest/e2e_fees/fees_test.d.ts +13 -9
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +39 -40
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +9 -8
- package/dest/e2e_multi_validator/utils.d.ts +2 -2
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_multi_validator/utils.js +4 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
- 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 +136 -0
- package/dest/e2e_p2p/p2p_network.d.ts +238 -18
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +50 -25
- package/dest/e2e_p2p/shared.d.ts +16 -17
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +57 -56
- package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +13 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +57 -66
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts +12 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +50 -24
- package/dest/fixtures/snapshot_manager.d.ts +16 -15
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +84 -88
- package/dest/fixtures/token_utils.d.ts +10 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +17 -18
- package/dest/fixtures/utils.d.ts +44 -47
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +128 -185
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts +2 -2
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +20 -23
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +10 -17
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +11 -8
- package/dest/shared/index.d.ts +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +13 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +44 -58
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +4 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +8 -5
- package/dest/simulators/token_simulator.d.ts +4 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +22 -14
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +144 -86
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +101 -16
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +414 -52
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
- package/src/bench/client_flows/data_extractor.ts +9 -31
- package/src/bench/utils.ts +15 -39
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
- package/src/e2e_deploy_contract/deploy_test.ts +18 -36
- package/src/e2e_epochs/epochs_test.ts +59 -42
- package/src/e2e_fees/bridging_race.notest.ts +16 -11
- package/src/e2e_fees/fees_test.ts +48 -52
- package/src/e2e_l1_publisher/write_json.ts +12 -9
- package/src/e2e_multi_validator/utils.ts +5 -11
- package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +125 -89
- package/src/e2e_p2p/shared.ts +69 -60
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +65 -105
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +2 -2
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +79 -32
- package/src/fixtures/snapshot_manager.ts +120 -131
- package/src/fixtures/token_utils.ts +16 -24
- package/src/fixtures/utils.ts +175 -269
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +3 -11
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +23 -31
- package/src/shared/gas_portal_test_harness.ts +14 -21
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +80 -88
- package/src/simulators/lending_simulator.ts +9 -6
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +15 -3
- package/src/spartan/setup_test_wallets.ts +171 -127
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +543 -45
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/src/fixtures/setup_l1_contracts.ts +0 -26
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
|
|
3
|
-
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
1
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
4
2
|
import { createLogger, logger } from '@aztec/foundation/log';
|
|
5
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
6
4
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
@@ -11,26 +9,7 @@ import { Decoder } from 'msgpackr';
|
|
|
11
9
|
import { readFile, readdir, writeFile } from 'node:fs/promises';
|
|
12
10
|
import { join } from 'node:path';
|
|
13
11
|
|
|
14
|
-
import { type Log,
|
|
15
|
-
|
|
16
|
-
type NativeProverConfig = { bbBinaryPath?: string; bbWorkingDirectory?: string };
|
|
17
|
-
|
|
18
|
-
async function createProver(config: NativeProverConfig = {}, log: Logger) {
|
|
19
|
-
const simulator = new WASMSimulator();
|
|
20
|
-
if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
|
|
21
|
-
return { prover: new BBWASMBundlePrivateKernelProver(simulator, 16, log), type: 'wasm' as ProverType };
|
|
22
|
-
} else {
|
|
23
|
-
const bbConfig = config as Required<NativeProverConfig>;
|
|
24
|
-
return {
|
|
25
|
-
prover: await BBNativePrivateKernelProver.new(
|
|
26
|
-
{ bbSkipCleanup: false, numConcurrentIVCVerifiers: 1, bbIVCConcurrency: 1, ...bbConfig },
|
|
27
|
-
simulator,
|
|
28
|
-
log,
|
|
29
|
-
),
|
|
30
|
-
type: 'native' as ProverType,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
12
|
+
import { type Log, ProxyLogger, generateBenchmark } from './benchmark.js';
|
|
34
13
|
|
|
35
14
|
async function main() {
|
|
36
15
|
ProxyLogger.create();
|
|
@@ -41,12 +20,11 @@ async function main() {
|
|
|
41
20
|
}
|
|
42
21
|
const flows = await readdir(ivcFolder);
|
|
43
22
|
logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
23
|
+
const simulator = new WASMSimulator();
|
|
24
|
+
const log = proxyLogger.createLogger('bb:prover');
|
|
25
|
+
const prover = new BBBundlePrivateKernelProver(simulator, { logger: log });
|
|
48
26
|
|
|
49
|
-
const userLog = createLogger('
|
|
27
|
+
const userLog = createLogger('chonk_flows:data_processor');
|
|
50
28
|
|
|
51
29
|
for (const flow of flows) {
|
|
52
30
|
userLog.info(`Processing flow ${flow}`);
|
|
@@ -84,10 +62,10 @@ async function main() {
|
|
|
84
62
|
let provingTime;
|
|
85
63
|
try {
|
|
86
64
|
const provingTimer = new Timer();
|
|
87
|
-
await prover.
|
|
65
|
+
await prover.createChonkProof(privateExecutionSteps);
|
|
88
66
|
provingTime = provingTimer.ms();
|
|
89
67
|
} catch (e) {
|
|
90
|
-
userLog.error(`Failed to generate
|
|
68
|
+
userLog.error(`Failed to generate chonk proof for ${flow}`, e);
|
|
91
69
|
error = (e as Error).message;
|
|
92
70
|
}
|
|
93
71
|
// Extract logs from this run from the proxy and write them to disk unconditionally
|
|
@@ -96,7 +74,7 @@ async function main() {
|
|
|
96
74
|
if (!(profile.stats.timings as ProvingTimings).proving) {
|
|
97
75
|
(profile.stats.timings as ProvingTimings).proving = provingTime;
|
|
98
76
|
}
|
|
99
|
-
const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps,
|
|
77
|
+
const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, 'native', error);
|
|
100
78
|
await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
|
|
101
79
|
proxyLogger.flushLogs();
|
|
102
80
|
}
|
package/src/bench/utils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { mean, stdDev, times } from '@aztec/foundation/collection';
|
|
4
5
|
import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
|
|
5
|
-
import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
|
|
6
6
|
import type { MetricsType } from '@aztec/telemetry-client';
|
|
7
7
|
import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
8
8
|
|
|
@@ -22,9 +22,8 @@ export async function benchmarkSetup(
|
|
|
22
22
|
},
|
|
23
23
|
) {
|
|
24
24
|
const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
.deployed();
|
|
25
|
+
const defaultAccountAddress = context.accounts[0];
|
|
26
|
+
const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }).deployed();
|
|
28
27
|
context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
|
|
29
28
|
const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
|
|
30
29
|
const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
|
|
@@ -105,19 +104,22 @@ function getMetricValues(points: BenchmarkDataPoint[]) {
|
|
|
105
104
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
106
105
|
* @returns A BatchCall instance.
|
|
107
106
|
*/
|
|
108
|
-
function makeCall(
|
|
107
|
+
async function makeCall(
|
|
109
108
|
index: number,
|
|
110
109
|
context: EndToEndContext,
|
|
111
110
|
contract: BenchmarkingContract,
|
|
112
111
|
heavyPublicCompute: boolean,
|
|
113
112
|
) {
|
|
114
|
-
const owner = context.wallet.getAddress();
|
|
115
113
|
if (heavyPublicCompute) {
|
|
116
|
-
return new BatchCall(context.wallet, [contract.methods.
|
|
114
|
+
return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
|
|
117
115
|
} else {
|
|
116
|
+
// We use random address for the new note owner because we can emit at most UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN
|
|
117
|
+
// logs for a given sender-recipient-contract tuple.
|
|
118
|
+
const ownerOfNewNote = await AztecAddress.random();
|
|
119
|
+
const [ownerOfBalance] = context.accounts;
|
|
118
120
|
return new BatchCall(context.wallet, [
|
|
119
|
-
contract.methods.create_note(
|
|
120
|
-
contract.methods.increment_balance(
|
|
121
|
+
contract.methods.create_note(ownerOfNewNote, index + 1),
|
|
122
|
+
contract.methods.increment_balance(ownerOfBalance, index + 1),
|
|
121
123
|
]);
|
|
122
124
|
}
|
|
123
125
|
}
|
|
@@ -137,11 +139,11 @@ export async function sendTxs(
|
|
|
137
139
|
contract: BenchmarkingContract,
|
|
138
140
|
heavyPublicCompute: boolean = false,
|
|
139
141
|
): Promise<SentTx[]> {
|
|
140
|
-
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
142
|
+
const calls = await Promise.all(times(txCount, index => makeCall(index, context, contract, heavyPublicCompute)));
|
|
141
143
|
context.logger.info(`Creating ${txCount} txs`);
|
|
142
|
-
const
|
|
144
|
+
const [from] = context.accounts;
|
|
143
145
|
context.logger.info(`Sending ${txCount} txs`);
|
|
144
|
-
return
|
|
146
|
+
return calls.map(call => call.send({ from }));
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
|
|
@@ -150,32 +152,6 @@ export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpt
|
|
|
150
152
|
context.logger.info(`All ${txs.length} txs have been mined`);
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
/**
|
|
154
|
-
* Creates a new PXE
|
|
155
|
-
* @param node - Node to connect the pxe to.
|
|
156
|
-
* @param contract - Benchmark contract to add to the pxe.
|
|
157
|
-
* @param startingBlock - First l2 block to process.
|
|
158
|
-
* @returns The new PXE.
|
|
159
|
-
*/
|
|
160
|
-
export async function createNewPXE(node: AztecNode, contract: BenchmarkingContract): Promise<PXEService> {
|
|
161
|
-
const l1Contracts = await node.getL1ContractAddresses();
|
|
162
|
-
const { l1ChainId, rollupVersion } = await node.getNodeInfo();
|
|
163
|
-
const pxeConfig = {
|
|
164
|
-
l2BlockBatchSize: 50,
|
|
165
|
-
l2BlockPollingIntervalMS: 100,
|
|
166
|
-
dataDirectory: undefined,
|
|
167
|
-
dataStoreMapSizeKB: 1024 * 1024,
|
|
168
|
-
l1Contracts,
|
|
169
|
-
l1ChainId,
|
|
170
|
-
rollupVersion,
|
|
171
|
-
} as PXEServiceConfig;
|
|
172
|
-
// docs:start:PXEcreate
|
|
173
|
-
const pxe = await createPXEService(node, pxeConfig);
|
|
174
|
-
// docs:end:PXEcreate
|
|
175
|
-
await pxe.registerContract(contract);
|
|
176
|
-
return pxe;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
155
|
function randomBytesAsBigInts(length: number): bigint[] {
|
|
180
156
|
return [...Array(length)].map(_ => BigInt(Math.floor(Math.random() * 255)));
|
|
181
157
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Fr,
|
|
8
|
-
type Logger,
|
|
9
|
-
type PXE,
|
|
10
|
-
type TxHash,
|
|
11
|
-
computeSecretHash,
|
|
12
|
-
createLogger,
|
|
13
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { computeSecretHash } from '@aztec/aztec.js/crypto';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
14
7
|
import type { CheatCodes } from '@aztec/aztec/testing';
|
|
15
8
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
16
9
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
17
10
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
18
11
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
12
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
19
13
|
|
|
20
14
|
import { jest } from '@jest/globals';
|
|
21
15
|
|
|
@@ -63,9 +57,7 @@ export class BlacklistTokenContractTest {
|
|
|
63
57
|
|
|
64
58
|
private snapshotManager: ISnapshotManager;
|
|
65
59
|
logger: Logger;
|
|
66
|
-
|
|
67
|
-
pxe!: PXE;
|
|
68
|
-
accounts: CompleteAddress[] = [];
|
|
60
|
+
wallet!: TestWallet;
|
|
69
61
|
asset!: TokenBlacklistContract;
|
|
70
62
|
tokenSim!: TokenSimulator;
|
|
71
63
|
badAccount!: InvalidAccountContract;
|
|
@@ -73,11 +65,8 @@ export class BlacklistTokenContractTest {
|
|
|
73
65
|
sequencer!: SequencerClient;
|
|
74
66
|
aztecNode!: AztecNode;
|
|
75
67
|
|
|
76
|
-
admin!: AccountWallet;
|
|
77
68
|
adminAddress!: AztecAddress;
|
|
78
|
-
other!: AccountWallet;
|
|
79
69
|
otherAddress!: AztecAddress;
|
|
80
|
-
blacklisted!: AccountWallet;
|
|
81
70
|
blacklistedAddress!: AztecAddress;
|
|
82
71
|
|
|
83
72
|
constructor(testName: string) {
|
|
@@ -105,19 +94,15 @@ export class BlacklistTokenContractTest {
|
|
|
105
94
|
await this.snapshotManager.snapshot(
|
|
106
95
|
'3_accounts',
|
|
107
96
|
deployAccounts(3, this.logger),
|
|
108
|
-
|
|
109
|
-
this.pxe = pxe;
|
|
97
|
+
({ deployedAccounts }, { cheatCodes, aztecNode, sequencer, wallet }) => {
|
|
110
98
|
this.cheatCodes = cheatCodes;
|
|
111
99
|
this.aztecNode = aztecNode;
|
|
112
100
|
this.sequencer = sequencer;
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
this.blacklisted = this.wallets[2];
|
|
119
|
-
this.blacklistedAddress = this.blacklisted.getAddress();
|
|
120
|
-
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
101
|
+
this.wallet = wallet;
|
|
102
|
+
this.adminAddress = deployedAccounts[0].address;
|
|
103
|
+
this.otherAddress = deployedAccounts[1].address;
|
|
104
|
+
this.blacklistedAddress = deployedAccounts[2].address;
|
|
105
|
+
return Promise.resolve();
|
|
121
106
|
},
|
|
122
107
|
);
|
|
123
108
|
|
|
@@ -127,16 +112,16 @@ export class BlacklistTokenContractTest {
|
|
|
127
112
|
// Create the token contract state.
|
|
128
113
|
// Move this account thing to addAccounts above?
|
|
129
114
|
this.logger.verbose(`Public deploy accounts...`);
|
|
130
|
-
await publicDeployAccounts(this.
|
|
115
|
+
await publicDeployAccounts(this.wallet, [this.adminAddress, this.otherAddress, this.blacklistedAddress]);
|
|
131
116
|
|
|
132
117
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
133
|
-
this.asset = await TokenBlacklistContract.deploy(this.
|
|
118
|
+
this.asset = await TokenBlacklistContract.deploy(this.wallet, this.adminAddress)
|
|
134
119
|
.send({ from: this.adminAddress })
|
|
135
120
|
.deployed();
|
|
136
121
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
137
122
|
|
|
138
123
|
this.logger.verbose(`Deploying bad account...`);
|
|
139
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
124
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
|
|
140
125
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
141
126
|
|
|
142
127
|
await this.crossTimestampOfChange();
|
|
@@ -145,18 +130,18 @@ export class BlacklistTokenContractTest {
|
|
|
145
130
|
},
|
|
146
131
|
async ({ tokenContractAddress, badAccountAddress }) => {
|
|
147
132
|
// Restore the token contract state.
|
|
148
|
-
this.asset =
|
|
133
|
+
this.asset = TokenBlacklistContract.at(tokenContractAddress, this.wallet);
|
|
149
134
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
150
135
|
|
|
151
136
|
this.tokenSim = new TokenSimulator(
|
|
152
137
|
this.asset as unknown as TokenContract,
|
|
153
|
-
this.
|
|
138
|
+
this.wallet,
|
|
154
139
|
this.adminAddress,
|
|
155
140
|
this.logger,
|
|
156
|
-
this.
|
|
141
|
+
[this.adminAddress, this.otherAddress, this.blacklistedAddress],
|
|
157
142
|
);
|
|
158
143
|
|
|
159
|
-
this.badAccount =
|
|
144
|
+
this.badAccount = InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
160
145
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
161
146
|
|
|
162
147
|
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
@@ -187,7 +172,7 @@ export class BlacklistTokenContractTest {
|
|
|
187
172
|
secretHash: Fr,
|
|
188
173
|
txHash: TxHash,
|
|
189
174
|
) {
|
|
190
|
-
const txEffects = await this.
|
|
175
|
+
const txEffects = await this.aztecNode.getTxEffect(txHash);
|
|
191
176
|
await contract.methods
|
|
192
177
|
.deliver_transparent_note(
|
|
193
178
|
contract.address,
|
|
@@ -205,40 +190,38 @@ export class BlacklistTokenContractTest {
|
|
|
205
190
|
await this.snapshotManager.snapshot(
|
|
206
191
|
'mint',
|
|
207
192
|
async () => {
|
|
208
|
-
const { asset
|
|
193
|
+
const { asset } = this;
|
|
209
194
|
const amount = 10000n;
|
|
210
195
|
|
|
211
196
|
const adminMinterRole = new Role().withAdmin().withMinter();
|
|
212
|
-
await this.asset
|
|
213
|
-
.
|
|
214
|
-
.methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
|
|
197
|
+
await this.asset.methods
|
|
198
|
+
.update_roles(this.adminAddress, adminMinterRole.toNoirStruct())
|
|
215
199
|
.send({ from: this.adminAddress })
|
|
216
200
|
.wait();
|
|
217
201
|
|
|
218
202
|
const blacklistRole = new Role().withBlacklisted();
|
|
219
|
-
await this.asset
|
|
220
|
-
.
|
|
221
|
-
.methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
|
|
203
|
+
await this.asset.methods
|
|
204
|
+
.update_roles(this.blacklistedAddress, blacklistRole.toNoirStruct())
|
|
222
205
|
.send({ from: this.adminAddress })
|
|
223
206
|
.wait();
|
|
224
207
|
|
|
225
208
|
await this.crossTimestampOfChange();
|
|
226
209
|
|
|
227
|
-
expect(
|
|
228
|
-
|
|
229
|
-
)
|
|
210
|
+
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
211
|
+
adminMinterRole.toNoirStruct(),
|
|
212
|
+
);
|
|
230
213
|
|
|
231
214
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
232
|
-
await asset.methods.mint_public(
|
|
215
|
+
await asset.methods.mint_public(this.adminAddress, amount).send({ from: this.adminAddress }).wait();
|
|
233
216
|
|
|
234
217
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
235
218
|
const secret = Fr.random();
|
|
236
219
|
const secretHash = await computeSecretHash(secret);
|
|
237
220
|
const receipt = await asset.methods.mint_private(amount, secretHash).send({ from: this.adminAddress }).wait();
|
|
238
221
|
|
|
239
|
-
await this.addPendingShieldNoteToPXE(asset,
|
|
222
|
+
await this.addPendingShieldNoteToPXE(asset, this.adminAddress, amount, secretHash, receipt.txHash);
|
|
240
223
|
const txClaim = asset.methods
|
|
241
|
-
.redeem_shield(
|
|
224
|
+
.redeem_shield(this.adminAddress, amount, secret)
|
|
242
225
|
.send({ from: this.adminAddress });
|
|
243
226
|
await txClaim.wait();
|
|
244
227
|
this.logger.verbose(`Minting complete.`);
|
|
@@ -246,23 +229,23 @@ export class BlacklistTokenContractTest {
|
|
|
246
229
|
return { amount };
|
|
247
230
|
},
|
|
248
231
|
async ({ amount }) => {
|
|
249
|
-
const {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
232
|
+
const { asset, tokenSim } = this;
|
|
233
|
+
tokenSim.mintPublic(this.adminAddress, amount);
|
|
234
|
+
|
|
235
|
+
const publicBalance = await asset.methods
|
|
236
|
+
.balance_of_public(this.adminAddress)
|
|
237
|
+
.simulate({ from: this.adminAddress });
|
|
257
238
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
258
|
-
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(
|
|
239
|
+
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(this.adminAddress));
|
|
259
240
|
|
|
260
|
-
tokenSim.mintPrivate(
|
|
261
|
-
const privateBalance = await asset.methods
|
|
241
|
+
tokenSim.mintPrivate(this.adminAddress, amount);
|
|
242
|
+
const privateBalance = await asset.methods
|
|
243
|
+
.balance_of_private(this.adminAddress)
|
|
244
|
+
.simulate({ from: this.adminAddress });
|
|
262
245
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
263
|
-
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(
|
|
246
|
+
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(this.adminAddress));
|
|
264
247
|
|
|
265
|
-
const totalSupply = await asset.methods.total_supply().simulate({ from:
|
|
248
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: this.adminAddress });
|
|
266
249
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
267
250
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
268
251
|
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type AztecNode,
|
|
7
|
-
type CompleteAddress,
|
|
8
|
-
EthAddress,
|
|
9
|
-
type Logger,
|
|
10
|
-
type PXE,
|
|
11
|
-
createLogger,
|
|
12
|
-
} from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
13
5
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from '@aztec/ethereum';
|
|
6
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
7
|
+
import type {
|
|
8
|
+
DeployAztecL1ContractsArgs,
|
|
9
|
+
DeployAztecL1ContractsReturnType,
|
|
10
|
+
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
11
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
12
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
20
13
|
import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
21
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
22
15
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
23
16
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
17
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
24
18
|
|
|
25
19
|
import { getContract } from 'viem';
|
|
26
20
|
|
|
@@ -32,6 +26,7 @@ import {
|
|
|
32
26
|
deployAccounts,
|
|
33
27
|
publicDeployAccounts,
|
|
34
28
|
} from '../fixtures/snapshot_manager.js';
|
|
29
|
+
import type { SetupOptions } from '../fixtures/utils.js';
|
|
35
30
|
import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
|
|
36
31
|
|
|
37
32
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
@@ -39,21 +34,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
39
34
|
export class CrossChainMessagingTest {
|
|
40
35
|
private snapshotManager: ISnapshotManager;
|
|
41
36
|
logger: Logger;
|
|
42
|
-
accounts: CompleteAddress[] = [];
|
|
43
37
|
aztecNode!: AztecNode;
|
|
44
|
-
pxe!: PXE;
|
|
45
38
|
aztecNodeConfig!: AztecNodeConfig;
|
|
46
39
|
aztecNodeAdmin!: AztecNodeAdmin;
|
|
40
|
+
ctx!: SubsystemsContext;
|
|
47
41
|
|
|
48
42
|
l1Client!: ExtendedViemWalletClient | undefined;
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
wallet!: TestWallet;
|
|
45
|
+
ownerAddress!: AztecAddress;
|
|
51
46
|
user1Address!: AztecAddress;
|
|
52
|
-
user2Wallet!: AccountWallet;
|
|
53
47
|
user2Address!: AztecAddress;
|
|
54
48
|
crossChainTestHarness!: CrossChainTestHarness;
|
|
55
49
|
ethAccount!: EthAddress;
|
|
56
|
-
ownerAddress!: AztecAddress;
|
|
57
50
|
l2Token!: TokenContract;
|
|
58
51
|
l2Bridge!: TokenBridgeContract;
|
|
59
52
|
|
|
@@ -61,11 +54,18 @@ export class CrossChainMessagingTest {
|
|
|
61
54
|
outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
|
|
62
55
|
cheatCodes!: CheatCodes;
|
|
63
56
|
|
|
64
|
-
deployL1ContractsValues!:
|
|
57
|
+
deployL1ContractsValues!: DeployAztecL1ContractsReturnType;
|
|
65
58
|
|
|
66
|
-
constructor(
|
|
59
|
+
constructor(
|
|
60
|
+
testName: string,
|
|
61
|
+
opts: SetupOptions = {},
|
|
62
|
+
deployL1ContractsArgs: Partial<DeployAztecL1ContractsArgs> = {},
|
|
63
|
+
) {
|
|
67
64
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
68
|
-
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath
|
|
65
|
+
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
|
|
66
|
+
initialValidators: [],
|
|
67
|
+
...deployL1ContractsArgs,
|
|
68
|
+
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
async assumeProven() {
|
|
@@ -73,13 +73,13 @@ export class CrossChainMessagingTest {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
async setup() {
|
|
76
|
-
|
|
77
|
-
this.aztecNode = aztecNode;
|
|
78
|
-
this.
|
|
79
|
-
this.aztecNodeConfig = aztecNodeConfig;
|
|
80
|
-
this.cheatCodes =
|
|
81
|
-
this.deployL1ContractsValues = deployL1ContractsValues;
|
|
82
|
-
this.aztecNodeAdmin = aztecNode;
|
|
76
|
+
this.ctx = await this.snapshotManager.setup();
|
|
77
|
+
this.aztecNode = this.ctx.aztecNode;
|
|
78
|
+
this.wallet = this.ctx.wallet;
|
|
79
|
+
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
80
|
+
this.cheatCodes = this.ctx.cheatCodes;
|
|
81
|
+
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
82
|
+
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
snapshot = <T>(
|
|
@@ -93,25 +93,18 @@ export class CrossChainMessagingTest {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
async applyBaseSnapshots() {
|
|
96
|
-
// Note that we are using the same `
|
|
96
|
+
// Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
|
|
97
97
|
// This is to not have issues with different networks.
|
|
98
98
|
|
|
99
99
|
await this.snapshotManager.snapshot(
|
|
100
100
|
'3_accounts',
|
|
101
101
|
deployAccounts(3, this.logger),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
105
|
-
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
106
|
-
|
|
107
|
-
this.user1Wallet = wallets[0];
|
|
108
|
-
this.user1Address = this.user1Wallet.getAddress();
|
|
109
|
-
this.user2Wallet = wallets[1];
|
|
110
|
-
this.user2Address = this.user2Wallet.getAddress();
|
|
111
|
-
|
|
112
|
-
this.pxe = pxe;
|
|
102
|
+
({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode }) => {
|
|
103
|
+
[this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map(a => a.address);
|
|
104
|
+
this.wallet = wallet;
|
|
113
105
|
this.aztecNode = aztecNode;
|
|
114
106
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
107
|
+
return Promise.resolve();
|
|
115
108
|
},
|
|
116
109
|
);
|
|
117
110
|
|
|
@@ -121,7 +114,7 @@ export class CrossChainMessagingTest {
|
|
|
121
114
|
// Create the token contract state.
|
|
122
115
|
// Move this account thing to addAccounts above?
|
|
123
116
|
this.logger.verbose(`Public deploy accounts...`);
|
|
124
|
-
await publicDeployAccounts(this.
|
|
117
|
+
await publicDeployAccounts(this.wallet, [this.ownerAddress, this.user1Address, this.user2Address]);
|
|
125
118
|
|
|
126
119
|
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
127
120
|
|
|
@@ -134,10 +127,9 @@ export class CrossChainMessagingTest {
|
|
|
134
127
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
135
128
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
136
129
|
this.aztecNode,
|
|
137
|
-
this.pxe,
|
|
138
130
|
this.l1Client,
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
131
|
+
this.wallet,
|
|
132
|
+
this.ownerAddress,
|
|
141
133
|
this.logger,
|
|
142
134
|
underlyingERC20Address,
|
|
143
135
|
);
|
|
@@ -146,13 +138,12 @@ export class CrossChainMessagingTest {
|
|
|
146
138
|
|
|
147
139
|
return this.crossChainTestHarness.toCrossChainContext();
|
|
148
140
|
},
|
|
149
|
-
|
|
150
|
-
this.l2Token =
|
|
151
|
-
this.l2Bridge =
|
|
141
|
+
crossChainContext => {
|
|
142
|
+
this.l2Token = TokenContract.at(crossChainContext.l2Token, this.wallet);
|
|
143
|
+
this.l2Bridge = TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
|
|
152
144
|
|
|
153
145
|
// There is an issue with the reviver so we are getting strings sometimes. Working around it here.
|
|
154
146
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
155
|
-
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
156
147
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
157
148
|
|
|
158
149
|
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
@@ -170,7 +161,6 @@ export class CrossChainMessagingTest {
|
|
|
170
161
|
|
|
171
162
|
this.crossChainTestHarness = new CrossChainTestHarness(
|
|
172
163
|
this.aztecNode,
|
|
173
|
-
this.pxe,
|
|
174
164
|
this.logger,
|
|
175
165
|
this.l2Token,
|
|
176
166
|
this.l2Bridge,
|
|
@@ -179,13 +169,14 @@ export class CrossChainMessagingTest {
|
|
|
179
169
|
crossChainContext.underlying,
|
|
180
170
|
l1Client,
|
|
181
171
|
this.aztecNodeConfig.l1Contracts,
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
172
|
+
this.wallet,
|
|
173
|
+
this.ownerAddress,
|
|
184
174
|
);
|
|
185
175
|
|
|
186
176
|
this.l1Client = l1Client;
|
|
187
177
|
this.inbox = inbox;
|
|
188
178
|
this.outbox = outbox;
|
|
179
|
+
return Promise.resolve();
|
|
189
180
|
},
|
|
190
181
|
);
|
|
191
182
|
}
|