@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.001888fc
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 +62 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +281 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +329 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +124 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +79 -0
- package/dest/bench/utils.d.ts +16 -41
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +44 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +28 -19
- 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 +125 -103
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
- 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 +105 -104
- package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +26 -27
- package/dest/e2e_epochs/epochs_test.d.ts +75 -24
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +290 -58
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +61 -0
- package/dest/e2e_fees/fees_test.d.ts +38 -23
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +169 -183
- package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +56 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +15 -15
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +36 -42
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
- package/dest/e2e_p2p/p2p_network.d.ts +282 -27
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +255 -176
- 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 +190 -0
- package/dest/e2e_p2p/shared.d.ts +64 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +200 -27
- 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 +29 -14
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +107 -75
- 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 +55 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.js +271 -0
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +10 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +11 -5
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +3 -15
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- 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/l1_to_l2_messaging.d.ts +11 -7
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +45 -19
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +239 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +606 -0
- package/dest/fixtures/setup_p2p_test.d.ts +23 -15
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +102 -31
- package/dest/fixtures/token_utils.d.ts +10 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +33 -13
- package/dest/fixtures/utils.d.ts +5 -153
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -552
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- 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/index.d.ts +1 -1
- 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 +44 -27
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +107 -53
- package/dest/shared/gas_portal_test_harness.d.ts +33 -25
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +51 -30
- 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/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +42 -2
- 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 +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +15 -16
- package/dest/shared/uniswap_l1_l2.d.ts +3 -25
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +175 -126
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +7 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +17 -18
- package/dest/simulators/token_simulator.d.ts +6 -3
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +12 -30
- package/dest/spartan/setup_test_wallets.d.ts +36 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +276 -62
- 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 +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 +45 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -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 +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -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 +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -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 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- 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 +48 -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 +151 -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 +72 -62
- package/src/bench/client_flows/benchmark.ts +363 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +388 -0
- package/src/bench/client_flows/config.ts +69 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +47 -86
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +149 -171
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +155 -182
- package/src/e2e_deploy_contract/deploy_test.ts +40 -48
- package/src/e2e_epochs/epochs_test.ts +364 -93
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +213 -259
- package/src/e2e_l1_publisher/write_json.ts +77 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +48 -59
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +367 -234
- package/src/e2e_p2p/reqresp/utils.ts +256 -0
- package/src/e2e_p2p/shared.ts +315 -39
- 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 +132 -126
- 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 +332 -0
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +15 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/setup.ts +903 -0
- package/src/fixtures/setup_p2p_test.ts +134 -50
- package/src/fixtures/token_utils.ts +37 -16
- package/src/fixtures/utils.ts +27 -820
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +9 -17
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +110 -94
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +52 -2
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +19 -20
- package/src/shared/uniswap_l1_l2.ts +207 -226
- package/src/simulators/lending_simulator.ts +18 -17
- package/src/simulators/token_simulator.ts +18 -34
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +393 -95
- package/src/spartan/tx_metrics.ts +376 -0
- 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 +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -582
- 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 +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/e2e_prover/e2e_prover_test.js +0 -291
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- 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 -87
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -479
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/e2e_prover/e2e_prover_test.ts +0 -418
- package/src/fixtures/setup_l1_contracts.ts +0 -27
- package/src/fixtures/snapshot_manager.ts +0 -617
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RollupContract
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
3
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
4
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { CounterContract } from '@aztec/noir-contracts.js/Counter';
|
|
7
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
8
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
9
9
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
10
10
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
11
|
+
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
11
12
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
12
13
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
13
14
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
14
|
-
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
15
15
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
16
16
|
import { getContract } from 'viem';
|
|
17
17
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
18
|
-
import {
|
|
18
|
+
import { deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
19
19
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
20
|
-
import {
|
|
20
|
+
import { getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
21
21
|
import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
|
|
22
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
23
22
|
/**
|
|
24
|
-
* Test fixture for testing fees. Provides the following
|
|
23
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
25
24
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
26
25
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
27
26
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
28
27
|
* FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
|
|
28
|
+
* SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
|
|
29
29
|
* FundAlice: Mints private and public bananas to Alice.
|
|
30
30
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
31
31
|
*/ export class FeesTest {
|
|
32
32
|
numberOfAccounts;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
setupOptions;
|
|
34
|
+
accounts;
|
|
35
|
+
context;
|
|
35
36
|
logger;
|
|
36
|
-
pxe;
|
|
37
37
|
aztecNode;
|
|
38
|
+
aztecNodeAdmin;
|
|
38
39
|
cheatCodes;
|
|
39
|
-
|
|
40
|
+
wallet;
|
|
40
41
|
aliceAddress;
|
|
41
|
-
bobWallet;
|
|
42
42
|
bobAddress;
|
|
43
43
|
sequencerAddress;
|
|
44
44
|
coinbase;
|
|
45
45
|
fpcAdmin;
|
|
46
46
|
gasSettings;
|
|
47
|
+
rollupContract;
|
|
47
48
|
feeJuiceContract;
|
|
48
49
|
bananaCoin;
|
|
49
50
|
bananaFPC;
|
|
51
|
+
sponsoredFPC;
|
|
50
52
|
counterContract;
|
|
51
53
|
subscriptionContract;
|
|
52
54
|
feeJuiceBridgeTestHarness;
|
|
53
|
-
context;
|
|
54
55
|
chainMonitor;
|
|
55
56
|
getCoinbaseBalance;
|
|
56
57
|
getCoinbaseSequencerRewards;
|
|
@@ -63,34 +64,43 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
63
64
|
APP_SPONSORED_TX_GAS_LIMIT;
|
|
64
65
|
constructor(testName, numberOfAccounts = 3, setupOptions = {}){
|
|
65
66
|
this.numberOfAccounts = numberOfAccounts;
|
|
66
|
-
this.
|
|
67
|
+
this.setupOptions = setupOptions;
|
|
68
|
+
this.accounts = [];
|
|
67
69
|
this.ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
68
70
|
this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
69
71
|
this.APP_SPONSORED_TX_GAS_LIMIT = BigInt(10e9);
|
|
70
72
|
if (!numberOfAccounts) {
|
|
71
73
|
throw new Error('There must be at least 1 initial account.');
|
|
72
74
|
}
|
|
75
|
+
setupOptions.coinbase ??= EthAddress.random();
|
|
76
|
+
this.coinbase = setupOptions.coinbase;
|
|
73
77
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
74
|
-
this.snapshotManager = createSnapshotManager(`e2e_fees/${testName}-${numberOfAccounts}`, dataPath, {
|
|
75
|
-
startProverNode: true,
|
|
76
|
-
...setupOptions
|
|
77
|
-
}, {
|
|
78
|
-
...setupOptions
|
|
79
|
-
});
|
|
80
78
|
}
|
|
81
79
|
async setup() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
this.logger.verbose('Setting up fresh context...');
|
|
81
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
82
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
83
|
+
this.context = await setup(0, {
|
|
84
|
+
startProverNode: true,
|
|
85
|
+
...this.setupOptions,
|
|
86
|
+
fundSponsoredFPC: true,
|
|
87
|
+
skipAccountDeployment: true,
|
|
88
|
+
l1ContractsArgs: {
|
|
89
|
+
...this.setupOptions
|
|
90
|
+
},
|
|
91
|
+
txPublicSetupAllowListExtend: [
|
|
92
|
+
...this.setupOptions.txPublicSetupAllowListExtend ?? [],
|
|
93
|
+
...tokenAllowList
|
|
94
|
+
]
|
|
86
95
|
});
|
|
87
|
-
|
|
88
|
-
this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
|
|
96
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
97
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
98
|
+
await this.applyBaseSetup();
|
|
89
99
|
return this;
|
|
90
100
|
}
|
|
91
101
|
async teardown() {
|
|
92
|
-
this.chainMonitor.stop();
|
|
93
|
-
await this.
|
|
102
|
+
await this.chainMonitor.stop();
|
|
103
|
+
await teardown(this.context);
|
|
94
104
|
}
|
|
95
105
|
setIsMarkingAsProven(b) {
|
|
96
106
|
this.context.watcher.setIsMarkingAsProven(b);
|
|
@@ -101,169 +111,145 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
101
111
|
await sleep(1000);
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
|
-
async
|
|
105
|
-
const
|
|
114
|
+
async getBlockRewards() {
|
|
115
|
+
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
116
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
117
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
118
|
+
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
119
|
+
const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
|
|
120
|
+
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
121
|
+
return {
|
|
122
|
+
sequencerBlockRewards,
|
|
123
|
+
proverBlockRewards
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
async mintAndBridgeFeeJuice(minter, recipient) {
|
|
127
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
|
|
106
128
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
107
|
-
await this.feeJuiceContract.methods.claim(
|
|
129
|
+
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({
|
|
130
|
+
from: minter
|
|
131
|
+
});
|
|
108
132
|
}
|
|
109
133
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
|
|
110
|
-
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate(
|
|
111
|
-
|
|
112
|
-
|
|
134
|
+
const { result: balanceBefore } = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
135
|
+
from: address
|
|
136
|
+
});
|
|
137
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
138
|
+
const { result: balanceAfter } = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
139
|
+
from: address
|
|
140
|
+
});
|
|
113
141
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
114
142
|
}
|
|
115
|
-
async
|
|
116
|
-
await this.
|
|
117
|
-
await this.
|
|
118
|
-
await this.
|
|
119
|
-
await this.
|
|
120
|
-
}
|
|
121
|
-
async
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
this.
|
|
126
|
-
maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2)
|
|
127
|
-
});
|
|
128
|
-
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
129
|
-
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
130
|
-
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
131
|
-
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
132
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.wallets.map((w)=>w.getAddress());
|
|
133
|
-
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
134
|
-
this.fpcAdmin = this.aliceAddress;
|
|
135
|
-
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
136
|
-
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.aliceWallet);
|
|
137
|
-
if (this.numberOfAccounts > 1) {
|
|
138
|
-
const bobInstance = (await this.bobWallet.getContractMetadata(this.bobAddress)).contractInstance;
|
|
139
|
-
await this.aliceWallet.registerAccount(deployedAccounts[1].secret, await computePartialAddress(bobInstance));
|
|
140
|
-
}
|
|
141
|
-
this.coinbase = EthAddress.random();
|
|
142
|
-
const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
143
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
144
|
-
aztecNode: aztecNode,
|
|
145
|
-
pxeService: pxe,
|
|
146
|
-
publicClient: publicClient,
|
|
147
|
-
walletClient: walletClient,
|
|
148
|
-
wallet: this.aliceWallet,
|
|
149
|
-
logger: this.logger
|
|
150
|
-
});
|
|
143
|
+
async applyBaseSetup() {
|
|
144
|
+
await this.applyInitialAccounts();
|
|
145
|
+
await this.applyPublicDeployAccounts();
|
|
146
|
+
await this.applySetupFeeJuice();
|
|
147
|
+
await this.applyDeployBananaToken();
|
|
148
|
+
}
|
|
149
|
+
async applyInitialAccounts() {
|
|
150
|
+
this.logger.info('Applying initial accounts setup');
|
|
151
|
+
const { deployedAccounts } = await deployAccounts(this.numberOfAccounts, this.logger)({
|
|
152
|
+
wallet: this.context.wallet,
|
|
153
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
151
154
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
await this.snapshotManager.snapshot('setup_fee_juice', async (context)=>{
|
|
158
|
-
await setupCanonicalFeeJuice(context.pxe);
|
|
159
|
-
}, async (_data, context)=>{
|
|
160
|
-
this.context = context;
|
|
161
|
-
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.aliceWallet);
|
|
162
|
-
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
163
|
-
const { publicClient, walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
164
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
165
|
-
aztecNode: context.aztecNode,
|
|
166
|
-
pxeService: context.pxe,
|
|
167
|
-
publicClient: publicClient,
|
|
168
|
-
walletClient: walletClient,
|
|
169
|
-
wallet: this.aliceWallet,
|
|
170
|
-
logger: this.logger
|
|
171
|
-
});
|
|
155
|
+
this.wallet = this.context.wallet;
|
|
156
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
157
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
158
|
+
this.gasSettings = GasSettings.default({
|
|
159
|
+
maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2)
|
|
172
160
|
});
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
161
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
162
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
163
|
+
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
164
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
165
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
166
|
+
this.fpcAdmin = this.aliceAddress;
|
|
167
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
168
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
169
|
+
}
|
|
170
|
+
async applyPublicDeployAccounts() {
|
|
171
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
172
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
173
|
+
}
|
|
174
|
+
async applySetupFeeJuice() {
|
|
175
|
+
this.logger.info('Applying fee juice setup');
|
|
176
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
177
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
178
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
179
|
+
aztecNode: this.context.aztecNodeService,
|
|
180
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
181
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
182
|
+
wallet: this.wallet,
|
|
183
|
+
logger: this.logger
|
|
183
184
|
});
|
|
184
185
|
}
|
|
185
|
-
async
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const bananaCoin = this.bananaCoin;
|
|
190
|
-
const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin).send().deployed();
|
|
191
|
-
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
192
|
-
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(FEE_FUNDING_FOR_TESTER_ACCOUNT, bananaFPC.address);
|
|
193
|
-
return {
|
|
194
|
-
bananaFPCAddress: bananaFPC.address,
|
|
195
|
-
feeJuiceAddress: feeJuiceContract.address,
|
|
196
|
-
l1FeeJuiceAddress: this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress,
|
|
197
|
-
rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress
|
|
198
|
-
};
|
|
199
|
-
}, async (data, context)=>{
|
|
200
|
-
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.aliceWallet);
|
|
201
|
-
this.bananaFPC = bananaFPC;
|
|
202
|
-
const logger = this.logger;
|
|
203
|
-
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, logger);
|
|
204
|
-
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, logger);
|
|
205
|
-
this.getCoinbaseBalance = async ()=>{
|
|
206
|
-
const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
207
|
-
const gasL1 = getContract({
|
|
208
|
-
address: data.l1FeeJuiceAddress.toString(),
|
|
209
|
-
abi: TestERC20Abi,
|
|
210
|
-
client: walletClient
|
|
211
|
-
});
|
|
212
|
-
return await gasL1.read.balanceOf([
|
|
213
|
-
this.coinbase.toString()
|
|
214
|
-
]);
|
|
215
|
-
};
|
|
216
|
-
this.getCoinbaseSequencerRewards = async ()=>{
|
|
217
|
-
const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
218
|
-
const rollup = getContract({
|
|
219
|
-
address: data.rollupAddress.toString(),
|
|
220
|
-
abi: RollupAbi,
|
|
221
|
-
client: walletClient
|
|
222
|
-
});
|
|
223
|
-
return await rollup.read.getSequencerRewards([
|
|
224
|
-
this.coinbase.toString()
|
|
225
|
-
]);
|
|
226
|
-
};
|
|
227
|
-
this.getProverFee = async (blockNumber)=>{
|
|
228
|
-
const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
229
|
-
const rollup = getContract({
|
|
230
|
-
address: data.rollupAddress.toString(),
|
|
231
|
-
abi: RollupAbi,
|
|
232
|
-
client: walletClient
|
|
233
|
-
});
|
|
234
|
-
const provingCostPerMana = await rollup.read.getProvingCostPerManaInFeeAsset();
|
|
235
|
-
const block = await this.pxe.getBlock(blockNumber);
|
|
236
|
-
const mana = block.header.totalManaUsed.toBigInt();
|
|
237
|
-
return mana * provingCostPerMana;
|
|
238
|
-
};
|
|
186
|
+
async applyDeployBananaToken() {
|
|
187
|
+
this.logger.info('Applying deploy banana token setup');
|
|
188
|
+
const { contract: bananaCoin } = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
189
|
+
from: this.aliceAddress
|
|
239
190
|
});
|
|
191
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
192
|
+
this.bananaCoin = bananaCoin;
|
|
193
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.logger);
|
|
194
|
+
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.logger);
|
|
195
|
+
}
|
|
196
|
+
async applyFPCSetup() {
|
|
197
|
+
this.logger.info('Applying FPC setup');
|
|
198
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
199
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
200
|
+
const bananaCoin = this.bananaCoin;
|
|
201
|
+
const { contract: bananaFPC } = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
202
|
+
from: this.aliceAddress
|
|
203
|
+
});
|
|
204
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
205
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
206
|
+
this.bananaFPC = bananaFPC;
|
|
207
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
208
|
+
this.getCoinbaseBalance = async ()=>{
|
|
209
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
210
|
+
const gasL1 = getContract({
|
|
211
|
+
address: l1FeeJuiceAddress.toString(),
|
|
212
|
+
abi: TestERC20Abi,
|
|
213
|
+
client: l1Client
|
|
214
|
+
});
|
|
215
|
+
return await gasL1.read.balanceOf([
|
|
216
|
+
this.coinbase.toString()
|
|
217
|
+
]);
|
|
218
|
+
};
|
|
219
|
+
this.getCoinbaseSequencerRewards = async ()=>{
|
|
220
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
221
|
+
};
|
|
222
|
+
this.getProverFee = async (blockNumber)=>{
|
|
223
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
224
|
+
// @todo @lherskind As we deal with #13601
|
|
225
|
+
// Right now the value is from `FeeLib.sol`
|
|
226
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 3600000n;
|
|
227
|
+
// We round up
|
|
228
|
+
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
229
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
230
|
+
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
|
|
231
|
+
const price = await this.rollupContract.getEthPerFeeAsset();
|
|
232
|
+
const mana = block.header.totalManaUsed.toBigInt();
|
|
233
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
async applySponsoredFPCSetup() {
|
|
237
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
238
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
239
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
240
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
241
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
242
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
240
243
|
}
|
|
241
244
|
async applyFundAliceWithBananas() {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
246
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
247
|
+
await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send({
|
|
248
|
+
from: this.aliceAddress
|
|
249
|
+
});
|
|
246
250
|
}
|
|
247
251
|
async applyFundAliceWithPrivateBananas() {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, ()=>Promise.resolve());
|
|
251
|
-
}
|
|
252
|
-
async applySetupSubscription() {
|
|
253
|
-
await this.snapshotManager.snapshot('setup_subscription', async ()=>{
|
|
254
|
-
const counterContract = await CounterContract.deploy(this.bobWallet, 0, this.bobAddress).send().deployed();
|
|
255
|
-
// Deploy subscription contract, that allows subscriptions for SUBSCRIPTION_AMOUNT of bananas
|
|
256
|
-
const subscriptionContract = await AppSubscriptionContract.deploy(this.bobWallet, counterContract.address, this.bobAddress, this.bananaCoin.address, this.SUBSCRIPTION_AMOUNT, this.APP_SPONSORED_TX_GAS_LIMIT).send().deployed();
|
|
257
|
-
// Mint some Fee Juice to the subscription contract
|
|
258
|
-
// Could also use bridgeFromL1ToL2 from the harness, but this is more direct
|
|
259
|
-
await this.mintAndBridgeFeeJuice(subscriptionContract.address, FEE_FUNDING_FOR_TESTER_ACCOUNT);
|
|
260
|
-
return {
|
|
261
|
-
counterContractAddress: counterContract.address,
|
|
262
|
-
subscriptionContractAddress: subscriptionContract.address
|
|
263
|
-
};
|
|
264
|
-
}, async ({ counterContractAddress, subscriptionContractAddress })=>{
|
|
265
|
-
this.counterContract = await CounterContract.at(counterContractAddress, this.bobWallet);
|
|
266
|
-
this.subscriptionContract = await AppSubscriptionContract.at(subscriptionContractAddress, this.bobWallet);
|
|
267
|
-
});
|
|
252
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
253
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
268
254
|
}
|
|
269
255
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { BatchedBlob, Blob } from '@aztec/blob-lib';
|
|
4
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
5
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a json object that can be used to test the solidity contract.
|
|
8
|
+
* The json object must be put into
|
|
9
|
+
*/
|
|
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=
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getEthBlobEvaluationInputs, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
2
|
+
import { writeFile } from 'fs/promises';
|
|
3
|
+
const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a json object that can be used to test the solidity contract.
|
|
6
|
+
* The json object must be put into
|
|
7
|
+
*/ export async function writeJson(fileName, checkpointHeader, block, l1ToL2Content, blobs, batchedBlob, recipientAddress, deployerAddress) {
|
|
8
|
+
if (!AZTEC_GENERATE_TEST_DATA) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
// Path relative to the package.json in the end-to-end folder
|
|
12
|
+
const path = `../../l1-contracts/test/fixtures/${fileName}.json`;
|
|
13
|
+
const asHex = (value, size = 64)=>{
|
|
14
|
+
const buffer = Buffer.isBuffer(value) ? value : value.toBuffer();
|
|
15
|
+
return `0x${buffer.toString('hex').padStart(size, '0')}`;
|
|
16
|
+
};
|
|
17
|
+
const jsonObject = {
|
|
18
|
+
populate: {
|
|
19
|
+
l1ToL2Content: l1ToL2Content.map((value)=>asHex(value)),
|
|
20
|
+
recipient: asHex(recipientAddress.toField()),
|
|
21
|
+
sender: deployerAddress
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
l2ToL1Messages: block.body.txEffects.flatMap((txEffect)=>txEffect.l2ToL1Msgs).map((value)=>asHex(value))
|
|
25
|
+
},
|
|
26
|
+
checkpoint: {
|
|
27
|
+
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
28
|
+
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
29
|
+
archive: asHex(block.archive.root),
|
|
30
|
+
blobCommitments: getPrefixedEthBlobCommitments(blobs),
|
|
31
|
+
batchedBlobInputs: getEthBlobEvaluationInputs(batchedBlob),
|
|
32
|
+
checkpointNumber: block.number,
|
|
33
|
+
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
34
|
+
header: {
|
|
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),
|
|
44
|
+
gasFees: {
|
|
45
|
+
feePerDaGas: Number(checkpointHeader.gasFees.feePerDaGas),
|
|
46
|
+
feePerL2Gas: Number(checkpointHeader.gasFees.feePerL2Gas)
|
|
47
|
+
},
|
|
48
|
+
totalManaUsed: checkpointHeader.totalManaUsed.toNumber()
|
|
49
|
+
},
|
|
50
|
+
headerHash: asHex(checkpointHeader.hash()),
|
|
51
|
+
numTxs: block.body.txEffects.length
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const output = JSON.stringify(jsonObject, null, 2);
|
|
55
|
+
await writeFile(path, output, 'utf8');
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { EthPrivateKey } from '@aztec/node-keystore';
|
|
4
|
+
export declare function createJSONRPCSigner(keyLookup: Map<string, EthPrivateKey>, stats: Map<string, number>): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
5
|
+
export declare function createKeyFile1(fileName: string, mnemonic: string, validatorIndex: number, publisher1Key: EthPrivateKey, publisher2Key: EthPrivateKey, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
|
|
6
|
+
export declare function createKeyFile2(fileName: string, validatorKey: EthPrivateKey, publisherMnemonic: string, publisher1Index: number, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
|
|
7
|
+
export declare function createKeyFile3(fileName: string, validatorAddress: EthAddress, publisher1Key: EthPrivateKey, publisher2Key: EthPrivateKey, coinbase: EthAddress, remoteSignerUrl: string, feeRecipient: AztecAddress): Promise<void>;
|
|
8
|
+
export declare function createKeyFile4(fileName: string, validator1Address: EthAddress, validator2Address: EthAddress, publisher1Index: number, publisher2Key: EthPrivateKey, mnemonic: string, publisher3Key: EthPrivateKey, coinbase1: EthAddress, coinbase2: EthAddress, remoteSignerUrl: string, feeRecipient1: AztecAddress, feeRecipient2: AztecAddress): Promise<void>;
|
|
9
|
+
export declare function createKeyFile5(fileName: string, proverAddress: EthAddress, remoteSignerUrl: string): Promise<void>;
|
|
10
|
+
export declare function createKeyFile6(fileName: string, mnemonic: string, validator1Index: number, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
|
|
11
|
+
export declare function addressForPrivateKey(privateKey: EthPrivateKey): EthAddress;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lMmVfbXVsdGlfdmFsaWRhdG9yL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFXMUQsd0JBQWdCLG1CQUFtQixDQUFDLFNBQVMsRUFBRSxHQUFHLENBQUMsTUFBTSxFQUFFLGFBQWEsQ0FBQyxFQUFFLEtBQUssRUFBRSxHQUFHLENBQUMsTUFBTSxFQUFFLE1BQU0sQ0FBQyxzR0EwRXBHO0FBR0Qsd0JBQXNCLGNBQWMsQ0FDbEMsUUFBUSxFQUFFLE1BQU0sRUFDaEIsUUFBUSxFQUFFLE1BQU0sRUFDaEIsY0FBYyxFQUFFLE1BQU0sRUFDdEIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsWUFBWSxFQUFFLFlBQVksaUJBbUIzQjtBQUVELHdCQUFzQixjQUFjLENBQ2xDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLFlBQVksRUFBRSxhQUFhLEVBQzNCLGlCQUFpQixFQUFFLE1BQU0sRUFDekIsZUFBZSxFQUFFLE1BQU0sRUFDdkIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsWUFBWSxFQUFFLFlBQVksaUJBbUIzQjtBQUVELHdCQUFzQixjQUFjLENBQ2xDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLGdCQUFnQixFQUFFLFVBQVUsRUFDNUIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsZUFBZSxFQUFFLE1BQU0sRUFDdkIsWUFBWSxFQUFFLFlBQVksaUJBaUIzQjtBQUVELHdCQUFzQixjQUFjLENBQ2xDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLGlCQUFpQixFQUFFLFVBQVUsRUFDN0IsaUJBQWlCLEVBQUUsVUFBVSxFQUM3QixlQUFlLEVBQUUsTUFBTSxFQUN2QixhQUFhLEVBQUUsYUFBYSxFQUM1QixRQUFRLEVBQUUsTUFBTSxFQUNoQixhQUFhLEVBQUUsYUFBYSxFQUM1QixTQUFTLEVBQUUsVUFBVSxFQUNyQixTQUFTLEVBQUUsVUFBVSxFQUNyQixlQUFlLEVBQUUsTUFBTSxFQUN2QixhQUFhLEVBQUUsWUFBWSxFQUMzQixhQUFhLEVBQUUsWUFBWSxpQkE0QjVCO0FBRUQsd0JBQXNCLGNBQWMsQ0FBQyxRQUFRLEVBQUUsTUFBTSxFQUFFLGFBQWEsRUFBRSxVQUFVLEVBQUUsZUFBZSxFQUFFLE1BQU0saUJBY3hHO0FBRUQsd0JBQXNCLGNBQWMsQ0FDbEMsUUFBUSxFQUFFLE1BQU0sRUFDaEIsUUFBUSxFQUFFLE1BQU0sRUFDaEIsZUFBZSxFQUFFLE1BQU0sRUFDdkIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsWUFBWSxFQUFFLFlBQVksaUJBa0IzQjtBQUVELHdCQUFnQixvQkFBb0IsQ0FBQyxVQUFVLEVBQUUsYUFBYSxHQUFHLFVBQVUsQ0FFMUUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/e2e_multi_validator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAW1D,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,sGA0EpG;AAGD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAmB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAmB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,UAAU,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,YAAY,iBAiB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,UAAU,EAC7B,iBAAiB,EAAE,UAAU,EAC7B,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,UAAU,EACrB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,YAAY,EAC3B,aAAa,EAAE,YAAY,iBA4B5B;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAcxG;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAkB3B;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,UAAU,CAE1E"}
|