@aztec/end-to-end 0.0.1-commit.5daedc8 → 0.0.1-commit.6a729f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +14 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +123 -136
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +9 -8
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -18
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
- 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 +96 -112
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
- 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 +91 -71
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +17 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +44 -20
- package/dest/e2e_fees/bridging_race.notest.js +4 -6
- package/dest/e2e_fees/fees_test.d.ts +20 -16
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +126 -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 +14 -16
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +31 -39
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +4 -4
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +6 -9
- package/dest/e2e_p2p/p2p_network.d.ts +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +120 -111
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +7 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +13 -20
- package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +89 -91
- package/dest/fixtures/e2e_prover_test.d.ts +10 -18
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +91 -103
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.js +1 -1
- 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/setup.d.ts +218 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +695 -0
- package/dest/fixtures/setup_p2p_test.d.ts +4 -5
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +27 -22
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +7 -4
- package/dest/fixtures/utils.d.ts +5 -637
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- 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/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 +18 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -14
- package/dest/shared/gas_portal_test_harness.d.ts +12 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- 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 +55 -35
- package/dest/simulators/lending_simulator.d.ts +6 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +63 -35
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +422 -0
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -220
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -782
- package/package.json +42 -41
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +145 -208
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +30 -20
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
- package/src/e2e_deploy_contract/deploy_test.ts +21 -14
- package/src/e2e_epochs/epochs_test.ts +92 -53
- package/src/e2e_fees/bridging_race.notest.ts +4 -10
- package/src/e2e_fees/fees_test.ts +179 -221
- package/src/e2e_l1_publisher/write_json.ts +16 -16
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +9 -12
- package/src/e2e_p2p/p2p_network.ts +180 -183
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +31 -28
- package/src/e2e_token_contract/token_contract_test.ts +103 -118
- package/src/fixtures/e2e_prover_test.ts +104 -141
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +18 -23
- package/src/fixtures/token_utils.ts +6 -5
- package/src/fixtures/utils.ts +27 -966
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- 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 +19 -36
- package/src/shared/gas_portal_test_harness.ts +2 -2
- package/src/shared/index.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +65 -86
- package/src/simulators/lending_simulator.ts +3 -3
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +81 -26
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -982
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- 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
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import {
|
|
3
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
4
|
+
import { GSEContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
6
|
+
import { MultiAdderArtifact } from '@aztec/ethereum/l1-artifacts';
|
|
7
|
+
import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
|
|
4
8
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
9
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
6
10
|
import { SecretValue } from '@aztec/foundation/config';
|
|
@@ -16,9 +20,8 @@ import { getGenesisValues } from '@aztec/world-state/testing';
|
|
|
16
20
|
import getPort from 'get-port';
|
|
17
21
|
import { getAddress, getContract } from 'viem';
|
|
18
22
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
23
|
+
import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, setup, teardown } from '../fixtures/setup.js';
|
|
19
24
|
import { ATTESTER_PRIVATE_KEYS_START_INDEX, createValidatorConfig, generatePrivateKeys } from '../fixtures/setup_p2p_test.js';
|
|
20
|
-
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
21
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress } from '../fixtures/utils.js';
|
|
22
25
|
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
23
26
|
// Use a fixed bootstrap node private key so that we can re-use the same snapshot and the nodes can find each other
|
|
24
27
|
const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f20670603a756ad8d84f2c94263a6427c591';
|
|
@@ -36,7 +39,7 @@ export class P2PNetworkTest {
|
|
|
36
39
|
numberOfValidators;
|
|
37
40
|
numberOfNodes;
|
|
38
41
|
metricsPort;
|
|
39
|
-
|
|
42
|
+
context;
|
|
40
43
|
baseAccountPrivateKey;
|
|
41
44
|
baseAccount;
|
|
42
45
|
logger;
|
|
@@ -53,8 +56,11 @@ export class P2PNetworkTest {
|
|
|
53
56
|
defaultAccountAddress;
|
|
54
57
|
spamContract;
|
|
55
58
|
bootstrapNode;
|
|
59
|
+
// Store setup options for use in setup()
|
|
60
|
+
setupOptions;
|
|
61
|
+
deployL1ContractsArgs;
|
|
56
62
|
constructor(testName, bootstrapNodeEnr, bootNodePort, numberOfValidators, initialValidatorConfig, numberOfNodes = 0, // If set enable metrics collection
|
|
57
|
-
metricsPort, startProverNode
|
|
63
|
+
metricsPort, startProverNode){
|
|
58
64
|
this.testName = testName;
|
|
59
65
|
this.bootstrapNodeEnr = bootstrapNodeEnr;
|
|
60
66
|
this.bootNodePort = bootNodePort;
|
|
@@ -74,7 +80,8 @@ export class P2PNetworkTest {
|
|
|
74
80
|
this.attesterPrivateKeys = generatePrivateKeys(ATTESTER_PRIVATE_KEYS_START_INDEX + numberOfNodes, numberOfValidators);
|
|
75
81
|
this.attesterPublicKeys = this.attesterPrivateKeys.map((privateKey)=>privateKeyToAccount(privateKey).address);
|
|
76
82
|
const zkPassportParams = ZkPassportProofParams.random();
|
|
77
|
-
|
|
83
|
+
// Store setup options for later use
|
|
84
|
+
this.setupOptions = {
|
|
78
85
|
...initialValidatorConfig,
|
|
79
86
|
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
|
|
80
87
|
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
@@ -83,11 +90,12 @@ export class P2PNetworkTest {
|
|
|
83
90
|
slashingRoundSizeInEpochs: initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
|
|
84
91
|
slasherFlavor: initialValidatorConfig.slasherFlavor ?? 'tally',
|
|
85
92
|
aztecTargetCommitteeSize: numberOfValidators,
|
|
86
|
-
salt: 420,
|
|
87
93
|
metricsPort: metricsPort,
|
|
88
94
|
numberOfInitialFundedAccounts: 2,
|
|
89
|
-
startProverNode
|
|
90
|
-
|
|
95
|
+
startProverNode,
|
|
96
|
+
walletMinFeePadding: 2.0
|
|
97
|
+
};
|
|
98
|
+
this.deployL1ContractsArgs = {
|
|
91
99
|
...initialValidatorConfig,
|
|
92
100
|
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
|
|
93
101
|
slashingRoundSizeInEpochs: initialValidatorConfig.slashingRoundSizeInEpochs ?? l1ContractsConfig.slashingRoundSizeInEpochs,
|
|
@@ -98,32 +106,30 @@ export class P2PNetworkTest {
|
|
|
98
106
|
aztecTargetCommitteeSize: numberOfValidators,
|
|
99
107
|
initialValidators: [],
|
|
100
108
|
zkPassportArgs: {
|
|
101
|
-
mockZkPassportVerifier,
|
|
102
109
|
zkPassportDomain: zkPassportParams.domain,
|
|
103
110
|
zkPassportScope: zkPassportParams.scope
|
|
104
111
|
}
|
|
105
|
-
}
|
|
112
|
+
};
|
|
106
113
|
}
|
|
107
|
-
static async create({ testName, numberOfNodes, numberOfValidators, basePort, metricsPort, initialConfig, startProverNode
|
|
114
|
+
static async create({ testName, numberOfNodes, numberOfValidators, basePort, metricsPort, initialConfig, startProverNode }) {
|
|
108
115
|
const port = basePort || await getPort();
|
|
109
116
|
const bootstrapNodeENR = await getBootstrapNodeEnr(BOOTSTRAP_NODE_PRIVATE_KEY, port);
|
|
110
117
|
const bootstrapNodeEnr = bootstrapNodeENR.encodeTxt();
|
|
111
118
|
const initialValidatorConfig = await createValidatorConfig(initialConfig ?? {}, bootstrapNodeEnr);
|
|
112
|
-
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfValidators, initialValidatorConfig, numberOfNodes, metricsPort, startProverNode
|
|
119
|
+
return new P2PNetworkTest(testName, bootstrapNodeEnr, port, numberOfValidators, initialValidatorConfig, numberOfNodes, metricsPort, startProverNode);
|
|
113
120
|
}
|
|
114
121
|
get fundedAccount() {
|
|
115
122
|
if (!this.deployedAccounts[0]) {
|
|
116
|
-
throw new Error('Call
|
|
123
|
+
throw new Error('Call setupAccount to create a funded account.');
|
|
117
124
|
}
|
|
118
125
|
return this.deployedAccounts[0];
|
|
119
126
|
}
|
|
120
127
|
async addBootstrapNode() {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
128
|
+
this.logger.info('Adding bootstrap node');
|
|
129
|
+
const telemetry = await getEndToEndTestTelemetryClient(this.metricsPort);
|
|
130
|
+
this.bootstrapNode = await createBootstrapNodeFromPrivateKey(BOOTSTRAP_NODE_PRIVATE_KEY, this.bootNodePort, telemetry, this.context.config);
|
|
131
|
+
// Overwrite enr with updated info
|
|
132
|
+
this.bootstrapNodeEnr = this.bootstrapNode.getENR().encodeTxt();
|
|
127
133
|
}
|
|
128
134
|
getValidators() {
|
|
129
135
|
const validators = [];
|
|
@@ -141,101 +147,92 @@ export class P2PNetworkTest {
|
|
|
141
147
|
validators
|
|
142
148
|
};
|
|
143
149
|
}
|
|
144
|
-
async
|
|
150
|
+
async applyBaseSetup() {
|
|
145
151
|
await this.addBootstrapNode();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
152
|
+
this.logger.info('Adding validators');
|
|
153
|
+
const rollup = getContract({
|
|
154
|
+
address: this.context.deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
155
|
+
abi: RollupAbi,
|
|
156
|
+
client: this.context.deployL1ContractsValues.l1Client
|
|
157
|
+
});
|
|
158
|
+
this.logger.info(`Adding ${this.numberOfValidators} validators`);
|
|
159
|
+
const stakingAsset = getContract({
|
|
160
|
+
address: this.context.deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
161
|
+
abi: TestERC20Abi,
|
|
162
|
+
client: this.context.deployL1ContractsValues.l1Client
|
|
163
|
+
});
|
|
164
|
+
const { address: multiAdderAddress } = await deployL1Contract(this.context.deployL1ContractsValues.l1Client, MultiAdderArtifact.contractAbi, MultiAdderArtifact.contractBytecode, [
|
|
165
|
+
rollup.address,
|
|
166
|
+
this.context.deployL1ContractsValues.l1Client.account.address
|
|
167
|
+
]);
|
|
168
|
+
const multiAdder = getContract({
|
|
169
|
+
address: multiAdderAddress.toString(),
|
|
170
|
+
abi: MultiAdderArtifact.contractAbi,
|
|
171
|
+
client: this.context.deployL1ContractsValues.l1Client
|
|
172
|
+
});
|
|
173
|
+
const stakeNeeded = await rollup.read.getActivationThreshold() * BigInt(this.numberOfValidators);
|
|
174
|
+
await Promise.all([
|
|
175
|
+
await stakingAsset.write.mint([
|
|
176
|
+
multiAdder.address,
|
|
177
|
+
stakeNeeded
|
|
178
|
+
], {})
|
|
179
|
+
].map((txHash)=>this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
180
|
+
hash: txHash
|
|
181
|
+
})));
|
|
182
|
+
const { validators } = this.getValidators();
|
|
183
|
+
this.validators = validators;
|
|
184
|
+
const gseAddress = this.context.deployL1ContractsValues.l1ContractAddresses.gseAddress;
|
|
185
|
+
if (!gseAddress) {
|
|
186
|
+
throw new Error('GSE contract not deployed');
|
|
187
|
+
}
|
|
188
|
+
const gseContract = new GSEContract(this.context.deployL1ContractsValues.l1Client, gseAddress.toString());
|
|
189
|
+
const makeValidatorTuples = async (validator)=>{
|
|
190
|
+
const registrationTuple = await gseContract.makeRegistrationTuple(validator.bn254SecretKey.getValue());
|
|
191
|
+
return {
|
|
192
|
+
attester: validator.attester.toString(),
|
|
193
|
+
withdrawer: validator.withdrawer.toString(),
|
|
194
|
+
...registrationTuple
|
|
190
195
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + await rollup.read.getLagInEpochsForValidatorSet() + 1n));
|
|
198
|
-
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
199
|
-
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
196
|
+
};
|
|
197
|
+
const validatorTuples = await Promise.all(validators.map(makeValidatorTuples));
|
|
198
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
199
|
+
hash: await multiAdder.write.addValidators([
|
|
200
|
+
validatorTuples
|
|
201
|
+
])
|
|
200
202
|
});
|
|
203
|
+
await this.context.cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await this.context.cheatCodes.rollup.getEpoch()) + await rollup.read.getLagInEpochsForValidatorSet() + 1n));
|
|
204
|
+
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
205
|
+
await this._sendDummyTx(this.context.deployL1ContractsValues.l1Client);
|
|
201
206
|
}
|
|
202
207
|
async setupAccount() {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.
|
|
207
|
-
return Promise.resolve();
|
|
208
|
+
this.logger.info('Setting up account');
|
|
209
|
+
const { deployedAccounts } = await deployAccounts(1, this.logger)({
|
|
210
|
+
wallet: this.context.wallet,
|
|
211
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
208
212
|
});
|
|
213
|
+
this.deployedAccounts = deployedAccounts;
|
|
214
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
215
|
+
this.wallet = this.context.wallet;
|
|
209
216
|
}
|
|
210
217
|
async deploySpamContract() {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}).deployed();
|
|
218
|
-
return {
|
|
219
|
-
contractAddress: spamContract.address
|
|
220
|
-
};
|
|
221
|
-
}, ({ contractAddress })=>{
|
|
222
|
-
if (!this.wallet) {
|
|
223
|
-
throw new Error('Call snapshot t.setupAccount before deploying account contract');
|
|
224
|
-
}
|
|
225
|
-
this.spamContract = SpamContract.at(contractAddress, this.wallet);
|
|
226
|
-
return Promise.resolve();
|
|
218
|
+
this.logger.info('Deploying spam contract');
|
|
219
|
+
if (!this.wallet) {
|
|
220
|
+
throw new Error('Call setupAccount before deploying spam contract');
|
|
221
|
+
}
|
|
222
|
+
const spamContract = await SpamContract.deploy(this.wallet).send({
|
|
223
|
+
from: this.defaultAccountAddress
|
|
227
224
|
});
|
|
225
|
+
this.spamContract = spamContract;
|
|
228
226
|
}
|
|
229
227
|
async removeInitialNode() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
237
|
-
await aztecNode.stop();
|
|
228
|
+
this.logger.info('Removing initial node');
|
|
229
|
+
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
230
|
+
const { receipt } = await this._sendDummyTx(this.context.deployL1ContractsValues.l1Client);
|
|
231
|
+
const block = await this.context.deployL1ContractsValues.l1Client.getBlock({
|
|
232
|
+
blockNumber: receipt.blockNumber
|
|
238
233
|
});
|
|
234
|
+
this.context.dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
235
|
+
await this.context.aztecNodeService.stop();
|
|
239
236
|
}
|
|
240
237
|
async sendDummyTx() {
|
|
241
238
|
return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
|
|
@@ -248,17 +245,29 @@ export class P2PNetworkTest {
|
|
|
248
245
|
});
|
|
249
246
|
}
|
|
250
247
|
async setup() {
|
|
251
|
-
this.
|
|
248
|
+
this.logger.info('Setting up subsystems from fresh');
|
|
249
|
+
this.context = await setup(0, {
|
|
250
|
+
...this.setupOptions,
|
|
251
|
+
fundSponsoredFPC: true,
|
|
252
|
+
skipAccountDeployment: true,
|
|
253
|
+
slasherFlavor: this.setupOptions.slasherFlavor ?? this.deployL1ContractsArgs.slasherFlavor ?? 'none',
|
|
254
|
+
aztecTargetCommitteeSize: 0,
|
|
255
|
+
l1ContractsArgs: this.deployL1ContractsArgs
|
|
256
|
+
}, // Use checkpointed chain tip for PXE to avoid issues with blocks being dropped due to pruned anchor blocks.
|
|
257
|
+
{
|
|
258
|
+
syncChainTip: 'checkpointed'
|
|
259
|
+
});
|
|
260
|
+
this.ctx = this.context;
|
|
252
261
|
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
253
262
|
const initialFundedAccounts = [
|
|
254
|
-
...this.
|
|
263
|
+
...this.context.initialFundedAccounts.map((a)=>a.address),
|
|
255
264
|
sponsoredFPCAddress
|
|
256
265
|
];
|
|
257
266
|
const { prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
|
|
258
267
|
this.prefilledPublicData = prefilledPublicData;
|
|
259
|
-
const rollupContract = RollupContract.getFromL1ContractsValues(this.
|
|
260
|
-
this.monitor = new ChainMonitor(rollupContract, this.
|
|
261
|
-
this.monitor.on('l1-block', ({ timestamp })=>this.
|
|
268
|
+
const rollupContract = RollupContract.getFromL1ContractsValues(this.context.deployL1ContractsValues);
|
|
269
|
+
this.monitor = new ChainMonitor(rollupContract, this.context.dateProvider).start();
|
|
270
|
+
this.monitor.on('l1-block', ({ timestamp })=>this.context.dateProvider.setTime(Number(timestamp) * 1000));
|
|
262
271
|
}
|
|
263
272
|
async stopNodes(nodes) {
|
|
264
273
|
this.logger.info('Stopping nodes');
|
|
@@ -295,15 +304,15 @@ export class P2PNetworkTest {
|
|
|
295
304
|
async teardown() {
|
|
296
305
|
await this.monitor.stop();
|
|
297
306
|
await tryStop(this.bootstrapNode, this.logger);
|
|
298
|
-
await this.
|
|
307
|
+
await teardown(this.context);
|
|
299
308
|
}
|
|
300
309
|
async getContracts() {
|
|
301
310
|
if (!this.ctx.deployL1ContractsValues) {
|
|
302
|
-
throw new Error('
|
|
311
|
+
throw new Error('DeployAztecL1ContractsValues not set');
|
|
303
312
|
}
|
|
304
313
|
const rollup = new RollupContract(this.ctx.deployL1ContractsValues.l1Client, this.ctx.deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
305
314
|
const slasherContract = getContract({
|
|
306
|
-
address: getAddress(await rollup.getSlasherAddress()),
|
|
315
|
+
address: getAddress((await rollup.getSlasherAddress()).toString()),
|
|
307
316
|
abi: SlasherAbi,
|
|
308
317
|
client: this.ctx.deployL1ContractsValues.l1Client
|
|
309
318
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { P2PNetworkTest } from '../p2p_network.js';
|
|
3
|
+
export declare const NUM_VALIDATORS = 6;
|
|
4
|
+
export declare const NUM_TXS_PER_NODE = 2;
|
|
5
|
+
export declare const BOOT_NODE_UDP_PORT = 4500;
|
|
6
|
+
export declare const createReqrespDataDir: () => string;
|
|
7
|
+
type ReqrespOptions = {
|
|
8
|
+
disableStatusHandshake?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function createReqrespTest(options?: ReqrespOptions): Promise<P2PNetworkTest>;
|
|
11
|
+
export declare function cleanupReqrespTest(params: {
|
|
12
|
+
t: P2PNetworkTest;
|
|
13
|
+
nodes?: AztecNodeService[];
|
|
14
|
+
dataDir: string;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
export declare function runReqrespTxTest(params: {
|
|
17
|
+
t: P2PNetworkTest;
|
|
18
|
+
dataDir: string;
|
|
19
|
+
disableStatusHandshake?: boolean;
|
|
20
|
+
}): Promise<AztecNodeService[]>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lMmVfcDJwL3JlcXJlc3AvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQWdCMUQsT0FBTyxFQUFFLGNBQWMsRUFBOEQsTUFBTSxtQkFBbUIsQ0FBQztBQUkvRyxlQUFPLE1BQU0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MAAM,oBAAoB,cAA2D,CAAC;AAE7F,KAAK,cAAc,GAAG;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoB7F;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAAE,CAAC,EAAE,cAAc,CAAC;IAAC,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,iBASlH;AAID,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,CAAC,EAAE,cAAc,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwG9B"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
3
|
+
import { Tx } from '@aztec/aztec.js/tx';
|
|
4
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import { timesAsync } from '@aztec/foundation/collection';
|
|
7
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
8
|
+
import { jest } from '@jest/globals';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import os from 'os';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { shouldCollectMetrics } from '../../fixtures/fixtures.js';
|
|
13
|
+
import { createNodes } from '../../fixtures/setup_p2p_test.js';
|
|
14
|
+
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES, WAIT_FOR_TX_TIMEOUT } from '../p2p_network.js';
|
|
15
|
+
import { prepareTransactions } from '../shared.js';
|
|
16
|
+
// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
|
|
17
|
+
export const NUM_VALIDATORS = 6;
|
|
18
|
+
export const NUM_TXS_PER_NODE = 2;
|
|
19
|
+
export const BOOT_NODE_UDP_PORT = 4500;
|
|
20
|
+
export const createReqrespDataDir = ()=>fs.mkdtempSync(path.join(os.tmpdir(), 'reqresp-'));
|
|
21
|
+
export async function createReqrespTest(options = {}) {
|
|
22
|
+
const { disableStatusHandshake = false } = options;
|
|
23
|
+
const t = await P2PNetworkTest.create({
|
|
24
|
+
testName: 'e2e_p2p_reqresp_tx',
|
|
25
|
+
numberOfNodes: 0,
|
|
26
|
+
numberOfValidators: NUM_VALIDATORS,
|
|
27
|
+
basePort: BOOT_NODE_UDP_PORT,
|
|
28
|
+
// To collect metrics - run in aztec-packages `docker compose --profile metrics up`
|
|
29
|
+
metricsPort: shouldCollectMetrics(),
|
|
30
|
+
initialConfig: {
|
|
31
|
+
...SHORTENED_BLOCK_TIME_CONFIG_NO_PRUNES,
|
|
32
|
+
aztecSlotDuration: 24,
|
|
33
|
+
...disableStatusHandshake ? {
|
|
34
|
+
p2pDisableStatusHandshake: true
|
|
35
|
+
} : {},
|
|
36
|
+
listenAddress: '127.0.0.1',
|
|
37
|
+
aztecEpochDuration: 64
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
await t.setup();
|
|
41
|
+
await t.applyBaseSetup();
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
export async function cleanupReqrespTest(params) {
|
|
45
|
+
const { t, nodes, dataDir } = params;
|
|
46
|
+
if (nodes) {
|
|
47
|
+
await t.stopNodes(nodes);
|
|
48
|
+
}
|
|
49
|
+
await t.teardown();
|
|
50
|
+
for(let i = 0; i < NUM_VALIDATORS; i++){
|
|
51
|
+
fs.rmSync(`${dataDir}-${i}`, {
|
|
52
|
+
recursive: true,
|
|
53
|
+
force: true,
|
|
54
|
+
maxRetries: 3
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const getNodePort = (nodeIndex)=>BOOT_NODE_UDP_PORT + 1 + nodeIndex;
|
|
59
|
+
export async function runReqrespTxTest(params) {
|
|
60
|
+
const { t, dataDir, disableStatusHandshake = false } = params;
|
|
61
|
+
if (!t.bootstrapNodeEnr) {
|
|
62
|
+
throw new Error('Bootstrap node ENR is not available');
|
|
63
|
+
}
|
|
64
|
+
t.logger.info('Creating nodes');
|
|
65
|
+
const aztecNodeConfig = disableStatusHandshake ? {
|
|
66
|
+
...t.ctx.aztecNodeConfig,
|
|
67
|
+
p2pDisableStatusHandshake: true
|
|
68
|
+
} : t.ctx.aztecNodeConfig;
|
|
69
|
+
const nodes = await createNodes(aztecNodeConfig, t.ctx.dateProvider, t.bootstrapNodeEnr, NUM_VALIDATORS, BOOT_NODE_UDP_PORT, t.prefilledPublicData, dataDir, shouldCollectMetrics());
|
|
70
|
+
t.logger.info('Waiting for nodes to connect');
|
|
71
|
+
await t.waitForP2PMeshConnectivity(nodes, NUM_VALIDATORS);
|
|
72
|
+
await t.setupAccount();
|
|
73
|
+
const targetBlockNumber = await t.ctx.aztecNodeService.getBlockNumber();
|
|
74
|
+
await retryUntil(async ()=>{
|
|
75
|
+
const blockNumbers = await Promise.all(nodes.map((node)=>node.getBlockNumber()));
|
|
76
|
+
return blockNumbers.every((blockNumber)=>blockNumber >= targetBlockNumber) ? true : undefined;
|
|
77
|
+
}, `validators to sync to L2 block ${targetBlockNumber}`, 60, 0.5);
|
|
78
|
+
t.logger.info('Preparing transactions to send');
|
|
79
|
+
const txBatches = await timesAsync(2, ()=>prepareTransactions(t.logger, t.ctx.aztecNodeService, NUM_TXS_PER_NODE, t.fundedAccount));
|
|
80
|
+
t.logger.info('Removing initial node');
|
|
81
|
+
await t.removeInitialNode();
|
|
82
|
+
t.logger.info('Starting fresh slot');
|
|
83
|
+
const [timestamp] = await t.ctx.cheatCodes.rollup.advanceToNextSlot();
|
|
84
|
+
t.ctx.dateProvider.setTime(Number(timestamp) * 1000);
|
|
85
|
+
const startSlotTimestamp = BigInt(timestamp);
|
|
86
|
+
const { proposerIndexes, nodesToTurnOffTxGossip } = await getProposerIndexes(t, startSlotTimestamp);
|
|
87
|
+
t.logger.info(`Turning off tx gossip for nodes: ${nodesToTurnOffTxGossip.map(getNodePort)}`);
|
|
88
|
+
t.logger.info(`Sending txs to proposer nodes: ${proposerIndexes.map(getNodePort)}`);
|
|
89
|
+
// Replace the p2p node implementation of some of the nodes with a spy such that it does not store transactions that are gossiped to it
|
|
90
|
+
// Original implementation of `handleGossipedTx` will store received transactions in the tx pool.
|
|
91
|
+
// We chose the first 2 nodes that will be the proposers for the next few slots
|
|
92
|
+
for (const nodeIndex of nodesToTurnOffTxGossip){
|
|
93
|
+
const logger = createLogger(`p2p:${getNodePort(nodeIndex)}`);
|
|
94
|
+
jest.spyOn(nodes[nodeIndex].p2pClient.p2pService, 'handleGossipedTx').mockImplementation((payloadData)=>{
|
|
95
|
+
const txHash = Tx.fromBuffer(payloadData).getTxHash();
|
|
96
|
+
logger.info(`Skipping storage of gossiped transaction ${txHash.toString()}`);
|
|
97
|
+
return Promise.resolve();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// We send the tx to the proposer nodes directly, ignoring the pxe and node in each context
|
|
101
|
+
// We cannot just call tx.send since they were created using a pxe wired to the first node which is now stopped
|
|
102
|
+
t.logger.info('Sending transactions through proposer nodes');
|
|
103
|
+
const submittedTxs = await Promise.all(txBatches.map(async (batch, batchIndex)=>{
|
|
104
|
+
const proposerNode = nodes[proposerIndexes[batchIndex]];
|
|
105
|
+
await Promise.all(batch.map(async (tx)=>{
|
|
106
|
+
try {
|
|
107
|
+
await proposerNode.sendTx(tx);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
t.logger.error(`Error sending tx: ${err}`);
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
return batch.map((tx)=>({
|
|
114
|
+
node: proposerNode,
|
|
115
|
+
txHash: tx.getTxHash()
|
|
116
|
+
}));
|
|
117
|
+
}));
|
|
118
|
+
t.logger.info('Waiting for all transactions to be mined');
|
|
119
|
+
await Promise.all(submittedTxs.flatMap((batch, batchIndex)=>batch.map(async (submittedTx, txIndex)=>{
|
|
120
|
+
t.logger.info(`Waiting for tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} to be mined`);
|
|
121
|
+
await waitForTx(submittedTx.node, submittedTx.txHash, {
|
|
122
|
+
timeout: WAIT_FOR_TX_TIMEOUT * 1.5
|
|
123
|
+
});
|
|
124
|
+
t.logger.info(`Tx ${batchIndex}-${txIndex} ${submittedTx.txHash.toString()} has been mined`);
|
|
125
|
+
})));
|
|
126
|
+
t.logger.info('All transactions mined');
|
|
127
|
+
return nodes;
|
|
128
|
+
}
|
|
129
|
+
async function getProposerIndexes(t, startSlotTimestamp) {
|
|
130
|
+
// Get the nodes for the next set of slots
|
|
131
|
+
const rollupContract = new RollupContract(t.ctx.deployL1ContractsValues.l1Client, t.ctx.deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
132
|
+
const attesters = await rollupContract.getAttesters();
|
|
133
|
+
const startSlot = await rollupContract.getSlotAt(startSlotTimestamp);
|
|
134
|
+
const proposers = await Promise.all(Array.from({
|
|
135
|
+
length: 3
|
|
136
|
+
}, async (_, i)=>{
|
|
137
|
+
const slot = SlotNumber(startSlot + i);
|
|
138
|
+
const slotTimestamp = await rollupContract.getTimestampForSlot(slot);
|
|
139
|
+
return await rollupContract.getProposerAt(slotTimestamp);
|
|
140
|
+
}));
|
|
141
|
+
// Get the indexes of the nodes that are responsible for the next two slots
|
|
142
|
+
const proposerIndexes = proposers.map((proposer)=>attesters.findIndex((a)=>a.equals(proposer)));
|
|
143
|
+
if (proposerIndexes.some((i)=>i === -1)) {
|
|
144
|
+
throw new Error(`Proposer index not found for proposer ` + `(proposers=${proposers.map((p)=>p.toString()).join(',')}, indices=${proposerIndexes.join(',')})`);
|
|
145
|
+
}
|
|
146
|
+
const nodesToTurnOffTxGossip = Array.from({
|
|
147
|
+
length: NUM_VALIDATORS
|
|
148
|
+
}, (_, i)=>i).filter((i)=>!proposerIndexes.includes(i));
|
|
149
|
+
return {
|
|
150
|
+
proposerIndexes,
|
|
151
|
+
nodesToTurnOffTxGossip
|
|
152
|
+
};
|
|
153
|
+
}
|
package/dest/e2e_p2p/shared.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
-
import { type SentTx } from '@aztec/aztec.js/contracts';
|
|
5
4
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
6
|
-
import {
|
|
5
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
7
6
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum';
|
|
7
|
+
import type { EmpireSlashingProposerContract, RollupContract, TallySlashingProposerContract } from '@aztec/ethereum/contracts';
|
|
9
8
|
import type { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
10
9
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
10
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
11
|
+
import { type ProvenTx } from '@aztec/test-wallet/server';
|
|
12
12
|
export declare const submitComplexTxsTo: (logger: Logger, from: AztecAddress, spamContract: SpamContract, numTxs: number, opts?: {
|
|
13
13
|
callPublic?: boolean | undefined;
|
|
14
|
-
}) => Promise<
|
|
15
|
-
export declare const submitTransactions: (logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData) => Promise<
|
|
16
|
-
export declare function prepareTransactions(logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData): Promise<
|
|
14
|
+
}) => Promise<TxHash[]>;
|
|
15
|
+
export declare const submitTransactions: (logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData) => Promise<TxHash[]>;
|
|
16
|
+
export declare function prepareTransactions(logger: Logger, node: AztecNodeService, numTxs: number, fundedAccount: InitialAccountData): Promise<ProvenTx[]>;
|
|
17
17
|
export declare function awaitProposalExecution(slashingProposer: EmpireSlashingProposerContract | TallySlashingProposerContract, timeoutSeconds: number, logger: Logger): Promise<bigint>;
|
|
18
18
|
export declare function awaitCommitteeExists({ rollup, logger }: {
|
|
19
19
|
rollup: RollupContract;
|
|
@@ -43,4 +43,4 @@ export declare function awaitCommitteeKicked({ rollup, cheatCodes, committee, sl
|
|
|
43
43
|
logger: Logger;
|
|
44
44
|
offenseEpoch: number;
|
|
45
45
|
}): Promise<void>;
|
|
46
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
46
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZTJlX3AycC9zaGFyZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNsRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzFELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUd6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDNUMsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUM3RCxPQUFPLEtBQUssRUFDViw4QkFBOEIsRUFDOUIsY0FBYyxFQUNk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