Skip to content

Commit

Permalink
feat: op-deployer upgrade, fix fork support
Browse files Browse the repository at this point in the history
  • Loading branch information
mslipper committed Nov 20, 2024
1 parent 5b085c8 commit ae564f7
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ optimism_package:
fjord_time_offset: 0

# Granite fork
# Defaults to None - not activated - decimal value
# Defaults to 0 (genesis activation) - decimal value
# Offset is in seconds
granite_time_offset: ""

Expand All @@ -228,6 +228,11 @@ optimism_package:
# Offset is in seconds
holocene_time_offset: ""

# Isthmus fork
# Defaults to None - not activated - decimal value
# Offset is in seconds
isthmus_time_offset: ""

# Interop fork
# Defaults to None - not activated - decimal value
# Offset is in seconds
Expand All @@ -254,8 +259,9 @@ optimism_package:
# L2 contract deployer configuration - used for all L2 networks
# The docker image that should be used for the L2 contract deployer
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.6
l1_artifacts_locator: op-contracts/v1.6.0
l2_artifacts_locator: op-contracts/v1.7.0-beta.1+l2-contracts

# The global log level that all clients should log at
# Valid values are "error", "warn", "info", "debug", and "trace"
Expand Down
8 changes: 3 additions & 5 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ optimism_package:
seconds_per_slot: 2
name: "op-kurtosis"
fjord_time_offset: 0
granite_time_offset: ""
holocene_time_offset: ""
interop_time_offset: ""
granite_time_offset: 0
holocene_time_offset: 0
fund_dev_accounts: true
batcher_params:
image: ""
extra_params: []
additional_services: []
op_contract_deployer_params:
image: mslipper/op-deployer:latest
artifacts_url: https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.6
global_log_level: "info"
global_node_selectors: {}
global_tolerations: []
Expand Down
37 changes: 35 additions & 2 deletions src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,37 @@ def deploy_contracts(
),
)

hardfork_schedule = []
for index, chain in enumerate(optimism_args.chains):
np = chain.network_params

# rename each hardfork to the name the override expects
renames = (
("l2GenesisFjordTimeOffset", np.fjord_time_offset),
("l2GenesisGraniteTimeOffset", np.granite_time_offset),
("l2GenesisHoloceneTimeOffset", np.holocene_time_offset),
("l2GenesisIsthmusTimeOffset", np.isthmus_time_offset),
("l2GenesisInteropTimeOffset", np.interop_time_offset),
)

# only include the hardforks that have been activated since
# toml does not support null values
for fork_key, activation_timestamp in renames:
if activation_timestamp != None:
hardfork_schedule.append((index, fork_key, activation_timestamp))


intent_updates = (
[
(
"string",
"contractArtifactsURL",
optimism_args.op_contract_deployer_params.artifacts_url,
"l1ContractsLocator",
optimism_args.op_contract_deployer_params.l1_artifacts_locator,
),
(
"string",
"l2ContractsLocator",
optimism_args.op_contract_deployer_params.l2_artifacts_locator,
),
]
+ [
Expand All @@ -64,6 +89,14 @@ def deploy_contracts(
)
for index, chain in enumerate(optimism_args.chains)
]
+ [
(
"string",
"chains.[{0}].deployOverrides.{1}".format(index, fork_key),
"0x%x" % activation_timestamp,
)
for index, fork_key, activation_timestamp in hardfork_schedule
]
)

op_deployer_configure = plan.run_sh(
Expand Down
12 changes: 8 additions & 4 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def input_parser(plan, input_args):
holocene_time_offset=result["network_params"][
"holocene_time_offset"
],
isthmus_time_offset=result["network_params"]["isthmus_time_offset"],
interop_time_offset=result["network_params"]["interop_time_offset"],
fund_dev_accounts=result["network_params"]["fund_dev_accounts"],
),
Expand All @@ -93,7 +94,8 @@ def input_parser(plan, input_args):
],
op_contract_deployer_params=struct(
image=results["op_contract_deployer_params"]["image"],
artifacts_url=results["op_contract_deployer_params"]["artifacts_url"],
l1_artifacts_locator=results["op_contract_deployer_params"]["l1_artifacts_locator"],
l2_artifacts_locator=results["op_contract_deployer_params"]["l2_artifacts_locator"],
),
global_log_level=results["global_log_level"],
global_node_selectors=results["global_node_selectors"],
Expand Down Expand Up @@ -204,8 +206,9 @@ def default_network_params():
"name": "op-kurtosis",
"seconds_per_slot": 2,
"fjord_time_offset": 0,
"granite_time_offset": None,
"granite_time_offset": 0,
"holocene_time_offset": None,
"isthmus_time_offset": None,
"interop_time_offset": None,
"fund_dev_accounts": True,
}
Expand Down Expand Up @@ -252,8 +255,9 @@ def default_participant():

def default_op_contract_deployer_params():
return {
"image": "mslipper/op-deployer:latest",
"artifacts_url": "https://storage.googleapis.com/oplabs-contract-artifacts/artifacts-v1-4accd01f0c35c26f24d2aa71aba898dd7e5085a2ce5daadc8a84b10caf113409.tar.gz",
"image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-deployer:v0.0.6",
"l1_artifacts_locator": "tag://op-contracts/v1.6.0",
"l2_artifacts_locator": "tag://op-contracts/v1.7.0-beta.1+l2-contracts",
}


Expand Down
3 changes: 2 additions & 1 deletion src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ SUBCATEGORY_PARAMS = {

OP_CONTRACT_DEPLOYER_PARAMS = [
"image",
"artifacts_url",
"l1_artifacts_locator",
"l2_artifacts_locator",
]

ADDITIONAL_SERVICES_PARAMS = [
Expand Down

0 comments on commit ae564f7

Please sign in to comment.