@aztec/end-to-end 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114
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 +10 -10
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +98 -133
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +5 -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 +94 -112
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -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 +60 -62
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +15 -13
- package/dest/e2e_epochs/epochs_test.js +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +2 -4
- package/dest/e2e_fees/fees_test.d.ts +11 -11
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +118 -139
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -8
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +29 -40
- package/dest/e2e_p2p/inactivity_slash_test.js +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts +5 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +99 -102
- package/dest/e2e_token_contract/token_contract_test.d.ts +15 -8
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +88 -92
- package/dest/fixtures/e2e_prover_test.d.ts +7 -13
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +78 -91
- package/dest/fixtures/snapshot_manager.d.ts +10 -44
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +12 -255
- package/dest/fixtures/utils.js +3 -3
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.d.ts +4 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +21 -1
- package/dest/spartan/utils.d.ts +5 -1
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +25 -8
- package/package.json +38 -38
- package/src/bench/client_flows/client_flows_benchmark.ts +134 -192
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -136
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +91 -103
- package/src/e2e_deploy_contract/deploy_test.ts +18 -14
- package/src/e2e_epochs/epochs_test.ts +1 -1
- package/src/e2e_fees/bridging_race.notest.ts +2 -5
- package/src/e2e_fees/fees_test.ts +165 -210
- package/src/e2e_l1_publisher/write_json.ts +1 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +30 -54
- package/src/e2e_p2p/inactivity_slash_test.ts +1 -1
- package/src/e2e_p2p/p2p_network.ts +149 -165
- package/src/e2e_token_contract/token_contract_test.ts +104 -113
- package/src/fixtures/e2e_prover_test.ts +97 -130
- package/src/fixtures/snapshot_manager.ts +12 -325
- package/src/fixtures/utils.ts +3 -3
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/spartan/setup_test_wallets.ts +7 -1
- package/src/spartan/tx_metrics.ts +21 -1
- package/src/spartan/utils.ts +26 -8
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
|
@@ -26,25 +26,18 @@ import { getContract } from 'viem';
|
|
|
26
26
|
|
|
27
27
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
28
28
|
import {
|
|
29
|
-
type ISnapshotManager,
|
|
30
29
|
type SubsystemsContext,
|
|
31
|
-
createSnapshotManager,
|
|
32
30
|
deployAccounts,
|
|
31
|
+
publicDeployAccounts,
|
|
32
|
+
setupFromFresh,
|
|
33
|
+
teardown,
|
|
33
34
|
} from '../fixtures/snapshot_manager.js';
|
|
34
35
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
35
|
-
import {
|
|
36
|
-
type BalancesFn,
|
|
37
|
-
type SetupOptions,
|
|
38
|
-
ensureAccountContractsPublished,
|
|
39
|
-
getBalancesFn,
|
|
40
|
-
setupSponsoredFPC,
|
|
41
|
-
} from '../fixtures/utils.js';
|
|
36
|
+
import { type BalancesFn, type SetupOptions, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
42
37
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
43
38
|
|
|
44
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
45
|
-
|
|
46
39
|
/**
|
|
47
|
-
* Test fixture for testing fees. Provides the following
|
|
40
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
48
41
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
49
42
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
50
43
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
@@ -54,8 +47,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
54
47
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
55
48
|
*/
|
|
56
49
|
export class FeesTest {
|
|
57
|
-
private snapshotManager: ISnapshotManager;
|
|
58
50
|
private accounts: AztecAddress[] = [];
|
|
51
|
+
public context!: SubsystemsContext;
|
|
59
52
|
|
|
60
53
|
public logger: Logger;
|
|
61
54
|
public aztecNode!: AztecNode;
|
|
@@ -82,7 +75,6 @@ export class FeesTest {
|
|
|
82
75
|
public subscriptionContract!: AppSubscriptionContract;
|
|
83
76
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
84
77
|
|
|
85
|
-
public context!: SubsystemsContext;
|
|
86
78
|
public chainMonitor!: ChainMonitor;
|
|
87
79
|
|
|
88
80
|
public getCoinbaseBalance!: () => Promise<bigint>;
|
|
@@ -99,7 +91,7 @@ export class FeesTest {
|
|
|
99
91
|
constructor(
|
|
100
92
|
testName: string,
|
|
101
93
|
private numberOfAccounts = 3,
|
|
102
|
-
setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
94
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
103
95
|
) {
|
|
104
96
|
if (!numberOfAccounts) {
|
|
105
97
|
throw new Error('There must be at least 1 initial account.');
|
|
@@ -107,26 +99,27 @@ export class FeesTest {
|
|
|
107
99
|
setupOptions.coinbase ??= EthAddress.random();
|
|
108
100
|
this.coinbase = setupOptions.coinbase!;
|
|
109
101
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
110
|
-
this.snapshotManager = createSnapshotManager(
|
|
111
|
-
`e2e_fees/${testName}-${numberOfAccounts}`,
|
|
112
|
-
dataPath,
|
|
113
|
-
{ startProverNode: true, ...setupOptions },
|
|
114
|
-
{ ...setupOptions },
|
|
115
|
-
);
|
|
116
102
|
}
|
|
117
103
|
|
|
118
104
|
async setup() {
|
|
119
|
-
|
|
105
|
+
this.logger.verbose('Setting up fresh context...');
|
|
106
|
+
this.context = await setupFromFresh(
|
|
107
|
+
this.logger,
|
|
108
|
+
{ startProverNode: true, ...this.setupOptions },
|
|
109
|
+
{ ...this.setupOptions },
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.aztecNodeConfig);
|
|
113
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
120
114
|
|
|
121
|
-
this.
|
|
122
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider, this.logger, 200).start();
|
|
115
|
+
await this.applyBaseSetup();
|
|
123
116
|
|
|
124
117
|
return this;
|
|
125
118
|
}
|
|
126
119
|
|
|
127
120
|
async teardown() {
|
|
128
121
|
await this.chainMonitor.stop();
|
|
129
|
-
await this.
|
|
122
|
+
await teardown(this.context);
|
|
130
123
|
}
|
|
131
124
|
|
|
132
125
|
setIsMarkingAsProven(b: boolean) {
|
|
@@ -176,210 +169,172 @@ export class FeesTest {
|
|
|
176
169
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
177
170
|
}
|
|
178
171
|
|
|
179
|
-
public async
|
|
180
|
-
await this.
|
|
181
|
-
await this.
|
|
182
|
-
await this.
|
|
183
|
-
await this.
|
|
172
|
+
public async applyBaseSetup() {
|
|
173
|
+
await this.applyInitialAccounts();
|
|
174
|
+
await this.applyPublicDeployAccounts();
|
|
175
|
+
await this.applySetupFeeJuice();
|
|
176
|
+
await this.applyDeployBananaToken();
|
|
184
177
|
}
|
|
185
178
|
|
|
186
|
-
async
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
179
|
+
async applyInitialAccounts() {
|
|
180
|
+
this.logger.info('Applying initial accounts setup');
|
|
181
|
+
|
|
182
|
+
const { deployedAccounts } = await deployAccounts(
|
|
183
|
+
this.numberOfAccounts,
|
|
184
|
+
this.logger,
|
|
185
|
+
)({
|
|
186
|
+
wallet: this.context.wallet,
|
|
187
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
this.wallet = this.context.wallet;
|
|
191
|
+
this.aztecNode = this.context.aztecNode;
|
|
192
|
+
this.aztecNodeAdmin = this.context.aztecNode;
|
|
193
|
+
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
194
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
195
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
196
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
197
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
198
|
+
|
|
199
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
200
|
+
this.fpcAdmin = this.aliceAddress;
|
|
201
|
+
|
|
202
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
203
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
207
204
|
}
|
|
208
205
|
|
|
209
|
-
async
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
);
|
|
206
|
+
async applyPublicDeployAccounts() {
|
|
207
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
208
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
213
209
|
}
|
|
214
210
|
|
|
215
|
-
async
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
'⛽',
|
|
226
|
-
this.feeJuiceContract.methods.balance_of_public,
|
|
227
|
-
this.aliceAddress,
|
|
228
|
-
this.logger,
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
232
|
-
aztecNode: context.aztecNode,
|
|
233
|
-
aztecNodeAdmin: context.aztecNode,
|
|
234
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
235
|
-
wallet: this.wallet,
|
|
236
|
-
logger: this.logger,
|
|
237
|
-
});
|
|
238
|
-
},
|
|
211
|
+
async applySetupFeeJuice() {
|
|
212
|
+
this.logger.info('Applying fee juice setup');
|
|
213
|
+
|
|
214
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
215
|
+
|
|
216
|
+
this.getGasBalanceFn = getBalancesFn(
|
|
217
|
+
'⛽',
|
|
218
|
+
this.feeJuiceContract.methods.balance_of_public,
|
|
219
|
+
this.aliceAddress,
|
|
220
|
+
this.logger,
|
|
239
221
|
);
|
|
222
|
+
|
|
223
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
224
|
+
aztecNode: this.context.aztecNode,
|
|
225
|
+
aztecNodeAdmin: this.context.aztecNode,
|
|
226
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
227
|
+
wallet: this.wallet,
|
|
228
|
+
logger: this.logger,
|
|
229
|
+
});
|
|
240
230
|
}
|
|
241
231
|
|
|
242
|
-
async
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
'🍌.private',
|
|
263
|
-
this.bananaCoin.methods.balance_of_private,
|
|
264
|
-
this.aliceAddress,
|
|
265
|
-
logger,
|
|
266
|
-
);
|
|
267
|
-
return Promise.resolve();
|
|
268
|
-
},
|
|
232
|
+
async applyDeployBananaToken() {
|
|
233
|
+
this.logger.info('Applying deploy banana token setup');
|
|
234
|
+
|
|
235
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
236
|
+
.send({ from: this.aliceAddress })
|
|
237
|
+
.deployed();
|
|
238
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
239
|
+
|
|
240
|
+
this.bananaCoin = bananaCoin;
|
|
241
|
+
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
242
|
+
'🍌.public',
|
|
243
|
+
this.bananaCoin.methods.balance_of_public,
|
|
244
|
+
this.aliceAddress,
|
|
245
|
+
this.logger,
|
|
246
|
+
);
|
|
247
|
+
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
248
|
+
'🍌.private',
|
|
249
|
+
this.bananaCoin.methods.balance_of_private,
|
|
250
|
+
this.aliceAddress,
|
|
251
|
+
this.logger,
|
|
269
252
|
);
|
|
270
253
|
}
|
|
271
254
|
|
|
272
|
-
public async
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
await this.rollupContract.getManaTarget(),
|
|
329
|
-
) + (await this.rollupContract.getProvingCostPerMana());
|
|
330
|
-
|
|
331
|
-
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
332
|
-
|
|
333
|
-
const mana = block!.header.totalManaUsed.toBigInt();
|
|
334
|
-
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
335
|
-
};
|
|
336
|
-
return Promise.resolve();
|
|
337
|
-
},
|
|
338
|
-
);
|
|
255
|
+
public async applyFPCSetup() {
|
|
256
|
+
this.logger.info('Applying FPC setup');
|
|
257
|
+
|
|
258
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
259
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
260
|
+
|
|
261
|
+
const bananaCoin = this.bananaCoin;
|
|
262
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
263
|
+
.send({ from: this.aliceAddress })
|
|
264
|
+
.deployed();
|
|
265
|
+
|
|
266
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
267
|
+
|
|
268
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
269
|
+
|
|
270
|
+
this.bananaFPC = bananaFPC;
|
|
271
|
+
|
|
272
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
273
|
+
|
|
274
|
+
this.getCoinbaseBalance = async () => {
|
|
275
|
+
const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
276
|
+
const gasL1 = getContract({
|
|
277
|
+
address: l1FeeJuiceAddress.toString(),
|
|
278
|
+
abi: TestERC20Abi,
|
|
279
|
+
client: l1Client,
|
|
280
|
+
});
|
|
281
|
+
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
this.getCoinbaseSequencerRewards = async () => {
|
|
285
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
this.getProverFee = async (blockNumber: BlockNumber) => {
|
|
289
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
290
|
+
|
|
291
|
+
// @todo @lherskind As we deal with #13601
|
|
292
|
+
// Right now the value is from `FeeLib.sol`
|
|
293
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
294
|
+
|
|
295
|
+
// We round up
|
|
296
|
+
const mulDiv = (a: bigint, b: bigint, c: bigint) => (a * b) / c + ((a * b) % c > 0n ? 1n : 0n);
|
|
297
|
+
|
|
298
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block!.header.globalVariables.timestamp);
|
|
299
|
+
const proverCost =
|
|
300
|
+
mulDiv(
|
|
301
|
+
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())),
|
|
302
|
+
1n,
|
|
303
|
+
await this.rollupContract.getManaTarget(),
|
|
304
|
+
) + (await this.rollupContract.getProvingCostPerMana());
|
|
305
|
+
|
|
306
|
+
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
307
|
+
|
|
308
|
+
const mana = block!.header.totalManaUsed.toBigInt();
|
|
309
|
+
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
310
|
+
};
|
|
339
311
|
}
|
|
340
312
|
|
|
341
|
-
public async
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return {
|
|
352
|
-
sponsoredFPCAddress: sponsoredFPC.address,
|
|
353
|
-
};
|
|
354
|
-
},
|
|
355
|
-
data => {
|
|
356
|
-
this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
357
|
-
return Promise.resolve();
|
|
358
|
-
},
|
|
359
|
-
);
|
|
313
|
+
public async applySponsoredFPCSetup() {
|
|
314
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
315
|
+
|
|
316
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
317
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
318
|
+
|
|
319
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
320
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
321
|
+
|
|
322
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
360
323
|
}
|
|
361
324
|
|
|
362
325
|
public async applyFundAliceWithBananas() {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
.wait();
|
|
371
|
-
},
|
|
372
|
-
() => Promise.resolve(),
|
|
373
|
-
);
|
|
326
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
327
|
+
|
|
328
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
329
|
+
await this.bananaCoin.methods
|
|
330
|
+
.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS)
|
|
331
|
+
.send({ from: this.aliceAddress })
|
|
332
|
+
.wait();
|
|
374
333
|
}
|
|
375
334
|
|
|
376
335
|
public async applyFundAliceWithPrivateBananas() {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
381
|
-
},
|
|
382
|
-
() => Promise.resolve(),
|
|
383
|
-
);
|
|
336
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
337
|
+
|
|
338
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
384
339
|
}
|
|
385
340
|
}
|
|
@@ -54,6 +54,7 @@ export async function writeJson(
|
|
|
54
54
|
blockHeadersHash: asHex(block.header.blockHeadersHash),
|
|
55
55
|
blobsHash: asHex(block.header.blobsHash),
|
|
56
56
|
inHash: asHex(block.header.inHash),
|
|
57
|
+
outHash: asHex(block.header.epochOutHash),
|
|
57
58
|
slotNumber: Number(block.header.globalVariables.slotNumber),
|
|
58
59
|
timestamp: Number(block.header.globalVariables.timestamp),
|
|
59
60
|
coinbase: asHex(block.header.globalVariables.coinbase, 40),
|
|
@@ -6,17 +6,15 @@ import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
|
6
6
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
type ISnapshotManager,
|
|
10
9
|
type SubsystemsContext,
|
|
11
|
-
createSnapshotManager,
|
|
12
10
|
deployAccounts,
|
|
13
11
|
publicDeployAccounts,
|
|
12
|
+
setupFromFresh,
|
|
13
|
+
teardown as teardownSubsystems,
|
|
14
14
|
} from '../fixtures/snapshot_manager.js';
|
|
15
15
|
|
|
16
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
17
|
-
|
|
18
16
|
export class NestedContractTest {
|
|
19
|
-
|
|
17
|
+
context!: SubsystemsContext;
|
|
20
18
|
logger: Logger;
|
|
21
19
|
wallet!: Wallet;
|
|
22
20
|
defaultAccountAddress!: AztecAddress;
|
|
@@ -30,67 +28,45 @@ export class NestedContractTest {
|
|
|
30
28
|
private numberOfAccounts = 1,
|
|
31
29
|
) {
|
|
32
30
|
this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`);
|
|
33
|
-
this.snapshotManager = createSnapshotManager(`e2e_nested_contract/${testName}-${numberOfAccounts}`, dataPath);
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
|
-
*
|
|
38
|
-
* 1. Add 3 accounts.
|
|
39
|
-
* 2. Publicly deploy accounts
|
|
34
|
+
* Applies base setup by deploying accounts and publicly deploying them.
|
|
40
35
|
*/
|
|
41
|
-
async
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
async applyBaseSetup() {
|
|
37
|
+
this.logger.info('Deploying accounts');
|
|
38
|
+
const { deployedAccounts } = await deployAccounts(
|
|
39
|
+
this.numberOfAccounts,
|
|
40
|
+
this.logger,
|
|
41
|
+
)({
|
|
42
|
+
wallet: this.context.wallet,
|
|
43
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
44
|
+
});
|
|
45
|
+
this.wallet = this.context.wallet;
|
|
46
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
47
|
+
this.aztecNode = this.context.aztecNode;
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
async () => {},
|
|
56
|
-
async () => {
|
|
57
|
-
this.logger.verbose(`Public deploy accounts...`);
|
|
58
|
-
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
59
|
-
},
|
|
60
|
-
);
|
|
49
|
+
this.logger.info('Public deploy accounts');
|
|
50
|
+
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
61
51
|
}
|
|
62
52
|
|
|
63
53
|
async setup() {
|
|
64
|
-
|
|
54
|
+
this.logger.info('Setting up fresh subsystems');
|
|
55
|
+
this.context = await setupFromFresh(this.logger);
|
|
56
|
+
await this.applyBaseSetup();
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
async teardown() {
|
|
68
|
-
await this.
|
|
60
|
+
await teardownSubsystems(this.context);
|
|
69
61
|
}
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'manual',
|
|
80
|
-
async () => {
|
|
81
|
-
const parentContract = await ParentContract.deploy(this.wallet)
|
|
82
|
-
.send({ from: this.defaultAccountAddress })
|
|
83
|
-
.deployed();
|
|
84
|
-
const childContract = await ChildContract.deploy(this.wallet)
|
|
85
|
-
.send({ from: this.defaultAccountAddress })
|
|
86
|
-
.deployed();
|
|
87
|
-
return { parentContractAddress: parentContract.address, childContractAddress: childContract.address };
|
|
88
|
-
},
|
|
89
|
-
({ parentContractAddress, childContractAddress }) => {
|
|
90
|
-
this.parentContract = ParentContract.at(parentContractAddress, this.wallet);
|
|
91
|
-
this.childContract = ChildContract.at(childContractAddress, this.wallet);
|
|
92
|
-
return Promise.resolve();
|
|
93
|
-
},
|
|
94
|
-
);
|
|
63
|
+
async applyManual() {
|
|
64
|
+
this.logger.info('Deploying parent and child contracts');
|
|
65
|
+
const parentContract = await ParentContract.deploy(this.wallet)
|
|
66
|
+
.send({ from: this.defaultAccountAddress })
|
|
67
|
+
.deployed();
|
|
68
|
+
const childContract = await ChildContract.deploy(this.wallet).send({ from: this.defaultAccountAddress }).deployed();
|
|
69
|
+
this.parentContract = parentContract;
|
|
70
|
+
this.childContract = childContract;
|
|
95
71
|
}
|
|
96
72
|
}
|
|
@@ -82,8 +82,8 @@ export class P2PInactivityTest {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
public async setup() {
|
|
85
|
-
await this.test.applyBaseSnapshots();
|
|
86
85
|
await this.test.setup();
|
|
86
|
+
await this.test.applyBaseSetup();
|
|
87
87
|
|
|
88
88
|
// Set slashing penalties for inactivity
|
|
89
89
|
const { rollup } = await this.test.getContracts();
|