@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.023c3e5
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 +321 -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 +106 -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 +41 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -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 +114 -102
- 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 +104 -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 +71 -22
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +260 -54
- 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 +162 -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 +37 -41
- 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 +281 -27
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +237 -175
- 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 +44 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +165 -27
- package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +96 -74
- 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 +278 -0
- package/dest/fixtures/fixtures.d.ts +6 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +5 -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/index.d.ts +1 -1
- 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 +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 +15 -15
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +96 -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 +31 -12
- 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 +105 -51
- 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 +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- 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 +176 -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 +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +27 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +233 -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 +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 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- package/package.json +66 -58
- package/src/bench/client_flows/benchmark.ts +363 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +41 -85
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
- package/src/e2e_deploy_contract/deploy_test.ts +40 -48
- package/src/e2e_epochs/epochs_test.ts +341 -81
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +220 -258
- 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 +46 -59
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +341 -234
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +260 -39
- package/src/e2e_token_contract/token_contract_test.ts +115 -126
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +336 -0
- package/src/fixtures/fixtures.ts +5 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +133 -50
- package/src/fixtures/token_utils.ts +33 -15
- 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 +7 -15
- 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 +103 -91
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/index.ts +1 -1
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +18 -20
- package/src/shared/uniswap_l1_l2.ts +197 -221
- package/src/simulators/lending_simulator.ts +16 -17
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +308 -95
- 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 -582
- 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,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { CounterContract } from '@aztec/noir-contracts.js/Counter';
|
|
6
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
7
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
9
8
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
10
9
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
10
|
+
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
11
11
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
12
12
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
13
13
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
14
|
-
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
15
14
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
16
15
|
import { getContract } from 'viem';
|
|
17
16
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
18
|
-
import {
|
|
17
|
+
import { deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
19
18
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
20
|
-
import {
|
|
19
|
+
import { getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
21
20
|
import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
|
|
22
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
23
21
|
/**
|
|
24
|
-
* Test fixture for testing fees. Provides the following
|
|
22
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
25
23
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
26
24
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
27
25
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
28
26
|
* FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
|
|
27
|
+
* SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
|
|
29
28
|
* FundAlice: Mints private and public bananas to Alice.
|
|
30
29
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
31
30
|
*/ export class FeesTest {
|
|
32
31
|
numberOfAccounts;
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
setupOptions;
|
|
33
|
+
accounts;
|
|
34
|
+
context;
|
|
35
35
|
logger;
|
|
36
|
-
pxe;
|
|
37
36
|
aztecNode;
|
|
37
|
+
aztecNodeAdmin;
|
|
38
38
|
cheatCodes;
|
|
39
|
-
|
|
39
|
+
wallet;
|
|
40
40
|
aliceAddress;
|
|
41
|
-
bobWallet;
|
|
42
41
|
bobAddress;
|
|
43
42
|
sequencerAddress;
|
|
44
43
|
coinbase;
|
|
45
44
|
fpcAdmin;
|
|
46
45
|
gasSettings;
|
|
46
|
+
rollupContract;
|
|
47
47
|
feeJuiceContract;
|
|
48
48
|
bananaCoin;
|
|
49
49
|
bananaFPC;
|
|
50
|
+
sponsoredFPC;
|
|
50
51
|
counterContract;
|
|
51
52
|
subscriptionContract;
|
|
52
53
|
feeJuiceBridgeTestHarness;
|
|
53
|
-
context;
|
|
54
54
|
chainMonitor;
|
|
55
55
|
getCoinbaseBalance;
|
|
56
56
|
getCoinbaseSequencerRewards;
|
|
@@ -63,34 +63,37 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
63
63
|
APP_SPONSORED_TX_GAS_LIMIT;
|
|
64
64
|
constructor(testName, numberOfAccounts = 3, setupOptions = {}){
|
|
65
65
|
this.numberOfAccounts = numberOfAccounts;
|
|
66
|
-
this.
|
|
66
|
+
this.setupOptions = setupOptions;
|
|
67
|
+
this.accounts = [];
|
|
67
68
|
this.ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
68
69
|
this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
69
70
|
this.APP_SPONSORED_TX_GAS_LIMIT = BigInt(10e9);
|
|
70
71
|
if (!numberOfAccounts) {
|
|
71
72
|
throw new Error('There must be at least 1 initial account.');
|
|
72
73
|
}
|
|
74
|
+
setupOptions.coinbase ??= EthAddress.random();
|
|
75
|
+
this.coinbase = setupOptions.coinbase;
|
|
73
76
|
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
77
|
}
|
|
81
78
|
async setup() {
|
|
82
|
-
|
|
83
|
-
await
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
this.logger.verbose('Setting up fresh context...');
|
|
80
|
+
this.context = await setup(0, {
|
|
81
|
+
startProverNode: true,
|
|
82
|
+
...this.setupOptions,
|
|
83
|
+
fundSponsoredFPC: true,
|
|
84
|
+
skipAccountDeployment: true,
|
|
85
|
+
l1ContractsArgs: {
|
|
86
|
+
...this.setupOptions
|
|
87
|
+
}
|
|
86
88
|
});
|
|
87
|
-
|
|
88
|
-
this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
|
|
89
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
90
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
91
|
+
await this.applyBaseSetup();
|
|
89
92
|
return this;
|
|
90
93
|
}
|
|
91
94
|
async teardown() {
|
|
92
|
-
this.chainMonitor.stop();
|
|
93
|
-
await this.
|
|
95
|
+
await this.chainMonitor.stop();
|
|
96
|
+
await teardown(this.context);
|
|
94
97
|
}
|
|
95
98
|
setIsMarkingAsProven(b) {
|
|
96
99
|
this.context.watcher.setIsMarkingAsProven(b);
|
|
@@ -101,169 +104,145 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
101
104
|
await sleep(1000);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
|
-
async
|
|
105
|
-
const
|
|
107
|
+
async getBlockRewards() {
|
|
108
|
+
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
109
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
110
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
111
|
+
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
112
|
+
const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
|
|
113
|
+
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
114
|
+
return {
|
|
115
|
+
sequencerBlockRewards,
|
|
116
|
+
proverBlockRewards
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async mintAndBridgeFeeJuice(minter, recipient) {
|
|
120
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
|
|
106
121
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
107
|
-
await this.feeJuiceContract.methods.claim(
|
|
122
|
+
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({
|
|
123
|
+
from: minter
|
|
124
|
+
});
|
|
108
125
|
}
|
|
109
126
|
/** 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
|
-
|
|
127
|
+
const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
128
|
+
from: this.aliceAddress
|
|
129
|
+
});
|
|
130
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
131
|
+
const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
|
|
132
|
+
from: this.aliceAddress
|
|
133
|
+
});
|
|
113
134
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
114
135
|
}
|
|
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
|
-
});
|
|
136
|
+
async applyBaseSetup() {
|
|
137
|
+
await this.applyInitialAccounts();
|
|
138
|
+
await this.applyPublicDeployAccounts();
|
|
139
|
+
await this.applySetupFeeJuice();
|
|
140
|
+
await this.applyDeployBananaToken();
|
|
141
|
+
}
|
|
142
|
+
async applyInitialAccounts() {
|
|
143
|
+
this.logger.info('Applying initial accounts setup');
|
|
144
|
+
const { deployedAccounts } = await deployAccounts(this.numberOfAccounts, this.logger)({
|
|
145
|
+
wallet: this.context.wallet,
|
|
146
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
151
147
|
});
|
|
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
|
-
});
|
|
148
|
+
this.wallet = this.context.wallet;
|
|
149
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
150
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
151
|
+
this.gasSettings = GasSettings.default({
|
|
152
|
+
maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2)
|
|
172
153
|
});
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
154
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
155
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
156
|
+
this.accounts.forEach((a, i)=>this.logger.verbose(`Account ${i} address: ${a}`));
|
|
157
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
158
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
159
|
+
this.fpcAdmin = this.aliceAddress;
|
|
160
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
161
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
162
|
+
}
|
|
163
|
+
async applyPublicDeployAccounts() {
|
|
164
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
165
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
166
|
+
}
|
|
167
|
+
async applySetupFeeJuice() {
|
|
168
|
+
this.logger.info('Applying fee juice setup');
|
|
169
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
170
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
171
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
172
|
+
aztecNode: this.context.aztecNodeService,
|
|
173
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
174
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
175
|
+
wallet: this.wallet,
|
|
176
|
+
logger: this.logger
|
|
183
177
|
});
|
|
184
178
|
}
|
|
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
|
-
};
|
|
179
|
+
async applyDeployBananaToken() {
|
|
180
|
+
this.logger.info('Applying deploy banana token setup');
|
|
181
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
182
|
+
from: this.aliceAddress
|
|
239
183
|
});
|
|
184
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
185
|
+
this.bananaCoin = bananaCoin;
|
|
186
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, this.logger);
|
|
187
|
+
this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, this.logger);
|
|
188
|
+
}
|
|
189
|
+
async applyFPCSetup() {
|
|
190
|
+
this.logger.info('Applying FPC setup');
|
|
191
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
192
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
193
|
+
const bananaCoin = this.bananaCoin;
|
|
194
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
195
|
+
from: this.aliceAddress
|
|
196
|
+
});
|
|
197
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
198
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
199
|
+
this.bananaFPC = bananaFPC;
|
|
200
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
201
|
+
this.getCoinbaseBalance = async ()=>{
|
|
202
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
203
|
+
const gasL1 = getContract({
|
|
204
|
+
address: l1FeeJuiceAddress.toString(),
|
|
205
|
+
abi: TestERC20Abi,
|
|
206
|
+
client: l1Client
|
|
207
|
+
});
|
|
208
|
+
return await gasL1.read.balanceOf([
|
|
209
|
+
this.coinbase.toString()
|
|
210
|
+
]);
|
|
211
|
+
};
|
|
212
|
+
this.getCoinbaseSequencerRewards = async ()=>{
|
|
213
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
214
|
+
};
|
|
215
|
+
this.getProverFee = async (blockNumber)=>{
|
|
216
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
217
|
+
// @todo @lherskind As we deal with #13601
|
|
218
|
+
// Right now the value is from `FeeLib.sol`
|
|
219
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
220
|
+
// We round up
|
|
221
|
+
const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
|
|
222
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
|
|
223
|
+
const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
|
|
224
|
+
const price = await this.rollupContract.getEthPerFeeAsset();
|
|
225
|
+
const mana = block.header.totalManaUsed.toBigInt();
|
|
226
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
async applySponsoredFPCSetup() {
|
|
230
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
231
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
232
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
233
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
234
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
235
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
240
236
|
}
|
|
241
237
|
async applyFundAliceWithBananas() {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
238
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
239
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
240
|
+
await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send({
|
|
241
|
+
from: this.aliceAddress
|
|
242
|
+
});
|
|
246
243
|
}
|
|
247
244
|
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
|
-
});
|
|
245
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
246
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
268
247
|
}
|
|
269
248
|
}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JpdGVfanNvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2UyZV9sMV9wdWJsaXNoZXIvd3JpdGVfanNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRS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AAE,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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lMmVfbXVsdGlfdmFsaWRhdG9yL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFXMUQsd0JBQWdCLG1CQUFtQixDQUFDLFNBQVMsRUF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