@aztec/end-to-end 1.0.0-nightly.20250810 → 1.0.0-nightly.20250812
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 +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +30 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -0
- 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 +47 -15
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -1
- 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 +12 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +5 -4
- package/dest/e2e_fees/bridging_race.notest.js +3 -1
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +29 -33
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +17 -12
- package/dest/e2e_p2p/p2p_network.d.ts +2 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +5 -1
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +7 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts +8 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +48 -23
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +22 -8
- package/dest/fixtures/snapshot_manager.js +3 -1
- 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 +13 -7
- package/dest/fixtures/utils.d.ts +4 -3
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +14 -6
- package/dest/sample-dapp/connect.d.mts +2 -0
- package/dest/sample-dapp/connect.d.mts.map +1 -0
- package/dest/sample-dapp/connect.js +1 -1
- package/dest/sample-dapp/contracts.d.mts +3 -0
- package/dest/sample-dapp/contracts.d.mts.map +1 -0
- package/dest/sample-dapp/contracts.js +1 -1
- package/dest/sample-dapp/deploy.d.mts +3 -0
- package/dest/sample-dapp/deploy.d.mts.map +1 -0
- package/dest/sample-dapp/deploy.js +4 -1
- package/dest/sample-dapp/index.d.mts +2 -0
- package/dest/sample-dapp/index.d.mts.map +1 -0
- package/dest/sample-dapp/index.js +18 -7
- package/dest/shared/cross_chain_test_harness.d.ts +6 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +50 -20
- package/dest/shared/gas_portal_test_harness.d.ts +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +9 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +37 -14
- package/dest/simulators/lending_simulator.js +6 -2
- 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 +12 -4
- package/dest/spartan/setup_test_wallets.d.ts +2 -0
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +15 -5
- package/package.json +35 -35
- package/src/bench/client_flows/benchmark.ts +1 -1
- package/src/bench/client_flows/client_flows_benchmark.ts +20 -11
- package/src/bench/utils.ts +4 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +28 -17
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -8
- package/src/e2e_deploy_contract/deploy_test.ts +5 -5
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +37 -46
- package/src/e2e_nested_contract/nested_contract_test.ts +16 -11
- package/src/e2e_p2p/p2p_network.ts +6 -2
- package/src/e2e_p2p/shared.ts +4 -2
- package/src/e2e_token_contract/token_contract_test.ts +38 -36
- package/src/fixtures/e2e_prover_test.ts +13 -7
- package/src/fixtures/snapshot_manager.ts +1 -1
- package/src/fixtures/token_utils.ts +13 -6
- package/src/fixtures/utils.ts +14 -7
- package/src/sample-dapp/connect.mjs +1 -1
- package/src/sample-dapp/contracts.mjs +1 -1
- package/src/sample-dapp/deploy.mjs +3 -3
- package/src/sample-dapp/index.mjs +11 -7
- package/src/shared/cross_chain_test_harness.ts +31 -18
- package/src/shared/gas_portal_test_harness.ts +6 -6
- package/src/shared/uniswap_l1_l2.ts +19 -15
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/simulators/token_simulator.ts +12 -3
- package/src/spartan/setup_test_wallets.ts +40 -16
|
@@ -74,8 +74,11 @@ export class BlacklistTokenContractTest {
|
|
|
74
74
|
aztecNode!: AztecNode;
|
|
75
75
|
|
|
76
76
|
admin!: AccountWallet;
|
|
77
|
+
adminAddress!: AztecAddress;
|
|
77
78
|
other!: AccountWallet;
|
|
79
|
+
otherAddress!: AztecAddress;
|
|
78
80
|
blacklisted!: AccountWallet;
|
|
81
|
+
blacklistedAddress!: AztecAddress;
|
|
79
82
|
|
|
80
83
|
constructor(testName: string) {
|
|
81
84
|
this.logger = createLogger(`e2e:e2e_blacklist_token_contract:${testName}`);
|
|
@@ -109,8 +112,11 @@ export class BlacklistTokenContractTest {
|
|
|
109
112
|
this.sequencer = sequencer;
|
|
110
113
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
111
114
|
this.admin = this.wallets[0];
|
|
115
|
+
this.adminAddress = this.admin.getAddress();
|
|
112
116
|
this.other = this.wallets[1];
|
|
117
|
+
this.otherAddress = this.other.getAddress();
|
|
113
118
|
this.blacklisted = this.wallets[2];
|
|
119
|
+
this.blacklistedAddress = this.blacklisted.getAddress();
|
|
114
120
|
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
115
121
|
},
|
|
116
122
|
);
|
|
@@ -121,14 +127,16 @@ export class BlacklistTokenContractTest {
|
|
|
121
127
|
// Create the token contract state.
|
|
122
128
|
// Move this account thing to addAccounts above?
|
|
123
129
|
this.logger.verbose(`Public deploy accounts...`);
|
|
124
|
-
await publicDeployAccounts(this.
|
|
130
|
+
await publicDeployAccounts(this.admin, this.accounts.slice(0, 3));
|
|
125
131
|
|
|
126
132
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
127
|
-
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();
|
|
128
136
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
129
137
|
|
|
130
138
|
this.logger.verbose(`Deploying bad account...`);
|
|
131
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
139
|
+
this.badAccount = await InvalidAccountContract.deploy(this.admin).send({ from: this.adminAddress }).deployed();
|
|
132
140
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
133
141
|
|
|
134
142
|
await this.crossTimestampOfChange();
|
|
@@ -142,7 +150,8 @@ export class BlacklistTokenContractTest {
|
|
|
142
150
|
|
|
143
151
|
this.tokenSim = new TokenSimulator(
|
|
144
152
|
this.asset as unknown as TokenContract,
|
|
145
|
-
this.
|
|
153
|
+
this.admin,
|
|
154
|
+
this.adminAddress,
|
|
146
155
|
this.logger,
|
|
147
156
|
this.accounts.map(a => a.address),
|
|
148
157
|
);
|
|
@@ -150,7 +159,7 @@ export class BlacklistTokenContractTest {
|
|
|
150
159
|
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallets[0]);
|
|
151
160
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
152
161
|
|
|
153
|
-
expect(await this.asset.methods.get_roles(this.
|
|
162
|
+
expect(await this.asset.methods.get_roles(this.adminAddress).simulate({ from: this.adminAddress })).toEqual(
|
|
154
163
|
new Role().withAdmin().toNoirStruct(),
|
|
155
164
|
);
|
|
156
165
|
},
|
|
@@ -189,7 +198,7 @@ export class BlacklistTokenContractTest {
|
|
|
189
198
|
txEffects!.data.nullifiers[0],
|
|
190
199
|
recipient,
|
|
191
200
|
)
|
|
192
|
-
.simulate();
|
|
201
|
+
.simulate({ from: recipient });
|
|
193
202
|
}
|
|
194
203
|
|
|
195
204
|
async applyMintSnapshot() {
|
|
@@ -203,32 +212,34 @@ export class BlacklistTokenContractTest {
|
|
|
203
212
|
await this.asset
|
|
204
213
|
.withWallet(this.admin)
|
|
205
214
|
.methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct())
|
|
206
|
-
.send()
|
|
215
|
+
.send({ from: this.adminAddress })
|
|
207
216
|
.wait();
|
|
208
217
|
|
|
209
218
|
const blacklistRole = new Role().withBlacklisted();
|
|
210
219
|
await this.asset
|
|
211
220
|
.withWallet(this.admin)
|
|
212
221
|
.methods.update_roles(this.blacklisted.getAddress(), blacklistRole.toNoirStruct())
|
|
213
|
-
.send()
|
|
222
|
+
.send({ from: this.adminAddress })
|
|
214
223
|
.wait();
|
|
215
224
|
|
|
216
225
|
await this.crossTimestampOfChange();
|
|
217
226
|
|
|
218
|
-
expect(
|
|
219
|
-
|
|
220
|
-
);
|
|
227
|
+
expect(
|
|
228
|
+
await this.asset.methods.get_roles(this.admin.getAddress()).simulate({ from: this.adminAddress }),
|
|
229
|
+
).toEqual(adminMinterRole.toNoirStruct());
|
|
221
230
|
|
|
222
231
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
223
|
-
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();
|
|
224
233
|
|
|
225
234
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
226
235
|
const secret = Fr.random();
|
|
227
236
|
const secretHash = await computeSecretHash(secret);
|
|
228
|
-
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();
|
|
229
238
|
|
|
230
239
|
await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
|
|
231
|
-
const txClaim = asset.methods
|
|
240
|
+
const txClaim = asset.methods
|
|
241
|
+
.redeem_shield(accounts[0].address, amount, secret)
|
|
242
|
+
.send({ from: this.adminAddress });
|
|
232
243
|
await txClaim.wait();
|
|
233
244
|
this.logger.verbose(`Minting complete.`);
|
|
234
245
|
|
|
@@ -242,16 +253,16 @@ export class BlacklistTokenContractTest {
|
|
|
242
253
|
} = this;
|
|
243
254
|
tokenSim.mintPublic(address, amount);
|
|
244
255
|
|
|
245
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate();
|
|
256
|
+
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
246
257
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
247
258
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
248
259
|
|
|
249
260
|
tokenSim.mintPrivate(address, amount);
|
|
250
|
-
const privateBalance = await asset.methods.balance_of_private(address).simulate();
|
|
261
|
+
const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
|
|
251
262
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
252
263
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
253
264
|
|
|
254
|
-
const totalSupply = await asset.methods.total_supply().simulate();
|
|
265
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: address });
|
|
255
266
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
256
267
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
257
268
|
|
|
@@ -39,7 +39,6 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
39
39
|
export class CrossChainMessagingTest {
|
|
40
40
|
private snapshotManager: ISnapshotManager;
|
|
41
41
|
logger: Logger;
|
|
42
|
-
wallets: AccountWallet[] = [];
|
|
43
42
|
accounts: CompleteAddress[] = [];
|
|
44
43
|
aztecNode!: AztecNode;
|
|
45
44
|
pxe!: PXE;
|
|
@@ -49,7 +48,9 @@ export class CrossChainMessagingTest {
|
|
|
49
48
|
l1Client!: ExtendedViemWalletClient | undefined;
|
|
50
49
|
|
|
51
50
|
user1Wallet!: AccountWallet;
|
|
51
|
+
user1Address!: AztecAddress;
|
|
52
52
|
user2Wallet!: AccountWallet;
|
|
53
|
+
user2Address!: AztecAddress;
|
|
53
54
|
crossChainTestHarness!: CrossChainTestHarness;
|
|
54
55
|
ethAccount!: EthAddress;
|
|
55
56
|
ownerAddress!: AztecAddress;
|
|
@@ -99,12 +100,14 @@ export class CrossChainMessagingTest {
|
|
|
99
100
|
'3_accounts',
|
|
100
101
|
deployAccounts(3, this.logger),
|
|
101
102
|
async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode }) => {
|
|
102
|
-
|
|
103
|
-
this.accounts =
|
|
104
|
-
|
|
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()}`));
|
|
105
106
|
|
|
106
|
-
this.user1Wallet =
|
|
107
|
-
this.
|
|
107
|
+
this.user1Wallet = wallets[0];
|
|
108
|
+
this.user1Address = this.user1Wallet.getAddress();
|
|
109
|
+
this.user2Wallet = wallets[1];
|
|
110
|
+
this.user2Address = this.user2Wallet.getAddress();
|
|
108
111
|
|
|
109
112
|
this.pxe = pxe;
|
|
110
113
|
this.aztecNode = aztecNode;
|
|
@@ -118,7 +121,7 @@ export class CrossChainMessagingTest {
|
|
|
118
121
|
// Create the token contract state.
|
|
119
122
|
// Move this account thing to addAccounts above?
|
|
120
123
|
this.logger.verbose(`Public deploy accounts...`);
|
|
121
|
-
await publicDeployAccounts(this.
|
|
124
|
+
await publicDeployAccounts(this.user1Wallet, this.accounts.slice(0, 3));
|
|
122
125
|
|
|
123
126
|
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
124
127
|
|
|
@@ -133,7 +136,8 @@ export class CrossChainMessagingTest {
|
|
|
133
136
|
this.aztecNode,
|
|
134
137
|
this.pxe,
|
|
135
138
|
this.l1Client,
|
|
136
|
-
this.
|
|
139
|
+
this.user1Wallet,
|
|
140
|
+
this.user1Address,
|
|
137
141
|
this.logger,
|
|
138
142
|
underlyingERC20Address,
|
|
139
143
|
);
|
|
@@ -176,6 +180,7 @@ export class CrossChainMessagingTest {
|
|
|
176
180
|
l1Client,
|
|
177
181
|
this.aztecNodeConfig.l1Contracts,
|
|
178
182
|
this.user1Wallet,
|
|
183
|
+
this.user1Address,
|
|
179
184
|
);
|
|
180
185
|
|
|
181
186
|
this.l1Client = l1Client;
|
|
@@ -22,11 +22,10 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
22
22
|
|
|
23
23
|
export class DeployTest {
|
|
24
24
|
private snapshotManager: ISnapshotManager;
|
|
25
|
-
private wallets: AccountWallet[] = [];
|
|
26
|
-
|
|
27
25
|
public logger: Logger;
|
|
28
26
|
public pxe!: PXE;
|
|
29
27
|
public wallet!: AccountWallet;
|
|
28
|
+
public defaultAccountAddress!: AztecAddress;
|
|
30
29
|
public aztecNode!: AztecNode;
|
|
31
30
|
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
32
31
|
|
|
@@ -52,9 +51,10 @@ export class DeployTest {
|
|
|
52
51
|
'initial_account',
|
|
53
52
|
deployAccounts(1, this.logger),
|
|
54
53
|
async ({ deployedAccounts }, { pxe }) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
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();
|
|
58
58
|
},
|
|
59
59
|
);
|
|
60
60
|
}
|
|
@@ -67,7 +67,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
67
67
|
const amount = FEE_FUNDING_FOR_TESTER_ACCOUNT;
|
|
68
68
|
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, bobsAddress);
|
|
69
69
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
70
|
-
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send().wait();
|
|
70
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, amount, secret, index).send({ from: bobsAddress }).wait();
|
|
71
71
|
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
72
72
|
expect(balance).toEqual(amount);
|
|
73
73
|
});
|
|
@@ -58,6 +58,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
58
58
|
export class FeesTest {
|
|
59
59
|
private snapshotManager: ISnapshotManager;
|
|
60
60
|
private wallets: AccountWallet[] = [];
|
|
61
|
+
private accounts: AztecAddress[] = [];
|
|
61
62
|
|
|
62
63
|
public logger: Logger;
|
|
63
64
|
public pxe!: PXE;
|
|
@@ -156,19 +157,23 @@ export class FeesTest {
|
|
|
156
157
|
return { sequencerBlockRewards, proverBlockRewards };
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
async mintAndBridgeFeeJuice(
|
|
160
|
-
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount,
|
|
160
|
+
async mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress, amount: bigint) {
|
|
161
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, recipient);
|
|
161
162
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
162
|
-
await this.feeJuiceContract.methods.claim(
|
|
163
|
+
await this.feeJuiceContract.methods.claim(recipient, amount, secret, index).send({ from: minter }).wait();
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
166
167
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
167
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
168
|
+
const balanceBefore = await this.bananaCoin.methods
|
|
169
|
+
.balance_of_private(address)
|
|
170
|
+
.simulate({ from: this.aliceAddress });
|
|
168
171
|
|
|
169
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceWallet, address, amount);
|
|
172
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, this.aliceWallet, address, amount);
|
|
170
173
|
|
|
171
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
174
|
+
const balanceAfter = await this.bananaCoin.methods
|
|
175
|
+
.balance_of_private(address)
|
|
176
|
+
.simulate({ from: this.aliceAddress });
|
|
172
177
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
173
178
|
}
|
|
174
179
|
|
|
@@ -191,8 +196,9 @@ export class FeesTest {
|
|
|
191
196
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
192
197
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
193
198
|
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
199
|
+
this.accounts = this.wallets.map(w => w.getAddress());
|
|
194
200
|
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
195
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.
|
|
201
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
|
|
196
202
|
|
|
197
203
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
198
204
|
this.fpcAdmin = this.aliceAddress;
|
|
@@ -219,7 +225,12 @@ export class FeesTest {
|
|
|
219
225
|
|
|
220
226
|
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.aliceWallet);
|
|
221
227
|
|
|
222
|
-
this.getGasBalanceFn = getBalancesFn(
|
|
228
|
+
this.getGasBalanceFn = getBalancesFn(
|
|
229
|
+
'⛽',
|
|
230
|
+
this.feeJuiceContract.methods.balance_of_public,
|
|
231
|
+
this.aliceAddress,
|
|
232
|
+
this.logger,
|
|
233
|
+
);
|
|
223
234
|
|
|
224
235
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
225
236
|
aztecNode: context.aztecNode,
|
|
@@ -238,7 +249,7 @@ export class FeesTest {
|
|
|
238
249
|
'deploy_banana_token',
|
|
239
250
|
async () => {
|
|
240
251
|
const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
241
|
-
.send()
|
|
252
|
+
.send({ from: this.aliceAddress })
|
|
242
253
|
.deployed();
|
|
243
254
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
244
255
|
return { bananaCoinAddress: bananaCoin.address };
|
|
@@ -246,10 +257,16 @@ export class FeesTest {
|
|
|
246
257
|
async ({ bananaCoinAddress }) => {
|
|
247
258
|
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.aliceWallet);
|
|
248
259
|
const logger = this.logger;
|
|
249
|
-
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
260
|
+
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
261
|
+
'🍌.public',
|
|
262
|
+
this.bananaCoin.methods.balance_of_public,
|
|
263
|
+
this.aliceAddress,
|
|
264
|
+
logger,
|
|
265
|
+
);
|
|
250
266
|
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
251
267
|
'🍌.private',
|
|
252
268
|
this.bananaCoin.methods.balance_of_private,
|
|
269
|
+
this.aliceAddress,
|
|
253
270
|
logger,
|
|
254
271
|
);
|
|
255
272
|
},
|
|
@@ -265,12 +282,16 @@ export class FeesTest {
|
|
|
265
282
|
|
|
266
283
|
const bananaCoin = this.bananaCoin;
|
|
267
284
|
const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin)
|
|
268
|
-
.send()
|
|
285
|
+
.send({ from: this.aliceAddress })
|
|
269
286
|
.deployed();
|
|
270
287
|
|
|
271
288
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
272
289
|
|
|
273
|
-
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(
|
|
290
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(
|
|
291
|
+
FEE_FUNDING_FOR_TESTER_ACCOUNT,
|
|
292
|
+
bananaFPC.address,
|
|
293
|
+
this.aliceAddress,
|
|
294
|
+
);
|
|
274
295
|
|
|
275
296
|
return {
|
|
276
297
|
bananaFPCAddress: bananaFPC.address,
|
|
@@ -349,7 +370,10 @@ export class FeesTest {
|
|
|
349
370
|
'fund_alice',
|
|
350
371
|
async () => {
|
|
351
372
|
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
352
|
-
await this.bananaCoin.methods
|
|
373
|
+
await this.bananaCoin.methods
|
|
374
|
+
.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS)
|
|
375
|
+
.send({ from: this.aliceAddress })
|
|
376
|
+
.wait();
|
|
353
377
|
},
|
|
354
378
|
() => Promise.resolve(),
|
|
355
379
|
);
|
|
@@ -364,37 +388,4 @@ export class FeesTest {
|
|
|
364
388
|
() => Promise.resolve(),
|
|
365
389
|
);
|
|
366
390
|
}
|
|
367
|
-
|
|
368
|
-
public async applySetupSubscription() {
|
|
369
|
-
await this.snapshotManager.snapshot(
|
|
370
|
-
'setup_subscription',
|
|
371
|
-
async () => {
|
|
372
|
-
const counterContract = await CounterContract.deploy(this.bobWallet, 0, this.bobAddress).send().deployed();
|
|
373
|
-
|
|
374
|
-
// Deploy subscription contract, that allows subscriptions for SUBSCRIPTION_AMOUNT of bananas
|
|
375
|
-
const subscriptionContract = await AppSubscriptionContract.deploy(
|
|
376
|
-
this.bobWallet,
|
|
377
|
-
counterContract.address,
|
|
378
|
-
this.bobAddress,
|
|
379
|
-
this.bananaCoin.address,
|
|
380
|
-
this.SUBSCRIPTION_AMOUNT,
|
|
381
|
-
this.APP_SPONSORED_TX_GAS_LIMIT,
|
|
382
|
-
)
|
|
383
|
-
.send()
|
|
384
|
-
.deployed();
|
|
385
|
-
|
|
386
|
-
// Mint some Fee Juice to the subscription contract
|
|
387
|
-
// Could also use bridgeFromL1ToL2 from the harness, but this is more direct
|
|
388
|
-
await this.mintAndBridgeFeeJuice(subscriptionContract.address, FEE_FUNDING_FOR_TESTER_ACCOUNT);
|
|
389
|
-
return {
|
|
390
|
-
counterContractAddress: counterContract.address,
|
|
391
|
-
subscriptionContractAddress: subscriptionContract.address,
|
|
392
|
-
};
|
|
393
|
-
},
|
|
394
|
-
async ({ counterContractAddress, subscriptionContractAddress }) => {
|
|
395
|
-
this.counterContract = await CounterContract.at(counterContractAddress, this.bobWallet);
|
|
396
|
-
this.subscriptionContract = await AppSubscriptionContract.at(subscriptionContractAddress, this.bobWallet);
|
|
397
|
-
},
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
391
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type AccountWallet,
|
|
2
|
+
import { type AccountWallet, AztecAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js';
|
|
3
3
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
4
4
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
5
5
|
|
|
@@ -16,8 +16,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
16
16
|
export class NestedContractTest {
|
|
17
17
|
private snapshotManager: ISnapshotManager;
|
|
18
18
|
logger: Logger;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
wallet!: AccountWallet;
|
|
20
|
+
defaultAccountAddress!: AztecAddress;
|
|
21
21
|
pxe!: PXE;
|
|
22
22
|
|
|
23
23
|
parentContract!: ParentContract;
|
|
@@ -41,9 +41,10 @@ export class NestedContractTest {
|
|
|
41
41
|
'accounts',
|
|
42
42
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
43
43
|
async ({ deployedAccounts }, { pxe }) => {
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
44
|
+
const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
45
|
+
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
46
|
+
[this.wallet] = wallets;
|
|
47
|
+
this.defaultAccountAddress = this.wallet.getAddress();
|
|
47
48
|
this.pxe = pxe;
|
|
48
49
|
},
|
|
49
50
|
);
|
|
@@ -53,7 +54,7 @@ export class NestedContractTest {
|
|
|
53
54
|
async () => {},
|
|
54
55
|
async () => {
|
|
55
56
|
this.logger.verbose(`Public deploy accounts...`);
|
|
56
|
-
await publicDeployAccounts(this.
|
|
57
|
+
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
57
58
|
},
|
|
58
59
|
);
|
|
59
60
|
}
|
|
@@ -76,13 +77,17 @@ export class NestedContractTest {
|
|
|
76
77
|
await this.snapshotManager.snapshot(
|
|
77
78
|
'manual',
|
|
78
79
|
async () => {
|
|
79
|
-
const parentContract = await ParentContract.deploy(this.
|
|
80
|
-
|
|
80
|
+
const parentContract = await ParentContract.deploy(this.wallet)
|
|
81
|
+
.send({ from: this.defaultAccountAddress })
|
|
82
|
+
.deployed();
|
|
83
|
+
const childContract = await ChildContract.deploy(this.wallet)
|
|
84
|
+
.send({ from: this.defaultAccountAddress })
|
|
85
|
+
.deployed();
|
|
81
86
|
return { parentContractAddress: parentContract.address, childContractAddress: childContract.address };
|
|
82
87
|
},
|
|
83
88
|
async ({ parentContractAddress, childContractAddress }) => {
|
|
84
|
-
this.parentContract = await ParentContract.at(parentContractAddress, this.
|
|
85
|
-
this.childContract = await ChildContract.at(childContractAddress, this.
|
|
89
|
+
this.parentContract = await ParentContract.at(parentContractAddress, this.wallet);
|
|
90
|
+
this.childContract = await ChildContract.at(childContractAddress, this.wallet);
|
|
86
91
|
},
|
|
87
92
|
);
|
|
88
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
-
import { type AccountWalletWithSecretKey, EthAddress, Fr } from '@aztec/aztec.js';
|
|
4
|
+
import { type AccountWalletWithSecretKey, AztecAddress, EthAddress, Fr } from '@aztec/aztec.js';
|
|
5
5
|
import {
|
|
6
6
|
type ExtendedViemWalletClient,
|
|
7
7
|
GSEContract,
|
|
@@ -72,6 +72,7 @@ export class P2PNetworkTest {
|
|
|
72
72
|
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
73
73
|
// The re-execution test needs a wallet and a spam contract
|
|
74
74
|
public wallet?: AccountWalletWithSecretKey;
|
|
75
|
+
public defaultAccountAddress?: AztecAddress;
|
|
75
76
|
public spamContract?: SpamContract;
|
|
76
77
|
|
|
77
78
|
public bootstrapNode?: BootstrapNode;
|
|
@@ -299,6 +300,7 @@ export class P2PNetworkTest {
|
|
|
299
300
|
this.deployedAccounts = deployedAccounts;
|
|
300
301
|
const [account] = deployedAccounts;
|
|
301
302
|
this.wallet = await getSchnorrWalletWithSecretKey(pxe, account.secret, account.signingKey, account.salt);
|
|
303
|
+
this.defaultAccountAddress = this.wallet.getAddress();
|
|
302
304
|
},
|
|
303
305
|
);
|
|
304
306
|
}
|
|
@@ -311,7 +313,9 @@ export class P2PNetworkTest {
|
|
|
311
313
|
throw new Error('Call snapshot t.setupAccount before deploying account contract');
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
const spamContract = await SpamContract.deploy(this.wallet)
|
|
316
|
+
const spamContract = await SpamContract.deploy(this.wallet)
|
|
317
|
+
.send({ from: this.defaultAccountAddress! })
|
|
318
|
+
.deployed();
|
|
315
319
|
return { contractAddress: spamContract.address };
|
|
316
320
|
},
|
|
317
321
|
async ({ contractAddress }) => {
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
|
2
2
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
3
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import {
|
|
5
|
+
AztecAddress,
|
|
5
6
|
Fr,
|
|
6
7
|
type Logger,
|
|
7
8
|
ProvenTx,
|
|
@@ -28,6 +29,7 @@ import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
|
28
29
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
29
30
|
export const submitComplexTxsTo = async (
|
|
30
31
|
logger: Logger,
|
|
32
|
+
from: AztecAddress,
|
|
31
33
|
spamContract: SpamContract,
|
|
32
34
|
numTxs: number,
|
|
33
35
|
opts: { callPublic?: boolean } = {},
|
|
@@ -37,7 +39,7 @@ export const submitComplexTxsTo = async (
|
|
|
37
39
|
const seed = 1234n;
|
|
38
40
|
const spamCount = 15;
|
|
39
41
|
for (let i = 0; i < numTxs; i++) {
|
|
40
|
-
const tx = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic).send();
|
|
42
|
+
const tx = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic).send({ from });
|
|
41
43
|
const txHash = await tx.getTxHash();
|
|
42
44
|
|
|
43
45
|
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
@@ -97,7 +99,7 @@ export async function createPXEServiceAndPrepareTransactions(
|
|
|
97
99
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
98
100
|
|
|
99
101
|
const txs = await timesAsync(numTxs, async () => {
|
|
100
|
-
const tx = await contract.methods.emit_nullifier(Fr.random()).prove();
|
|
102
|
+
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: account.getAddress() });
|
|
101
103
|
const txHash = tx.getTxHash();
|
|
102
104
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
103
105
|
return tx;
|