@aztec/end-to-end 0.0.1-commit.2f68f620 → 0.0.1-commit.321f6a9
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/README.md +215 -27
- package/dest/automine/automine_test_context.d.ts +85 -0
- package/dest/automine/automine_test_context.d.ts.map +1 -0
- package/dest/automine/automine_test_context.js +98 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
- package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
- package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
- package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
- package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
- package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
- package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +18 -40
- package/dest/automine/token/token_contract_test.d.ts +40 -0
- package/dest/automine/token/token_contract_test.d.ts.map +1 -0
- package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +22 -39
- package/dest/automine/token/token_test_helpers.d.ts +73 -0
- package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
- package/dest/automine/token/token_test_helpers.js +97 -0
- package/dest/bench/client_flows/benchmark.d.ts +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +3 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +4 -4
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +31 -19
- package/dest/bench/client_flows/data_extractor.js +1 -0
- package/dest/bench/utils.d.ts +3 -3
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +95 -6
- package/dest/composed/ha/ha_full_setup.d.ts +77 -0
- package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
- package/dest/composed/ha/ha_full_setup.js +383 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
- package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.d.ts +12 -9
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +48 -28
- package/dest/fixtures/fixtures.d.ts +19 -10
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +26 -11
- package/dest/fixtures/ha_setup.d.ts +3 -3
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +4 -1
- 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 -42
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +194 -229
- package/dest/fixtures/setup_p2p_test.d.ts +1 -1
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +3 -3
- package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
- package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
- package/dest/fixtures/standard_contracts_genesis.js +25 -0
- package/dest/fixtures/timing.d.ts +42 -0
- package/dest/fixtures/timing.d.ts.map +1 -0
- package/dest/fixtures/timing.js +72 -0
- package/dest/fixtures/token_utils.d.ts +22 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +21 -1
- package/dest/fixtures/utils.d.ts +2 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +1 -1
- package/dest/fixtures/wait_helpers.d.ts +135 -0
- package/dest/fixtures/wait_helpers.d.ts.map +1 -0
- package/dest/fixtures/wait_helpers.js +154 -0
- package/dest/forward-compatibility/wallet_service.js +3 -3
- package/dest/multi-node/block-production/setup.d.ts +97 -0
- package/dest/multi-node/block-production/setup.d.ts.map +1 -0
- package/dest/multi-node/block-production/setup.js +158 -0
- package/dest/multi-node/governance/setup.d.ts +67 -0
- package/dest/multi-node/governance/setup.d.ts.map +1 -0
- package/dest/multi-node/governance/setup.js +126 -0
- package/dest/multi-node/multi_node_test_context.d.ts +212 -0
- package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
- package/dest/multi-node/multi_node_test_context.js +347 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
- package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/inactivity_setup.js +111 -0
- package/dest/multi-node/slashing/setup.d.ts +167 -0
- package/dest/multi-node/slashing/setup.d.ts.map +1 -0
- package/dest/multi-node/slashing/setup.js +275 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +41 -16
- package/dest/p2p/reqresp/utils.d.ts +19 -0
- package/dest/p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -17
- package/dest/p2p/shared.d.ts +72 -0
- package/dest/p2p/shared.d.ts.map +1 -0
- package/dest/p2p/shared.js +212 -0
- package/dest/shared/cross_chain_test_harness.d.ts +3 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +24 -16
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -5
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +12 -5
- package/dest/shared/timing_env.d.js +5 -0
- package/dest/shared/timing_env.js +365 -0
- 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 +1 -6
- package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
- package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
- package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
- package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
- package/dest/single-node/fees/fees_test.d.ts +95 -0
- package/dest/single-node/fees/fees_test.d.ts.map +1 -0
- package/dest/{e2e_fees → single-node/fees}/fees_test.js +126 -60
- package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
- package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
- package/dest/single-node/l1-reorgs/setup.js +57 -0
- package/dest/single-node/partial-proofs/setup.d.ts +5 -0
- package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
- package/dest/single-node/partial-proofs/setup.js +5 -0
- package/dest/single-node/proving/setup.d.ts +5 -0
- package/dest/single-node/proving/setup.d.ts.map +1 -0
- package/dest/single-node/proving/setup.js +5 -0
- package/dest/single-node/recovery/setup.d.ts +5 -0
- package/dest/single-node/recovery/setup.d.ts.map +1 -0
- package/dest/single-node/recovery/setup.js +5 -0
- package/dest/single-node/setup.d.ts +49 -0
- package/dest/single-node/setup.d.ts.map +1 -0
- package/dest/single-node/setup.js +56 -0
- package/dest/single-node/single_node_test_context.d.ts +374 -0
- package/dest/single-node/single_node_test_context.d.ts.map +1 -0
- package/dest/single-node/single_node_test_context.js +847 -0
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +19 -9
- package/dest/spartan/tx_metrics.d.ts +10 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +32 -0
- package/dest/test-wallet/test_wallet.d.ts +23 -3
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +56 -9
- package/dest/test-wallet/utils.d.ts +36 -1
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +64 -4
- package/dest/test-wallet/wallet_worker_script.js +5 -2
- package/dest/test-wallet/worker_wallet.d.ts +5 -5
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +5 -3
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -159
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +2 -1
- package/package.json +41 -41
- package/src/automine/README.md +60 -0
- package/src/automine/automine_test_context.ts +153 -0
- package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
- package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
- package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +20 -57
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -57
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +3 -1
- package/src/bench/client_flows/client_flows_benchmark.ts +45 -26
- package/src/bench/client_flows/data_extractor.ts +1 -0
- package/src/bench/utils.ts +109 -6
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/e2e_prover_test.ts +60 -47
- package/src/fixtures/fixtures.ts +28 -11
- package/src/fixtures/ha_setup.ts +7 -3
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/setup.ts +245 -290
- package/src/fixtures/setup_p2p_test.ts +3 -3
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +39 -4
- package/src/fixtures/utils.ts +0 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_service.ts +6 -4
- package/src/guides/up_quick_start.sh +5 -0
- package/src/infra/README.md +12 -0
- package/src/multi-node/README.md +96 -0
- package/src/multi-node/block-production/setup.ts +272 -0
- package/src/multi-node/governance/setup.ts +172 -0
- package/src/multi-node/multi_node_test_context.ts +447 -0
- package/src/multi-node/slashing/inactivity_setup.ts +139 -0
- package/src/multi-node/slashing/setup.ts +433 -0
- package/src/p2p/README.md +78 -0
- package/src/{e2e_p2p → p2p}/p2p_network.ts +40 -13
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -16
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +22 -13
- package/src/shared/gas_portal_test_harness.ts +13 -5
- package/src/shared/submit-transactions.ts +13 -5
- package/src/shared/timing_env.d.mts +39 -0
- package/src/shared/timing_env.mjs +363 -0
- package/src/shared/uniswap_l1_l2.ts +1 -8
- package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/single-node/README.md +66 -0
- package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
- package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
- package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
- package/src/{e2e_fees → single-node/fees}/fees_test.ts +143 -70
- package/src/single-node/l1-reorgs/setup.ts +93 -0
- package/src/single-node/partial-proofs/setup.ts +8 -0
- package/src/single-node/proving/setup.ts +15 -0
- package/src/single-node/recovery/setup.ts +8 -0
- package/src/single-node/setup.ts +63 -0
- package/src/single-node/single_node_test_context.ts +1058 -0
- package/src/spartan/setup_test_wallets.ts +24 -9
- package/src/spartan/tx_metrics.ts +26 -0
- package/src/test-wallet/test_wallet.ts +60 -10
- package/src/test-wallet/utils.ts +102 -5
- package/src/test-wallet/wallet_worker_script.ts +6 -3
- package/src/test-wallet/worker_wallet.ts +10 -12
- package/src/test-wallet/worker_wallet_schema.ts +3 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -161
- package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
- package/dest/e2e_deploy_contract/deploy_test.js +0 -51
- package/dest/e2e_epochs/epochs_test.d.ts +0 -125
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -460
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -91
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
- package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
- package/dest/e2e_l1_publisher/write_json.js +0 -56
- package/dest/e2e_multi_validator/utils.d.ts +0 -12
- package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +0 -55
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +0 -137
- package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.d.ts +0 -75
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -217
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -231
- package/src/e2e_deploy_contract/deploy_test.ts +0 -86
- package/src/e2e_epochs/epochs_test.ts +0 -575
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -77
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -180
- package/src/e2e_p2p/shared.ts +0 -332
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
- /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
- /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
- /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
- /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
2
|
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
3
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { DefaultWaitOpts, NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
5
5
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
6
6
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
7
7
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
@@ -14,8 +14,10 @@ import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
|
14
14
|
import type { Logger } from '@aztec/foundation/log';
|
|
15
15
|
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
16
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
17
18
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
19
|
import { TxStatus } from '@aztec/stdlib/tx';
|
|
20
|
+
import { getGasLimits } from '@aztec/wallet-sdk/base-wallet';
|
|
19
21
|
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
20
22
|
|
|
21
23
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
@@ -54,6 +56,8 @@ export async function setupTestAccountsWithTokens(
|
|
|
54
56
|
|
|
55
57
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
56
58
|
const wallet = await TestWallet.create(aztecNode);
|
|
59
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
60
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
57
61
|
|
|
58
62
|
const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
|
|
59
63
|
0,
|
|
@@ -84,8 +88,10 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
84
88
|
numberOfFundedWallets = 1,
|
|
85
89
|
): Promise<TestAccounts> {
|
|
86
90
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
87
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
88
|
-
const fundedAccounts = await Promise.all(
|
|
91
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
92
|
+
const fundedAccounts = await Promise.all(
|
|
93
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
94
|
+
);
|
|
89
95
|
|
|
90
96
|
await registerSponsoredFPC(wallet);
|
|
91
97
|
|
|
@@ -142,8 +148,9 @@ async function deployAccountWithDiagnostics(
|
|
|
142
148
|
const deployMethod = await account.getDeployMethod();
|
|
143
149
|
let gasSettings: any;
|
|
144
150
|
if (estimateGas) {
|
|
145
|
-
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
|
|
146
|
-
|
|
151
|
+
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod }, includeMetadata: true });
|
|
152
|
+
const { txsLimits } = await aztecNode.getNodeInfo();
|
|
153
|
+
gasSettings = getGasLimits(sim.gasUsed!, Gas.from(txsLimits.gas));
|
|
147
154
|
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
148
155
|
}
|
|
149
156
|
|
|
@@ -230,8 +237,10 @@ export async function deploySponsoredTestAccounts(
|
|
|
230
237
|
opts?: { estimateGas?: boolean },
|
|
231
238
|
): Promise<TestAccountsWithoutTokens> {
|
|
232
239
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
233
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
234
|
-
const fundedAccounts = await Promise.all(
|
|
240
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
241
|
+
const fundedAccounts = await Promise.all(
|
|
242
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
243
|
+
);
|
|
235
244
|
|
|
236
245
|
await registerSponsoredFPC(wallet);
|
|
237
246
|
|
|
@@ -273,10 +282,14 @@ export async function deployTestAccountsWithTokens(
|
|
|
273
282
|
): Promise<TestAccounts> {
|
|
274
283
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
275
284
|
const wallet = await TestWallet.create(aztecNode);
|
|
285
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
286
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
276
287
|
|
|
277
288
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
278
|
-
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
279
|
-
const fundedAccounts = await Promise.all(
|
|
289
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt, recipient.signingKey);
|
|
290
|
+
const fundedAccounts = await Promise.all(
|
|
291
|
+
funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt, a.signingKey)),
|
|
292
|
+
);
|
|
280
293
|
|
|
281
294
|
const claims = await Promise.all(
|
|
282
295
|
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
|
|
@@ -456,6 +469,8 @@ export async function createWalletAndAztecNodeClient(
|
|
|
456
469
|
proverEnabled,
|
|
457
470
|
};
|
|
458
471
|
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
472
|
+
// Remote JSON-RPC node: keep the 1s poll cadence rather than the in-process TestWallet fast default.
|
|
473
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
459
474
|
|
|
460
475
|
return {
|
|
461
476
|
wallet,
|
|
@@ -161,6 +161,7 @@ export class TxInclusionMetrics {
|
|
|
161
161
|
private mempoolMinedDelay:
|
|
162
162
|
| { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
|
|
163
163
|
| undefined;
|
|
164
|
+
private inclusionOutcome: { mined: number; failed: number } | undefined;
|
|
164
165
|
|
|
165
166
|
constructor(
|
|
166
167
|
private aztecNode: AztecNode,
|
|
@@ -249,6 +250,16 @@ export class TxInclusionMetrics {
|
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Whether this tx was ever observed in a block (by the block-watcher or a mined receipt).
|
|
255
|
+
* Idempotent first-sighting semantics: a later reorg / pool eviction never clears it, so callers
|
|
256
|
+
* can treat "ever mined" as included regardless of what happens to the tx afterwards.
|
|
257
|
+
*/
|
|
258
|
+
public wasMined(txHash: string): boolean {
|
|
259
|
+
const d = this.data.get(txHash);
|
|
260
|
+
return !!d && d.minedAtMs !== -1;
|
|
261
|
+
}
|
|
262
|
+
|
|
252
263
|
/** Per-tx inclusion records for a group. Used to serialise out for downstream tooling. */
|
|
253
264
|
getInclusionRecords(group?: string): TxInclusionData[] {
|
|
254
265
|
const out: TxInclusionData[] = [];
|
|
@@ -342,6 +353,11 @@ export class TxInclusionMetrics {
|
|
|
342
353
|
this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
|
|
343
354
|
}
|
|
344
355
|
|
|
356
|
+
/** Mined vs failed counts for the high-value lane — recorded instead of asserting strict 1:1 inclusion. */
|
|
357
|
+
public recordInclusionOutcome(mined: number, failed: number): void {
|
|
358
|
+
this.inclusionOutcome = { mined, failed };
|
|
359
|
+
}
|
|
360
|
+
|
|
345
361
|
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
|
|
346
362
|
const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
|
|
347
363
|
for (const group of this.groups) {
|
|
@@ -423,6 +439,16 @@ export class TxInclusionMetrics {
|
|
|
423
439
|
);
|
|
424
440
|
}
|
|
425
441
|
|
|
442
|
+
if (this.inclusionOutcome) {
|
|
443
|
+
const { mined, failed } = this.inclusionOutcome;
|
|
444
|
+
const total = mined + failed;
|
|
445
|
+
data.push(
|
|
446
|
+
{ name: 'inclusion/mined_count', unit: 'count', value: mined },
|
|
447
|
+
{ name: 'inclusion/failed_count', unit: 'count', value: failed },
|
|
448
|
+
{ name: 'inclusion/success_ratio', unit: 'ratio', value: total > 0 ? mined / total : 0 },
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
426
452
|
const scenario = process.env.BENCH_SCENARIO?.trim();
|
|
427
453
|
if (!scenario) {
|
|
428
454
|
return data;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub
|
|
2
|
+
import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/ecdsa/stub';
|
|
3
|
+
import { SchnorrAccountContract, SchnorrInitializerlessAccountContract } from '@aztec/accounts/schnorr';
|
|
4
|
+
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/schnorr/stub';
|
|
5
5
|
import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
|
|
6
6
|
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
7
7
|
import {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
isContractFunctionInteractionCallIntent,
|
|
14
14
|
lookupValidity,
|
|
15
15
|
} from '@aztec/aztec.js/authorization';
|
|
16
|
+
import { ContractFunctionInteraction } from '@aztec/aztec.js/contracts';
|
|
16
17
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
18
|
import { AccountManager, type SendOptions } from '@aztec/aztec.js/wallet';
|
|
18
19
|
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
@@ -22,11 +23,10 @@ import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
|
22
23
|
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
23
24
|
import type { NotesFilter } from '@aztec/pxe/client/lazy';
|
|
24
25
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/config';
|
|
25
|
-
import { PXE, type PXECreationOptions, createPXE } from '@aztec/pxe/server';
|
|
26
|
+
import { PXE, type PXECreationOptions, type TaggingSecretSource, createPXE } from '@aztec/pxe/server';
|
|
26
27
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
27
28
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
28
29
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
29
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
30
30
|
import type { NoteDao } from '@aztec/stdlib/note';
|
|
31
31
|
import {
|
|
32
32
|
type BlockHeader,
|
|
@@ -58,6 +58,13 @@ export interface AccountData {
|
|
|
58
58
|
* utilities
|
|
59
59
|
* It is intended to be used in e2e tests.
|
|
60
60
|
*/
|
|
61
|
+
/**
|
|
62
|
+
* Poll interval (in seconds) for in-process TestWallet tx waits. In-process nodes reach CHECKPOINTED synchronously
|
|
63
|
+
* under automine and cheaply otherwise, so a sub-second cadence removes almost-pure dead time from every send().wait().
|
|
64
|
+
* Spartan tests run against remote JSON-RPC nodes and restore the 1s default via setDefaultWaitInterval.
|
|
65
|
+
*/
|
|
66
|
+
export const IN_PROCESS_WAIT_INTERVAL_SECONDS = 0.25;
|
|
67
|
+
|
|
61
68
|
export class TestWallet extends BaseWallet {
|
|
62
69
|
constructor(
|
|
63
70
|
pxe: PXE,
|
|
@@ -65,6 +72,15 @@ export class TestWallet extends BaseWallet {
|
|
|
65
72
|
) {
|
|
66
73
|
super(pxe, nodeRef);
|
|
67
74
|
this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
|
|
75
|
+
this.defaultWaitInterval = IN_PROCESS_WAIT_INTERVAL_SECONDS;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Overrides the poll interval (in seconds) used when a send().wait() caller does not specify one. Pass `undefined`
|
|
80
|
+
* to fall back to the DefaultWaitOpts cadence. Spartan tests set this to 1 so they do not hammer remote nodes.
|
|
81
|
+
*/
|
|
82
|
+
setDefaultWaitInterval(interval?: number): void {
|
|
83
|
+
this.defaultWaitInterval = interval;
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
static async create(
|
|
@@ -91,11 +107,19 @@ export class TestWallet extends BaseWallet {
|
|
|
91
107
|
this.nodeRef.updateTargetNode(node);
|
|
92
108
|
}
|
|
93
109
|
|
|
94
|
-
createSchnorrAccount(secret: Fr, salt: Fr, signingKey
|
|
95
|
-
signingKey = signingKey ?? deriveSigningKey(secret);
|
|
110
|
+
createSchnorrAccount(secret: Fr, salt: Fr, signingKey: Fq): Promise<AccountManager> {
|
|
96
111
|
return this.createAccount({ secret, salt, type: 'schnorr', contract: new SchnorrAccountContract(signingKey) });
|
|
97
112
|
}
|
|
98
113
|
|
|
114
|
+
createSchnorrInitializerlessAccount(secret: Fr, salt: Fr, signingKey: Fq): Promise<AccountManager> {
|
|
115
|
+
return this.createAccount({
|
|
116
|
+
secret,
|
|
117
|
+
salt,
|
|
118
|
+
type: 'schnorr_initializerless',
|
|
119
|
+
contract: new SchnorrInitializerlessAccountContract(signingKey),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
99
123
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
|
|
100
124
|
return this.createAccount({
|
|
101
125
|
secret,
|
|
@@ -131,6 +155,8 @@ export class TestWallet extends BaseWallet {
|
|
|
131
155
|
await this.pxe.registerContractClass(StubEcdsaAccountContractArtifact);
|
|
132
156
|
|
|
133
157
|
this.stubClassIds.set('schnorr', schnorrClassId);
|
|
158
|
+
// Initializerless accounts share the schnorr stub class for kernelless simulation.
|
|
159
|
+
this.stubClassIds.set('schnorr_initializerless', schnorrClassId);
|
|
134
160
|
this.stubClassIds.set('ecdsasecp256k1', ecdsaClassId);
|
|
135
161
|
this.stubClassIds.set('ecdsasecp256r1', ecdsaClassId);
|
|
136
162
|
}
|
|
@@ -178,7 +204,8 @@ export class TestWallet extends BaseWallet {
|
|
|
178
204
|
}
|
|
179
205
|
|
|
180
206
|
private getStubAccountFor(address: AztecAddress, completeAddress: CompleteAddress) {
|
|
181
|
-
|
|
207
|
+
const type = this.getTypeFor(address);
|
|
208
|
+
return type === 'schnorr' || type === 'schnorr_initializerless'
|
|
182
209
|
? createStubSchnorrAccount(completeAddress)
|
|
183
210
|
: createStubEcdsaAccount(completeAddress);
|
|
184
211
|
}
|
|
@@ -221,6 +248,10 @@ export class TestWallet extends BaseWallet {
|
|
|
221
248
|
const type = accountData?.type ?? 'schnorr';
|
|
222
249
|
const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
|
|
223
250
|
|
|
251
|
+
// Initializerless accounts have no deployment tx: the address commits to the signing public key
|
|
252
|
+
// (via the contract's immutablesHash, resolved by AccountManager.create) and the constructor's
|
|
253
|
+
// storage writes are materialized locally via a simulated "store" call below.
|
|
254
|
+
// Mirrors EmbeddedWallet.createAccountInternal.
|
|
224
255
|
const accountManager = await AccountManager.create(this, secret, contract, { salt });
|
|
225
256
|
|
|
226
257
|
const instance = accountManager.getInstance();
|
|
@@ -231,6 +262,16 @@ export class TestWallet extends BaseWallet {
|
|
|
231
262
|
const address = accountManager.address.toString();
|
|
232
263
|
this.accounts.set(address, { account: await accountManager.getAccount(), type });
|
|
233
264
|
|
|
265
|
+
if (contract instanceof SchnorrInitializerlessAccountContract) {
|
|
266
|
+
const constructorAbi = artifact.functions.find(f => f.name === 'constructor');
|
|
267
|
+
if (!constructorAbi) {
|
|
268
|
+
throw new Error('Could not create SchnorrInitializerlessAccount: constructor ABI not found');
|
|
269
|
+
}
|
|
270
|
+
const { x, y } = await contract.getSigningPublicKey();
|
|
271
|
+
const storeCall = new ContractFunctionInteraction(this, instance.address, constructorAbi, [x, y]);
|
|
272
|
+
await storeCall.simulate({ from: instance.address });
|
|
273
|
+
}
|
|
274
|
+
|
|
234
275
|
return accountManager;
|
|
235
276
|
}
|
|
236
277
|
|
|
@@ -277,7 +318,7 @@ export class TestWallet extends BaseWallet {
|
|
|
277
318
|
opts: SimulateViaEntrypointOptions,
|
|
278
319
|
): Promise<TxSimulationResultWithAppOffset> {
|
|
279
320
|
const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement, sendMessagesAs } = opts;
|
|
280
|
-
const scopes = this.scopesFrom(from, additionalScopes);
|
|
321
|
+
const scopes = this.scopesFrom(from, additionalScopes ?? [], sendMessagesAs);
|
|
281
322
|
const skipKernels = this.simulationMode !== 'full';
|
|
282
323
|
const useOverride = this.simulationMode === 'kernelless-override';
|
|
283
324
|
|
|
@@ -343,7 +384,7 @@ export class TestWallet extends BaseWallet {
|
|
|
343
384
|
});
|
|
344
385
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
345
386
|
const txProvingResult = await this.pxe.proveTx(txRequest, {
|
|
346
|
-
scopes: this.scopesFrom(opts.from, opts.additionalScopes),
|
|
387
|
+
scopes: this.scopesFrom(opts.from, opts.additionalScopes ?? [], opts.sendMessagesAs),
|
|
347
388
|
senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
|
|
348
389
|
});
|
|
349
390
|
return new ProvenTx(
|
|
@@ -370,6 +411,15 @@ export class TestWallet extends BaseWallet {
|
|
|
370
411
|
return this.pxe.sync();
|
|
371
412
|
}
|
|
372
413
|
|
|
414
|
+
/**
|
|
415
|
+
* Registers a non-sender tagging-secret source (e.g. a raw out-of-band shared secret) so this PXE discovers messages
|
|
416
|
+
* tagged with it. Test-only surface over {@link PXE.registerTaggingSecretSource}, which the base `Wallet` does not
|
|
417
|
+
* expose. The `address-derived` (sender) variant is excluded: use {@link Wallet.registerSender} for that.
|
|
418
|
+
*/
|
|
419
|
+
registerTaggingSecretSource(source: Exclude<TaggingSecretSource, { kind: 'address-derived' }>): Promise<void> {
|
|
420
|
+
return this.pxe.registerTaggingSecretSource(source);
|
|
421
|
+
}
|
|
422
|
+
|
|
373
423
|
stop(): Promise<void> {
|
|
374
424
|
return this.pxe.stop();
|
|
375
425
|
}
|
package/src/test-wallet/utils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
1
2
|
import {
|
|
2
3
|
BatchCall,
|
|
3
4
|
ContractFunctionInteraction,
|
|
@@ -10,11 +11,15 @@ import {
|
|
|
10
11
|
toSendOptions,
|
|
11
12
|
} from '@aztec/aztec.js/contracts';
|
|
12
13
|
import { type AztecNode, waitForTx } from '@aztec/aztec.js/node';
|
|
14
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
15
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
16
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
13
17
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
14
18
|
import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
15
19
|
|
|
16
20
|
import { inspect } from 'util';
|
|
17
21
|
|
|
22
|
+
import { testSpan, withTestSpanOwner } from '../fixtures/timing.js';
|
|
18
23
|
import type { TestWallet } from './test_wallet.js';
|
|
19
24
|
|
|
20
25
|
export type ProvenTxSendOpts = {
|
|
@@ -35,7 +40,11 @@ export class ProvenTx extends Tx {
|
|
|
35
40
|
|
|
36
41
|
send(options?: Omit<ProvenTxSendOpts, 'wait'>): Promise<TxReceipt>;
|
|
37
42
|
send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & { wait: W }): Promise<ProvenTxSendReturn<W>>;
|
|
38
|
-
|
|
43
|
+
send(options?: ProvenTxSendOpts): Promise<TxHash | TxReceipt> {
|
|
44
|
+
return testSpan('tx:send', () => this.sendInner(options));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private async sendInner(options?: ProvenTxSendOpts): Promise<TxHash | TxReceipt> {
|
|
39
48
|
const txHash = this.getTxHash();
|
|
40
49
|
await this.node.sendTx(this).catch(err => {
|
|
41
50
|
throw this.contextualizeError(err, inspect(this));
|
|
@@ -61,13 +70,101 @@ export class ProvenTx extends Tx {
|
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
export
|
|
73
|
+
export function proveInteraction(
|
|
65
74
|
wallet: TestWallet,
|
|
66
75
|
interaction: ContractFunctionInteraction | DeployMethod | BatchCall,
|
|
67
76
|
options: SendInteractionOptions | DeployOptions,
|
|
68
|
-
) {
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
): Promise<ProvenTx> {
|
|
78
|
+
return testSpan('tx:prove', async () => {
|
|
79
|
+
const execPayload = await interaction.request(options);
|
|
80
|
+
return wallet.proveTx(execPayload, toSendOptions(options));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Builds an interaction for index `i` of a batch. */
|
|
85
|
+
export type MakeBatchCall = (i: number) => ContractFunctionInteraction | DeployMethod | BatchCall;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Pre-proves `count` interactions built by `makeCall(i)` against `wallet`, all with the same
|
|
89
|
+
* `options`. Returns the proven txs so the caller can send them individually (e.g. with sleeps
|
|
90
|
+
* between sends, or anchored to intermediate tips). For the common "send the whole batch at once"
|
|
91
|
+
* case use {@link proveAndSendTxs}.
|
|
92
|
+
*/
|
|
93
|
+
export function proveTxs(
|
|
94
|
+
wallet: TestWallet,
|
|
95
|
+
count: number,
|
|
96
|
+
makeCall: MakeBatchCall,
|
|
97
|
+
options: SendInteractionOptions | DeployOptions,
|
|
98
|
+
): Promise<ProvenTx[]> {
|
|
99
|
+
return timesAsync(count, i => proveInteraction(wallet, makeCall(i), options));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Pre-proves `count` interactions built by `makeCall(i)` and sends each one with `NO_WAIT`, all at
|
|
104
|
+
* once. Returns the tx hashes in batch order. Pairs with `waitForTxs` for the "send N, wait for N"
|
|
105
|
+
* arc. Use {@link proveTxs} instead when the sends need bespoke sequencing.
|
|
106
|
+
*/
|
|
107
|
+
export async function proveAndSendTxs(
|
|
108
|
+
wallet: TestWallet,
|
|
109
|
+
count: number,
|
|
110
|
+
makeCall: MakeBatchCall,
|
|
111
|
+
options: SendInteractionOptions | DeployOptions,
|
|
112
|
+
): Promise<TxHash[]> {
|
|
113
|
+
const txs = await proveTxs(wallet, count, makeCall, options);
|
|
114
|
+
return Promise.all(txs.map(tx => tx.send({ wait: NO_WAIT })));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Options for {@link startMempoolFeeder}. */
|
|
118
|
+
export type MempoolFeederOpts = {
|
|
119
|
+
/** The account the txs are sent from. */
|
|
120
|
+
from: AztecAddress;
|
|
121
|
+
/** Keep the pending-tx count at or above this threshold; defaults to 3. */
|
|
122
|
+
minPending?: number;
|
|
123
|
+
/** Milliseconds between top-up polls; defaults to 1000. */
|
|
124
|
+
intervalMs?: number;
|
|
125
|
+
/** Logger for verbose top-up traces. */
|
|
126
|
+
logger?: Logger;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Starts a background loop that keeps `node`'s mempool topped up: whenever the pending-tx count drops
|
|
131
|
+
* below `opts.minPending`, it proves and sends one interaction built by `makeCall()` (NO_WAIT). Errors
|
|
132
|
+
* are swallowed and retried. Returns an {@link AsyncDisposable}; disposing stops the loop and awaits it.
|
|
133
|
+
*/
|
|
134
|
+
export function startMempoolFeeder(
|
|
135
|
+
wallet: TestWallet,
|
|
136
|
+
node: AztecNode,
|
|
137
|
+
makeCall: () => ContractFunctionInteraction | DeployMethod | BatchCall,
|
|
138
|
+
opts: MempoolFeederOpts,
|
|
139
|
+
): AsyncDisposable {
|
|
140
|
+
const minPending = opts.minPending ?? 3;
|
|
141
|
+
const intervalMs = opts.intervalMs ?? 1000;
|
|
142
|
+
let stopped = false;
|
|
143
|
+
|
|
144
|
+
// Pin the feeder's prove/send spans to a fixed non-test owner. It runs interleaved with arbitrary
|
|
145
|
+
// tests, so without this its tx:prove/tx:send spans would smear onto whichever test was current
|
|
146
|
+
// when each round fired; the pinned owner matches no test/suite record, excluding them cleanly.
|
|
147
|
+
const loop = withTestSpanOwner('other:mempool-feeder', async () => {
|
|
148
|
+
while (!stopped) {
|
|
149
|
+
try {
|
|
150
|
+
const pendingCount = await node.getPendingTxCount();
|
|
151
|
+
if (pendingCount < minPending) {
|
|
152
|
+
await proveAndSendTxs(wallet, 1, makeCall, { from: opts.from });
|
|
153
|
+
opts.logger?.verbose(`Topped up mempool (was ${pendingCount})`);
|
|
154
|
+
}
|
|
155
|
+
} catch (err) {
|
|
156
|
+
opts.logger?.verbose(`Mempool top-up error (will retry): ${err}`);
|
|
157
|
+
}
|
|
158
|
+
await sleep(intervalMs);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
async [Symbol.asyncDispose]() {
|
|
164
|
+
stopped = true;
|
|
165
|
+
await loop;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
71
168
|
}
|
|
72
169
|
|
|
73
170
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DefaultWaitOpts } from '@aztec/aztec.js/contracts';
|
|
1
2
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
3
|
import type { SendOptions } from '@aztec/aztec.js/wallet';
|
|
3
4
|
import { BackendType, BarretenbergSync } from '@aztec/bb.js';
|
|
4
5
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
5
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import type { ApiSchema, Fr } from '@aztec/foundation/schemas';
|
|
7
|
+
import type { ApiSchema, Fq, Fr } from '@aztec/foundation/schemas';
|
|
7
8
|
import { getSchemaParameters, parseWithOptionals, schemaHasMethod } from '@aztec/foundation/schemas';
|
|
8
9
|
import { NodeListener, TransportServer } from '@aztec/foundation/transport';
|
|
9
10
|
import { ExecutionPayload, Tx } from '@aztec/stdlib/tx';
|
|
@@ -23,6 +24,8 @@ try {
|
|
|
23
24
|
// Worker sync bb use is limited to crypto and proof serialization helpers.
|
|
24
25
|
await BarretenbergSync.initSingleton({ backend: BackendType.Wasm });
|
|
25
26
|
const wallet = await TestWallet.create(node, pxeConfig);
|
|
27
|
+
// Worker wallets are only used by spartan tests against remote JSON-RPC nodes: keep the 1s poll cadence.
|
|
28
|
+
wallet.setDefaultWaitInterval(DefaultWaitOpts.interval);
|
|
26
29
|
logger.info('Worker wallet initialized');
|
|
27
30
|
|
|
28
31
|
const customMethods = {
|
|
@@ -36,8 +39,8 @@ try {
|
|
|
36
39
|
provenTx.publicFunctionCalldata,
|
|
37
40
|
);
|
|
38
41
|
},
|
|
39
|
-
registerAccount: async (secret: Fr, salt: Fr) => {
|
|
40
|
-
const manager = await wallet.createSchnorrAccount(secret, salt);
|
|
42
|
+
registerAccount: async (secret: Fr, salt: Fr, signingKey: Fq) => {
|
|
43
|
+
const manager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
41
44
|
return manager.address;
|
|
42
45
|
},
|
|
43
46
|
};
|
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
WalletCapabilities,
|
|
19
19
|
} from '@aztec/aztec.js/wallet';
|
|
20
20
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
21
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
21
|
+
import type { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
22
22
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
23
23
|
import { createLogger } from '@aztec/foundation/log';
|
|
24
24
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
@@ -29,7 +29,7 @@ import type { PXEConfig } from '@aztec/pxe/config';
|
|
|
29
29
|
import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@aztec/stdlib/abi';
|
|
30
30
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
31
31
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
32
|
-
import type {
|
|
32
|
+
import type { ContractInstancePreimage } from '@aztec/stdlib/contract';
|
|
33
33
|
import type { ExecutionPayload, TxProfileResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
34
34
|
import { Tx } from '@aztec/stdlib/tx';
|
|
35
35
|
|
|
@@ -116,15 +116,17 @@ export class WorkerWallet implements Wallet {
|
|
|
116
116
|
return wallet;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
private async callRaw(fn: string, ...args: any[]): Promise<string> {
|
|
119
|
+
private async callRaw(fn: string, ...args: any[]): Promise<string | undefined> {
|
|
120
120
|
const argsJson = jsonStringify(args);
|
|
121
|
-
return (await this.client.request({ fn, args: argsJson })) as string;
|
|
121
|
+
return (await this.client.request({ fn, args: argsJson })) as string | undefined;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
private async call(fn: string, ...args: any[]): Promise<any> {
|
|
125
125
|
const resultJson = await this.callRaw(fn, ...args);
|
|
126
126
|
const methodSchema = (WorkerWalletSchema as ApiSchema)[fn];
|
|
127
|
-
|
|
127
|
+
// Void-returning methods (e.g. registerContract) serialize to `undefined` on the worker side, which
|
|
128
|
+
// JSON.parse cannot handle; hand it straight to the schema, whose `z.void()` output accepts undefined.
|
|
129
|
+
return getSchemaReturnType(methodSchema).parseAsync(resultJson === undefined ? undefined : JSON.parse(resultJson));
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
getChainInfo(): Promise<ChainInfo> {
|
|
@@ -158,11 +160,7 @@ export class WorkerWallet implements Wallet {
|
|
|
158
160
|
return this.call('getAccounts');
|
|
159
161
|
}
|
|
160
162
|
|
|
161
|
-
registerContract(
|
|
162
|
-
instance: ContractInstanceWithAddress,
|
|
163
|
-
artifact?: ContractArtifact,
|
|
164
|
-
secretKey?: Fr,
|
|
165
|
-
): Promise<ContractInstanceWithAddress> {
|
|
163
|
+
registerContract(instance: ContractInstancePreimage, artifact?: ContractArtifact, secretKey?: Fr): Promise<void> {
|
|
166
164
|
return this.call('registerContract', instance, artifact, secretKey);
|
|
167
165
|
}
|
|
168
166
|
|
|
@@ -194,8 +192,8 @@ export class WorkerWallet implements Wallet {
|
|
|
194
192
|
}
|
|
195
193
|
|
|
196
194
|
/** Registers an account inside the worker's TestWallet, populating its accounts map. */
|
|
197
|
-
registerAccount(secret: Fr, salt: Fr): Promise<AztecAddress> {
|
|
198
|
-
return this.call('registerAccount', secret, salt);
|
|
195
|
+
registerAccount(secret: Fr, salt: Fr, signingKey: Fq): Promise<AztecAddress> {
|
|
196
|
+
return this.call('registerAccount', secret, salt, signingKey);
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExecutionPayloadSchema, SendOptionsSchema, WalletSchema } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import type { ApiSchema } from '@aztec/foundation/schemas';
|
|
2
3
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { Tx } from '@aztec/stdlib/tx';
|
|
@@ -6,8 +7,8 @@ import { Tx } from '@aztec/stdlib/tx';
|
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
|
|
8
9
|
/** Schema for the WorkerWallet API — extends WalletSchema with proveTx and registerAccount. */
|
|
9
|
-
export const WorkerWalletSchema = {
|
|
10
|
+
export const WorkerWalletSchema: ApiSchema = {
|
|
10
11
|
...WalletSchema,
|
|
11
12
|
proveTx: z.function({ input: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]), output: Tx.schema }),
|
|
12
|
-
registerAccount: z.function({ input: z.tuple([schemas.Fr, schemas.Fr]), output: AztecAddress.schema }),
|
|
13
|
+
registerAccount: z.function({ input: z.tuple([schemas.Fr, schemas.Fr, schemas.Fq]), output: AztecAddress.schema }),
|
|
13
14
|
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { type Logger } from '@aztec/aztec.js/log';
|
|
4
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
|
-
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
6
|
-
import type { CheatCodes } from '@aztec/aztec/testing';
|
|
7
|
-
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
8
|
-
import { GenericProxyContract } from '@aztec/noir-test-contracts.js/GenericProxy';
|
|
9
|
-
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
10
|
-
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
11
|
-
import type { AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { type EndToEndContext, type SetupOptions } from '../fixtures/setup.js';
|
|
13
|
-
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
14
|
-
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
15
|
-
export declare class Role {
|
|
16
|
-
private isAdmin;
|
|
17
|
-
private isMinter;
|
|
18
|
-
private isBlacklisted;
|
|
19
|
-
withAdmin(): this;
|
|
20
|
-
withMinter(): this;
|
|
21
|
-
withBlacklisted(): this;
|
|
22
|
-
toNoirStruct(): {
|
|
23
|
-
is_admin: boolean;
|
|
24
|
-
is_minter: boolean;
|
|
25
|
-
is_blacklisted: boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export declare class BlacklistTokenContractTest {
|
|
29
|
-
static CHANGE_ROLES_DELAY: number;
|
|
30
|
-
context: EndToEndContext;
|
|
31
|
-
logger: Logger;
|
|
32
|
-
wallet: TestWallet;
|
|
33
|
-
asset: TokenBlacklistContract;
|
|
34
|
-
tokenSim: TokenSimulator;
|
|
35
|
-
badAccount: InvalidAccountContract;
|
|
36
|
-
authwitProxy: GenericProxyContract;
|
|
37
|
-
cheatCodes: CheatCodes;
|
|
38
|
-
sequencer: SequencerClient;
|
|
39
|
-
aztecNode: AztecNode & AztecNodeDebug;
|
|
40
|
-
adminAddress: AztecAddress;
|
|
41
|
-
otherAddress: AztecAddress;
|
|
42
|
-
blacklistedAddress: AztecAddress;
|
|
43
|
-
constructor(testName: string);
|
|
44
|
-
crossTimestampOfChange(): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Applies base setup:
|
|
47
|
-
* 1. Add 3 accounts.
|
|
48
|
-
* 2. Publicly deploy accounts, deploy token contract and a "bad account".
|
|
49
|
-
*/
|
|
50
|
-
applyBaseSetup(): Promise<void>;
|
|
51
|
-
setup(opts?: Partial<SetupOptions>): Promise<void>;
|
|
52
|
-
teardown(): Promise<void>;
|
|
53
|
-
addPendingShieldNoteToPXE(contract: TokenBlacklistContract, recipient: AztecAddress, amount: bigint, secretHash: Fr, txHash: TxHash): Promise<void>;
|
|
54
|
-
applyMint(): Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxhY2tsaXN0X3Rva2VuX2NvbnRyYWN0X3Rlc3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lMmVfYmxhY2tsaXN0X3Rva2VuX2NvbnRyYWN0L2JsYWNrbGlzdF90b2tlbl9jb250cmFjdF90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDNUMsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFnQixNQUFNLHFCQUFxQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2pELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRXZELE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBQ2pGLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDRDQUE0QyxDQUFDO0FBQ2xGLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLDhDQUE4QyxDQUFDO0FBQ3RGLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQy9ELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBSXRFLE9BQU8sRUFDTCxLQUFLLGVBQWUsRUFDcEIsS0FBSyxZQUFZLEVBTWxCLE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBQ2xFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRWhFLHFCQUFhLElBQUk7SUFDZixPQUFPLENBQUMsT0FBTyxDQUFTO0lBQ3hCLE9BQU8sQ0FBQyxRQUFRLENBQVM7SUFDekIsT0FBTyxDQUFDLGFBQWEsQ0FBUztJQUU5QixTQUFTLFNBR1I7SUFFRCxVQUFVLFNBR1Q7SUFFRCxlQUFlLFNBR2Q7SUFFRCxZQUFZOzs7O01BSVg7Q0FDRjtBQUVELHFCQUFhLDBCQUEwQjtJQUVyQyxNQUFNLENBQUMsa0JBQWtCLFNBQVM7SUFFbEMsT0FBTyxFQUFHLGVBQWUsQ0FBQztJQUMxQixNQUFNLEVBQUUsTUFBTSxDQUFDO0lBQ2YsTUFBTSxFQUFHLFVBQVUsQ0FBQztJQUNwQixLQUFLLEVBQUcsc0JBQXNCLENBQUM7SUFDL0IsUUFBUSxFQUFHLGNBQWMsQ0FBQztJQUMxQixVQUFVLEVBQUcsc0JBQXNCLENBQUM7SUFDcEMsWUFBWSxFQUFHLG9CQUFvQixDQUFDO0lBQ3BDLFVBQVUsRUFBRyxVQUFVLENBQUM7SUFDeEIsU0FBUyxFQUFHLGVBQWUsQ0FBQztJQUM1QixTQUFTLEVBQUcsU0FBUyxHQUFHLGNBQWMsQ0FBQztJQUV2QyxZQUFZLEVBQUcsWUFBWSxDQUFDO0lBQzVCLFlBQVksRUFBRyxZQUFZLENBQUM7SUFDNUIsa0JBQWtCLEVBQUcsWUFBWSxDQUFDO0lBRWxDLFlBQVksUUFBUSxFQUFFLE1BQU0sRUFFM0I7SUFFSyxzQkFBc0Isa0JBUTNCO0lBRUQ7Ozs7T0FJRztJQUNHLGNBQWMsa0JBOERuQjtJQUVLLEtBQUssQ0FBQyxJQUFJLEdBQUUsT0FBTyxDQUFDLFlBQVksQ0FBTSxpQkFRM0M7SUFFSyxRQUFRLGtCQUViO0lBRUsseUJBQXlCLENBQzdCLFFBQVEsRUFBRSxzQkFBc0IsRUFDaEMsU0FBUyxFQUFFLFlBQVksRUFDdkIsTUFBTSxFQUFFLE1BQU0sRUFDZCxVQUFVLEVBQUUsRUFBRSxFQUNkLE1BQU0sRUFBRSxNQUFNLGlCQWNmO0lBRUssU0FBUyxrQkFtRGQ7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blacklist_token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAMlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,qBAAa,IAAI;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAE9B,SAAS,SAGR;IAED,UAAU,SAGT;IAED,eAAe,SAGd;IAED,YAAY;;;;MAIX;CACF;AAED,qBAAa,0BAA0B;IAErC,MAAM,CAAC,kBAAkB,SAAS;IAElC,OAAO,EAAG,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,UAAU,CAAC;IACpB,KAAK,EAAG,sBAAsB,CAAC;IAC/B,QAAQ,EAAG,cAAc,CAAC;IAC1B,UAAU,EAAG,sBAAsB,CAAC;IACpC,YAAY,EAAG,oBAAoB,CAAC;IACpC,UAAU,EAAG,UAAU,CAAC;IACxB,SAAS,EAAG,eAAe,CAAC;IAC5B,SAAS,EAAG,SAAS,GAAG,cAAc,CAAC;IAEvC,YAAY,EAAG,YAAY,CAAC;IAC5B,YAAY,EAAG,YAAY,CAAC;IAC5B,kBAAkB,EAAG,YAAY,CAAC;IAElC,YAAY,QAAQ,EAAE,MAAM,EAE3B;IAEK,sBAAsB,kBAQ3B;IAED;;;;OAIG;IACG,cAAc,kBA8DnB;IAEK,KAAK,CAAC,IAAI,GAAE,OAAO,CAAC,YAAY,CAAM,iBAQ3C;IAEK,QAAQ,kBAEb;IAEK,yBAAyB,CAC7B,QAAQ,EAAE,sBAAsB,EAChC,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,MAAM,iBAcf;IAEK,SAAS,kBAmDd;CACF"}
|