From 7cbc1fbb589e6d8db9e84bab5700f9d8ac8c1f7d Mon Sep 17 00:00:00 2001 From: Divya-Solulab Date: Fri, 22 Nov 2024 19:06:20 +0530 Subject: [PATCH 1/4] fix: override gas params --- run_service.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/run_service.py b/run_service.py index 6ce7efe..9ad3b2a 100644 --- a/run_service.py +++ b/run_service.py @@ -88,6 +88,8 @@ "mode":"mode" } ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +DEFAULT_MAX_FEE = 20000000 +use_default_max_fee = True def estimate_priority_fee( web3_object: Web3, @@ -394,7 +396,7 @@ def get_service_template(config: OptimusConfig) -> ServiceTemplate: home_chain_id = "34443" return ServiceTemplate({ "name": "Optimus", - "hash": "bafybeifokbnipvf4epclritybmfjteqpyqhdhtyrol65j75qq5cv47he2m", + "hash": "bafybeibwo7bduh67esoxw72ok2cn6qneog7sivb66i6rhhew3hqgbnn4fe", "description": "Optimus", "image": "https://gateway.autonolas.tech/ipfs/bafybeiaakdeconw7j5z76fgghfdjmsr6tzejotxcwnvmp3nroaw3glgyve", @@ -572,10 +574,16 @@ def calculate_fund_requirement(rpc, fee_history_blocks: int, gas_amount: int, fe def fetch_agent_fund_requirement(chain_id, rpc, fee_history_blocks: int = 500000) -> int: gas_amount = 50_000_000 + if use_default_max_fee: + return DEFAULT_MAX_FEE * gas_amount + return calculate_fund_requirement(rpc, fee_history_blocks, gas_amount) def fetch_operator_fund_requirement(chain_id, rpc, fee_history_blocks: int = 500000) -> int: gas_amount = 30_000_000 + if use_default_max_fee: + return DEFAULT_MAX_FEE * gas_amount + return calculate_fund_requirement(rpc, fee_history_blocks, gas_amount) def main() -> None: From dea7c0c5c2a92d42bcb4ec37204685f03927c4b0 Mon Sep 17 00:00:00 2001 From: Divya-Solulab Date: Fri, 22 Nov 2024 20:39:40 +0530 Subject: [PATCH 2/4] fix: resolve gas override issue --- operate/services/manage.py | 1 - run_service.py | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/operate/services/manage.py b/operate/services/manage.py index dde4e4f..7fb3095 100644 --- a/operate/services/manage.py +++ b/operate/services/manage.py @@ -1353,7 +1353,6 @@ def update_service( ) -> Service: """Update a service.""" - self.logger.info("-----Entering update local service-----") old_service = self.load_or_create(hash=old_hash) new_service = self.load_or_create( hash=new_hash, service_template=service_template diff --git a/run_service.py b/run_service.py index 9ad3b2a..9883424 100644 --- a/run_service.py +++ b/run_service.py @@ -396,7 +396,7 @@ def get_service_template(config: OptimusConfig) -> ServiceTemplate: home_chain_id = "34443" return ServiceTemplate({ "name": "Optimus", - "hash": "bafybeibwo7bduh67esoxw72ok2cn6qneog7sivb66i6rhhew3hqgbnn4fe", + "hash": "bafybeig7b4ca7l6ae54x6cmp4ltyyqnuhsyggw3bpswbznjzkmgytbv4pa", "description": "Optimus", "image": "https://gateway.autonolas.tech/ipfs/bafybeiaakdeconw7j5z76fgghfdjmsr6tzejotxcwnvmp3nroaw3glgyve", @@ -644,8 +644,6 @@ def main() -> None: if chain_config.ledger_config.rpc is not None: os.environ["CUSTOM_CHAIN_RPC"] = chain_config.ledger_config.rpc os.environ["OPEN_AUTONOMY_SUBGRAPH_URL"] = "https://subgraph.autonolas.tech/subgraphs/name/autonolas-staging" - os.environ["MAX_PRIORITY_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_PRIORITY_FEE_PER_GAS"] - os.environ["MAX_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_FEE_PER_GAS"] service_exists = manager._get_on_chain_state(chain_config) != OnChainState.NON_EXISTENT @@ -794,7 +792,7 @@ def main() -> None: manager.fund_service(hash=service.hash, chain_id=chain_id, safe_fund_treshold=safe_fund_threshold, safe_topup=safe_topup, agent_fund_threshold=agent_fund_requirement, agent_topup=agent_fund_requirement) usdc_balance = get_erc20_balance(ledger_api, USDC_ADDRESS, address) - if usdc_investment_fund_requirement > 0: + if usdc_investment_fund_requirement > 0 and not service_exists: # transfer all the usdc balance into the service safe manager.fund_service_erc20( hash=service.hash, From 66342978004d6035bf785fad99a9fd7174a0b44b Mon Sep 17 00:00:00 2001 From: Divya-Solulab Date: Fri, 22 Nov 2024 20:52:26 +0530 Subject: [PATCH 3/4] fix: add gas overrides --- run_service.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/run_service.py b/run_service.py index 9883424..f54bd50 100644 --- a/run_service.py +++ b/run_service.py @@ -79,8 +79,8 @@ # this means default values will be used "FEE_HISTORY_PERCENTILE": "50", "DEFAULT_PRIORITY_FEE": "2000000", - "MAX_PRIORITY_FEE_PER_GAS": "", - "MAX_FEE_PER_GAS": "", + "MAX_PRIORITY_FEE_PER_GAS": "20000000", + "MAX_FEE_PER_GAS": "3000000", } }, } @@ -396,7 +396,7 @@ def get_service_template(config: OptimusConfig) -> ServiceTemplate: home_chain_id = "34443" return ServiceTemplate({ "name": "Optimus", - "hash": "bafybeig7b4ca7l6ae54x6cmp4ltyyqnuhsyggw3bpswbznjzkmgytbv4pa", + "hash": "bafybeifokbnipvf4epclritybmfjteqpyqhdhtyrol65j75qq5cv47he2m", "description": "Optimus", "image": "https://gateway.autonolas.tech/ipfs/bafybeiaakdeconw7j5z76fgghfdjmsr6tzejotxcwnvmp3nroaw3glgyve", @@ -644,6 +644,8 @@ def main() -> None: if chain_config.ledger_config.rpc is not None: os.environ["CUSTOM_CHAIN_RPC"] = chain_config.ledger_config.rpc os.environ["OPEN_AUTONOMY_SUBGRAPH_URL"] = "https://subgraph.autonolas.tech/subgraphs/name/autonolas-staging" + os.environ["MAX_PRIORITY_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_PRIORITY_FEE_PER_GAS"] + os.environ["MAX_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_FEE_PER_GAS"] service_exists = manager._get_on_chain_state(chain_config) != OnChainState.NON_EXISTENT From 10d1dbff151408961ed4249cb28a265e2371c527 Mon Sep 17 00:00:00 2001 From: Divya-Solulab Date: Fri, 22 Nov 2024 23:13:18 +0530 Subject: [PATCH 4/4] fix: update service hash --- run_service.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/run_service.py b/run_service.py index f54bd50..4a92b26 100644 --- a/run_service.py +++ b/run_service.py @@ -79,8 +79,8 @@ # this means default values will be used "FEE_HISTORY_PERCENTILE": "50", "DEFAULT_PRIORITY_FEE": "2000000", - "MAX_PRIORITY_FEE_PER_GAS": "20000000", - "MAX_FEE_PER_GAS": "3000000", + "MAX_PRIORITY_FEE_PER_GAS": "3000000", + "MAX_FEE_PER_GAS": "20000000", } }, } @@ -396,7 +396,7 @@ def get_service_template(config: OptimusConfig) -> ServiceTemplate: home_chain_id = "34443" return ServiceTemplate({ "name": "Optimus", - "hash": "bafybeifokbnipvf4epclritybmfjteqpyqhdhtyrol65j75qq5cv47he2m", + "hash": "bafybeiazaphqrn65tvscbubjvuh6mzmodqp3inwayjmye2jjweu3uea7wi", "description": "Optimus", "image": "https://gateway.autonolas.tech/ipfs/bafybeiaakdeconw7j5z76fgghfdjmsr6tzejotxcwnvmp3nroaw3glgyve", @@ -644,8 +644,6 @@ def main() -> None: if chain_config.ledger_config.rpc is not None: os.environ["CUSTOM_CHAIN_RPC"] = chain_config.ledger_config.rpc os.environ["OPEN_AUTONOMY_SUBGRAPH_URL"] = "https://subgraph.autonolas.tech/subgraphs/name/autonolas-staging" - os.environ["MAX_PRIORITY_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_PRIORITY_FEE_PER_GAS"] - os.environ["MAX_FEE_PER_GAS"] = chain_metadata["gasParams"]["MAX_FEE_PER_GAS"] service_exists = manager._get_on_chain_state(chain_config) != OnChainState.NON_EXISTENT