@aztec/end-to-end 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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 +27 -0
- package/dest/bench/client_flows/benchmark.d.ts +17 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +38 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +23 -17
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +143 -136
- 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/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +7 -27
- package/dest/bench/utils.d.ts +8 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +33 -19
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +12 -10
- 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 +120 -117
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +33 -16
- 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 +124 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +7 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +20 -14
- package/dest/e2e_epochs/epochs_test.d.ts +49 -16
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +188 -64
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +5 -7
- package/dest/e2e_fees/fees_test.d.ts +25 -18
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +162 -141
- 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 +18 -19
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +32 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +11 -9
- package/dest/e2e_p2p/p2p_network.d.ts +237 -28
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +176 -129
- 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 +206 -0
- package/dest/e2e_p2p/shared.d.ts +44 -15
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +102 -68
- 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 +20 -11
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +103 -93
- 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 +34 -0
- package/dest/fixtures/e2e_prover_test.d.ts +19 -24
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +126 -145
- 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 +75 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +73 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- 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/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- 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 +272 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +735 -0
- package/dest/fixtures/setup_p2p_test.d.ts +22 -11
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +57 -38
- package/dest/fixtures/token_utils.d.ts +6 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +13 -9
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/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/index.d.ts +1 -1
- 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/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +9 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +34 -30
- 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 +21 -12
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.d.ts +1 -1
- 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 +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +87 -50
- 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/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +11 -4
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +32 -18
- 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 +18 -6
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +159 -30
- package/dest/spartan/tx_metrics.d.ts +102 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +475 -0
- 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 +19 -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 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/dest/test-wallet/test_wallet.d.ts +85 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +273 -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 +66 -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 +53 -0
- package/dest/test-wallet/worker_wallet.d.ts +53 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +155 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +22 -0
- package/package.json +56 -46
- package/src/bench/client_flows/benchmark.ts +43 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +203 -206
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +38 -22
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +141 -152
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +180 -127
- package/src/e2e_deploy_contract/deploy_test.ts +25 -17
- package/src/e2e_epochs/epochs_test.ts +254 -116
- package/src/e2e_fees/bridging_race.notest.ts +6 -12
- package/src/e2e_fees/fees_test.ts +215 -229
- package/src/e2e_l1_publisher/write_json.ts +20 -19
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +38 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +12 -10
- package/src/e2e_p2p/p2p_network.ts +246 -201
- package/src/e2e_p2p/reqresp/utils.ts +274 -0
- package/src/e2e_p2p/shared.ts +132 -82
- 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 +129 -117
- package/src/fixtures/authwit_proxy.ts +54 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +154 -199
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +95 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +188 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +1056 -0
- package/src/fixtures/setup_p2p_test.ts +70 -56
- package/src/fixtures/token_utils.ts +9 -8
- package/src/fixtures/utils.ts +29 -947
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +4 -6
- package/src/install_legacy_contracts.cjs +75 -0
- package/src/legacy-jest-resolver.cjs +112 -0
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +37 -40
- package/src/shared/gas_portal_test_harness.ts +24 -14
- package/src/shared/index.ts +2 -1
- 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 +142 -114
- package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
- package/src/simulators/lending_simulator.ts +39 -19
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +234 -32
- package/src/spartan/tx_metrics.ts +434 -0
- 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 -942
- package/src/test-wallet/test_wallet.ts +376 -0
- package/src/test-wallet/utils.ts +108 -0
- package/src/test-wallet/wallet_worker_script.ts +63 -0
- package/src/test-wallet/worker_wallet.ts +218 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -109,7 +109,9 @@ export class TokenSimulator {
|
|
|
109
109
|
await Promise.all(
|
|
110
110
|
chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
|
|
111
111
|
)
|
|
112
|
-
)
|
|
112
|
+
)
|
|
113
|
+
.flatMap(r => r.result)
|
|
114
|
+
.map(r => r.result);
|
|
113
115
|
expect(results[0]).toEqual(this.totalSupply);
|
|
114
116
|
|
|
115
117
|
// Check that all our balances match
|
|
@@ -119,39 +121,13 @@ export class TokenSimulator {
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
async checkPrivate() {
|
|
122
|
-
// Private calls
|
|
123
|
-
const defaultLookups = [];
|
|
124
|
-
const nonDefaultLookups = [];
|
|
125
|
-
|
|
126
124
|
for (const address of this.accounts) {
|
|
127
|
-
if (this.lookupProvider.has(address.toString())) {
|
|
128
|
-
nonDefaultLookups.push(address);
|
|
129
|
-
} else {
|
|
130
|
-
defaultLookups.push(address);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const defaultCalls = defaultLookups.map(address => this.token.methods.balance_of_private(address));
|
|
135
|
-
const results = (
|
|
136
|
-
await Promise.all(
|
|
137
|
-
chunk(defaultCalls, 4).map(batch =>
|
|
138
|
-
new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress }),
|
|
139
|
-
),
|
|
140
|
-
)
|
|
141
|
-
).flat();
|
|
142
|
-
for (let i = 0; i < defaultLookups.length; i++) {
|
|
143
|
-
expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// We are just running individual calls for the non-default lookups
|
|
147
|
-
// @todo We should also batch these
|
|
148
|
-
for (const address of nonDefaultLookups) {
|
|
149
125
|
const wallet = this.lookupProvider.get(address.toString());
|
|
150
126
|
const asset = wallet ? this.token.withWallet(wallet) : this.token;
|
|
151
127
|
|
|
152
|
-
const actualPrivateBalance = await asset.methods
|
|
153
|
-
.balance_of_private(
|
|
154
|
-
.simulate({ from:
|
|
128
|
+
const { result: actualPrivateBalance } = await asset.methods
|
|
129
|
+
.balance_of_private(address)
|
|
130
|
+
.simulate({ from: address });
|
|
155
131
|
expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
|
|
156
132
|
}
|
|
157
133
|
}
|
package/src/spartan/DEVELOP.md
CHANGED
|
@@ -61,10 +61,17 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
|
|
|
61
61
|
- the containers for the aztec infrastructure (validators, provers, etc)
|
|
62
62
|
|
|
63
63
|
# Deploy Metrics
|
|
64
|
+
|
|
64
65
|
```bash
|
|
65
66
|
./spartan/bootstrap.sh metrics-kind
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
# Install Chaos Mesh
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
./spartan/bootstrap.sh chaos-mesh
|
|
73
|
+
```
|
|
74
|
+
|
|
68
75
|
# Deploy stuff
|
|
69
76
|
|
|
70
77
|
```bash
|
|
@@ -1,21 +1,29 @@
|
|
|
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 {
|
|
9
|
+
import { waitForL1ToL2MessageReady } from '@aztec/aztec.js/messaging';
|
|
10
|
+
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
8
11
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { createEthereumChain
|
|
12
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
13
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
14
|
import type { Logger } from '@aztec/foundation/log';
|
|
11
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
15
|
+
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
12
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
13
17
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
14
|
-
import {
|
|
18
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
19
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
15
20
|
|
|
16
21
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
17
22
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
18
23
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
24
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
25
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
26
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
19
27
|
|
|
20
28
|
export interface TestAccounts {
|
|
21
29
|
aztecNode: AztecNode;
|
|
@@ -28,6 +36,11 @@ export interface TestAccounts {
|
|
|
28
36
|
tokenAddress: AztecAddress;
|
|
29
37
|
}
|
|
30
38
|
|
|
39
|
+
export type TestAccountsWithoutTokens = Omit<
|
|
40
|
+
TestAccounts,
|
|
41
|
+
'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
|
|
42
|
+
>;
|
|
43
|
+
|
|
31
44
|
const TOKEN_NAME = 'USDC';
|
|
32
45
|
const TOKEN_SYMBOL = 'USD';
|
|
33
46
|
const TOKEN_DECIMALS = 18n;
|
|
@@ -42,14 +55,14 @@ export async function setupTestAccountsWithTokens(
|
|
|
42
55
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
43
56
|
const wallet = await TestWallet.create(aztecNode);
|
|
44
57
|
|
|
45
|
-
const [recipientAccount, ...accounts] = (await
|
|
58
|
+
const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
|
|
46
59
|
0,
|
|
47
60
|
ACCOUNT_COUNT + 1,
|
|
48
61
|
);
|
|
49
62
|
|
|
50
63
|
const tokenAdmin = accounts[0];
|
|
51
64
|
const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
|
|
52
|
-
const tokenContract =
|
|
65
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
53
66
|
|
|
54
67
|
return {
|
|
55
68
|
aztecNode,
|
|
@@ -63,7 +76,7 @@ export async function setupTestAccountsWithTokens(
|
|
|
63
76
|
};
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
export async function
|
|
79
|
+
export async function deploySponsoredTestAccountsWithTokens(
|
|
67
80
|
wallet: TestWallet,
|
|
68
81
|
aztecNode: AztecNode,
|
|
69
82
|
mintAmount: bigint,
|
|
@@ -78,11 +91,19 @@ export async function deploySponsoredTestAccounts(
|
|
|
78
91
|
|
|
79
92
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
80
93
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
81
|
-
await recipientDeployMethod.send({
|
|
94
|
+
await recipientDeployMethod.send({
|
|
95
|
+
from: NO_FROM,
|
|
96
|
+
fee: { paymentMethod },
|
|
97
|
+
wait: { timeout: 2400 },
|
|
98
|
+
});
|
|
82
99
|
await Promise.all(
|
|
83
100
|
fundedAccounts.map(async a => {
|
|
84
101
|
const deployMethod = await a.getDeployMethod();
|
|
85
|
-
await deployMethod.send({
|
|
102
|
+
await deployMethod.send({
|
|
103
|
+
from: NO_FROM,
|
|
104
|
+
fee: { paymentMethod },
|
|
105
|
+
wait: { timeout: 2400 },
|
|
106
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
86
107
|
logger.info(`Account deployed at ${a.address}`);
|
|
87
108
|
}),
|
|
88
109
|
);
|
|
@@ -96,7 +117,7 @@ export async function deploySponsoredTestAccounts(
|
|
|
96
117
|
new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
|
|
97
118
|
logger,
|
|
98
119
|
);
|
|
99
|
-
const tokenContract =
|
|
120
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
100
121
|
|
|
101
122
|
return {
|
|
102
123
|
aztecNode,
|
|
@@ -110,6 +131,138 @@ export async function deploySponsoredTestAccounts(
|
|
|
110
131
|
};
|
|
111
132
|
}
|
|
112
133
|
|
|
134
|
+
async function deployAccountWithDiagnostics(
|
|
135
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
136
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
137
|
+
aztecNode: AztecNode,
|
|
138
|
+
logger: Logger,
|
|
139
|
+
accountLabel: string,
|
|
140
|
+
estimateGas?: boolean,
|
|
141
|
+
): Promise<void> {
|
|
142
|
+
const deployMethod = await account.getDeployMethod();
|
|
143
|
+
let gasSettings: any;
|
|
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
|
+
|
|
150
|
+
// Track the tx hash across retries so we don't re-send when the previous tx is still pending.
|
|
151
|
+
let sentTxHash: { txHash: any } | undefined;
|
|
152
|
+
|
|
153
|
+
await retry(
|
|
154
|
+
async () => {
|
|
155
|
+
// Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
|
|
156
|
+
const existing = await aztecNode.getContract(account.address);
|
|
157
|
+
if (existing) {
|
|
158
|
+
logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// If we already sent a tx, check if it was dropped before deciding to re-send.
|
|
163
|
+
if (sentTxHash) {
|
|
164
|
+
const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
|
|
165
|
+
if (prevReceipt.isDropped()) {
|
|
166
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
|
|
167
|
+
sentTxHash = undefined;
|
|
168
|
+
} else {
|
|
169
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!sentTxHash) {
|
|
174
|
+
const deployResult = await deployMethod.send({
|
|
175
|
+
from: NO_FROM,
|
|
176
|
+
fee: { paymentMethod, gasSettings },
|
|
177
|
+
wait: NO_WAIT,
|
|
178
|
+
});
|
|
179
|
+
sentTxHash = { txHash: deployResult.txHash };
|
|
180
|
+
logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
|
|
184
|
+
if (receipt.isDropped()) {
|
|
185
|
+
sentTxHash = undefined;
|
|
186
|
+
throw new Error(`${accountLabel} tx was dropped, retrying...`);
|
|
187
|
+
}
|
|
188
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
189
|
+
},
|
|
190
|
+
`deploy ${accountLabel}`,
|
|
191
|
+
makeBackoff([1, 2, 4, 8, 16]),
|
|
192
|
+
logger,
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function deployAccountsInBatches(
|
|
197
|
+
accounts: {
|
|
198
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
199
|
+
address: any;
|
|
200
|
+
}[],
|
|
201
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
202
|
+
aztecNode: AztecNode,
|
|
203
|
+
logger: Logger,
|
|
204
|
+
labelPrefix: string,
|
|
205
|
+
batchSize = 2,
|
|
206
|
+
estimateGas?: boolean,
|
|
207
|
+
): Promise<void> {
|
|
208
|
+
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
209
|
+
const batch = accounts.slice(i, i + batchSize);
|
|
210
|
+
await Promise.all(
|
|
211
|
+
batch.map((account, idx) =>
|
|
212
|
+
deployAccountWithDiagnostics(
|
|
213
|
+
account,
|
|
214
|
+
paymentMethod,
|
|
215
|
+
aztecNode,
|
|
216
|
+
logger,
|
|
217
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
218
|
+
estimateGas,
|
|
219
|
+
),
|
|
220
|
+
),
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export async function deploySponsoredTestAccounts(
|
|
226
|
+
wallet: TestWallet,
|
|
227
|
+
aztecNode: AztecNode,
|
|
228
|
+
logger: Logger,
|
|
229
|
+
numberOfFundedWallets = 1,
|
|
230
|
+
opts?: { estimateGas?: boolean },
|
|
231
|
+
): Promise<TestAccountsWithoutTokens> {
|
|
232
|
+
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
233
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
234
|
+
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
235
|
+
|
|
236
|
+
await registerSponsoredFPC(wallet);
|
|
237
|
+
|
|
238
|
+
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
239
|
+
|
|
240
|
+
await deployAccountWithDiagnostics(
|
|
241
|
+
recipientAccount,
|
|
242
|
+
paymentMethod,
|
|
243
|
+
aztecNode,
|
|
244
|
+
logger,
|
|
245
|
+
'Recipient account',
|
|
246
|
+
opts?.estimateGas,
|
|
247
|
+
);
|
|
248
|
+
await deployAccountsInBatches(
|
|
249
|
+
fundedAccounts,
|
|
250
|
+
paymentMethod,
|
|
251
|
+
aztecNode,
|
|
252
|
+
logger,
|
|
253
|
+
'Funded account ',
|
|
254
|
+
2,
|
|
255
|
+
opts?.estimateGas,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
aztecNode,
|
|
260
|
+
wallet,
|
|
261
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
262
|
+
recipientAddress: recipientAccount.address,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
113
266
|
export async function deployTestAccountsWithTokens(
|
|
114
267
|
nodeUrl: string,
|
|
115
268
|
l1RpcUrls: string[],
|
|
@@ -138,7 +291,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
138
291
|
fundedAccounts.map(async (a, i) => {
|
|
139
292
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
140
293
|
const deployMethod = await a.getDeployMethod();
|
|
141
|
-
await deployMethod.send({ from:
|
|
294
|
+
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
|
|
142
295
|
logger.info(`Account deployed at ${a.address}`);
|
|
143
296
|
}),
|
|
144
297
|
);
|
|
@@ -152,7 +305,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
152
305
|
undefined,
|
|
153
306
|
logger,
|
|
154
307
|
);
|
|
155
|
-
const tokenContract =
|
|
308
|
+
const tokenContract = TokenContract.at(tokenAddress, wallet);
|
|
156
309
|
|
|
157
310
|
return {
|
|
158
311
|
aztecNode,
|
|
@@ -181,9 +334,7 @@ async function bridgeL1FeeJuice(
|
|
|
181
334
|
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
182
335
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
183
336
|
|
|
184
|
-
|
|
185
|
-
(await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
186
|
-
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
337
|
+
await waitForL1ToL2MessageReady(aztecNode, Fr.fromHexString(claim.messageHash), { timeoutSeconds: 24 });
|
|
187
338
|
|
|
188
339
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
189
340
|
return claim;
|
|
@@ -214,25 +365,29 @@ async function deployTokenAndMint(
|
|
|
214
365
|
logger: Logger,
|
|
215
366
|
) {
|
|
216
367
|
logger.verbose(`Deploying TokenContract...`);
|
|
217
|
-
const tokenContract = await TokenContract.deploy(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
368
|
+
const { contract: tokenContract } = await TokenContract.deploy(
|
|
369
|
+
wallet,
|
|
370
|
+
admin,
|
|
371
|
+
TOKEN_NAME,
|
|
372
|
+
TOKEN_SYMBOL,
|
|
373
|
+
TOKEN_DECIMALS,
|
|
374
|
+
).send({
|
|
375
|
+
from: admin,
|
|
376
|
+
fee: {
|
|
377
|
+
paymentMethod,
|
|
378
|
+
},
|
|
379
|
+
wait: { timeout: 600 },
|
|
380
|
+
});
|
|
225
381
|
|
|
226
382
|
const tokenAddress = tokenContract.address;
|
|
227
383
|
|
|
228
384
|
logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
|
|
229
385
|
|
|
230
386
|
await Promise.all(
|
|
231
|
-
accounts.map(
|
|
232
|
-
|
|
233
|
-
.mint_to_public(acc, mintAmount)
|
|
234
|
-
.send({ from: admin, fee: { paymentMethod } })
|
|
235
|
-
.wait({ timeout: 600 }),
|
|
387
|
+
accounts.map(acc =>
|
|
388
|
+
TokenContract.at(tokenAddress, wallet)
|
|
389
|
+
.methods.mint_to_public(acc, mintAmount)
|
|
390
|
+
.send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
|
|
236
391
|
),
|
|
237
392
|
);
|
|
238
393
|
|
|
@@ -260,8 +415,8 @@ export async function performTransfers({
|
|
|
260
415
|
// Default to sponsored fee payment if no fee method is provided
|
|
261
416
|
const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
262
417
|
for (let i = 0; i < rounds; i++) {
|
|
263
|
-
const txs = testAccounts.accounts.map(
|
|
264
|
-
const token =
|
|
418
|
+
const txs = testAccounts.accounts.map(acc => {
|
|
419
|
+
const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
|
|
265
420
|
return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
|
|
266
421
|
from: acc,
|
|
267
422
|
fee: {
|
|
@@ -272,17 +427,25 @@ export async function performTransfers({
|
|
|
272
427
|
|
|
273
428
|
const provenTxs = await Promise.all(txs);
|
|
274
429
|
|
|
275
|
-
|
|
430
|
+
// Wait only for the txs to be proposed, not checkpointed. This is enough to keep the chain
|
|
431
|
+
// loaded for the reorg scenario, and avoids each round blocking on the (slower) checkpoint lag.
|
|
432
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600, waitForStatus: TxStatus.PROPOSED } })));
|
|
276
433
|
|
|
277
434
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
278
435
|
}
|
|
279
436
|
}
|
|
280
437
|
|
|
438
|
+
export type WalletWrapper = {
|
|
439
|
+
wallet: TestWallet;
|
|
440
|
+
aztecNode: AztecNode;
|
|
441
|
+
cleanup: () => Promise<void>;
|
|
442
|
+
};
|
|
443
|
+
|
|
281
444
|
export async function createWalletAndAztecNodeClient(
|
|
282
445
|
nodeUrl: string,
|
|
283
446
|
proverEnabled: boolean,
|
|
284
447
|
logger: Logger,
|
|
285
|
-
): Promise<
|
|
448
|
+
): Promise<WalletWrapper> {
|
|
286
449
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
287
450
|
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
288
451
|
const pxeConfig = {
|
|
@@ -304,3 +467,42 @@ export async function createWalletAndAztecNodeClient(
|
|
|
304
467
|
},
|
|
305
468
|
};
|
|
306
469
|
}
|
|
470
|
+
|
|
471
|
+
export type WorkerWalletWrapper = {
|
|
472
|
+
wallet: WorkerWallet;
|
|
473
|
+
aztecNode: AztecNode;
|
|
474
|
+
cleanup: () => Promise<void>;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export async function createWorkerWalletClient(
|
|
478
|
+
nodeUrl: string,
|
|
479
|
+
proverEnabled: boolean,
|
|
480
|
+
logger: Logger,
|
|
481
|
+
): Promise<WorkerWalletWrapper> {
|
|
482
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
483
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
484
|
+
|
|
485
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
486
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
487
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
488
|
+
|
|
489
|
+
const pxeConfig = {
|
|
490
|
+
dataDirectory: undefined,
|
|
491
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
492
|
+
...bbPaths,
|
|
493
|
+
...acvmPaths,
|
|
494
|
+
proverEnabled,
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
498
|
+
|
|
499
|
+
return {
|
|
500
|
+
wallet,
|
|
501
|
+
aztecNode,
|
|
502
|
+
async cleanup() {
|
|
503
|
+
await wallet.stop();
|
|
504
|
+
await bbCleanup?.();
|
|
505
|
+
await acvmCleanup?.();
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
}
|