Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
659bece
feat: basic localnet with 4 nodes
avilagaston9 Nov 14, 2024
6042b80
feat: are more makefile targets
avilagaston9 Nov 14, 2024
736a8e4
chore: remove tx_spammer
MarcosNicolau Nov 14, 2024
bfd250b
feat: add grafana panels
avilagaston9 Nov 14, 2024
d51869b
chore: add network params and prefunded accounts
MarcosNicolau Nov 14, 2024
e625a50
fix: network_params.yml
MarcosNicolau Nov 14, 2024
21033a0
feat: spamoor commands
MarcosNicolau Nov 14, 2024
d7a050b
refactor: spamoor commands
MarcosNicolau Nov 14, 2024
4a0ca44
fix: spamoor commands
MarcosNicolau Nov 14, 2024
a9897d6
feat: add aligned contracts
avilagaston9 Nov 14, 2024
deba97b
feat: add batcher and aggregator
avilagaston9 Nov 14, 2024
fd64066
feat: connect operator to devnet
avilagaston9 Nov 14, 2024
6342c06
feat: spamoor with gas burning
MarcosNicolau Nov 14, 2024
a0d4222
chore: 12 seconds per slot and increment initial rich wallets balance
MarcosNicolau Nov 15, 2024
80ecbfb
chore: makefile separate register and start operator
MarcosNicolau Nov 15, 2024
258d419
fix: makefile operator commands
MarcosNicolau Nov 15, 2024
4997002
chore: add max_fee and tip_fee to spamoor
MarcosNicolau Nov 15, 2024
643488a
chore: add tracing to batcher send responseToTask
MarcosNicolau Nov 15, 2024
5400685
chore: increase max_fee for groth16
MarcosNicolau Nov 19, 2024
b642714
fix: remove ethereum_package_contracts file
avilagaston9 Nov 19, 2024
0982069
refactor: remove unnecesary log
avilagaston9 Nov 19, 2024
e24469f
docs: add docs about how to run
avilagaston9 Nov 19, 2024
21ee4c7
feat: add comment about the contracts deployment
avilagaston9 Nov 19, 2024
8ddd753
Merge branch 'staging' into aligned-ethereum-package
avilagaston9 Nov 19, 2024
3526cb2
feat: deploy new contracts in ethereum package
avilagaston9 Nov 19, 2024
cfb4278
docs: add example to docs
avilagaston9 Nov 19, 2024
9b6f2c2
Merge branch 'staging' into aligned-ethereum-package
MauroToscano Nov 20, 2024
e8d1261
Update docs/0_internal/ethereum_package.md
MauroToscano Nov 20, 2024
be69255
fix: removes stop instruction
avilagaston9 Nov 20, 2024
db65c37
fix: docs detail missing pormetheus
uri-99 Nov 20, 2024
7b7a414
docs: add instructions to check network status
avilagaston9 Nov 20, 2024
17da41c
chore: details on new guide
uri-99 Nov 20, 2024
3d9e5c0
chore: install_spamoor install message
MarcosNicolau Nov 20, 2024
2595f84
Merge branch 'staging' into aligned-ethereum-package
MarcosNicolau Nov 20, 2024
e115f37
Merge branch 'staging' into aligned-ethereum-package
MauroToscano Nov 20, 2024
dca4d0e
docs: add guide about how to update the contracts
avilagaston9 Dec 3, 2024
83e72ca
Merge remote-tracking branch 'origin/staging' into aligned-ethereum-p…
MarcosNicolau Dec 3, 2024
4ace6df
chore: update contracts on eth package
MarcosNicolau Dec 3, 2024
51dee0d
chore: improve contract creation json command
MarcosNicolau Dec 3, 2024
2701272
fix: restore max_fee
avilagaston9 Dec 5, 2024
fc3acc1
fix: restore fund operator script
avilagaston9 Dec 9, 2024
dc0110d
fix: remove unused param
JuArce Jan 8, 2025
b7f715c
Merge remote-tracking branch 'refs/remotes/origin/staging' into align…
JuArce Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1226,3 +1226,57 @@ ansible_operator_deploy: ## Deploy the Operator. Parameters: INVENTORY
-i $(INVENTORY) \
-e "ecdsa_keystore_path=$(ECDSA_KEYSTORE)" \
-e "bls_keystore_path=$(BLS_KEYSTORE)"

__ETHEREUM_PACKAGE__: ## ____

ethereum_package_start: ## Starts the ethereum_package environment
kurtosis run --enclave aligned github.com/ethpandaops/ethereum-package --args-file network_params.yaml

ethereum_package_inspect: ## Prints detailed information about the net
kurtosis enclave inspect aligned

