@aztec/end-to-end 0.0.1-fake-c83136db25 → 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 +2 -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 +12 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +58 -54
- package/dest/bench/client_flows/data_extractor.js +3 -3
- package/dest/bench/utils.d.ts +11 -2
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +34 -10
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +8 -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 +33 -31
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -9
- package/dest/e2e_epochs/epochs_test.d.ts +1 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +9 -10
- package/dest/e2e_fees/bridging_race.notest.js +9 -12
- package/dest/e2e_fees/fees_test.d.ts +5 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +31 -23
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -5
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +9 -7
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +2 -5
- package/dest/e2e_p2p/p2p_network.d.ts +2 -14
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +10 -32
- package/dest/e2e_p2p/shared.d.ts +13 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +45 -49
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +17 -14
- package/dest/fixtures/e2e_prover_test.d.ts +6 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +50 -40
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +2 -2
- package/dest/fixtures/setup_p2p_test.d.ts +7 -0
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +7 -10
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +32 -42
- package/dest/fixtures/token_utils.d.ts +4 -6
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +15 -11
- package/dest/fixtures/utils.d.ts +27 -23
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +100 -75
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +5 -16
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +10 -16
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +15 -13
- package/dest/shared/gas_portal_test_harness.d.ts +6 -9
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +7 -10
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -5
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +7 -8
- package/dest/shared/uniswap_l1_l2.d.ts +6 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +45 -29
- package/dest/simulators/lending_simulator.d.ts +1 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -3
- package/dest/simulators/token_simulator.d.ts +1 -3
- 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 +13 -19
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +84 -107
- package/dest/spartan/utils.d.ts +0 -44
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +20 -212
- package/package.json +36 -37
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +82 -62
- package/src/bench/client_flows/data_extractor.ts +4 -4
- package/src/bench/utils.ts +37 -9
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +63 -46
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -33
- package/src/e2e_deploy_contract/deploy_test.ts +35 -17
- package/src/e2e_epochs/epochs_test.ts +14 -12
- package/src/e2e_fees/bridging_race.notest.ts +9 -14
- package/src/e2e_fees/fees_test.ts +38 -26
- package/src/e2e_l1_publisher/write_json.ts +6 -8
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +10 -11
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -7
- package/src/e2e_p2p/p2p_network.ts +67 -105
- package/src/e2e_p2p/shared.ts +55 -50
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +88 -51
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +2 -3
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +8 -0
- package/src/fixtures/snapshot_manager.ts +59 -59
- package/src/fixtures/token_utils.ts +21 -13
- package/src/fixtures/utils.ts +137 -86
- package/src/fixtures/web3signer.ts +5 -22
- package/src/guides/up_quick_start.sh +10 -2
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +29 -18
- package/src/shared/gas_portal_test_harness.ts +19 -12
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +8 -12
- package/src/shared/uniswap_l1_l2.ts +67 -61
- package/src/simulators/lending_simulator.ts +2 -3
- package/src/simulators/token_simulator.ts +2 -5
- package/src/spartan/DEVELOP.md +3 -8
- package/src/spartan/setup_test_wallets.ts +125 -132
- package/src/spartan/utils.ts +18 -268
package/dest/fixtures/utils.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { generateSchnorrAccounts,
|
|
2
|
+
import { deployFundedSchnorrAccounts, generateSchnorrAccounts, getDeployedTestAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
|
-
import { BatchCall } from '@aztec/aztec.js
|
|
5
|
+
import { BatchCall, createAztecNodeClient, createLogger, createPXEClient, makeFetch, sleep, waitForPXE } from '@aztec/aztec.js';
|
|
6
6
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
7
|
-
import { createLogger } from '@aztec/aztec.js/log';
|
|
8
|
-
import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
9
7
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
10
8
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
11
9
|
import { createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
@@ -19,19 +17,19 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
19
17
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
20
18
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
21
19
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
22
|
-
import {
|
|
23
|
-
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
20
|
+
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
24
21
|
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
25
22
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
26
23
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
27
|
-
import {
|
|
24
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
28
25
|
import { createProverNode } from '@aztec/prover-node';
|
|
29
|
-
import {
|
|
26
|
+
import { createPXEServiceWithSimulator, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
27
|
+
import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
28
|
+
import { FileCircuitRecorder } from '@aztec/simulator/testing';
|
|
30
29
|
import { getContractClassFromArtifact, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
31
30
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
32
31
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
33
32
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
34
|
-
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
|
|
35
33
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
36
34
|
import fs from 'fs/promises';
|
|
37
35
|
import getPort from 'get-port';
|
|
@@ -46,8 +44,8 @@ import { getBBConfig } from './get_bb_config.js';
|
|
|
46
44
|
import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
|
|
47
45
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
48
46
|
export { startAnvil };
|
|
49
|
-
const {
|
|
50
|
-
const getAztecUrl = ()=>
|
|
47
|
+
const { PXE_URL = '' } = process.env;
|
|
48
|
+
const getAztecUrl = ()=>PXE_URL;
|
|
51
49
|
let telemetry = undefined;
|
|
52
50
|
function getTelemetryClient(partialConfig = {}) {
|
|
53
51
|
if (!telemetry) {
|
|
@@ -74,7 +72,7 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
74
72
|
export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, chain = foundry)=>{
|
|
75
73
|
const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
|
|
76
74
|
vkTreeRoot: getVKTreeRoot(),
|
|
77
|
-
|
|
75
|
+
protocolContractTreeRoot,
|
|
78
76
|
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
79
77
|
salt: args.salt,
|
|
80
78
|
initialValidators: args.initialValidators,
|
|
@@ -85,30 +83,33 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
85
83
|
return l1Data;
|
|
86
84
|
};
|
|
87
85
|
/**
|
|
88
|
-
* Sets up Private eXecution Environment (PXE)
|
|
86
|
+
* Sets up Private eXecution Environment (PXE).
|
|
89
87
|
* @param aztecNode - An instance of Aztec Node.
|
|
90
|
-
* @param opts - Partial configuration for the PXE.
|
|
88
|
+
* @param opts - Partial configuration for the PXE service.
|
|
91
89
|
* @param logger - The logger to be used.
|
|
92
90
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
93
|
-
* @returns
|
|
94
|
-
*/ export async function
|
|
95
|
-
const
|
|
96
|
-
...
|
|
91
|
+
* @returns Private eXecution Environment (PXE), logger and teardown function.
|
|
92
|
+
*/ export async function setupPXEService(aztecNode, opts = {}, logger = getLogger(), useLogSuffix = false) {
|
|
93
|
+
const pxeServiceConfig = {
|
|
94
|
+
...getPXEServiceConfig(),
|
|
97
95
|
...opts
|
|
98
96
|
};
|
|
99
97
|
// For tests we only want proving enabled if specifically requested
|
|
100
|
-
|
|
98
|
+
pxeServiceConfig.proverEnabled = !!opts.proverEnabled;
|
|
101
99
|
// If no data directory provided, create a temp directory and clean up afterwards
|
|
102
|
-
const configuredDataDirectory =
|
|
100
|
+
const configuredDataDirectory = pxeServiceConfig.dataDirectory;
|
|
103
101
|
if (!configuredDataDirectory) {
|
|
104
|
-
|
|
102
|
+
pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
105
103
|
}
|
|
106
|
-
const
|
|
107
|
-
const
|
|
104
|
+
const simulator = new WASMSimulator();
|
|
105
|
+
const recorder = process.env.CIRCUIT_RECORD_DIR ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR) : new MemoryCircuitRecorder();
|
|
106
|
+
const simulatorWithRecorder = new SimulatorRecorderWrapper(simulator, recorder);
|
|
107
|
+
const pxe = await createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, pxeServiceConfig, {
|
|
108
108
|
useLogSuffix
|
|
109
109
|
});
|
|
110
|
+
const teardown = configuredDataDirectory ? ()=>Promise.resolve() : ()=>tryRmDir(pxeServiceConfig.dataDirectory);
|
|
110
111
|
return {
|
|
111
|
-
|
|
112
|
+
pxe,
|
|
112
113
|
logger,
|
|
113
114
|
teardown
|
|
114
115
|
};
|
|
@@ -126,40 +127,44 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
126
127
|
const aztecNodeUrl = getAztecUrl();
|
|
127
128
|
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
128
129
|
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
logger.verbose(`Creating PXE client to remote host ${PXE_URL}`);
|
|
131
|
+
const pxeClient = createPXEClient(PXE_URL, {}, makeFetch([
|
|
132
|
+
1,
|
|
133
|
+
2,
|
|
134
|
+
3
|
|
135
|
+
], true));
|
|
136
|
+
await waitForPXE(pxeClient, logger);
|
|
137
|
+
logger.verbose('JSON RPC client connected to PXE');
|
|
138
|
+
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
139
|
+
const { l1ContractAddresses, rollupVersion } = await pxeClient.getNodeInfo();
|
|
133
140
|
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
134
141
|
const deployL1ContractsValues = {
|
|
135
142
|
l1ContractAddresses,
|
|
136
143
|
l1Client,
|
|
137
144
|
rollupVersion
|
|
138
145
|
};
|
|
139
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls
|
|
140
|
-
const
|
|
141
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
146
|
+
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
147
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
142
148
|
const teardown = ()=>Promise.resolve();
|
|
143
|
-
logger.verbose('
|
|
144
|
-
const initialFundedAccounts = await
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
logger.verbose('Constructing available wallets from already registered accounts...');
|
|
150
|
+
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
151
|
+
const wallets = await getDeployedTestAccountsWallets(pxeClient);
|
|
152
|
+
if (wallets.length < numberOfAccounts) {
|
|
153
|
+
throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
|
|
147
154
|
// Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
|
|
148
155
|
}
|
|
149
|
-
const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
|
|
150
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
151
|
-
return accountManager.address;
|
|
152
|
-
}));
|
|
153
156
|
return {
|
|
154
157
|
aztecNode,
|
|
155
158
|
aztecNodeAdmin: undefined,
|
|
156
159
|
sequencer: undefined,
|
|
157
160
|
proverNode: undefined,
|
|
161
|
+
pxe: pxeClient,
|
|
158
162
|
deployL1ContractsValues,
|
|
159
163
|
config,
|
|
160
164
|
initialFundedAccounts,
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
wallets,
|
|
166
|
+
wallet: wallets[0],
|
|
167
|
+
accounts: wallets.slice(0, numberOfAccounts).map((w)=>w.getAddress()),
|
|
163
168
|
logger,
|
|
164
169
|
cheatCodes,
|
|
165
170
|
ethCheatCodes,
|
|
@@ -206,8 +211,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
206
211
|
if (!isAnvilTestChain(chain.id)) {
|
|
207
212
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
208
213
|
}
|
|
209
|
-
if (
|
|
210
|
-
throw new Error(`
|
|
214
|
+
if (PXE_URL) {
|
|
215
|
+
throw new Error(`PXE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`);
|
|
211
216
|
}
|
|
212
217
|
const res = await startAnvil({
|
|
213
218
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
@@ -225,8 +230,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
225
230
|
logger.info(`Logging metrics to ${filename}`);
|
|
226
231
|
setupMetricsLogger(filename);
|
|
227
232
|
}
|
|
228
|
-
const
|
|
229
|
-
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
233
|
+
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
|
|
230
234
|
if (opts.stateLoad) {
|
|
231
235
|
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
232
236
|
}
|
|
@@ -254,7 +258,7 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
254
258
|
];
|
|
255
259
|
}
|
|
256
260
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
257
|
-
if (
|
|
261
|
+
if (PXE_URL) {
|
|
258
262
|
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
259
263
|
return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
|
|
260
264
|
}
|
|
@@ -297,7 +301,6 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
297
301
|
if (enableAutomine) {
|
|
298
302
|
await ethCheatCodes.setAutomine(false);
|
|
299
303
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
300
|
-
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
301
304
|
}
|
|
302
305
|
if (opts.l2StartTime) {
|
|
303
306
|
// This should only be used in synching test or when you need to have a stable
|
|
@@ -306,7 +309,9 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
306
309
|
resetBlockInterval: true
|
|
307
310
|
});
|
|
308
311
|
}
|
|
309
|
-
const
|
|
312
|
+
const dateProvider = new TestDateProvider();
|
|
313
|
+
dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
|
|
314
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
|
|
310
315
|
if (!opts.disableAnvilTestWatcher) {
|
|
311
316
|
await watcher.start();
|
|
312
317
|
}
|
|
@@ -399,31 +404,32 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
399
404
|
proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNode, prefilledPublicData);
|
|
400
405
|
}
|
|
401
406
|
logger.verbose('Creating a pxe...');
|
|
402
|
-
const {
|
|
403
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls,
|
|
407
|
+
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
408
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
404
409
|
if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
|
|
405
410
|
// We need to advance such that the committee is set up.
|
|
406
|
-
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1)
|
|
411
|
+
await cheatCodes.rollup.advanceToEpoch(await cheatCodes.rollup.getEpoch() + BigInt(config.lagInEpochs + 1), {
|
|
412
|
+
updateDateProvider: dateProvider
|
|
413
|
+
});
|
|
407
414
|
await cheatCodes.rollup.setupEpoch();
|
|
408
415
|
await cheatCodes.rollup.debugRollup();
|
|
409
416
|
}
|
|
410
|
-
let accounts = [];
|
|
411
417
|
// Below we continue with what we described in the long comment on line 571.
|
|
418
|
+
let accountManagers = [];
|
|
412
419
|
if (numberOfAccounts === 0) {
|
|
413
420
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
414
|
-
while(await
|
|
421
|
+
while(await pxe.getBlockNumber() === 0){
|
|
415
422
|
await sleep(2000);
|
|
416
423
|
}
|
|
417
424
|
} else {
|
|
418
425
|
logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
|
|
419
|
-
|
|
420
|
-
const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
|
|
421
|
-
accounts = accountManagers.map((accountManager)=>accountManager.address);
|
|
426
|
+
accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
422
427
|
}
|
|
423
428
|
// Now we restore the original minTxsPerBlock setting.
|
|
424
429
|
sequencerClient.getSequencer().updateConfig({
|
|
425
430
|
minTxsPerBlock: originalMinTxsPerBlock
|
|
426
431
|
});
|
|
432
|
+
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
427
433
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
428
434
|
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
429
435
|
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
@@ -461,11 +467,13 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
461
467
|
mockGossipSubNetwork,
|
|
462
468
|
prefilledPublicData,
|
|
463
469
|
proverNode,
|
|
470
|
+
pxe,
|
|
464
471
|
sequencer: sequencerClient,
|
|
465
472
|
teardown,
|
|
466
473
|
telemetryClient: telemetry,
|
|
467
|
-
|
|
468
|
-
|
|
474
|
+
wallets,
|
|
475
|
+
wallet: wallets[0],
|
|
476
|
+
accounts: wallets.map((w)=>w.getAddress()),
|
|
469
477
|
watcher
|
|
470
478
|
};
|
|
471
479
|
} catch (err) {
|
|
@@ -479,28 +487,45 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
479
487
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
480
488
|
* @param sender - Wallet to send the deployment tx.
|
|
481
489
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
482
|
-
*/
|
|
490
|
+
*/ // docs:start:public_deploy_accounts
|
|
491
|
+
export async function ensureAccountContractsPublished(sender, accountsToDeploy) {
|
|
483
492
|
// We have to check whether the accounts are already deployed. This can happen if the test runs against
|
|
484
493
|
// the sandbox and the test accounts exist
|
|
485
|
-
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (
|
|
494
|
+
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (account)=>{
|
|
495
|
+
const address = account.getAddress();
|
|
486
496
|
return {
|
|
487
497
|
address,
|
|
488
|
-
deployed: (await
|
|
498
|
+
deployed: (await sender.getContractMetadata(address)).isContractPublished
|
|
489
499
|
};
|
|
490
500
|
}));
|
|
491
|
-
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>
|
|
501
|
+
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>sender.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.contractInstance);
|
|
492
502
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
493
|
-
if (!(await
|
|
494
|
-
await (await publishContractClass(
|
|
495
|
-
from: accountsToDeploy[0]
|
|
503
|
+
if (!(await sender.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
|
|
504
|
+
await (await publishContractClass(sender, SchnorrAccountContractArtifact)).send({
|
|
505
|
+
from: accountsToDeploy[0].getAddress()
|
|
496
506
|
}).wait();
|
|
497
507
|
}
|
|
498
|
-
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(
|
|
499
|
-
const batch = new BatchCall(
|
|
508
|
+
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(sender, instance)));
|
|
509
|
+
const batch = new BatchCall(sender, requests);
|
|
500
510
|
await batch.send({
|
|
501
|
-
from: accountsToDeploy[0]
|
|
511
|
+
from: accountsToDeploy[0].getAddress()
|
|
502
512
|
}).wait();
|
|
503
513
|
}
|
|
514
|
+
// docs:end:public_deploy_accounts
|
|
515
|
+
/**
|
|
516
|
+
* Sets the timestamp of the next block.
|
|
517
|
+
* @param rpcUrl - rpc url of the blockchain instance to connect to
|
|
518
|
+
* @param timestamp - the timestamp for the next block
|
|
519
|
+
*/ export async function setNextBlockTimestamp(rpcUrl, timestamp) {
|
|
520
|
+
const params = `[${timestamp}]`;
|
|
521
|
+
await fetch(rpcUrl, {
|
|
522
|
+
body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
|
|
523
|
+
method: 'POST',
|
|
524
|
+
headers: {
|
|
525
|
+
'Content-Type': 'application/json'
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
}
|
|
504
529
|
/** Returns the job name for the current test. */ function getJobName() {
|
|
505
530
|
return process.env.JOB_NAME ?? expect.getState().currentTestName?.split(' ')[0].replaceAll('/', '_') ?? 'unknown';
|
|
506
531
|
}
|
|
@@ -539,7 +564,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
539
564
|
expect(diffs).toEqual(expectedDiffs);
|
|
540
565
|
}
|
|
541
566
|
/**
|
|
542
|
-
* Computes the address of the "canonical"
|
|
567
|
+
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
543
568
|
* but by conventions its address is computed with a salt of 0.
|
|
544
569
|
* @returns The address of the sponsored FPC contract
|
|
545
570
|
*/ export function getSponsoredFPCInstance() {
|
|
@@ -548,7 +573,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
548
573
|
}));
|
|
549
574
|
}
|
|
550
575
|
/**
|
|
551
|
-
* Computes the address of the "canonical"
|
|
576
|
+
* Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
|
|
552
577
|
* but by conventions its address is computed with a salt of 0.
|
|
553
578
|
* @returns The address of the sponsored FPC contract
|
|
554
579
|
*/ export async function getSponsoredFPCAddress() {
|
|
@@ -557,11 +582,11 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
557
582
|
}
|
|
558
583
|
/**
|
|
559
584
|
* Deploy a sponsored FPC contract to a running instance.
|
|
560
|
-
*/ export async function setupSponsoredFPC(
|
|
585
|
+
*/ export async function setupSponsoredFPC(pxe) {
|
|
561
586
|
const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
562
587
|
salt: new Fr(SPONSORED_FPC_SALT)
|
|
563
588
|
});
|
|
564
|
-
await
|
|
589
|
+
await pxe.registerContract({
|
|
565
590
|
instance,
|
|
566
591
|
artifact: SponsoredFPCContract.artifact
|
|
567
592
|
});
|
|
@@ -570,9 +595,9 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
570
595
|
}
|
|
571
596
|
/**
|
|
572
597
|
* Registers the SponsoredFPC in this PXE instance
|
|
573
|
-
* @param
|
|
574
|
-
*/ export async function registerSponsoredFPC(
|
|
575
|
-
await
|
|
598
|
+
* @param pxe - The pxe client
|
|
599
|
+
*/ export async function registerSponsoredFPC(pxe) {
|
|
600
|
+
await pxe.registerContract({
|
|
576
601
|
instance: await getSponsoredFPCInstance(),
|
|
577
602
|
artifact: SponsoredFPCContract.artifact
|
|
578
603
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function createWeb3SignerKeystore(dir: string, ...privateKeys: string[]): Promise<void>;
|
|
2
|
-
export declare function refreshWeb3Signer(url: string
|
|
2
|
+
export declare function refreshWeb3Signer(url: string): Promise<void>;
|
|
3
3
|
export declare function getWeb3SignerTestKeystoreDir(): string;
|
|
4
4
|
export declare function getWeb3SignerUrl(): string;
|
|
5
5
|
//# sourceMappingURL=web3signer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web3signer.d.ts","sourceRoot":"","sources":["../../src/fixtures/web3signer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web3signer.d.ts","sourceRoot":"","sources":["../../src/fixtures/web3signer.ts"],"names":[],"mappings":"AAOA,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,iBAcnF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,iBAKlD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { sleep } from '@aztec/aztec.js';
|
|
1
2
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
2
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
|
-
import { sleep } from '@aztec/foundation/sleep';
|
|
4
|
-
import { RemoteSigner } from '@aztec/node-keystore';
|
|
5
3
|
import { mkdirSync } from 'node:fs';
|
|
6
4
|
import { writeFile } from 'node:fs/promises';
|
|
7
5
|
import { join } from 'node:path';
|
|
@@ -17,22 +15,13 @@ privateKey: ${pk}`).join('\n---\n');
|
|
|
17
15
|
flag: 'wx'
|
|
18
16
|
});
|
|
19
17
|
}
|
|
20
|
-
export async function refreshWeb3Signer(url
|
|
18
|
+
export async function refreshWeb3Signer(url) {
|
|
21
19
|
await fetch(new URL('reload', url), {
|
|
22
20
|
method: 'POST'
|
|
23
21
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
await RemoteSigner.validateAccess(url, expectedAddresses);
|
|
28
|
-
return true;
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}, 'web3signer refresh', 10, 0.5);
|
|
33
|
-
} else {
|
|
34
|
-
await sleep(1000);
|
|
35
|
-
}
|
|
22
|
+
// give the service a chance to load up the new files
|
|
23
|
+
// 1s might not be enough if there are a lot of files to scan
|
|
24
|
+
await sleep(1000);
|
|
36
25
|
}
|
|
37
26
|
export function getWeb3SignerTestKeystoreDir() {
|
|
38
27
|
if (process.env.WEB3_SIGNER_TEST_KEYSTORE_DIR) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAKpE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAMV,YAAY;YAqCZ,WAAW;IAqBzB;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE;;;OAGG;IACU,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
4
|
-
import { type L2AmountClaim, type L2AmountClaimWithRecipient } from '@aztec/aztec.js/ethereum';
|
|
5
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
-
import type { SiblingPath } from '@aztec/aztec.js/trees';
|
|
9
|
-
import type { TxReceipt } from '@aztec/aztec.js/tx';
|
|
10
|
-
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
1
|
+
import { type AccountWallet, AuthWitness, type AztecAddress, type AztecNode, EthAddress, type FieldsOf, Fr, type L2AmountClaim, type L2AmountClaimWithRecipient, type Logger, type PXE, type SiblingPath, type TxReceipt, type Wallet } from '@aztec/aztec.js';
|
|
11
2
|
import { type ExtendedViemWalletClient, type L1ContractAddresses } from '@aztec/ethereum';
|
|
12
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
13
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
14
4
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
15
5
|
import { type Hex } from 'viem';
|
|
@@ -62,6 +52,8 @@ export type CrossChainContext = {
|
|
|
62
52
|
export declare class CrossChainTestHarness {
|
|
63
53
|
/** Aztec node instance. */
|
|
64
54
|
aztecNode: AztecNode;
|
|
55
|
+
/** Private eXecution Environment (PXE). */
|
|
56
|
+
pxeService: PXE;
|
|
65
57
|
/** Logger. */
|
|
66
58
|
logger: Logger;
|
|
67
59
|
/** L2 Token contract. */
|
|
@@ -78,16 +70,18 @@ export declare class CrossChainTestHarness {
|
|
|
78
70
|
l1Client: ExtendedViemWalletClient;
|
|
79
71
|
/** Deployment addresses for all L1 contracts */
|
|
80
72
|
readonly l1ContractAddresses: L1ContractAddresses;
|
|
81
|
-
/** Wallet
|
|
82
|
-
readonly
|
|
73
|
+
/** Wallet of the owner. */
|
|
74
|
+
readonly ownerWallet: AccountWallet;
|
|
83
75
|
/** Owner of the l2 token and bridge */
|
|
84
76
|
readonly ownerAddress: AztecAddress;
|
|
85
|
-
static new(aztecNode: AztecNode, l1Client: ExtendedViemWalletClient, wallet:
|
|
77
|
+
static new(aztecNode: AztecNode, pxeService: PXE, l1Client: ExtendedViemWalletClient, wallet: AccountWallet, ownerAddress: AztecAddress, logger: Logger, underlyingERC20Address: EthAddress): Promise<CrossChainTestHarness>;
|
|
86
78
|
private readonly l1TokenManager;
|
|
87
79
|
private readonly l1TokenPortalManager;
|
|
88
80
|
constructor(
|
|
89
81
|
/** Aztec node instance. */
|
|
90
82
|
aztecNode: AztecNode,
|
|
83
|
+
/** Private eXecution Environment (PXE). */
|
|
84
|
+
pxeService: PXE,
|
|
91
85
|
/** Logger. */
|
|
92
86
|
logger: Logger,
|
|
93
87
|
/** L2 Token contract. */
|
|
@@ -104,8 +98,8 @@ export declare class CrossChainTestHarness {
|
|
|
104
98
|
l1Client: ExtendedViemWalletClient,
|
|
105
99
|
/** Deployment addresses for all L1 contracts */
|
|
106
100
|
l1ContractAddresses: L1ContractAddresses,
|
|
107
|
-
/** Wallet
|
|
108
|
-
|
|
101
|
+
/** Wallet of the owner. */
|
|
102
|
+
ownerWallet: AccountWallet,
|
|
109
103
|
/** Owner of the l2 token and bridge */
|
|
110
104
|
ownerAddress: AztecAddress);
|
|
111
105
|
mintTokensOnL1(amount: bigint): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { L1TokenPortalManager } from '@aztec/aztec.js
|
|
3
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
1
|
+
// docs:start:cross_chain_test_harness
|
|
2
|
+
import { EthAddress, Fr, L1TokenPortalManager, retryUntil } from '@aztec/aztec.js';
|
|
4
3
|
import { deployL1Contract } from '@aztec/ethereum';
|
|
5
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
6
4
|
import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
|
|
7
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
8
6
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
9
7
|
import { getContract } from 'viem';
|
|
10
8
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
9
|
+
// docs:start:deployAndInitializeTokenAndBridgeContracts
|
|
11
10
|
/**
|
|
12
11
|
* Deploy L1 token and portal, initialize portal, deploy a non native l2 token contract, its L2 bridge contract and attach is to the portal.
|
|
13
12
|
* @param wallet - the wallet instance
|
|
@@ -76,6 +75,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
76
75
|
* shared between cross chain tests.
|
|
77
76
|
*/ export class CrossChainTestHarness {
|
|
78
77
|
aztecNode;
|
|
78
|
+
pxeService;
|
|
79
79
|
logger;
|
|
80
80
|
l2Token;
|
|
81
81
|
l2Bridge;
|
|
@@ -84,21 +84,22 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
84
84
|
underlyingERC20Address;
|
|
85
85
|
l1Client;
|
|
86
86
|
l1ContractAddresses;
|
|
87
|
-
|
|
87
|
+
ownerWallet;
|
|
88
88
|
ownerAddress;
|
|
89
|
-
static async new(aztecNode, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
|
|
89
|
+
static async new(aztecNode, pxeService, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
|
|
90
90
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
91
|
-
const l1ContractAddresses = (await
|
|
91
|
+
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
92
92
|
// Deploy and initialize all required contracts
|
|
93
93
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
94
|
-
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress,
|
|
94
|
+
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, wallet.getAddress(), underlyingERC20Address);
|
|
95
95
|
logger.info('Deployed and initialized token, portal and its bridge.');
|
|
96
|
-
return new CrossChainTestHarness(aztecNode, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet, ownerAddress);
|
|
96
|
+
return new CrossChainTestHarness(aztecNode, pxeService, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet, ownerAddress);
|
|
97
97
|
}
|
|
98
98
|
l1TokenManager;
|
|
99
99
|
l1TokenPortalManager;
|
|
100
|
-
constructor(/** Aztec node instance. */ aztecNode, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem Extended client instance. */ l1Client, /** Deployment addresses for all L1 contracts */ l1ContractAddresses, /** Wallet
|
|
100
|
+
constructor(/** Aztec node instance. */ aztecNode, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem Extended client instance. */ l1Client, /** Deployment addresses for all L1 contracts */ l1ContractAddresses, /** Wallet of the owner. */ ownerWallet, /** Owner of the l2 token and bridge */ ownerAddress){
|
|
101
101
|
this.aztecNode = aztecNode;
|
|
102
|
+
this.pxeService = pxeService;
|
|
102
103
|
this.logger = logger;
|
|
103
104
|
this.l2Token = l2Token;
|
|
104
105
|
this.l2Bridge = l2Bridge;
|
|
@@ -107,10 +108,11 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
107
108
|
this.underlyingERC20Address = underlyingERC20Address;
|
|
108
109
|
this.l1Client = l1Client;
|
|
109
110
|
this.l1ContractAddresses = l1ContractAddresses;
|
|
110
|
-
this.
|
|
111
|
+
this.ownerWallet = ownerWallet;
|
|
111
112
|
this.ownerAddress = ownerAddress;
|
|
112
113
|
this.l1TokenPortalManager = new L1TokenPortalManager(this.tokenPortalAddress, this.underlyingERC20Address, this.l1ContractAddresses.feeAssetHandlerAddress, this.l1ContractAddresses.outboxAddress, this.l1Client, this.logger);
|
|
113
114
|
this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
|
|
115
|
+
this.ownerAddress = this.ownerWallet.getAddress();
|
|
114
116
|
}
|
|
115
117
|
async mintTokensOnL1(amount) {
|
|
116
118
|
const contract = getContract({
|
|
@@ -144,7 +146,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
144
146
|
}).wait();
|
|
145
147
|
}
|
|
146
148
|
async mintTokensPrivateOnL2(amount) {
|
|
147
|
-
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerAddress, amount);
|
|
149
|
+
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerWallet, this.ownerAddress, amount);
|
|
148
150
|
}
|
|
149
151
|
async sendL2PublicTransfer(transferAmount, receiverAddress) {
|
|
150
152
|
// send a transfer tx to force through rollup with the message included
|
|
@@ -243,4 +245,4 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
243
245
|
outbox: this.l1ContractAddresses.outboxAddress
|
|
244
246
|
};
|
|
245
247
|
}
|
|
246
|
-
}
|
|
248
|
+
} // docs:end:cross_chain_test_harness
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, EthAddress } from '@aztec/aztec.js
|
|
2
|
-
import { L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim } from '@aztec/aztec.js/ethereum';
|
|
3
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
|
-
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
1
|
+
import { type AztecAddress, type AztecNode, EthAddress, L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
6
2
|
import type { ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
7
3
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
8
4
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -16,6 +12,7 @@ export interface IGasBridgingTestHarness {
|
|
|
16
12
|
export interface FeeJuicePortalTestingHarnessFactoryConfig {
|
|
17
13
|
aztecNode: AztecNode;
|
|
18
14
|
aztecNodeAdmin?: AztecNodeAdmin;
|
|
15
|
+
pxeService: PXE;
|
|
19
16
|
l1Client: ExtendedViemWalletClient;
|
|
20
17
|
wallet: Wallet;
|
|
21
18
|
logger: Logger;
|
|
@@ -36,8 +33,8 @@ export declare class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
36
33
|
aztecNode: AztecNode;
|
|
37
34
|
/** Aztec node admin interface */
|
|
38
35
|
aztecNodeAdmin: AztecNodeAdmin | undefined;
|
|
39
|
-
/**
|
|
40
|
-
|
|
36
|
+
/** Private eXecution Environment (PXE). */
|
|
37
|
+
pxeService: PXE;
|
|
41
38
|
/** Logger. */
|
|
42
39
|
logger: Logger;
|
|
43
40
|
/** L2 Token/Bridge contract. */
|
|
@@ -59,8 +56,8 @@ export declare class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
59
56
|
aztecNode: AztecNode,
|
|
60
57
|
/** Aztec node admin interface */
|
|
61
58
|
aztecNodeAdmin: AztecNodeAdmin | undefined,
|
|
62
|
-
/**
|
|
63
|
-
|
|
59
|
+
/** Private eXecution Environment (PXE). */
|
|
60
|
+
pxeService: PXE,
|
|
64
61
|
/** Logger. */
|
|
65
62
|
logger: Logger,
|
|
66
63
|
/** L2 Token/Bridge contract. */
|