Commit 4d96409c authored by Barnabas Busa's avatar Barnabas Busa Committed by GitHub

fix: re-add networkid (#464)

parent f6098a15
...@@ -107,6 +107,7 @@ def launch( ...@@ -107,6 +107,7 @@ def launch(
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
launcher.jwt_file, launcher.jwt_file,
launcher.network, launcher.network,
launcher.networkid,
image, image,
service_name, service_name,
existing_el_clients, existing_el_clients,
...@@ -152,6 +153,7 @@ def get_config( ...@@ -152,6 +153,7 @@ def get_config(
el_cl_genesis_data, el_cl_genesis_data,
jwt_file, jwt_file,
network, network,
networkid,
image, image,
service_name, service_name,
existing_el_clients, existing_el_clients,
...@@ -177,6 +179,7 @@ def get_config( ...@@ -177,6 +179,7 @@ def get_config(
"--chain={0}".format( "--chain={0}".format(
network if network in constants.PUBLIC_NETWORKS else "dev" network if network in constants.PUBLIC_NETWORKS else "dev"
), ),
"--networkid={0}".format(networkid),
"--log.console.verbosity=" + verbosity_level, "--log.console.verbosity=" + verbosity_level,
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--port={0}".format(DISCOVERY_PORT_NUM), "--port={0}".format(DISCOVERY_PORT_NUM),
...@@ -276,9 +279,10 @@ def get_config( ...@@ -276,9 +279,10 @@ def get_config(
) )
def new_erigon_launcher(el_cl_genesis_data, jwt_file, network): def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid):
return struct( return struct(
el_cl_genesis_data=el_cl_genesis_data, el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file, jwt_file=jwt_file,
network=network, network=network,
networkid=networkid,
) )
...@@ -115,6 +115,7 @@ def launch( ...@@ -115,6 +115,7 @@ def launch(
launcher.el_cl_genesis_data, launcher.el_cl_genesis_data,
launcher.jwt_file, launcher.jwt_file,
launcher.network, launcher.network,
launcher.networkid,
image, image,
service_name, service_name,
existing_el_clients, existing_el_clients,
...@@ -163,6 +164,7 @@ def get_config( ...@@ -163,6 +164,7 @@ def get_config(
el_cl_genesis_data, el_cl_genesis_data,
jwt_file, jwt_file,
network, network,
networkid,
image, image,
service_name, service_name,
existing_el_clients, existing_el_clients,
...@@ -235,6 +237,7 @@ def get_config( ...@@ -235,6 +237,7 @@ def get_config(
"{0}".format( "{0}".format(
"--{}".format(network) if network in constants.PUBLIC_NETWORKS else "" "--{}".format(network) if network in constants.PUBLIC_NETWORKS else ""
), ),
"--networkid={0}".format(networkid),
"--verbosity=" + verbosity_level, "--verbosity=" + verbosity_level,
"--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER, "--datadir=" + EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
"--http", "--http",
...@@ -338,6 +341,7 @@ def new_geth_launcher( ...@@ -338,6 +341,7 @@ def new_geth_launcher(
el_cl_genesis_data, el_cl_genesis_data,
jwt_file, jwt_file,
network, network,
networkid,
final_genesis_timestamp, final_genesis_timestamp,
capella_fork_epoch, capella_fork_epoch,
electra_fork_epoch=None, electra_fork_epoch=None,
...@@ -346,6 +350,7 @@ def new_geth_launcher( ...@@ -346,6 +350,7 @@ def new_geth_launcher(
el_cl_genesis_data=el_cl_genesis_data, el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file, jwt_file=jwt_file,
network=network, network=network,
networkid=networkid,
final_genesis_timestamp=final_genesis_timestamp, final_genesis_timestamp=final_genesis_timestamp,
capella_fork_epoch=capella_fork_epoch, capella_fork_epoch=capella_fork_epoch,
electra_fork_epoch=electra_fork_epoch, electra_fork_epoch=electra_fork_epoch,
......
...@@ -59,6 +59,14 @@ PUBLIC_NETWORKS = ( ...@@ -59,6 +59,14 @@ PUBLIC_NETWORKS = (
"sepolia", "sepolia",
"holesky", "holesky",
) )
NETWORK_ID = {
"mainnet": 1,
"goerli": 5,
"sepolia": 11155111,
"holesky": 17000,
}
CHECKPOINT_SYNC_URL = { CHECKPOINT_SYNC_URL = {
"mainnet": "https://beaconstate.info", "mainnet": "https://beaconstate.info",
"goerli": "https://checkpoint-sync.goerli.ethpandaops.io", "goerli": "https://checkpoint-sync.goerli.ethpandaops.io",
......
...@@ -83,6 +83,8 @@ def launch_participant_network( ...@@ -83,6 +83,8 @@ def launch_participant_network(
plan.print(json.indent(json.encode(validator_data))) plan.print(json.indent(json.encode(validator_data)))
network_id = network_params.network_id
# We need to send the same genesis time to both the EL and the CL to ensure that timestamp based forking works as expected # We need to send the same genesis time to both the EL and the CL to ensure that timestamp based forking works as expected
final_genesis_timestamp = get_final_genesis_timestamp( final_genesis_timestamp = get_final_genesis_timestamp(
plan, plan,
...@@ -161,6 +163,7 @@ def launch_participant_network( ...@@ -161,6 +163,7 @@ def launch_participant_network(
constants.GENESIS_VALIDATORS_ROOT[network_params.network], constants.GENESIS_VALIDATORS_ROOT[network_params.network],
) )
final_genesis_timestamp = constants.GENESIS_TIME[network_params.network] final_genesis_timestamp = constants.GENESIS_TIME[network_params.network]
network_id = constants.NETWORK_ID[network_params.network]
validator_data = None validator_data = None
else: else:
# We are running a devnet # We are running a devnet
...@@ -175,6 +178,7 @@ def launch_participant_network( ...@@ -175,6 +178,7 @@ def launch_participant_network(
files={"/opt": el_cl_genesis_uuid}, files={"/opt": el_cl_genesis_uuid},
) )
genesis_validators_root = read_file(url + "/genesis_validators_root.txt") genesis_validators_root = read_file(url + "/genesis_validators_root.txt")
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data( el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
el_cl_genesis_data_uuid.files_artifacts[0], el_cl_genesis_data_uuid.files_artifacts[0],
genesis_validators_root, genesis_validators_root,
...@@ -182,6 +186,9 @@ def launch_participant_network( ...@@ -182,6 +186,9 @@ def launch_participant_network(
final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config( final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config(
plan, el_cl_genesis_uuid plan, el_cl_genesis_uuid
) )
network_id = shared_utils.read_genesis_network_id_from_config(
plan, el_cl_genesis_uuid
)
validator_data = None validator_data = None
el_launchers = { el_launchers = {
...@@ -190,6 +197,7 @@ def launch_participant_network( ...@@ -190,6 +197,7 @@ def launch_participant_network(
el_cl_data, el_cl_data,
jwt_file, jwt_file,
network_params.network, network_params.network,
network_id,
final_genesis_timestamp, final_genesis_timestamp,
network_params.capella_fork_epoch, network_params.capella_fork_epoch,
network_params.electra_fork_epoch, network_params.electra_fork_epoch,
...@@ -201,6 +209,7 @@ def launch_participant_network( ...@@ -201,6 +209,7 @@ def launch_participant_network(
el_cl_data, el_cl_data,
jwt_file, jwt_file,
network_params.network, network_params.network,
network_id,
final_genesis_timestamp, final_genesis_timestamp,
network_params.capella_fork_epoch, network_params.capella_fork_epoch,
network_params.electra_fork_epoch, network_params.electra_fork_epoch,
...@@ -220,6 +229,7 @@ def launch_participant_network( ...@@ -220,6 +229,7 @@ def launch_participant_network(
el_cl_data, el_cl_data,
jwt_file, jwt_file,
network_params.network, network_params.network,
network_id,
), ),
"launch_method": erigon.launch, "launch_method": erigon.launch,
}, },
......
...@@ -117,11 +117,25 @@ import yaml ...@@ -117,11 +117,25 @@ import yaml
with open("/network-configs/config.yaml", "r") as f: with open("/network-configs/config.yaml", "r") as f:
yaml_data = yaml.safe_load(f) yaml_data = yaml.safe_load(f)
# Get values from the YAML content
min_genesis_time = int(yaml_data.get("MIN_GENESIS_TIME", 0)) min_genesis_time = int(yaml_data.get("MIN_GENESIS_TIME", 0))
genesis_delay = int(yaml_data.get("GENESIS_DELAY", 0)) genesis_delay = int(yaml_data.get("GENESIS_DELAY", 0))
print(min_genesis_time + genesis_delay, end="")
""",
)
return value.output
print(int(min_genesis_time + genesis_delay), end="")
def read_genesis_network_id_from_config(plan, filename):
value = plan.run_python(
files={constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: filename},
wait=None,
packages=["PyYAML"],
run="""
import yaml
with open("/network-configs/config.yaml", "r") as f:
yaml_data = yaml.safe_load(f)
network_id = int(yaml_data.get("DEPOSIT_NETWORK_ID", 0))
print(network_id, end="")
""", """,
) )
return value.output return value.output
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment