Skip to content

Commit

Permalink
feat: Adding arbitrary contract definition (#646)
Browse files Browse the repository at this point in the history
Co-authored-by: Barnabas Busa <busa.barnabas@gmail.com>
Co-authored-by: pk910 <philipp@pk910.de>
Co-authored-by: Barnabas Busa <barnabas.busa@ethereum.org>
  • Loading branch information
4 people authored Jun 11, 2024
1 parent 20fef70 commit cb58b65
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .github/tests/custom-contracts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
participants:
- el_type: geth
cl_type: teku
- el_type: nethermind
cl_type: prysm
- el_type: erigon
cl_type: nimbus
- el_type: besu
cl_type: lighthouse
- el_type: reth
cl_type: lodestar
- el_type: ethereumjs
cl_type: teku
network_params:
network: kurtosis
additional_preloaded_contracts: '{"0x123463a4B065722E99115D6c222f267d9cABb524": {"balance": "2ETH","code": "0x1234","storage": {}}}'
additional_services: []
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,15 @@ network_params:
# For an example of minimal preset, please refer to [minimal.yaml](.github/tests/minimal.yaml)
preset: "mainnet"
# Preloaded contracts for the chain
additional_preloaded_contracts: {}
# example: To set a contract code at a certain address:
# "0x123463a4B065722E99115D6c222f267d9cABb524":
# balance: "1ETH"
# code: "0x1234"
# storage: {}
# nonce: 0
# secretKey: "0x"
# Global parameters for the network
Expand Down
5 changes: 3 additions & 2 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ participants:
el_max_mem: 0
# CL
cl_type: lighthouse
cl_image: sigp/lighthouse:latest
cl_image: sigp/lighthouse:latest-unstable
cl_log_level: ""
cl_extra_env_vars: {}
cl_extra_labels: {}
Expand All @@ -28,7 +28,7 @@ participants:
use_separate_vc: true
# Validator
vc_type: lighthouse
vc_image: sigp/lighthouse:latest
vc_image: sigp/lighthouse:latest-unstable
vc_log_level: ""
vc_count: 1
vc_extra_env_vars: {}
Expand Down Expand Up @@ -81,6 +81,7 @@ network_params:
samples_per_slot: 8
custody_requirement: 1
target_number_of_peers: 70
additional_preloaded_contracts: {}
additional_services:
- tx_spammer
- blob_spammer
Expand Down
4 changes: 2 additions & 2 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ EIP7594_FORK_VERSION = "0x70000038"

ETHEREUM_GENESIS_GENERATOR = struct(
capella_genesis="ethpandaops/ethereum-genesis-generator:2.0.12", # Deprecated (no support for minimal config)
deneb_genesis="ethpandaops/ethereum-genesis-generator:3.1.6", # Default
deneb_genesis="ethpandaops/ethereum-genesis-generator:3.2.1", # Default
verkle_support_genesis="ethpandaops/ethereum-genesis-generator:3.0.0-rc.19", # soon to be deneb genesis, waiting for rebase
verkle_genesis="ethpandaops/ethereum-genesis-generator:verkle-gen-v1.0.0",
)
Expand Down Expand Up @@ -380,7 +380,7 @@ RAM_CPU_OVERRIDES = {
"geth_max_cpu": 1000, # 1 core
"erigon_max_mem": 1024, # 1GB
"erigon_max_cpu": 1000, # 1 core
"nethermind_max_mem": 1024, # 1GB
"nethermind_max_mem": 2048, # 2GB
"nethermind_max_cpu": 1000, # 1 core
"besu_max_mem": 1024, # 1GB
"besu_max_cpu": 1000, # 1 core
Expand Down
13 changes: 9 additions & 4 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DEFAULT_EL_IMAGES = {
}

DEFAULT_CL_IMAGES = {
"lighthouse": "sigp/lighthouse:latest",
"lighthouse": "ethpandaops/lighthouse:stable",
"teku": "consensys/teku:latest",
"nimbus": "statusim/nimbus-eth2:multiarch-latest",
"prysm": "gcr.io/prysmaticlabs/prysm/beacon-chain:latest",
Expand All @@ -24,7 +24,7 @@ DEFAULT_CL_IMAGES = {
}

DEFAULT_CL_IMAGES_MINIMAL = {
"lighthouse": "ethpandaops/lighthouse:stable-minimal",
"lighthouse": "ethpandaops/lighthouse:stable",
"teku": "consensys/teku:latest",
"nimbus": "ethpandaops/nimbus-eth2:stable-minimal",
"prysm": "ethpandaops/prysm-beacon-chain:develop-minimal",
Expand All @@ -33,7 +33,7 @@ DEFAULT_CL_IMAGES_MINIMAL = {
}

DEFAULT_VC_IMAGES = {
"lighthouse": "sigp/lighthouse:latest",
"lighthouse": "ethpandaops/lighthouse:stable",
"lodestar": "chainsafe/lodestar:latest",
"nimbus": "statusim/nimbus-validator-client:multiarch-latest",
"prysm": "gcr.io/prysmaticlabs/prysm/validator:latest",
Expand All @@ -42,7 +42,7 @@ DEFAULT_VC_IMAGES = {
}

DEFAULT_VC_IMAGES_MINIMAL = {
"lighthouse": "ethpandaops/lighthouse:stable-minimal",
"lighthouse": "ethpandaops/lighthouse:stable",
"lodestar": "chainsafe/lodestar:latest",
"nimbus": "ethpandaops/nimbus-validator-client:stable-minimal",
"prysm": "ethpandaops/prysm-validator:develop-minimal",
Expand Down Expand Up @@ -292,6 +292,9 @@ def input_parser(plan, input_args):
custody_requirement=result["network_params"]["custody_requirement"],
target_number_of_peers=result["network_params"]["target_number_of_peers"],
preset=result["network_params"]["preset"],
additional_preloaded_contracts=result["network_params"][
"additional_preloaded_contracts"
],
),
mev_params=struct(
mev_relay_image=result["mev_params"]["mev_relay_image"],
Expand Down Expand Up @@ -789,6 +792,7 @@ def default_network_params():
"custody_requirement": 1,
"target_number_of_peers": 70,
"preset": "mainnet",
"additional_preloaded_contracts": {},
}


Expand Down Expand Up @@ -818,6 +822,7 @@ def default_minimal_network_params():
"custody_requirement": 1,
"target_number_of_peers": 70,
"preset": "minimal",
"additional_preloaded_contracts": {},
}


Expand Down
1 change: 1 addition & 0 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def launch_participant_network(
network_params.custody_requirement,
network_params.target_number_of_peers,
network_params.preset,
network_params.additional_preloaded_contracts,
)
elif network_params.network in constants.PUBLIC_NETWORKS:
# We are running a public network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def generate_el_cl_genesis_data(
custody_requirement,
target_number_of_peers,
preset,
additional_preloaded_contracts,
):
files = {}
shadowfork_file = ""
Expand Down Expand Up @@ -67,6 +68,7 @@ def generate_el_cl_genesis_data(
custody_requirement,
target_number_of_peers,
preset,
additional_preloaded_contracts,
)
genesis_generation_template = shared_utils.new_template_and_data(
genesis_generation_config_yml_template, template_data
Expand All @@ -86,7 +88,7 @@ def generate_el_cl_genesis_data(

genesis = plan.run_sh(
description="Creating genesis",
run="cp /opt/values.env /config/values.env && ./entrypoint.sh all && mkdir /network-configs && mv /data/custom_config_data/* /network-configs/",
run="cp /opt/values.env /config/values.env && ./entrypoint.sh all && mkdir /network-configs && mv /data/metadata/* /network-configs/",
image=image,
files=files,
store=[
Expand Down Expand Up @@ -154,6 +156,7 @@ def new_env_file_for_el_cl_genesis_data(
custody_requirement,
target_number_of_peers,
preset,
additional_preloaded_contracts,
):
return {
"UnixTimestamp": genesis_unix_timestamp,
Expand Down Expand Up @@ -184,4 +187,5 @@ def new_env_file_for_el_cl_genesis_data(
"CustodyRequirement": custody_requirement,
"TargetNumberOfPeers": target_number_of_peers,
"Preset": preset,
"AdditionalPreloadedContracts": json.encode(additional_preloaded_contracts),
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ export DATA_COLUMN_SIDECAR_SUBNET_COUNT={{ .DataColumnSidecarSubnetCount }}
export SAMPLES_PER_SLOT={{ .SamplesPerSlot }}
export CUSTODY_REQUIREMENT={{ .CustodyRequirement }}
export TARGET_NUMBER_OF_PEERS={{ .TargetNumberOfPeers }}
export ADDITIONAL_PRELOADED_CONTRACTS={{ .AdditionalPreloadedContracts }}

0 comments on commit cb58b65

Please sign in to comment.