@aztec/end-to-end 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52
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 +21 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +116 -121
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +7 -27
- package/dest/bench/utils.d.ts +5 -5
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +18 -11
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +98 -113
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +91 -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 +11 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +19 -16
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +4 -6
- package/dest/e2e_fees/fees_test.d.ts +20 -16
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +127 -139
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +23 -18
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +32 -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 +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts +225 -18
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +117 -110
- 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 +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +90 -92
- package/dest/fixtures/e2e_prover_test.d.ts +12 -18
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +98 -109
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +216 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +684 -0
- package/dest/fixtures/setup_p2p_test.d.ts +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -10
- package/dest/fixtures/token_utils.d.ts +5 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/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 +5 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts +2 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +43 -23
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +2 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +5 -3
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +8 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +45 -10
- package/dest/spartan/tx_metrics.d.ts +52 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +248 -0
- package/dest/spartan/utils.d.ts +66 -24
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +326 -133
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +157 -162
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +22 -14
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +107 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -124
- package/src/e2e_deploy_contract/deploy_test.ts +22 -15
- package/src/e2e_epochs/epochs_test.ts +39 -25
- package/src/e2e_fees/bridging_race.notest.ts +4 -7
- package/src/e2e_fees/fees_test.ts +180 -215
- package/src/e2e_l1_publisher/write_json.ts +26 -20
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +35 -55
- package/src/e2e_p2p/inactivity_slash_test.ts +10 -9
- package/src/e2e_p2p/p2p_network.ts +175 -180
- package/src/e2e_p2p/shared.ts +15 -7
- package/src/e2e_token_contract/token_contract_test.ts +105 -118
- package/src/fixtures/e2e_prover_test.ts +120 -153
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +1010 -0
- package/src/fixtures/setup_p2p_test.ts +23 -9
- package/src/fixtures/token_utils.ts +4 -4
- package/src/fixtures/utils.ts +27 -947
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +1 -1
- 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 +6 -9
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/index.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +53 -67
- package/src/simulators/lending_simulator.ts +6 -4
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +56 -13
- package/src/spartan/tx_metrics.ts +231 -0
- package/src/spartan/utils.ts +379 -75
- 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 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -2,8 +2,11 @@ import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
|
-
import {
|
|
5
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
6
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
|
+
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
6
8
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
9
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
7
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
11
|
import { sleep } from '@aztec/foundation/sleep';
|
|
9
12
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -16,31 +19,26 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
16
19
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
17
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
18
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
19
23
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
20
24
|
|
|
21
25
|
import { getContract } from 'viem';
|
|
22
26
|
|
|
23
27
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
24
28
|
import {
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
createSnapshotManager,
|
|
29
|
+
type EndToEndContext,
|
|
30
|
+
type SetupOptions,
|
|
28
31
|
deployAccounts,
|
|
29
|
-
|
|
32
|
+
publicDeployAccounts,
|
|
33
|
+
setup,
|
|
34
|
+
teardown,
|
|
35
|
+
} from '../fixtures/setup.js';
|
|
30
36
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
31
|
-
import {
|
|
32
|
-
type BalancesFn,
|
|
33
|
-
type SetupOptions,
|
|
34
|
-
ensureAccountContractsPublished,
|
|
35
|
-
getBalancesFn,
|
|
36
|
-
setupSponsoredFPC,
|
|
37
|
-
} from '../fixtures/utils.js';
|
|
37
|
+
import { type BalancesFn, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
38
38
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
39
39
|
|
|
40
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
41
|
-
|
|
42
40
|
/**
|
|
43
|
-
* Test fixture for testing fees. Provides the following
|
|
41
|
+
* Test fixture for testing fees. Provides the following setup steps:
|
|
44
42
|
* InitialAccounts: Initializes 3 Schnorr account contracts.
|
|
45
43
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
46
44
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
@@ -50,11 +48,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
50
48
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
51
49
|
*/
|
|
52
50
|
export class FeesTest {
|
|
53
|
-
private snapshotManager: ISnapshotManager;
|
|
54
51
|
private accounts: AztecAddress[] = [];
|
|
52
|
+
public context!: EndToEndContext;
|
|
55
53
|
|
|
56
54
|
public logger: Logger;
|
|
57
55
|
public aztecNode!: AztecNode;
|
|
56
|
+
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
58
57
|
public cheatCodes!: CheatCodes;
|
|
59
58
|
|
|
60
59
|
public wallet!: TestWallet;
|
|
@@ -77,7 +76,6 @@ export class FeesTest {
|
|
|
77
76
|
public subscriptionContract!: AppSubscriptionContract;
|
|
78
77
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
79
78
|
|
|
80
|
-
public context!: SubsystemsContext;
|
|
81
79
|
public chainMonitor!: ChainMonitor;
|
|
82
80
|
|
|
83
81
|
public getCoinbaseBalance!: () => Promise<bigint>;
|
|
@@ -85,7 +83,7 @@ export class FeesTest {
|
|
|
85
83
|
public getGasBalanceFn!: BalancesFn;
|
|
86
84
|
public getBananaPublicBalanceFn!: BalancesFn;
|
|
87
85
|
public getBananaPrivateBalanceFn!: BalancesFn;
|
|
88
|
-
public getProverFee!: (blockNumber:
|
|
86
|
+
public getProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
89
87
|
|
|
90
88
|
public readonly ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
91
89
|
public readonly SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
@@ -94,7 +92,7 @@ export class FeesTest {
|
|
|
94
92
|
constructor(
|
|
95
93
|
testName: string,
|
|
96
94
|
private numberOfAccounts = 3,
|
|
97
|
-
setupOptions: Partial<SetupOptions &
|
|
95
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
98
96
|
) {
|
|
99
97
|
if (!numberOfAccounts) {
|
|
100
98
|
throw new Error('There must be at least 1 initial account.');
|
|
@@ -102,30 +100,33 @@ export class FeesTest {
|
|
|
102
100
|
setupOptions.coinbase ??= EthAddress.random();
|
|
103
101
|
this.coinbase = setupOptions.coinbase!;
|
|
104
102
|
this.logger = createLogger(`e2e:e2e_fees:${testName}`);
|
|
105
|
-
this.snapshotManager = createSnapshotManager(
|
|
106
|
-
`e2e_fees/${testName}-${numberOfAccounts}`,
|
|
107
|
-
dataPath,
|
|
108
|
-
{ startProverNode: true, ...setupOptions },
|
|
109
|
-
{ ...setupOptions },
|
|
110
|
-
);
|
|
111
103
|
}
|
|
112
104
|
|
|
113
105
|
async setup() {
|
|
114
|
-
|
|
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
|
+
});
|
|
115
114
|
|
|
116
|
-
this.rollupContract = RollupContract.getFromConfig(context.
|
|
117
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider
|
|
115
|
+
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
116
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider!, this.logger, 200).start();
|
|
117
|
+
|
|
118
|
+
await this.applyBaseSetup();
|
|
118
119
|
|
|
119
120
|
return this;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
async teardown() {
|
|
123
124
|
await this.chainMonitor.stop();
|
|
124
|
-
await this.
|
|
125
|
+
await teardown(this.context);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
setIsMarkingAsProven(b: boolean) {
|
|
128
|
-
this.context.watcher
|
|
129
|
+
this.context.watcher!.setIsMarkingAsProven(b);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
async catchUpProvenChain() {
|
|
@@ -136,12 +137,10 @@ export class FeesTest {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
async getBlockRewards() {
|
|
139
|
-
const blockReward = await this.rollupContract.
|
|
140
|
+
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
140
141
|
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
141
142
|
|
|
142
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
143
|
-
EthAddress.fromString(rewardConfig.rewardDistributor),
|
|
144
|
-
);
|
|
143
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
145
144
|
|
|
146
145
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
147
146
|
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
@@ -173,206 +172,172 @@ export class FeesTest {
|
|
|
173
172
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
public async
|
|
177
|
-
await this.
|
|
178
|
-
await this.
|
|
179
|
-
await this.
|
|
180
|
-
await this.
|
|
175
|
+
public async applyBaseSetup() {
|
|
176
|
+
await this.applyInitialAccounts();
|
|
177
|
+
await this.applyPublicDeployAccounts();
|
|
178
|
+
await this.applySetupFeeJuice();
|
|
179
|
+
await this.applyDeployBananaToken();
|
|
181
180
|
}
|
|
182
181
|
|
|
183
|
-
async
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
182
|
+
async applyInitialAccounts() {
|
|
183
|
+
this.logger.info('Applying initial accounts setup');
|
|
184
|
+
|
|
185
|
+
const { deployedAccounts } = await deployAccounts(
|
|
186
|
+
this.numberOfAccounts,
|
|
187
|
+
this.logger,
|
|
188
|
+
)({
|
|
189
|
+
wallet: this.context.wallet,
|
|
190
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
this.wallet = this.context.wallet;
|
|
194
|
+
this.aztecNode = this.context.aztecNodeService!;
|
|
195
|
+
this.aztecNodeAdmin = this.context.aztecNodeService!;
|
|
196
|
+
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
197
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
198
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
199
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
200
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
201
|
+
|
|
202
|
+
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
203
|
+
this.fpcAdmin = this.aliceAddress;
|
|
204
|
+
|
|
205
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
206
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
async
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
);
|
|
209
|
+
async applyPublicDeployAccounts() {
|
|
210
|
+
this.logger.info('Applying public deploy accounts setup');
|
|
211
|
+
await publicDeployAccounts(this.wallet, this.accounts);
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
async
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
'⛽',
|
|
222
|
-
this.feeJuiceContract.methods.balance_of_public,
|
|
223
|
-
this.aliceAddress,
|
|
224
|
-
this.logger,
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
228
|
-
aztecNode: context.aztecNode,
|
|
229
|
-
aztecNodeAdmin: context.aztecNode,
|
|
230
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
231
|
-
wallet: this.wallet,
|
|
232
|
-
logger: this.logger,
|
|
233
|
-
});
|
|
234
|
-
},
|
|
214
|
+
async applySetupFeeJuice() {
|
|
215
|
+
this.logger.info('Applying fee juice setup');
|
|
216
|
+
|
|
217
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
218
|
+
|
|
219
|
+
this.getGasBalanceFn = getBalancesFn(
|
|
220
|
+
'⛽',
|
|
221
|
+
this.feeJuiceContract.methods.balance_of_public,
|
|
222
|
+
this.aliceAddress,
|
|
223
|
+
this.logger,
|
|
235
224
|
);
|
|
225
|
+
|
|
226
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
227
|
+
aztecNode: this.context.aztecNodeService!,
|
|
228
|
+
aztecNodeAdmin: this.context.aztecNodeService!,
|
|
229
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
230
|
+
wallet: this.wallet,
|
|
231
|
+
logger: this.logger,
|
|
232
|
+
});
|
|
236
233
|
}
|
|
237
234
|
|
|
238
|
-
async
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
'🍌.private',
|
|
259
|
-
this.bananaCoin.methods.balance_of_private,
|
|
260
|
-
this.aliceAddress,
|
|
261
|
-
logger,
|
|
262
|
-
);
|
|
263
|
-
},
|
|
235
|
+
async applyDeployBananaToken() {
|
|
236
|
+
this.logger.info('Applying deploy banana token setup');
|
|
237
|
+
|
|
238
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
239
|
+
.send({ from: this.aliceAddress })
|
|
240
|
+
.deployed();
|
|
241
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
242
|
+
|
|
243
|
+
this.bananaCoin = bananaCoin;
|
|
244
|
+
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
245
|
+
'🍌.public',
|
|
246
|
+
this.bananaCoin.methods.balance_of_public,
|
|
247
|
+
this.aliceAddress,
|
|
248
|
+
this.logger,
|
|
249
|
+
);
|
|
250
|
+
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
251
|
+
'🍌.private',
|
|
252
|
+
this.bananaCoin.methods.balance_of_private,
|
|
253
|
+
this.aliceAddress,
|
|
254
|
+
this.logger,
|
|
264
255
|
);
|
|
265
256
|
}
|
|
266
257
|
|
|
267
|
-
public async
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
await this.rollupContract.getManaTarget(),
|
|
324
|
-
) + (await this.rollupContract.getProvingCostPerMana());
|
|
325
|
-
|
|
326
|
-
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
327
|
-
|
|
328
|
-
const mana = block!.header.totalManaUsed.toBigInt();
|
|
329
|
-
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
330
|
-
};
|
|
331
|
-
},
|
|
332
|
-
);
|
|
258
|
+
public async applyFPCSetup() {
|
|
259
|
+
this.logger.info('Applying FPC setup');
|
|
260
|
+
|
|
261
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
262
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
263
|
+
|
|
264
|
+
const bananaCoin = this.bananaCoin;
|
|
265
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
266
|
+
.send({ from: this.aliceAddress })
|
|
267
|
+
.deployed();
|
|
268
|
+
|
|
269
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
270
|
+
|
|
271
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
|
|
272
|
+
|
|
273
|
+
this.bananaFPC = bananaFPC;
|
|
274
|
+
|
|
275
|
+
const l1FeeJuiceAddress = this.feeJuiceBridgeTestHarness.l1FeeJuiceAddress;
|
|
276
|
+
|
|
277
|
+
this.getCoinbaseBalance = async () => {
|
|
278
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
279
|
+
const gasL1 = getContract({
|
|
280
|
+
address: l1FeeJuiceAddress.toString(),
|
|
281
|
+
abi: TestERC20Abi,
|
|
282
|
+
client: l1Client,
|
|
283
|
+
});
|
|
284
|
+
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
this.getCoinbaseSequencerRewards = async () => {
|
|
288
|
+
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
this.getProverFee = async (blockNumber: BlockNumber) => {
|
|
292
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
293
|
+
|
|
294
|
+
// @todo @lherskind As we deal with #13601
|
|
295
|
+
// Right now the value is from `FeeLib.sol`
|
|
296
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
|
|
297
|
+
|
|
298
|
+
// We round up
|
|
299
|
+
const mulDiv = (a: bigint, b: bigint, c: bigint) => (a * b) / c + ((a * b) % c > 0n ? 1n : 0n);
|
|
300
|
+
|
|
301
|
+
const { baseFee } = await this.rollupContract.getL1FeesAt(block!.header.globalVariables.timestamp);
|
|
302
|
+
const proverCost =
|
|
303
|
+
mulDiv(
|
|
304
|
+
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())),
|
|
305
|
+
1n,
|
|
306
|
+
await this.rollupContract.getManaTarget(),
|
|
307
|
+
) + (await this.rollupContract.getProvingCostPerMana());
|
|
308
|
+
|
|
309
|
+
const price = await this.rollupContract.getFeeAssetPerEth();
|
|
310
|
+
|
|
311
|
+
const mana = block!.header.totalManaUsed.toBigInt();
|
|
312
|
+
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
313
|
+
};
|
|
333
314
|
}
|
|
334
315
|
|
|
335
|
-
public async
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return {
|
|
346
|
-
sponsoredFPCAddress: sponsoredFPC.address,
|
|
347
|
-
};
|
|
348
|
-
},
|
|
349
|
-
async data => {
|
|
350
|
-
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
351
|
-
},
|
|
352
|
-
);
|
|
316
|
+
public async applySponsoredFPCSetup() {
|
|
317
|
+
this.logger.info('Applying sponsored FPC setup');
|
|
318
|
+
|
|
319
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
320
|
+
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
321
|
+
|
|
322
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.wallet);
|
|
323
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
324
|
+
|
|
325
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.wallet);
|
|
353
326
|
}
|
|
354
327
|
|
|
355
328
|
public async applyFundAliceWithBananas() {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
.wait();
|
|
364
|
-
},
|
|
365
|
-
() => Promise.resolve(),
|
|
366
|
-
);
|
|
329
|
+
this.logger.info('Applying fund Alice with bananas setup');
|
|
330
|
+
|
|
331
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
332
|
+
await this.bananaCoin.methods
|
|
333
|
+
.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS)
|
|
334
|
+
.send({ from: this.aliceAddress })
|
|
335
|
+
.wait();
|
|
367
336
|
}
|
|
368
337
|
|
|
369
338
|
public async applyFundAliceWithPrivateBananas() {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
374
|
-
},
|
|
375
|
-
() => Promise.resolve(),
|
|
376
|
-
);
|
|
339
|
+
this.logger.info('Applying fund Alice with private bananas setup');
|
|
340
|
+
|
|
341
|
+
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
377
342
|
}
|
|
378
343
|
}
|
|
@@ -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
|
-
import { BatchedBlob, Blob, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
3
|
+
import { BatchedBlob, Blob, getEthBlobEvaluationInputs, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
5
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { L2BlockNew } from '@aztec/stdlib/block';
|
|
6
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
6
7
|
|
|
7
8
|
import { writeFile } from 'fs/promises';
|
|
8
9
|
|
|
@@ -14,7 +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,
|
|
17
|
-
block:
|
|
18
|
+
block: L2BlockNew,
|
|
18
19
|
l1ToL2Content: Fr[],
|
|
19
20
|
blobs: Blob[],
|
|
20
21
|
batchedBlob: BatchedBlob,
|
|
@@ -32,6 +33,12 @@ export async function writeJson(
|
|
|
32
33
|
return `0x${buffer.toString('hex').padStart(size, '0')}`;
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
// Create a checkpoint header for this block
|
|
37
|
+
const checkpointHeader = CheckpointHeader.random({
|
|
38
|
+
slotNumber: block.slot,
|
|
39
|
+
timestamp: block.timestamp,
|
|
40
|
+
});
|
|
41
|
+
|
|
35
42
|
const jsonObject = {
|
|
36
43
|
populate: {
|
|
37
44
|
l1ToL2Content: l1ToL2Content.map(value => asHex(value)),
|
|
@@ -41,32 +48,31 @@ export async function writeJson(
|
|
|
41
48
|
messages: {
|
|
42
49
|
l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(value => asHex(value)),
|
|
43
50
|
},
|
|
44
|
-
|
|
51
|
+
checkpoint: {
|
|
45
52
|
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
46
53
|
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
47
54
|
archive: asHex(block.archive.root),
|
|
48
55
|
blobCommitments: getPrefixedEthBlobCommitments(blobs),
|
|
49
|
-
batchedBlobInputs:
|
|
50
|
-
|
|
56
|
+
batchedBlobInputs: getEthBlobEvaluationInputs(batchedBlob),
|
|
57
|
+
checkpointNumber: block.number,
|
|
51
58
|
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
52
59
|
header: {
|
|
53
|
-
lastArchiveRoot: asHex(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
feeRecipient: asHex(block.header.globalVariables.feeRecipient),
|
|
60
|
+
lastArchiveRoot: asHex(checkpointHeader.lastArchiveRoot),
|
|
61
|
+
blockHeadersHash: asHex(checkpointHeader.blockHeadersHash),
|
|
62
|
+
blobsHash: asHex(checkpointHeader.blobsHash),
|
|
63
|
+
inHash: asHex(checkpointHeader.inHash),
|
|
64
|
+
outHash: asHex(checkpointHeader.epochOutHash),
|
|
65
|
+
slotNumber: Number(checkpointHeader.slotNumber),
|
|
66
|
+
timestamp: Number(checkpointHeader.timestamp),
|
|
67
|
+
coinbase: asHex(checkpointHeader.coinbase, 40),
|
|
68
|
+
feeRecipient: asHex(checkpointHeader.feeRecipient),
|
|
63
69
|
gasFees: {
|
|
64
|
-
feePerDaGas: Number(
|
|
65
|
-
feePerL2Gas: Number(
|
|
70
|
+
feePerDaGas: Number(checkpointHeader.gasFees.feePerDaGas),
|
|
71
|
+
feePerL2Gas: Number(checkpointHeader.gasFees.feePerL2Gas),
|
|
66
72
|
},
|
|
67
|
-
totalManaUsed:
|
|
73
|
+
totalManaUsed: checkpointHeader.totalManaUsed.toNumber(),
|
|
68
74
|
},
|
|
69
|
-
headerHash: asHex(
|
|
75
|
+
headerHash: asHex(checkpointHeader.hash()),
|
|
70
76
|
numTxs: block.body.txEffects.length,
|
|
71
77
|
},
|
|
72
78
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { getAddressFromPrivateKey } from '@aztec/ethereum';
|
|
2
|
+
import { getAddressFromPrivateKey } from '@aztec/ethereum/account';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { EthPrivateKey } from '@aztec/node-keystore';
|
|
5
5
|
|