@aztec/end-to-end 0.0.1-commit.d3ec352c → 0.0.1-commit.e310a4c8
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 +14 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +123 -136
- 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 +27 -18
- 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 +19 -13
- 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 +91 -71
- 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 +9 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +42 -18
- package/dest/e2e_fees/bridging_race.notest.js +4 -6
- package/dest/e2e_fees/fees_test.d.ts +18 -15
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +126 -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_multi_validator/utils.js +1 -1
- 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 +4 -4
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +6 -9
- package/dest/e2e_p2p/p2p_network.d.ts +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +120 -111
- 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 +7 -7
- 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 +10 -18
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +91 -103
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +1 -2
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- 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 +27 -22
- 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 -638
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- 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 +18 -7
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -14
- package/dest/shared/gas_portal_test_harness.d.ts +12 -2
- 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 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +55 -35
- package/dest/simulators/lending_simulator.d.ts +6 -2
- 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 +63 -35
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +422 -0
- 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 -221
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -782
- package/package.json +40 -39
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +145 -208
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +30 -20
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
- package/src/e2e_deploy_contract/deploy_test.ts +21 -14
- package/src/e2e_epochs/epochs_test.ts +83 -44
- package/src/e2e_fees/bridging_race.notest.ts +4 -10
- package/src/e2e_fees/fees_test.ts +177 -220
- package/src/e2e_l1_publisher/write_json.ts +16 -16
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +9 -12
- package/src/e2e_p2p/p2p_network.ts +180 -183
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +31 -28
- package/src/e2e_token_contract/token_contract_test.ts +103 -118
- package/src/fixtures/e2e_prover_test.ts +104 -141
- package/src/fixtures/fixtures.ts +1 -3
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +18 -23
- package/src/fixtures/token_utils.ts +6 -5
- package/src/fixtures/utils.ts +27 -966
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- 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 +19 -37
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/index.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +65 -86
- package/src/simulators/lending_simulator.ts +3 -3
- package/src/spartan/setup_test_wallets.ts +81 -26
- package/src/spartan/tx_metrics.ts +376 -0
- 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 -983
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- 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/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -2,7 +2,9 @@ import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
|
-
import {
|
|
5
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
6
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
|
+
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
6
8
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
7
9
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
8
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -17,31 +19,26 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
17
19
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
18
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
19
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
20
23
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
21
24
|
|
|
22
25
|
import { getContract } from 'viem';
|
|
23
26
|
|
|
24
27
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
25
28
|
import {
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
createSnapshotManager,
|
|
29
|
+
type EndToEndContext,
|
|
30
|
+
type SetupOptions,
|
|
29
31
|
deployAccounts,
|
|
30
|
-
|
|
32
|
+
publicDeployAccounts,
|
|
33
|
+
setup,
|
|
34
|
+
teardown,
|
|
35
|
+
} from '../fixtures/setup.js';
|
|
31
36
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
32
|
-
import {
|
|
33
|
-
type BalancesFn,
|
|
34
|
-
type SetupOptions,
|
|
35
|
-
ensureAccountContractsPublished,
|
|
36
|
-
getBalancesFn,
|
|
37
|
-
setupSponsoredFPC,
|
|
38
|
-
} from '../fixtures/utils.js';
|
|
37
|
+
import { type BalancesFn, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
39
38
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
40
39
|
|
|
41
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
42
|
-
|
|
43
40
|
/**
|
|
44
|
-
* Test fixture for testing fees. Provides the following
|
|
41
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
45
42
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
46
43
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
47
44
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
@@ -51,11 +48,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
51
48
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
52
49
|
*/
|
|
53
50
|
export class FeesTest {
|
|
54
|
-
private snapshotManager: ISnapshotManager;
|
|
55
51
|
private accounts: AztecAddress[] = [];
|
|
52
|
+
public context!: EndToEndContext;
|
|
56
53
|
|
|
57
54
|
public logger: Logger;
|
|
58
55
|
public aztecNode!: AztecNode;
|
|
56
|
+
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
59
57
|
public cheatCodes!: CheatCodes;
|
|
60
58
|
|
|
61
59
|
public wallet!: TestWallet;
|
|
@@ -78,7 +76,6 @@ export class FeesTest {
|
|
|
78
76
|
public subscriptionContract!: AppSubscriptionContract;
|
|
79
77
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
80
78
|
|
|
81
|
-
public context!: SubsystemsContext;
|
|
82
79
|
public chainMonitor!: ChainMonitor;
|
|
83
80
|
|
|
84
81
|
public getCoinbaseBalance!: () => Promise<bigint>;
|
|
@@ -95,7 +92,7 @@ export class FeesTest {
|
|
|
95
92
|
constructor(
|
|
96
93
|
testName: string,
|
|
97
94
|
private numberOfAccounts = 3,
|
|
98
|
-
setupOptions: Partial<SetupOptions &
|
|
95
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
99
96
|
) {
|
|
100
97
|
if (!numberOfAccounts) {
|
|
101
98
|
throw new Error('There must be at least 1 initial account.');
|
|
@@ -103,30 +100,33 @@ export class FeesTest {
|
|
|
103
100
|
setupOptions.coinbase ??= EthAddress.random();
|
|
104
101
|
this.coinbase = setupOptions.coinbase!;
|
|
105
102
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
106
|
-
this.snapshotManager = createSnapshotManager(
|
|
107
|
-
`e2e_fees/${testName}-${numberOfAccounts}`,
|
|
108
|
-
dataPath,
|
|
109
|
-
{ startProverNode: true, ...setupOptions },
|
|
110
|
-
{ ...setupOptions },
|
|
111
|
-
);
|
|
112
103
|
}
|
|
113
104
|
|
|
114
105
|
async setup() {
|
|
115
|
-
|
|
106
|
+
this.logger.verbose('Setting up fresh context...');
|
|
107
|
+
this.context = await setup(0, {
|
|
108
|
+
startProverNode: true,
|
|
109
|
+
...this.setupOptions,
|
|
110
|
+
fundSponsoredFPC: true,
|
|
111
|
+
skipAccountDeployment: true,
|
|
112
|
+
l1ContractsArgs: { ...this.setupOptions },
|
|
113
|
+
});
|
|
116
114
|
|
|
117
|
-
this.rollupContract = RollupContract.getFromConfig(context.
|
|
118
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider
|
|
115
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
116
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider!, this.logger, 200).start();
|
|
117
|
+
|
|
118
|
+
await this.applyBaseSetup();
|
|
119
119
|
|
|
120
120
|
return this;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
async teardown() {
|
|
124
124
|
await this.chainMonitor.stop();
|
|
125
|
-
await this.
|
|
125
|
+
await teardown(this.context);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
setIsMarkingAsProven(b: boolean) {
|
|
129
|
-
this.context.watcher
|
|
129
|
+
this.context.watcher!.setIsMarkingAsProven(b);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
async catchUpProvenChain() {
|
|
@@ -140,9 +140,7 @@ export class FeesTest {
|
|
|
140
140
|
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
141
141
|
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
142
142
|
|
|
143
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
144
|
-
EthAddress.fromString(rewardConfig.rewardDistributor),
|
|
145
|
-
);
|
|
143
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
146
144
|
|
|
147
145
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
148
146
|
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
@@ -154,10 +152,7 @@ export class FeesTest {
|
|
|
154
152
|
async mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress) {
|
|
155
153
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
|
|
156
154
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
157
|
-
await this.feeJuiceContract.methods
|
|
158
|
-
.claim(recipient, claim.claimAmount, secret, index)
|
|
159
|
-
.send({ from: minter })
|
|
160
|
-
.wait();
|
|
155
|
+
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({ from: minter });
|
|
161
156
|
}
|
|
162
157
|
|
|
163
158
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
@@ -174,209 +169,171 @@ export class FeesTest {
|
|
|
174
169
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
175
170
|
}
|
|
176
171
|
|
|
177
|
-
public async
|
|
178
|
-
await this.
|
|
179
|
-
await this.
|
|
180
|
-
await this.
|
|
181
|
-
await this.
|
|
172
|
+
public async applyBaseSetup() {
|
|
173
|
+
await this.applyInitialAccounts();
|
|
174
|
+
await this.applyPublicDeployAccounts();
|
|
175
|
+
await this.applySetupFeeJuice();
|
|
176
|
+
await this.applyDeployBananaToken();
|
|
182
177
|
}
|
|
183
178
|
|
|
184
|
-
async
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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.aztecNodeService!;
|
|
192
|
+
this.aztecNodeAdmin = this.context.aztecNodeService!;
|
|
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);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
async
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
);
|
|
206
|
+
async applyPublicDeployAccounts() {
|
|
207
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
208
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
210
209
|
}
|
|
211
210
|
|
|
212
|
-
async
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
'⛽',
|
|
223
|
-
this.feeJuiceContract.methods.balance_of_public,
|
|
224
|
-
this.aliceAddress,
|
|
225
|
-
this.logger,
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
229
|
-
aztecNode: context.aztecNode,
|
|
230
|
-
aztecNodeAdmin: context.aztecNode,
|
|
231
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
232
|
-
wallet: this.wallet,
|
|
233
|
-
logger: this.logger,
|
|
234
|
-
});
|
|
235
|
-
},
|
|
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,
|
|
236
221
|
);
|
|
222
|
+
|
|
223
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
224
|
+
aztecNode: this.context.aztecNodeService!,
|
|
225
|
+
aztecNodeAdmin: this.context.aztecNodeService!,
|
|
226
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
227
|
+
wallet: this.wallet,
|
|
228
|
+
logger: this.logger,
|
|
229
|
+
});
|
|
237
230
|
}
|
|
238
231
|
|
|
239
|
-
async
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
'🍌.private',
|
|
260
|
-
this.bananaCoin.methods.balance_of_private,
|
|
261
|
-
this.aliceAddress,
|
|
262
|
-
logger,
|
|
263
|
-
);
|
|
264
|
-
return Promise.resolve();
|
|
265
|
-
},
|
|
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).send({
|
|
236
|
+
from: this.aliceAddress,
|
|
237
|
+
});
|
|
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,
|
|
266
252
|
);
|
|
267
253
|
}
|
|
268
254
|
|
|
269
|
-
public async
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
await this.rollupContract.getManaTarget(),
|
|
326
|
-
) + (await this.rollupContract.getProvingCostPerMana());
|
|
327
|
-
|
|
328
|
-
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
329
|
-
|
|
330
|
-
const mana = block!.header.totalManaUsed.toBigInt();
|
|
331
|
-
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
332
|
-
};
|
|
333
|
-
return Promise.resolve();
|
|
334
|
-
},
|
|
335
|
-
);
|
|
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).send({
|
|
263
|
+
from: this.aliceAddress,
|
|
264
|
+
});
|
|
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.config.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.getEthPerFeeAsset();
|
|
307
|
+
|
|
308
|
+
const mana = block!.header.totalManaUsed.toBigInt();
|
|
309
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
310
|
+
};
|
|
336
311
|
}
|
|
337
312
|
|
|
338
|
-
public async
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return {
|
|
349
|
-
sponsoredFPCAddress: sponsoredFPC.address,
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
data => {
|
|
353
|
-
this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
354
|
-
return Promise.resolve();
|
|
355
|
-
},
|
|
356
|
-
);
|
|
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);
|
|
357
323
|
}
|
|
358
324
|
|
|
359
325
|
public async applyFundAliceWithBananas() {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
.send({ from: this.aliceAddress })
|
|
367
|
-
.wait();
|
|
368
|
-
},
|
|
369
|
-
() => Promise.resolve(),
|
|
370
|
-
);
|
|
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 });
|
|
371
332
|
}
|
|
372
333
|
|
|
373
334
|
public async applyFundAliceWithPrivateBananas() {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
378
|
-
},
|
|
379
|
-
() => Promise.resolve(),
|
|
380
|
-
);
|
|
335
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
336
|
+
|
|
337
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
381
338
|
}
|
|
382
339
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
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, getEthBlobEvaluationInputs, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
5
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
6
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
6
7
|
|
|
7
8
|
import { writeFile } from 'fs/promises';
|
|
8
9
|
|
|
@@ -14,6 +15,7 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
14
15
|
*/
|
|
15
16
|
export async function writeJson(
|
|
16
17
|
fileName: string,
|
|
18
|
+
checkpointHeader: CheckpointHeader,
|
|
17
19
|
block: L2Block,
|
|
18
20
|
l1ToL2Content: Fr[],
|
|
19
21
|
blobs: Blob[],
|
|
@@ -50,24 +52,22 @@ export async function writeJson(
|
|
|
50
52
|
checkpointNumber: block.number,
|
|
51
53
|
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
52
54
|
header: {
|
|
53
|
-
lastArchiveRoot: asHex(
|
|
54
|
-
blockHeadersHash: asHex(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
coinbase: asHex(block.header.globalVariables.coinbase, 40),
|
|
63
|
-
feeRecipient: asHex(block.header.globalVariables.feeRecipient),
|
|
55
|
+
lastArchiveRoot: asHex(checkpointHeader.lastArchiveRoot),
|
|
56
|
+
blockHeadersHash: asHex(checkpointHeader.blockHeadersHash),
|
|
57
|
+
blobsHash: asHex(checkpointHeader.blobsHash),
|
|
58
|
+
inHash: asHex(checkpointHeader.inHash),
|
|
59
|
+
outHash: asHex(checkpointHeader.epochOutHash),
|
|
60
|
+
slotNumber: Number(checkpointHeader.slotNumber),
|
|
61
|
+
timestamp: Number(checkpointHeader.timestamp),
|
|
62
|
+
coinbase: asHex(checkpointHeader.coinbase, 40),
|
|
63
|
+
feeRecipient: asHex(checkpointHeader.feeRecipient),
|
|
64
64
|
gasFees: {
|
|
65
|
-
feePerDaGas: Number(
|
|
66
|
-
feePerL2Gas: Number(
|
|
65
|
+
feePerDaGas: Number(checkpointHeader.gasFees.feePerDaGas),
|
|
66
|
+
feePerL2Gas: Number(checkpointHeader.gasFees.feePerL2Gas),
|
|
67
67
|
},
|
|
68
|
-
totalManaUsed:
|
|
68
|
+
totalManaUsed: checkpointHeader.totalManaUsed.toNumber(),
|
|
69
69
|
},
|
|
70
|
-
headerHash: asHex(
|
|
70
|
+
headerHash: asHex(checkpointHeader.hash()),
|
|
71
71
|
numTxs: block.body.txEffects.length,
|
|
72
72
|
},
|
|
73
73
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { getAddressFromPrivateKey } from '@aztec/ethereum';
|
|
2
|
+
import { getAddressFromPrivateKey } from '@aztec/ethereum/account';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { EthPrivateKey } from '@aztec/node-keystore';
|
|
5
5
|
|