@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.023c3e5
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 +62 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +281 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +321 -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 +79 -0
- package/dest/bench/utils.d.ts +16 -41
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +41 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -19
- 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 +114 -102
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
- 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 +104 -104
- package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +26 -27
- package/dest/e2e_epochs/epochs_test.d.ts +71 -22
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +260 -54
- 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 +61 -0
- package/dest/e2e_fees/fees_test.d.ts +38 -23
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +162 -183
- package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +56 -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 +15 -15
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +37 -41
- 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 +281 -27
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +237 -175
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +44 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +165 -27
- package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +96 -74
- package/dest/fixtures/e2e_prover_test.d.ts +55 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.js +278 -0
- 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.d.ts +218 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +695 -0
- package/dest/fixtures/setup_p2p_test.d.ts +15 -15
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +96 -31
- 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 +31 -12
- package/dest/fixtures/utils.d.ts +5 -153
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -552
- 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/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +44 -27
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +105 -51
- package/dest/shared/gas_portal_test_harness.d.ts +33 -25
- 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 +2 -2
- package/dest/shared/index.d.ts.map +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 +15 -16
- package/dest/shared/uniswap_l1_l2.d.ts +3 -25
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +176 -126
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +7 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +17 -18
- 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 +27 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +233 -62
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +422 -0
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- package/package.json +66 -58
- package/src/bench/client_flows/benchmark.ts +363 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +384 -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 +41 -85
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
- package/src/e2e_deploy_contract/deploy_test.ts +40 -48
- package/src/e2e_epochs/epochs_test.ts +341 -81
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +220 -258
- 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 +46 -59
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +341 -234
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +260 -39
- package/src/e2e_token_contract/token_contract_test.ts +115 -126
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +336 -0
- 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.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +133 -50
- package/src/fixtures/token_utils.ts +33 -15
- package/src/fixtures/utils.ts +27 -820
- 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 → grafana_client.ts} +2 -2
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +103 -91
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/index.ts +1 -1
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +18 -20
- package/src/shared/uniswap_l1_l2.ts +197 -221
- package/src/simulators/lending_simulator.ts +16 -17
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +308 -95
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -582
- 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/e2e_prover/e2e_prover_test.js +0 -291
- 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/fixtures/snapshot_manager.d.ts +0 -87
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -479
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.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/e2e_prover/e2e_prover_test.ts +0 -418
- package/src/fixtures/setup_l1_contracts.ts +0 -27
- package/src/fixtures/snapshot_manager.ts +0 -617
- 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,98 +0,0 @@
|
|
|
1
|
-
// docs:start:imports
|
|
2
|
-
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
|
-
import { createPXEClient, waitForPXE } from '@aztec/aztec.js';
|
|
4
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
5
|
-
import { getToken } from './contracts.mjs';
|
|
6
|
-
// docs:end:imports
|
|
7
|
-
const { PXE_URL = 'http://localhost:8080' } = process.env;
|
|
8
|
-
// docs:start:showAccounts
|
|
9
|
-
async function showAccounts(pxe) {
|
|
10
|
-
const accounts = await pxe.getRegisteredAccounts();
|
|
11
|
-
console.log(`User accounts:\n${accounts.map((a)=>a.address).join('\n')}`);
|
|
12
|
-
}
|
|
13
|
-
// docs:end:showAccounts
|
|
14
|
-
// docs:start:showPrivateBalances
|
|
15
|
-
async function showPrivateBalances(pxe) {
|
|
16
|
-
const [owner] = await getInitialTestAccountsWallets(pxe);
|
|
17
|
-
const token = await getToken(owner);
|
|
18
|
-
const accounts = await pxe.getRegisteredAccounts();
|
|
19
|
-
for (const account of accounts){
|
|
20
|
-
// highlight-next-line:showPrivateBalances
|
|
21
|
-
const balance = await token.methods.balance_of_private(account.address).simulate();
|
|
22
|
-
console.log(`Balance of ${account.address}: ${balance}`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// docs:end:showPrivateBalances
|
|
26
|
-
// docs:start:mintPrivateFunds
|
|
27
|
-
async function mintPrivateFunds(pxe) {
|
|
28
|
-
const [ownerWallet] = await getInitialTestAccountsWallets(pxe);
|
|
29
|
-
const token = await getToken(ownerWallet);
|
|
30
|
-
await showPrivateBalances(pxe);
|
|
31
|
-
// We mint tokens to the owner
|
|
32
|
-
const mintAmount = 20n;
|
|
33
|
-
const from = ownerWallet.getAddress(); // we are setting from to owner here because we need a sender to calculate the tag
|
|
34
|
-
await token.methods.mint_to_private(from, ownerWallet.getAddress(), mintAmount).send().wait();
|
|
35
|
-
await showPrivateBalances(pxe);
|
|
36
|
-
}
|
|
37
|
-
// docs:end:mintPrivateFunds
|
|
38
|
-
// docs:start:transferPrivateFunds
|
|
39
|
-
async function transferPrivateFunds(pxe) {
|
|
40
|
-
const [owner, recipient] = await getInitialTestAccountsWallets(pxe);
|
|
41
|
-
const token = await getToken(owner);
|
|
42
|
-
await showPrivateBalances(pxe);
|
|
43
|
-
console.log(`Sending transaction, awaiting transaction to be mined`);
|
|
44
|
-
const receipt = await token.methods.transfer(recipient.getAddress(), 1).send().wait();
|
|
45
|
-
console.log(`Transaction ${receipt.txHash} has been mined on block ${receipt.blockNumber}`);
|
|
46
|
-
await showPrivateBalances(pxe);
|
|
47
|
-
}
|
|
48
|
-
// docs:end:transferPrivateFunds
|
|
49
|
-
// docs:start:showPublicBalances
|
|
50
|
-
async function showPublicBalances(pxe) {
|
|
51
|
-
const [owner] = await getInitialTestAccountsWallets(pxe);
|
|
52
|
-
const token = await getToken(owner);
|
|
53
|
-
const accounts = await pxe.getRegisteredAccounts();
|
|
54
|
-
for (const account of accounts){
|
|
55
|
-
// highlight-next-line:showPublicBalances
|
|
56
|
-
const balance = await token.methods.balance_of_public(account.address).simulate();
|
|
57
|
-
console.log(`Balance of ${account.address}: ${balance}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// docs:end:showPublicBalances
|
|
61
|
-
// docs:start:mintPublicFunds
|
|
62
|
-
async function mintPublicFunds(pxe) {
|
|
63
|
-
const [owner] = await getInitialTestAccountsWallets(pxe);
|
|
64
|
-
const token = await getToken(owner);
|
|
65
|
-
await showPublicBalances(pxe);
|
|
66
|
-
console.log(`Sending transaction, awaiting transaction to be mined`);
|
|
67
|
-
const receipt = await token.methods.mint_to_public(owner.getAddress(), 100).send().wait();
|
|
68
|
-
console.log(`Transaction ${receipt.txHash} has been mined on block ${receipt.blockNumber}`);
|
|
69
|
-
await showPublicBalances(pxe);
|
|
70
|
-
// docs:start:showLogs
|
|
71
|
-
const blockNumber = await pxe.getBlockNumber();
|
|
72
|
-
const logs = (await pxe.getPublicLogs({
|
|
73
|
-
fromBlock: blockNumber - 1
|
|
74
|
-
})).logs;
|
|
75
|
-
const textLogs = logs.map((extendedLog)=>extendedLog.toHumanReadable().slice(0, 200));
|
|
76
|
-
for (const log of textLogs)console.log(`Log emitted: ${log}`);
|
|
77
|
-
// docs:end:showLogs
|
|
78
|
-
}
|
|
79
|
-
// docs:end:mintPublicFunds
|
|
80
|
-
async function main() {
|
|
81
|
-
const pxe = createPXEClient(PXE_URL);
|
|
82
|
-
await waitForPXE(pxe);
|
|
83
|
-
const { l1ChainId } = await pxe.getNodeInfo();
|
|
84
|
-
console.log(`Connected to chain ${l1ChainId}`);
|
|
85
|
-
await showAccounts(pxe);
|
|
86
|
-
await mintPrivateFunds(pxe);
|
|
87
|
-
await transferPrivateFunds(pxe);
|
|
88
|
-
await mintPublicFunds(pxe);
|
|
89
|
-
}
|
|
90
|
-
// Execute main only if run directly
|
|
91
|
-
if (process.argv[1].replace(/\/index\.m?js$/, '') === fileURLToPath(import.meta.url).replace(/\/index\.m?js$/, '')) {
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
93
|
-
main().then(()=>process.exit(0)).catch((err)=>{
|
|
94
|
-
console.error(`Error in app: ${err}`);
|
|
95
|
-
process.exit(1);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export { main };
|
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SchnorrAccountContractArtifact,
|
|
3
|
-
getSchnorrAccount,
|
|
4
|
-
getSchnorrWalletWithSecretKey,
|
|
5
|
-
} from '@aztec/accounts/schnorr';
|
|
6
|
-
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
7
|
-
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
8
|
-
import {
|
|
9
|
-
type AccountWalletWithSecretKey,
|
|
10
|
-
type AztecNode,
|
|
11
|
-
type CheatCodes,
|
|
12
|
-
type CompleteAddress,
|
|
13
|
-
type DeployL1ContractsReturnType,
|
|
14
|
-
EthAddress,
|
|
15
|
-
type Logger,
|
|
16
|
-
type PXE,
|
|
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';
|
|
23
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
24
|
-
import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
25
|
-
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
26
|
-
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
27
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
28
|
-
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
29
|
-
|
|
30
|
-
import { type Hex, getContract } from 'viem';
|
|
31
|
-
import { privateKeyToAddress } from 'viem/accounts';
|
|
32
|
-
|
|
33
|
-
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
34
|
-
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
35
|
-
import {
|
|
36
|
-
type ISnapshotManager,
|
|
37
|
-
type SubsystemsContext,
|
|
38
|
-
createSnapshotManager,
|
|
39
|
-
deployAccounts,
|
|
40
|
-
publicDeployAccounts,
|
|
41
|
-
} from '../fixtures/snapshot_manager.js';
|
|
42
|
-
import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
|
|
43
|
-
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
44
|
-
|
|
45
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
46
|
-
|
|
47
|
-
type ProvenSetup = {
|
|
48
|
-
pxe: PXE;
|
|
49
|
-
teardown: () => Promise<void>;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
54
|
-
* However, we then setup a second PXE with a full prover instance.
|
|
55
|
-
* We configure this instance with all of the accounts and contracts.
|
|
56
|
-
* We then prove and verify transactions created via this full prover PXE.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
export class FullProverTest {
|
|
60
|
-
static TOKEN_NAME = 'USDC';
|
|
61
|
-
static TOKEN_SYMBOL = 'USD';
|
|
62
|
-
static TOKEN_DECIMALS = 18n;
|
|
63
|
-
private snapshotManager: ISnapshotManager;
|
|
64
|
-
logger: Logger;
|
|
65
|
-
deployedAccounts: InitialAccountData[] = [];
|
|
66
|
-
wallets: AccountWalletWithSecretKey[] = [];
|
|
67
|
-
accounts: CompleteAddress[] = [];
|
|
68
|
-
fakeProofsAsset!: TokenContract;
|
|
69
|
-
tokenSim!: TokenSimulator;
|
|
70
|
-
aztecNode!: AztecNode;
|
|
71
|
-
pxe!: PXEService;
|
|
72
|
-
cheatCodes!: CheatCodes;
|
|
73
|
-
blobSink!: BlobSinkServer;
|
|
74
|
-
private provenComponents: ProvenSetup[] = [];
|
|
75
|
-
private bbConfigCleanup?: () => Promise<void>;
|
|
76
|
-
private acvmConfigCleanup?: () => Promise<void>;
|
|
77
|
-
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
78
|
-
provenAssets: TokenContract[] = [];
|
|
79
|
-
private context!: SubsystemsContext;
|
|
80
|
-
private proverNode!: ProverNode;
|
|
81
|
-
private simulatedProverNode!: ProverNode;
|
|
82
|
-
public l1Contracts!: DeployL1ContractsReturnType;
|
|
83
|
-
public proverAddress!: EthAddress;
|
|
84
|
-
|
|
85
|
-
constructor(
|
|
86
|
-
testName: string,
|
|
87
|
-
private minNumberOfTxsPerBlock: number,
|
|
88
|
-
coinbase: EthAddress,
|
|
89
|
-
private realProofs = true,
|
|
90
|
-
) {
|
|
91
|
-
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
92
|
-
this.snapshotManager = createSnapshotManager(
|
|
93
|
-
`full_prover_integration/${testName}`,
|
|
94
|
-
dataPath,
|
|
95
|
-
{ startProverNode: true, fundRewardDistributor: true, coinbase },
|
|
96
|
-
{},
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Adds two state shifts to snapshot manager.
|
|
102
|
-
* 1. Add 2 accounts.
|
|
103
|
-
* 2. Publicly deploy accounts, deploy token contract
|
|
104
|
-
*/
|
|
105
|
-
async applyBaseSnapshots() {
|
|
106
|
-
await this.snapshotManager.snapshot(
|
|
107
|
-
'2_accounts',
|
|
108
|
-
deployAccounts(2, this.logger),
|
|
109
|
-
async ({ deployedAccounts }, { pxe }) => {
|
|
110
|
-
this.deployedAccounts = deployedAccounts;
|
|
111
|
-
this.wallets = await Promise.all(
|
|
112
|
-
deployedAccounts.map(a => getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)),
|
|
113
|
-
);
|
|
114
|
-
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
115
|
-
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
await this.snapshotManager.snapshot(
|
|
120
|
-
'client_prover_integration',
|
|
121
|
-
async () => {
|
|
122
|
-
// Create the token contract state.
|
|
123
|
-
// Move this account thing to addAccounts above?
|
|
124
|
-
this.logger.verbose(`Public deploy accounts...`);
|
|
125
|
-
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2), false);
|
|
126
|
-
|
|
127
|
-
this.logger.verbose(`Deploying TokenContract...`);
|
|
128
|
-
const asset = await TokenContract.deploy(
|
|
129
|
-
this.wallets[0],
|
|
130
|
-
this.accounts[0],
|
|
131
|
-
FullProverTest.TOKEN_NAME,
|
|
132
|
-
FullProverTest.TOKEN_SYMBOL,
|
|
133
|
-
FullProverTest.TOKEN_DECIMALS,
|
|
134
|
-
)
|
|
135
|
-
.send()
|
|
136
|
-
.deployed();
|
|
137
|
-
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
138
|
-
|
|
139
|
-
return { tokenContractAddress: asset.address };
|
|
140
|
-
},
|
|
141
|
-
async ({ tokenContractAddress }) => {
|
|
142
|
-
// Restore the token contract state.
|
|
143
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
|
|
144
|
-
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
145
|
-
|
|
146
|
-
this.tokenSim = new TokenSimulator(
|
|
147
|
-
this.fakeProofsAsset,
|
|
148
|
-
this.wallets[0],
|
|
149
|
-
this.logger,
|
|
150
|
-
this.accounts.map(a => a.address),
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate()).toBe(this.accounts[0].address.toBigInt());
|
|
154
|
-
},
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
async setup() {
|
|
159
|
-
this.context = await this.snapshotManager.setup();
|
|
160
|
-
|
|
161
|
-
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
162
|
-
this.context.watcher.setIsMarkingAsProven(false);
|
|
163
|
-
|
|
164
|
-
this.simulatedProverNode = this.context.proverNode!;
|
|
165
|
-
({
|
|
166
|
-
pxe: this.pxe,
|
|
167
|
-
aztecNode: this.aztecNode,
|
|
168
|
-
deployL1ContractsValues: this.l1Contracts,
|
|
169
|
-
cheatCodes: this.cheatCodes,
|
|
170
|
-
blobSink: this.blobSink,
|
|
171
|
-
} = this.context);
|
|
172
|
-
|
|
173
|
-
const blobSinkClient = createBlobSinkClient({ blobSinkUrl: `http://localhost:${this.blobSink.port}` });
|
|
174
|
-
|
|
175
|
-
// Configure a full prover PXE
|
|
176
|
-
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
|
|
177
|
-
let bbConfig: Awaited<ReturnType<typeof getBBConfig>> | undefined;
|
|
178
|
-
if (this.realProofs) {
|
|
179
|
-
[acvmConfig, bbConfig] = await Promise.all([getACVMConfig(this.logger), getBBConfig(this.logger)]);
|
|
180
|
-
if (!acvmConfig || !bbConfig) {
|
|
181
|
-
throw new Error('Missing ACVM or BB config');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.acvmConfigCleanup = acvmConfig.cleanup;
|
|
185
|
-
this.bbConfigCleanup = bbConfig.cleanup;
|
|
186
|
-
|
|
187
|
-
if (!bbConfig?.bbWorkingDirectory || !bbConfig?.bbBinaryPath) {
|
|
188
|
-
throw new Error(`Test must be run with BB native configuration`);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
|
|
192
|
-
|
|
193
|
-
this.logger.debug(`Configuring the node for real proofs...`);
|
|
194
|
-
await this.aztecNode.setConfig({
|
|
195
|
-
realProofs: true,
|
|
196
|
-
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
200
|
-
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
201
|
-
await this.aztecNode.setConfig({
|
|
202
|
-
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
this.logger.verbose(`Move to a clean epoch`);
|
|
207
|
-
await this.context.cheatCodes.rollup.advanceToNextEpoch();
|
|
208
|
-
|
|
209
|
-
this.logger.verbose(`Marking current block as proven`);
|
|
210
|
-
await this.context.cheatCodes.rollup.markAsProven();
|
|
211
|
-
|
|
212
|
-
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
213
|
-
for (let i = 0; i < 2; i++) {
|
|
214
|
-
const result = await setupPXEService(
|
|
215
|
-
this.aztecNode,
|
|
216
|
-
{
|
|
217
|
-
proverEnabled: this.realProofs,
|
|
218
|
-
bbBinaryPath: bbConfig?.bbBinaryPath,
|
|
219
|
-
bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
|
|
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
|
-
});
|
|
249
|
-
|
|
250
|
-
const provenWallet = await account.getWallet();
|
|
251
|
-
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
252
|
-
this.provenComponents.push({
|
|
253
|
-
pxe: result.pxe,
|
|
254
|
-
teardown: result.teardown,
|
|
255
|
-
});
|
|
256
|
-
this.provenAssets.push(asset);
|
|
257
|
-
}
|
|
258
|
-
this.logger.info(`Full prover PXE started`);
|
|
259
|
-
|
|
260
|
-
// Shutdown the current, simulated prover node
|
|
261
|
-
this.logger.verbose('Shutting down simulated prover node');
|
|
262
|
-
await this.simulatedProverNode.stop();
|
|
263
|
-
|
|
264
|
-
// Creating temp store and archiver for fully proven prover node
|
|
265
|
-
this.logger.verbose('Starting archiver for new prover node');
|
|
266
|
-
const archiver = await createArchiver(
|
|
267
|
-
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
268
|
-
blobSinkClient,
|
|
269
|
-
{ blockUntilSync: true },
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
// The simulated prover node (now shutdown) used private key index 2
|
|
273
|
-
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
274
|
-
const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey!).toString());
|
|
275
|
-
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
276
|
-
|
|
277
|
-
this.logger.verbose(`Funding prover node at ${proverNodeSenderAddress}`);
|
|
278
|
-
await this.mintL1ERC20(proverNodeSenderAddress, 100_000_000n);
|
|
279
|
-
|
|
280
|
-
this.logger.verbose('Starting prover node');
|
|
281
|
-
const proverConfig: ProverNodeConfig = {
|
|
282
|
-
...this.context.aztecNodeConfig,
|
|
283
|
-
proverCoordinationNodeUrl: undefined,
|
|
284
|
-
dataDirectory: undefined,
|
|
285
|
-
proverId: this.proverAddress.toField(),
|
|
286
|
-
realProofs: this.realProofs,
|
|
287
|
-
proverAgentCount: 2,
|
|
288
|
-
publisherPrivateKey: `0x${proverNodePrivateKey!.toString('hex')}`,
|
|
289
|
-
proverNodeMaxPendingJobs: 100,
|
|
290
|
-
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
291
|
-
proverNodePollingIntervalMs: 100,
|
|
292
|
-
txGatheringTimeoutMs: 60000,
|
|
293
|
-
txGatheringIntervalMs: 1000,
|
|
294
|
-
txGatheringMaxParallelRequests: 100,
|
|
295
|
-
};
|
|
296
|
-
const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map(a => a.address));
|
|
297
|
-
this.proverNode = await createProverNode(
|
|
298
|
-
proverConfig,
|
|
299
|
-
{
|
|
300
|
-
aztecNodeTxProvider: this.aztecNode,
|
|
301
|
-
archiver: archiver as Archiver,
|
|
302
|
-
blobSinkClient,
|
|
303
|
-
},
|
|
304
|
-
{ prefilledPublicData },
|
|
305
|
-
);
|
|
306
|
-
this.proverNode.start();
|
|
307
|
-
|
|
308
|
-
this.logger.warn(`Proofs are now enabled`);
|
|
309
|
-
return this;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
private async mintL1ERC20(recipient: Hex, amount: bigint) {
|
|
313
|
-
const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
|
|
314
|
-
const client = this.context.deployL1ContractsValues.walletClient;
|
|
315
|
-
const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
|
|
316
|
-
const hash = await erc20.write.mint([recipient, amount]);
|
|
317
|
-
await this.context.deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash });
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
snapshot = <T>(
|
|
321
|
-
name: string,
|
|
322
|
-
apply: (context: SubsystemsContext) => Promise<T>,
|
|
323
|
-
restore: (snapshotData: T, context: SubsystemsContext) => Promise<void> = () => Promise.resolve(),
|
|
324
|
-
): Promise<void> => this.snapshotManager.snapshot(name, apply, restore);
|
|
325
|
-
|
|
326
|
-
async teardown() {
|
|
327
|
-
await this.snapshotManager.teardown();
|
|
328
|
-
|
|
329
|
-
// Cleanup related to the full prover PXEs
|
|
330
|
-
for (let i = 0; i < this.provenComponents.length; i++) {
|
|
331
|
-
await this.provenComponents[i].teardown();
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// clean up the full prover node
|
|
335
|
-
await this.proverNode.stop();
|
|
336
|
-
|
|
337
|
-
await this.bbConfigCleanup?.();
|
|
338
|
-
await this.acvmConfigCleanup?.();
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
async applyMintSnapshot() {
|
|
342
|
-
await this.snapshotManager.snapshot(
|
|
343
|
-
'mint',
|
|
344
|
-
async () => {
|
|
345
|
-
const { fakeProofsAsset: asset, accounts } = this;
|
|
346
|
-
const privateAmount = 10000n;
|
|
347
|
-
const publicAmount = 10000n;
|
|
348
|
-
|
|
349
|
-
const waitOpts = { proven: false };
|
|
350
|
-
|
|
351
|
-
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
352
|
-
await asset.methods
|
|
353
|
-
.mint_to_public(accounts[0].address, privateAmount + publicAmount)
|
|
354
|
-
.send()
|
|
355
|
-
.wait(waitOpts);
|
|
356
|
-
|
|
357
|
-
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
358
|
-
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(waitOpts);
|
|
359
|
-
|
|
360
|
-
this.logger.verbose(`Minting complete.`);
|
|
361
|
-
|
|
362
|
-
return { amount: publicAmount };
|
|
363
|
-
},
|
|
364
|
-
async ({ amount }) => {
|
|
365
|
-
const {
|
|
366
|
-
fakeProofsAsset: asset,
|
|
367
|
-
accounts: [{ address }],
|
|
368
|
-
tokenSim,
|
|
369
|
-
} = this;
|
|
370
|
-
tokenSim.mintPublic(address, amount);
|
|
371
|
-
|
|
372
|
-
const publicBalance = await asset.methods.balance_of_public(address).simulate();
|
|
373
|
-
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
374
|
-
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
375
|
-
|
|
376
|
-
tokenSim.mintPrivate(address, amount);
|
|
377
|
-
const privateBalance = await asset.methods.balance_of_private(address).simulate();
|
|
378
|
-
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
379
|
-
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
380
|
-
|
|
381
|
-
const totalSupply = await asset.methods.total_supply().simulate();
|
|
382
|
-
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
383
|
-
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
384
|
-
|
|
385
|
-
return Promise.resolve();
|
|
386
|
-
},
|
|
387
|
-
);
|
|
388
|
-
}
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type Logger, deployL1Contracts } from '@aztec/aztec.js';
|
|
2
|
-
import type { DeployL1ContractsArgs, L1ContractsConfig } from '@aztec/ethereum';
|
|
3
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
-
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
5
|
-
|
|
6
|
-
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
7
|
-
import { foundry } from 'viem/chains';
|
|
8
|
-
|
|
9
|
-
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
10
|
-
|
|
11
|
-
export const setupL1Contracts = async (
|
|
12
|
-
l1RpcUrl: string,
|
|
13
|
-
account: HDAccount | PrivateKeyAccount,
|
|
14
|
-
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'genesisBlockHash' | 'initialValidators'> &
|
|
16
|
-
L1ContractsConfig,
|
|
17
|
-
) => {
|
|
18
|
-
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
20
|
-
vkTreeRoot: getVKTreeRoot(),
|
|
21
|
-
protocolContractTreeRoot,
|
|
22
|
-
salt: undefined,
|
|
23
|
-
...args,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return l1Data;
|
|
27
|
-
};
|