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

feat: Add support for op-deployer, fix multiple L2s #74

Merged
merged 24 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
13 changes: 7 additions & 6 deletions .github/tests/blockscout.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
optimism_package:
- participants:
- el_type: op-geth
network_params:
name: op-rollup-one
additional_services:
- blockscout
chains:
- participants:
- el_type: op-geth
network_params:
name: op-rollup-one
additional_services:
- blockscout
22 changes: 13 additions & 9 deletions .github/tests/hildr.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
optimism_package:
participants:
- el_type: op-geth
cl_type: op-node
- el_type: op-geth
cl_type: hildr
- el_type: op-reth
cl_type: hildr
- el_type: op-erigon
cl_type: hildr
chains:
- participants:
- el_type: op-geth
cl_type: op-node
- el_type: op-geth
cl_type: hildr
- el_type: op-reth
cl_type: hildr
- el_type: op-erigon
cl_type: hildr
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
8 changes: 6 additions & 2 deletions .github/tests/multiple_l2s.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
optimism_package:
- network_params:
chains:
- network_params:
name: op-rollup-one
network_id: '3151909'
- network_params:
- network_params:
name: op-rollup-two
network_id: '3151910'
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
10 changes: 7 additions & 3 deletions .github/tests/op-besu.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
optimism_package:
participants:
- el_type: op-besu
cl_type: op-node
chains:
- participants:
- el_type: op-besu
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
10 changes: 7 additions & 3 deletions .github/tests/op-erigon.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
optimism_package:
participants:
- el_type: op-erigon
cl_type: op-node
chains:
- participants:
- el_type: op-erigon
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
10 changes: 7 additions & 3 deletions .github/tests/op-geth.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
optimism_package:
participants:
- el_type: op-geth
cl_type: op-node
chains:
- participants:
- el_type: op-geth
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
12 changes: 8 additions & 4 deletions .github/tests/op-nethermind.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
optimism_package:
participants:
- el_type: op-geth
- el_type: op-nethermind
cl_type: op-node
chains:
- participants:
- el_type: op-geth
- el_type: op-nethermind
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
22 changes: 13 additions & 9 deletions .github/tests/op-node.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
optimism_package:
participants:
- el_type: op-geth
cl_type: op-node
- el_type: op-reth
cl_type: op-node
- el_type: op-erigon
cl_type: op-node
- el_type: op-nethermind
cl_type: op-node
chains:
- participants:
- el_type: op-geth
cl_type: op-node
- el_type: op-reth
cl_type: op-node
- el_type: op-erigon
cl_type: op-node
- el_type: op-nethermind
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
10 changes: 7 additions & 3 deletions .github/tests/op-reth.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
optimism_package:
participants:
- el_type: op-reth
cl_type: op-node
chains:
- participants:
- el_type: op-reth
cl_type: op-node
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
8 changes: 6 additions & 2 deletions .github/tests/single_l2.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
optimism_package:
participants:
- count: 2
chains:
- participants:
- count: 2
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
44 changes: 23 additions & 21 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def run(plan, args):
"""
plan.print("Parsing the L1 input args")
# If no args are provided, use the default values with minimal preset
ethereum_args = args.get(
"ethereum_package", {"network_params": {"preset": "minimal"}}
)
ethereum_args = args.get("ethereum_package", input_parser.default_ethereum_config())
optimism_args = args.get("optimism_package", {})
optimism_args_with_right_defaults = input_parser.input_parser(plan, optimism_args)
# Deploy the L1
Expand All @@ -38,17 +36,32 @@ def run(plan, args):
all_l1_participants, l1_network_params, l1_network_id
)

if l1_network_params.network != "kurtosis":
if l1_network_params.network == "kurtosis":
plan.print("Waiting for L1 to start up")
wait_for_sync.wait_for_startup(plan, l1_config_env_vars)
else:
plan.print("Waiting for network to sync")
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
deployment_output = contract_deployer.deploy_contracts(
plan,
l1_priv_key,
l1_config_env_vars,
optimism_args_with_right_defaults,
)

# 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, l2_contract_deployer_image
)
for chain in optimism_args_with_right_defaults.chains:
l2_launcher.launch_l2(
plan,
chain.network_params.name,
chain,
deployment_output,
l1_config_env_vars,
l1_priv_key,
all_l1_participants[0].el_context,
)

return
# Deploy L2s
plan.print("Deploying a local L2")
if type(optimism_args) == "dict":
Expand Down Expand Up @@ -104,15 +117,4 @@ def get_l1_config(all_l1_participants, l1_network_params, l1_network_id):
env_vars["L1_WS_URL"] = str(all_l1_participants[0].el_context.ws_url)
env_vars["L1_CHAIN_ID"] = str(l1_network_id)
env_vars["L1_BLOCK_TIME"] = str(l1_network_params.seconds_per_slot)
env_vars["DEPLOYMENT_OUTFILE"] = (
"/workspace/optimism/packages/contracts-bedrock/deployments/"
+ str(l1_network_id)
+ "/kurtosis.json"
)
env_vars["STATE_DUMP_PATH"] = (
"/workspace/optimism/packages/contracts-bedrock/deployments/"
+ str(l1_network_id)
+ "/state-dump.json"
)

return env_vars
26 changes: 17 additions & 9 deletions network_params.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
optimism_package:
participants:
- el_type: op-geth
- el_type: op-reth
- el_type: op-erigon
- el_type: op-nethermind
- el_type: op-besu
additional_services:
- blockscout
chains:
- participants:
- el_type: op-geth
sequencer: true
additional_services:
- blockscout
network_params:
network_id: 777
name: rollup-1
- participants:
- el_type: op-geth
sequencer: true
network_params:
network_id: 999
name: rollup-2
op_contract_deployer_params:
image: ethpandaops/optimism-contract-deployer:develop
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
25 changes: 20 additions & 5 deletions src/blockscout/blockscout_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ constants = import_module(

postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")

util = import_module("../util.star")

IMAGE_NAME_BLOCKSCOUT = "blockscout/blockscout-optimism:6.6.0"
IMAGE_NAME_BLOCKSCOUT_VERIF = "ghcr.io/blockscout/smart-contract-verifier:v1.7.0"

Expand Down Expand Up @@ -48,10 +50,18 @@ def launch_blockscout(
l2_services_suffix,
l1_el_context,
l2_el_context,
l2oo_address,
l2_network_name,
additional_env_vars,
deployment_output,
network_id,
):
rollup_filename = "rollup-{0}".format(network_id)
portal_address = util.read_network_config_value(
plan, deployment_output, rollup_filename, ".deposit_contract_address"
)
l1_deposit_start_block = util.read_network_config_value(
plan, deployment_output, rollup_filename, ".genesis.l1.number"
)

postgres_output = postgres.run(
plan,
service_name="{0}-postgres{1}".format(
Expand All @@ -75,9 +85,15 @@ def launch_blockscout(
l1_el_context,
l2_el_context,
verif_url,
l2oo_address,
l2_network_name,
additional_env_vars,
{
"INDEXER_OPTIMISM_L1_PORTAL_CONTRACT": portal_address,
"INDEXER_OPTIMISM_L1_DEPOSITS_START_BLOCK": l1_deposit_start_block,
"INDEXER_OPTIMISM_L1_WITHDRAWALS_START_BLOCK": l1_deposit_start_block,
"INDEXER_OPTIMISM_L1_BATCH_START_BLOCK": l1_deposit_start_block,
# The L2OO is no longer deployed
"INDEXER_OPTIMISM_L1_OUTPUT_ORACLE_CONTRACT": "0x0000000000000000000000000000000000000000",
},
)
blockscout_service = plan.add_service(
"{0}{1}".format(SERVICE_NAME_BLOCKSCOUT, l2_services_suffix), config_backend
Expand Down Expand Up @@ -112,7 +128,6 @@ def get_config_backend(
l1_el_context,
l2_el_context,
verif_url,
l2oo_address,
l2_network_name,
additional_env_vars,
):
Expand Down
Loading