@aztec/end-to-end 3.0.0-nightly.20250910 → 3.0.0-nightly.20250912
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/client_flows_benchmark.d.ts +14 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +35 -39
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -4
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -6
- 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 +38 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +4 -5
- 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 +16 -20
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +4 -7
- package/dest/e2e_epochs/epochs_test.d.ts +2 -0
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +5 -0
- package/dest/e2e_fees/bridging_race.notest.js +10 -8
- package/dest/e2e_fees/fees_test.d.ts +3 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +26 -21
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +3 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +7 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +10 -18
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +13 -16
- package/dest/fixtures/e2e_prover_test.d.ts +4 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +22 -29
- package/dest/fixtures/snapshot_manager.d.ts +6 -4
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +22 -12
- package/dest/fixtures/token_utils.d.ts +3 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +8 -10
- package/dest/fixtures/utils.d.ts +7 -7
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +31 -28
- package/dest/shared/cross_chain_test_harness.d.ts +6 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +5 -6
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +4 -5
- package/dest/shared/uniswap_l1_l2.d.ts +6 -4
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -21
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +12 -10
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +54 -50
- package/package.json +37 -36
- package/src/bench/client_flows/client_flows_benchmark.ts +41 -52
- package/src/bench/utils.ts +6 -6
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +39 -50
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +15 -33
- package/src/e2e_deploy_contract/deploy_test.ts +6 -14
- package/src/e2e_epochs/epochs_test.ts +3 -0
- package/src/e2e_fees/bridging_race.notest.ts +12 -9
- package/src/e2e_fees/fees_test.ts +30 -30
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -8
- package/src/e2e_p2p/p2p_network.ts +16 -15
- package/src/e2e_p2p/shared.ts +14 -21
- package/src/e2e_token_contract/token_contract_test.ts +14 -17
- package/src/fixtures/e2e_prover_test.ts +26 -60
- package/src/fixtures/snapshot_manager.ts +32 -24
- package/src/fixtures/token_utils.ts +7 -15
- package/src/fixtures/utils.ts +41 -44
- package/src/shared/cross_chain_test_harness.ts +5 -7
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +7 -8
- package/src/shared/uniswap_l1_l2.ts +40 -36
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +82 -73
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
1
|
import {
|
|
3
|
-
type AccountWallet,
|
|
4
2
|
AztecAddress,
|
|
5
3
|
type AztecNode,
|
|
6
|
-
type CompleteAddress,
|
|
7
4
|
Fr,
|
|
8
5
|
type Logger,
|
|
9
6
|
type PXE,
|
|
@@ -16,6 +13,7 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
16
13
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
17
14
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
18
15
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
16
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
19
17
|
|
|
20
18
|
import { jest } from '@jest/globals';
|
|
21
19
|
|
|
@@ -63,9 +61,8 @@ export class BlacklistTokenContractTest {
|
|
|
63
61
|
|
|
64
62
|
private snapshotManager: ISnapshotManager;
|
|
65
63
|
logger: Logger;
|
|
66
|
-
|
|
64
|
+
wallet!: TestWallet;
|
|
67
65
|
pxe!: PXE;
|
|
68
|
-
accounts: CompleteAddress[] = [];
|
|
69
66
|
asset!: TokenBlacklistContract;
|
|
70
67
|
tokenSim!: TokenSimulator;
|
|
71
68
|
badAccount!: InvalidAccountContract;
|
|
@@ -73,11 +70,8 @@ export class BlacklistTokenContractTest {
|
|
|
73
70
|
sequencer!: SequencerClient;
|
|
74
71
|
aztecNode!: AztecNode;
|
|
75
72
|
|
|
76
|
-
admin!: AccountWallet;
|
|
77
73
|
adminAddress!: AztecAddress;
|
|
78
|
-
other!: AccountWallet;
|
|
79
74
|
otherAddress!: AztecAddress;
|
|
80
|
-
blacklisted!: AccountWallet;
|
|
81
75
|
blacklistedAddress!: AztecAddress;
|
|
82
76
|
|
|
83
77
|
constructor(testName: string) {
|
|
@@ -105,19 +99,16 @@ export class BlacklistTokenContractTest {
|
|
|
105
99
|
await this.snapshotManager.snapshot(
|
|
106
100
|
'3_accounts',
|
|
107
101
|
deployAccounts(3, this.logger),
|
|
108
|
-
|
|
102
|
+
({ deployedAccounts }, { pxe, cheatCodes, aztecNode, sequencer, wallet }) => {
|
|
109
103
|
this.pxe = pxe;
|
|
110
104
|
this.cheatCodes = cheatCodes;
|
|
111
105
|
this.aztecNode = aztecNode;
|
|
112
106
|
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());
|
|
107
|
+
this.wallet = wallet;
|
|
108
|
+
this.adminAddress = deployedAccounts[0].address;
|
|
109
|
+
this.otherAddress = deployedAccounts[1].address;
|
|
110
|
+
this.blacklistedAddress = deployedAccounts[2].address;
|
|
111
|
+
return Promise.resolve();
|
|
121
112
|
},
|
|
122
113
|
);
|
|
123
114
|
|
|
@@ -127,16 +118,16 @@ export class BlacklistTokenContractTest {
|
|
|
127
118
|
// Create the token contract state.
|
|
128
119
|
// Move this account thing to addAccounts above?
|
|
129
120
|
this.logger.verbose(`Public deploy accounts...`);
|
|
130
|
-
await publicDeployAccounts(this.
|
|
121
|
+
await publicDeployAccounts(this.wallet, [this.adminAddress, this.otherAddress, this.blacklistedAddress]);
|
|
131
122
|
|
|
132
123
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
133
|
-
this.asset = await TokenBlacklistContract.deploy(this.
|
|
124
|
+
this.asset = await TokenBlacklistContract.deploy(this.wallet, this.adminAddress)
|
|
134
125
|
.send({ from: this.adminAddress })
|
|
135
126
|
.deployed();
|
|
136
127
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
137
128
|
|
|
138
129
|
this.logger.verbose(`Deploying bad account...`);
|
|
139
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
130
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
|
|
140
131
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
141
132
|
|
|
142
133
|
await this.crossTimestampOfChange();
|
|
@@ -145,18 +136,18 @@ export class BlacklistTokenContractTest {
|
|
|
145
136
|
},
|
|
146
137
|
async ({ tokenContractAddress, badAccountAddress }) => {
|
|
147
138
|
// Restore the token contract state.
|
|
148
|
-
this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.
|
|
139
|
+
this.asset = await TokenBlacklistContract.at(tokenContractAddress, this.wallet);
|
|
149
140
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
150
141
|
|
|
151
142
|
this.tokenSim = new TokenSimulator(
|
|
152
143
|
this.asset as unknown as TokenContract,
|
|
153
|
-
this.
|
|
144
|
+
this.wallet,
|
|
154
145
|
this.adminAddress,
|
|
155
146
|
this.logger,
|
|
156
|
-
this.
|
|
147
|
+
[this.adminAddress, this.otherAddress, this.blacklistedAddress],
|
|
157
148
|
);
|
|
158
149
|
|
|
159
|
-
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.
|
|
150
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
160
151
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
161
152
|
|
|
162
153
|
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
@@ -205,40 +196,38 @@ export class BlacklistTokenContractTest {
|
|
|
205
196
|
await this.snapshotManager.snapshot(
|
|
206
197
|
'mint',
|
|
207
198
|
async () => {
|
|
208
|
-
const { asset
|
|
199
|
+
const { asset } = this;
|
|
209
200
|
const amount = 10000n;
|
|
210
201
|
|
|
211
202
|
const adminMinterRole = new Role().withAdmin().withMinter();
|
|
212
|
-
await this.asset
|
|
213
|
-
.
|
|
214
|
-
.methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
|
|
203
|
+
await this.asset.methods
|
|
204
|
+
.update_roles(this.adminAddress, adminMinterRole.toNoirStruct())
|
|
215
205
|
.send({ from: this.adminAddress })
|
|
216
206
|
.wait();
|
|
217
207
|
|
|
218
208
|
const blacklistRole = new Role().withBlacklisted();
|
|
219
|
-
await this.asset
|
|
220
|
-
.
|
|
221
|
-
.methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
|
|
209
|
+
await this.asset.methods
|
|
210
|
+
.update_roles(this.blacklistedAddress, blacklistRole.toNoirStruct())
|
|
222
211
|
.send({ from: this.adminAddress })
|
|
223
212
|
.wait();
|
|
224
213
|
|
|
225
214
|
await this.crossTimestampOfChange();
|
|
226
215
|
|
|
227
|
-
expect(
|
|
228
|
-
|
|
229
|
-
)
|
|
216
|
+
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
217
|
+
adminMinterRole.toNoirStruct(),
|
|
218
|
+
);
|
|
230
219
|
|
|
231
220
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
232
|
-
await asset.methods.mint_public(
|
|
221
|
+
await asset.methods.mint_public(this.adminAddress, amount).send({ from: this.adminAddress }).wait();
|
|
233
222
|
|
|
234
223
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
235
224
|
const secret = Fr.random();
|
|
236
225
|
const secretHash = await computeSecretHash(secret);
|
|
237
226
|
const receipt = await asset.methods.mint_private(amount, secretHash).send({ from: this.adminAddress }).wait();
|
|
238
227
|
|
|
239
|
-
await this.addPendingShieldNoteToPXE(asset,
|
|
228
|
+
await this.addPendingShieldNoteToPXE(asset, this.adminAddress, amount, secretHash, receipt.txHash);
|
|
240
229
|
const txClaim = asset.methods
|
|
241
|
-
.redeem_shield(
|
|
230
|
+
.redeem_shield(this.adminAddress, amount, secret)
|
|
242
231
|
.send({ from: this.adminAddress });
|
|
243
232
|
await txClaim.wait();
|
|
244
233
|
this.logger.verbose(`Minting complete.`);
|
|
@@ -246,23 +235,23 @@ export class BlacklistTokenContractTest {
|
|
|
246
235
|
return { amount };
|
|
247
236
|
},
|
|
248
237
|
async ({ amount }) => {
|
|
249
|
-
const {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
238
|
+
const { asset, tokenSim } = this;
|
|
239
|
+
tokenSim.mintPublic(this.adminAddress, amount);
|
|
240
|
+
|
|
241
|
+
const publicBalance = await asset.methods
|
|
242
|
+
.balance_of_public(this.adminAddress)
|
|
243
|
+
.simulate({ from: this.adminAddress });
|
|
257
244
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
258
|
-
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(
|
|
245
|
+
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(this.adminAddress));
|
|
259
246
|
|
|
260
|
-
tokenSim.mintPrivate(
|
|
261
|
-
const privateBalance = await asset.methods
|
|
247
|
+
tokenSim.mintPrivate(this.adminAddress, amount);
|
|
248
|
+
const privateBalance = await asset.methods
|
|
249
|
+
.balance_of_private(this.adminAddress)
|
|
250
|
+
.simulate({ from: this.adminAddress });
|
|
262
251
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
263
|
-
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(
|
|
252
|
+
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(this.adminAddress));
|
|
264
253
|
|
|
265
|
-
const totalSupply = await asset.methods.total_supply().simulate({ from:
|
|
254
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: this.adminAddress });
|
|
266
255
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
267
256
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
268
257
|
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
3
|
-
import {
|
|
4
|
-
type AccountWallet,
|
|
5
|
-
AztecAddress,
|
|
6
|
-
type AztecNode,
|
|
7
|
-
type CompleteAddress,
|
|
8
|
-
EthAddress,
|
|
9
|
-
type Logger,
|
|
10
|
-
type PXE,
|
|
11
|
-
createLogger,
|
|
12
|
-
} from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress, type AztecNode, EthAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js';
|
|
13
3
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
14
4
|
import {
|
|
15
5
|
type DeployL1ContractsReturnType,
|
|
@@ -21,6 +11,7 @@ import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-
|
|
|
21
11
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
22
12
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
23
13
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
14
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
24
15
|
|
|
25
16
|
import { getContract } from 'viem';
|
|
26
17
|
|
|
@@ -39,7 +30,6 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
39
30
|
export class CrossChainMessagingTest {
|
|
40
31
|
private snapshotManager: ISnapshotManager;
|
|
41
32
|
logger: Logger;
|
|
42
|
-
accounts: CompleteAddress[] = [];
|
|
43
33
|
aztecNode!: AztecNode;
|
|
44
34
|
pxe!: PXE;
|
|
45
35
|
aztecNodeConfig!: AztecNodeConfig;
|
|
@@ -47,13 +37,12 @@ export class CrossChainMessagingTest {
|
|
|
47
37
|
|
|
48
38
|
l1Client!: ExtendedViemWalletClient | undefined;
|
|
49
39
|
|
|
50
|
-
|
|
40
|
+
wallet!: TestWallet;
|
|
41
|
+
ownerAddress!: AztecAddress;
|
|
51
42
|
user1Address!: AztecAddress;
|
|
52
|
-
user2Wallet!: AccountWallet;
|
|
53
43
|
user2Address!: AztecAddress;
|
|
54
44
|
crossChainTestHarness!: CrossChainTestHarness;
|
|
55
45
|
ethAccount!: EthAddress;
|
|
56
|
-
ownerAddress!: AztecAddress;
|
|
57
46
|
l2Token!: TokenContract;
|
|
58
47
|
l2Bridge!: TokenBridgeContract;
|
|
59
48
|
|
|
@@ -99,19 +88,13 @@ export class CrossChainMessagingTest {
|
|
|
99
88
|
await this.snapshotManager.snapshot(
|
|
100
89
|
'3_accounts',
|
|
101
90
|
deployAccounts(3, this.logger),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.accounts = wallets.map(w => w.getCompleteAddress());
|
|
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
|
-
|
|
91
|
+
({ deployedAccounts }, { pxe, wallet, aztecNodeConfig, aztecNode }) => {
|
|
92
|
+
[this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map(a => a.address);
|
|
112
93
|
this.pxe = pxe;
|
|
94
|
+
this.wallet = wallet;
|
|
113
95
|
this.aztecNode = aztecNode;
|
|
114
96
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
97
|
+
return Promise.resolve();
|
|
115
98
|
},
|
|
116
99
|
);
|
|
117
100
|
|
|
@@ -121,7 +104,7 @@ export class CrossChainMessagingTest {
|
|
|
121
104
|
// Create the token contract state.
|
|
122
105
|
// Move this account thing to addAccounts above?
|
|
123
106
|
this.logger.verbose(`Public deploy accounts...`);
|
|
124
|
-
await publicDeployAccounts(this.
|
|
107
|
+
await publicDeployAccounts(this.wallet, [this.ownerAddress, this.user1Address, this.user2Address]);
|
|
125
108
|
|
|
126
109
|
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
127
110
|
|
|
@@ -136,8 +119,8 @@ export class CrossChainMessagingTest {
|
|
|
136
119
|
this.aztecNode,
|
|
137
120
|
this.pxe,
|
|
138
121
|
this.l1Client,
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
122
|
+
this.wallet,
|
|
123
|
+
this.ownerAddress,
|
|
141
124
|
this.logger,
|
|
142
125
|
underlyingERC20Address,
|
|
143
126
|
);
|
|
@@ -147,12 +130,11 @@ export class CrossChainMessagingTest {
|
|
|
147
130
|
return this.crossChainTestHarness.toCrossChainContext();
|
|
148
131
|
},
|
|
149
132
|
async crossChainContext => {
|
|
150
|
-
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.
|
|
151
|
-
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.
|
|
133
|
+
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
|
|
134
|
+
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
|
|
152
135
|
|
|
153
136
|
// There is an issue with the reviver so we are getting strings sometimes. Working around it here.
|
|
154
137
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
155
|
-
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
156
138
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
157
139
|
|
|
158
140
|
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
@@ -179,8 +161,8 @@ export class CrossChainMessagingTest {
|
|
|
179
161
|
crossChainContext.underlying,
|
|
180
162
|
l1Client,
|
|
181
163
|
this.aztecNodeConfig.l1Contracts,
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
164
|
+
this.wallet,
|
|
165
|
+
this.ownerAddress,
|
|
184
166
|
);
|
|
185
167
|
|
|
186
168
|
this.l1Client = l1Client;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
1
|
import {
|
|
3
|
-
type AccountWallet,
|
|
4
2
|
type AztecAddress,
|
|
5
3
|
type AztecNode,
|
|
6
4
|
type ContractArtifact,
|
|
@@ -24,7 +22,7 @@ export class DeployTest {
|
|
|
24
22
|
private snapshotManager: ISnapshotManager;
|
|
25
23
|
public logger: Logger;
|
|
26
24
|
public pxe!: PXE;
|
|
27
|
-
public wallet!:
|
|
25
|
+
public wallet!: Wallet;
|
|
28
26
|
public defaultAccountAddress!: AztecAddress;
|
|
29
27
|
public aztecNode!: AztecNode;
|
|
30
28
|
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
@@ -37,7 +35,7 @@ export class DeployTest {
|
|
|
37
35
|
async setup() {
|
|
38
36
|
await this.applyInitialAccountSnapshot();
|
|
39
37
|
const context = await this.snapshotManager.setup();
|
|
40
|
-
({ pxe: this.pxe, aztecNode: this.aztecNode } = context);
|
|
38
|
+
({ pxe: this.pxe, aztecNode: this.aztecNode, wallet: this.wallet } = context);
|
|
41
39
|
this.aztecNodeAdmin = context.aztecNode;
|
|
42
40
|
return this;
|
|
43
41
|
}
|
|
@@ -47,16 +45,10 @@ export class DeployTest {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
private async applyInitialAccountSnapshot() {
|
|
50
|
-
await this.snapshotManager.snapshot(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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();
|
|
58
|
-
},
|
|
59
|
-
);
|
|
48
|
+
await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), ({ deployedAccounts }) => {
|
|
49
|
+
this.defaultAccountAddress = deployedAccounts[0].address;
|
|
50
|
+
return Promise.resolve();
|
|
51
|
+
});
|
|
60
52
|
}
|
|
61
53
|
|
|
62
54
|
async registerContract<T extends ContractBase>(
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
retryUntil,
|
|
10
10
|
sleep,
|
|
11
11
|
} from '@aztec/aztec.js';
|
|
12
|
+
import { EpochCache } from '@aztec/epoch-cache';
|
|
12
13
|
import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
|
|
13
14
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
14
15
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
@@ -69,6 +70,7 @@ export class EpochsTestContext {
|
|
|
69
70
|
public constants!: L1RollupConstants;
|
|
70
71
|
public logger!: Logger;
|
|
71
72
|
public monitor!: ChainMonitor;
|
|
73
|
+
public epochCache!: EpochCache;
|
|
72
74
|
public proverDelayer!: Delayer;
|
|
73
75
|
public sequencerDelayer!: Delayer;
|
|
74
76
|
|
|
@@ -141,6 +143,7 @@ export class EpochsTestContext {
|
|
|
141
143
|
this.logger = context.logger;
|
|
142
144
|
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
143
145
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
146
|
+
this.epochCache = await EpochCache.create(this.rollup, context.config, { dateProvider: context.dateProvider });
|
|
144
147
|
|
|
145
148
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
146
149
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr, type Logger,
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, type Logger, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { Fq } from '@aztec/foundation/fields';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
5
6
|
|
|
6
7
|
import { jest } from '@jest/globals';
|
|
7
8
|
import type { Hex } from 'viem';
|
|
@@ -27,7 +28,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
27
28
|
await t.applyPublicDeployAccountsSnapshot();
|
|
28
29
|
await t.applySetupFeeJuiceSnapshot();
|
|
29
30
|
|
|
30
|
-
({
|
|
31
|
+
({ wallet, logger } = await t.setup());
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
afterAll(async () => {
|
|
@@ -35,17 +36,19 @@ describe('e2e_fees bridging_race', () => {
|
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
let logger: Logger;
|
|
38
|
-
let pxe: PXE;
|
|
39
39
|
let bobsAddress: AztecAddress;
|
|
40
|
+
let wallet: TestWallet;
|
|
40
41
|
|
|
41
42
|
beforeEach(async () => {
|
|
42
43
|
const bobsSecretKey = Fr.random();
|
|
43
44
|
const bobsPrivateSigningKey = Fq.random();
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const bobsSalt = Fr.random();
|
|
46
|
+
const bobsAccountManager = await wallet.createAccount({
|
|
47
|
+
secret: bobsSecretKey,
|
|
48
|
+
salt: bobsSalt,
|
|
49
|
+
contract: new SchnorrAccountContract(bobsPrivateSigningKey),
|
|
50
|
+
});
|
|
51
|
+
bobsAddress = bobsAccountManager.getAddress();
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
it('Alice bridges funds to Bob', async () => {
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type AccountWallet,
|
|
4
|
-
type AztecAddress,
|
|
5
|
-
type AztecNode,
|
|
6
|
-
type Logger,
|
|
7
|
-
type PXE,
|
|
8
|
-
createLogger,
|
|
9
|
-
sleep,
|
|
10
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { type AztecAddress, type AztecNode, type Logger, type PXE, createLogger, sleep } from '@aztec/aztec.js';
|
|
11
3
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
12
4
|
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
13
5
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
@@ -22,6 +14,7 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
22
14
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
15
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
24
16
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
17
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
25
18
|
|
|
26
19
|
import { getContract } from 'viem';
|
|
27
20
|
|
|
@@ -56,7 +49,6 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
56
49
|
*/
|
|
57
50
|
export class FeesTest {
|
|
58
51
|
private snapshotManager: ISnapshotManager;
|
|
59
|
-
private wallets: AccountWallet[] = [];
|
|
60
52
|
private accounts: AztecAddress[] = [];
|
|
61
53
|
|
|
62
54
|
public logger: Logger;
|
|
@@ -64,9 +56,8 @@ export class FeesTest {
|
|
|
64
56
|
public aztecNode!: AztecNode;
|
|
65
57
|
public cheatCodes!: CheatCodes;
|
|
66
58
|
|
|
67
|
-
public
|
|
59
|
+
public wallet!: TestWallet;
|
|
68
60
|
public aliceAddress!: AztecAddress;
|
|
69
|
-
public bobWallet!: AccountWallet;
|
|
70
61
|
public bobAddress!: AztecAddress;
|
|
71
62
|
public sequencerAddress!: AztecAddress;
|
|
72
63
|
public coinbase!: EthAddress;
|
|
@@ -172,7 +163,7 @@ export class FeesTest {
|
|
|
172
163
|
.balance_of_private(address)
|
|
173
164
|
.simulate({ from: this.aliceAddress });
|
|
174
165
|
|
|
175
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress,
|
|
166
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
176
167
|
|
|
177
168
|
const balanceAfter = await this.bananaCoin.methods
|
|
178
169
|
.balance_of_private(address)
|
|
@@ -191,30 +182,39 @@ export class FeesTest {
|
|
|
191
182
|
await this.snapshotManager.snapshot(
|
|
192
183
|
'initial_accounts',
|
|
193
184
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
194
|
-
async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
|
|
185
|
+
async ({ deployedAccounts }, { wallet, pxe, aztecNode, aztecNodeConfig }) => {
|
|
195
186
|
this.pxe = pxe;
|
|
196
|
-
|
|
187
|
+
this.wallet = wallet;
|
|
197
188
|
this.aztecNode = aztecNode;
|
|
198
189
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
199
190
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
203
|
-
|
|
204
|
-
|
|
191
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
192
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
193
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
194
|
+
await Promise.all(
|
|
195
|
+
deployedAccounts.map(async acc => {
|
|
196
|
+
const accountData = {
|
|
197
|
+
secret: acc.secret,
|
|
198
|
+
salt: acc.salt,
|
|
199
|
+
contract: new SchnorrAccountContract(acc.signingKey),
|
|
200
|
+
};
|
|
201
|
+
const accountManager = await this.wallet.createAccount(accountData);
|
|
202
|
+
return accountManager.register();
|
|
203
|
+
}),
|
|
204
|
+
);
|
|
205
205
|
|
|
206
206
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
207
207
|
this.fpcAdmin = this.aliceAddress;
|
|
208
208
|
|
|
209
209
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
210
|
-
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.
|
|
210
|
+
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
211
211
|
},
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
async applyPublicDeployAccountsSnapshot() {
|
|
216
216
|
await this.snapshotManager.snapshot('public_deploy_accounts', () =>
|
|
217
|
-
ensureAccountContractsPublished(this.
|
|
217
|
+
ensureAccountContractsPublished(this.wallet, this.accounts),
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -225,7 +225,7 @@ export class FeesTest {
|
|
|
225
225
|
async (_data, context) => {
|
|
226
226
|
this.context = context;
|
|
227
227
|
|
|
228
|
-
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.
|
|
228
|
+
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
229
229
|
|
|
230
230
|
this.getGasBalanceFn = getBalancesFn(
|
|
231
231
|
'⛽',
|
|
@@ -239,7 +239,7 @@ export class FeesTest {
|
|
|
239
239
|
aztecNodeAdmin: context.aztecNode,
|
|
240
240
|
pxeService: context.pxe,
|
|
241
241
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
242
|
-
wallet: this.
|
|
242
|
+
wallet: this.wallet,
|
|
243
243
|
logger: this.logger,
|
|
244
244
|
});
|
|
245
245
|
},
|
|
@@ -250,14 +250,14 @@ export class FeesTest {
|
|
|
250
250
|
await this.snapshotManager.snapshot(
|
|
251
251
|
'deploy_banana_token',
|
|
252
252
|
async () => {
|
|
253
|
-
const bananaCoin = await BananaCoin.deploy(this.
|
|
253
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
254
254
|
.send({ from: this.aliceAddress })
|
|
255
255
|
.deployed();
|
|
256
256
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
257
257
|
return { bananaCoinAddress: bananaCoin.address };
|
|
258
258
|
},
|
|
259
259
|
async ({ bananaCoinAddress }) => {
|
|
260
|
-
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.
|
|
260
|
+
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
|
|
261
261
|
const logger = this.logger;
|
|
262
262
|
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
263
263
|
'🍌.public',
|
|
@@ -283,7 +283,7 @@ export class FeesTest {
|
|
|
283
283
|
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
284
284
|
|
|
285
285
|
const bananaCoin = this.bananaCoin;
|
|
286
|
-
const bananaFPC = await FPCContract.deploy(this.
|
|
286
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
287
287
|
.send({ from: this.aliceAddress })
|
|
288
288
|
.deployed();
|
|
289
289
|
|
|
@@ -299,7 +299,7 @@ export class FeesTest {
|
|
|
299
299
|
};
|
|
300
300
|
},
|
|
301
301
|
async (data, context) => {
|
|
302
|
-
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.
|
|
302
|
+
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
303
303
|
this.bananaFPC = bananaFPC;
|
|
304
304
|
|
|
305
305
|
this.getCoinbaseBalance = async () => {
|
|
@@ -358,7 +358,7 @@ export class FeesTest {
|
|
|
358
358
|
};
|
|
359
359
|
},
|
|
360
360
|
async data => {
|
|
361
|
-
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.
|
|
361
|
+
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
362
362
|
},
|
|
363
363
|
);
|
|
364
364
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AccountWallet, AztecAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type Logger, type PXE, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
3
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
4
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
5
4
|
|
|
@@ -16,7 +15,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
16
15
|
export class NestedContractTest {
|
|
17
16
|
private snapshotManager: ISnapshotManager;
|
|
18
17
|
logger: Logger;
|
|
19
|
-
wallet!:
|
|
18
|
+
wallet!: Wallet;
|
|
20
19
|
defaultAccountAddress!: AztecAddress;
|
|
21
20
|
pxe!: PXE;
|
|
22
21
|
|
|
@@ -40,12 +39,11 @@ export class NestedContractTest {
|
|
|
40
39
|
await this.snapshotManager.snapshot(
|
|
41
40
|
'accounts',
|
|
42
41
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[this.wallet] = wallets;
|
|
47
|
-
this.defaultAccountAddress = this.wallet.getAddress();
|
|
42
|
+
({ deployedAccounts }, { pxe, wallet }) => {
|
|
43
|
+
this.wallet = wallet;
|
|
44
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
48
45
|
this.pxe = pxe;
|
|
46
|
+
return Promise.resolve();
|
|
49
47
|
},
|
|
50
48
|
);
|
|
51
49
|
|