From 43183b114488e6b0d0a45600772d29d20dfc492d Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 14 Nov 2024 17:23:25 +0100 Subject: [PATCH 1/2] fix: add env variables when updating a service --- operate/services/service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/operate/services/service.py b/operate/services/service.py index 9685cc49..fee2a021 100644 --- a/operate/services/service.py +++ b/operate/services/service.py @@ -946,6 +946,7 @@ def update( self.name = service_template["name"] self.hash = service_template["hash"] self.description = service_template["description"] + self.env_variables = service_template["env_variables"] # Only update hash_history if latest inserted hash is different if self.hash_history[max(self.hash_history.keys())] != service_template["hash"]: From eaa70e565061d901c1a3f64d927f1e44d9bae8bc Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 14 Nov 2024 17:57:07 +0100 Subject: [PATCH 2/2] [no ci] fix: manage.py --- operate/services/manage.py | 45 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/operate/services/manage.py b/operate/services/manage.py index a20ff505..1a92a051 100644 --- a/operate/services/manage.py +++ b/operate/services/manage.py @@ -532,28 +532,29 @@ def _deploy_service_onchain_from_safe( # pylint: disable=too-many-statements,to ) # TODO A customized, arbitrary computation mechanism should be devised. - env_var_to_value = { - "ETHEREUM_LEDGER_RPC": PUBLIC_RPCS[ChainType.ETHEREUM], - "GNOSIS_LEDGER_RPC": PUBLIC_RPCS[ChainType.GNOSIS], - "BASE_LEDGER_RPC": PUBLIC_RPCS[ChainType.BASE], - "OPTIMISM_LEDGER_RPC": PUBLIC_RPCS[ChainType.OPTIMISM], - "STAKING_CONTRACT_ADDRESS": staking_params.get("staking_contract"), - "MECH_ACTIVITY_CHECKER_CONTRACT": staking_params.get("activity_checker"), - "MECH_CONTRACT_ADDRESS": staking_params.get("agent_mech"), - "MECH_REQUEST_PRICE": "10000000000000000", - "USE_MECH_MARKETPLACE": str( - "mech_marketplace" - in service.chain_configs[ - service.home_chain_id - ].chain_data.user_params.staking_program_id - ), - "REQUESTER_STAKING_INSTANCE_ADDRESS": staking_params.get( - "staking_contract" - ), - "PRIORITY_MECH_ADDRESS": staking_params.get("agent_mech"), - } - - service.update_env_variables_values(env_var_to_value) + if chain_id == service.home_chain_id: + env_var_to_value = { + "ETHEREUM_LEDGER_RPC": PUBLIC_RPCS[ChainType.ETHEREUM], + "GNOSIS_LEDGER_RPC": PUBLIC_RPCS[ChainType.GNOSIS], + "BASE_LEDGER_RPC": PUBLIC_RPCS[ChainType.BASE], + "OPTIMISM_LEDGER_RPC": PUBLIC_RPCS[ChainType.OPTIMISM], + "STAKING_CONTRACT_ADDRESS": staking_params.get("staking_contract"), + "MECH_ACTIVITY_CHECKER_CONTRACT": staking_params.get("activity_checker"), + "MECH_CONTRACT_ADDRESS": staking_params.get("agent_mech"), + "MECH_REQUEST_PRICE": "10000000000000000", + "USE_MECH_MARKETPLACE": str( + "mech_marketplace" + in service.chain_configs[ + service.home_chain_id + ].chain_data.user_params.staking_program_id + ), + "REQUESTER_STAKING_INSTANCE_ADDRESS": staking_params.get( + "staking_contract" + ), + "PRIORITY_MECH_ADDRESS": staking_params.get("agent_mech"), + } + + service.update_env_variables_values(env_var_to_value) if user_params.use_staking: self.logger.info("Checking staking compatibility")