Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handling of config options #85

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ optimism_package:
# Offset is in seconds
interop_time_offset: ""

# Whether to fund dev accounts on L2
# Defaults to True
fund_dev_accounts: true
barnabasbusa marked this conversation as resolved.
Show resolved Hide resolved

# The Docker image that should be used for the batcher; leave blank to use the default op-batcher image
batcher_image: ""
klkvr marked this conversation as resolved.
Show resolved Hide resolved


# Additional services to run alongside the network
# Defaults to []
Expand Down
2 changes: 2 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ optimism_package:
granite_time_offset: ""
holocene_time_offset: ""
interop_time_offset: ""
fund_dev_accounts: true
batcher_image: ""
additional_services: []
op_contract_deployer_params:
image: mslipper/op-deployer:latest
Expand Down
18 changes: 14 additions & 4 deletions src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ def deploy_contracts(
),
)

intent_updates = [
("string", "contractArtifactsURL", optimism_args.op_contract_deployer_params.artifacts_url),
] + [
("int", "chains.[{0}].deployOverrides.l2BlockTime".format(index), str(chain.network_params.seconds_per_slot))
for index, chain in enumerate(optimism_args.chains)
] + [
("bool", "chains.[{0}].deployOverrides.fundDevAccounts".format(index), "true" if chain.network_params.fund_dev_accounts else "false")
for index, chain in enumerate(optimism_args.chains)
]

op_deployer_configure = plan.run_sh(
name="op-deployer-configure",
description="Configure L2 contract deployments",
Expand All @@ -55,10 +65,10 @@ def deploy_contracts(
},
run=" && ".join(
[
"cat /network-data/intent.toml | dasel put -r toml -t string -v '{0}' 'contractArtifactsURL' > /network-data/.intent.toml".format(
optimism_args.op_contract_deployer_params.artifacts_url
),
"mv /network-data/.intent.toml /network-data/intent.toml",
"cat /network-data/intent.toml | dasel put -r toml -t {0} -v '{2}' '{1}' -o /network-data/intent.toml".format(
t, k, v
)
for t, k, v in intent_updates
]
),
)
Expand Down
1 change: 1 addition & 0 deletions src/el/op-besu/op_besu_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def get_config(
)
)

cmd += participant.el_extra_params
klkvr marked this conversation as resolved.
Show resolved Hide resolved
cmd_str = " ".join(cmd)

files = {
Expand Down
1 change: 1 addition & 0 deletions src/el/op-erigon/op_erigon_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def get_config(
)
)

cmd += participant.el_extra_params
cmd_str = " ".join(cmd)
if launcher.network not in ethereum_package_constants.PUBLIC_NETWORKS:
subcommand_strs = [
Expand Down
1 change: 1 addition & 0 deletions src/el/op-geth/op_geth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def get_config(
)
)

cmd += participant.el_extra_params
cmd_str = " ".join(cmd)
if launcher.network not in ethereum_package_constants.PUBLIC_NETWORKS:
subcommand_strs = [
Expand Down
2 changes: 2 additions & 0 deletions src/el/op-nethermind/op_nethermind_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ def get_config(
constants.EL_TYPE.op_nethermind + "_volume_size"
],
)

cmd += participant.el_extra_params
env_vars = participant.el_extra_env_vars
config_args = {
"image": participant.el_image,
Expand Down
1 change: 1 addition & 0 deletions src/el/op-reth/op_reth_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def get_config(
],
)

cmd += participant.el_extra_params
env_vars = participant.el_extra_env_vars
config_args = {
"image": participant.el_image,
Expand Down
4 changes: 0 additions & 4 deletions src/l2.star
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ def launch_l2(
):
network_params = l2_args.network_params

l2_config_env_vars = {}
l2_config_env_vars["L2_CHAIN_ID"] = str(network_params.network_id)
l2_config_env_vars["L2_BLOCK_TIME"] = str(network_params.seconds_per_slot)

barnabasbusa marked this conversation as resolved.
Show resolved Hide resolved
plan.print("Deploying L2 with name {0}".format(network_params.name))
jwt_file = plan.upload_files(
src=ethereum_package_static_files.JWT_PATH_FILEPATH,
Expand Down
4 changes: 4 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def input_parser(plan, input_args):
"holocene_time_offset"
],
interop_time_offset=result["network_params"]["interop_time_offset"],
fund_dev_accounts=result["network_params"]["fund_dev_accounts"],
batcher_image=result["network_params"]["batcher_image"],
),
additional_services=result["additional_services"],
)
Expand Down Expand Up @@ -202,6 +204,8 @@ def default_network_params():
"granite_time_offset": None,
"holocene_time_offset": None,
"interop_time_offset": None,
"fund_dev_accounts": True,
"batcher_image": "",
}


Expand Down
2 changes: 2 additions & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ SUBCATEGORY_PARAMS = {
"granite_time_offset",
"holocene_time_offset",
"interop_time_offset",
"fund_dev_accounts",
"batcher_image",
],
}

Expand Down
4 changes: 3 additions & 1 deletion src/participant_network.star
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ def launch_participant_network(
".privateKey",
)

op_batcher_image = network_params.batcher_image if network_params.batcher_image != "" else input_parser.DEFAULT_BATCHER_IMAGES["op-batcher"]

op_batcher_launcher.launch(
plan,
"op-batcher-{0}".format(l2_services_suffix),
input_parser.DEFAULT_BATCHER_IMAGES["op-batcher"],
op_batcher_image,
all_el_contexts[0],
all_cl_contexts[0],
l1_config_env_vars,
Expand Down