Skip to content

Commit

Permalink
feat: add op_contract_deployer_params/image (#63)
Browse files Browse the repository at this point in the history
…2 deployer image as a param
  • Loading branch information
barnabasbusa authored Aug 27, 2024
1 parent 08e7548 commit 9416a86
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ optimism_package:
# Available services:
# - blockscout
additional_services: []
# L2 contract deployer configuration
# The docker image that should be used for the L2 contract deployer
op_contract_deployer_params:
image: ethpandaops/optimism-contract-deployer:develop
```

### Additional configuration recommendations
Expand Down
10 changes: 9 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ static_files = import_module(
)
l2_launcher = import_module("./src/l2.star")
wait_for_sync = import_module("./src/wait/wait_for_sync.star")
input_parser = import_module("./src/package_io/input_parser.star")


def run(plan, args):
Expand All @@ -21,6 +22,7 @@ def run(plan, args):
"ethereum_package", {"network_params": {"preset": "minimal"}}
)
optimism_args = args.get("optimism_package", {})
optimism_args_with_right_defaults = input_parser.input_parser(plan, optimism_args)
# Deploy the L1
plan.print("Deploying a local L1")
l1 = ethereum_package.run(plan, ethereum_args)
Expand All @@ -39,8 +41,14 @@ def run(plan, args):
if l1_network_params.network != "kurtosis":
wait_for_sync.wait_for_sync(plan, l1_config_env_vars)

l2_contract_deployer_image = (
optimism_args_with_right_defaults.op_contract_deployer_params.image
)

# Deploy Create2 Factory contract (only need to do this once for multiple l2s)
contract_deployer.deploy_factory_contract(plan, l1_priv_key, l1_config_env_vars)
contract_deployer.deploy_factory_contract(
plan, l1_priv_key, l1_config_env_vars, l2_contract_deployer_image
)
# Deploy L2s
plan.print("Deploying a local L2")
if type(optimism_args) == "dict":
Expand Down
2 changes: 2 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ optimism_package:
- el_type: op-besu
additional_services:
- blockscout
op_contract_deployer_params:
image: ethpandaops/optimism-contract-deployer:develop
8 changes: 4 additions & 4 deletions src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
IMAGE = "ethpandaops/optimism-contract-deployer:develop"

ENVRC_PATH = "/workspace/optimism/.envrc"
FACTORY_DEPLOYER_ADDRESS = "0x3fAB184622Dc19b6109349B94811493BF2a45362"
FACTORY_ADDRESS = "0x4e59b44847b379578588920cA78FbF26c0B4956C"
Expand All @@ -13,11 +11,12 @@ def deploy_factory_contract(
plan,
priv_key,
l1_config_env_vars,
image,
):
factory_deployment_result = plan.run_sh(
name="op-deploy-factory-contract",
description="Deploying L2 factory contract to L1 (takes about a minute)",
image=IMAGE,
image=image,
env_vars={
"PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10ether",
Expand Down Expand Up @@ -48,6 +47,7 @@ def deploy_l2_contracts(
l2_config_env_vars,
l2_services_suffix,
fork_activation_env,
image,
):
chainspec_files_artifact = plan.upload_files(
src=CHAINSPEC_JQ_FILEPATH,
Expand All @@ -57,7 +57,7 @@ def deploy_l2_contracts(
op_genesis = plan.run_sh(
name="op-deploy-l2-contracts",
description="Deploying L2 contracts (takes about a minute)",
image=IMAGE,
image=image,
env_vars={
"PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10ether",
Expand Down
1 change: 1 addition & 0 deletions src/l2.star
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def launch_l2(
l2_config_env_vars,
l2_services_suffix,
fork_activation_env,
args_with_right_defaults.op_contract_deployer_params.image,
)

plan.print("Deploying L2 with name {0}".format(network_params.name))
Expand Down
11 changes: 11 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def input_parser(plan, input_args):
additional_services=result.get(
"additional_services", DEFAULT_ADDITIONAL_SERVICES
),
op_contract_deployer_params=struct(
image=result["op_contract_deployer_params"]["image"],
),
)


Expand Down Expand Up @@ -125,9 +128,11 @@ def parse_network_params(plan, input_args):
def default_input_args(input_args):
network_params = default_network_params()
participants = [default_participant()]
op_contract_deployer_params = default_op_contract_deployer_params()
return {
"participants": participants,
"network_params": network_params,
"op_contract_deployer_params": op_contract_deployer_params,
}


Expand All @@ -152,3 +157,9 @@ def default_participant():
"cl_image": "",
"count": 1,
}


def default_op_contract_deployer_params():
return {
"image": "ethpandaops/optimism-contract-deployer:develop",
}
1 change: 1 addition & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SUBCATEGORY_PARAMS = {
"holocene_time_offset",
"interop_time_offset",
],
"op_contract_deployer_params": ["image"],
}

ADDITIONAL_SERVICES_PARAMS = [
Expand Down

0 comments on commit 9416a86

Please sign in to comment.