@aztec/end-to-end 0.0.1-commit.c2eed6949 → 0.0.1-commit.c52d6e7
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 +229 -14
- 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 +23 -36
- 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 +24 -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 +15 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +19 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +6 -6
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +56 -58
- 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 +97 -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/authwit_proxy.d.ts +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -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 +53 -35
- package/dest/fixtures/fixtures.d.ts +79 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +80 -0
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -2
- 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 +2 -2
- package/dest/fixtures/ha_setup.d.ts +4 -4
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +5 -2
- 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/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
- package/dest/fixtures/setup.d.ts +81 -42
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +289 -198
- package/dest/fixtures/setup_p2p_test.d.ts +10 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +11 -11
- 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 +23 -6
- 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_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- 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 +19 -10
- package/dest/p2p/p2p_network.d.ts.map +1 -0
- package/dest/{e2e_p2p → p2p}/p2p_network.js +82 -38
- 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 +32 -29
- 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 +6 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +33 -21
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +26 -15
- 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 +50 -37
- package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
- package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
- package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
- package/dest/simulators/lending_simulator.d.ts +10 -3
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +24 -12
- 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/single-node/fees/fees_test.js +344 -0
- 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 +84 -50
- package/dest/spartan/tx_metrics.d.ts +27 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +105 -20
- package/dest/spartan/utils/config.d.ts +9 -35
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +2 -2
- package/dest/test-wallet/test_wallet.d.ts +39 -10
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +166 -59
- package/dest/test-wallet/utils.d.ts +38 -3
- package/dest/test-wallet/utils.d.ts.map +1 -1
- package/dest/test-wallet/utils.js +65 -10
- package/dest/test-wallet/wallet_worker_script.js +12 -4
- package/dest/test-wallet/worker_wallet.d.ts +9 -8
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +10 -4
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -273
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet_schema.js +15 -2
- package/package.json +47 -42
- 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 +24 -47
- package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +25 -48
- package/src/automine/token/token_test_helpers.ts +138 -0
- package/src/bench/client_flows/benchmark.ts +21 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +106 -80
- package/src/bench/client_flows/data_extractor.ts +1 -0
- package/src/bench/utils.ts +110 -6
- package/src/composed/ha/ha_full_setup.ts +466 -0
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +68 -52
- package/src/fixtures/fixtures.ts +100 -0
- package/src/fixtures/get_acvm_config.ts +2 -8
- package/src/fixtures/get_bb_config.ts +1 -2
- package/src/fixtures/ha_setup.ts +11 -5
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +361 -256
- package/src/fixtures/setup_p2p_test.ts +15 -11
- package/src/fixtures/standard_contracts_genesis.ts +28 -0
- package/src/fixtures/timing.ts +97 -0
- package/src/fixtures/token_utils.ts +40 -8
- package/src/fixtures/utils.ts +2 -3
- package/src/fixtures/wait_helpers.ts +333 -0
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +106 -0
- package/src/guides/up_quick_start.sh +5 -2
- package/src/infra/README.md +12 -0
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -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 +95 -50
- package/src/{e2e_p2p → p2p}/reqresp/utils.ts +35 -28
- package/src/p2p/shared.ts +329 -0
- package/src/shared/cross_chain_test_harness.ts +36 -17
- package/src/shared/gas_portal_test_harness.ts +34 -17
- 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 +80 -43
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +28 -14
- 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/single-node/fees/fees_test.ts +434 -0
- 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 +87 -47
- package/src/spartan/tx_metrics.ts +107 -23
- package/src/spartan/utils/nodes.ts +2 -2
- package/src/test-wallet/test_wallet.ts +185 -60
- package/src/test-wallet/utils.ts +104 -11
- package/src/test-wallet/wallet_worker_script.ts +11 -5
- package/src/test-wallet/worker_wallet.ts +19 -16
- package/src/test-wallet/worker_wallet_schema.ts +4 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -55
- 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 -47
- 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 -129
- 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 -50
- package/dest/e2e_epochs/epochs_test.d.ts +0 -104
- package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
- package/dest/e2e_epochs/epochs_test.js +0 -389
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.d.ts +0 -88
- package/dest/e2e_fees/fees_test.d.ts.map +0 -1
- package/dest/e2e_fees/fees_test.js +0 -255
- 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 -54
- 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 -136
- 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 -66
- package/dest/e2e_p2p/shared.d.ts.map +0 -1
- package/dest/e2e_p2p/shared.js +0 -212
- 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 -193
- package/src/e2e_deploy_contract/deploy_test.ts +0 -85
- package/src/e2e_epochs/epochs_test.ts +0 -499
- package/src/e2e_fees/fees_test.ts +0 -331
- package/src/e2e_l1_publisher/write_json.ts +0 -77
- package/src/e2e_nested_contract/nested_contract_test.ts +0 -75
- package/src/e2e_p2p/inactivity_slash_test.ts +0 -179
- package/src/e2e_p2p/shared.ts +0 -343
- /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
package/src/e2e_p2p/shared.ts
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { NO_WAIT, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
|
-
import { TxHash } from '@aztec/aztec.js/tx';
|
|
8
|
-
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
|
-
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
10
|
-
import type {
|
|
11
|
-
EmpireSlashingProposerContract,
|
|
12
|
-
RollupContract,
|
|
13
|
-
TallySlashingProposerContract,
|
|
14
|
-
} from '@aztec/ethereum/contracts';
|
|
15
|
-
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
16
|
-
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
17
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
18
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
19
|
-
import { pluralize } from '@aztec/foundation/string';
|
|
20
|
-
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
21
|
-
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
22
|
-
import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
23
|
-
import { getRoundForOffense } from '@aztec/slasher';
|
|
24
|
-
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
25
|
-
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
26
|
-
|
|
27
|
-
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
28
|
-
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
29
|
-
import { type ProvenTx, proveInteraction } from '../test-wallet/utils.js';
|
|
30
|
-
|
|
31
|
-
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
32
|
-
export const submitComplexTxsTo = async (
|
|
33
|
-
logger: Logger,
|
|
34
|
-
from: AztecAddress,
|
|
35
|
-
spamContract: SpamContract,
|
|
36
|
-
numTxs: number,
|
|
37
|
-
opts: { callPublic?: boolean } = {},
|
|
38
|
-
) => {
|
|
39
|
-
const txs: TxHash[] = [];
|
|
40
|
-
|
|
41
|
-
const seed = 1234n;
|
|
42
|
-
const spamCount = 15;
|
|
43
|
-
for (let i = 0; i < numTxs; i++) {
|
|
44
|
-
const method = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic);
|
|
45
|
-
const { txHash } = await method.send({ from, wait: NO_WAIT });
|
|
46
|
-
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
47
|
-
txs.push(txHash);
|
|
48
|
-
}
|
|
49
|
-
return txs;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// creates a wallet and submit a given number of transactions through it.
|
|
53
|
-
export const submitTransactions = async (
|
|
54
|
-
logger: Logger,
|
|
55
|
-
node: AztecNodeService,
|
|
56
|
-
numTxs: number,
|
|
57
|
-
fundedAccount: InitialAccountData,
|
|
58
|
-
): Promise<TxHash[]> => {
|
|
59
|
-
const rpcConfig = getRpcConfig();
|
|
60
|
-
rpcConfig.proverEnabled = false;
|
|
61
|
-
const wallet = await TestWallet.create(
|
|
62
|
-
node,
|
|
63
|
-
{ ...getPXEConfig(), proverEnabled: false },
|
|
64
|
-
{ loggerActorLabel: 'pxe-tx' },
|
|
65
|
-
);
|
|
66
|
-
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
67
|
-
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export async function prepareTransactions(
|
|
71
|
-
logger: Logger,
|
|
72
|
-
node: AztecNodeService,
|
|
73
|
-
numTxs: number,
|
|
74
|
-
fundedAccount: InitialAccountData,
|
|
75
|
-
): Promise<ProvenTx[]> {
|
|
76
|
-
const rpcConfig = getRpcConfig();
|
|
77
|
-
rpcConfig.proverEnabled = false;
|
|
78
|
-
|
|
79
|
-
const wallet = await TestWallet.create(
|
|
80
|
-
node,
|
|
81
|
-
{ ...getPXEConfig(), proverEnabled: false },
|
|
82
|
-
{ loggerActorLabel: 'pxe-tx' },
|
|
83
|
-
);
|
|
84
|
-
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
85
|
-
|
|
86
|
-
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
87
|
-
salt: Fr.random(),
|
|
88
|
-
});
|
|
89
|
-
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
90
|
-
const contract = TestContract.at(testContractInstance.address, wallet);
|
|
91
|
-
|
|
92
|
-
return timesAsync(numTxs, async () => {
|
|
93
|
-
const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
|
|
94
|
-
from: fundedAccountManager.address,
|
|
95
|
-
});
|
|
96
|
-
logger.info(`Tx prepared with hash ${tx.getTxHash()}`);
|
|
97
|
-
return tx;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function awaitProposalExecution(
|
|
102
|
-
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract,
|
|
103
|
-
timeoutSeconds: number,
|
|
104
|
-
logger: Logger,
|
|
105
|
-
): Promise<bigint> {
|
|
106
|
-
return new Promise<bigint>((resolve, reject) => {
|
|
107
|
-
const timeout = setTimeout(() => {
|
|
108
|
-
logger.warn(`Timed out waiting for proposal execution`);
|
|
109
|
-
reject(new Error(`Timeout waiting for proposal execution after ${timeoutSeconds}s`));
|
|
110
|
-
}, timeoutSeconds * 1000);
|
|
111
|
-
|
|
112
|
-
if (slashingProposer.type === 'empire') {
|
|
113
|
-
const unwatch = slashingProposer.listenToPayloadSubmitted(args => {
|
|
114
|
-
logger.warn(`Proposal ${args.payload} from round ${args.round} executed`);
|
|
115
|
-
clearTimeout(timeout);
|
|
116
|
-
unwatch();
|
|
117
|
-
resolve(args.round);
|
|
118
|
-
});
|
|
119
|
-
} else if (slashingProposer.type === 'tally') {
|
|
120
|
-
const unwatch = slashingProposer.listenToRoundExecuted(args => {
|
|
121
|
-
logger.warn(`Slash from round ${args.round} executed`);
|
|
122
|
-
clearTimeout(timeout);
|
|
123
|
-
unwatch();
|
|
124
|
-
resolve(args.round);
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
clearTimeout(timeout);
|
|
128
|
-
reject(new Error(`Unknown slashing proposer type: ${(slashingProposer as any).type}`));
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export async function awaitCommitteeExists({
|
|
134
|
-
rollup,
|
|
135
|
-
logger,
|
|
136
|
-
}: {
|
|
137
|
-
rollup: RollupContract;
|
|
138
|
-
logger: Logger;
|
|
139
|
-
}): Promise<readonly `0x${string}`[]> {
|
|
140
|
-
logger.info(`Waiting for committee to be set`);
|
|
141
|
-
let committee: EthAddress[] | undefined;
|
|
142
|
-
await retryUntil(
|
|
143
|
-
async () => {
|
|
144
|
-
committee = await rollup.getCurrentEpochCommittee();
|
|
145
|
-
return committee && committee.length > 0;
|
|
146
|
-
},
|
|
147
|
-
'non-empty committee',
|
|
148
|
-
60,
|
|
149
|
-
);
|
|
150
|
-
logger.warn(`Committee has been formed`, { committee: committee!.map(c => c.toString()) });
|
|
151
|
-
return committee!.map(c => c.toString() as `0x${string}`);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Advance epochs until we find one where the target proposer is selected for at least one slot,
|
|
156
|
-
* then stop one epoch before it. This leaves time for the caller to start sequencers before
|
|
157
|
-
* warping to the target epoch, avoiding the race where the target epoch passes before sequencers
|
|
158
|
-
* are ready.
|
|
159
|
-
*
|
|
160
|
-
* Returns the target epoch number so the caller can warp to it after starting sequencers.
|
|
161
|
-
*/
|
|
162
|
-
export async function advanceToEpochBeforeProposer({
|
|
163
|
-
epochCache,
|
|
164
|
-
cheatCodes,
|
|
165
|
-
targetProposer,
|
|
166
|
-
logger,
|
|
167
|
-
maxAttempts = 20,
|
|
168
|
-
}: {
|
|
169
|
-
epochCache: EpochCacheInterface;
|
|
170
|
-
cheatCodes: RollupCheatCodes;
|
|
171
|
-
targetProposer: EthAddress;
|
|
172
|
-
logger: Logger;
|
|
173
|
-
maxAttempts?: number;
|
|
174
|
-
}): Promise<{ targetEpoch: EpochNumber }> {
|
|
175
|
-
const { epochDuration } = await cheatCodes.getConfig();
|
|
176
|
-
|
|
177
|
-
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
178
|
-
const currentEpoch = await cheatCodes.getEpoch();
|
|
179
|
-
// Check the NEXT epoch's slots so we stay one epoch before the target,
|
|
180
|
-
// giving the caller time to start sequencers before the target epoch arrives.
|
|
181
|
-
const nextEpoch = Number(currentEpoch) + 1;
|
|
182
|
-
const startSlot = nextEpoch * Number(epochDuration);
|
|
183
|
-
const endSlot = startSlot + Number(epochDuration);
|
|
184
|
-
|
|
185
|
-
logger.info(
|
|
186
|
-
`Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
for (let s = startSlot; s < endSlot; s++) {
|
|
190
|
-
const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
|
|
191
|
-
if (proposer && proposer.equals(targetProposer)) {
|
|
192
|
-
logger.warn(
|
|
193
|
-
`Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
|
|
194
|
-
);
|
|
195
|
-
return { targetEpoch: EpochNumber(nextEpoch) };
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
logger.info(`Target proposer not found in epoch ${nextEpoch}, advancing to next epoch`);
|
|
200
|
-
await cheatCodes.advanceToNextEpoch();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
throw new Error(`Target proposer ${targetProposer} not found in any slot after ${maxAttempts} epoch attempts`);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export async function awaitOffenseDetected({
|
|
207
|
-
logger,
|
|
208
|
-
nodeAdmin,
|
|
209
|
-
slashingRoundSize,
|
|
210
|
-
epochDuration,
|
|
211
|
-
waitUntilOffenseCount,
|
|
212
|
-
timeoutSeconds = 120,
|
|
213
|
-
}: {
|
|
214
|
-
nodeAdmin: AztecNodeAdmin;
|
|
215
|
-
logger: Logger;
|
|
216
|
-
slashingRoundSize: number;
|
|
217
|
-
epochDuration: number;
|
|
218
|
-
waitUntilOffenseCount?: number;
|
|
219
|
-
timeoutSeconds?: number;
|
|
220
|
-
}) {
|
|
221
|
-
const targetOffenseCount = waitUntilOffenseCount ?? 1;
|
|
222
|
-
logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
|
|
223
|
-
const offenses = await retryUntil(
|
|
224
|
-
async () => {
|
|
225
|
-
const offenses = await nodeAdmin.getSlashOffenses('all');
|
|
226
|
-
if (offenses.length >= targetOffenseCount) {
|
|
227
|
-
return offenses;
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
'non-empty offenses',
|
|
231
|
-
timeoutSeconds,
|
|
232
|
-
);
|
|
233
|
-
logger.info(
|
|
234
|
-
`Hit ${offenses.length} offenses on rounds ${unique(offenses.map(o => getRoundForOffense(o, { slashingRoundSize, epochDuration })))}`,
|
|
235
|
-
{ offenses },
|
|
236
|
-
);
|
|
237
|
-
return offenses;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Await the committee to be slashed out of the validator set.
|
|
242
|
-
* Currently assumes that the committee is the same size as the validator set.
|
|
243
|
-
*/
|
|
244
|
-
export async function awaitCommitteeKicked({
|
|
245
|
-
rollup,
|
|
246
|
-
cheatCodes,
|
|
247
|
-
committee,
|
|
248
|
-
slashFactory,
|
|
249
|
-
slashingProposer,
|
|
250
|
-
slashingRoundSize,
|
|
251
|
-
aztecSlotDuration,
|
|
252
|
-
aztecEpochDuration,
|
|
253
|
-
logger,
|
|
254
|
-
offenseEpoch,
|
|
255
|
-
}: {
|
|
256
|
-
rollup: RollupContract;
|
|
257
|
-
cheatCodes: RollupCheatCodes;
|
|
258
|
-
committee: readonly `0x${string}`[];
|
|
259
|
-
slashFactory: SlashFactoryContract;
|
|
260
|
-
slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract | undefined;
|
|
261
|
-
slashingRoundSize: number;
|
|
262
|
-
aztecSlotDuration: number;
|
|
263
|
-
aztecEpochDuration: number;
|
|
264
|
-
logger: Logger;
|
|
265
|
-
offenseEpoch: number;
|
|
266
|
-
}) {
|
|
267
|
-
if (!slashingProposer) {
|
|
268
|
-
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
await cheatCodes.debugRollup();
|
|
272
|
-
|
|
273
|
-
if (slashingProposer.type === 'empire') {
|
|
274
|
-
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
275
|
-
const targetEpoch = EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1);
|
|
276
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
277
|
-
await cheatCodes.advanceToEpoch(targetEpoch);
|
|
278
|
-
|
|
279
|
-
const slashPayloadEvents = await retryUntil(
|
|
280
|
-
async () => {
|
|
281
|
-
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
282
|
-
return events.length > 0 ? events : undefined;
|
|
283
|
-
},
|
|
284
|
-
'slash payload created',
|
|
285
|
-
120,
|
|
286
|
-
1,
|
|
287
|
-
);
|
|
288
|
-
expect(slashPayloadEvents.length).toBe(1);
|
|
289
|
-
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
290
|
-
expect(unique(slashPayloadEvents[0].slashes.map(slash => slash.validator.toString()))).toHaveLength(
|
|
291
|
-
committee.length,
|
|
292
|
-
);
|
|
293
|
-
} else {
|
|
294
|
-
// Use the slash offset to ensure we are in the right epoch for tally
|
|
295
|
-
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
296
|
-
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
297
|
-
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
298
|
-
const firstEpochInOffenseRound = offenseEpoch - (offenseEpoch % slashingRoundSizeInEpochs);
|
|
299
|
-
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
300
|
-
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
301
|
-
await cheatCodes.advanceToEpoch(EpochNumber(targetEpoch), { offset: -aztecSlotDuration / 2 });
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const attestersPre = await rollup.getAttesters();
|
|
305
|
-
expect(attestersPre.length).toBe(committee.length);
|
|
306
|
-
|
|
307
|
-
for (const attester of attestersPre) {
|
|
308
|
-
const attesterInfo = await rollup.getAttesterView(attester);
|
|
309
|
-
expect(attesterInfo.status).toEqual(1); // Validating
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
|
|
313
|
-
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
314
|
-
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
315
|
-
|
|
316
|
-
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
317
|
-
await cheatCodes.debugRollup();
|
|
318
|
-
const committeePostSlashing = await rollup.getCurrentEpochCommittee();
|
|
319
|
-
expect(committeePostSlashing?.length).toBe(attestersPre.length);
|
|
320
|
-
|
|
321
|
-
const attestersPostSlashing = await rollup.getAttesters();
|
|
322
|
-
expect(attestersPostSlashing.length).toBe(0);
|
|
323
|
-
|
|
324
|
-
for (const attester of attestersPre) {
|
|
325
|
-
const attesterInfo = await rollup.getAttesterView(attester);
|
|
326
|
-
expect(attesterInfo.status).toEqual(2); // Living
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
logger.info(`Advancing to check current committee`);
|
|
330
|
-
await cheatCodes.debugRollup();
|
|
331
|
-
await cheatCodes.advanceToEpoch(
|
|
332
|
-
EpochNumber((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochsForValidatorSet()) + 1),
|
|
333
|
-
);
|
|
334
|
-
await cheatCodes.debugRollup();
|
|
335
|
-
|
|
336
|
-
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
337
|
-
// The committee should be undefined, since the validator set is empty
|
|
338
|
-
// and the tests currently using this helper always set a target committee size.
|
|
339
|
-
expect(committeeNextEpoch).toBeUndefined();
|
|
340
|
-
|
|
341
|
-
const attestersNextEpoch = await rollup.getAttesters();
|
|
342
|
-
expect(attestersNextEpoch.length).toBe(0);
|
|
343
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts}
RENAMED
|
File without changes
|