@aztec/end-to-end 0.0.1-commit.6230efd → 0.0.1-commit.6a729f7
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 +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +12 -13
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +118 -133
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +9 -8
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +17 -12
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -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 +96 -112
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +15 -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 +89 -70
- 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 +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +7 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +31 -9
- package/dest/e2e_fees/bridging_race.notest.js +3 -5
- package/dest/e2e_fees/fees_test.d.ts +13 -13
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +123 -141
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +14 -16
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +31 -39
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +111 -104
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +13 -20
- package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +89 -91
- package/dest/fixtures/e2e_prover_test.d.ts +8 -14
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +86 -95
- package/dest/fixtures/setup.d.ts +218 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +695 -0
- package/dest/fixtures/setup_p2p_test.d.ts +4 -5
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +24 -19
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/fixtures/utils.d.ts +5 -194
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -619
- 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/shared/cross_chain_test_harness.d.ts +16 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.d.ts +11 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.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 +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -28
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +51 -33
- package/dest/simulators/lending_simulator.d.ts +5 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +61 -34
- package/dest/spartan/tx_metrics.d.ts +51 -2
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +333 -6
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -253
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -892
- package/package.json +40 -39
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +138 -204
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +20 -14
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +127 -116
- package/src/e2e_deploy_contract/deploy_test.ts +21 -14
- package/src/e2e_epochs/epochs_test.ts +60 -34
- package/src/e2e_fees/bridging_race.notest.ts +3 -9
- package/src/e2e_fees/fees_test.ts +172 -220
- package/src/e2e_l1_publisher/write_json.ts +16 -16
- package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +5 -5
- package/src/e2e_p2p/p2p_network.ts +172 -168
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +26 -27
- package/src/e2e_token_contract/token_contract_test.ts +103 -118
- package/src/fixtures/e2e_prover_test.ts +99 -134
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +15 -20
- package/src/fixtures/token_utils.ts +6 -5
- package/src/fixtures/utils.ts +27 -907
- 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/shared/cross_chain_test_harness.ts +16 -36
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +58 -77
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +79 -25
- package/src/spartan/tx_metrics.ts +255 -9
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -1158
- package/dest/fixtures/snapshot_manager.d.ts +0 -93
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -493
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/snapshot_manager.ts +0 -651
|
@@ -14,13 +14,12 @@ import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
|
14
14
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
15
15
|
import { getContract } from 'viem';
|
|
16
16
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
17
|
-
import {
|
|
17
|
+
import { deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
18
18
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
19
|
-
import {
|
|
19
|
+
import { getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
20
20
|
import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
|
|
21
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
22
21
|
/**
|
|
23
|
-
* Test fixture for testing fees. Provides the following
|
|
22
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
24
23
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
25
24
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
26
25
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
@@ -30,8 +29,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
30
29
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
31
30
|
*/ export class FeesTest {
|
|
32
31
|
numberOfAccounts;
|
|
33
|
-
|
|
32
|
+
setupOptions;
|
|
34
33
|
accounts;
|
|
34
|
+
context;
|
|
35
35
|
logger;
|
|
36
36
|
aztecNode;
|
|
37
37
|
aztecNodeAdmin;
|
|
@@ -51,7 +51,6 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
51
51
|
counterContract;
|
|
52
52
|
subscriptionContract;
|
|
53
53
|
feeJuiceBridgeTestHarness;
|
|
54
|
-
context;
|
|
55
54
|
chainMonitor;
|
|
56
55
|
getCoinbaseBalance;
|
|
57
56
|
getCoinbaseSequencerRewards;
|
|
@@ -64,6 +63,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
64
63
|
APP_SPONSORED_TX_GAS_LIMIT;
|
|
65
64
|
constructor(testName, numberOfAccounts = 3, setupOptions = {}){
|
|
66
65
|
this.numberOfAccounts = numberOfAccounts;
|
|
66
|
+
this.setupOptions = setupOptions;
|
|
67
67
|
this.accounts = [];
|
|
68
68
|
this.ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
69
69
|
this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
@@ -74,22 +74,26 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
74
74
|
setupOptions.coinbase ??= EthAddress.random();
|
|
75
75
|
this.coinbase = setupOptions.coinbase;
|
|
76
76
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
77
|
-
this.snapshotManager = createSnapshotManager(`e2e_fees/${testName}-${numberOfAccounts}`, dataPath, {
|
|
78
|
-
startProverNode: true,
|
|
79
|
-
...setupOptions
|
|
80
|
-
}, {
|
|
81
|
-
...setupOptions
|
|
82
|
-
});
|
|
83
77
|
}
|
|
84
78
|
async setup() {
|
|
85
|
-
|
|
86
|
-
this.
|
|
87
|
-
|
|
79
|
+
this.logger.verbose('Setting up fresh context...');
|
|
80
|
+
this.context = await setup(0, {
|
|
81
|
+
startProverNode: true,
|
|
82
|
+
...this.setupOptions,
|
|
83
|
+
fundSponsoredFPC: true,
|
|
84
|
+
skipAccountDeployment: true,
|
|
85
|
+
l1ContractsArgs: {
|
|
86
|
+
...this.setupOptions
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
90
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
91
|
+
await this.applyBaseSetup();
|
|
88
92
|
return this;
|
|
89
93
|
}
|
|
90
94
|
async teardown() {
|
|
91
95
|
await this.chainMonitor.stop();
|
|
92
|
-
await this.
|
|
96
|
+
await teardown(this.context);
|
|
93
97
|
}
|
|
94
98
|
setIsMarkingAsProven(b) {
|
|
95
99
|
this.context.watcher.setIsMarkingAsProven(b);
|
|
@@ -103,7 +107,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
103
107
|
async getBlockRewards() {
|
|
104
108
|
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
105
109
|
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
106
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
110
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
107
111
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
108
112
|
const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
|
|
109
113
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
@@ -117,7 +121,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
117
121
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
118
122
|
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({
|
|
119
123
|
from: minter
|
|
120
|
-
})
|
|
124
|
+
});
|
|
121
125
|
}
|
|
122
126
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
|
|
123
127
|
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
@@ -129,138 +133,116 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
129
133
|
});
|
|
130
134
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
131
135
|
}
|
|
132
|
-
async
|
|
133
|
-
await this.
|
|
134
|
-
await this.
|
|
135
|
-
await this.
|
|
136
|
-
await this.
|
|
137
|
-
}
|
|
138
|
-
async
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
this.
|
|
143
|
-
this.gasSettings = GasSettings.default({
|
|
144
|
-
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
145
|
-
});
|
|
146
|
-
this.cheatCodes = cheatCodes;
|
|
147
|
-
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
148
|
-
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
149
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
150
|
-
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
151
|
-
this.fpcAdmin = this.aliceAddress;
|
|
152
|
-
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
153
|
-
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
136
|
+
async applyBaseSetup() {
|
|
137
|
+
await this.applyInitialAccounts();
|
|
138
|
+
await this.applyPublicDeployAccounts();
|
|
139
|
+
await this.applySetupFeeJuice();
|
|
140
|
+
await this.applyDeployBananaToken();
|
|
141
|
+
}
|
|
142
|
+
async applyInitialAccounts() {
|
|
143
|
+
this.logger.info('Applying initial accounts setup');
|
|
144
|
+
const { deployedAccounts } = await deployAccounts(this.numberOfAccounts, this.logger)({
|
|
145
|
+
wallet: this.context.wallet,
|
|
146
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
154
147
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
|
|
161
|
-
this.context = context;
|
|
162
|
-
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
163
|
-
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
164
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
165
|
-
aztecNode: context.aztecNode,
|
|
166
|
-
aztecNodeAdmin: context.aztecNode,
|
|
167
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
168
|
-
wallet: this.wallet,
|
|
169
|
-
logger: this.logger
|
|
170
|
-
});
|
|
148
|
+
this.wallet = this.context.wallet;
|
|
149
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
150
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
151
|
+
this.gasSettings = GasSettings.default({
|
|
152
|
+
maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2)
|
|
171
153
|
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
154
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
155
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
156
|
+
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
157
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
158
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
159
|
+
this.fpcAdmin = this.aliceAddress;
|
|
160
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
161
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
162
|
+
}
|
|
163
|
+
async applyPublicDeployAccounts() {
|
|
164
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
165
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
166
|
+
}
|
|
167
|
+
async applySetupFeeJuice() {
|
|
168
|
+
this.logger.info('Applying fee juice setup');
|
|
169
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
170
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
171
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
172
|
+
aztecNode: this.context.aztecNodeService,
|
|
173
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
174
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
175
|
+
wallet: this.wallet,
|
|
176
|
+
logger: this.logger
|
|
188
177
|
});
|
|
189
178
|
}
|
|
190
|
-
async
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const bananaCoin = this.bananaCoin;
|
|
195
|
-
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
196
|
-
from: this.aliceAddress
|
|
197
|
-
}).deployed();
|
|
198
|
-
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
199
|
-
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
200
|
-
return {
|
|
201
|
-
bananaFPCAddress: bananaFPC.address,
|
|
202
|
-
feeJuiceAddress: feeJuiceContract.address,
|
|
203
|
-
l1FeeJuiceAddress: this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress,
|
|
204
|
-
rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress
|
|
205
|
-
};
|
|
206
|
-
}, (data, context)=>{
|
|
207
|
-
const bananaFPC = FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
208
|
-
this.bananaFPC = bananaFPC;
|
|
209
|
-
this.getCoinbaseBalance = async ()=>{
|
|
210
|
-
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
211
|
-
const gasL1 = getContract({
|
|
212
|
-
address: data.l1FeeJuiceAddress.toString(),
|
|
213
|
-
abi: TestERC20Abi,
|
|
214
|
-
client: l1Client
|
|
215
|
-
});
|
|
216
|
-
return await gasL1.read.balanceOf([
|
|
217
|
-
this.coinbase.toString()
|
|
218
|
-
]);
|
|
219
|
-
};
|
|
220
|
-
this.getCoinbaseSequencerRewards = async ()=>{
|
|
221
|
-
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
222
|
-
};
|
|
223
|
-
this.getProverFee = async (blockNumber)=>{
|
|
224
|
-
const block = await this.aztecNode.getBlock(blockNumber);
|
|
225
|
-
// @todo @lherskind As we deal with #13601
|
|
226
|
-
// Right now the value is from `FeeLib.sol`
|
|
227
|
-
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
228
|
-
// We round up
|
|
229
|
-
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
230
|
-
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
231
|
-
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await this.rollupContract.getEpochDuration()), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
|
|
232
|
-
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
233
|
-
const mana = block.header.totalManaUsed.toBigInt();
|
|
234
|
-
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
235
|
-
};
|
|
236
|
-
return Promise.resolve();
|
|
179
|
+
async applyDeployBananaToken() {
|
|
180
|
+
this.logger.info('Applying deploy banana token setup');
|
|
181
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
182
|
+
from: this.aliceAddress
|
|
237
183
|
});
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return Promise.resolve();
|
|
184
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
185
|
+
this.bananaCoin = bananaCoin;
|
|
186
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
187
|
+
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, this.logger);
|
|
188
|
+
}
|
|
189
|
+
async applyFPCSetup() {
|
|
190
|
+
this.logger.info('Applying FPC setup');
|
|
191
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
192
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
193
|
+
const bananaCoin = this.bananaCoin;
|
|
194
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
195
|
+
from: this.aliceAddress
|
|
251
196
|
});
|
|
197
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
198
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
199
|
+
this.bananaFPC = bananaFPC;
|
|
200
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
201
|
+
this.getCoinbaseBalance = async ()=>{
|
|
202
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
203
|
+
const gasL1 = getContract({
|
|
204
|
+
address: l1FeeJuiceAddress.toString(),
|
|
205
|
+
abi: TestERC20Abi,
|
|
206
|
+
client: l1Client
|
|
207
|
+
});
|
|
208
|
+
return await gasL1.read.balanceOf([
|
|
209
|
+
this.coinbase.toString()
|
|
210
|
+
]);
|
|
211
|
+
};
|
|
212
|
+
this.getCoinbaseSequencerRewards = async ()=>{
|
|
213
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
214
|
+
};
|
|
215
|
+
this.getProverFee = async (blockNumber)=>{
|
|
216
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
217
|
+
// @todo @lherskind As we deal with #13601
|
|
218
|
+
// Right now the value is from `FeeLib.sol`
|
|
219
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
220
|
+
// We round up
|
|
221
|
+
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
222
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
223
|
+
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
|
|
224
|
+
const price = await this.rollupContract.getEthPerFeeAsset();
|
|
225
|
+
const mana = block.header.totalManaUsed.toBigInt();
|
|
226
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
async applySponsoredFPCSetup() {
|
|
230
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
231
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
232
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
233
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
234
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
235
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
252
236
|
}
|
|
253
237
|
async applyFundAliceWithBananas() {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}, ()=>Promise.resolve());
|
|
238
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
239
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
240
|
+
await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send({
|
|
241
|
+
from: this.aliceAddress
|
|
242
|
+
});
|
|
260
243
|
}
|
|
261
244
|
async applyFundAliceWithPrivateBananas() {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}, ()=>Promise.resolve());
|
|
245
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
246
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
265
247
|
}
|
|
266
248
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { L2Block } from '@aztec/aztec.js/block';
|
|
3
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
3
|
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
4
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
5
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
5
6
|
/**
|
|
6
7
|
* Creates a json object that can be used to test the solidity contract.
|
|
7
8
|
* The json object must be put into
|
|
8
9
|
*/
|
|
9
|
-
export declare function writeJson(fileName: string, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
export declare function writeJson(fileName: string, checkpointHeader: CheckpointHeader, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JpdGVfanNvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2UyZV9sMV9wdWJsaXNoZXIvd3JpdGVfanNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRSxXQUFXLEVBQUUsSUFBSSxFQUE2RCxNQUFNLGlCQUFpQixDQUFDO0FBRS9HLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQU14RDs7O0dBR0c7QUFDSCx3QkFBc0IsU0FBUyxDQUM3QixRQUFRLEVBQUUsTUFBTSxFQUNoQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDbEMsS0FBSyxFQUFFLE9BQU8sRUFDZCxhQUFhLEVBQUUsRUFBRSxFQUFFLEVBQ25CLEtBQUssRUFBRSxJQUFJLEVBQUUsRUFDYixXQUFXLEVBQUUsV0FBVyxFQUN4QixnQkFBZ0IsRUFBRSxZQUFZLEVBQzlCLGVBQWUsRUFBRSxLQUFLLE1BQU0sRUFBRSxHQUM3QixPQUFPLENBQUMsSUFBSSxDQUFDLENBb0RmIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/e2e_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/e2e_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAA6D,MAAM,iBAAiB,CAAC;AAE/G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,EAAE,EAAE,EACnB,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,YAAY,EAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
|
@@ -4,7 +4,7 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a json object that can be used to test the solidity contract.
|
|
6
6
|
* The json object must be put into
|
|
7
|
-
*/ export async function writeJson(fileName, block, l1ToL2Content, blobs, batchedBlob, recipientAddress, deployerAddress) {
|
|
7
|
+
*/ export async function writeJson(fileName, checkpointHeader, block, l1ToL2Content, blobs, batchedBlob, recipientAddress, deployerAddress) {
|
|
8
8
|
if (!AZTEC_GENERATE_TEST_DATA) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
@@ -32,24 +32,22 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
32
32
|
checkpointNumber: block.number,
|
|
33
33
|
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
34
34
|
header: {
|
|
35
|
-
lastArchiveRoot: asHex(
|
|
36
|
-
blockHeadersHash: asHex(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
coinbase: asHex(block.header.globalVariables.coinbase, 40),
|
|
45
|
-
feeRecipient: asHex(block.header.globalVariables.feeRecipient),
|
|
35
|
+
lastArchiveRoot: asHex(checkpointHeader.lastArchiveRoot),
|
|
36
|
+
blockHeadersHash: asHex(checkpointHeader.blockHeadersHash),
|
|
37
|
+
blobsHash: asHex(checkpointHeader.blobsHash),
|
|
38
|
+
inHash: asHex(checkpointHeader.inHash),
|
|
39
|
+
outHash: asHex(checkpointHeader.epochOutHash),
|
|
40
|
+
slotNumber: Number(checkpointHeader.slotNumber),
|
|
41
|
+
timestamp: Number(checkpointHeader.timestamp),
|
|
42
|
+
coinbase: asHex(checkpointHeader.coinbase, 40),
|
|
43
|
+
feeRecipient: asHex(checkpointHeader.feeRecipient),
|
|
46
44
|
gasFees: {
|
|
47
|
-
feePerDaGas: Number(
|
|
48
|
-
feePerL2Gas: Number(
|
|
45
|
+
feePerDaGas: Number(checkpointHeader.gasFees.feePerDaGas),
|
|
46
|
+
feePerL2Gas: Number(checkpointHeader.gasFees.feePerL2Gas)
|
|
49
47
|
},
|
|
50
|
-
totalManaUsed:
|
|
48
|
+
totalManaUsed: checkpointHeader.totalManaUsed.toNumber()
|
|
51
49
|
},
|
|
52
|
-
headerHash: asHex(
|
|
50
|
+
headerHash: asHex(checkpointHeader.hash()),
|
|
53
51
|
numTxs: block.body.txEffects.length
|
|
54
52
|
}
|
|
55
53
|
};
|
|
@@ -4,10 +4,10 @@ import type { AztecNode } from '@aztec/aztec.js/node';
|
|
|
4
4
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
5
5
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
6
6
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
7
|
-
import { type
|
|
7
|
+
import { type EndToEndContext } from '../fixtures/setup.js';
|
|
8
8
|
export declare class NestedContractTest {
|
|
9
9
|
private numberOfAccounts;
|
|
10
|
-
|
|
10
|
+
context: EndToEndContext;
|
|
11
11
|
logger: Logger;
|
|
12
12
|
wallet: Wallet;
|
|
13
13
|
defaultAccountAddress: AztecAddress;
|
|
@@ -16,14 +16,11 @@ export declare class NestedContractTest {
|
|
|
16
16
|
childContract: ChildContract;
|
|
17
17
|
constructor(testName: string, numberOfAccounts?: number);
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
* 1. Add 3 accounts.
|
|
21
|
-
* 2. Publicly deploy accounts
|
|
19
|
+
* Applies base setup by deploying accounts and publicly deploying them.
|
|
22
20
|
*/
|
|
23
|
-
|
|
21
|
+
applyBaseSetup(): Promise<void>;
|
|
24
22
|
setup(): Promise<void>;
|
|
25
23
|
teardown(): Promise<void>;
|
|
26
|
-
|
|
27
|
-
applyManualSnapshots(): Promise<void>;
|
|
24
|
+
applyManual(): Promise<void>;
|
|
28
25
|
}
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVzdGVkX2NvbnRyYWN0X3Rlc3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lMmVfbmVzdGVkX2NvbnRyYWN0L25lc3RlZF9jb250cmFjdF90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0scUJBQXFCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDckQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQ3BFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUV0RSxPQUFPLEVBQ0wsS0FBSyxlQUFlLEVBS3JCLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIscUJBQWEsa0JBQWtCO0lBWTNCLE9BQU8sQ0FBQyxnQkFBZ0I7SUFYMUIsT0FBTyxFQUFHLGVBQWUsQ0FBQztJQUMxQixNQUFNLEVBQUUsTUFBTSxDQUFDO0lBQ2YsTUFBTSxFQUFHLE1BQU0sQ0FBQztJQUNoQixxQkFBcUIsRUFBRyxZQUFZLENBQUM7SUFDckMsU0FBUyxFQUFHLFNBQVMsQ0FBQztJQUV0QixjQUFjLEVBQUcsY0FBYyxDQUFDO0lBQ2hDLGFBQWEsRUFBRyxhQUFhLENBQUM7SUFFOUIsWUFDRSxRQUFRLEVBQUUsTUFBTSxFQUNSLGdCQUFnQixTQUFJLEVBRzdCO0lBRUQ7O09BRUc7SUFDRyxjQUFjLGtCQWVuQjtJQUVLLEtBQUssa0JBT1Y7SUFFSyxRQUFRLGtCQUViO0lBRUssV0FBVyxrQkFNaEI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,
|
|
1
|
+
{"version":3,"file":"nested_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_nested_contract/nested_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAkB;IAY3B,OAAO,CAAC,gBAAgB;IAX1B,OAAO,EAAG,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAChB,qBAAqB,EAAG,YAAY,CAAC;IACrC,SAAS,EAAG,SAAS,CAAC;IAEtB,cAAc,EAAG,cAAc,CAAC;IAChC,aAAa,EAAG,aAAa,CAAC;IAE9B,YACE,QAAQ,EAAE,MAAM,EACR,gBAAgB,SAAI,EAG7B;IAED;;OAEG;IACG,cAAc,kBAenB;IAEK,KAAK,kBAOV;IAEK,QAAQ,kBAEb;IAEK,WAAW,kBAMhB;CACF"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
2
|
import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
|
|
3
3
|
import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
|
|
4
|
-
import {
|
|
5
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
4
|
+
import { deployAccounts, publicDeployAccounts, setup, teardown as teardownSubsystems } from '../fixtures/setup.js';
|
|
6
5
|
export class NestedContractTest {
|
|
7
6
|
numberOfAccounts;
|
|
8
|
-
|
|
7
|
+
context;
|
|
9
8
|
logger;
|
|
10
9
|
wallet;
|
|
11
10
|
defaultAccountAddress;
|
|
@@ -14,51 +13,44 @@ export class NestedContractTest {
|
|
|
14
13
|
childContract;
|
|
15
14
|
constructor(testName, numberOfAccounts = 1){
|
|
16
15
|
this.numberOfAccounts = numberOfAccounts;
|
|
17
|
-
this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
18
16
|
this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`);
|
|
19
|
-
this.snapshotManager = createSnapshotManager(`e2e_nested_contract/${testName}-${numberOfAccounts}`, dataPath);
|
|
20
17
|
}
|
|
21
18
|
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
29
|
-
this.aztecNode = aztecNode;
|
|
30
|
-
return Promise.resolve();
|
|
31
|
-
});
|
|
32
|
-
await this.snapshotManager.snapshot('public_deploy', async ()=>{}, async ()=>{
|
|
33
|
-
this.logger.verbose(`Public deploy accounts...`);
|
|
34
|
-
await publicDeployAccounts(this.wallet, [
|
|
35
|
-
this.defaultAccountAddress
|
|
36
|
-
]);
|
|
19
|
+
* Applies base setup by deploying accounts and publicly deploying them.
|
|
20
|
+
*/ async applyBaseSetup() {
|
|
21
|
+
this.logger.info('Deploying accounts');
|
|
22
|
+
const { deployedAccounts } = await deployAccounts(this.numberOfAccounts, this.logger)({
|
|
23
|
+
wallet: this.context.wallet,
|
|
24
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
37
25
|
});
|
|
26
|
+
this.wallet = this.context.wallet;
|
|
27
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
28
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
29
|
+
this.logger.info('Public deploy accounts');
|
|
30
|
+
await publicDeployAccounts(this.wallet, [
|
|
31
|
+
this.defaultAccountAddress
|
|
32
|
+
]);
|
|
38
33
|
}
|
|
39
34
|
async setup() {
|
|
40
|
-
|
|
35
|
+
this.logger.info('Setting up fresh subsystems');
|
|
36
|
+
this.context = await setup(0, {
|
|
37
|
+
fundSponsoredFPC: true,
|
|
38
|
+
skipAccountDeployment: true
|
|
39
|
+
});
|
|
40
|
+
await this.applyBaseSetup();
|
|
41
41
|
}
|
|
42
42
|
async teardown() {
|
|
43
|
-
await this.
|
|
43
|
+
await teardownSubsystems(this.context);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
await this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
from: this.defaultAccountAddress
|
|
53
|
-
}).deployed();
|
|
54
|
-
return {
|
|
55
|
-
parentContractAddress: parentContract.address,
|
|
56
|
-
childContractAddress: childContract.address
|
|
57
|
-
};
|
|
58
|
-
}, ({ parentContractAddress, childContractAddress })=>{
|
|
59
|
-
this.parentContract = ParentContract.at(parentContractAddress, this.wallet);
|
|
60
|
-
this.childContract = ChildContract.at(childContractAddress, this.wallet);
|
|
61
|
-
return Promise.resolve();
|
|
45
|
+
async applyManual() {
|
|
46
|
+
this.logger.info('Deploying parent and child contracts');
|
|
47
|
+
const parentContract = await ParentContract.deploy(this.wallet).send({
|
|
48
|
+
from: this.defaultAccountAddress
|
|
49
|
+
});
|
|
50
|
+
const childContract = await ChildContract.deploy(this.wallet).send({
|
|
51
|
+
from: this.defaultAccountAddress
|
|
62
52
|
});
|
|
53
|
+
this.parentContract = parentContract;
|
|
54
|
+
this.childContract = childContract;
|
|
63
55
|
}
|
|
64
56
|
}
|
|
@@ -24,8 +24,8 @@ export declare class P2PInactivityTest {
|
|
|
24
24
|
}): Promise<P2PInactivityTest>;
|
|
25
25
|
setup(): Promise<this>;
|
|
26
26
|
teardown(): Promise<void>;
|
|
27
|
-
get ctx(): import("../fixtures/
|
|
28
|
-
get logger(): import("
|
|
27
|
+
get ctx(): import("../fixtures/setup.js").EndToEndContext;
|
|
28
|
+
get logger(): import("@aztec/foundation/log").Logger;
|
|
29
29
|
get slashingAmount(): bigint;
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5hY3Rpdml0eV9zbGFzaF90ZXN0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZTJlX3AycC9pbmFjdGl2aXR5X3NsYXNoX3Rlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDdkQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBSTNELE9BQU8sZUFBZSxDQUFDO0FBS3ZCLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQWlCbEQscUJBQWEsaUJBQWlCO2FBYVYsSUFBSSxFQUFFLGNBQWM7SUFaL0IsS0FBSyxFQUFHLGdCQUFnQixFQUFFLENBQUM7SUFDM0IsV0FBVyxFQUFHLGdCQUFnQixFQUFFLENBQUM7SUFDakMsYUFBYSxFQUFHLGdCQUFnQixFQUFFLENBQUM7SUFFbkMsTUFBTSxFQUFHLGNBQWMsQ0FBQztJQUN4QixpQkFBaUIsRUFBRyxVQUFVLEVBQUUsQ0FBQztJQUV4QyxPQUFPLENBQUMsT0FBTyxDQUFTO0lBQ3hCLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBUztJQUNsQyxPQUFPLENBQUMsZUFBZSxDQUFVO0lBRWpDLFlBQ2tCLElBQUksRUFBRSxjQUFjLEVBQ3BDLElBQUksRUFBRTtRQUFFLGlCQUFpQixFQUFFLE1BQU0sQ0FBQztRQUFDLGVBQWUsQ0FBQyxFQUFFLE9BQU8sQ0FBQTtLQUFFLEVBSy9EO0lBRUQsT0FBYSxNQUFNLENBQ2pCLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLElBQUksRUFBRTtRQUFFLHdDQUF3QyxFQUFFLE1BQU0sQ0FBQztRQUFDLGlCQUFpQixFQUFFLE1BQU0sQ0FBQztRQUFDLGVBQWUsQ0FBQyxFQUFFLE9BQU8sQ0FBQTtLQUFFLDhCQThCakg7SUFFWSxLQUFLLGtCQTBFakI7SUFFWSxRQUFRLGtCQU1wQjtJQUVELElBQVcsR0FBRyxtREFFYjtJQUVELElBQVcsTUFBTSwyQ0FFaEI7SUFFRCxJQUFXLGNBQWMsV0FFeEI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,eAAe,CAAC;AAKvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBlD,qBAAa,iBAAiB;aAaV,IAAI,EAAE,cAAc;IAZ/B,KAAK,EAAG,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAG,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,EAAG,cAAc,CAAC;IACxB,iBAAiB,EAAG,UAAU,EAAE,CAAC;IAExC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAU;IAEjC,YACkB,IAAI,EAAE,cAAc,EACpC,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,EAK/D;IAED,OAAa,MAAM,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QAAE,wCAAwC,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,8BA8BjH;IAEY,KAAK,kBA0EjB;IAEY,QAAQ,kBAMpB;IAED,IAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"inactivity_slash_test.d.ts","sourceRoot":"","sources":["../../src/e2e_p2p/inactivity_slash_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,eAAe,CAAC;AAKvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBlD,qBAAa,iBAAiB;aAaV,IAAI,EAAE,cAAc;IAZ/B,KAAK,EAAG,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAG,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,EAAG,cAAc,CAAC;IACxB,iBAAiB,EAAG,UAAU,EAAE,CAAC;IAExC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,eAAe,CAAU;IAEjC,YACkB,IAAI,EAAE,cAAc,EACpC,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,EAK/D;IAED,OAAa,MAAM,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QAAE,wCAAwC,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,8BA8BjH;IAEY,KAAK,kBA0EjB;IAEY,QAAQ,kBAMpB;IAED,IAAW,GAAG,mDAEb;IAED,IAAW,MAAM,2CAEhB;IAED,IAAW,cAAc,WAExB;CACF"}
|
|
@@ -67,8 +67,8 @@ export class P2PInactivityTest {
|
|
|
67
67
|
return new P2PInactivityTest(test, opts);
|
|
68
68
|
}
|
|
69
69
|
async setup() {
|
|
70
|
-
await this.test.applyBaseSnapshots();
|
|
71
70
|
await this.test.setup();
|
|
71
|
+
await this.test.applyBaseSetup();
|
|
72
72
|
// Set slashing penalties for inactivity
|
|
73
73
|
const { rollup } = await this.test.getContracts();
|
|
74
74
|
const [activationThreshold, ejectionThreshold, localEjectionThreshold] = await Promise.all([
|
|
@@ -81,7 +81,7 @@ export class P2PInactivityTest {
|
|
|
81
81
|
this.test.ctx.aztecNodeConfig.slashInactivityPenalty = SLASHING_AMOUNT;
|
|
82
82
|
this.rollup = rollup;
|
|
83
83
|
if (!this.keepInitialNode) {
|
|
84
|
-
await this.test.ctx.
|
|
84
|
+
await this.test.ctx.aztecNodeService.stop();
|
|
85
85
|
}
|
|
86
86
|
// Create all active nodes
|
|
87
87
|
this.activeNodes = await createNodes(this.test.ctx.aztecNodeConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode), BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, Number(this.keepInitialNode));
|
|
@@ -93,7 +93,7 @@ export class P2PInactivityTest {
|
|
|
93
93
|
this.inactiveNodes = await createNodes(inactiveConfig, this.test.ctx.dateProvider, this.test.bootstrapNodeEnr, this.inactiveNodeCount, BOOT_NODE_UDP_PORT, this.test.prefilledPublicData, this.dataDir, undefined, NUM_NODES - this.inactiveNodeCount);
|
|
94
94
|
this.nodes = [
|
|
95
95
|
...this.keepInitialNode ? [
|
|
96
|
-
this.test.ctx.
|
|
96
|
+
this.test.ctx.aztecNodeService
|
|
97
97
|
] : [],
|
|
98
98
|
...this.activeNodes,
|
|
99
99
|
...this.inactiveNodes
|