@aztec/end-to-end 3.0.0-canary.a9708bd → 3.0.0-devnet.2
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/client_flows_benchmark.d.ts +16 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
- package/dest/bench/utils.d.ts +2 -11
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -34
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
- 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 +31 -33
- package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
- 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 +9 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +19 -13
- package/dest/e2e_fees/bridging_race.notest.js +12 -9
- package/dest/e2e_fees/fees_test.d.ts +5 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +26 -33
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -5
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_multi_validator/utils.js +3 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
- 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 +135 -0
- package/dest/e2e_p2p/p2p_network.d.ts +22 -8
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +36 -15
- package/dest/e2e_p2p/shared.d.ts +12 -13
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +54 -54
- package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
- 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 +8 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +42 -51
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +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/get_bb_config.js +2 -2
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +2 -2
- package/dest/fixtures/setup_p2p_test.d.ts +10 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +38 -20
- package/dest/fixtures/snapshot_manager.d.ts +10 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +60 -47
- package/dest/fixtures/token_utils.d.ts +6 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +11 -15
- package/dest/fixtures/utils.d.ts +26 -28
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +83 -109
- 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/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +16 -10
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -15
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +10 -7
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +5 -3
- 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 +9 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +29 -45
- package/dest/simulators/lending_simulator.d.ts +2 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +3 -2
- package/dest/simulators/token_simulator.d.ts +3 -1
- 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 +19 -13
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -85
- package/dest/spartan/utils.d.ts +68 -3
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +312 -49
- package/package.json +39 -38
- package/src/bench/client_flows/benchmark.ts +6 -6
- package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +9 -37
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
- package/src/e2e_deploy_contract/deploy_test.ts +17 -35
- package/src/e2e_epochs/epochs_test.ts +22 -19
- package/src/e2e_fees/bridging_race.notest.ts +14 -9
- package/src/e2e_fees/fees_test.ts +29 -40
- package/src/e2e_l1_publisher/write_json.ts +8 -6
- package/src/e2e_multi_validator/utils.ts +4 -10
- package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
- package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
- package/src/e2e_p2p/p2p_network.ts +110 -71
- package/src/e2e_p2p/shared.ts +57 -56
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +52 -88
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +60 -27
- package/src/fixtures/snapshot_manager.ts +80 -72
- package/src/fixtures/token_utils.ts +13 -21
- package/src/fixtures/utils.ts +95 -145
- package/src/fixtures/web3signer.ts +63 -0
- package/src/guides/up_quick_start.sh +2 -10
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +18 -29
- package/src/shared/gas_portal_test_harness.ts +12 -19
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +61 -67
- package/src/simulators/lending_simulator.ts +3 -2
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +8 -3
- package/src/spartan/setup_test_wallets.ts +133 -126
- package/src/spartan/utils.ts +373 -48
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
1
|
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type AztecNode,
|
|
7
|
-
type CompleteAddress,
|
|
8
|
-
EthAddress,
|
|
9
|
-
type Logger,
|
|
10
|
-
type PXE,
|
|
11
|
-
createLogger,
|
|
12
|
-
} from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
13
5
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
14
6
|
import {
|
|
7
|
+
type DeployL1ContractsArgs,
|
|
15
8
|
type DeployL1ContractsReturnType,
|
|
16
9
|
type ExtendedViemWalletClient,
|
|
17
10
|
createExtendedL1Client,
|
|
@@ -21,6 +14,7 @@ import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-
|
|
|
21
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
22
15
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
23
16
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
17
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
24
18
|
|
|
25
19
|
import { getContract } from 'viem';
|
|
26
20
|
|
|
@@ -32,6 +26,7 @@ import {
|
|
|
32
26
|
deployAccounts,
|
|
33
27
|
publicDeployAccounts,
|
|
34
28
|
} from '../fixtures/snapshot_manager.js';
|
|
29
|
+
import type { SetupOptions } from '../fixtures/utils.js';
|
|
35
30
|
import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
|
|
36
31
|
|
|
37
32
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
@@ -39,21 +34,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
39
34
|
export class CrossChainMessagingTest {
|
|
40
35
|
private snapshotManager: ISnapshotManager;
|
|
41
36
|
logger: Logger;
|
|
42
|
-
accounts: CompleteAddress[] = [];
|
|
43
37
|
aztecNode!: AztecNode;
|
|
44
|
-
pxe!: PXE;
|
|
45
38
|
aztecNodeConfig!: AztecNodeConfig;
|
|
46
39
|
aztecNodeAdmin!: AztecNodeAdmin;
|
|
40
|
+
ctx!: SubsystemsContext;
|
|
47
41
|
|
|
48
42
|
l1Client!: ExtendedViemWalletClient | undefined;
|
|
49
43
|
|
|
50
|
-
|
|
44
|
+
wallet!: TestWallet;
|
|
45
|
+
ownerAddress!: AztecAddress;
|
|
51
46
|
user1Address!: AztecAddress;
|
|
52
|
-
user2Wallet!: AccountWallet;
|
|
53
47
|
user2Address!: AztecAddress;
|
|
54
48
|
crossChainTestHarness!: CrossChainTestHarness;
|
|
55
49
|
ethAccount!: EthAddress;
|
|
56
|
-
ownerAddress!: AztecAddress;
|
|
57
50
|
l2Token!: TokenContract;
|
|
58
51
|
l2Bridge!: TokenBridgeContract;
|
|
59
52
|
|
|
@@ -63,9 +56,12 @@ export class CrossChainMessagingTest {
|
|
|
63
56
|
|
|
64
57
|
deployL1ContractsValues!: DeployL1ContractsReturnType;
|
|
65
58
|
|
|
66
|
-
constructor(testName: string) {
|
|
59
|
+
constructor(testName: string, opts: SetupOptions = {}, deployL1ContractsArgs: Partial<DeployL1ContractsArgs> = {}) {
|
|
67
60
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
68
|
-
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath
|
|
61
|
+
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
|
|
62
|
+
initialValidators: [],
|
|
63
|
+
...deployL1ContractsArgs,
|
|
64
|
+
});
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
async assumeProven() {
|
|
@@ -73,13 +69,13 @@ export class CrossChainMessagingTest {
|
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
async setup() {
|
|
76
|
-
|
|
77
|
-
this.aztecNode = aztecNode;
|
|
78
|
-
this.
|
|
79
|
-
this.aztecNodeConfig = aztecNodeConfig;
|
|
80
|
-
this.cheatCodes =
|
|
81
|
-
this.deployL1ContractsValues = deployL1ContractsValues;
|
|
82
|
-
this.aztecNodeAdmin = aztecNode;
|
|
72
|
+
this.ctx = await this.snapshotManager.setup();
|
|
73
|
+
this.aztecNode = this.ctx.aztecNode;
|
|
74
|
+
this.wallet = this.ctx.wallet;
|
|
75
|
+
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
76
|
+
this.cheatCodes = this.ctx.cheatCodes;
|
|
77
|
+
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
78
|
+
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
snapshot = <T>(
|
|
@@ -93,25 +89,18 @@ export class CrossChainMessagingTest {
|
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
async applyBaseSnapshots() {
|
|
96
|
-
// Note that we are using the same `
|
|
92
|
+
// Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
|
|
97
93
|
// This is to not have issues with different networks.
|
|
98
94
|
|
|
99
95
|
await this.snapshotManager.snapshot(
|
|
100
96
|
'3_accounts',
|
|
101
97
|
deployAccounts(3, this.logger),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
105
|
-
wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
106
|
-
|
|
107
|
-
this.user1Wallet = wallets[0];
|
|
108
|
-
this.user1Address = this.user1Wallet.getAddress();
|
|
109
|
-
this.user2Wallet = wallets[1];
|
|
110
|
-
this.user2Address = this.user2Wallet.getAddress();
|
|
111
|
-
|
|
112
|
-
this.pxe = pxe;
|
|
98
|
+
({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode }) => {
|
|
99
|
+
[this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map(a => a.address);
|
|
100
|
+
this.wallet = wallet;
|
|
113
101
|
this.aztecNode = aztecNode;
|
|
114
102
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
103
|
+
return Promise.resolve();
|
|
115
104
|
},
|
|
116
105
|
);
|
|
117
106
|
|
|
@@ -121,7 +110,7 @@ export class CrossChainMessagingTest {
|
|
|
121
110
|
// Create the token contract state.
|
|
122
111
|
// Move this account thing to addAccounts above?
|
|
123
112
|
this.logger.verbose(`Public deploy accounts...`);
|
|
124
|
-
await publicDeployAccounts(this.
|
|
113
|
+
await publicDeployAccounts(this.wallet, [this.ownerAddress, this.user1Address, this.user2Address]);
|
|
125
114
|
|
|
126
115
|
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
127
116
|
|
|
@@ -134,10 +123,9 @@ export class CrossChainMessagingTest {
|
|
|
134
123
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
135
124
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
136
125
|
this.aztecNode,
|
|
137
|
-
this.pxe,
|
|
138
126
|
this.l1Client,
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
127
|
+
this.wallet,
|
|
128
|
+
this.ownerAddress,
|
|
141
129
|
this.logger,
|
|
142
130
|
underlyingERC20Address,
|
|
143
131
|
);
|
|
@@ -147,12 +135,11 @@ export class CrossChainMessagingTest {
|
|
|
147
135
|
return this.crossChainTestHarness.toCrossChainContext();
|
|
148
136
|
},
|
|
149
137
|
async crossChainContext => {
|
|
150
|
-
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.
|
|
151
|
-
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.
|
|
138
|
+
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
|
|
139
|
+
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
|
|
152
140
|
|
|
153
141
|
// There is an issue with the reviver so we are getting strings sometimes. Working around it here.
|
|
154
142
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
155
|
-
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
156
143
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
157
144
|
|
|
158
145
|
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
@@ -170,7 +157,6 @@ export class CrossChainMessagingTest {
|
|
|
170
157
|
|
|
171
158
|
this.crossChainTestHarness = new CrossChainTestHarness(
|
|
172
159
|
this.aztecNode,
|
|
173
|
-
this.pxe,
|
|
174
160
|
this.logger,
|
|
175
161
|
this.l2Token,
|
|
176
162
|
this.l2Bridge,
|
|
@@ -179,8 +165,8 @@ export class CrossChainMessagingTest {
|
|
|
179
165
|
crossChainContext.underlying,
|
|
180
166
|
l1Client,
|
|
181
167
|
this.aztecNodeConfig.l1Contracts,
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
168
|
+
this.wallet,
|
|
169
|
+
this.ownerAddress,
|
|
184
170
|
);
|
|
185
171
|
|
|
186
172
|
this.l1Client = l1Client;
|
|
@@ -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,18 +61,13 @@ 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']>;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
retryUntil,
|
|
10
|
-
sleep,
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
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';
|
|
12
9
|
import { DefaultL1ContractsConfig, type ExtendedViemWalletClient, createExtendedL1Client } from '@aztec/ethereum';
|
|
13
10
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
14
11
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
|
|
15
12
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
13
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
17
14
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
15
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
18
17
|
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
19
18
|
import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
20
|
-
import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
|
|
19
|
+
import { ProverNode, type ProverNodeConfig, ProverNodePublisher } from '@aztec/prover-node';
|
|
21
20
|
import type { TestProverNode } from '@aztec/prover-node/test';
|
|
22
21
|
import {
|
|
23
22
|
type SequencerClient,
|
|
@@ -69,6 +68,7 @@ export class EpochsTestContext {
|
|
|
69
68
|
public constants!: L1RollupConstants;
|
|
70
69
|
public logger!: Logger;
|
|
71
70
|
public monitor!: ChainMonitor;
|
|
71
|
+
public epochCache!: EpochCache;
|
|
72
72
|
public proverDelayer!: Delayer;
|
|
73
73
|
public sequencerDelayer!: Delayer;
|
|
74
74
|
|
|
@@ -126,9 +126,6 @@ export class EpochsTestContext {
|
|
|
126
126
|
// using the prover's eth address if the proverId is used for something in the rollup contract
|
|
127
127
|
// Use numeric EthAddress for deterministic prover id
|
|
128
128
|
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
129
|
worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
|
|
133
130
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
134
131
|
slasherFlavor: 'none',
|
|
@@ -141,6 +138,7 @@ export class EpochsTestContext {
|
|
|
141
138
|
this.logger = context.logger;
|
|
142
139
|
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
143
140
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
141
|
+
this.epochCache = await EpochCache.create(this.rollup, context.config, { dateProvider: context.dateProvider });
|
|
144
142
|
|
|
145
143
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
146
144
|
this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
|
|
@@ -184,15 +182,20 @@ export class EpochsTestContext {
|
|
|
184
182
|
await this.context.teardown();
|
|
185
183
|
}
|
|
186
184
|
|
|
187
|
-
public async createProverNode() {
|
|
185
|
+
public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
|
|
188
186
|
this.logger.warn('Creating and syncing a simulated prover node...');
|
|
189
187
|
const proverNodePrivateKey = this.getNextPrivateKey();
|
|
190
188
|
const suffix = (this.proverNodes.length + 1).toString();
|
|
191
189
|
const proverNode = await withLogNameSuffix(suffix, () =>
|
|
192
190
|
createAndSyncProverNode(
|
|
193
191
|
proverNodePrivateKey,
|
|
194
|
-
{ ...this.context.config
|
|
195
|
-
{
|
|
192
|
+
{ ...this.context.config },
|
|
193
|
+
{
|
|
194
|
+
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
195
|
+
proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
|
|
196
|
+
dontStart: opts.dontStart,
|
|
197
|
+
...opts,
|
|
198
|
+
},
|
|
196
199
|
this.context.aztecNode,
|
|
197
200
|
undefined,
|
|
198
201
|
{ dateProvider: this.context.dateProvider },
|
|
@@ -349,7 +352,7 @@ export class EpochsTestContext {
|
|
|
349
352
|
publicKeys: undefined,
|
|
350
353
|
deployer: undefined,
|
|
351
354
|
});
|
|
352
|
-
await wallet.registerContract(
|
|
355
|
+
await wallet.registerContract(instance, SpamContract.artifact);
|
|
353
356
|
return SpamContract.at(instance.address, wallet);
|
|
354
357
|
}
|
|
355
358
|
|
|
@@ -424,7 +427,7 @@ export class EpochsTestContext {
|
|
|
424
427
|
sequencer.getSequencer().on(eventName, (args: Parameters<SequencerEvents[typeof eventName]>[0]) => {
|
|
425
428
|
const evt = makeEvent(i, eventName, args);
|
|
426
429
|
failEvents.push(evt);
|
|
427
|
-
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, evt);
|
|
430
|
+
this.logger.error(`Failed event ${eventName} from sequencer ${sequencerIndex}`, undefined, evt);
|
|
428
431
|
});
|
|
429
432
|
});
|
|
430
433
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr
|
|
1
|
+
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
3
4
|
import { Fq } from '@aztec/foundation/fields';
|
|
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 () => {
|
|
@@ -1,17 +1,11 @@
|
|
|
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
5
|
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
13
6
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
14
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
15
9
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
16
10
|
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
17
11
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
@@ -22,6 +16,7 @@ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
|
|
|
22
16
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
17
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
24
18
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
19
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
25
20
|
|
|
26
21
|
import { getContract } from 'viem';
|
|
27
22
|
|
|
@@ -56,17 +51,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
56
51
|
*/
|
|
57
52
|
export class FeesTest {
|
|
58
53
|
private snapshotManager: ISnapshotManager;
|
|
59
|
-
private wallets: AccountWallet[] = [];
|
|
60
54
|
private accounts: AztecAddress[] = [];
|
|
61
55
|
|
|
62
56
|
public logger: Logger;
|
|
63
|
-
public pxe!: PXE;
|
|
64
57
|
public aztecNode!: AztecNode;
|
|
65
58
|
public cheatCodes!: CheatCodes;
|
|
66
59
|
|
|
67
|
-
public
|
|
60
|
+
public wallet!: TestWallet;
|
|
68
61
|
public aliceAddress!: AztecAddress;
|
|
69
|
-
public bobWallet!: AccountWallet;
|
|
70
62
|
public bobAddress!: AztecAddress;
|
|
71
63
|
public sequencerAddress!: AztecAddress;
|
|
72
64
|
public coinbase!: EthAddress;
|
|
@@ -145,13 +137,14 @@ export class FeesTest {
|
|
|
145
137
|
|
|
146
138
|
async getBlockRewards() {
|
|
147
139
|
const blockReward = await this.rollupContract.getBlockReward();
|
|
140
|
+
const rewardConfig = await this.rollupContract.getRewardConfig();
|
|
148
141
|
|
|
149
142
|
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
150
|
-
|
|
143
|
+
EthAddress.fromString(rewardConfig.rewardDistributor),
|
|
151
144
|
);
|
|
152
145
|
|
|
153
146
|
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
154
|
-
const sequencerBlockRewards = toDistribute /
|
|
147
|
+
const sequencerBlockRewards = (toDistribute * BigInt(rewardConfig.sequencerBps)) / 10000n;
|
|
155
148
|
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
156
149
|
|
|
157
150
|
return { sequencerBlockRewards, proverBlockRewards };
|
|
@@ -172,7 +165,7 @@ export class FeesTest {
|
|
|
172
165
|
.balance_of_private(address)
|
|
173
166
|
.simulate({ from: this.aliceAddress });
|
|
174
167
|
|
|
175
|
-
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress,
|
|
168
|
+
await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, address, amount);
|
|
176
169
|
|
|
177
170
|
const balanceAfter = await this.bananaCoin.methods
|
|
178
171
|
.balance_of_private(address)
|
|
@@ -191,30 +184,27 @@ export class FeesTest {
|
|
|
191
184
|
await this.snapshotManager.snapshot(
|
|
192
185
|
'initial_accounts',
|
|
193
186
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
194
|
-
async ({ deployedAccounts }, {
|
|
195
|
-
this.
|
|
196
|
-
|
|
187
|
+
async ({ deployedAccounts }, { wallet, aztecNode, cheatCodes }) => {
|
|
188
|
+
this.wallet = wallet;
|
|
197
189
|
this.aztecNode = aztecNode;
|
|
198
190
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
199
|
-
this.cheatCodes =
|
|
200
|
-
this.
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
203
|
-
[this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
|
|
204
|
-
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
|
|
191
|
+
this.cheatCodes = cheatCodes;
|
|
192
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
193
|
+
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
194
|
+
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
205
195
|
|
|
206
196
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
207
197
|
this.fpcAdmin = this.aliceAddress;
|
|
208
198
|
|
|
209
199
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
210
|
-
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.
|
|
200
|
+
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.wallet);
|
|
211
201
|
},
|
|
212
202
|
);
|
|
213
203
|
}
|
|
214
204
|
|
|
215
205
|
async applyPublicDeployAccountsSnapshot() {
|
|
216
206
|
await this.snapshotManager.snapshot('public_deploy_accounts', () =>
|
|
217
|
-
ensureAccountContractsPublished(this.
|
|
207
|
+
ensureAccountContractsPublished(this.wallet, this.accounts),
|
|
218
208
|
);
|
|
219
209
|
}
|
|
220
210
|
|
|
@@ -225,7 +215,7 @@ export class FeesTest {
|
|
|
225
215
|
async (_data, context) => {
|
|
226
216
|
this.context = context;
|
|
227
217
|
|
|
228
|
-
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.
|
|
218
|
+
this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.wallet);
|
|
229
219
|
|
|
230
220
|
this.getGasBalanceFn = getBalancesFn(
|
|
231
221
|
'⛽',
|
|
@@ -237,9 +227,8 @@ export class FeesTest {
|
|
|
237
227
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
238
228
|
aztecNode: context.aztecNode,
|
|
239
229
|
aztecNodeAdmin: context.aztecNode,
|
|
240
|
-
pxeService: context.pxe,
|
|
241
230
|
l1Client: context.deployL1ContractsValues.l1Client,
|
|
242
|
-
wallet: this.
|
|
231
|
+
wallet: this.wallet,
|
|
243
232
|
logger: this.logger,
|
|
244
233
|
});
|
|
245
234
|
},
|
|
@@ -250,14 +239,14 @@ export class FeesTest {
|
|
|
250
239
|
await this.snapshotManager.snapshot(
|
|
251
240
|
'deploy_banana_token',
|
|
252
241
|
async () => {
|
|
253
|
-
const bananaCoin = await BananaCoin.deploy(this.
|
|
242
|
+
const bananaCoin = await BananaCoin.deploy(this.wallet, this.aliceAddress, 'BC', 'BC', 18n)
|
|
254
243
|
.send({ from: this.aliceAddress })
|
|
255
244
|
.deployed();
|
|
256
245
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
257
246
|
return { bananaCoinAddress: bananaCoin.address };
|
|
258
247
|
},
|
|
259
248
|
async ({ bananaCoinAddress }) => {
|
|
260
|
-
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.
|
|
249
|
+
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.wallet);
|
|
261
250
|
const logger = this.logger;
|
|
262
251
|
this.getBananaPublicBalanceFn = getBalancesFn(
|
|
263
252
|
'🍌.public',
|
|
@@ -280,10 +269,10 @@ export class FeesTest {
|
|
|
280
269
|
'fpc_setup',
|
|
281
270
|
async context => {
|
|
282
271
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
283
|
-
expect((await context.
|
|
272
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
284
273
|
|
|
285
274
|
const bananaCoin = this.bananaCoin;
|
|
286
|
-
const bananaFPC = await FPCContract.deploy(this.
|
|
275
|
+
const bananaFPC = await FPCContract.deploy(this.wallet, bananaCoin.address, this.fpcAdmin)
|
|
287
276
|
.send({ from: this.aliceAddress })
|
|
288
277
|
.deployed();
|
|
289
278
|
|
|
@@ -299,7 +288,7 @@ export class FeesTest {
|
|
|
299
288
|
};
|
|
300
289
|
},
|
|
301
290
|
async (data, context) => {
|
|
302
|
-
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.
|
|
291
|
+
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.wallet);
|
|
303
292
|
this.bananaFPC = bananaFPC;
|
|
304
293
|
|
|
305
294
|
this.getCoinbaseBalance = async () => {
|
|
@@ -317,7 +306,7 @@ export class FeesTest {
|
|
|
317
306
|
};
|
|
318
307
|
|
|
319
308
|
this.getProverFee = async (blockNumber: number) => {
|
|
320
|
-
const block = await this.
|
|
309
|
+
const block = await this.aztecNode.getBlock(blockNumber);
|
|
321
310
|
|
|
322
311
|
// @todo @lherskind As we deal with #13601
|
|
323
312
|
// Right now the value is from `FeeLib.sol`
|
|
@@ -348,9 +337,9 @@ export class FeesTest {
|
|
|
348
337
|
'sponsored_fpc_setup',
|
|
349
338
|
async context => {
|
|
350
339
|
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
351
|
-
expect((await context.
|
|
340
|
+
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
352
341
|
|
|
353
|
-
const sponsoredFPC = await setupSponsoredFPC(
|
|
342
|
+
const sponsoredFPC = await setupSponsoredFPC(this.wallet);
|
|
354
343
|
this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
|
|
355
344
|
|
|
356
345
|
return {
|
|
@@ -358,7 +347,7 @@ export class FeesTest {
|
|
|
358
347
|
};
|
|
359
348
|
},
|
|
360
349
|
async data => {
|
|
361
|
-
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.
|
|
350
|
+
this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.wallet);
|
|
362
351
|
},
|
|
363
352
|
);
|
|
364
353
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AztecAddress
|
|
2
|
-
import {
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { L2Block } from '@aztec/aztec.js/block';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { BatchedBlob, Blob, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
3
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
6
|
|
|
5
7
|
import { writeFile } from 'fs/promises';
|
|
@@ -32,18 +34,18 @@ export async function writeJson(
|
|
|
32
34
|
|
|
33
35
|
const jsonObject = {
|
|
34
36
|
populate: {
|
|
35
|
-
l1ToL2Content: l1ToL2Content.map(asHex),
|
|
37
|
+
l1ToL2Content: l1ToL2Content.map(value => asHex(value)),
|
|
36
38
|
recipient: asHex(recipientAddress.toField()),
|
|
37
39
|
sender: deployerAddress,
|
|
38
40
|
},
|
|
39
41
|
messages: {
|
|
40
|
-
l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(asHex),
|
|
42
|
+
l2ToL1Messages: block.body.txEffects.flatMap(txEffect => txEffect.l2ToL1Msgs).map(value => asHex(value)),
|
|
41
43
|
},
|
|
42
44
|
block: {
|
|
43
45
|
// The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
|
|
44
46
|
// This should not be a problem for testing as long as the values are not larger than u32.
|
|
45
47
|
archive: asHex(block.archive.root),
|
|
46
|
-
blobCommitments:
|
|
48
|
+
blobCommitments: getPrefixedEthBlobCommitments(blobs),
|
|
47
49
|
batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
|
|
48
50
|
blockNumber: block.number,
|
|
49
51
|
body: `0x${block.body.toBuffer().toString('hex')}`,
|
|
@@ -64,7 +66,7 @@ export async function writeJson(
|
|
|
64
66
|
},
|
|
65
67
|
totalManaUsed: block.header.totalManaUsed.toNumber(),
|
|
66
68
|
},
|
|
67
|
-
headerHash: asHex(block.
|
|
69
|
+
headerHash: asHex(block.getCheckpointHeader().hash()),
|
|
68
70
|
numTxs: block.body.txEffects.length,
|
|
69
71
|
},
|
|
70
72
|
};
|