@aztec/end-to-end 0.0.1-commit.fcb71a6 → 0.0.1-commit.ff7989d6c
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 +13 -14
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +121 -136
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- 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 +9 -8
- 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 +106 -112
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -11
- 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 +90 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
- 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 +15 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +87 -40
- package/dest/e2e_fees/bridging_race.notest.js +3 -5
- package/dest/e2e_fees/fees_test.d.ts +14 -14
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +125 -143
- 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 +8 -7
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +127 -106
- 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 +177 -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 +18 -21
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +99 -91
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +11 -17
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +112 -128
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +235 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +605 -0
- package/dest/fixtures/setup_p2p_test.d.ts +16 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +40 -29
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +10 -6
- 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 +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- 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 +53 -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/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -23
- package/dest/spartan/setup_test_wallets.d.ts +12 -4
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +92 -35
- 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 +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -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 +39 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +21 -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 +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +460 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -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/dest/test-wallet/test_wallet.d.ts +83 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +214 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +40 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +103 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +44 -39
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +141 -211
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +21 -15
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +114 -143
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +127 -117
- package/src/e2e_deploy_contract/deploy_test.ts +22 -15
- package/src/e2e_epochs/epochs_test.ts +130 -94
- package/src/e2e_fees/bridging_race.notest.ts +4 -10
- package/src/e2e_fees/fees_test.ts +164 -227
- 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 +3 -3
- package/src/e2e_p2p/p2p_network.ts +197 -171
- package/src/e2e_p2p/reqresp/utils.ts +235 -0
- package/src/e2e_p2p/shared.ts +28 -27
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +113 -119
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +127 -172
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +896 -0
- package/src/fixtures/setup_p2p_test.ts +40 -44
- package/src/fixtures/token_utils.ts +7 -5
- package/src/fixtures/utils.ts +27 -907
- package/src/guides/up_quick_start.sh +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/shared/cross_chain_test_harness.ts +16 -36
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +2 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +14 -16
- package/src/shared/uniswap_l1_l2.ts +59 -80
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/simulators/token_simulator.ts +1 -29
- package/src/spartan/setup_test_wallets.ts +134 -26
- package/src/spartan/tx_metrics.ts +255 -9
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +27 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +65 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +535 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -1158
- package/src/test-wallet/test_wallet.ts +306 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +43 -0
- package/src/test-wallet/worker_wallet.ts +165 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- 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
|
@@ -20,31 +20,25 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
20
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
21
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
22
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
24
23
|
|
|
25
24
|
import { getContract } from 'viem';
|
|
26
25
|
|
|
27
26
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
28
27
|
import {
|
|
29
|
-
type
|
|
30
|
-
type
|
|
31
|
-
createSnapshotManager,
|
|
28
|
+
type EndToEndContext,
|
|
29
|
+
type SetupOptions,
|
|
32
30
|
deployAccounts,
|
|
33
|
-
|
|
31
|
+
publicDeployAccounts,
|
|
32
|
+
setup,
|
|
33
|
+
teardown,
|
|
34
|
+
} from '../fixtures/setup.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, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
42
37
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
43
|
-
|
|
44
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
38
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
45
39
|
|
|
46
40
|
/**
|
|
47
|
-
* Test fixture for testing fees. Provides the following
|
|
41
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
48
42
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
49
43
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
50
44
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
@@ -54,8 +48,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
54
48
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
55
49
|
*/
|
|
56
50
|
export class FeesTest {
|
|
57
|
-
private snapshotManager: ISnapshotManager;
|
|
58
51
|
private accounts: AztecAddress[] = [];
|
|
52
|
+
public context!: EndToEndContext;
|
|
59
53
|
|
|
60
54
|
public logger: Logger;
|
|
61
55
|
public aztecNode!: AztecNode;
|
|
@@ -82,7 +76,6 @@ export class FeesTest {
|
|
|
82
76
|
public subscriptionContract!: AppSubscriptionContract;
|
|
83
77
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
84
78
|
|
|
85
|
-
public context!: SubsystemsContext;
|
|
86
79
|
public chainMonitor!: ChainMonitor;
|
|
87
80
|
|
|
88
81
|
public getCoinbaseBalance!: () => Promise<bigint>;
|
|
@@ -99,7 +92,7 @@ export class FeesTest {
|
|
|
99
92
|
constructor(
|
|
100
93
|
testName: string,
|
|
101
94
|
private numberOfAccounts = 3,
|
|
102
|
-
setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
95
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
103
96
|
) {
|
|
104
97
|
if (!numberOfAccounts) {
|
|
105
98
|
throw new Error('There must be at least 1 initial account.');
|
|
@@ -107,26 +100,29 @@ export class FeesTest {
|
|
|
107
100
|
setupOptions.coinbase ??= EthAddress.random();
|
|
108
101
|
this.coinbase = setupOptions.coinbase!;
|
|
109
102
|
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
103
|
}
|
|
117
104
|
|
|
118
105
|
async setup() {
|
|
119
|
-
|
|
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
|
+
});
|
|
120
114
|
|
|
121
|
-
this.rollupContract = RollupContract.getFromConfig(context.
|
|
122
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider, this.logger, 200).start();
|
|
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();
|
|
123
119
|
|
|
124
120
|
return this;
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
async teardown() {
|
|
128
124
|
await this.chainMonitor.stop();
|
|
129
|
-
await this.
|
|
125
|
+
await teardown(this.context);
|
|
130
126
|
}
|
|
131
127
|
|
|
132
128
|
setIsMarkingAsProven(b: boolean) {
|
|
@@ -144,9 +140,7 @@ export class FeesTest {
|
|
|
144
140
|
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
145
141
|
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
146
142
|
|
|
147
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
148
|
-
EthAddress.fromString(rewardConfig.rewardDistributor),
|
|
149
|
-
);
|
|
143
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
150
144
|
|
|
151
145
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
152
146
|
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
@@ -158,230 +152,173 @@ export class FeesTest {
|
|
|
158
152
|
async mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress) {
|
|
159
153
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
|
|
160
154
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
161
|
-
await this.feeJuiceContract.methods
|
|
162
|
-
.claim(recipient, claim.claimAmount, secret, index)
|
|
163
|
-
.send({ from: minter })
|
|
164
|
-
.wait();
|
|
155
|
+
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({ from: minter });
|
|
165
156
|
}
|
|
166
157
|
|
|
167
158
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
168
159
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
169
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
170
|
-
.balance_of_private(address)
|
|
171
|
-
.simulate({ from: this.aliceAddress });
|
|
160
|
+
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({ from: address });
|
|
172
161
|
|
|
173
162
|
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
174
163
|
|
|
175
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
176
|
-
.balance_of_private(address)
|
|
177
|
-
.simulate({ from: this.aliceAddress });
|
|
164
|
+
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({ from: address });
|
|
178
165
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
179
166
|
}
|
|
180
167
|
|
|
181
|
-
public async
|
|
182
|
-
await this.
|
|
183
|
-
await this.
|
|
184
|
-
await this.
|
|
185
|
-
await this.
|
|
168
|
+
public async applyBaseSetup() {
|
|
169
|
+
await this.applyInitialAccounts();
|
|
170
|
+
await this.applyPublicDeployAccounts();
|
|
171
|
+
await this.applySetupFeeJuice();
|
|
172
|
+
await this.applyDeployBananaToken();
|
|
186
173
|
}
|
|
187
174
|
|
|
188
|
-
async
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
175
|
+
async applyInitialAccounts() {
|
|
176
|
+
this.logger.info('Applying initial accounts setup');
|
|
177
|
+
|
|
178
|
+
const { deployedAccounts } = await deployAccounts(
|
|
179
|
+
this.numberOfAccounts,
|
|
180
|
+
this.logger,
|
|
181
|
+
)({
|
|
182
|
+
wallet: this.context.wallet,
|
|
183
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
this.wallet = this.context.wallet;
|
|
187
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
188
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
189
|
+
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
190
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
191
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
192
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
193
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
194
|
+
|
|
195
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
196
|
+
this.fpcAdmin = this.aliceAddress;
|
|
197
|
+
|
|
198
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
199
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
209
200
|
}
|
|
210
201
|
|
|
211
|
-
async
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
);
|
|
202
|
+
async applyPublicDeployAccounts() {
|
|
203
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
204
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
215
205
|
}
|
|
216
206
|
|
|
217
|
-
async
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
234
|
-
aztecNode: context.aztecNode,
|
|
235
|
-
aztecNodeAdmin: context.aztecNode,
|
|
236
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
237
|
-
wallet: this.wallet,
|
|
238
|
-
logger: this.logger,
|
|
239
|
-
});
|
|
240
|
-
},
|
|
241
|
-
);
|
|
207
|
+
async applySetupFeeJuice() {
|
|
208
|
+
this.logger.info('Applying fee juice setup');
|
|
209
|
+
|
|
210
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
211
|
+
|
|
212
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
213
|
+
|
|
214
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
215
|
+
aztecNode: this.context.aztecNodeService,
|
|
216
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
217
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
218
|
+
wallet: this.wallet,
|
|
219
|
+
logger: this.logger,
|
|
220
|
+
});
|
|
242
221
|
}
|
|
243
222
|
|
|
244
|
-
async
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
'🍌.public',
|
|
259
|
-
this.bananaCoin.methods.balance_of_public,
|
|
260
|
-
this.aliceAddress,
|
|
261
|
-
logger,
|
|
262
|
-
);
|
|
263
|
-
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
264
|
-
'🍌.private',
|
|
265
|
-
this.bananaCoin.methods.balance_of_private,
|
|
266
|
-
this.aliceAddress,
|
|
267
|
-
logger,
|
|
268
|
-
);
|
|
269
|
-
return Promise.resolve();
|
|
270
|
-
},
|
|
223
|
+
async applyDeployBananaToken() {
|
|
224
|
+
this.logger.info('Applying deploy banana token setup');
|
|
225
|
+
|
|
226
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
227
|
+
from: this.aliceAddress,
|
|
228
|
+
});
|
|
229
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
230
|
+
|
|
231
|
+
this.bananaCoin = bananaCoin;
|
|
232
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.logger);
|
|
233
|
+
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
234
|
+
'🍌.private',
|
|
235
|
+
this.bananaCoin.methods.balance_of_private,
|
|
236
|
+
this.logger,
|
|
271
237
|
);
|
|
272
238
|
}
|
|
273
239
|
|
|
274
|
-
public async
|
|
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
|
-
|
|
329
|
-
|
|
330
|
-
await this.rollupContract.getManaTarget(),
|
|
331
|
-
) + (await this.rollupContract.getProvingCostPerMana());
|
|
332
|
-
|
|
333
|
-
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
334
|
-
|
|
335
|
-
const mana = block!.header.totalManaUsed.toBigInt();
|
|
336
|
-
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
337
|
-
};
|
|
338
|
-
return Promise.resolve();
|
|
339
|
-
},
|
|
340
|
-
);
|
|
240
|
+
public async applyFPCSetup() {
|
|
241
|
+
this.logger.info('Applying FPC setup');
|
|
242
|
+
|
|
243
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
244
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
245
|
+
|
|
246
|
+
const bananaCoin = this.bananaCoin;
|
|
247
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
248
|
+
from: this.aliceAddress,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
252
|
+
|
|
253
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
254
|
+
|
|
255
|
+
this.bananaFPC = bananaFPC;
|
|
256
|
+
|
|
257
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
258
|
+
|
|
259
|
+
this.getCoinbaseBalance = async () => {
|
|
260
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
261
|
+
const gasL1 = getContract({
|
|
262
|
+
address: l1FeeJuiceAddress.toString(),
|
|
263
|
+
abi: TestERC20Abi,
|
|
264
|
+
client: l1Client,
|
|
265
|
+
});
|
|
266
|
+
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
this.getCoinbaseSequencerRewards = async () => {
|
|
270
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
this.getProverFee = async (blockNumber: BlockNumber) => {
|
|
274
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
275
|
+
|
|
276
|
+
// @todo @lherskind As we deal with #13601
|
|
277
|
+
// Right now the value is from `FeeLib.sol`
|
|
278
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
279
|
+
|
|
280
|
+
// We round up
|
|
281
|
+
const mulDiv = (a: bigint, b: bigint, c: bigint) => (a * b) / c + ((a * b) % c > 0n ? 1n : 0n);
|
|
282
|
+
|
|
283
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block!.header.globalVariables.timestamp);
|
|
284
|
+
const proverCost =
|
|
285
|
+
mulDiv(
|
|
286
|
+
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())),
|
|
287
|
+
1n,
|
|
288
|
+
await this.rollupContract.getManaTarget(),
|
|
289
|
+
) + (await this.rollupContract.getProvingCostPerMana());
|
|
290
|
+
|
|
291
|
+
const price = await this.rollupContract.getEthPerFeeAsset();
|
|
292
|
+
|
|
293
|
+
const mana = block!.header.totalManaUsed.toBigInt();
|
|
294
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
295
|
+
};
|
|
341
296
|
}
|
|
342
297
|
|
|
343
|
-
public async
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return {
|
|
354
|
-
sponsoredFPCAddress: sponsoredFPC.address,
|
|
355
|
-
};
|
|
356
|
-
},
|
|
357
|
-
data => {
|
|
358
|
-
this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
359
|
-
return Promise.resolve();
|
|
360
|
-
},
|
|
361
|
-
);
|
|
298
|
+
public async applySponsoredFPCSetup() {
|
|
299
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
300
|
+
|
|
301
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
302
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
303
|
+
|
|
304
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
305
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
306
|
+
|
|
307
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
362
308
|
}
|
|
363
309
|
|
|
364
310
|
public async applyFundAliceWithBananas() {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
.send({ from: this.aliceAddress })
|
|
372
|
-
.wait();
|
|
373
|
-
},
|
|
374
|
-
() => Promise.resolve(),
|
|
375
|
-
);
|
|
311
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
312
|
+
|
|
313
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
314
|
+
await this.bananaCoin.methods
|
|
315
|
+
.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS)
|
|
316
|
+
.send({ from: this.aliceAddress });
|
|
376
317
|
}
|
|
377
318
|
|
|
378
319
|
public async applyFundAliceWithPrivateBananas() {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
383
|
-
},
|
|
384
|
-
() => Promise.resolve(),
|
|
385
|
-
);
|
|
320
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
321
|
+
|
|
322
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
386
323
|
}
|
|
387
324
|
}
|
|
@@ -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
|
};
|