Skip to content

Commit

Permalink
feat: enable shadowforking (#475)
Browse files Browse the repository at this point in the history
Co-authored-by: pk910 <github@pk910.de>
Co-authored-by: parithosh <parithosh.jayanthi@ethereum.org>
  • Loading branch information
3 people authored Feb 9, 2024
1 parent 631eaf3 commit b788b18
Show file tree
Hide file tree
Showing 26 changed files with 419 additions and 119 deletions.
17 changes: 17 additions & 0 deletions .github/tests/holesky-shadowfork-verkle.yaml_norun
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
participants:
- el_client_type: geth
el_client_image: ethpandaops/geth:transition-post-genesis-04b0304
cl_client_type: lighthouse
cl_client_image: ethpandaops/lighthouse:verkle-trees-capella-2ffb8a9
- el_client_type: geth
el_client_image: ethpandaops/geth:transition-post-genesis-04b0304
cl_client_type: lodestar
cl_client_image: ethpandaops/lodestar:g11tech-verge-815364b
network_params:
electra_fork_epoch: 1
network: holesky-shadowfork-verkle
genesis_delay: 300
additional_services:
- dora
snooper_enabled: true
persistent: true
12 changes: 12 additions & 0 deletions .github/tests/holesky-shadowfork.yaml_norun
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
participants:
- el_client_type: geth
el_client_image: ethereum/client-go:v1.13.11
cl_client_type: teku
cl_client_image: consensys/teku:24.1.1
network_params:
dencun_fork_epoch: 1
network: holesky-shadowfork
additional_services:
- dora
snooper_enabled: true
persistent: true
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
participants:
- el_client_type: geth
el_client_image: ethpandaops/geth:kaustinen-with-shapella-6d7b22c
el_client_image: ethpandaops/geth:kaustinen-with-shapella-0b110bd
cl_client_type: lighthouse
cl_client_image: ethpandaops/lighthouse:verkle-trees-capella-2ffb8a9
count: 2
- el_client_type: geth
el_client_image: ethpandaops/geth:kaustinen-with-shapella-6d7b22c
el_client_image: ethpandaops/geth:kaustinen-with-shapella-0b110bd
cl_client_type: lodestar
cl_client_image: ethpandaops/lodestar:g11tech-verge-815364b
network_params:
network: verkle-gen-devnet-3
network: verkle-gen-devnet-4

4 changes: 2 additions & 2 deletions .github/tests/verkle-gen.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
participants:
- el_client_type: geth
el_client_image: ethpandaops/geth:kaustinen-with-shapella-6d7b22c
el_client_image: ethpandaops/geth:kaustinen-with-shapella-0b110bd
cl_client_type: lighthouse
cl_client_image: ethpandaops/lighthouse:verkle-trees-capella-2ffb8a9
count: 2
- el_client_type: geth
el_client_image: ethpandaops/geth:kaustinen-with-shapella-6d7b22c
el_client_image: ethpandaops/geth:kaustinen-with-shapella-0b110bd
cl_client_type: lodestar
cl_client_image: ethpandaops/lodestar:g11tech-verge-815364b
count: 2
Expand Down
4 changes: 2 additions & 2 deletions .github/tests/verkle.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
participants:
- el_client_type: geth
el_client_image: ethpandaops/geth:transition-post-genesis-1d80ebd
el_client_image: ethpandaops/geth:transition-post-genesis-04b0304
cl_client_type: lighthouse
cl_client_image: ethpandaops/lighthouse:verkle-trees-capella-2ffb8a9
count: 2
- el_client_type: geth
el_client_image: ethpandaops/geth:transition-post-genesis-1d80ebd
el_client_image: ethpandaops/geth:transition-post-genesis-04b0304
cl_client_type: lodestar
cl_client_image: ethpandaops/lodestar:g11tech-verge-815364b
network_params:
Expand Down
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ To mitigate these issues, you can use the `el_client_volume_size` and `cl_client

For optimal performance, we recommend using a cloud provider that allows you to provision Kubernetes clusters with fast persistent storage or self hosting your own Kubernetes cluster with fast persistent storage.

### Shadowforking
In order to enable shadowfork capabilities, you can use the `network_params.network` flag. The expected value is the name of the network you want to shadowfork followed by `-shadowfork`. Please note that `persistent` configuration parameter has to be enabled for shadowforks to work! Current limitation on k8s is it is only working on a single node cluster. For example, to shadowfork the Holesky testnet, you can use the following command:
```yaml
...
network_params:
network: "holesky-shadowfork"
persistent: true
...
```

##### Shadowforking custom verkle networks
In order to enable shadowfork capabilities for verkle networks, you need to define electra and mention verkle in the network name after shadowfork.
```yaml
...
network_params:
electra_fork_epoch: 1
network: "holesky-shadowfork-verkle"
persistent: true
...
```

#### Taints and tolerations
It is possible to run the package on a Kubernetes cluster with taints and tolerations. This is done by adding the tolerations to the `tolerations` field in the `network_params.yaml` file. For example:
```yaml
Expand Down Expand Up @@ -218,7 +239,7 @@ participants:
# effect: "NoSchedule"
# toleration_seconds: 3600
# Defaults to empty
el_tolerations: []
cl_tolerations: []
# A list of tolerations that will be passed to the validator container
# Only works with Kubernetes
Expand Down Expand Up @@ -362,7 +383,7 @@ network_params:
# Defaults to 2048
eth1_follow_distance: 2048
# The epoch at which the capella and deneb forks are set to occur.
# The epoch at which the capella/deneb/electra forks are set to occur.
capella_fork_epoch: 0
deneb_fork_epoch: 500
electra_fork_epoch: null
Expand All @@ -373,6 +394,14 @@ network_params:
# You can sync any devnet by setting this to the network name (e.g. "dencun-devnet-12", "verkle-gen-devnet-2")
network: "kurtosis"
# The number of epochs to wait validators to be able to withdraw
# Defaults to 256 epochs ~27 hours
min_validator_withdrawability_delay: 256
# The period of the shard committee
# Defaults to 256 epoch ~27 hours
shard_committee_period: 256
# Configuration place for transaction spammer - https:#github.com/MariusVanDerWijden/tx-fuzz
tx_spammer_params:
# A list of optional extra params that will be passed to the TX Spammer container for modifying its behaviour
Expand Down
9 changes: 9 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ participants:
el_client_log_level: ""
el_extra_params: []
el_extra_labels: {}
el_tolerations: []
cl_client_type: lighthouse
cl_client_image: sigp/lighthouse:latest
cl_client_log_level: ""
cl_tolerations: []
validator_tolerations: []
tolerations: []
beacon_extra_params: []
beacon_extra_labels: {}
validator_extra_params: []
Expand Down Expand Up @@ -50,6 +54,10 @@ network_params:
capella_fork_epoch: 0
deneb_fork_epoch: 4
electra_fork_epoch: null
network: kurtosis
min_validator_withdrawability_delay: 256
shard_committee_period: 256

additional_services:
- tx_spammer
- blob_spammer
Expand Down Expand Up @@ -78,3 +86,4 @@ mev_params:
grafana_additional_dashboards: []
persistent: false
xatu_sentry_enabled: false
global_tolerations: []
13 changes: 5 additions & 8 deletions src/cl/lighthouse/lighthouse_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,7 @@ def launch(
cl_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

bn_min_cpu = int(bn_min_cpu) if int(bn_min_cpu) > 0 else BEACON_MIN_CPU
bn_max_cpu = (
Expand Down Expand Up @@ -381,7 +375,10 @@ def get_beacon_config(

if network not in constants.PUBLIC_NETWORKS:
cmd.append("--testnet-dir=" + constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER)
if network == constants.NETWORK_NAME.kurtosis:
if (
network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network
):
if boot_cl_client_ctxs != None:
cmd.append(
"--boot-nodes="
Expand Down
13 changes: 5 additions & 8 deletions src/cl/lodestar/lodestar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,7 @@ def launch(
cl_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

bn_min_cpu = int(bn_min_cpu) if int(bn_min_cpu) > 0 else BEACON_MIN_CPU
bn_max_cpu = (
Expand Down Expand Up @@ -349,7 +343,10 @@ def get_beacon_config(
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz"
)
if network == constants.NETWORK_NAME.kurtosis:
if (
network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network
):
if bootnode_contexts != None:
cmd.append(
"--bootnodes="
Expand Down
13 changes: 5 additions & 8 deletions src/cl/nimbus/nimbus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,7 @@ def launch(
cl_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

bn_min_cpu = int(bn_min_cpu) if int(bn_min_cpu) > 0 else BEACON_MIN_CPU
bn_max_cpu = (
Expand Down Expand Up @@ -394,7 +388,10 @@ def get_beacon_config(
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/bootstrap_nodes.txt"
)
if network == constants.NETWORK_NAME.kurtosis:
if (
network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network
):
if bootnode_contexts == None:
cmd.append("--subscribe-all-subnets")
else:
Expand Down
13 changes: 5 additions & 8 deletions src/cl/prysm/prysm_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,7 @@ def launch(
cl_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

bn_min_cpu = int(bn_min_cpu) if int(bn_min_cpu) > 0 else BEACON_MIN_CPU
bn_max_cpu = (
Expand Down Expand Up @@ -360,7 +354,10 @@ def get_beacon_config(
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz",
)
if network == constants.NETWORK_NAME.kurtosis:
if (
network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network
):
if bootnode_contexts != None:
for ctx in bootnode_contexts[: constants.MAX_ENR_ENTRIES]:
cmd.append("--peer=" + ctx.multiaddr)
Expand Down
20 changes: 12 additions & 8 deletions src/cl/teku/teku_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,7 @@ def launch(
int(bn_max_mem) if int(bn_max_mem) > 0 else holesky_beacon_memory_limit
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

bn_min_cpu = int(bn_min_cpu) if int(bn_min_cpu) > 0 else BEACON_MIN_CPU
bn_max_cpu = (
Expand Down Expand Up @@ -400,7 +394,10 @@ def get_beacon_config(
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
+ "/genesis.ssz"
)
if network == constants.NETWORK_NAME.kurtosis:
if (
network == constants.NETWORK_NAME.kurtosis
or constants.NETWORK_NAME.shadowfork in network
):
if bootnode_contexts != None:
cmd.append(
"--p2p-discovery-bootnodes="
Expand Down Expand Up @@ -430,6 +427,13 @@ def get_beacon_config(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
elif constants.NETWORK_NAME.shadowfork in network:
cmd.append(
"--p2p-discovery-bootnodes="
+ shared_utils.get_devnet_enrs_list(
plan, el_cl_genesis_data.files_artifact_uuid
)
)
else: # Devnets
# TODO Remove once checkpoint sync is working for verkle
if constants.NETWORK_NAME.verkle not in network:
Expand Down
13 changes: 5 additions & 8 deletions src/el/besu/besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,7 @@ def launch(
el_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
Expand Down Expand Up @@ -208,7 +202,10 @@ def get_config(
"--metrics-host=0.0.0.0",
"--metrics-port={0}".format(METRICS_PORT_NUM),
]
if network not in constants.PUBLIC_NETWORKS:
if (
network not in constants.PUBLIC_NETWORKS
or constants.NETWORK_NAME.shadowfork in network
):
cmd.append(
"--genesis-file="
+ constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER
Expand Down
18 changes: 10 additions & 8 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,7 @@ def launch(
el_tolerations, participant_tolerations, global_tolerations
)

network_name = (
"devnets"
if launcher.network != "kurtosis"
and launcher.network != "ephemery"
and launcher.network not in constants.PUBLIC_NETWORKS
else launcher.network
)
network_name = shared_utils.get_network_name(launcher.network)

el_min_cpu = int(el_min_cpu) if int(el_min_cpu) > 0 else EXECUTION_MIN_CPU
el_max_cpu = (
Expand Down Expand Up @@ -134,6 +128,7 @@ def launch(
extra_params,
extra_env_vars,
extra_labels,
launcher.cancun_time,
persistent,
el_volume_size,
tolerations,
Expand Down Expand Up @@ -181,6 +176,7 @@ def get_config(
extra_params,
extra_env_vars,
extra_labels,
cancun_time,
persistent,
el_volume_size,
tolerations,
Expand All @@ -195,6 +191,11 @@ def get_config(
"--chain={0}".format(
network if network in constants.PUBLIC_NETWORKS else "dev"
),
"{0}".format(
"--override.cancun=" + str(cancun_time)
if constants.NETWORK_NAME.shadowfork in network
else ""
),
"--networkid={0}".format(networkid),
"--log.console.verbosity=" + verbosity_level,
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
Expand Down Expand Up @@ -296,10 +297,11 @@ def get_config(
)


def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid):
def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid, cancun_time):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
networkid=networkid,
cancun_time=cancun_time,
)
Loading

0 comments on commit b788b18

Please sign in to comment.