Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
praetoriansentry committed Mar 22, 2024
1 parent 5bd1e46 commit f7b6bfe
Showing 1 changed file with 44 additions and 15 deletions.
59 changes: 44 additions & 15 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,24 @@ def run(plan, args):
)

# Fetch addresses
zkevm_bridge_address = extract_json_key_from_service(plan, "contracts" + args["deployment_suffix"], "/opt/zkevm/bridge-config.toml", "PolygonBridgeAddress") # "L2PolygonBridgeAddresses"
rollup_manager_address = extract_json_key_from_service(plan, "contracts" + args["deployment_suffix"], "/opt/zkevm/bridge-config.toml", "PolygonRollupManagerAddress")
polygon_zkevm_address = extract_json_key_from_service(plan, "contracts" + args["deployment_suffix"], "/opt/zkevm/bridge-config.toml", "PolygonZkEVMAddress")
zkevm_bridge_address = extract_json_key_from_service(
plan,
"contracts" + args["deployment_suffix"],
"/opt/zkevm/bridge-config.toml",
"PolygonBridgeAddress",
) # "L2PolygonBridgeAddresses"
rollup_manager_address = extract_json_key_from_service(
plan,
"contracts" + args["deployment_suffix"],
"/opt/zkevm/bridge-config.toml",
"PolygonRollupManagerAddress",
)
polygon_zkevm_address = extract_json_key_from_service(
plan,
"contracts" + args["deployment_suffix"],
"/opt/zkevm/bridge-config.toml",
"PolygonZkEVMAddress",
)
l1_eth_service = plan.get_service(name="el-1-geth-lighthouse")

# Fetch port
Expand All @@ -289,10 +304,16 @@ def run(plan, args):
args["zkevm_bridge_ui_port"], application_protocol="http"
),
},
env_vars = {
"ETHEREUM_RPC_URL": "http://{}:{}".format(l1_eth_service.ip_address, l1_eth_service.ports["rpc"].number),
"POLYGON_ZK_EVM_RPC_URL": "http://{}:{}".format(service_map["rpc"].ip_address, polygon_zkevm_rpc_http_port.number),
"BRIDGE_API_URL": "http://{}:{}".format(zkevm_bridge_service.ip_address, bridge_api_http_port.number),
env_vars={
"ETHEREUM_RPC_URL": "http://{}:{}".format(
l1_eth_service.ip_address, l1_eth_service.ports["rpc"].number
),
"POLYGON_ZK_EVM_RPC_URL": "http://{}:{}".format(
service_map["rpc"].ip_address, polygon_zkevm_rpc_http_port.number
),
"BRIDGE_API_URL": "http://{}:{}".format(
zkevm_bridge_service.ip_address, bridge_api_http_port.number
),
"ETHEREUM_BRIDGE_CONTRACT_ADDRESS": zkevm_bridge_address,
"POLYGON_ZK_EVM_BRIDGE_CONTRACT_ADDRESS": zkevm_bridge_address,
"ETHEREUM_FORCE_UPDATE_GLOBAL_EXIT_ROOT": "true",
Expand Down Expand Up @@ -333,8 +354,12 @@ def start_node_components(

service_map = {}
# Deploy components.
service_map["synchronizer"] = zkevm_node_package.start_synchronizer(plan, args, config_artifact, genesis_artifact)
service_map["sequencer"] = zkevm_node_package.start_sequencer(plan, args, config_artifact, genesis_artifact)
service_map["synchronizer"] = zkevm_node_package.start_synchronizer(
plan, args, config_artifact, genesis_artifact
)
service_map["sequencer"] = zkevm_node_package.start_sequencer(
plan, args, config_artifact, genesis_artifact
)
service_map["sequence_sender"] = zkevm_node_package.start_sequence_sender(
plan, args, config_artifact, genesis_artifact, sequencer_keystore_artifact
)
Expand All @@ -346,7 +371,9 @@ def start_node_components(
sequencer_keystore_artifact,
aggregator_keystore_artifact,
)
service_map["rpc"] = zkevm_node_package.start_rpc(plan, args, config_artifact, genesis_artifact)
service_map["rpc"] = zkevm_node_package.start_rpc(
plan, args, config_artifact, genesis_artifact
)

service_map["eth_tx_manager"] = zkevm_node_package.start_eth_tx_manager(
plan,
Expand All @@ -362,13 +389,15 @@ def start_node_components(
)
return service_map

def extract_json_key_from_service(
plan, service_name, filename, key
):

def extract_json_key_from_service(plan, service_name, filename, key):
plan.print("Extracting contract addresses and ports...")
exec_recipe = ExecRecipe(
command=["/bin/sh", "-c", "cat {} | grep -w '{}' | xargs -n1 | tail -1".format(filename, key)]
command=[
"/bin/sh",
"-c",
"cat {} | grep -w '{}' | xargs -n1 | tail -1".format(filename, key),
]
)
result = plan.exec(service_name=service_name, recipe=exec_recipe)
return result["output"]

0 comments on commit f7b6bfe

Please sign in to comment.