Skip to content

Commit 6845473

Browse files
avilagaston9MarcosNicolauMauroToscanouri-99JuArce
authored
feat: ethereum-package for real conditions network stress-test (#1426)
Co-authored-by: Marcos Nicolau <[email protected]> Co-authored-by: Mauro Toscano <[email protected]> Co-authored-by: Urix <[email protected]> Co-authored-by: MauroFab <[email protected]> Co-authored-by: JuArce <[email protected]>
1 parent 8e6d2c2 commit 6845473

File tree

6 files changed

+818
-0
lines changed

6 files changed

+818
-0
lines changed

Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,3 +1226,57 @@ ansible_operator_deploy: ## Deploy the Operator. Parameters: INVENTORY
12261226
-i $(INVENTORY) \
12271227
-e "ecdsa_keystore_path=$(ECDSA_KEYSTORE)" \
12281228
-e "bls_keystore_path=$(BLS_KEYSTORE)"
1229+
1230+
__ETHEREUM_PACKAGE__: ## ____
1231+
1232+
ethereum_package_start: ## Starts the ethereum_package environment
1233+
kurtosis run --enclave aligned github.com/ethpandaops/ethereum-package --args-file network_params.yaml
1234+
1235+
ethereum_package_inspect: ## Prints detailed information about the net
1236+
kurtosis enclave inspect aligned
1237+
1238+
ethereum_package_rm: ## Stops and removes the ethereum_package environment and used resources
1239+
kurtosis enclave rm aligned -f
1240+
1241+
batcher_start_ethereum_package: user_fund_payment_service
1242+
@echo "Starting Batcher..."
1243+
@$(MAKE) run_storage &
1244+
@cargo run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/config-batcher-ethereum-package.yaml --env-file ./batcher/aligned-batcher/.env.dev
1245+
1246+
aggregator_start_ethereum_package:
1247+
$(MAKE) aggregator_start AGG_CONFIG_FILE=config-files/config-aggregator-ethereum-package.yaml
1248+
1249+
operator_start_ethereum_package:
1250+
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
1251+
1252+
operator_register_start_ethereum_package:
1253+
$(MAKE) operator_full_registration OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml \
1254+
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
1255+
1256+
1257+
install_spamoor: ## Instal spamoor to spam transactions
1258+
@echo "Installing spamoor..."
1259+
@git clone https://github.com/ethpandaops/spamoor.git
1260+
@cd spamoor && make
1261+
@mv spamoor/bin/spamoor $(HOME)/.local/bin
1262+
@rm -rf spamoor
1263+
@echo "======================================================================="
1264+
@echo "Installation complete! Run 'spamoor --help' to verify the installation."
1265+
@echo "If 'spamoor' is not recognized, make sure it's in your PATH by adding the following line to your shell configuration:"
1266+
@echo "export PATH=\$$PATH:\$$HOME/.local/bin"
1267+
@echo "======================================================================="
1268+
1269+
# Spamoor funding wallet
1270+
SPAMOOR_PRIVATE_KEY?=dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
1271+
NUM_WALLETS?=1000
1272+
TX_PER_BLOCK?=250
1273+
# Similar to a swap
1274+
TX_CONSUMES_GAS?=150000
1275+
1276+
spamoor_send_transactions: ## Sends normal transactions and also replacement transactions
1277+
spamoor gasburnertx -p $(SPAMOOR_PRIVATE_KEY) -c $(COUNT) \
1278+
--gas-units-to-burn $(TX_CONSUMES_GAS) \
1279+
--max-wallets $(NUM_WALLETS) --max-pending $(TX_PER_BLOCK) \
1280+
-t $(TX_PER_BLOCK) -h http://127.0.0.1:8545/ -h http://127.0.0.1:8550/ -h http://127.0.0.1:8555/ -h http://127.0.0.1:8565/ \
1281+
--refill-amount 5 --refill-balance 2 --tipfee $(TIP_FEE) --basefee 100 \
1282+
2>&1 | grep -v 'checked child wallets (no funding needed)'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: "production"
4+
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5+
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6+
eth_rpc_url: "http://localhost:8545"
7+
eth_rpc_url_fallback: "http://localhost:8550"
8+
eth_ws_url: "ws://localhost:8546"
9+
eth_ws_url_fallback: "ws://localhost:8551"
10+
eigen_metrics_ip_port_address: "localhost:9090"
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: "config-files/anvil.aggregator.ecdsa.key.json"
15+
private_key_store_password: ""
16+
17+
## BLS Configurations
18+
bls:
19+
private_key_store_path: "config-files/anvil.aggregator.bls.key.json"
20+
private_key_store_password: ""
21+
22+
## Aggregator Configurations
23+
aggregator:
24+
server_ip_port_address: localhost:8090
25+
bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44
26+
avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690
27+
enable_metrics: true
28+
metrics_ip_port_address: localhost:9091
29+
telemetry_ip_port_address: localhost:4001
30+
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
31+
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
32+
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
33+
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
34+
gas_base_bump_percentage: 10 # How much to bump gas price when responding to task. Suggested value 10%
35+
gas_bump_incremental_percentage: 2 # An extra percentage to bump every retry i*2 when responding to task. Suggested value 2%
36+
time_to_wait_before_bump: 36s # The time to wait for the receipt when responding to task. Suggested value 36 seconds (3 blocks)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: "production"
4+
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5+
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6+
eth_rpc_url: "http://localhost:8545"
7+
eth_rpc_url_fallback: "http://localhost:8550"
8+
eth_ws_url: "ws://localhost:8546"
9+
eth_ws_url_fallback: "ws://localhost:8551"
10+
eigen_metrics_ip_port_address: "localhost:9090"
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: "config-files/anvil.batcher.ecdsa.key.json"
15+
private_key_store_password: ""
16+
17+
## Batcher configurations
18+
batcher:
19+
block_interval: 3
20+
batch_size_interval: 10
21+
transaction_wait_timeout: 36000 # 3 blocks
22+
max_proof_size: 67108864 # 64 MiB
23+
max_batch_byte_size: 268435456 # 256 MiB
24+
max_batch_proof_qty: 3000 # 3000 proofs in a batch
25+
pre_verification_is_enabled: true
26+
metrics_port: 9093
27+
telemetry_ip_port_address: localhost:4001
28+
non_paying:
29+
address: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 # Anvil address 9
30+
replacement_private_key: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # Anvil address 1
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: 'development'
4+
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
5+
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
6+
eth_rpc_url: 'http://localhost:8545'
7+
eth_rpc_url_fallback: 'http://localhost:8550'
8+
eth_ws_url: 'ws://localhost:8546'
9+
eth_ws_url_fallback: 'ws://localhost:8551'
10+
eigen_metrics_ip_port_address: 'localhost:9090'
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: 'config-files/devnet/keys/operator-1.ecdsa.key.json'
15+
private_key_store_password: ''
16+
17+
## BLS Configurations
18+
bls:
19+
private_key_store_path: 'config-files/devnet/keys/operator-1.bls.key.json'
20+
private_key_store_password: ''
21+
22+
## Operator Configurations
23+
operator:
24+
aggregator_rpc_server_ip_port_address: localhost:8090
25+
operator_tracker_ip_port_address: http://localhost:4001
26+
address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
27+
earnings_receiver_address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
28+
delegation_approver_address: '0x0000000000000000000000000000000000000000'
29+
staker_opt_out_window_blocks: 0
30+
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
31+
enable_metrics: true
32+
metrics_ip_port_address: localhost:9092
33+
max_batch_size: 268435456 # 256 MiB
34+
last_processed_batch_filepath: 'config-files/operator-1.last_processed_batch.json'
35+
36+
# Operators variables needed for register it in EigenLayer
37+
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
38+
private_key_store_path: config-files/devnet/keys/operator-1.ecdsa.key.json
39+
bls_private_key_store_path: config-files/devnet/keys/operator-1.bls.key.json
40+
signer_type: local_keystore
41+
chain_id: 31337
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Ethereum Package
2+
3+
> [!WARNING]
4+
> [Kurtosis](https://github.com/kurtosis-tech/kurtosis) must be installed.
5+
6+
## Usage and Setup
7+
8+
To start a local network run:
9+
10+
```bash
11+
make ethereum_package_start
12+
```
13+
14+
To see the status of the network run:
15+
16+
```bash
17+
make ethereum_package_inspect
18+
```
19+
20+
This will show you all the containers running and their respective ports. The most interesting ones are prometheus, grafana and el_forkmon, they will provide you with metrics to see the gasPrice, gasUsed, txPerBlock, and others that will be in our interest to create chaos on the network.
21+
22+
To stop the network run the following:
23+
24+
```bash
25+
make ethereum_package_rm
26+
```
27+
28+
To start the batcher run:
29+
30+
```bash
31+
make batcher_start_ethereum_package
32+
```
33+
34+
To start the aggregator run:
35+
36+
```bash
37+
make aggregator_start_ethereum_package
38+
```
39+
40+
To start an operator run:
41+
42+
```bash
43+
make operator_register_start_ethereum_package
44+
```
45+
46+
If you want to deploy more operators, you must duplicate the config-operator-1-ethereum-package.yaml and change the private and bls keys and the address.
47+
48+
To start Telemetry and the Explorer, run the usual commands:
49+
50+
```bash
51+
make telemetry_full_start
52+
make run_explorer
53+
```
54+
55+
To spam transactions install spamoor:
56+
```bash
57+
make install_spamoor
58+
```
59+
60+
and run the following make targets:
61+
62+
```bash
63+
make spamoor_send_transactions \\
64+
COUNT=<TOTAL_TX_TO_EXECUTE> \\
65+
TX_PER_BLOCK=<LIMIT_OF_TXS_TO_SEND_PER_BLOCK> \\
66+
TX_CONSUME_GAS=<HOW_MUCH_GAS_TO_USE_PER_TX> \\
67+
NUM_WALLETS=<NUMBER_OF_WALLETS_FROM_WHICH_TO_SEND_TXS> \\
68+
TIP_FEE=<TIP_FEE_IN_GWEI>
69+
```
70+
71+
For Example:
72+
```bash
73+
make spamoor_send_transactions COUNT=1000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=50 NUM_WALLETS=100 TIP_FEE=2
74+
```
75+
76+
## Network status
77+
78+
You can check the network status using Grafana and el_forkmon explorer.
79+
Run `make ethereum_package_inspect` to see the exposed ports for the enabled services. You can check for example the Grafana panels under `Dashboards -> Ethereum Metrics Exporter Overview` which provides useful information about the network.
80+
81+
## Changing Network Params
82+
83+
To adjust network params you have to modify `network_params.yaml`.
84+
85+
> [!NOTE]
86+
> We are using a hardcoded input to deploy Eigen and Aligned contracts using the output from anvil.
87+
88+
## How to make transactions compete and see bumping in the Aggregator and Batcher logs
89+
90+
To increment the gas price and make transactions compete with aligned transactions we need to:
91+
92+
1. **Exceed the block `gasLimit` (30 million):** This is achieved by ensuring the total gas consumed per block is greater than `30,000,000`. Calculate it as: `TX_CONSUME_GAS * TX_PER_BLOCK`
93+
2. **Raise the `tipFee` slightly above the current gas price:** For instance, if the current `gasPrice` is `20 GWEI`, you can generate spam transactions with:
94+
95+
```bash
96+
make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=22
97+
```
98+
99+
- Notes:
100+
- A transaction consuming `150000` of gas would be similar to a bridge swap.
101+
- We pass `2` gwei more to the `tipFee` that should be enough if not, you can increase it.
102+
103+
3. **Monitor Gas Price Updates:** After a few blocks, the `gasPrice` will adjust. The aligned batcher and aggregator will fetch the updated `gasPrice` and start competing in the mempool with their adjusted bump.
104+
4. **Repeat as Needed:** Re-run the same command with the updated `TIP_FEE` to maintain competition:
105+
106+
```bash
107+
make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=<new_tip_fee>
108+
```
109+
110+
## How to update preloaded contracts
111+
112+
1. First, deploy the new contracts in Anvil:
113+
114+
```bash
115+
make anvil_deploy_aligned_contracts
116+
```
117+
118+
That will generate the state output in `contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json`
119+
120+
2. Filter the contracts' state:
121+
122+
```bash
123+
jq '.accounts | to_entries | map(select(.value.code != "0x")) | from_entries' contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json > contracts.json
124+
```
125+
126+
3. Open the `network_params.yaml` file and replace the `additional_preloaded_contracts` section with the content of `contracts.json`.

0 commit comments

Comments
 (0)