From f7b6bfed21ae7dce87bb198c9640cfd74ebfed98 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Fri, 22 Mar 2024 00:36:10 -0400 Subject: [PATCH] chore: lint --- main.star | 59 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/main.star b/main.star index 7f557373..4e8c99a8 100644 --- a/main.star +++ b/main.star @@ -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 @@ -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", @@ -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 ) @@ -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, @@ -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"] -