ethereum_package_rm: ## Stops and removes the ethereum_package environment and used resources
kurtosis enclave rm aligned -f

batcher_start_ethereum_package: user_fund_payment_service
@echo "Starting Batcher..."
@$(MAKE) run_storage &
@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

aggregator_start_ethereum_package:
$(MAKE) aggregator_start AGG_CONFIG_FILE=config-files/config-aggregator-ethereum-package.yaml

operator_start_ethereum_package:
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml

operator_register_start_ethereum_package:
$(MAKE) operator_full_registration OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml \
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml


install_spamoor: ## Instal spamoor to spam transactions
@echo "Installing spamoor..."
@git clone https://github.com/ethpandaops/spamoor.git
@cd spamoor && make
@mv spamoor/bin/spamoor $(HOME)/.local/bin
@rm -rf spamoor
@echo "======================================================================="
@echo "Installation complete! Run 'spamoor --help' to verify the installation."
@echo "If 'spamoor' is not recognized, make sure it's in your PATH by adding the following line to your shell configuration:"
@echo "export PATH=\$$PATH:\$$HOME/.local/bin"
@echo "======================================================================="

# Spamoor funding wallet
SPAMOOR_PRIVATE_KEY?=dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
NUM_WALLETS?=1000
TX_PER_BLOCK?=250
# Similar to a swap
TX_CONSUMES_GAS?=150000

spamoor_send_transactions: ## Sends normal transactions and also replacement transactions
spamoor gasburnertx -p $(SPAMOOR_PRIVATE_KEY) -c $(COUNT) \
--gas-units-to-burn $(TX_CONSUMES_GAS) \
--max-wallets $(NUM_WALLETS) --max-pending $(TX_PER_BLOCK) \
-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/ \
--refill-amount 5 --refill-balance 2 --tipfee $(TIP_FEE) --basefee 100 \
2>&1 | grep -v 'checked child wallets (no funding needed)'
36 changes: 36 additions & 0 deletions config-files/config-aggregator-ethereum-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Common variables for all the services
# 'production' only prints info and above. 'development' also prints debug
environment: "production"
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
eth_rpc_url: "http://localhost:8545"
eth_rpc_url_fallback: "http://localhost:8550"
eth_ws_url: "ws://localhost:8546"
eth_ws_url_fallback: "ws://localhost:8551"
eigen_metrics_ip_port_address: "localhost:9090"

## ECDSA Configurations
ecdsa:
private_key_store_path: "config-files/anvil.aggregator.ecdsa.key.json"
private_key_store_password: ""

## BLS Configurations
bls:
private_key_store_path: "config-files/anvil.aggregator.bls.key.json"
private_key_store_password: ""

## Aggregator Configurations
aggregator:
server_ip_port_address: localhost:8090
bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44
avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690
enable_metrics: true
metrics_ip_port_address: localhost:9091
telemetry_ip_port_address: localhost:4001
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
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)
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
bls_service_task_timeout: 168h # The timeout of bls aggregation service tasks. Suggested value for prod '168h' (7 days)
gas_base_bump_percentage: 10 # How much to bump gas price when responding to task. Suggested value 10%
gas_bump_incremental_percentage: 2 # An extra percentage to bump every retry i*2 when responding to task. Suggested value 2%
time_to_wait_before_bump: 36s # The time to wait for the receipt when responding to task. Suggested value 36 seconds (3 blocks)
30 changes: 30 additions & 0 deletions config-files/config-batcher-ethereum-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Common variables for all the services
# 'production' only prints info and above. 'development' also prints debug
environment: "production"
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
eth_rpc_url: "http://localhost:8545"
eth_rpc_url_fallback: "http://localhost:8550"
eth_ws_url: "ws://localhost:8546"
eth_ws_url_fallback: "ws://localhost:8551"
eigen_metrics_ip_port_address: "localhost:9090"

## ECDSA Configurations
ecdsa:
private_key_store_path: "config-files/anvil.batcher.ecdsa.key.json"
private_key_store_password: ""

