@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c
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 +60 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -27
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -43
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -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 +66 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
- 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 +34 -53
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -6
- package/dest/e2e_epochs/epochs_test.d.ts +56 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +222 -42
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts +16 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +87 -88
- package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
- 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 +132 -0
- package/dest/e2e_p2p/p2p_network.d.ts +56 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +154 -125
- package/dest/e2e_p2p/shared.d.ts +41 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +146 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +51 -24
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +8 -15
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +14 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +8 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +120 -104
- package/dest/fixtures/token_utils.d.ts +4 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +24 -7
- package/dest/fixtures/utils.d.ts +65 -22
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +439 -318
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +42 -0
- package/dest/shared/cross_chain_test_harness.d.ts +28 -18
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +97 -41
- package/dest/shared/gas_portal_test_harness.d.ts +23 -18
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +43 -25
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +5 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +136 -90
- package/dest/simulators/lending_simulator.d.ts +5 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +11 -15
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -22
- package/dest/spartan/utils.d.ts +60 -307
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +200 -115
- package/package.json +60 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +26 -52
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
- package/src/e2e_deploy_contract/deploy_test.ts +11 -8
- package/src/e2e_epochs/epochs_test.ts +276 -54
- package/src/e2e_fees/bridging_race.notest.ts +75 -0
- package/src/e2e_fees/fees_test.ts +121 -108
- package/src/e2e_l1_publisher/write_json.ts +74 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
- package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
- package/src/e2e_p2p/p2p_network.ts +212 -144
- package/src/e2e_p2p/shared.ts +234 -14
- package/src/e2e_token_contract/token_contract_test.ts +42 -38
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +2 -10
- package/src/fixtures/get_bb_config.ts +15 -11
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +5 -6
- package/src/fixtures/setup_p2p_test.ts +112 -30
- package/src/fixtures/snapshot_manager.ts +150 -102
- package/src/fixtures/token_utils.ts +33 -8
- package/src/fixtures/utils.ts +530 -352
- package/src/fixtures/web3signer.ts +46 -0
- package/src/guides/up_quick_start.sh +4 -4
- package/src/shared/cross_chain_test_harness.ts +92 -52
- package/src/shared/gas_portal_test_harness.ts +47 -31
- package/src/shared/uniswap_l1_l2.ts +127 -124
- package/src/simulators/lending_simulator.ts +11 -15
- package/src/simulators/token_simulator.ts +17 -12
- package/src/spartan/DEVELOP.md +116 -0
- package/src/spartan/setup_test_wallets.ts +144 -29
- package/src/spartan/utils.ts +194 -116
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -8,39 +8,45 @@ import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
|
8
8
|
import {
|
|
9
9
|
type AccountWalletWithSecretKey,
|
|
10
10
|
type AztecNode,
|
|
11
|
-
type CheatCodes,
|
|
12
11
|
type CompleteAddress,
|
|
13
|
-
type DeployL1ContractsReturnType,
|
|
14
12
|
EthAddress,
|
|
15
13
|
type Logger,
|
|
16
14
|
type PXE,
|
|
17
15
|
createLogger,
|
|
18
|
-
deployL1Contract,
|
|
19
16
|
} from '@aztec/aztec.js';
|
|
20
|
-
import {
|
|
17
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
18
|
+
import {
|
|
19
|
+
BBCircuitVerifier,
|
|
20
|
+
type ClientProtocolCircuitVerifier,
|
|
21
|
+
QueuedIVCVerifier,
|
|
22
|
+
TestCircuitVerifier,
|
|
23
|
+
} from '@aztec/bb-prover';
|
|
21
24
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
22
25
|
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
26
|
+
import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
23
27
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
24
|
-
import {
|
|
28
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
29
|
+
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
25
30
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
26
31
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
27
32
|
import type { PXEService } from '@aztec/pxe/server';
|
|
33
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
28
34
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
29
35
|
|
|
30
36
|
import { type Hex, getContract } from 'viem';
|
|
31
37
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
32
38
|
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
39
|
+
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
40
|
+
import { getACVMConfig } from './get_acvm_config.js';
|
|
41
|
+
import { getBBConfig } from './get_bb_config.js';
|
|
35
42
|
import {
|
|
36
43
|
type ISnapshotManager,
|
|
37
44
|
type SubsystemsContext,
|
|
38
45
|
createSnapshotManager,
|
|
39
46
|
deployAccounts,
|
|
40
47
|
publicDeployAccounts,
|
|
41
|
-
} from '
|
|
42
|
-
import { getPrivateKeyFromIndex, setupPXEService } from '
|
|
43
|
-
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
48
|
+
} from './snapshot_manager.js';
|
|
49
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEService } from './utils.js';
|
|
44
50
|
|
|
45
51
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
46
52
|
|
|
@@ -68,6 +74,7 @@ export class FullProverTest {
|
|
|
68
74
|
fakeProofsAsset!: TokenContract;
|
|
69
75
|
tokenSim!: TokenSimulator;
|
|
70
76
|
aztecNode!: AztecNode;
|
|
77
|
+
aztecNodeAdmin!: AztecNodeAdmin;
|
|
71
78
|
pxe!: PXEService;
|
|
72
79
|
cheatCodes!: CheatCodes;
|
|
73
80
|
blobSink!: BlobSinkServer;
|
|
@@ -93,7 +100,9 @@ export class FullProverTest {
|
|
|
93
100
|
`full_prover_integration/${testName}`,
|
|
94
101
|
dataPath,
|
|
95
102
|
{ startProverNode: true, fundRewardDistributor: true, coinbase },
|
|
96
|
-
{
|
|
103
|
+
{
|
|
104
|
+
realVerifier: realProofs,
|
|
105
|
+
},
|
|
97
106
|
);
|
|
98
107
|
}
|
|
99
108
|
|
|
@@ -122,7 +131,7 @@ export class FullProverTest {
|
|
|
122
131
|
// Create the token contract state.
|
|
123
132
|
// Move this account thing to addAccounts above?
|
|
124
133
|
this.logger.verbose(`Public deploy accounts...`);
|
|
125
|
-
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2)
|
|
134
|
+
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2));
|
|
126
135
|
|
|
127
136
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
128
137
|
const asset = await TokenContract.deploy(
|
|
@@ -132,7 +141,7 @@ export class FullProverTest {
|
|
|
132
141
|
FullProverTest.TOKEN_SYMBOL,
|
|
133
142
|
FullProverTest.TOKEN_DECIMALS,
|
|
134
143
|
)
|
|
135
|
-
.send()
|
|
144
|
+
.send({ from: this.wallets[0].getAddress() })
|
|
136
145
|
.deployed();
|
|
137
146
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
138
147
|
|
|
@@ -146,11 +155,14 @@ export class FullProverTest {
|
|
|
146
155
|
this.tokenSim = new TokenSimulator(
|
|
147
156
|
this.fakeProofsAsset,
|
|
148
157
|
this.wallets[0],
|
|
158
|
+
this.wallets[0].getAddress(),
|
|
149
159
|
this.logger,
|
|
150
160
|
this.accounts.map(a => a.address),
|
|
151
161
|
);
|
|
152
162
|
|
|
153
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate(
|
|
163
|
+
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0].address })).toBe(
|
|
164
|
+
this.accounts[0].address.toBigInt(),
|
|
165
|
+
);
|
|
154
166
|
},
|
|
155
167
|
);
|
|
156
168
|
}
|
|
@@ -169,6 +181,7 @@ export class FullProverTest {
|
|
|
169
181
|
cheatCodes: this.cheatCodes,
|
|
170
182
|
blobSink: this.blobSink,
|
|
171
183
|
} = this.context);
|
|
184
|
+
this.aztecNodeAdmin = this.context.aztecNode;
|
|
172
185
|
|
|
173
186
|
const blobSinkClient = createBlobSinkClient({ blobSinkUrl: `http://localhost:${this.blobSink.port}` });
|
|
174
187
|
|
|
@@ -188,17 +201,18 @@ export class FullProverTest {
|
|
|
188
201
|
throw new Error(`Test must be run with BB native configuration`);
|
|
189
202
|
}
|
|
190
203
|
|
|
191
|
-
|
|
204
|
+
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
205
|
+
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
192
206
|
|
|
193
207
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
194
|
-
await this.
|
|
208
|
+
await this.aztecNodeAdmin.setConfig({
|
|
195
209
|
realProofs: true,
|
|
196
210
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
197
211
|
});
|
|
198
212
|
} else {
|
|
199
213
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
200
214
|
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
201
|
-
await this.
|
|
215
|
+
await this.aztecNodeAdmin.setConfig({
|
|
202
216
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
203
217
|
});
|
|
204
218
|
}
|
|
@@ -265,7 +279,7 @@ export class FullProverTest {
|
|
|
265
279
|
this.logger.verbose('Starting archiver for new prover node');
|
|
266
280
|
const archiver = await createArchiver(
|
|
267
281
|
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
268
|
-
blobSinkClient,
|
|
282
|
+
{ blobSinkClient },
|
|
269
283
|
{ blockUntilSync: true },
|
|
270
284
|
);
|
|
271
285
|
|
|
@@ -275,25 +289,31 @@ export class FullProverTest {
|
|
|
275
289
|
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
276
290
|
|
|
277
291
|
this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
|
|
278
|
-
await this.
|
|
292
|
+
await this.mintFeeJuice(proverNodeSenderAddress);
|
|
279
293
|
|
|
280
294
|
this.logger.verbose('Starting prover node');
|
|
281
295
|
const proverConfig: ProverNodeConfig = {
|
|
282
296
|
...this.context.aztecNodeConfig,
|
|
283
|
-
|
|
297
|
+
txCollectionNodeRpcUrls: [],
|
|
284
298
|
dataDirectory: undefined,
|
|
285
|
-
proverId: this.proverAddress
|
|
299
|
+
proverId: this.proverAddress,
|
|
286
300
|
realProofs: this.realProofs,
|
|
287
301
|
proverAgentCount: 2,
|
|
288
|
-
|
|
302
|
+
publisherPrivateKeys: [new SecretValue(`0x${proverNodePrivateKey!.toString('hex')}` as const)],
|
|
289
303
|
proverNodeMaxPendingJobs: 100,
|
|
290
304
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
291
305
|
proverNodePollingIntervalMs: 100,
|
|
292
|
-
txGatheringTimeoutMs: 60000,
|
|
293
306
|
txGatheringIntervalMs: 1000,
|
|
294
|
-
|
|
307
|
+
txGatheringBatchSize: 10,
|
|
308
|
+
txGatheringMaxParallelRequestsPerNode: 100,
|
|
309
|
+
txGatheringTimeoutMs: 24_000,
|
|
310
|
+
proverNodeFailedEpochStore: undefined,
|
|
311
|
+
proverNodeEpochProvingDelayMs: undefined,
|
|
295
312
|
};
|
|
296
|
-
const
|
|
313
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
314
|
+
const { prefilledPublicData } = await getGenesisValues(
|
|
315
|
+
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
316
|
+
);
|
|
297
317
|
this.proverNode = await createProverNode(
|
|
298
318
|
proverConfig,
|
|
299
319
|
{
|
|
@@ -303,18 +323,19 @@ export class FullProverTest {
|
|
|
303
323
|
},
|
|
304
324
|
{ prefilledPublicData },
|
|
305
325
|
);
|
|
306
|
-
this.proverNode.start();
|
|
326
|
+
await this.proverNode.start();
|
|
307
327
|
|
|
308
328
|
this.logger.warn(`Proofs are now enabled`);
|
|
309
329
|
return this;
|
|
310
330
|
}
|
|
311
331
|
|
|
312
|
-
private async
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
await
|
|
332
|
+
private async mintFeeJuice(recipient: Hex) {
|
|
333
|
+
const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress!;
|
|
334
|
+
this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
|
|
335
|
+
const client = this.context.deployL1ContractsValues.l1Client;
|
|
336
|
+
const handler = getContract({ abi: FeeAssetHandlerAbi, address: handlerAddress.toString(), client });
|
|
337
|
+
const hash = await handler.write.mint([recipient]);
|
|
338
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
|
|
318
339
|
}
|
|
319
340
|
|
|
320
341
|
snapshot = <T>(
|
|
@@ -346,16 +367,17 @@ export class FullProverTest {
|
|
|
346
367
|
const privateAmount = 10000n;
|
|
347
368
|
const publicAmount = 10000n;
|
|
348
369
|
|
|
349
|
-
const waitOpts = { proven: false };
|
|
350
|
-
|
|
351
370
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
352
371
|
await asset.methods
|
|
353
372
|
.mint_to_public(accounts[0].address, privateAmount + publicAmount)
|
|
354
|
-
.send()
|
|
355
|
-
.wait(
|
|
373
|
+
.send({ from: accounts[0].address })
|
|
374
|
+
.wait();
|
|
356
375
|
|
|
357
376
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
358
|
-
await asset.methods
|
|
377
|
+
await asset.methods
|
|
378
|
+
.transfer_to_private(accounts[0].address, privateAmount)
|
|
379
|
+
.send({ from: accounts[0].address })
|
|
380
|
+
.wait();
|
|
359
381
|
|
|
360
382
|
this.logger.verbose(`Minting complete.`);
|
|
361
383
|
|
|
@@ -369,16 +391,16 @@ export class FullProverTest {
|
|
|
369
391
|
} = this;
|
|
370
392
|
tokenSim.mintPublic(address, amount);
|
|
371
393
|
|
|
372
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate();
|
|
394
|
+
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
373
395
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
374
396
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
375
397
|
|
|
376
398
|
tokenSim.mintPrivate(address, amount);
|
|
377
|
-
const privateBalance = await asset.methods.balance_of_private(address).simulate();
|
|
399
|
+
const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
|
|
378
400
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
379
401
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
380
402
|
|
|
381
|
-
const totalSupply = await asset.methods.total_supply().simulate();
|
|
403
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: address });
|
|
382
404
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
383
405
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
384
406
|
|
|
@@ -386,33 +408,4 @@ export class FullProverTest {
|
|
|
386
408
|
},
|
|
387
409
|
);
|
|
388
410
|
}
|
|
389
|
-
|
|
390
|
-
async deployVerifier() {
|
|
391
|
-
if (!this.realProofs) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
if (!this.circuitProofVerifier) {
|
|
396
|
-
throw new Error('No verifier');
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
const { walletClient, publicClient, l1ContractAddresses } = this.context.deployL1ContractsValues;
|
|
400
|
-
const rollup = getContract({
|
|
401
|
-
abi: RollupAbi,
|
|
402
|
-
address: l1ContractAddresses.rollupAddress.toString(),
|
|
403
|
-
client: walletClient,
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
const { address: verifierAddress } = await deployL1Contract(
|
|
407
|
-
walletClient,
|
|
408
|
-
publicClient,
|
|
409
|
-
HonkVerifierAbi,
|
|
410
|
-
HonkVerifierBytecode,
|
|
411
|
-
);
|
|
412
|
-
this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
|
|
413
|
-
|
|
414
|
-
await rollup.write.setEpochVerifier([verifierAddress.toString()]);
|
|
415
|
-
|
|
416
|
-
this.logger.info('Rollup only accepts valid proofs now');
|
|
417
|
-
}
|
|
418
411
|
}
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -8,17 +8,18 @@ export const shouldCollectMetrics = () => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
11
|
+
export const TEST_MAX_TX_POOL_SIZE = 2 * 1024 * 1024 * 1024; // 2GB
|
|
11
12
|
|
|
12
13
|
export const MNEMONIC = 'test test test test test test test test test test test junk';
|
|
13
14
|
export const privateKey = Buffer.from('ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', 'hex');
|
|
14
15
|
export const privateKey2 = Buffer.from('59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', 'hex');
|
|
15
16
|
|
|
16
17
|
/// Common errors
|
|
17
|
-
export const U128_UNDERFLOW_ERROR =
|
|
18
|
-
export const U128_OVERFLOW_ERROR =
|
|
18
|
+
export const U128_UNDERFLOW_ERROR = 'Assertion failed: attempt to subtract with overflow';
|
|
19
|
+
export const U128_OVERFLOW_ERROR = 'Assertion failed: attempt to add with overflow';
|
|
19
20
|
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
|
|
20
21
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
|
|
21
|
-
export const DUPLICATE_NULLIFIER_ERROR = /dropped|
|
|
22
|
+
export const DUPLICATE_NULLIFIER_ERROR = /dropped|nullifier|reverted/i;
|
|
22
23
|
export const NO_L1_TO_L2_MSG_ERROR =
|
|
23
24
|
/No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
|
|
24
25
|
export const STATIC_CALL_STATE_MODIFICATION_ERROR =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/aztec.js';
|
|
2
2
|
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
3
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
4
|
+
import { tryRmDir } from '@aztec/foundation/fs';
|
|
4
5
|
|
|
5
6
|
import { promises as fs } from 'fs';
|
|
6
7
|
|
|
@@ -36,16 +37,7 @@ export async function getACVMConfig(logger: Logger): Promise<
|
|
|
36
37
|
|
|
37
38
|
const directoryToCleanup = ACVM_WORKING_DIRECTORY ? undefined : tempWorkingDirectory;
|
|
38
39
|
|
|
39
|
-
const cleanup =
|
|
40
|
-
if (directoryToCleanup) {
|
|
41
|
-
try {
|
|
42
|
-
logger.info(`Cleaning up ACVM temp directory ${directoryToCleanup}`);
|
|
43
|
-
await fs.rm(directoryToCleanup, { recursive: true, force: true, maxRetries: 3 });
|
|
44
|
-
} catch (err) {
|
|
45
|
-
logger.warn(`Failed to delete ACVM temp directory at ${directoryToCleanup}: ${err}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
40
|
+
const cleanup = () => tryRmDir(directoryToCleanup, logger);
|
|
49
41
|
|
|
50
42
|
return {
|
|
51
43
|
acvmWorkingDirectory,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Logger, fileURLToPath } from '@aztec/aztec.js';
|
|
2
2
|
import type { BBConfig } from '@aztec/bb-prover';
|
|
3
|
+
import { tryRmDir } from '@aztec/foundation/fs';
|
|
3
4
|
|
|
4
5
|
import fs from 'node:fs/promises';
|
|
5
6
|
import { tmpdir } from 'node:os';
|
|
@@ -11,6 +12,8 @@ const {
|
|
|
11
12
|
BB_SKIP_CLEANUP = '',
|
|
12
13
|
TEMP_DIR = tmpdir(),
|
|
13
14
|
BB_WORKING_DIRECTORY = '',
|
|
15
|
+
BB_NUM_IVC_VERIFIERS = '1',
|
|
16
|
+
BB_IVC_CONCURRENCY = '1',
|
|
14
17
|
} = process.env;
|
|
15
18
|
|
|
16
19
|
export const getBBConfig = async (
|
|
@@ -35,18 +38,19 @@ export const getBBConfig = async (
|
|
|
35
38
|
await fs.mkdir(bbWorkingDirectory, { recursive: true });
|
|
36
39
|
|
|
37
40
|
const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
|
|
42
|
+
|
|
43
|
+
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
44
|
+
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
bbSkipCleanup,
|
|
48
|
+
bbBinaryPath,
|
|
49
|
+
bbWorkingDirectory,
|
|
50
|
+
cleanup,
|
|
51
|
+
numConcurrentIVCVerifiers: numIvcVerifiers,
|
|
52
|
+
bbIVCConcurrency: ivcConcurrency,
|
|
47
53
|
};
|
|
48
|
-
|
|
49
|
-
return { bbSkipCleanup, bbBinaryPath, bbWorkingDirectory, cleanup };
|
|
50
54
|
} catch (err) {
|
|
51
55
|
logger.error(`Native BB not available, error: ${err}`);
|
|
52
56
|
return undefined;
|
|
@@ -1,50 +1,80 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { tryJsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
4
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
|
|
6
|
-
import { expect } from '@jest/globals';
|
|
7
7
|
import { decodeEventLog, getContract } from 'viem';
|
|
8
8
|
|
|
9
|
+
import { getLogger } from './utils.js';
|
|
10
|
+
|
|
9
11
|
export async function sendL1ToL2Message(
|
|
10
12
|
message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
|
|
11
13
|
ctx: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress'>;
|
|
14
|
+
l1Client: ExtendedViemWalletClient;
|
|
15
|
+
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
15
16
|
},
|
|
16
17
|
) {
|
|
18
|
+
const logger = getLogger();
|
|
17
19
|
const inbox = getContract({
|
|
18
20
|
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
19
21
|
abi: InboxAbi,
|
|
20
|
-
client: ctx.
|
|
22
|
+
client: ctx.l1Client,
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
const { recipient, content, secretHash } = message;
|
|
24
|
-
|
|
26
|
+
|
|
27
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
25
28
|
|
|
26
29
|
// We inject the message to Inbox
|
|
27
|
-
const txHash = await inbox.write.sendL2Message(
|
|
28
|
-
{ actor: recipient.toString(), version: BigInt(version) },
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const txHash = await inbox.write.sendL2Message(
|
|
31
|
+
[{ actor: recipient.toString(), version: BigInt(version) }, content.toString(), secretHash.toString()],
|
|
32
|
+
{
|
|
33
|
+
gas: 1_000_000n,
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
logger.info(`L1 to L2 message sent in tx ${txHash}`);
|
|
32
37
|
|
|
33
38
|
// We check that the message was correctly injected by checking the emitted event
|
|
34
|
-
const txReceipt = await ctx.
|
|
39
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
if (txReceipt.status !== 'success') {
|
|
42
|
+
throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
|
|
43
|
+
}
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
|
|
46
|
+
|
|
47
|
+
if (txReceipt.transactionHash !== txHash) {
|
|
48
|
+
throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Filter for MessageSent events from the Inbox contract by trying to decode each log
|
|
52
|
+
const messageSentLogs = txReceipt.logs
|
|
53
|
+
.filter(log => log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase())
|
|
54
|
+
.map(log => {
|
|
55
|
+
try {
|
|
56
|
+
const decoded = decodeEventLog({
|
|
57
|
+
abi: InboxAbi,
|
|
58
|
+
data: log.data,
|
|
59
|
+
topics: log.topics,
|
|
60
|
+
});
|
|
61
|
+
return { log, decoded };
|
|
62
|
+
} catch {
|
|
63
|
+
return null; // Not a decodable event from this ABI
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.filter((item): item is { log: any; decoded: any } => item !== null && item.decoded.eventName === 'MessageSent');
|
|
67
|
+
|
|
68
|
+
if (messageSentLogs.length !== 1) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map(item => item.log))}`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// We already have the decoded event
|
|
75
|
+
const topics = messageSentLogs[0].decoded;
|
|
46
76
|
const receivedMsgHash = topics.args.hash;
|
|
47
77
|
const receivedGlobalLeafIndex = topics.args.index;
|
|
48
78
|
|
|
49
|
-
return
|
|
79
|
+
return { msgHash: Fr.fromHexString(receivedMsgHash), globalLeafIndex: new Fr(receivedGlobalLeafIndex), txReceipt };
|
|
50
80
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
+
import { type DeployL1ContractsArgs, type L1ContractsConfig, deployL1Contracts } from '@aztec/ethereum';
|
|
3
3
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
-
import {
|
|
4
|
+
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
5
5
|
|
|
6
6
|
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
7
7
|
import { foundry } from 'viem/chains';
|
|
@@ -12,14 +12,13 @@ export const setupL1Contracts = async (
|
|
|
12
12
|
l1RpcUrl: string,
|
|
13
13
|
account: HDAccount | PrivateKeyAccount,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | '
|
|
16
|
-
L1ContractsConfig,
|
|
15
|
+
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'initialValidators'> & L1ContractsConfig,
|
|
17
16
|
) => {
|
|
18
17
|
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
20
18
|
vkTreeRoot: getVKTreeRoot(),
|
|
21
19
|
protocolContractTreeRoot,
|
|
22
20
|
salt: undefined,
|
|
21
|
+
realVerifier: false,
|
|
23
22
|
...args,
|
|
24
23
|
});
|
|
25
24
|
|