Skip to content

Commit

Permalink
chore: cleanup cancun time, fix prague time (#692)
Browse files Browse the repository at this point in the history
Signed-off-by: Barnabas Busa <busa.barnabas@gmail.com>
Signed-off-by: Barnabas Busa <barnabas.busa@ethereum.org>
Signed-off-by: Parithosh Jayanthi <parithosh@indenwolken.xyz>
Co-authored-by: parithosh <parithosh.jayanthi@ethereum.org>
  • Loading branch information
barnabasbusa and parithosh committed Jun 26, 2024
1 parent cda5dda commit 2711cff
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 51 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/per-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
kurtosis analytics disable
- name: Run Starlark
run: kurtosis run ${{ github.workspace }} --args-file network_params.yaml
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
kurtosis run ${{ github.workspace }} --args-file network_params.yaml
run_with_args:
strategy:
Expand Down Expand Up @@ -58,7 +60,9 @@ jobs:
kurtosis analytics disable
- name: Run Starlark
run: kurtosis run ${{ github.workspace }} --args-file ${{ matrix.file_name }}
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
kurtosis run ${{ github.workspace }} --args-file ${{ matrix.file_name }}
lint:
runs-on: self-hosted-ghr-size-s-x64
Expand Down
4 changes: 1 addition & 3 deletions src/el/el_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def launch(
jwt_file,
network_params.network,
network_id,
el_cl_data.cancun_time,
el_cl_data.prague_time,
),
"launch_method": geth.launch,
Expand All @@ -43,7 +42,6 @@ def launch(
jwt_file,
network_params.network,
network_id,
el_cl_data.cancun_time,
el_cl_data.prague_time,
),
"launch_method": geth.launch,
Expand All @@ -62,7 +60,7 @@ def launch(
jwt_file,
network_params.network,
network_id,
el_cl_data.cancun_time,
el_cl_data.prague_time,
),
"launch_method": erigon.launch,
},
Expand Down
13 changes: 9 additions & 4 deletions src/el/erigon/erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def launch(
extra_params,
extra_env_vars,
extra_labels,
launcher.cancun_time,
launcher.prague_time,
persistent,
el_volume_size,
tolerations,
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_config(
extra_params,
extra_env_vars,
extra_labels,
cancun_time,
prague_time,
persistent,
el_volume_size,
tolerations,
Expand Down Expand Up @@ -209,6 +209,11 @@ def get_config(

cmd = [
"erigon",
"{0}".format(
"--override.prague=" + str(prague_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 @@ -300,11 +305,11 @@ def get_config(
)


def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid, cancun_time):
def new_erigon_launcher(el_cl_genesis_data, jwt_file, network, networkid, prague_time):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
networkid=networkid,
cancun_time=cancun_time,
prague_time=prague_time,
)
28 changes: 9 additions & 19 deletions src/el/geth/geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def launch(
extra_params,
extra_env_vars,
extra_labels,
launcher.cancun_time,
launcher.prague_time,
persistent,
el_volume_size,
Expand Down Expand Up @@ -197,7 +196,6 @@ def get_config(
extra_params,
extra_env_vars,
extra_labels,
cancun_time,
prague_time,
persistent,
el_volume_size,
Expand Down Expand Up @@ -226,7 +224,7 @@ def get_config(
constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json",
)
)
elif constants.NETWORK_NAME.shadowfork in network:
elif constants.NETWORK_NAME.shadowfork in network: # shadowfork
init_datadir_cmd_str = "echo shadowfork"

elif gcmode_archive: # Disable path based storage scheme archive mode
Expand All @@ -235,7 +233,7 @@ def get_config(
constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json",
)
else:
init_datadir_cmd_str = "geth init --state.scheme=path --datadir={0} {1}".format(
init_datadir_cmd_str = "geth init --datadir={0} {1}".format(
EXECUTION_DATA_DIRPATH_ON_CLIENT_CONTAINER,
constants.GENESIS_CONFIG_MOUNT_PATH_ON_CONTAINER + "/genesis.json",
)
Expand All @@ -259,16 +257,10 @@ def get_config(
# Disable path based storage scheme for electra fork and verkle
# TODO: REMOVE Once geth default db is path based, and builder rebased
"{0}".format(
"--state.scheme=path"
if "verkle" not in network and not gcmode_archive
else ""
"--state.scheme=hash" if "verkle" in network or gcmode_archive else ""
),
# Override prague fork timestamp for electra fork
"{0}".format("--cache.preimages" if "verkle" in network else ""),
# Override prague fork timestamp
"{0}".format(
"--override.prague=" + str(prague_time) if "verkle-gen" in network else ""
),
"{0}".format(
"--{}".format(network) if network in constants.PUBLIC_NETWORKS else ""
),
Expand Down Expand Up @@ -331,13 +323,13 @@ def get_config(
]
)
)
if (
constants.NETWORK_NAME.shadowfork in network and "verkle" in network
): # verkle shadowfork
if constants.NETWORK_NAME.shadowfork in network: # shadowfork
cmd.append("--override.prague=" + str(prague_time))
cmd.append("--override.overlay-stride=10000")
cmd.append("--override.blockproof=true")
cmd.append("--clear.verkle.costs=true")
if "verkle" in network: # verkle-shadowfork
cmd.append("--override.overlay-stride=10000")
cmd.append("--override.blockproof=true")
cmd.append("--clear.verkle.costs=true")

elif (
network not in constants.PUBLIC_NETWORKS
and constants.NETWORK_NAME.shadowfork not in network
Expand Down Expand Up @@ -402,14 +394,12 @@ def new_geth_launcher(
jwt_file,
network,
networkid,
cancun_time,
prague_time,
):
return struct(
el_cl_genesis_data=el_cl_genesis_data,
jwt_file=jwt_file,
network=network,
networkid=networkid,
cancun_time=cancun_time,
prague_time=prague_time,
)
3 changes: 1 addition & 2 deletions src/network_launcher/devnet.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ el_cl_genesis_data = import_module(
)


def launch(plan, network, cancun_time, prague_time, repo):
def launch(plan, network, prague_time, repo):
# We are running a devnet
url = shared_utils.calculate_devnet_url(network, repo)
el_cl_genesis_uuid = plan.upload_files(
Expand All @@ -23,7 +23,6 @@ def launch(plan, network, cancun_time, prague_time, repo):
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
el_cl_genesis_data_uuid.files_artifacts[0],
genesis_validators_root,
cancun_time,
prague_time,
)
final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config(
Expand Down
3 changes: 1 addition & 2 deletions src/network_launcher/ephemery.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ el_cl_genesis_data = import_module(
)


def launch(plan, cancun_time, prague_time):
def launch(plan, prague_time):
el_cl_genesis_data_uuid = plan.run_sh(
name="fetch_ephemery_genesis_data",
description="Creating network configs",
Expand All @@ -19,7 +19,6 @@ def launch(plan, cancun_time, prague_time):
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
el_cl_genesis_data_uuid.files_artifacts[0],
genesis_validators_root,
cancun_time,
prague_time,
)
final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config(
Expand Down
3 changes: 1 addition & 2 deletions src/network_launcher/public_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ el_cl_genesis_data = import_module(
constants = import_module("../package_io/constants.star")


def launch(plan, network, cancun_time, prague_time):
def launch(plan, network, prague_time):
# We are running a public network
dummy_genesis_data = plan.run_sh(
name="dummy_genesis_data",
Expand All @@ -16,7 +16,6 @@ def launch(plan, network, cancun_time, prague_time):
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
dummy_genesis_data.files_artifacts[0],
constants.GENESIS_VALIDATORS_ROOT[network],
cancun_time,
prague_time,
)
final_genesis_timestamp = constants.GENESIS_TIME[network]
Expand Down
8 changes: 2 additions & 6 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def launch_participant_network(
network_id = network_params.network_id
latest_block = ""
num_participants = len(participants)
cancun_time = 0
prague_time = 0
shadowfork_block = "latest"
total_number_of_validator_keys = 0
Expand Down Expand Up @@ -104,17 +103,15 @@ def launch_participant_network(
final_genesis_timestamp,
network_id,
validator_data,
) = launch_public_network.launch(
plan, network_params.network, cancun_time, prague_time
)
) = launch_public_network.launch(plan, network_params.network, prague_time)
elif network_params.network == constants.NETWORK_NAME.ephemery:
# We are running an ephemery network
(
el_cl_data,
final_genesis_timestamp,
network_id,
validator_data,
) = launch_ephemery.launch(plan, cancun_time, prague_time)
) = launch_ephemery.launch(plan, prague_time)
else:
# We are running a devnet
(
Expand All @@ -125,7 +122,6 @@ def launch_participant_network(
) = launch_devnet.launch(
plan,
network_params.network,
cancun_time,
prague_time,
network_params.devnet_repo,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
def new_el_cl_genesis_data(
files_artifact_uuid,
genesis_validators_root,
cancun_time,
prague_time,
):
return struct(
files_artifact_uuid=files_artifact_uuid,
genesis_validators_root=genesis_validators_root,
cancun_time=cancun_time,
prague_time=prague_time,
)
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ def generate_el_cl_genesis_data(
wait=None,
)

cancun_time = plan.run_sh(
name="read_cancun_time",
description="Reading cancun time from genesis",
run="jq .config.cancunTime /data/genesis.json | tr -d '\n'",
image="badouralix/curl-jq",
files={"/data": genesis.files_artifacts[0]},
)

prague_time = plan.run_sh(
name="read_prague_time",
description="Reading prague time from genesis",
Expand All @@ -89,7 +81,6 @@ def generate_el_cl_genesis_data(
result = el_cl_genesis_data.new_el_cl_genesis_data(
genesis.files_artifacts[0],
genesis_validators_root.output,
cancun_time.output,
prague_time.output,
)

Expand Down

0 comments on commit 2711cff

Please sign in to comment.