@aztec/end-to-end 0.0.0-test.0 → 0.0.1-commit.03f7ef2
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 +61 -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 +80 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +336 -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 +77 -0
- package/dest/bench/utils.d.ts +12 -38
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +26 -66
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +21 -13
- 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 +85 -57
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +20 -25
- 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 +51 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +16 -8
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +13 -19
- package/dest/e2e_epochs/epochs_test.d.ts +65 -22
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +233 -49
- 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 +63 -0
- package/dest/e2e_fees/fees_test.d.ts +27 -12
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +106 -109
- package/dest/e2e_l1_publisher/write_json.d.ts +10 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +58 -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 +10 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +24 -20
- 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 +276 -23
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +188 -133
- package/dest/e2e_p2p/shared.d.ts +43 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +164 -19
- package/dest/e2e_token_contract/token_contract_test.d.ts +12 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +50 -26
- package/dest/fixtures/e2e_prover_test.d.ts +61 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +108 -112
- package/dest/fixtures/fixtures.d.ts +6 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +5 -5
- 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 +3 -15
- 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 +10 -17
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +45 -19
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts +15 -14
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +82 -22
- package/dest/fixtures/snapshot_manager.d.ts +20 -14
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +154 -140
- package/dest/fixtures/token_utils.d.ts +10 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +28 -12
- package/dest/fixtures/utils.d.ts +95 -54
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +456 -389
- 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 +42 -35
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +104 -50
- package/dest/shared/gas_portal_test_harness.d.ts +29 -31
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +51 -30
- 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 +16 -13
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +149 -117
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +7 -11
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +16 -17
- package/dest/simulators/token_simulator.d.ts +6 -3
- 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 +26 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +202 -58
- 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 +129 -313
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +559 -151
- package/package.json +65 -58
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +450 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +22 -76
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +80 -77
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +70 -107
- package/src/e2e_deploy_contract/deploy_test.ts +24 -39
- package/src/e2e_epochs/epochs_test.ts +299 -65
- package/src/e2e_fees/bridging_race.notest.ts +80 -0
- package/src/e2e_fees/fees_test.ts +151 -141
- package/src/e2e_l1_publisher/write_json.ts +77 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +29 -19
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +274 -171
- package/src/e2e_p2p/shared.ts +251 -29
- package/src/e2e_token_contract/token_contract_test.ts +43 -39
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +113 -160
- package/src/fixtures/fixtures.ts +5 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/setup_p2p_test.ts +127 -39
- package/src/fixtures/snapshot_manager.ts +196 -162
- package/src/fixtures/token_utils.ts +32 -15
- package/src/fixtures/utils.ts +562 -475
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +7 -15
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +112 -80
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +187 -192
- package/src/simulators/lending_simulator.ts +15 -16
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +252 -93
- package/src/spartan/tx_metrics.ts +130 -0
- package/src/spartan/utils.ts +641 -146
- package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/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/fixtures/setup_l1_contracts.ts +0 -27
- 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
|
@@ -1,51 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SchnorrAccountContractArtifact,
|
|
3
|
-
getSchnorrAccount,
|
|
4
|
-
getSchnorrWalletWithSecretKey,
|
|
5
|
-
} from '@aztec/accounts/schnorr';
|
|
6
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
7
2
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
3
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
7
|
import {
|
|
9
|
-
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
createLogger,
|
|
18
|
-
deployL1Contract,
|
|
19
|
-
} from '@aztec/aztec.js';
|
|
20
|
-
import { BBCircuitVerifier, type ClientProtocolCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
21
|
-
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
22
|
-
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
8
|
+
BBCircuitVerifier,
|
|
9
|
+
type ClientProtocolCircuitVerifier,
|
|
10
|
+
QueuedIVCVerifier,
|
|
11
|
+
TestCircuitVerifier,
|
|
12
|
+
} from '@aztec/bb-prover';
|
|
13
|
+
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
15
|
+
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
23
16
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
24
|
-
import {
|
|
17
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
18
|
+
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
25
19
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
26
20
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
27
|
-
import type {
|
|
21
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
22
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
28
24
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
29
25
|
|
|
30
26
|
import { type Hex, getContract } from 'viem';
|
|
31
27
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
32
28
|
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
29
|
+
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
30
|
+
import { getACVMConfig } from './get_acvm_config.js';
|
|
31
|
+
import { getBBConfig } from './get_bb_config.js';
|
|
35
32
|
import {
|
|
36
33
|
type ISnapshotManager,
|
|
37
34
|
type SubsystemsContext,
|
|
38
35
|
createSnapshotManager,
|
|
39
36
|
deployAccounts,
|
|
40
37
|
publicDeployAccounts,
|
|
41
|
-
} from '
|
|
42
|
-
import { getPrivateKeyFromIndex,
|
|
43
|
-
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
38
|
+
} from './snapshot_manager.js';
|
|
39
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
|
|
44
40
|
|
|
45
41
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
46
42
|
|
|
47
43
|
type ProvenSetup = {
|
|
48
|
-
|
|
44
|
+
wallet: TestWallet;
|
|
49
45
|
teardown: () => Promise<void>;
|
|
50
46
|
};
|
|
51
47
|
|
|
@@ -62,24 +58,25 @@ export class FullProverTest {
|
|
|
62
58
|
static TOKEN_DECIMALS = 18n;
|
|
63
59
|
private snapshotManager: ISnapshotManager;
|
|
64
60
|
logger: Logger;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
accounts:
|
|
61
|
+
wallet!: TestWallet;
|
|
62
|
+
provenWallet!: TestWallet;
|
|
63
|
+
accounts: AztecAddress[] = [];
|
|
64
|
+
deployedAccounts!: InitialAccountData[];
|
|
68
65
|
fakeProofsAsset!: TokenContract;
|
|
66
|
+
fakeProofsAssetInstance!: ContractInstanceWithAddress;
|
|
69
67
|
tokenSim!: TokenSimulator;
|
|
70
68
|
aztecNode!: AztecNode;
|
|
71
|
-
|
|
69
|
+
aztecNodeAdmin!: AztecNodeAdmin;
|
|
72
70
|
cheatCodes!: CheatCodes;
|
|
73
|
-
blobSink!: BlobSinkServer;
|
|
74
71
|
private provenComponents: ProvenSetup[] = [];
|
|
75
72
|
private bbConfigCleanup?: () => Promise<void>;
|
|
76
73
|
private acvmConfigCleanup?: () => Promise<void>;
|
|
77
74
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
78
|
-
|
|
75
|
+
provenAsset!: TokenContract;
|
|
79
76
|
private context!: SubsystemsContext;
|
|
80
77
|
private proverNode!: ProverNode;
|
|
81
78
|
private simulatedProverNode!: ProverNode;
|
|
82
|
-
public l1Contracts!:
|
|
79
|
+
public l1Contracts!: DeployAztecL1ContractsReturnType;
|
|
83
80
|
public proverAddress!: EthAddress;
|
|
84
81
|
|
|
85
82
|
constructor(
|
|
@@ -92,8 +89,10 @@ export class FullProverTest {
|
|
|
92
89
|
this.snapshotManager = createSnapshotManager(
|
|
93
90
|
`full_prover_integration/${testName}`,
|
|
94
91
|
dataPath,
|
|
95
|
-
{ startProverNode: true,
|
|
96
|
-
{
|
|
92
|
+
{ startProverNode: true, coinbase },
|
|
93
|
+
{
|
|
94
|
+
realVerifier: realProofs,
|
|
95
|
+
},
|
|
97
96
|
);
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -106,13 +105,11 @@ export class FullProverTest {
|
|
|
106
105
|
await this.snapshotManager.snapshot(
|
|
107
106
|
'2_accounts',
|
|
108
107
|
deployAccounts(2, this.logger),
|
|
109
|
-
|
|
108
|
+
({ deployedAccounts }, { wallet }) => {
|
|
110
109
|
this.deployedAccounts = deployedAccounts;
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
);
|
|
114
|
-
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
115
|
-
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
110
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
111
|
+
this.wallet = wallet;
|
|
112
|
+
return Promise.resolve();
|
|
116
113
|
},
|
|
117
114
|
);
|
|
118
115
|
|
|
@@ -122,35 +119,39 @@ export class FullProverTest {
|
|
|
122
119
|
// Create the token contract state.
|
|
123
120
|
// Move this account thing to addAccounts above?
|
|
124
121
|
this.logger.verbose(`Public deploy accounts...`);
|
|
125
|
-
await publicDeployAccounts(this.
|
|
122
|
+
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
126
123
|
|
|
127
124
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
128
|
-
const asset = await TokenContract.deploy(
|
|
129
|
-
this.
|
|
125
|
+
const { contract: asset, instance } = await TokenContract.deploy(
|
|
126
|
+
this.wallet,
|
|
130
127
|
this.accounts[0],
|
|
131
128
|
FullProverTest.TOKEN_NAME,
|
|
132
129
|
FullProverTest.TOKEN_SYMBOL,
|
|
133
130
|
FullProverTest.TOKEN_DECIMALS,
|
|
134
131
|
)
|
|
135
|
-
.send()
|
|
136
|
-
.
|
|
132
|
+
.send({ from: this.accounts[0] })
|
|
133
|
+
.wait();
|
|
137
134
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
138
135
|
|
|
139
|
-
return { tokenContractAddress: asset.address };
|
|
136
|
+
return { tokenContractAddress: asset.address, tokenContractInstance: instance };
|
|
140
137
|
},
|
|
141
|
-
async ({ tokenContractAddress }) => {
|
|
138
|
+
async ({ tokenContractAddress, tokenContractInstance }) => {
|
|
142
139
|
// Restore the token contract state.
|
|
143
|
-
this.fakeProofsAsset =
|
|
140
|
+
this.fakeProofsAsset = TokenContract.at(tokenContractAddress, this.wallet);
|
|
141
|
+
this.fakeProofsAssetInstance = tokenContractInstance;
|
|
144
142
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
145
143
|
|
|
146
144
|
this.tokenSim = new TokenSimulator(
|
|
147
145
|
this.fakeProofsAsset,
|
|
148
|
-
this.
|
|
146
|
+
this.wallet,
|
|
147
|
+
this.accounts[0],
|
|
149
148
|
this.logger,
|
|
150
|
-
this.accounts
|
|
149
|
+
this.accounts,
|
|
151
150
|
);
|
|
152
151
|
|
|
153
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate(
|
|
152
|
+
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
|
|
153
|
+
this.accounts[0].toBigInt(),
|
|
154
|
+
);
|
|
154
155
|
},
|
|
155
156
|
);
|
|
156
157
|
}
|
|
@@ -163,14 +164,14 @@ export class FullProverTest {
|
|
|
163
164
|
|
|
164
165
|
this.simulatedProverNode = this.context.proverNode!;
|
|
165
166
|
({
|
|
166
|
-
pxe: this.pxe,
|
|
167
167
|
aztecNode: this.aztecNode,
|
|
168
168
|
deployL1ContractsValues: this.l1Contracts,
|
|
169
169
|
cheatCodes: this.cheatCodes,
|
|
170
|
-
blobSink: this.blobSink,
|
|
171
170
|
} = this.context);
|
|
171
|
+
this.aztecNodeAdmin = this.context.aztecNode;
|
|
172
172
|
|
|
173
|
-
const
|
|
173
|
+
const config = this.context.aztecNodeConfig;
|
|
174
|
+
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
174
175
|
|
|
175
176
|
// Configure a full prover PXE
|
|
176
177
|
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
|
|
@@ -184,21 +185,20 @@ export class FullProverTest {
|
|
|
184
185
|
this.acvmConfigCleanup = acvmConfig.cleanup;
|
|
185
186
|
this.bbConfigCleanup = bbConfig.cleanup;
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
throw new Error(`Test must be run with BB native configuration`);
|
|
189
|
-
}
|
|
188
|
+
await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
|
|
190
189
|
|
|
191
|
-
|
|
190
|
+
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
191
|
+
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
192
192
|
|
|
193
193
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
194
|
-
await this.
|
|
194
|
+
await this.aztecNodeAdmin.setConfig({
|
|
195
195
|
realProofs: true,
|
|
196
196
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
197
197
|
});
|
|
198
198
|
} else {
|
|
199
199
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
200
200
|
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
201
|
-
await this.
|
|
201
|
+
await this.aztecNodeAdmin.setConfig({
|
|
202
202
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
203
203
|
});
|
|
204
204
|
}
|
|
@@ -210,51 +210,27 @@ export class FullProverTest {
|
|
|
210
210
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
211
211
|
|
|
212
212
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
undefined,
|
|
222
|
-
true,
|
|
223
|
-
);
|
|
224
|
-
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
225
|
-
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
226
|
-
|
|
227
|
-
for (let i = 0; i < 2; i++) {
|
|
228
|
-
await result.pxe.registerAccount(
|
|
229
|
-
this.deployedAccounts[i].secret,
|
|
230
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
231
|
-
);
|
|
232
|
-
await this.pxe.registerAccount(
|
|
233
|
-
this.deployedAccounts[i].secret,
|
|
234
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const account = await getSchnorrAccount(
|
|
239
|
-
result.pxe,
|
|
240
|
-
this.deployedAccounts[0].secret,
|
|
241
|
-
this.deployedAccounts[0].signingKey,
|
|
242
|
-
this.deployedAccounts[0].salt,
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
await result.pxe.registerContract({
|
|
246
|
-
instance: account.getInstance(),
|
|
247
|
-
artifact: SchnorrAccountContractArtifact,
|
|
248
|
-
});
|
|
213
|
+
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
|
|
214
|
+
this.aztecNode,
|
|
215
|
+
{ proverEnabled: this.realProofs },
|
|
216
|
+
undefined,
|
|
217
|
+
true,
|
|
218
|
+
);
|
|
219
|
+
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
220
|
+
await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
|
|
249
221
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this.
|
|
253
|
-
pxe: result.pxe,
|
|
254
|
-
teardown: result.teardown,
|
|
255
|
-
});
|
|
256
|
-
this.provenAssets.push(asset);
|
|
222
|
+
for (let i = 0; i < 2; i++) {
|
|
223
|
+
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
224
|
+
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
257
225
|
}
|
|
226
|
+
|
|
227
|
+
const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
228
|
+
this.provenComponents.push({
|
|
229
|
+
wallet: provenWallet,
|
|
230
|
+
teardown: provenTeardown,
|
|
231
|
+
});
|
|
232
|
+
this.provenAsset = asset;
|
|
233
|
+
this.provenWallet = provenWallet;
|
|
258
234
|
this.logger.info(`Full prover PXE started`);
|
|
259
235
|
|
|
260
236
|
// Shutdown the current, simulated prover node
|
|
@@ -265,7 +241,7 @@ export class FullProverTest {
|
|
|
265
241
|
this.logger.verbose('Starting archiver for new prover node');
|
|
266
242
|
const archiver = await createArchiver(
|
|
267
243
|
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
268
|
-
|
|
244
|
+
{ blobClient, dateProvider: this.context.dateProvider },
|
|
269
245
|
{ blockUntilSync: true },
|
|
270
246
|
);
|
|
271
247
|
|
|
@@ -275,46 +251,53 @@ export class FullProverTest {
|
|
|
275
251
|
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
276
252
|
|
|
277
253
|
this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
|
|
278
|
-
await this.
|
|
254
|
+
await this.mintFeeJuice(proverNodeSenderAddress);
|
|
279
255
|
|
|
280
256
|
this.logger.verbose('Starting prover node');
|
|
281
257
|
const proverConfig: ProverNodeConfig = {
|
|
282
258
|
...this.context.aztecNodeConfig,
|
|
283
|
-
|
|
259
|
+
txCollectionNodeRpcUrls: [],
|
|
284
260
|
dataDirectory: undefined,
|
|
285
|
-
proverId: this.proverAddress
|
|
261
|
+
proverId: this.proverAddress,
|
|
286
262
|
realProofs: this.realProofs,
|
|
287
263
|
proverAgentCount: 2,
|
|
288
|
-
|
|
264
|
+
publisherPrivateKeys: [new SecretValue(`0x${proverNodePrivateKey!.toString('hex')}` as const)],
|
|
289
265
|
proverNodeMaxPendingJobs: 100,
|
|
290
266
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
291
267
|
proverNodePollingIntervalMs: 100,
|
|
292
|
-
txGatheringTimeoutMs: 60000,
|
|
293
268
|
txGatheringIntervalMs: 1000,
|
|
294
|
-
|
|
269
|
+
txGatheringBatchSize: 10,
|
|
270
|
+
txGatheringMaxParallelRequestsPerNode: 100,
|
|
271
|
+
txGatheringTimeoutMs: 24_000,
|
|
272
|
+
proverNodeFailedEpochStore: undefined,
|
|
273
|
+
proverNodeEpochProvingDelayMs: undefined,
|
|
295
274
|
};
|
|
296
|
-
const
|
|
275
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
276
|
+
const { prefilledPublicData } = await getGenesisValues(
|
|
277
|
+
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
278
|
+
);
|
|
297
279
|
this.proverNode = await createProverNode(
|
|
298
280
|
proverConfig,
|
|
299
281
|
{
|
|
300
282
|
aztecNodeTxProvider: this.aztecNode,
|
|
301
283
|
archiver: archiver as Archiver,
|
|
302
|
-
|
|
284
|
+
blobClient,
|
|
303
285
|
},
|
|
304
286
|
{ prefilledPublicData },
|
|
305
287
|
);
|
|
306
|
-
this.proverNode.start();
|
|
288
|
+
await this.proverNode.start();
|
|
307
289
|
|
|
308
290
|
this.logger.warn(`Proofs are now enabled`);
|
|
309
291
|
return this;
|
|
310
292
|
}
|
|
311
293
|
|
|
312
|
-
private async
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
await
|
|
294
|
+
private async mintFeeJuice(recipient: Hex) {
|
|
295
|
+
const handlerAddress = this.context.deployL1ContractsValues.l1ContractAddresses.feeAssetHandlerAddress!;
|
|
296
|
+
this.logger.verbose(`Minting fee juice to ${recipient} using handler at ${handlerAddress}`);
|
|
297
|
+
const client = this.context.deployL1ContractsValues.l1Client;
|
|
298
|
+
const handler = getContract({ abi: FeeAssetHandlerAbi, address: handlerAddress.toString(), client });
|
|
299
|
+
const hash = await handler.write.mint([recipient]);
|
|
300
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
|
|
318
301
|
}
|
|
319
302
|
|
|
320
303
|
snapshot = <T>(
|
|
@@ -334,6 +317,7 @@ export class FullProverTest {
|
|
|
334
317
|
// clean up the full prover node
|
|
335
318
|
await this.proverNode.stop();
|
|
336
319
|
|
|
320
|
+
await Barretenberg.destroySingleton();
|
|
337
321
|
await this.bbConfigCleanup?.();
|
|
338
322
|
await this.acvmConfigCleanup?.();
|
|
339
323
|
}
|
|
@@ -346,16 +330,14 @@ export class FullProverTest {
|
|
|
346
330
|
const privateAmount = 10000n;
|
|
347
331
|
const publicAmount = 10000n;
|
|
348
332
|
|
|
349
|
-
const waitOpts = { proven: false };
|
|
350
|
-
|
|
351
333
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
352
334
|
await asset.methods
|
|
353
|
-
.mint_to_public(accounts[0]
|
|
354
|
-
.send()
|
|
355
|
-
.wait(
|
|
335
|
+
.mint_to_public(accounts[0], privateAmount + publicAmount)
|
|
336
|
+
.send({ from: accounts[0] })
|
|
337
|
+
.wait();
|
|
356
338
|
|
|
357
339
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
358
|
-
await asset.methods.transfer_to_private(accounts[0]
|
|
340
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
|
|
359
341
|
|
|
360
342
|
this.logger.verbose(`Minting complete.`);
|
|
361
343
|
|
|
@@ -364,21 +346,21 @@ export class FullProverTest {
|
|
|
364
346
|
async ({ amount }) => {
|
|
365
347
|
const {
|
|
366
348
|
fakeProofsAsset: asset,
|
|
367
|
-
accounts: [
|
|
349
|
+
accounts: [address],
|
|
368
350
|
tokenSim,
|
|
369
351
|
} = this;
|
|
370
352
|
tokenSim.mintPublic(address, amount);
|
|
371
353
|
|
|
372
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate();
|
|
354
|
+
const publicBalance = await asset.methods.balance_of_public(address).simulate({ from: address });
|
|
373
355
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
374
356
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
375
357
|
|
|
376
358
|
tokenSim.mintPrivate(address, amount);
|
|
377
|
-
const privateBalance = await asset.methods.balance_of_private(address).simulate();
|
|
359
|
+
const privateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
|
|
378
360
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
379
361
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
380
362
|
|
|
381
|
-
const totalSupply = await asset.methods.total_supply().simulate();
|
|
363
|
+
const totalSupply = await asset.methods.total_supply().simulate({ from: address });
|
|
382
364
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
383
365
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
384
366
|
|
|
@@ -386,33 +368,4 @@ export class FullProverTest {
|
|
|
386
368
|
},
|
|
387
369
|
);
|
|
388
370
|
}
|
|
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
371
|
}
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -8,21 +8,19 @@ 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
|
-
export const STATIC_CALL_STATE_MODIFICATION_ERROR =
|
|
25
|
-
/Static call cannot update the state, emit L2->L1 messages or generate logs.*/;
|
|
25
|
+
export const STATIC_CALL_STATE_MODIFICATION_ERROR = /Static call cannot update the state.*/;
|
|
26
26
|
export const STATIC_CONTEXT_ASSERTION_ERROR = /Assertion failed: Function .* can only be called statically.*/;
|
|
27
|
-
|
|
28
|
-
export const DEFAULT_BLOB_SINK_PORT = '5052';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/aztec.js';
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
import { parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
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,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
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';
|
|
6
7
|
import path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
7
9
|
|
|
8
10
|
const {
|
|
9
11
|
BB_RELEASE_DIR = 'barretenberg/cpp/build/bin',
|
|
@@ -11,6 +13,8 @@ const {
|
|
|
11
13
|
BB_SKIP_CLEANUP = '',
|
|
12
14
|
TEMP_DIR = tmpdir(),
|
|
13
15
|
BB_WORKING_DIRECTORY = '',
|
|
16
|
+
BB_NUM_IVC_VERIFIERS = '1',
|
|
17
|
+
BB_IVC_CONCURRENCY = '1',
|
|
14
18
|
} = process.env;
|
|
15
19
|
|
|
16
20
|
export const getBBConfig = async (
|
|
@@ -19,7 +23,7 @@ export const getBBConfig = async (
|
|
|
19
23
|
try {
|
|
20
24
|
const bbBinaryPath =
|
|
21
25
|
BB_BINARY_PATH ??
|
|
22
|
-
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
|
|
26
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
|
|
23
27
|
await fs.access(bbBinaryPath, fs.constants.R_OK);
|
|
24
28
|
|
|
25
29
|
let bbWorkingDirectory: string;
|
|
@@ -35,18 +39,19 @@ export const getBBConfig = async (
|
|
|
35
39
|
await fs.mkdir(bbWorkingDirectory, { recursive: true });
|
|
36
40
|
|
|
37
41
|
const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
|
|
43
|
+
|
|
44
|
+
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
45
|
+
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
bbSkipCleanup,
|
|
49
|
+
bbBinaryPath,
|
|
50
|
+
bbWorkingDirectory,
|
|
51
|
+
cleanup,
|
|
52
|
+
numConcurrentIVCVerifiers: numIvcVerifiers,
|
|
53
|
+
bbIVCConcurrency: ivcConcurrency,
|
|
47
54
|
};
|
|
48
|
-
|
|
49
|
-
return { bbSkipCleanup, bbBinaryPath, bbWorkingDirectory, cleanup };
|
|
50
55
|
} catch (err) {
|
|
51
56
|
logger.error(`Native BB not available, error: ${err}`);
|
|
52
57
|
return undefined;
|