Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa committed Jan 5, 2024
1 parent 4e48c65 commit 732f77a
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def launch_participant_network(
):
num_participants = len(participants)
if network_params.network == "kurtosis":
# We are running a kurtosis network
plan.print("Generating cl validator key stores")
validator_data = None
if not parallel_keystore_generation:
Expand Down Expand Up @@ -150,28 +151,20 @@ def launch_participant_network(
network_params.electra_fork_epoch,
)
elif network_params.network in constants.PUBLIC_NETWORKS:
# We are running a public network
dummy = plan.run_sh(
run="mkdir /network-configs",
store=[StoreSpec(src="/network-configs/", name="el_cl_genesis_data")],
)
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
dummy.files_artifacts[0],
constants.GENESIS_VALIDATORS_ROOT[network]
constants.GENESIS_VALIDATORS_ROOT[network_params.network],
)
final_genesis_timestamp = constants.GENESIS_TIME[network]
final_genesis_timestamp = constants.GENESIS_TIME[network_params.network]
validator_data = None
else:
# split up the name from dencun-devnet-12 to dencun and devnet-12
# split up the name from verkle-gen-devnet-12 to verkle-gen and devnet-12
network_parts = network_params.network.split("-devnet-", 1)
devnet_name, devnet_number = network_parts[0], network_parts[1]
devnet_category = devnet_name.split("-")[0]
devnet_subname = (
devnet_name.split("-")[1] + "-" if len(devnet_name.split("-")) > 1 else ""
)
url = "github.com/ethpandaops/{0}-devnets/network-configs/{1}devnet-{2}".format(
devnet_category, devnet_subname, devnet_number
)
# We are running a devnet
url = calculate_devnet_url(network_params.network)
el_cl_genesis_uuid = plan.upload_files(
src=url,
name="el_cl_genesis",
Expand All @@ -181,9 +174,10 @@ def launch_participant_network(
store=[StoreSpec(src="/network-configs/", name="el_cl_genesis_data")],
files={"/opt": el_cl_genesis_uuid},
)
genesis_validators_root = read_file(url + "/genesis_validators_root.txt")
el_cl_data = el_cl_genesis_data.new_el_cl_genesis_data(
el_cl_genesis_data_uuid.files_artifacts[0],
"0",
genesis_validators_root,
)
final_genesis_timestamp = shared_utils.read_genesis_timestamp_from_config(
plan, el_cl_genesis_uuid
Expand Down Expand Up @@ -546,10 +540,6 @@ def launch_participant_network(
)


def zfill_custom(value, width):
return ("0" * (width - len(str(value)))) + str(value)


# this is a python procedure so that Kurtosis can do idempotent runs
# time.now() runs everytime bringing non determinism
# note that the timestamp it returns is a string
Expand All @@ -565,3 +555,15 @@ print(int(time.time()+padding), end="")
store=[StoreSpec(src="/tmp", name="final-genesis-timestamp")],
)
return result.output


def calculate_devnet_url(network):
network_parts = network.split("-devnet-", 1)
devnet_name, devnet_number = network_parts[0], network_parts[1]
devnet_category = devnet_name.split("-")[0]
devnet_subname = (
devnet_name.split("-")[1] + "-" if len(devnet_name.split("-")) > 1 else ""
)
return "github.com/ethpandaops/{0}-devnets/network-configs/{1}devnet-{2}".format(
devnet_category, devnet_subname, devnet_number
)

0 comments on commit 732f77a

Please sign in to comment.