@aztec/end-to-end 0.0.1-commit.3469e52 → 0.0.1-commit.35158ae7e
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/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +49 -26
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/utils.d.ts +5 -4
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +13 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- 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 +27 -18
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- 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 +3 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +17 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +90 -40
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +24 -17
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -7
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +5 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +29 -8
- 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 +26 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +46 -18
- 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 +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +20 -10
- 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 +7 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +44 -50
- 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 +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +48 -25
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +97 -172
- package/dest/fixtures/setup_p2p_test.d.ts +16 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +40 -29
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +12 -8
- package/dest/shared/cross_chain_test_harness.d.ts +3 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +24 -24
- package/dest/shared/gas_portal_test_harness.js +3 -3
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +27 -28
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +162 -41
- package/dest/spartan/tx_metrics.d.ts +38 -2
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +179 -5
- 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 -260
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -942
- package/dest/test-wallet/test_wallet.d.ts +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +213 -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 +45 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +50 -58
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +15 -8
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +33 -23
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +139 -91
- package/src/e2e_fees/bridging_race.notest.ts +2 -5
- package/src/e2e_fees/fees_test.ts +28 -40
- package/src/e2e_l1_publisher/write_json.ts +3 -8
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -7
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
- package/src/e2e_p2p/p2p_network.ts +50 -18
- package/src/e2e_p2p/reqresp/utils.ts +256 -0
- package/src/e2e_p2p/shared.ts +76 -23
- 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 +27 -12
- 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 +48 -63
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +131 -235
- package/src/fixtures/setup_p2p_test.ts +40 -44
- package/src/fixtures/token_utils.ts +10 -6
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/cross_chain_test_harness.ts +24 -34
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +49 -51
- package/src/simulators/lending_simulator.ts +10 -6
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +205 -26
- package/src/spartan/tx_metrics.ts +153 -8
- 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 -1246
- package/src/test-wallet/test_wallet.ts +301 -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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Archiver } from '@aztec/archiver';
|
|
1
2
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
3
|
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
3
4
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
@@ -9,28 +10,25 @@ import { EpochCache } from '@aztec/epoch-cache';
|
|
|
9
10
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
11
|
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
11
12
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
12
|
-
import {
|
|
13
|
+
import { Delayer, createDelayer, waitUntilL1Timestamp, wrapClientWithDelayer } from '@aztec/ethereum/l1-tx-utils';
|
|
14
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
13
15
|
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
14
16
|
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
15
17
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
18
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
17
|
-
import {
|
|
19
|
+
import { withLoggerBindings } from '@aztec/foundation/log/server';
|
|
18
20
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
19
21
|
import { sleep } from '@aztec/foundation/sleep';
|
|
20
22
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
23
|
+
import { TestContract } from '@aztec/noir-test-contracts.js/Test';
|
|
21
24
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
22
|
-
import {
|
|
23
|
-
import type {
|
|
24
|
-
import {
|
|
25
|
-
type SequencerClient,
|
|
26
|
-
type SequencerEvents,
|
|
27
|
-
type SequencerPublisher,
|
|
28
|
-
SequencerState,
|
|
29
|
-
} from '@aztec/sequencer-client';
|
|
30
|
-
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
25
|
+
import type { ProverNodeConfig } from '@aztec/prover-node';
|
|
26
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
27
|
+
import { type SequencerClient, type SequencerEvents, SequencerState } from '@aztec/sequencer-client';
|
|
31
28
|
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
32
29
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
33
30
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
31
|
+
import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
|
|
34
32
|
|
|
35
33
|
import { join } from 'path';
|
|
36
34
|
import type { Hex } from 'viem';
|
|
@@ -44,12 +42,16 @@ import {
|
|
|
44
42
|
setup,
|
|
45
43
|
} from '../fixtures/utils.js';
|
|
46
44
|
|
|
47
|
-
export const
|
|
45
|
+
export const WORLD_STATE_CHECKPOINT_HISTORY = 2;
|
|
48
46
|
export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
49
47
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
50
48
|
export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
|
|
51
49
|
|
|
52
|
-
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
50
|
+
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
51
|
+
numberOfAccounts?: number;
|
|
52
|
+
pxeOpts?: Partial<PXEConfig>;
|
|
53
|
+
aztecSlotDurationInL1Slots?: number;
|
|
54
|
+
};
|
|
53
55
|
|
|
54
56
|
export type TrackedSequencerEvent = {
|
|
55
57
|
[K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
|
|
@@ -75,7 +77,7 @@ export class EpochsTestContext {
|
|
|
75
77
|
public proverDelayer!: Delayer;
|
|
76
78
|
public sequencerDelayer!: Delayer;
|
|
77
79
|
|
|
78
|
-
public proverNodes:
|
|
80
|
+
public proverNodes: AztecNodeService[] = [];
|
|
79
81
|
public nodes: AztecNodeService[] = [];
|
|
80
82
|
|
|
81
83
|
public epochDuration!: number;
|
|
@@ -94,7 +96,7 @@ export class EpochsTestContext {
|
|
|
94
96
|
? parseInt(process.env.L1_BLOCK_TIME)
|
|
95
97
|
: DEFAULT_L1_BLOCK_TIME;
|
|
96
98
|
const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
|
|
97
|
-
const aztecSlotDuration = opts.aztecSlotDuration ??
|
|
99
|
+
const aztecSlotDuration = opts.aztecSlotDuration ?? (opts.aztecSlotDurationInL1Slots ?? 2) * ethereumSlotDuration;
|
|
98
100
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
99
101
|
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
100
102
|
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
@@ -121,30 +123,36 @@ export class EpochsTestContext {
|
|
|
121
123
|
|
|
122
124
|
// Set up system without any account nor protocol contracts
|
|
123
125
|
// and with faster block times and shorter epochs.
|
|
124
|
-
const context = await setup(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
126
|
+
const context = await setup(
|
|
127
|
+
opts.numberOfAccounts ?? 0,
|
|
128
|
+
{
|
|
129
|
+
automineL1Setup: true,
|
|
130
|
+
checkIntervalMs: 50,
|
|
131
|
+
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
132
|
+
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
133
|
+
aztecEpochDuration,
|
|
134
|
+
aztecSlotDuration,
|
|
135
|
+
ethereumSlotDuration,
|
|
136
|
+
aztecProofSubmissionEpochs,
|
|
137
|
+
aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
|
|
138
|
+
minTxsPerBlock: 0,
|
|
139
|
+
realProofs: false,
|
|
140
|
+
startProverNode: true,
|
|
141
|
+
proverTestDelayMs: opts.proverTestDelayMs ?? 0,
|
|
142
|
+
// We use numeric incremental prover ids for simplicity, but we can switch to
|
|
143
|
+
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
144
|
+
// Use numeric EthAddress for deterministic prover id
|
|
145
|
+
proverId: EthAddress.fromNumber(1),
|
|
146
|
+
worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
|
|
147
|
+
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
148
|
+
slasherFlavor: 'none',
|
|
149
|
+
l1PublishingTime,
|
|
150
|
+
...opts,
|
|
151
|
+
},
|
|
152
|
+
// Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
153
|
+
// Can be overridden via opts.pxeOpts.
|
|
154
|
+
{ syncChainTip: 'checkpointed', ...opts.pxeOpts },
|
|
155
|
+
);
|
|
148
156
|
|
|
149
157
|
this.context = context;
|
|
150
158
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
@@ -157,17 +165,8 @@ export class EpochsTestContext {
|
|
|
157
165
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
158
166
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
159
167
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.proverDelayer = context.proverNode
|
|
163
|
-
? (((context.proverNode as TestProverNode).publisher as ProverNodePublisher).l1TxUtils as DelayedTxUtils).delayer!
|
|
164
|
-
: undefined!;
|
|
165
|
-
this.sequencerDelayer = context.sequencer
|
|
166
|
-
? (
|
|
167
|
-
((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher)
|
|
168
|
-
.l1TxUtils as DelayedTxUtils
|
|
169
|
-
).delayer!
|
|
170
|
-
: undefined!;
|
|
168
|
+
this.proverDelayer = context.proverDelayer!;
|
|
169
|
+
this.sequencerDelayer = context.sequencerDelayer!;
|
|
171
170
|
|
|
172
171
|
if ((context.proverNode && !this.proverDelayer) || (context.sequencer && !this.sequencerDelayer)) {
|
|
173
172
|
throw new Error(`Could not find prover or sequencer delayer`);
|
|
@@ -182,6 +181,8 @@ export class EpochsTestContext {
|
|
|
182
181
|
l1GenesisTime: await this.rollup.getL1GenesisTime(),
|
|
183
182
|
ethereumSlotDuration,
|
|
184
183
|
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
|
|
184
|
+
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
|
|
185
|
+
rollupManaLimit: Number(await this.rollup.getManaLimit()),
|
|
185
186
|
};
|
|
186
187
|
|
|
187
188
|
this.logger.info(
|
|
@@ -199,20 +200,32 @@ export class EpochsTestContext {
|
|
|
199
200
|
public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
|
|
200
201
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
201
202
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
202
|
-
const
|
|
203
|
-
const
|
|
203
|
+
const proverIndex = this.proverNodes.length + 1;
|
|
204
|
+
const { mockGossipSubNetwork } = this.context;
|
|
205
|
+
const { proverNode } = await withLoggerBindings({ actor: `prover-${proverIndex}` }, () =>
|
|
204
206
|
createAndSyncProverNode(
|
|
205
207
|
proverNodePrivateKey,
|
|
206
|
-
{ ...this.context.config },
|
|
207
208
|
{
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
...this.context.config,
|
|
210
|
+
p2pEnabled: this.context.config.p2pEnabled || mockGossipSubNetwork !== undefined,
|
|
211
|
+
proverId: EthAddress.fromNumber(proverIndex),
|
|
210
212
|
dontStart: opts.dontStart,
|
|
211
213
|
...opts,
|
|
212
214
|
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
{
|
|
216
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
dateProvider: this.context.dateProvider,
|
|
220
|
+
p2pClientDeps: {
|
|
221
|
+
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
222
|
+
rpcTxProviders: [this.context.aztecNode],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
prefilledPublicData: this.context.prefilledPublicData ?? [],
|
|
227
|
+
dontStart: opts.dontStart,
|
|
228
|
+
},
|
|
216
229
|
),
|
|
217
230
|
);
|
|
218
231
|
this.proverNodes.push(proverNode);
|
|
@@ -226,26 +239,34 @@ export class EpochsTestContext {
|
|
|
226
239
|
|
|
227
240
|
public createValidatorNode(
|
|
228
241
|
privateKeys: `0x${string}`[],
|
|
229
|
-
opts: Partial<AztecNodeConfig> & {
|
|
242
|
+
opts: Partial<AztecNodeConfig> & {
|
|
243
|
+
dontStartSequencer?: boolean;
|
|
244
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
245
|
+
} = {},
|
|
230
246
|
) {
|
|
231
247
|
this.logger.warn('Creating and syncing a validator node...');
|
|
232
248
|
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
|
|
233
249
|
}
|
|
234
250
|
|
|
235
251
|
private async createNode(
|
|
236
|
-
opts: Partial<AztecNodeConfig> & {
|
|
252
|
+
opts: Partial<AztecNodeConfig> & {
|
|
253
|
+
dontStartSequencer?: boolean;
|
|
254
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
255
|
+
} = {},
|
|
237
256
|
) {
|
|
238
|
-
const
|
|
257
|
+
const nodeIndex = this.nodes.length + 1;
|
|
258
|
+
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
239
259
|
const { mockGossipSubNetwork } = this.context;
|
|
240
260
|
const resolvedConfig = { ...this.context.config, ...opts };
|
|
241
261
|
const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
|
|
242
262
|
const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
|
|
243
|
-
const node = await
|
|
263
|
+
const node = await withLoggerBindings({ actor: `${actorPrefix}-${nodeIndex}` }, () =>
|
|
244
264
|
AztecNodeService.createAndSync(
|
|
245
265
|
{
|
|
246
266
|
...resolvedConfig,
|
|
247
267
|
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
248
268
|
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
269
|
+
nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
|
|
249
270
|
p2pEnabled,
|
|
250
271
|
p2pIp,
|
|
251
272
|
},
|
|
@@ -254,6 +275,7 @@ export class EpochsTestContext {
|
|
|
254
275
|
p2pClientDeps: {
|
|
255
276
|
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
256
277
|
},
|
|
278
|
+
slashingProtectionDb: opts.slashingProtectionDb,
|
|
257
279
|
},
|
|
258
280
|
{
|
|
259
281
|
prefilledPublicData: this.context.prefilledPublicData,
|
|
@@ -262,26 +284,6 @@ export class EpochsTestContext {
|
|
|
262
284
|
),
|
|
263
285
|
);
|
|
264
286
|
|
|
265
|
-
// REFACTOR: We're getting too much into the internals of the sequencer here.
|
|
266
|
-
// We should have a single method for constructing an aztec node that returns a TestAztecNodeService
|
|
267
|
-
// which directly exposes the delayer and sets any test config.
|
|
268
|
-
if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
|
|
269
|
-
this.logger.info(
|
|
270
|
-
`Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`,
|
|
271
|
-
);
|
|
272
|
-
// Here we reach into the sequencer and hook in a tx delayer. The problem is that the sequencer's l1 utils only uses a public client, not a wallet.
|
|
273
|
-
// The delayer needs a wallet (a client that can sign), so we have to create one here.
|
|
274
|
-
const l1Client = createExtendedL1Client(
|
|
275
|
-
resolvedConfig.l1RpcUrls!,
|
|
276
|
-
resolvedConfig.publisherPrivateKeys![0]!.getValue(),
|
|
277
|
-
);
|
|
278
|
-
const sequencer = node.getSequencer() as TestSequencerClient;
|
|
279
|
-
const publisher = sequencer.sequencer.publisher;
|
|
280
|
-
const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
|
|
281
|
-
delayed.delayer!.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
|
|
282
|
-
publisher.l1TxUtils = delayed;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
287
|
this.nodes.push(node);
|
|
286
288
|
return node;
|
|
287
289
|
}
|
|
@@ -333,7 +335,10 @@ export class EpochsTestContext {
|
|
|
333
335
|
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
334
336
|
oneSlotBefore,
|
|
335
337
|
});
|
|
336
|
-
|
|
338
|
+
// Use a timeout that accounts for the full proof submission window
|
|
339
|
+
const proofSubmissionWindowDuration =
|
|
340
|
+
this.constants.proofSubmissionEpochs * this.epochDuration * this.L2_SLOT_DURATION_IN_S;
|
|
341
|
+
await waitUntilL1Timestamp(this.l1Client, oneSlotBefore, undefined, proofSubmissionWindowDuration * 2);
|
|
337
342
|
}
|
|
338
343
|
|
|
339
344
|
/** Waits for the aztec node to sync to the target block number. */
|
|
@@ -370,17 +375,28 @@ export class EpochsTestContext {
|
|
|
370
375
|
return SpamContract.at(instance.address, wallet);
|
|
371
376
|
}
|
|
372
377
|
|
|
378
|
+
/** Registers the TestContract on the given wallet. */
|
|
379
|
+
public async registerTestContract(wallet: Wallet, salt = Fr.ZERO) {
|
|
380
|
+
const instance = await getContractInstanceFromInstantiationParams(TestContract.artifact, {
|
|
381
|
+
constructorArgs: [],
|
|
382
|
+
constructorArtifact: undefined,
|
|
383
|
+
salt,
|
|
384
|
+
publicKeys: undefined,
|
|
385
|
+
deployer: undefined,
|
|
386
|
+
});
|
|
387
|
+
await wallet.registerContract(instance, TestContract.artifact);
|
|
388
|
+
return TestContract.at(instance.address, wallet);
|
|
389
|
+
}
|
|
390
|
+
|
|
373
391
|
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */
|
|
374
392
|
public async createL1Client() {
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.l1Client.chain,
|
|
380
|
-
),
|
|
381
|
-
this.context.dateProvider!,
|
|
382
|
-
{ ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
|
|
393
|
+
const rawClient = createExtendedL1Client(
|
|
394
|
+
[...this.l1Client.chain.rpcUrls.default.http],
|
|
395
|
+
privateKeyToAccount(this.getNextPrivateKey()),
|
|
396
|
+
this.l1Client.chain,
|
|
383
397
|
);
|
|
398
|
+
const delayer = createDelayer(this.context.dateProvider, { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S }, {});
|
|
399
|
+
const client = wrapClientWithDelayer(rawClient, delayer);
|
|
384
400
|
expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
|
|
385
401
|
return { client, delayer };
|
|
386
402
|
}
|
|
@@ -397,6 +413,38 @@ export class EpochsTestContext {
|
|
|
397
413
|
expect(result).toBe(expectedSuccess);
|
|
398
414
|
}
|
|
399
415
|
|
|
416
|
+
/** Verifies at least one checkpoint has the target number of blocks (for MBPS validation). */
|
|
417
|
+
public async assertMultipleBlocksPerSlot(targetBlockCount: number) {
|
|
418
|
+
const archiver = (this.context.aztecNode as AztecNodeService).getBlockSource() as Archiver;
|
|
419
|
+
const checkpoints = await archiver.getCheckpoints(CheckpointNumber(1), 50);
|
|
420
|
+
|
|
421
|
+
this.logger.warn(`Retrieved ${checkpoints.length} checkpoints from archiver`, {
|
|
422
|
+
checkpoints: checkpoints.map(pc => pc.checkpoint.getStats()),
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
|
|
426
|
+
let targetFound = false;
|
|
427
|
+
|
|
428
|
+
for (const checkpoint of checkpoints) {
|
|
429
|
+
const blockCount = checkpoint.checkpoint.blocks.length;
|
|
430
|
+
targetFound = targetFound || blockCount >= targetBlockCount;
|
|
431
|
+
|
|
432
|
+
this.logger.verbose(`Checkpoint ${checkpoint.checkpoint.number} has ${blockCount} blocks`, {
|
|
433
|
+
checkpoint: checkpoint.checkpoint.getStats(),
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
for (let i = 0; i < blockCount; i++) {
|
|
437
|
+
const block = checkpoint.checkpoint.blocks[i];
|
|
438
|
+
expect(block.indexWithinCheckpoint).toBe(i);
|
|
439
|
+
expect(block.checkpointNumber).toBe(checkpoint.checkpoint.number);
|
|
440
|
+
expect(block.number).toBe(expectedBlockNumber);
|
|
441
|
+
expectedBlockNumber++;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
expect(targetFound).toBe(true);
|
|
446
|
+
}
|
|
447
|
+
|
|
400
448
|
public watchSequencerEvents(
|
|
401
449
|
sequencers: SequencerClient[],
|
|
402
450
|
getMetadata: (i: number) => Record<string, any> = () => ({}),
|
|
@@ -4,11 +4,11 @@ import type { Logger } from '@aztec/aztec.js/log';
|
|
|
4
4
|
import { Fq } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
8
7
|
|
|
9
8
|
import { jest } from '@jest/globals';
|
|
10
9
|
import type { Hex } from 'viem';
|
|
11
10
|
|
|
11
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
12
12
|
import { FeesTest } from './fees_test.js';
|
|
13
13
|
|
|
14
14
|
jest.setTimeout(300_000);
|
|
@@ -67,10 +67,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
67
67
|
// Yes, we need to REFACTOR it at some point
|
|
68
68
|
const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(bobsAddress);
|
|
69
69
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
70
|
-
await t.feeJuiceContract.methods
|
|
71
|
-
.claim(bobsAddress, claim.claimAmount, secret, index)
|
|
72
|
-
.send({ from: bobsAddress })
|
|
73
|
-
.wait();
|
|
70
|
+
await t.feeJuiceContract.methods.claim(bobsAddress, claim.claimAmount, secret, index).send({ from: bobsAddress });
|
|
74
71
|
const [balance] = await t.getGasBalanceFn(bobsAddress);
|
|
75
72
|
expect(balance).toEqual(claim.claimAmount);
|
|
76
73
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
|
+
import { CheatCodes, getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
5
5
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
7
|
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
@@ -20,7 +20,6 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
20
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
21
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
22
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
24
23
|
|
|
25
24
|
import { getContract } from 'viem';
|
|
26
25
|
|
|
@@ -36,6 +35,7 @@ import {
|
|
|
36
35
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
37
36
|
import { type BalancesFn, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
38
37
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
38
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Test fixture for testing fees. Provides the following setup steps:
|
|
@@ -104,16 +104,19 @@ export class FeesTest {
|
|
|
104
104
|
|
|
105
105
|
async setup() {
|
|
106
106
|
this.logger.verbose('Setting up fresh context...');
|
|
107
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
108
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
107
109
|
this.context = await setup(0, {
|
|
108
110
|
startProverNode: true,
|
|
109
111
|
...this.setupOptions,
|
|
110
112
|
fundSponsoredFPC: true,
|
|
111
113
|
skipAccountDeployment: true,
|
|
112
114
|
l1ContractsArgs: { ...this.setupOptions },
|
|
115
|
+
txPublicSetupAllowListExtend: [...(this.setupOptions.txPublicSetupAllowListExtend ?? []), ...tokenAllowList],
|
|
113
116
|
});
|
|
114
117
|
|
|
115
118
|
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
116
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider
|
|
119
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
117
120
|
|
|
118
121
|
await this.applyBaseSetup();
|
|
119
122
|
|
|
@@ -126,7 +129,7 @@ export class FeesTest {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
setIsMarkingAsProven(b: boolean) {
|
|
129
|
-
this.context.watcher
|
|
132
|
+
this.context.watcher.setIsMarkingAsProven(b);
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
async catchUpProvenChain() {
|
|
@@ -152,23 +155,20 @@ export class FeesTest {
|
|
|
152
155
|
async mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress) {
|
|
153
156
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
|
|
154
157
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
155
|
-
await this.feeJuiceContract.methods
|
|
156
|
-
.claim(recipient, claim.claimAmount, secret, index)
|
|
157
|
-
.send({ from: minter })
|
|
158
|
-
.wait();
|
|
158
|
+
await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({ from: minter });
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/** Alice mints bananaCoin tokens privately to the target address and redeems them. */
|
|
162
162
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
163
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
163
|
+
const { result: balanceBefore } = await this.bananaCoin.methods
|
|
164
164
|
.balance_of_private(address)
|
|
165
|
-
.simulate({ from:
|
|
165
|
+
.simulate({ from: address });
|
|
166
166
|
|
|
167
167
|
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
168
168
|
|
|
169
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
169
|
+
const { result: balanceAfter } = await this.bananaCoin.methods
|
|
170
170
|
.balance_of_private(address)
|
|
171
|
-
.simulate({ from:
|
|
171
|
+
.simulate({ from: address });
|
|
172
172
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -191,8 +191,8 @@ export class FeesTest {
|
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
this.wallet = this.context.wallet;
|
|
194
|
-
this.aztecNode = this.context.aztecNodeService
|
|
195
|
-
this.aztecNodeAdmin = this.context.aztecNodeService
|
|
194
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
195
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
196
196
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
197
197
|
this.cheatCodes = this.context.cheatCodes;
|
|
198
198
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
@@ -216,16 +216,11 @@ export class FeesTest {
|
|
|
216
216
|
|
|
217
217
|
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
218
218
|
|
|
219
|
-
this.getGasBalanceFn = getBalancesFn(
|
|
220
|
-
'⛽',
|
|
221
|
-
this.feeJuiceContract.methods.balance_of_public,
|
|
222
|
-
this.aliceAddress,
|
|
223
|
-
this.logger,
|
|
224
|
-
);
|
|
219
|
+
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
225
220
|
|
|
226
221
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
227
|
-
aztecNode: this.context.aztecNodeService
|
|
228
|
-
aztecNodeAdmin: this.context.aztecNodeService
|
|
222
|
+
aztecNode: this.context.aztecNodeService,
|
|
223
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
229
224
|
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
230
225
|
wallet: this.wallet,
|
|
231
226
|
logger: this.logger,
|
|
@@ -235,22 +230,16 @@ export class FeesTest {
|
|
|
235
230
|
async applyDeployBananaToken() {
|
|
236
231
|
this.logger.info('Applying deploy banana token setup');
|
|
237
232
|
|
|
238
|
-
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
const { contract: bananaCoin } = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n).send({
|
|
234
|
+
from: this.aliceAddress,
|
|
235
|
+
});
|
|
241
236
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
242
237
|
|
|
243
238
|
this.bananaCoin = bananaCoin;
|
|
244
|
-
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
245
|
-
'🍌.public',
|
|
246
|
-
this.bananaCoin.methods.balance_of_public,
|
|
247
|
-
this.aliceAddress,
|
|
248
|
-
this.logger,
|
|
249
|
-
);
|
|
239
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.logger);
|
|
250
240
|
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
251
241
|
'🍌.private',
|
|
252
242
|
this.bananaCoin.methods.balance_of_private,
|
|
253
|
-
this.aliceAddress,
|
|
254
243
|
this.logger,
|
|
255
244
|
);
|
|
256
245
|
}
|
|
@@ -262,9 +251,9 @@ export class FeesTest {
|
|
|
262
251
|
expect((await this.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
263
252
|
|
|
264
253
|
const bananaCoin = this.bananaCoin;
|
|
265
|
-
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
266
|
-
|
|
267
|
-
|
|
254
|
+
const { contract: bananaFPC } = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin).send({
|
|
255
|
+
from: this.aliceAddress,
|
|
256
|
+
});
|
|
268
257
|
|
|
269
258
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
270
259
|
|
|
@@ -293,7 +282,7 @@ export class FeesTest {
|
|
|
293
282
|
|
|
294
283
|
// @todo @lherskind As we deal with #13601
|
|
295
284
|
// Right now the value is from `FeeLib.sol`
|
|
296
|
-
const L1_GAS_PER_EPOCH_VERIFIED =
|
|
285
|
+
const L1_GAS_PER_EPOCH_VERIFIED = 3600000n;
|
|
297
286
|
|
|
298
287
|
// We round up
|
|
299
288
|
const mulDiv = (a: bigint, b: bigint, c: bigint) => (a * b) / c + ((a * b) % c > 0n ? 1n : 0n);
|
|
@@ -306,10 +295,10 @@ export class FeesTest {
|
|
|
306
295
|
await this.rollupContract.getManaTarget(),
|
|
307
296
|
) + (await this.rollupContract.getProvingCostPerMana());
|
|
308
297
|
|
|
309
|
-
const price = await this.rollupContract.
|
|
298
|
+
const price = await this.rollupContract.getEthPerFeeAsset();
|
|
310
299
|
|
|
311
300
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
312
|
-
return mulDiv(mana * proverCost,
|
|
301
|
+
return mulDiv(mana * proverCost, 10n ** 12n, price);
|
|
313
302
|
};
|
|
314
303
|
}
|
|
315
304
|
|
|
@@ -331,8 +320,7 @@ export class FeesTest {
|
|
|
331
320
|
await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
|
|
332
321
|
await this.bananaCoin.methods
|
|
333
322
|
.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS)
|
|
334
|
-
.send({ from: this.aliceAddress })
|
|
335
|
-
.wait();
|
|
323
|
+
.send({ from: this.aliceAddress });
|
|
336
324
|
}
|
|
337
325
|
|
|
338
326
|
public async applyFundAliceWithPrivateBananas() {
|
|
@@ -2,7 +2,7 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
|
2
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { BatchedBlob, Blob, getEthBlobEvaluationInputs, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
-
import {
|
|
5
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
6
6
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
7
7
|
|
|
8
8
|
import { writeFile } from 'fs/promises';
|
|
@@ -15,7 +15,8 @@ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
|
|
|
15
15
|
*/
|
|
16
16
|
export async function writeJson(
|
|
17
17
|
fileName: string,
|
|
18
|
-
|
|
18
|
+
checkpointHeader: CheckpointHeader,
|
|
19
|
+
block: L2Block,
|
|
19
20
|
l1ToL2Content: Fr[],
|
|
20
21
|
blobs: Blob[],
|
|
21
22
|
batchedBlob: BatchedBlob,
|
|
@@ -33,12 +34,6 @@ export async function writeJson(
|
|
|
33
34
|
return `0x${buffer.toString('hex').padStart(size, '0')}`;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
// Create a checkpoint header for this block
|
|
37
|
-
const checkpointHeader = CheckpointHeader.random({
|
|
38
|
-
slotNumber: block.slot,
|
|
39
|
-
timestamp: block.timestamp,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
37
|
const jsonObject = {
|
|
43
38
|
populate: {
|
|
44
39
|
l1ToL2Content: l1ToL2Content.map(value => asHex(value)),
|
|
@@ -44,7 +44,7 @@ export class NestedContractTest {
|
|
|
44
44
|
});
|
|
45
45
|
this.wallet = this.context.wallet;
|
|
46
46
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
47
|
-
this.aztecNode = this.context.aztecNodeService
|
|
47
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
48
48
|
|
|
49
49
|
this.logger.info('Public deploy accounts');
|
|
50
50
|
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
@@ -65,11 +65,11 @@ export class NestedContractTest {
|
|
|
65
65
|
|
|
66
66
|
async applyManual() {
|
|
67
67
|
this.logger.info('Deploying parent and child contracts');
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({
|
|
69
|
+
from: this.defaultAccountAddress,
|
|
70
|
+
}));
|
|
71
|
+
({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({
|
|
72
|
+
from: this.defaultAccountAddress,
|
|
73
|
+
}));
|
|
74
74
|
}
|
|
75
75
|
}
|