@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +4 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
- 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 +10 -30
- package/dest/bench/utils.d.ts +3 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +17 -37
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
- 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 +35 -35
- package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +20 -12
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +36 -27
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +14 -11
- package/dest/e2e_fees/fees_test.d.ts +13 -9
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +39 -40
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +9 -8
- package/dest/e2e_multi_validator/utils.d.ts +2 -2
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_multi_validator/utils.js +4 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
- 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 +238 -18
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +50 -25
- package/dest/e2e_p2p/shared.d.ts +16 -17
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +57 -56
- package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +13 -11
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +57 -66
- 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 +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- 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 +2 -2
- 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_p2p_test.d.ts +12 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +50 -24
- package/dest/fixtures/snapshot_manager.d.ts +16 -15
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +84 -88
- package/dest/fixtures/token_utils.d.ts +10 -5
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +17 -18
- package/dest/fixtures/utils.d.ts +44 -47
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +128 -185
- 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/alert_checker.d.ts +2 -2
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +20 -23
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +10 -17
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +11 -8
- package/dest/shared/index.d.ts +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 +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +13 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +44 -58
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +4 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +8 -5
- package/dest/simulators/token_simulator.d.ts +4 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +22 -14
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +144 -86
- package/dest/spartan/tx_metrics.d.ts +39 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +95 -0
- package/dest/spartan/utils.d.ts +101 -16
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +414 -52
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
- package/src/bench/client_flows/data_extractor.ts +9 -31
- package/src/bench/utils.ts +15 -39
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
- package/src/e2e_deploy_contract/deploy_test.ts +18 -36
- package/src/e2e_epochs/epochs_test.ts +59 -42
- package/src/e2e_fees/bridging_race.notest.ts +16 -11
- package/src/e2e_fees/fees_test.ts +48 -52
- package/src/e2e_l1_publisher/write_json.ts +12 -9
- package/src/e2e_multi_validator/utils.ts +5 -11
- package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +125 -89
- package/src/e2e_p2p/shared.ts +69 -60
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +65 -105
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +2 -2
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +79 -32
- package/src/fixtures/snapshot_manager.ts +120 -131
- package/src/fixtures/token_utils.ts +16 -24
- package/src/fixtures/utils.ts +175 -269
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +3 -11
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +23 -31
- package/src/shared/gas_portal_test_harness.ts +14 -21
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +80 -88
- package/src/simulators/lending_simulator.ts +9 -6
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +15 -3
- package/src/spartan/setup_test_wallets.ts +171 -127
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +543 -45
- 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/src/fixtures/setup_l1_contracts.ts +0 -26
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type Logger,
|
|
10
|
-
type PXE,
|
|
11
|
-
type PublicKeys,
|
|
12
|
-
type Wallet,
|
|
13
|
-
createLogger,
|
|
14
|
-
getContractInstanceFromInstantiationParams,
|
|
15
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type ContractBase, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import type { PublicKeys } from '@aztec/aztec.js/keys';
|
|
6
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
16
9
|
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
17
10
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
18
12
|
|
|
19
13
|
import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
20
14
|
|
|
@@ -23,8 +17,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
23
17
|
export class DeployTest {
|
|
24
18
|
private snapshotManager: ISnapshotManager;
|
|
25
19
|
public logger: Logger;
|
|
26
|
-
public
|
|
27
|
-
public wallet!: AccountWallet;
|
|
20
|
+
public wallet!: TestWallet;
|
|
28
21
|
public defaultAccountAddress!: AztecAddress;
|
|
29
22
|
public aztecNode!: AztecNode;
|
|
30
23
|
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
@@ -37,7 +30,7 @@ export class DeployTest {
|
|
|
37
30
|
async setup() {
|
|
38
31
|
await this.applyInitialAccountSnapshot();
|
|
39
32
|
const context = await this.snapshotManager.setup();
|
|
40
|
-
({
|
|
33
|
+
({ aztecNode: this.aztecNode, wallet: this.wallet } = context);
|
|
41
34
|
this.aztecNodeAdmin = context.aztecNode;
|
|
42
35
|
return this;
|
|
43
36
|
}
|
|
@@ -47,16 +40,10 @@ export class DeployTest {
|
|
|
47
40
|
}
|
|
48
41
|
|
|
49
42
|
private async applyInitialAccountSnapshot() {
|
|
50
|
-
await this.snapshotManager.snapshot(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
55
|
-
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
56
|
-
this.wallet = wallets[0];
|
|
57
|
-
this.defaultAccountAddress = this.wallet.getAddress();
|
|
58
|
-
},
|
|
59
|
-
);
|
|
43
|
+
await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), ({ deployedAccounts }) => {
|
|
44
|
+
this.defaultAccountAddress = deployedAccounts[0].address;
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
});
|
|
60
47
|
}
|
|
61
48
|
|
|
62
49
|
async registerContract<T extends ContractBase>(
|
|
@@ -74,23 +61,18 @@ export class DeployTest {
|
|
|
74
61
|
const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
|
|
75
62
|
constructorArgs: initArgs ?? [],
|
|
76
63
|
constructorArtifact: constructorName,
|
|
77
|
-
salt,
|
|
64
|
+
salt: salt ?? Fr.random(),
|
|
78
65
|
publicKeys,
|
|
79
66
|
deployer,
|
|
80
67
|
});
|
|
81
|
-
await wallet.registerContract(
|
|
68
|
+
await wallet.registerContract(instance, contractArtifact.artifact);
|
|
82
69
|
return contractArtifact.at(instance.address, wallet);
|
|
83
70
|
}
|
|
84
|
-
|
|
85
|
-
async registerRandomAccount(): Promise<AztecAddress> {
|
|
86
|
-
const completeAddress = await this.pxe.registerAccount(Fr.random(), Fr.random());
|
|
87
|
-
return completeAddress.address;
|
|
88
|
-
}
|
|
89
71
|
}
|
|
90
72
|
|
|
91
73
|
export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
|
|
92
74
|
|
|
93
75
|
export type ContractArtifactClass<T extends ContractBase> = {
|
|
94
|
-
at(address: AztecAddress, wallet: Wallet):
|
|
76
|
+
at(address: AztecAddress, wallet: Wallet): T;
|
|
95
77
|
artifact: ContractArtifact;
|
|
96
78
|
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
12
|
-
import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
|
|
2
|
+
import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
|
|
3
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
|
+
import { MerkleTreeId } from '@aztec/aztec.js/trees';
|
|
7
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
8
|
+
import { EpochCache } from '@aztec/epoch-cache';
|
|
9
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
|
+
import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
|
|
13
11
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
14
12
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
13
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
14
|
+
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
15
15
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
16
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
17
17
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
18
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
19
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
18
20
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
19
21
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
20
|
-
import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
|
|
22
|
+
import { ProverNode, type ProverNodeConfig, ProverNodePublisher } from '@aztec/prover-node';
|
|
21
23
|
import type { TestProverNode } from '@aztec/prover-node/test';
|
|
22
24
|
import {
|
|
23
25
|
type SequencerClient,
|
|
@@ -26,7 +28,7 @@ import {
|
|
|
26
28
|
SequencerState,
|
|
27
29
|
} from '@aztec/sequencer-client';
|
|
28
30
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
29
|
-
import {
|
|
31
|
+
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
30
32
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
31
33
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
32
34
|
|
|
@@ -69,6 +71,7 @@ export class EpochsTestContext {
|
|
|
69
71
|
public constants!: L1RollupConstants;
|
|
70
72
|
public logger!: Logger;
|
|
71
73
|
public monitor!: ChainMonitor;
|
|
74
|
+
public epochCache!: EpochCache;
|
|
72
75
|
public proverDelayer!: Delayer;
|
|
73
76
|
public sequencerDelayer!: Delayer;
|
|
74
77
|
|
|
@@ -94,12 +97,24 @@ export class EpochsTestContext {
|
|
|
94
97
|
const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
|
|
95
98
|
const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
|
|
96
99
|
const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
|
|
97
|
-
|
|
100
|
+
const l1PublishingTime = opts.l1PublishingTime ?? 1;
|
|
101
|
+
return {
|
|
102
|
+
l1PublishingTime,
|
|
103
|
+
ethereumSlotDuration,
|
|
104
|
+
aztecSlotDuration,
|
|
105
|
+
aztecEpochDuration,
|
|
106
|
+
aztecProofSubmissionEpochs,
|
|
107
|
+
};
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
public async setup(opts: EpochsTestOpts = {}) {
|
|
101
|
-
const {
|
|
102
|
-
|
|
111
|
+
const {
|
|
112
|
+
ethereumSlotDuration,
|
|
113
|
+
aztecSlotDuration,
|
|
114
|
+
aztecEpochDuration,
|
|
115
|
+
aztecProofSubmissionEpochs,
|
|
116
|
+
l1PublishingTime,
|
|
117
|
+
} = EpochsTestContext.getSlotDurations(opts);
|
|
103
118
|
|
|
104
119
|
this.L1_BLOCK_TIME_IN_S = ethereumSlotDuration;
|
|
105
120
|
this.L2_SLOT_DURATION_IN_S = aztecSlotDuration;
|
|
@@ -111,8 +126,6 @@ export class EpochsTestContext {
|
|
|
111
126
|
checkIntervalMs: 50,
|
|
112
127
|
archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
|
|
113
128
|
worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
|
|
114
|
-
skipProtocolContracts: true,
|
|
115
|
-
salt: 1,
|
|
116
129
|
aztecEpochDuration,
|
|
117
130
|
aztecSlotDuration,
|
|
118
131
|
ethereumSlotDuration,
|
|
@@ -126,12 +139,10 @@ export class EpochsTestContext {
|
|
|
126
139
|
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
127
140
|
// Use numeric EthAddress for deterministic prover id
|
|
128
141
|
proverId: EthAddress.fromNumber(1),
|
|
129
|
-
// This must be enough so that the tx from the prover is delayed properly,
|
|
130
|
-
// but not so much to hang the sequencer and timeout the teardown
|
|
131
|
-
txPropagationMaxQueryAttempts: opts.txPropagationMaxQueryAttempts ?? 12,
|
|
132
142
|
worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
|
|
133
143
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
134
144
|
slasherFlavor: 'none',
|
|
145
|
+
l1PublishingTime,
|
|
135
146
|
...opts,
|
|
136
147
|
});
|
|
137
148
|
|
|
@@ -141,6 +152,7 @@ export class EpochsTestContext {
|
|
|
141
152
|
this.logger = context.logger;
|
|
142
153
|
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
143
154
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
155
|
+
this.epochCache = await EpochCache.create(this.rollup, context.config, { dateProvider: context.dateProvider });
|
|
144
156
|
|
|
145
157
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
146
158
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
@@ -184,15 +196,20 @@ export class EpochsTestContext {
|
|
|
184
196
|
await this.context.teardown();
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
public async createProverNode() {
|
|
199
|
+
public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
|
|
188
200
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
189
201
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
190
202
|
const suffix = (this.proverNodes.length + 1).toString();
|
|
191
203
|
const proverNode = await withLogNameSuffix(suffix, () =>
|
|
192
204
|
createAndSyncProverNode(
|
|
193
205
|
proverNodePrivateKey,
|
|
194
|
-
{ ...this.context.config
|
|
195
|
-
{
|
|
206
|
+
{ ...this.context.config },
|
|
207
|
+
{
|
|
208
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
209
|
+
proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
|
|
210
|
+
dontStart: opts.dontStart,
|
|
211
|
+
...opts,
|
|
212
|
+
},
|
|
196
213
|
this.context.aztecNode,
|
|
197
214
|
undefined,
|
|
198
215
|
{ dateProvider: this.context.dateProvider },
|
|
@@ -276,7 +293,7 @@ export class EpochsTestContext {
|
|
|
276
293
|
|
|
277
294
|
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
|
|
278
295
|
public async waitUntilEpochStarts(epoch: number) {
|
|
279
|
-
const [start] = getTimestampRangeForEpoch(
|
|
296
|
+
const [start] = getTimestampRangeForEpoch(EpochNumber(epoch), this.constants);
|
|
280
297
|
this.logger.info(`Waiting until L1 timestamp ${start} is reached as the start of epoch ${epoch}`);
|
|
281
298
|
await waitUntilL1Timestamp(
|
|
282
299
|
this.l1Client,
|
|
@@ -287,30 +304,30 @@ export class EpochsTestContext {
|
|
|
287
304
|
return start;
|
|
288
305
|
}
|
|
289
306
|
|
|
290
|
-
/** Waits until the given
|
|
291
|
-
public async
|
|
307
|
+
/** Waits until the given checkpoint number is mined. */
|
|
308
|
+
public async waitUntilCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
292
309
|
await retryUntil(
|
|
293
|
-
() => Promise.resolve(target <= this.monitor.
|
|
294
|
-
`Wait until
|
|
310
|
+
() => Promise.resolve(target <= this.monitor.checkpointNumber),
|
|
311
|
+
`Wait until checkpoint ${target}`,
|
|
295
312
|
timeout,
|
|
296
313
|
0.1,
|
|
297
314
|
);
|
|
298
315
|
}
|
|
299
316
|
|
|
300
|
-
/** Waits until the given
|
|
301
|
-
public async
|
|
317
|
+
/** Waits until the given checkpoint number is marked as proven. */
|
|
318
|
+
public async waitUntilProvenCheckpointNumber(target: CheckpointNumber, timeout = 120) {
|
|
302
319
|
await retryUntil(
|
|
303
|
-
() => Promise.resolve(
|
|
304
|
-
`Wait proven
|
|
320
|
+
() => Promise.resolve(target <= this.monitor.provenCheckpointNumber),
|
|
321
|
+
`Wait proven checkpoint ${target}`,
|
|
305
322
|
timeout,
|
|
306
323
|
0.1,
|
|
307
324
|
);
|
|
308
|
-
return this.monitor.
|
|
325
|
+
return this.monitor.provenCheckpointNumber;
|
|
309
326
|
}
|
|
310
327
|
|
|
311
328
|
/** Waits until the last slot of the proof submission window for a given epoch. */
|
|
312
329
|
public async waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint) {
|
|
313
|
-
const deadline = getProofSubmissionDeadlineTimestamp(BigInt(epochNumber), this.constants);
|
|
330
|
+
const deadline = getProofSubmissionDeadlineTimestamp(EpochNumber.fromBigInt(BigInt(epochNumber)), this.constants);
|
|
314
331
|
const oneSlotBefore = deadline - BigInt(this.constants.slotDuration);
|
|
315
332
|
const date = new Date(Number(oneSlotBefore) * 1000);
|
|
316
333
|
this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
|
|
@@ -320,7 +337,7 @@ export class EpochsTestContext {
|
|
|
320
337
|
}
|
|
321
338
|
|
|
322
339
|
/** Waits for the aztec node to sync to the target block number. */
|
|
323
|
-
public async waitForNodeToSync(blockNumber:
|
|
340
|
+
public async waitForNodeToSync(blockNumber: BlockNumber, type: 'proven' | 'finalized' | 'historic') {
|
|
324
341
|
const waitTime = ARCHIVER_POLL_INTERVAL + WORLD_STATE_BLOCK_CHECK_INTERVAL;
|
|
325
342
|
let synched = false;
|
|
326
343
|
while (!synched) {
|
|
@@ -349,7 +366,7 @@ export class EpochsTestContext {
|
|
|
349
366
|
publicKeys: undefined,
|
|
350
367
|
deployer: undefined,
|
|
351
368
|
});
|
|
352
|
-
await wallet.registerContract(
|
|
369
|
+
await wallet.registerContract(instance, SpamContract.artifact);
|
|
353
370
|
return SpamContract.at(instance.address, wallet);
|
|
354
371
|
}
|
|
355
372
|
|
|
@@ -369,7 +386,7 @@ export class EpochsTestContext {
|
|
|
369
386
|
}
|
|
370
387
|
|
|
371
388
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
372
|
-
public async verifyHistoricBlock(blockNumber:
|
|
389
|
+
public async verifyHistoricBlock(blockNumber: BlockParameter, expectedSuccess: boolean) {
|
|
373
390
|
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
374
391
|
// at a particular block, so we know whether that historic block is available or has been
|
|
375
392
|
// pruned. Note that `getBlock` would not work here, since it only hits the archiver.
|
|
@@ -387,11 +404,11 @@ export class EpochsTestContext {
|
|
|
387
404
|
const stateChanges: TrackedSequencerEvent[] = [];
|
|
388
405
|
const failEvents: TrackedSequencerEvent[] = [];
|
|
389
406
|
|
|
390
|
-
// Note we do not include the 'tx-count-check-failed' event here, since it is fine if we dont build
|
|
407
|
+
// Note we do not include the 'block-tx-count-check-failed' event here, since it is fine if we dont build
|
|
391
408
|
// due to lack of txs available.
|
|
392
409
|
const failEventsKeys: (keyof SequencerEvents)[] = [
|
|
393
410
|
'block-build-failed',
|
|
394
|
-
'
|
|
411
|
+
'checkpoint-publish-failed',
|
|
395
412
|
'proposer-rollup-check-failed',
|
|
396
413
|
];
|
|
397
414
|
|
|
@@ -424,7 +441,7 @@ export class EpochsTestContext {
|
|
|
424
441
|
sequencer.getSequencer().on(eventName, (args: Parameters<SequencerEvents[typeof eventName]>[0]) => {
|
|
425
442
|
const evt = makeEvent(i, eventName, args);
|
|
426
443
|
failEvents.push(evt);
|
|
427
|
-
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, evt);
|
|
444
|
+
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
|
|
428
445
|
});
|
|
429
446
|
});
|
|
430
447
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr
|
|
3
|
-
import {
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
+
import { Fq } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
5
8
|
|
|
6
9
|
import { jest } from '@jest/globals';
|
|
7
10
|
import type { Hex } from 'viem';
|
|
@@ -27,7 +30,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
27
30
|
await t.applyPublicDeployAccountsSnapshot();
|
|
28
31
|
await t.applySetupFeeJuiceSnapshot();
|
|
29
32
|
|
|
30
|
-
({
|
|
33
|
+
({ wallet, logger } = await t.setup());
|
|
31
34
|
});
|
|
32
35
|
|
|
33
36
|
afterAll(async () => {
|
|
@@ -35,17 +38,19 @@ describe('e2e_fees bridging_race', () => {
|
|
|
35
38
|
});
|
|
36
39
|
|
|
37
40
|
let logger: Logger;
|
|
38
|
-
let pxe: PXE;
|
|
39
41
|
let bobsAddress: AztecAddress;
|
|
42
|
+
let wallet: TestWallet;
|
|
40
43
|
|
|
41
44
|
beforeEach(async () => {
|
|
42
45
|
const bobsSecretKey = Fr.random();
|
|
43
46
|
const bobsPrivateSigningKey = Fq.random();
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const bobsSalt = Fr.random();
|
|
48
|
+
const bobsAccountManager = await wallet.createAccount({
|
|
49
|
+
secret: bobsSecretKey,
|
|
50
|
+
salt: bobsSalt,
|
|
51
|
+
contract: new SchnorrAccountContract(bobsPrivateSigningKey),
|
|
52
|
+
});
|
|
53
|
+
bobsAddress = bobsAccountManager.address;
|
|
49
54
|
});
|
|
50
55
|
|
|
51
56
|
it('Alice bridges funds to Bob', async () => {
|
|
@@ -55,7 +60,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
55
60
|
const origApprove = l1TokenManager.approve.bind(l1TokenManager);
|
|
56
61
|
l1TokenManager.approve = async (amount: bigint, address: Hex, addressName = '') => {
|
|
57
62
|
await origApprove(amount, address, addressName);
|
|
58
|
-
const sleepTime = (Number(t.chainMonitor.
|
|
63
|
+
const sleepTime = (Number(t.chainMonitor.checkpointTimestamp) + AZTEC_SLOT_DURATION) * 1000 - Date.now() - 500;
|
|
59
64
|
logger.info(`Sleeping for ${sleepTime}ms until near end of L2 slot before sending L1 fee juice to L2 inbox`);
|
|
60
65
|
await sleep(sleepTime);
|
|
61
66
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type AztecAddress,
|
|
5
|
-
type AztecNode,
|
|
6
|
-
type Logger,
|
|
7
|
-
type PXE,
|
|
8
|
-
createLogger,
|
|
9
|
-
sleep,
|
|
10
|
-
} from '@aztec/aztec.js';
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
11
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
12
|
-
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';
|
|
13
8
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
9
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
14
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
15
12
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
16
13
|
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
17
14
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
@@ -22,6 +19,8 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
22
19
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
24
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
25
24
|
|
|
26
25
|
import { getContract } from 'viem';
|
|
27
26
|
|
|
@@ -56,17 +55,15 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
56
55
|
*/
|
|
57
56
|
export class FeesTest {
|
|
58
57
|
private snapshotManager: ISnapshotManager;
|
|
59
|
-
private wallets: AccountWallet[] = [];
|
|
60
58
|
private accounts: AztecAddress[] = [];
|
|
61
59
|
|
|
62
60
|
public logger: Logger;
|
|
63
|
-
public pxe!: PXE;
|
|
64
61
|
public aztecNode!: AztecNode;
|
|
62
|
+
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
65
63
|
public cheatCodes!: CheatCodes;
|
|
66
64
|
|
|
67
|
-
public
|
|
65
|
+
public wallet!: TestWallet;
|
|
68
66
|
public aliceAddress!: AztecAddress;
|
|
69
|
-
public bobWallet!: AccountWallet;
|
|
70
67
|
public bobAddress!: AztecAddress;
|
|
71
68
|
public sequencerAddress!: AztecAddress;
|
|
72
69
|
public coinbase!: EthAddress;
|
|
@@ -93,7 +90,7 @@ export class FeesTest {
|
|
|
93
90
|
public getGasBalanceFn!: BalancesFn;
|
|
94
91
|
public getBananaPublicBalanceFn!: BalancesFn;
|
|
95
92
|
public getBananaPrivateBalanceFn!: BalancesFn;
|
|
96
|
-
public getProverFee!: (blockNumber:
|
|
93
|
+
public getProverFee!: (blockNumber: BlockNumber) => Promise<bigint>;
|
|
97
94
|
|
|
98
95
|
public readonly ALICE_INITIAL_BANANAS = BigInt(1e22);
|
|
99
96
|
public readonly SUBSCRIPTION_AMOUNT = BigInt(1e19);
|
|
@@ -102,7 +99,7 @@ export class FeesTest {
|
|
|
102
99
|
constructor(
|
|
103
100
|
testName: string,
|
|
104
101
|
private numberOfAccounts = 3,
|
|
105
|
-
setupOptions: Partial<SetupOptions &
|
|
102
|
+
setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {},
|
|
106
103
|
) {
|
|
107
104
|
if (!numberOfAccounts) {
|
|
108
105
|
throw new Error('There must be at least 1 initial account.');
|
|
@@ -144,14 +141,13 @@ export class FeesTest {
|
|
|
144
141
|
}
|
|
145
142
|
|
|
146
143
|
async getBlockRewards() {
|
|
147
|
-
const blockReward = await this.rollupContract.
|
|
144
|
+
const blockReward = await this.rollupContract.getCheckpointReward();
|
|
145
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
148
146
|
|
|
149
|
-
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
150
|
-
this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress,
|
|
151
|
-
);
|
|
147
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(rewardConfig.rewardDistributor);
|
|
152
148
|
|
|
153
149
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
154
|
-
const sequencerBlockRewards = toDistribute /
|
|
150
|
+
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
155
151
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
156
152
|
|
|
157
153
|
return { sequencerBlockRewards, proverBlockRewards };
|
|
@@ -172,7 +168,7 @@ export class FeesTest {
|
|
|
172
168
|
.balance_of_private(address)
|
|
173
169
|
.simulate({ from: this.aliceAddress });
|
|
174
170
|
|
|
175
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress,
|
|
171
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
176
172
|
|
|
177
173
|
const balanceAfter = await this.bananaCoin.methods
|
|
178
174
|
.balance_of_private(address)
|
|
@@ -191,30 +187,28 @@ export class FeesTest {
|
|
|
191
187
|
await this.snapshotManager.snapshot(
|
|
192
188
|
'initial_accounts',
|
|
193
189
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
194
|
-
async ({ deployedAccounts }, {
|
|
195
|
-
this.
|
|
196
|
-
|
|
190
|
+
async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
|
|
191
|
+
this.wallet = wallet;
|
|
197
192
|
this.aztecNode = aztecNode;
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this.accounts
|
|
203
|
-
[this.
|
|
204
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
|
|
193
|
+
this.aztecNodeAdmin = aztecNode;
|
|
194
|
+
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
195
|
+
this.cheatCodes = cheatCodes;
|
|
196
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
197
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
198
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
205
199
|
|
|
206
200
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
207
201
|
this.fpcAdmin = this.aliceAddress;
|
|
208
202
|
|
|
209
203
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
210
|
-
this.feeJuiceContract =
|
|
204
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
211
205
|
},
|
|
212
206
|
);
|
|
213
207
|
}
|
|
214
208
|
|
|
215
209
|
async applyPublicDeployAccountsSnapshot() {
|
|
216
210
|
await this.snapshotManager.snapshot('public_deploy_accounts', () =>
|
|
217
|
-
ensureAccountContractsPublished(this.
|
|
211
|
+
ensureAccountContractsPublished(this.wallet, this.accounts),
|
|
218
212
|
);
|
|
219
213
|
}
|
|
220
214
|
|
|
@@ -225,7 +219,7 @@ export class FeesTest {
|
|
|
225
219
|
async (_data, context) => {
|
|
226
220
|
this.context = context;
|
|
227
221
|
|
|
228
|
-
this.feeJuiceContract =
|
|
222
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
229
223
|
|
|
230
224
|
this.getGasBalanceFn = getBalancesFn(
|
|
231
225
|
'⛽',
|
|
@@ -237,9 +231,8 @@ export class FeesTest {
|
|
|
237
231
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
238
232
|
aztecNode: context.aztecNode,
|
|
239
233
|
aztecNodeAdmin: context.aztecNode,
|
|
240
|
-
pxeService: context.pxe,
|
|
241
234
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
242
|
-
wallet: this.
|
|
235
|
+
wallet: this.wallet,
|
|
243
236
|
logger: this.logger,
|
|
244
237
|
});
|
|
245
238
|
},
|
|
@@ -250,14 +243,14 @@ export class FeesTest {
|
|
|
250
243
|
await this.snapshotManager.snapshot(
|
|
251
244
|
'deploy_banana_token',
|
|
252
245
|
async () => {
|
|
253
|
-
const bananaCoin = await BananaCoin.deploy(this.
|
|
246
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
254
247
|
.send({ from: this.aliceAddress })
|
|
255
248
|
.deployed();
|
|
256
249
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
257
250
|
return { bananaCoinAddress: bananaCoin.address };
|
|
258
251
|
},
|
|
259
|
-
|
|
260
|
-
this.bananaCoin =
|
|
252
|
+
({ bananaCoinAddress }) => {
|
|
253
|
+
this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.wallet);
|
|
261
254
|
const logger = this.logger;
|
|
262
255
|
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
263
256
|
'🍌.public',
|
|
@@ -271,6 +264,7 @@ export class FeesTest {
|
|
|
271
264
|
this.aliceAddress,
|
|
272
265
|
logger,
|
|
273
266
|
);
|
|
267
|
+
return Promise.resolve();
|
|
274
268
|
},
|
|
275
269
|
);
|
|
276
270
|
}
|
|
@@ -280,10 +274,10 @@ export class FeesTest {
|
|
|
280
274
|
'fpc_setup',
|
|
281
275
|
async context => {
|
|
282
276
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
283
|
-
expect((await context.
|
|
277
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
284
278
|
|
|
285
279
|
const bananaCoin = this.bananaCoin;
|
|
286
|
-
const bananaFPC = await FPCContract.deploy(this.
|
|
280
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
287
281
|
.send({ from: this.aliceAddress })
|
|
288
282
|
.deployed();
|
|
289
283
|
|
|
@@ -298,8 +292,8 @@ export class FeesTest {
|
|
|
298
292
|
rollupAddress: context.deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
299
293
|
};
|
|
300
294
|
},
|
|
301
|
-
|
|
302
|
-
const bananaFPC =
|
|
295
|
+
(data, context) => {
|
|
296
|
+
const bananaFPC = FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
303
297
|
this.bananaFPC = bananaFPC;
|
|
304
298
|
|
|
305
299
|
this.getCoinbaseBalance = async () => {
|
|
@@ -316,8 +310,8 @@ export class FeesTest {
|
|
|
316
310
|
return await this.rollupContract.getSequencerRewards(this.coinbase);
|
|
317
311
|
};
|
|
318
312
|
|
|
319
|
-
this.getProverFee = async (blockNumber:
|
|
320
|
-
const block = await this.
|
|
313
|
+
this.getProverFee = async (blockNumber: BlockNumber) => {
|
|
314
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
321
315
|
|
|
322
316
|
// @todo @lherskind As we deal with #13601
|
|
323
317
|
// Right now the value is from `FeeLib.sol`
|
|
@@ -329,7 +323,7 @@ export class FeesTest {
|
|
|
329
323
|
const { baseFee } = await this.rollupContract.getL1FeesAt(block!.header.globalVariables.timestamp);
|
|
330
324
|
const proverCost =
|
|
331
325
|
mulDiv(
|
|
332
|
-
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await this.rollupContract.getEpochDuration()),
|
|
326
|
+
mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, BigInt(await this.rollupContract.getEpochDuration())),
|
|
333
327
|
1n,
|
|
334
328
|
await this.rollupContract.getManaTarget(),
|
|
335
329
|
) + (await this.rollupContract.getProvingCostPerMana());
|
|
@@ -339,6 +333,7 @@ export class FeesTest {
|
|
|
339
333
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
340
334
|
return mulDiv(mana * proverCost, price, 10n ** 9n);
|
|
341
335
|
};
|
|
336
|
+
return Promise.resolve();
|
|
342
337
|
},
|
|
343
338
|
);
|
|
344
339
|
}
|
|
@@ -348,17 +343,18 @@ export class FeesTest {
|
|
|
348
343
|
'sponsored_fpc_setup',
|
|
349
344
|
async context => {
|
|
350
345
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
351
|
-
expect((await context.
|
|
346
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
352
347
|
|
|
353
|
-
const sponsoredFPC = await setupSponsoredFPC(
|
|
348
|
+
const sponsoredFPC = await setupSponsoredFPC(this.wallet);
|
|
354
349
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
355
350
|
|
|
356
351
|
return {
|
|
357
352
|
sponsoredFPCAddress: sponsoredFPC.address,
|
|
358
353
|
};
|
|
359
354
|
},
|
|
360
|
-
|
|
361
|
-
this.sponsoredFPC =
|
|
355
|
+
data => {
|
|
356
|
+
this.sponsoredFPC = SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
357
|
+
return Promise.resolve();
|
|
362
358
|
},
|
|
363
359
|
);
|
|
364
360
|
}
|