@aztec/end-to-end 0.0.1-commit.3469e52 → 0.0.1-commit.35158ae7e
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/client_flows_benchmark.d.ts +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +49 -26
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/utils.d.ts +5 -4
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +13 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- 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 +27 -18
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- 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 +3 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +17 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +90 -40
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +24 -17
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +1 -7
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +5 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +29 -8
- 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 +190 -0
- package/dest/e2e_p2p/shared.d.ts +26 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +46 -18
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +20 -10
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +7 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +44 -50
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/setup.d.ts +48 -25
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +97 -172
- package/dest/fixtures/setup_p2p_test.d.ts +16 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +40 -29
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +12 -8
- package/dest/shared/cross_chain_test_harness.d.ts +3 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +24 -24
- package/dest/shared/gas_portal_test_harness.js +3 -3
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +27 -28
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +12 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +162 -41
- package/dest/spartan/tx_metrics.d.ts +38 -2
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +179 -5
- package/dest/spartan/utils/bot.d.ts +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -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 +45 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -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 +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -260
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -942
- package/dest/test-wallet/test_wallet.d.ts +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +213 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +45 -43
- package/src/bench/client_flows/client_flows_benchmark.ts +50 -58
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/utils.ts +15 -8
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +33 -23
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +139 -91
- package/src/e2e_fees/bridging_race.notest.ts +2 -5
- package/src/e2e_fees/fees_test.ts +28 -40
- package/src/e2e_l1_publisher/write_json.ts +3 -8
- package/src/e2e_nested_contract/nested_contract_test.ts +7 -7
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
- package/src/e2e_p2p/p2p_network.ts +50 -18
- package/src/e2e_p2p/reqresp/utils.ts +256 -0
- package/src/e2e_p2p/shared.ts +76 -23
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +27 -12
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +48 -63
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +131 -235
- package/src/fixtures/setup_p2p_test.ts +40 -44
- package/src/fixtures/token_utils.ts +10 -6
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/cross_chain_test_harness.ts +24 -34
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/index.ts +1 -0
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +49 -51
- package/src/simulators/lending_simulator.ts +10 -6
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/setup_test_wallets.ts +205 -26
- package/src/spartan/tx_metrics.ts +153 -8
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -1246
- package/src/test-wallet/test_wallet.ts +301 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
5
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
4
6
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
5
7
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
6
8
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
|
-
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
9
|
+
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
8
10
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
11
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
10
12
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
11
13
|
import type { Logger } from '@aztec/foundation/log';
|
|
12
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
14
|
+
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
13
15
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
14
16
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
15
|
-
import {
|
|
17
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
16
18
|
|
|
17
19
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
18
20
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
19
21
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
22
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
23
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
24
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
20
25
|
|
|
21
26
|
export interface TestAccounts {
|
|
22
27
|
aztecNode: AztecNode;
|
|
@@ -84,11 +89,19 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
84
89
|
|
|
85
90
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
86
91
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
87
|
-
await recipientDeployMethod.send({
|
|
92
|
+
await recipientDeployMethod.send({
|
|
93
|
+
from: NO_FROM,
|
|
94
|
+
fee: { paymentMethod },
|
|
95
|
+
wait: { timeout: 2400 },
|
|
96
|
+
});
|
|
88
97
|
await Promise.all(
|
|
89
98
|
fundedAccounts.map(async a => {
|
|
90
99
|
const deployMethod = await a.getDeployMethod();
|
|
91
|
-
await deployMethod.send({
|
|
100
|
+
await deployMethod.send({
|
|
101
|
+
from: NO_FROM,
|
|
102
|
+
fee: { paymentMethod },
|
|
103
|
+
wait: { timeout: 2400 },
|
|
104
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
92
105
|
logger.info(`Account deployed at ${a.address}`);
|
|
93
106
|
}),
|
|
94
107
|
);
|
|
@@ -116,11 +129,129 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
116
129
|
};
|
|
117
130
|
}
|
|
118
131
|
|
|
132
|
+
async function deployAccountWithDiagnostics(
|
|
133
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
134
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
135
|
+
aztecNode: AztecNode,
|
|
136
|
+
logger: Logger,
|
|
137
|
+
accountLabel: string,
|
|
138
|
+
estimateGas?: boolean,
|
|
139
|
+
): Promise<void> {
|
|
140
|
+
const deployMethod = await account.getDeployMethod();
|
|
141
|
+
let txHash;
|
|
142
|
+
let gasSettings: any;
|
|
143
|
+
try {
|
|
144
|
+
if (estimateGas) {
|
|
145
|
+
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
|
|
146
|
+
gasSettings = sim.estimatedGas;
|
|
147
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
148
|
+
}
|
|
149
|
+
const deployResult = await deployMethod.send({
|
|
150
|
+
from: NO_FROM,
|
|
151
|
+
fee: { paymentMethod, gasSettings },
|
|
152
|
+
wait: NO_WAIT,
|
|
153
|
+
});
|
|
154
|
+
txHash = deployResult.txHash;
|
|
155
|
+
await waitForTx(aztecNode, txHash, { timeout: 2400 });
|
|
156
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
const blockNumber = await aztecNode.getBlockNumber();
|
|
159
|
+
let receipt;
|
|
160
|
+
try {
|
|
161
|
+
receipt = await aztecNode.getTxReceipt(txHash);
|
|
162
|
+
} catch {
|
|
163
|
+
receipt = 'unavailable';
|
|
164
|
+
}
|
|
165
|
+
logger.error(`${accountLabel} deployment failed`, {
|
|
166
|
+
txHash: txHash.toString(),
|
|
167
|
+
receipt: JSON.stringify(receipt),
|
|
168
|
+
currentBlockNumber: blockNumber,
|
|
169
|
+
error: String(error),
|
|
170
|
+
});
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Track the tx hash across retries so we don't re-send when the previous tx is still pending.
|
|
175
|
+
let sentTxHash: { txHash: any } | undefined;
|
|
176
|
+
|
|
177
|
+
await retry(
|
|
178
|
+
async () => {
|
|
179
|
+
// Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
|
|
180
|
+
const existing = await aztecNode.getContract(account.address);
|
|
181
|
+
if (existing) {
|
|
182
|
+
logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// If we already sent a tx, check if it was dropped before deciding to re-send.
|
|
187
|
+
if (sentTxHash) {
|
|
188
|
+
const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
|
|
189
|
+
if (prevReceipt.isDropped()) {
|
|
190
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
|
|
191
|
+
sentTxHash = undefined;
|
|
192
|
+
} else {
|
|
193
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (!sentTxHash) {
|
|
198
|
+
const deployResult = await deployMethod.send({
|
|
199
|
+
from: AztecAddress.ZERO,
|
|
200
|
+
fee: { paymentMethod, gasSettings },
|
|
201
|
+
wait: NO_WAIT,
|
|
202
|
+
});
|
|
203
|
+
sentTxHash = { txHash: deployResult.txHash };
|
|
204
|
+
logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
|
|
208
|
+
if (receipt.isDropped()) {
|
|
209
|
+
sentTxHash = undefined;
|
|
210
|
+
throw new Error(`${accountLabel} tx was dropped, retrying...`);
|
|
211
|
+
}
|
|
212
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
213
|
+
},
|
|
214
|
+
`deploy ${accountLabel}`,
|
|
215
|
+
makeBackoff([1, 2, 4, 8, 16]),
|
|
216
|
+
logger,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async function deployAccountsInBatches(
|
|
221
|
+
accounts: {
|
|
222
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
223
|
+
address: any;
|
|
224
|
+
}[],
|
|
225
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
226
|
+
aztecNode: AztecNode,
|
|
227
|
+
logger: Logger,
|
|
228
|
+
labelPrefix: string,
|
|
229
|
+
batchSize = 2,
|
|
230
|
+
estimateGas?: boolean,
|
|
231
|
+
): Promise<void> {
|
|
232
|
+
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
233
|
+
const batch = accounts.slice(i, i + batchSize);
|
|
234
|
+
await Promise.all(
|
|
235
|
+
batch.map((account, idx) =>
|
|
236
|
+
deployAccountWithDiagnostics(
|
|
237
|
+
account,
|
|
238
|
+
paymentMethod,
|
|
239
|
+
aztecNode,
|
|
240
|
+
logger,
|
|
241
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
242
|
+
estimateGas,
|
|
243
|
+
),
|
|
244
|
+
),
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
119
249
|
export async function deploySponsoredTestAccounts(
|
|
120
250
|
wallet: TestWallet,
|
|
121
251
|
aztecNode: AztecNode,
|
|
122
252
|
logger: Logger,
|
|
123
253
|
numberOfFundedWallets = 1,
|
|
254
|
+
opts?: { estimateGas?: boolean },
|
|
124
255
|
): Promise<TestAccountsWithoutTokens> {
|
|
125
256
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
126
257
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
@@ -129,14 +260,23 @@ export async function deploySponsoredTestAccounts(
|
|
|
129
260
|
await registerSponsoredFPC(wallet);
|
|
130
261
|
|
|
131
262
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
132
|
-
|
|
133
|
-
await
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
263
|
+
|
|
264
|
+
await deployAccountWithDiagnostics(
|
|
265
|
+
recipientAccount,
|
|
266
|
+
paymentMethod,
|
|
267
|
+
aztecNode,
|
|
268
|
+
logger,
|
|
269
|
+
'Recipient account',
|
|
270
|
+
opts?.estimateGas,
|
|
271
|
+
);
|
|
272
|
+
await deployAccountsInBatches(
|
|
273
|
+
fundedAccounts,
|
|
274
|
+
paymentMethod,
|
|
275
|
+
aztecNode,
|
|
276
|
+
logger,
|
|
277
|
+
'Funded account ',
|
|
278
|
+
2,
|
|
279
|
+
opts?.estimateGas,
|
|
140
280
|
);
|
|
141
281
|
|
|
142
282
|
return {
|
|
@@ -175,7 +315,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
175
315
|
fundedAccounts.map(async (a, i) => {
|
|
176
316
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
177
317
|
const deployMethod = await a.getDeployMethod();
|
|
178
|
-
await deployMethod.send({ from:
|
|
318
|
+
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
|
|
179
319
|
logger.info(`Account deployed at ${a.address}`);
|
|
180
320
|
}),
|
|
181
321
|
);
|
|
@@ -219,7 +359,7 @@ async function bridgeL1FeeJuice(
|
|
|
219
359
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
220
360
|
|
|
221
361
|
const isSynced = async () =>
|
|
222
|
-
(await aztecNode.
|
|
362
|
+
(await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
223
363
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
224
364
|
|
|
225
365
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
@@ -251,14 +391,15 @@ async function deployTokenAndMint(
|
|
|
251
391
|
logger: Logger,
|
|
252
392
|
) {
|
|
253
393
|
logger.verbose(`Deploying TokenContract...`);
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
394
|
+
const {
|
|
395
|
+
receipt: { contract: tokenContract },
|
|
396
|
+
} = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
|
|
397
|
+
from: admin,
|
|
398
|
+
fee: {
|
|
399
|
+
paymentMethod,
|
|
400
|
+
},
|
|
401
|
+
wait: { timeout: 600, returnReceipt: true },
|
|
402
|
+
});
|
|
262
403
|
|
|
263
404
|
const tokenAddress = tokenContract.address;
|
|
264
405
|
|
|
@@ -268,8 +409,7 @@ async function deployTokenAndMint(
|
|
|
268
409
|
accounts.map(acc =>
|
|
269
410
|
TokenContract.at(tokenAddress, wallet)
|
|
270
411
|
.methods.mint_to_public(acc, mintAmount)
|
|
271
|
-
.send({ from: admin, fee: { paymentMethod } })
|
|
272
|
-
.wait({ timeout: 600 }),
|
|
412
|
+
.send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
|
|
273
413
|
),
|
|
274
414
|
);
|
|
275
415
|
|
|
@@ -309,7 +449,7 @@ export async function performTransfers({
|
|
|
309
449
|
|
|
310
450
|
const provenTxs = await Promise.all(txs);
|
|
311
451
|
|
|
312
|
-
await Promise.all(provenTxs.map(t => t.send(
|
|
452
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
|
|
313
453
|
|
|
314
454
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
315
455
|
}
|
|
@@ -347,3 +487,42 @@ export async function createWalletAndAztecNodeClient(
|
|
|
347
487
|
},
|
|
348
488
|
};
|
|
349
489
|
}
|
|
490
|
+
|
|
491
|
+
export type WorkerWalletWrapper = {
|
|
492
|
+
wallet: WorkerWallet;
|
|
493
|
+
aztecNode: AztecNode;
|
|
494
|
+
cleanup: () => Promise<void>;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
export async function createWorkerWalletClient(
|
|
498
|
+
nodeUrl: string,
|
|
499
|
+
proverEnabled: boolean,
|
|
500
|
+
logger: Logger,
|
|
501
|
+
): Promise<WorkerWalletWrapper> {
|
|
502
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
503
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
504
|
+
|
|
505
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
506
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
507
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
508
|
+
|
|
509
|
+
const pxeConfig = {
|
|
510
|
+
dataDirectory: undefined,
|
|
511
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
512
|
+
...bbPaths,
|
|
513
|
+
...acvmPaths,
|
|
514
|
+
proverEnabled,
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
518
|
+
|
|
519
|
+
return {
|
|
520
|
+
wallet,
|
|
521
|
+
aztecNode,
|
|
522
|
+
async cleanup() {
|
|
523
|
+
await wallet.stop();
|
|
524
|
+
await bbCleanup?.();
|
|
525
|
+
await acvmCleanup?.();
|
|
526
|
+
},
|
|
527
|
+
};
|
|
528
|
+
}
|
|
@@ -1,10 +1,137 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
3
4
|
import type { TopicType } from '@aztec/stdlib/p2p';
|
|
4
|
-
import { Tx, type TxReceipt
|
|
5
|
+
import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
|
|
5
6
|
|
|
6
7
|
import { createHistogram } from 'perf_hooks';
|
|
7
8
|
|
|
9
|
+
/** Metrics class for proving-related benchmarks. */
|
|
10
|
+
export class ProvingMetrics {
|
|
11
|
+
private successfulTxs: number | undefined;
|
|
12
|
+
private proofDuration: number | undefined;
|
|
13
|
+
private activeAgents: number | undefined;
|
|
14
|
+
private avgQueueTime: number | undefined;
|
|
15
|
+
private jobRetries: number | undefined;
|
|
16
|
+
private jobDuration: number | undefined;
|
|
17
|
+
private timedOutJobs: number | undefined;
|
|
18
|
+
private resolvedJobs: number | undefined;
|
|
19
|
+
private rejectedJobs: number | undefined;
|
|
20
|
+
private epochProvingDuration: number | undefined;
|
|
21
|
+
private provenTransactions: number | undefined;
|
|
22
|
+
private provenBlocks: number | undefined;
|
|
23
|
+
|
|
24
|
+
constructor(private prefix: string) {}
|
|
25
|
+
|
|
26
|
+
recordSuccessfulTxs(count: number): void {
|
|
27
|
+
this.successfulTxs = count;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
recordProofDuration(seconds: number): void {
|
|
31
|
+
this.proofDuration = seconds;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
recordActiveAgents(count: number): void {
|
|
35
|
+
this.activeAgents = count;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
recordAvgQueueTime(ms: number): void {
|
|
39
|
+
this.avgQueueTime = ms;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
recordJobRetries(count: number): void {
|
|
43
|
+
this.jobRetries = count;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
recordJobDuration(ms: number): void {
|
|
47
|
+
this.jobDuration = ms;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
recordTimedOutJobs(count: number): void {
|
|
51
|
+
this.timedOutJobs = count;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
recordResolvedJobs(count: number): void {
|
|
55
|
+
this.resolvedJobs = count;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
recordRejectedJobs(count: number): void {
|
|
59
|
+
this.rejectedJobs = count;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
recordEpochProvingDuration(seconds: number): void {
|
|
63
|
+
this.epochProvingDuration = seconds;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
recordProvenTransactions(count: number): void {
|
|
67
|
+
this.provenTransactions = count;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
recordProvenBlocks(count: number): void {
|
|
71
|
+
this.provenBlocks = count;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number }> {
|
|
75
|
+
const data: Array<{ name: string; unit: string; value: number }> = [];
|
|
76
|
+
|
|
77
|
+
if (this.successfulTxs !== undefined) {
|
|
78
|
+
data.push({ name: `${this.prefix}/successful_txs`, unit: 'count', value: this.successfulTxs });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.proofDuration !== undefined) {
|
|
82
|
+
data.push({ name: `${this.prefix}/proof_duration`, unit: 's', value: this.proofDuration });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.activeAgents !== undefined) {
|
|
86
|
+
data.push({ name: `${this.prefix}/active_agents`, unit: 'count', value: this.activeAgents });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (this.avgQueueTime !== undefined) {
|
|
90
|
+
data.push({ name: `${this.prefix}/avg_queue_time`, unit: 'ms', value: this.avgQueueTime });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.jobRetries !== undefined) {
|
|
94
|
+
data.push({ name: `${this.prefix}/job_retries`, unit: 'count', value: this.jobRetries });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.jobDuration !== undefined) {
|
|
98
|
+
data.push({ name: `${this.prefix}/job_duration`, unit: 'ms', value: this.jobDuration });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.timedOutJobs !== undefined) {
|
|
102
|
+
data.push({ name: `${this.prefix}/timed_out_jobs`, unit: 'count', value: this.timedOutJobs });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.resolvedJobs !== undefined) {
|
|
106
|
+
data.push({ name: `${this.prefix}/resolved_jobs`, unit: 'count', value: this.resolvedJobs });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.rejectedJobs !== undefined) {
|
|
110
|
+
data.push({ name: `${this.prefix}/rejected_jobs`, unit: 'count', value: this.rejectedJobs });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (this.epochProvingDuration !== undefined) {
|
|
114
|
+
data.push({ name: `${this.prefix}/epoch_proving_duration`, unit: 's', value: this.epochProvingDuration });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (this.provenTransactions !== undefined) {
|
|
118
|
+
data.push({ name: `${this.prefix}/proven_transactions`, unit: 'count', value: this.provenTransactions });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (this.provenBlocks !== undefined) {
|
|
122
|
+
data.push({ name: `${this.prefix}/proven_blocks`, unit: 'count', value: this.provenBlocks });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const scenario = process.env.BENCH_SCENARIO?.trim();
|
|
126
|
+
if (!scenario) {
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const scenarioPrefix = `scenario/${scenario}/`;
|
|
131
|
+
return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
8
135
|
export type TxInclusionData = {
|
|
9
136
|
txHash: string;
|
|
10
137
|
sentAt: number;
|
|
@@ -20,7 +147,7 @@ export type TxInclusionData = {
|
|
|
20
147
|
export class TxInclusionMetrics {
|
|
21
148
|
private data = new Map<string, TxInclusionData>();
|
|
22
149
|
private groups = new Set<string>();
|
|
23
|
-
private blocks = new Map<number, Promise<
|
|
150
|
+
private blocks = new Map<number, Promise<L2Block | undefined>>();
|
|
24
151
|
|
|
25
152
|
private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
|
|
26
153
|
|
|
@@ -32,12 +159,19 @@ export class TxInclusionMetrics {
|
|
|
32
159
|
| { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
|
|
33
160
|
| undefined;
|
|
34
161
|
|
|
35
|
-
constructor(
|
|
162
|
+
constructor(
|
|
163
|
+
private aztecNode: AztecNode,
|
|
164
|
+
private logger?: Logger,
|
|
165
|
+
) {}
|
|
36
166
|
|
|
37
167
|
recordSentTx(tx: Tx, group: string): void {
|
|
38
168
|
const txHash = tx.getTxHash().toString();
|
|
39
169
|
const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
|
|
40
170
|
|
|
171
|
+
if (this.data.has(txHash)) {
|
|
172
|
+
this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
|
|
173
|
+
}
|
|
174
|
+
|
|
41
175
|
this.data.set(txHash, {
|
|
42
176
|
txHash,
|
|
43
177
|
sentAt: Math.trunc(Date.now() / 1000),
|
|
@@ -53,8 +187,13 @@ export class TxInclusionMetrics {
|
|
|
53
187
|
}
|
|
54
188
|
|
|
55
189
|
async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
|
|
56
|
-
const {
|
|
57
|
-
if (
|
|
190
|
+
const { txHash, blockNumber } = txReceipt;
|
|
191
|
+
if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
|
|
192
|
+
this.logger?.debug('Skipping mined tx record due to receipt status', {
|
|
193
|
+
txHash: txHash.toString(),
|
|
194
|
+
status: txReceipt.status,
|
|
195
|
+
blockNumber,
|
|
196
|
+
});
|
|
58
197
|
return;
|
|
59
198
|
}
|
|
60
199
|
|
|
@@ -64,9 +203,15 @@ export class TxInclusionMetrics {
|
|
|
64
203
|
|
|
65
204
|
const block = await this.blocks.get(blockNumber)!;
|
|
66
205
|
if (!block) {
|
|
206
|
+
this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
|
|
67
207
|
return;
|
|
68
208
|
}
|
|
69
|
-
const data = this.data.get(txHash.toString())
|
|
209
|
+
const data = this.data.get(txHash.toString());
|
|
210
|
+
if (!data) {
|
|
211
|
+
const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
|
|
212
|
+
this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
|
|
213
|
+
throw new Error(message);
|
|
214
|
+
}
|
|
70
215
|
data.blocknumber = blockNumber;
|
|
71
216
|
data.minedAt = Number(block.header.globalVariables.timestamp);
|
|
72
217
|
data.attestedAt = -1;
|
|
@@ -151,7 +296,7 @@ export class TxInclusionMetrics {
|
|
|
151
296
|
value: stats.mean,
|
|
152
297
|
},
|
|
153
298
|
{
|
|
154
|
-
name: `${group}/
|
|
299
|
+
name: `${group}/p50_inclusion`,
|
|
155
300
|
unit: 's',
|
|
156
301
|
value: stats.median,
|
|
157
302
|
},
|