@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/src/bench/utils.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { type AztecNode, BatchCall,
|
|
3
|
-
import { mean, stdDev,
|
|
4
|
-
import {
|
|
5
|
-
import { BenchmarkingContract } from '@aztec/noir-contracts.js/Benchmarking';
|
|
2
|
+
import { type AztecNode, BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js';
|
|
3
|
+
import { mean, stdDev, times } from '@aztec/foundation/collection';
|
|
4
|
+
import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
|
|
6
5
|
import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe/server';
|
|
7
6
|
import type { MetricsType } from '@aztec/telemetry-client';
|
|
8
7
|
import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
9
8
|
|
|
10
|
-
import { writeFileSync } from 'fs';
|
|
11
|
-
import
|
|
12
|
-
import { globSync } from 'glob';
|
|
13
|
-
import { join } from 'path';
|
|
9
|
+
import { mkdirSync, writeFileSync } from 'fs';
|
|
10
|
+
import path from 'path';
|
|
14
11
|
|
|
15
12
|
import { type EndToEndContext, type SetupOptions, setup } from '../fixtures/utils.js';
|
|
16
13
|
|
|
@@ -25,7 +22,9 @@ export async function benchmarkSetup(
|
|
|
25
22
|
},
|
|
26
23
|
) {
|
|
27
24
|
const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
|
|
28
|
-
const contract = await BenchmarkingContract.deploy(context.wallet)
|
|
25
|
+
const contract = await BenchmarkingContract.deploy(context.wallet)
|
|
26
|
+
.send({ from: context.wallet.getAddress() })
|
|
27
|
+
.deployed();
|
|
29
28
|
context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
|
|
30
29
|
const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
|
|
31
30
|
const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
|
|
@@ -36,7 +35,11 @@ export async function benchmarkSetup(
|
|
|
36
35
|
await telemetry.flush();
|
|
37
36
|
const data = telemetry.getMeters();
|
|
38
37
|
const formatted = formatMetricsForGithubBenchmarkAction(data, opts.metrics);
|
|
38
|
+
if (formatted.length === 0) {
|
|
39
|
+
throw new Error(`No benchmark data generated. Please review your test setup.`);
|
|
40
|
+
}
|
|
39
41
|
const benchOutput = opts.benchOutput ?? process.env.BENCH_OUTPUT ?? 'bench.json';
|
|
42
|
+
mkdirSync(path.dirname(benchOutput), { recursive: true });
|
|
40
43
|
writeFileSync(benchOutput, JSON.stringify(formatted));
|
|
41
44
|
context.logger.info(`Wrote ${data.length} metrics to ${benchOutput}`);
|
|
42
45
|
await origTeardown();
|
|
@@ -52,7 +55,7 @@ type MetricFilter = {
|
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
// See https://github.com/benchmark-action/github-action-benchmark/blob/e3c661617bc6aa55f26ae4457c737a55545a86a4/src/extract.ts#L659-L670
|
|
55
|
-
type GithubActionBenchmarkResult = {
|
|
58
|
+
export type GithubActionBenchmarkResult = {
|
|
56
59
|
name: string;
|
|
57
60
|
value: number;
|
|
58
61
|
range?: string;
|
|
@@ -91,30 +94,6 @@ function getMetricValues(points: BenchmarkDataPoint[]) {
|
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
/**
|
|
95
|
-
* Creates and returns a directory with the current job name and a random number.
|
|
96
|
-
* @param index - Index to merge into the dir path.
|
|
97
|
-
* @returns A path to a created dir.
|
|
98
|
-
*/
|
|
99
|
-
export function makeDataDirectory(index: number) {
|
|
100
|
-
const testName = expect.getState().currentTestName!.split(' ')[0].replaceAll('/', '_');
|
|
101
|
-
const db = join('data', testName, index.toString(), `${randomInt(99)}`);
|
|
102
|
-
mkdirpSync(db);
|
|
103
|
-
return db;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Returns the size in disk of a folder.
|
|
108
|
-
* @param path - Path to the folder.
|
|
109
|
-
* @returns Size in bytes.
|
|
110
|
-
*/
|
|
111
|
-
export function getFolderSize(path: string): number {
|
|
112
|
-
return globSync('**', { stat: true, cwd: path, nodir: true, withFileTypes: true }).reduce(
|
|
113
|
-
(accum, file) => accum + (file as any as { /** Size */ size: number }).size,
|
|
114
|
-
0,
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
97
|
/**
|
|
119
98
|
* Returns a call to the benchmark contract. Each call has a private execution (account entrypoint),
|
|
120
99
|
* a nested private call (create_note), a public call (increment_balance), and a nested public
|
|
@@ -126,22 +105,19 @@ export function getFolderSize(path: string): number {
|
|
|
126
105
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
127
106
|
* @returns A BatchCall instance.
|
|
128
107
|
*/
|
|
129
|
-
|
|
108
|
+
function makeCall(
|
|
130
109
|
index: number,
|
|
131
110
|
context: EndToEndContext,
|
|
132
111
|
contract: BenchmarkingContract,
|
|
133
112
|
heavyPublicCompute: boolean,
|
|
134
113
|
) {
|
|
135
114
|
const owner = context.wallet.getAddress();
|
|
136
|
-
const sender = owner;
|
|
137
115
|
if (heavyPublicCompute) {
|
|
138
|
-
return new BatchCall(context.wallet, [
|
|
139
|
-
await contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048)).request(),
|
|
140
|
-
]);
|
|
116
|
+
return new BatchCall(context.wallet, [contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048))]);
|
|
141
117
|
} else {
|
|
142
118
|
return new BatchCall(context.wallet, [
|
|
143
|
-
|
|
144
|
-
|
|
119
|
+
contract.methods.create_note(owner, index + 1),
|
|
120
|
+
contract.methods.increment_balance(owner, index + 1),
|
|
145
121
|
]);
|
|
146
122
|
}
|
|
147
123
|
}
|
|
@@ -161,9 +137,9 @@ export async function sendTxs(
|
|
|
161
137
|
contract: BenchmarkingContract,
|
|
162
138
|
heavyPublicCompute: boolean = false,
|
|
163
139
|
): Promise<SentTx[]> {
|
|
164
|
-
const calls =
|
|
140
|
+
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
165
141
|
context.logger.info(`Creating ${txCount} txs`);
|
|
166
|
-
const provenTxs = await Promise.all(calls.map(call => call.prove({
|
|
142
|
+
const provenTxs = await Promise.all(calls.map(call => call.prove({ from: context.wallet.getAddress() })));
|
|
167
143
|
context.logger.info(`Sending ${txCount} txs`);
|
|
168
144
|
return provenTxs.map(tx => tx.send());
|
|
169
145
|
}
|
|
@@ -181,23 +157,21 @@ export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpt
|
|
|
181
157
|
* @param startingBlock - First l2 block to process.
|
|
182
158
|
* @returns The new PXE.
|
|
183
159
|
*/
|
|
184
|
-
export async function createNewPXE(
|
|
185
|
-
node: AztecNode,
|
|
186
|
-
contract: BenchmarkingContract,
|
|
187
|
-
startingBlock: number = INITIAL_L2_BLOCK_NUM,
|
|
188
|
-
): Promise<PXEService> {
|
|
160
|
+
export async function createNewPXE(node: AztecNode, contract: BenchmarkingContract): Promise<PXEService> {
|
|
189
161
|
const l1Contracts = await node.getL1ContractAddresses();
|
|
190
|
-
const { l1ChainId,
|
|
162
|
+
const { l1ChainId, rollupVersion } = await node.getNodeInfo();
|
|
191
163
|
const pxeConfig = {
|
|
192
|
-
|
|
164
|
+
l2BlockBatchSize: 50,
|
|
193
165
|
l2BlockPollingIntervalMS: 100,
|
|
194
166
|
dataDirectory: undefined,
|
|
195
|
-
|
|
167
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
196
168
|
l1Contracts,
|
|
197
169
|
l1ChainId,
|
|
198
|
-
|
|
170
|
+
rollupVersion,
|
|
199
171
|
} as PXEServiceConfig;
|
|
172
|
+
// docs:start:PXEcreate
|
|
200
173
|
const pxe = await createPXEService(node, pxeConfig);
|
|
174
|
+
// docs:end:PXEcreate
|
|
201
175
|
await pxe.registerContract(contract);
|
|
202
176
|
return pxe;
|
|
203
177
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import {
|
|
3
3
|
type AccountWallet,
|
|
4
|
+
AztecAddress,
|
|
5
|
+
type AztecNode,
|
|
4
6
|
type CompleteAddress,
|
|
5
7
|
Fr,
|
|
6
8
|
type Logger,
|
|
9
|
+
type PXE,
|
|
7
10
|
type TxHash,
|
|
8
11
|
computeSecretHash,
|
|
9
12
|
createLogger,
|
|
10
13
|
} from '@aztec/aztec.js';
|
|
11
|
-
import {
|
|
12
|
-
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
14
|
+
import type { CheatCodes } from '@aztec/aztec/testing';
|
|
13
15
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
14
16
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
17
|
+
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
18
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
15
19
|
|
|
16
20
|
import { jest } from '@jest/globals';
|
|
17
21
|
|
|
@@ -54,31 +58,39 @@ export class Role {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
export class BlacklistTokenContractTest {
|
|
57
|
-
// A low delay is really poor ux, but we need to keep it low for the tests to run "quickly".
|
|
58
61
|
// This value MUST match the same value that we have in the contract
|
|
59
|
-
static
|
|
62
|
+
static CHANGE_ROLES_DELAY = 86400;
|
|
60
63
|
|
|
61
64
|
private snapshotManager: ISnapshotManager;
|
|
62
65
|
logger: Logger;
|
|
63
66
|
wallets: AccountWallet[] = [];
|
|
67
|
+
pxe!: PXE;
|
|
64
68
|
accounts: CompleteAddress[] = [];
|
|
65
69
|
asset!: TokenBlacklistContract;
|
|
66
70
|
tokenSim!: TokenSimulator;
|
|
67
|
-
badAccount!:
|
|
71
|
+
badAccount!: InvalidAccountContract;
|
|
72
|
+
cheatCodes!: CheatCodes;
|
|
73
|
+
sequencer!: SequencerClient;
|
|
74
|
+
aztecNode!: AztecNode;
|
|
68
75
|
|
|
69
76
|
admin!: AccountWallet;
|
|
77
|
+
adminAddress!: AztecAddress;
|
|
70
78
|
other!: AccountWallet;
|
|
79
|
+
otherAddress!: AztecAddress;
|
|
71
80
|
blacklisted!: AccountWallet;
|
|
81
|
+
blacklistedAddress!: AztecAddress;
|
|
72
82
|
|
|
73
83
|
constructor(testName: string) {
|
|
74
84
|
this.logger = createLogger(`e2e:e2e_blacklist_token_contract:${testName}`);
|
|
75
85
|
this.snapshotManager = createSnapshotManager(`e2e_blacklist_token_contract/${testName}`, dataPath);
|
|
76
86
|
}
|
|
77
87
|
|
|
78
|
-
async
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
async crossTimestampOfChange() {
|
|
89
|
+
await this.cheatCodes.warpL2TimeAtLeastBy(
|
|
90
|
+
this.sequencer,
|
|
91
|
+
this.aztecNode,
|
|
92
|
+
BlacklistTokenContractTest.CHANGE_ROLES_DELAY,
|
|
93
|
+
);
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
/**
|
|
@@ -93,11 +105,18 @@ export class BlacklistTokenContractTest {
|
|
|
93
105
|
await this.snapshotManager.snapshot(
|
|
94
106
|
'3_accounts',
|
|
95
107
|
deployAccounts(3, this.logger),
|
|
96
|
-
async ({ deployedAccounts }, { pxe }) => {
|
|
108
|
+
async ({ deployedAccounts }, { pxe, cheatCodes, aztecNode, sequencer }) => {
|
|
109
|
+
this.pxe = pxe;
|
|
110
|
+
this.cheatCodes = cheatCodes;
|
|
111
|
+
this.aztecNode = aztecNode;
|
|
112
|
+
this.sequencer = sequencer;
|
|
97
113
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
98
114
|
this.admin = this.wallets[0];
|
|
115
|
+
this.adminAddress = this.admin.getAddress();
|
|
99
116
|
this.other = this.wallets[1];
|
|
117
|
+
this.otherAddress = this.other.getAddress();
|
|
100
118
|
this.blacklisted = this.wallets[2];
|
|
119
|
+
this.blacklistedAddress = this.blacklisted.getAddress();
|
|
101
120
|
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
102
121
|
},
|
|
103
122
|
);
|
|
@@ -108,17 +127,19 @@ export class BlacklistTokenContractTest {
|
|
|
108
127
|
// Create the token contract state.
|
|
109
128
|
// Move this account thing to addAccounts above?
|
|
110
129
|
this.logger.verbose(`Public deploy accounts...`);
|
|
111
|
-
await publicDeployAccounts(this.
|
|
130
|
+
await publicDeployAccounts(this.admin, this.accounts.slice(0, 3));
|
|
112
131
|
|
|
113
132
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
114
|
-
this.asset = await TokenBlacklistContract.deploy(this.admin, this.
|
|
133
|
+
this.asset = await TokenBlacklistContract.deploy(this.admin, this.adminAddress)
|
|
134
|
+
.send({ from: this.adminAddress })
|
|
135
|
+
.deployed();
|
|
115
136
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
116
137
|
|
|
117
138
|
this.logger.verbose(`Deploying bad account...`);
|
|
118
|
-
this.badAccount = await
|
|
139
|
+
this.badAccount = await InvalidAccountContract.deploy(this.admin).send({ from: this.adminAddress }).deployed();
|
|
119
140
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
120
141
|
|
|
121
|
-
await this.
|
|
142
|
+
await this.crossTimestampOfChange();
|
|
122
143
|
|
|
123
144
|
return { tokenContractAddress: this.asset.address, badAccountAddress: this.badAccount.address };
|
|
124
145
|
},
|
|
@@ -129,15 +150,16 @@ export class BlacklistTokenContractTest {
|
|
|
129
150
|
|
|
130
151
|
this.tokenSim = new TokenSimulator(
|
|
131
152
|
this.asset as unknown as TokenContract,
|
|
132
|
-
this.
|
|
153
|
+
this.admin,
|
|
154
|
+
this.adminAddress,
|
|
133
155
|
this.logger,
|
|
134
156
|
this.accounts.map(a => a.address),
|
|
135
157
|
);
|
|
136
158
|
|
|
137
|
-
this.badAccount = await
|
|
159
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
|
|
138
160
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
139
161
|
|
|
140
|
-
expect(await this.asset.methods.get_roles(this.
|
|
162
|
+
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
141
163
|
new Role().withAdmin().toNoirStruct(),
|
|
142
164
|
);
|
|
143
165
|
},
|
|
@@ -158,29 +180,25 @@ export class BlacklistTokenContractTest {
|
|
|
158
180
|
await this.snapshotManager.teardown();
|
|
159
181
|
}
|
|
160
182
|
|
|
161
|
-
#toBoundedVec(arr: Fr[], maxLen: number) {
|
|
162
|
-
return { len: arr.length, storage: arr.concat(new Array(maxLen - arr.length).fill(new Fr(0))) };
|
|
163
|
-
}
|
|
164
|
-
|
|
165
183
|
async addPendingShieldNoteToPXE(
|
|
166
184
|
contract: TokenBlacklistContract,
|
|
167
|
-
|
|
185
|
+
recipient: AztecAddress,
|
|
168
186
|
amount: bigint,
|
|
169
187
|
secretHash: Fr,
|
|
170
188
|
txHash: TxHash,
|
|
171
189
|
) {
|
|
172
|
-
const txEffects = await
|
|
190
|
+
const txEffects = await this.pxe.getTxEffect(txHash);
|
|
173
191
|
await contract.methods
|
|
174
192
|
.deliver_transparent_note(
|
|
175
193
|
contract.address,
|
|
176
194
|
amount,
|
|
177
195
|
secretHash,
|
|
178
196
|
txHash.hash,
|
|
179
|
-
|
|
197
|
+
txEffects!.data.noteHashes,
|
|
180
198
|
txEffects!.data.nullifiers[0],
|
|
181
|
-
|
|
199
|
+
recipient,
|
|
182
200
|
)
|
|
183
|
-
.simulate();
|
|
201
|
+
.simulate({ from: recipient });
|
|
184
202
|
}
|
|
185
203
|
|
|
186
204
|
async applyMintSnapshot() {
|
|
@@ -194,33 +212,35 @@ export class BlacklistTokenContractTest {
|
|
|
194
212
|
await this.asset
|
|
195
213
|
.withWallet(this.admin)
|
|
196
214
|
.methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
|
|
197
|
-
.send()
|
|
215
|
+
.send({ from: this.adminAddress })
|
|
198
216
|
.wait();
|
|
199
217
|
|
|
200
218
|
const blacklistRole = new Role().withBlacklisted();
|
|
201
219
|
await this.asset
|
|
202
220
|
.withWallet(this.admin)
|
|
203
221
|
.methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
|
|
204
|
-
.send()
|
|
222
|
+
.send({ from: this.adminAddress })
|
|
205
223
|
.wait();
|
|
206
224
|
|
|
207
|
-
await this.
|
|
225
|
+
await this.crossTimestampOfChange();
|
|
208
226
|
|
|
209
|
-
expect(
|
|
210
|
-
|
|
211
|
-
);
|
|
227
|
+
expect(
|
|
228
|
+
await this.asset.methods.get_roles(this.admin.getAddress()).simulate({ from: this.adminAddress }),
|
|
229
|
+
).toEqual(adminMinterRole.toNoirStruct());
|
|
212
230
|
|
|
213
231
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
214
|
-
await asset.methods.mint_public(accounts[0].address, amount).send().wait();
|
|
232
|
+
await asset.methods.mint_public(accounts[0].address, amount).send({ from: this.adminAddress }).wait();
|
|
215
233
|
|
|
216
234
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
217
235
|
const secret = Fr.random();
|
|
218
236
|
const secretHash = await computeSecretHash(secret);
|
|
219
|
-
const receipt = await asset.methods.mint_private(amount, secretHash).send().wait();
|
|
237
|
+
const receipt = await asset.methods.mint_private(amount, secretHash).send({ from: this.adminAddress }).wait();
|
|
220
238
|
|
|
221
|
-
await this.addPendingShieldNoteToPXE(asset, wallets[0], amount, secretHash, receipt.txHash);
|
|
222
|
-
const txClaim = asset.methods
|
|
223
|
-
|
|
239
|
+
await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
|
|
240
|
+
const txClaim = asset.methods
|
|
241
|
+
.redeem_shield(accounts[0].address, amount, secret)
|
|
242
|
+
.send({ from: this.adminAddress });
|
|
243
|
+
await txClaim.wait();
|
|
224
244
|
this.logger.verbose(`Minting complete.`);
|
|
225
245
|
|
|
226
246
|
return { amount };
|
|
@@ -233,16 +253,16 @@ export class BlacklistTokenContractTest {
|
|
|
233
253
|
} = this;
|
|
234
254
|
tokenSim.mintPublic(address, amount);
|
|
235
255
|
|
|
236
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate();
|
|
256
|
+
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
237
257
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
238
258
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
239
259
|
|
|
240
260
|
tokenSim.mintPrivate(address, amount);
|
|
241
|
-
const privateBalance = await asset.methods.balance_of_private(address).simulate();
|
|
261
|
+
const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
|
|
242
262
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
243
263
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
244
264
|
|
|
245
|
-
const totalSupply = await asset.methods.total_supply().simulate();
|
|
265
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: address });
|
|
246
266
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
247
267
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
248
268
|
|
|
@@ -4,17 +4,23 @@ import {
|
|
|
4
4
|
type AccountWallet,
|
|
5
5
|
AztecAddress,
|
|
6
6
|
type AztecNode,
|
|
7
|
-
CheatCodes,
|
|
8
7
|
type CompleteAddress,
|
|
9
8
|
EthAddress,
|
|
10
9
|
type Logger,
|
|
11
10
|
type PXE,
|
|
12
11
|
createLogger,
|
|
13
12
|
} from '@aztec/aztec.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
14
|
+
import {
|
|
15
|
+
type DeployL1ContractsReturnType,
|
|
16
|
+
type ExtendedViemWalletClient,
|
|
17
|
+
createExtendedL1Client,
|
|
18
|
+
deployL1Contract,
|
|
19
|
+
} from '@aztec/ethereum';
|
|
20
|
+
import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
16
21
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
22
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
23
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
24
|
|
|
19
25
|
import { getContract } from 'viem';
|
|
20
26
|
|
|
@@ -33,26 +39,29 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
33
39
|
export class CrossChainMessagingTest {
|
|
34
40
|
private snapshotManager: ISnapshotManager;
|
|
35
41
|
logger: Logger;
|
|
36
|
-
wallets: AccountWallet[] = [];
|
|
37
42
|
accounts: CompleteAddress[] = [];
|
|
38
43
|
aztecNode!: AztecNode;
|
|
39
44
|
pxe!: PXE;
|
|
40
45
|
aztecNodeConfig!: AztecNodeConfig;
|
|
46
|
+
aztecNodeAdmin!: AztecNodeAdmin;
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
l1Client!: ExtendedViemWalletClient | undefined;
|
|
43
49
|
|
|
44
50
|
user1Wallet!: AccountWallet;
|
|
51
|
+
user1Address!: AztecAddress;
|
|
45
52
|
user2Wallet!: AccountWallet;
|
|
53
|
+
user2Address!: AztecAddress;
|
|
46
54
|
crossChainTestHarness!: CrossChainTestHarness;
|
|
47
55
|
ethAccount!: EthAddress;
|
|
48
56
|
ownerAddress!: AztecAddress;
|
|
49
57
|
l2Token!: TokenContract;
|
|
50
58
|
l2Bridge!: TokenBridgeContract;
|
|
51
59
|
|
|
52
|
-
rollup!: any; // GetContractReturnType<typeof RollupAbi> | undefined;
|
|
53
60
|
inbox!: any; // GetContractReturnType<typeof InboxAbi> | undefined;
|
|
54
61
|
outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
|
|
55
|
-
|
|
62
|
+
cheatCodes!: CheatCodes;
|
|
63
|
+
|
|
64
|
+
deployL1ContractsValues!: DeployL1ContractsReturnType;
|
|
56
65
|
|
|
57
66
|
constructor(testName: string) {
|
|
58
67
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
@@ -60,15 +69,17 @@ export class CrossChainMessagingTest {
|
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
async assumeProven() {
|
|
63
|
-
await this.
|
|
72
|
+
await this.cheatCodes.rollup.markAsProven();
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
async setup() {
|
|
67
|
-
const { aztecNode, pxe, aztecNodeConfig } = await this.snapshotManager.setup();
|
|
76
|
+
const { aztecNode, pxe, aztecNodeConfig, deployL1ContractsValues } = await this.snapshotManager.setup();
|
|
68
77
|
this.aztecNode = aztecNode;
|
|
69
78
|
this.pxe = pxe;
|
|
70
79
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
71
|
-
this.
|
|
80
|
+
this.cheatCodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
81
|
+
this.deployL1ContractsValues = deployL1ContractsValues;
|
|
82
|
+
this.aztecNodeAdmin = aztecNode;
|
|
72
83
|
}
|
|
73
84
|
|
|
74
85
|
snapshot = <T>(
|
|
@@ -88,19 +99,15 @@ export class CrossChainMessagingTest {
|
|
|
88
99
|
await this.snapshotManager.snapshot(
|
|
89
100
|
'3_accounts',
|
|
90
101
|
deployAccounts(3, this.logger),
|
|
91
|
-
async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode
|
|
92
|
-
|
|
93
|
-
this.accounts =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.rollup = getContract({
|
|
97
|
-
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
98
|
-
abi: RollupAbi,
|
|
99
|
-
client: deployL1ContractsValues.walletClient,
|
|
100
|
-
});
|
|
102
|
+
async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode }) => {
|
|
103
|
+
const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
104
|
+
this.accounts = wallets.map(w => w.getCompleteAddress());
|
|
105
|
+
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
101
106
|
|
|
102
|
-
this.user1Wallet =
|
|
103
|
-
this.
|
|
107
|
+
this.user1Wallet = wallets[0];
|
|
108
|
+
this.user1Address = this.user1Wallet.getAddress();
|
|
109
|
+
this.user2Wallet = wallets[1];
|
|
110
|
+
this.user2Address = this.user2Wallet.getAddress();
|
|
104
111
|
|
|
105
112
|
this.pxe = pxe;
|
|
106
113
|
this.aztecNode = aztecNode;
|
|
@@ -114,41 +121,30 @@ export class CrossChainMessagingTest {
|
|
|
114
121
|
// Create the token contract state.
|
|
115
122
|
// Move this account thing to addAccounts above?
|
|
116
123
|
this.logger.verbose(`Public deploy accounts...`);
|
|
117
|
-
await publicDeployAccounts(this.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const underlyingERC20Address = await deployL1Contract(
|
|
122
|
-
walletClient,
|
|
123
|
-
publicClient,
|
|
124
|
-
TestERC20Abi,
|
|
125
|
-
TestERC20Bytecode,
|
|
126
|
-
['Underlying', 'UND', walletClient.account.address],
|
|
127
|
-
).then(({ address }) => address);
|
|
128
|
-
|
|
129
|
-
const underlyingERC20 = getContract({
|
|
130
|
-
address: underlyingERC20Address!.toString(),
|
|
131
|
-
abi: TestERC20Abi,
|
|
132
|
-
client: walletClient,
|
|
133
|
-
});
|
|
124
|
+
await publicDeployAccounts(this.user1Wallet, this.accounts.slice(0, 3));
|
|
125
|
+
|
|
126
|
+
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
134
127
|
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
const underlyingERC20Address = await deployL1Contract(this.l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
129
|
+
'Underlying',
|
|
130
|
+
'UND',
|
|
131
|
+
this.l1Client.account.address,
|
|
132
|
+
]).then(({ address }) => address);
|
|
137
133
|
|
|
138
134
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
139
135
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
140
136
|
this.aztecNode,
|
|
141
137
|
this.pxe,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.
|
|
138
|
+
this.l1Client,
|
|
139
|
+
this.user1Wallet,
|
|
140
|
+
this.user1Address,
|
|
145
141
|
this.logger,
|
|
146
142
|
underlyingERC20Address,
|
|
147
143
|
);
|
|
148
144
|
|
|
149
145
|
this.logger.verbose(`L2 token deployed to: ${this.crossChainTestHarness.l2Token.address}`);
|
|
150
146
|
|
|
151
|
-
return this.toCrossChainContext();
|
|
147
|
+
return this.crossChainTestHarness.toCrossChainContext();
|
|
152
148
|
},
|
|
153
149
|
async crossChainContext => {
|
|
154
150
|
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.user1Wallet);
|
|
@@ -159,17 +155,17 @@ export class CrossChainMessagingTest {
|
|
|
159
155
|
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
160
156
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
161
157
|
|
|
162
|
-
const
|
|
158
|
+
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
163
159
|
|
|
164
160
|
const inbox = getContract({
|
|
165
161
|
address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
|
|
166
162
|
abi: InboxAbi,
|
|
167
|
-
client:
|
|
163
|
+
client: l1Client,
|
|
168
164
|
});
|
|
169
165
|
const outbox = getContract({
|
|
170
166
|
address: this.aztecNodeConfig.l1Contracts.outboxAddress.toString(),
|
|
171
167
|
abi: OutboxAbi,
|
|
172
|
-
client:
|
|
168
|
+
client: l1Client,
|
|
173
169
|
});
|
|
174
170
|
|
|
175
171
|
this.crossChainTestHarness = new CrossChainTestHarness(
|
|
@@ -181,40 +177,16 @@ export class CrossChainMessagingTest {
|
|
|
181
177
|
this.ethAccount,
|
|
182
178
|
tokenPortalAddress,
|
|
183
179
|
crossChainContext.underlying,
|
|
184
|
-
|
|
185
|
-
walletClient,
|
|
180
|
+
l1Client,
|
|
186
181
|
this.aztecNodeConfig.l1Contracts,
|
|
187
182
|
this.user1Wallet,
|
|
183
|
+
this.user1Address,
|
|
188
184
|
);
|
|
189
185
|
|
|
190
|
-
this.
|
|
186
|
+
this.l1Client = l1Client;
|
|
191
187
|
this.inbox = inbox;
|
|
192
188
|
this.outbox = outbox;
|
|
193
189
|
},
|
|
194
190
|
);
|
|
195
191
|
}
|
|
196
|
-
|
|
197
|
-
toCrossChainContext(): CrossChainContext {
|
|
198
|
-
return {
|
|
199
|
-
l2Token: this.crossChainTestHarness.l2Token.address,
|
|
200
|
-
l2Bridge: this.crossChainTestHarness.l2Bridge.address,
|
|
201
|
-
tokenPortal: this.crossChainTestHarness.tokenPortalAddress,
|
|
202
|
-
underlying: this.crossChainTestHarness.underlyingERC20Address,
|
|
203
|
-
ethAccount: this.crossChainTestHarness.ethAccount,
|
|
204
|
-
ownerAddress: this.crossChainTestHarness.ownerAddress,
|
|
205
|
-
inbox: this.crossChainTestHarness.l1ContractAddresses.inboxAddress,
|
|
206
|
-
outbox: this.crossChainTestHarness.l1ContractAddresses.outboxAddress,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
192
|
}
|
|
210
|
-
|
|
211
|
-
type CrossChainContext = {
|
|
212
|
-
l2Token: AztecAddress;
|
|
213
|
-
l2Bridge: AztecAddress;
|
|
214
|
-
tokenPortal: EthAddress;
|
|
215
|
-
underlying: EthAddress;
|
|
216
|
-
ethAccount: EthAddress;
|
|
217
|
-
ownerAddress: AztecAddress;
|
|
218
|
-
inbox: EthAddress;
|
|
219
|
-
outbox: EthAddress;
|
|
220
|
-
};
|
|
@@ -11,9 +11,10 @@ import {
|
|
|
11
11
|
type PublicKeys,
|
|
12
12
|
type Wallet,
|
|
13
13
|
createLogger,
|
|
14
|
-
|
|
14
|
+
getContractInstanceFromInstantiationParams,
|
|
15
15
|
} from '@aztec/aztec.js';
|
|
16
|
-
import type { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest';
|
|
16
|
+
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
17
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
17
18
|
|
|
18
19
|
import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
19
20
|
|
|
@@ -21,12 +22,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
21
22
|
|
|
22
23
|
export class DeployTest {
|
|
23
24
|
private snapshotManager: ISnapshotManager;
|
|
24
|
-
private wallets: AccountWallet[] = [];
|
|
25
|
-
|
|
26
25
|
public logger: Logger;
|
|
27
26
|
public pxe!: PXE;
|
|
28
27
|
public wallet!: AccountWallet;
|
|
28
|
+
public defaultAccountAddress!: AztecAddress;
|
|
29
29
|
public aztecNode!: AztecNode;
|
|
30
|
+
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
30
31
|
|
|
31
32
|
constructor(testName: string) {
|
|
32
33
|
this.logger = createLogger(`e2e:e2e_deploy_contract:${testName}`);
|
|
@@ -37,6 +38,7 @@ export class DeployTest {
|
|
|
37
38
|
await this.applyInitialAccountSnapshot();
|
|
38
39
|
const context = await this.snapshotManager.setup();
|
|
39
40
|
({ pxe: this.pxe, aztecNode: this.aztecNode } = context);
|
|
41
|
+
this.aztecNodeAdmin = context.aztecNode;
|
|
40
42
|
return this;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -49,9 +51,10 @@ export class DeployTest {
|
|
|
49
51
|
'initial_account',
|
|
50
52
|
deployAccounts(1, this.logger),
|
|
51
53
|
async ({ deployedAccounts }, { pxe }) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.wallet =
|
|
54
|
+
const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
55
|
+
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
56
|
+
this.wallet = wallets[0];
|
|
57
|
+
this.defaultAccountAddress = this.wallet.getAddress();
|
|
55
58
|
},
|
|
56
59
|
);
|
|
57
60
|
}
|
|
@@ -68,7 +71,7 @@ export class DeployTest {
|
|
|
68
71
|
} = {},
|
|
69
72
|
): Promise<T> {
|
|
70
73
|
const { salt, publicKeys, initArgs, constructorName, deployer } = opts;
|
|
71
|
-
const instance = await
|
|
74
|
+
const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
|
|
72
75
|
constructorArgs: initArgs ?? [],
|
|
73
76
|
constructorArtifact: constructorName,
|
|
74
77
|
salt,
|