## Batcher configurations
batcher:
block_interval: 3
batch_size_interval: 10
transaction_wait_timeout: 36000 # 3 blocks
max_proof_size: 67108864 # 64 MiB
max_batch_byte_size: 268435456 # 256 MiB
max_batch_proof_qty: 3000 # 3000 proofs in a batch
pre_verification_is_enabled: true
metrics_port: 9093
telemetry_ip_port_address: localhost:4001
non_paying:
address: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 # Anvil address 9
replacement_private_key: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # Anvil address 1
41 changes: 41 additions & 0 deletions config-files/config-operator-1-ethereum-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Common variables for all the services
# 'production' only prints info and above. 'development' also prints debug
environment: 'development'
aligned_layer_deployment_config_file_path: './contracts/script/output/devnet/alignedlayer_deployment_output.json'
eigen_layer_deployment_config_file_path: './contracts/script/output/devnet/eigenlayer_deployment_output.json'
eth_rpc_url: 'http://localhost:8545'
eth_rpc_url_fallback: 'http://localhost:8550'
eth_ws_url: 'ws://localhost:8546'
eth_ws_url_fallback: 'ws://localhost:8551'
eigen_metrics_ip_port_address: 'localhost:9090'

## ECDSA Configurations
ecdsa:
private_key_store_path: 'config-files/devnet/keys/operator-1.ecdsa.key.json'
private_key_store_password: ''

## BLS Configurations
bls:
private_key_store_path: 'config-files/devnet/keys/operator-1.bls.key.json'
private_key_store_password: ''

## Operator Configurations
operator:
aggregator_rpc_server_ip_port_address: localhost:8090
operator_tracker_ip_port_address: http://localhost:4001
address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
earnings_receiver_address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
delegation_approver_address: '0x0000000000000000000000000000000000000000'
staker_opt_out_window_blocks: 0
metadata_url: 'https://yetanotherco.github.io/operator_metadata/metadata.json'
enable_metrics: true
metrics_ip_port_address: localhost:9092
max_batch_size: 268435456 # 256 MiB
last_processed_batch_filepath: 'config-files/operator-1.last_processed_batch.json'

# Operators variables needed for register it in EigenLayer
el_delegation_manager_address: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9'
private_key_store_path: config-files/devnet/keys/operator-1.ecdsa.key.json
bls_private_key_store_path: config-files/devnet/keys/operator-1.bls.key.json
signer_type: local_keystore
chain_id: 31337
126 changes: 126 additions & 0 deletions docs/0_internal/ethereum_package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Ethereum Package

> [!WARNING]
> [Kurtosis](https://github.com/kurtosis-tech/kurtosis) must be installed.

## Usage and Setup

To start a local network run:

```bash
make ethereum_package_start
```

To see the status of the network run:

```bash
make ethereum_package_inspect
```

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.

To stop the network run the following:

```bash
make ethereum_package_rm
```

To start the batcher run:

```bash
make batcher_start_ethereum_package
```

To start the aggregator run:

```bash
make aggregator_start_ethereum_package
```

To start an operator run:

```bash
make operator_register_start_ethereum_package
```

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.

To start Telemetry and the Explorer, run the usual commands:

```bash
make telemetry_full_start
make run_explorer
```

To spam transactions install spamoor:
```bash
make install_spamoor
```

and run the following make targets:

```bash
make spamoor_send_transactions \\
COUNT=<TOTAL_TX_TO_EXECUTE> \\
TX_PER_BLOCK=<LIMIT_OF_TXS_TO_SEND_PER_BLOCK> \\
TX_CONSUME_GAS=<HOW_MUCH_GAS_TO_USE_PER_TX> \\
NUM_WALLETS=<NUMBER_OF_WALLETS_FROM_WHICH_TO_SEND_TXS> \\
TIP_FEE=<TIP_FEE_IN_GWEI>
```

For Example:
```bash
make spamoor_send_transactions COUNT=1000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=50 NUM_WALLETS=100 TIP_FEE=2
```

## Network status

You can check the network status using Grafana and el_forkmon explorer.
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.

## Changing Network Params

To adjust network params you have to modify `network_params.yaml`.

> [!NOTE]
> We are using a hardcoded input to deploy Eigen and Aligned contracts using the output from anvil.

## How to make transactions compete and see bumping in the Aggregator and Batcher logs

To increment the gas price and make transactions compete with aligned transactions we need to:

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`
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:

```bash
make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=22
```

- Notes:
- A transaction consuming `150000` of gas would be similar to a bridge swap.
- We pass `2` gwei more to the `tipFee` that should be enough if not, you can increase it.

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.
4. **Repeat as Needed:** Re-run the same command with the updated `TIP_FEE` to maintain competition:

```bash
make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=<new_tip_fee>
```

## How to update preloaded contracts

1. First, deploy the new contracts in Anvil:

```bash
make anvil_deploy_aligned_contracts
```

That will generate the state output in `contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json`

2. Filter the contracts' state:

```bash
jq '.accounts | to_entries | map(select(.value.code != "0x")) | from_entries' contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json > contracts.json
```

3. Open the `network_params.yaml` file and replace the `additional_preloaded_contracts` section with the content of `contracts.json`.
Loading