From 797e92845c6927f94745360f4b69b140b8dce12c Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 1 Dec 2023 18:37:40 +0100 Subject: [PATCH 1/7] feat: add timeout to `check_redemeed` --- packages/packages.json | 12 ++-- packages/valory/agents/trader/aea-config.yaml | 9 +-- .../contracts/conditional_tokens/contract.py | 63 +++++++++++++------ .../conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 6 +- .../decision_maker_abci/behaviours/reedem.py | 1 + .../skills/decision_maker_abci/models.py | 3 + .../skills/decision_maker_abci/skill.yaml | 7 ++- packages/valory/skills/trader_abci/skill.yaml | 5 +- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 10 files changed, 73 insertions(+), 37 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index b2275c966..7987621a2 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym", - "skill/valory/trader_abci/0.1.0": "bafybeieszk2tzxxi5ulku6v5x3i3zltvzbxhgbm6f3pwxbzsejrdru6cla", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu", + "skill/valory/trader_abci/0.1.0": "bafybeifwtzx4cioprrqunh2i7vvheuzqntdqo3ghg4znxhldjwyl5oduoy", "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeifneutrvfu462ebebzoi7belih7j2jjaxex7f4tsaum4tzl42rus4", - "service/valory/trader/0.1.0": "bafybeif4g4626hotgl7k6vfvdc5zezynkpm3fkuih7xhs7lejuiegbppcu", + "agent/valory/trader/0.1.0": "bafybeidtogranucwerhl5ftntfgwi6julfzvwy3vt3pitrjtzr2itfmkii", + "service/valory/trader/0.1.0": "bafybeih4rri7hje4alzu47hf3ek7ax7ldved4dgxch6ueu5s5htyxche3a", "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei", + "contract/valory/conditional_tokens/0.1.0": "bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4", "contract/valory/agent_registry/0.1.0": "bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi", "contract/valory/service_staking_token/0.1.0": "bafybeig2pnb3f4y65hlhhva52fsrwb6k3dqkqttq43sxd5kb4drgob65oy", "skill/valory/staking_abci/0.1.0": "bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index ddc90195e..e0f4ea111 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -22,7 +22,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei +- valory/conditional_tokens:0.1.0:bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4 - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym -- valory/trader_abci:0.1.0:bafybeieszk2tzxxi5ulku6v5x3i3zltvzbxhgbm6f3pwxbzsejrdru6cla +- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu +- valory/trader_abci:0.1.0:bafybeifwtzx4cioprrqunh2i7vvheuzqntdqo3ghg4znxhldjwyl5oduoy - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe default_ledger: ethereum required_ledgers: @@ -207,6 +207,7 @@ models: agent_balance_threshold: ${int:10000000000000000} refill_check_interval: ${int:10} tool_punishment_multiplier: ${int:1} + check_redeemed_timeout: ${float:300.0} --- public_id: valory/p2p_libp2p_client:0.1.0 type: connection diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 6dc296e75..9c9193574 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -18,8 +18,8 @@ # ------------------------------------------------------------------------------ """This module contains the conditional tokens contract definition.""" - -from typing import List +import concurrent.futures +from typing import List, Any, Dict, Union from requests.exceptions import ReadTimeout as RequestsReadTimeoutError from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError @@ -30,6 +30,8 @@ from hexbytes import HexBytes +FIVE_MINUTES = 300.0 + class ConditionalTokensContract(Contract): """The ConditionalTokens smart contract.""" @@ -47,6 +49,7 @@ def check_redeemed( parent_collection_ids: List[bytes], condition_ids: List[HexBytes], index_sets: List[List[int]], + timeout: float = FIVE_MINUTES, ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" contract_instance = cls.get_instance(ledger_api, contract_address) @@ -55,23 +58,45 @@ def check_redeemed( collateral_tokens_checksummed = [ to_checksum(token) for token in collateral_tokens ] - try: - payout_filter = contract_instance.events.PayoutRedemption.build_filter() - payout_filter.args.redeemer.match_single(redeemer_checksummed) - payout_filter.args.collateralToken.match_any(*collateral_tokens_checksummed) - payout_filter.args.parentCollectionId.match_any(*parent_collection_ids) - payout_filter.args.conditionId.match_any(*condition_ids) - payout_filter.args.indexSets.match_any(*index_sets) - payout_filter.fromBlock = from_block - payout_filter.toBlock = to_block - redeemed = list(payout_filter.deploy(ledger_api.api).get_all_entries()) - except (Urllib3ReadTimeoutError, RequestsReadTimeoutError): - msg = ( - "The RPC timed out! This usually happens if the filtering is too wide. " - f"The service tried to filter from block {from_block} to {to_block}. " - f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" - ) - return dict(error=msg) + + def get_redeem_events() -> Union[List[Dict[str, Any]], str]: + """Get the redeem events.""" + try: + payout_filter = contract_instance.events.PayoutRedemption.build_filter() + payout_filter.args.redeemer.match_single(redeemer_checksummed) + payout_filter.args.collateralToken.match_any(*collateral_tokens_checksummed) + payout_filter.args.parentCollectionId.match_any(*parent_collection_ids) + payout_filter.args.conditionId.match_any(*condition_ids) + payout_filter.args.indexSets.match_any(*index_sets) + payout_filter.fromBlock = from_block + payout_filter.toBlock = to_block + redeemed = list(payout_filter.deploy(ledger_api.api).get_all_entries()) + return redeemed + + except (Urllib3ReadTimeoutError, RequestsReadTimeoutError): + msg = ( + "The RPC timed out! This usually happens if the filtering is too wide. " + f"The service tried to filter from block {from_block} to {to_block}. " + f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" + ) + return msg + + # Create a ProcessPoolExecutor with a maximum of 1 worker (process) + with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor: + # Submit the function to the executor + future = executor.submit(get_redeem_events) + + try: + # Wait for the result with a 5-minute timeout + redeemed = future.result(timeout=timeout) + except TimeoutError: + # Handle the case where the execution times out + msg = f"The RPC didn't respond in {timeout}." + return dict(error=msg) + + # Check if an error occurred + if isinstance(redeemed, str): + return dict(error=redeemed) payouts = {} for redeeming in redeemed: diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 1a09d137b..2cb87b403 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeic34mnydr5m7xncg42tgg5qrjxkltsxxudnvog4jjcs6elg64z5ty + contract.py: bafybeigzd6ld3xll724umgleojptbbcrlzksueefrwhlpaow3vbiagodzq fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 750c78137..202bc6301 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifneutrvfu462ebebzoi7belih7j2jjaxex7f4tsaum4tzl42rus4 +agent: valory/trader:0.1.0:bafybeidtogranucwerhl5ftntfgwi6julfzvwy3vt3pitrjtzr2itfmkii number_of_agents: 4 deployment: {} --- @@ -121,6 +121,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} + check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} benchmark_tool: &id005 args: log_dir: ${LOG_DIR:str:/benchmarks} @@ -202,6 +203,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} + check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} benchmark_tool: *id005 2: models: @@ -281,6 +283,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} + check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} benchmark_tool: *id005 3: models: @@ -360,6 +363,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} + check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} benchmark_tool: *id005 --- public_id: valory/ledger:0.19.0 diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index 8c4af0263..fa1acd963 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -437,6 +437,7 @@ def _check_already_redeemed(self) -> WaitableConditionType: redeemer=safe_address_lower, from_block=from_block, to_block=to_block, + timeout=self.params.check_redeemed_timeout, **kwargs, ) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 4604ac3f0..97a9630ba 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -256,6 +256,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.tool_punishment_multiplier: int = self._ensure( "tool_punishment_multiplier", kwargs, int ) + self.check_redeemed_timeout: float = self._ensure( + "check_redeemed_timeout", kwargs, float + ) super().__init__(*args, **kwargs) @property diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 7bdb8eb78..f149df2d3 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -18,14 +18,14 @@ fingerprint: behaviours/decision_receive.py: bafybeifacce2ke7oltnwnpdjdqfd74eaaw5wxnjfzk6c5tqdsxsmbzjj3m behaviours/decision_request.py: bafybeievr7vae43e7jr4eqqhwe3emvgiih7ysa66jcb5g2oz5lbxua232q behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/reedem.py: bafybeifegxnjid4obmbodlc7ogw2ahoa64bgfneeltxw6mdubglfijylq4 + behaviours/reedem.py: bafybeibndrzx5zcynhf3uh4ajpl2qnyii5zhizbtre23conm4muzsi3s2u behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeidqrxj3l3e555znk4wxx6spwaijz3bhc5yialhzbhd6ngk52w7jbq handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy - models.py: bafybeif3ubulx7cr7bh7yvwhik2footnfi6ofvjoioym3w6eka3owi67pe + models.py: bafybeifjzkye2uounzdbkd5bmics66eshkwadmjhfrcngsrullw2afgxn4 payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm @@ -52,7 +52,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei +- valory/conditional_tokens:0.1.0:bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4 - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi @@ -209,6 +209,7 @@ models: - stabilityai-stable-diffusion-512-v2-1 - stabilityai-stable-diffusion-768-v2-1 tool_punishment_multiplier: 1 + check_redeemed_timeout: 300.0 class_name: DecisionMakerParams mech_response: args: diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index eb3536aeb..472836fd1 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu +- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: @@ -192,6 +192,7 @@ models: refill_check_interval: 10 redeem_round_timeout: 3600.0 tool_punishment_multiplier: 1 + check_redeemed_timeout: 300.0 class_name: TraderParams network_subgraph: args: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index ba51ceb83..2cd852fc2 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym +- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: From 2e80a7cac933dc174e43f389f6e6db6b75bad854 Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 1 Dec 2023 18:52:13 +0100 Subject: [PATCH 2/7] fix: avoid pickle --- packages/packages.json | 12 +++--- packages/valory/agents/trader/aea-config.yaml | 8 ++-- .../contracts/conditional_tokens/contract.py | 37 +++++++++++++++---- .../conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 +- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 45 insertions(+), 24 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 7987621a2..523c11489 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu", - "skill/valory/trader_abci/0.1.0": "bafybeifwtzx4cioprrqunh2i7vvheuzqntdqo3ghg4znxhldjwyl5oduoy", + "skill/valory/decision_maker_abci/0.1.0": "bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum", + "skill/valory/trader_abci/0.1.0": "bafybeigxwjuoqi3xts2xa6qf6qo34csptruxjn2agmv3fvzlkjfj4as54y", "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeidtogranucwerhl5ftntfgwi6julfzvwy3vt3pitrjtzr2itfmkii", - "service/valory/trader/0.1.0": "bafybeih4rri7hje4alzu47hf3ek7ax7ldved4dgxch6ueu5s5htyxche3a", + "agent/valory/trader/0.1.0": "bafybeibu7mijugx4ca5jwjjme4s24tkr7rvdmczad6f2xbqt7yux2xoqt4", + "service/valory/trader/0.1.0": "bafybeiht3ed5lr4kqp77itni7rrlku52pvoxaqzairw3plluqgmdg3ciji", "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4", + "contract/valory/conditional_tokens/0.1.0": "bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa", "contract/valory/agent_registry/0.1.0": "bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi", "contract/valory/service_staking_token/0.1.0": "bafybeig2pnb3f4y65hlhhva52fsrwb6k3dqkqttq43sxd5kb4drgob65oy", "skill/valory/staking_abci/0.1.0": "bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index e0f4ea111..84ae3b77a 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -22,7 +22,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4 +- valory/conditional_tokens:0.1.0:bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu -- valory/trader_abci:0.1.0:bafybeifwtzx4cioprrqunh2i7vvheuzqntdqo3ghg4znxhldjwyl5oduoy +- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum +- valory/trader_abci:0.1.0:bafybeigxwjuoqi3xts2xa6qf6qo34csptruxjn2agmv3fvzlkjfj4as54y - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe default_ledger: ethereum required_ledgers: diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 9c9193574..6d276523c 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -52,15 +52,25 @@ def check_redeemed( timeout: float = FIVE_MINUTES, ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" - contract_instance = cls.get_instance(ledger_api, contract_address) - to_checksum = ledger_api.api.to_checksum_address - redeemer_checksummed = to_checksum(redeemer) - collateral_tokens_checksummed = [ - to_checksum(token) for token in collateral_tokens - ] - def get_redeem_events() -> Union[List[Dict[str, Any]], str]: + def get_redeem_events( + ledger_api: LedgerApi, + contract_address: str, + redeemer: str, + from_block: int, + to_block: int, + collateral_tokens: List[str], + parent_collection_ids: List[bytes], + condition_ids: List[HexBytes], + index_sets: List[List[int]], + ) -> Union[List[Dict[str, Any]], str]: """Get the redeem events.""" + contract_instance = cls.get_instance(ledger_api, contract_address) + to_checksum = ledger_api.api.to_checksum_address + redeemer_checksummed = to_checksum(redeemer) + collateral_tokens_checksummed = [ + to_checksum(token) for token in collateral_tokens + ] try: payout_filter = contract_instance.events.PayoutRedemption.build_filter() payout_filter.args.redeemer.match_single(redeemer_checksummed) @@ -84,7 +94,18 @@ def get_redeem_events() -> Union[List[Dict[str, Any]], str]: # Create a ProcessPoolExecutor with a maximum of 1 worker (process) with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor: # Submit the function to the executor - future = executor.submit(get_redeem_events) + future = executor.submit( + get_redeem_events, + ledger_api, + contract_address, + redeemer, + from_block, + to_block, + collateral_tokens, + parent_collection_ids, + condition_ids, + index_sets, + ) try: # Wait for the result with a 5-minute timeout diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 2cb87b403..1712db652 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeigzd6ld3xll724umgleojptbbcrlzksueefrwhlpaow3vbiagodzq + contract.py: bafybeigm4dcxvxpzwhm6pza45q2l53ss5nvtwxint26w6s6gogurm3l2dy fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 202bc6301..8bd6f658b 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidtogranucwerhl5ftntfgwi6julfzvwy3vt3pitrjtzr2itfmkii +agent: valory/trader:0.1.0:bafybeibu7mijugx4ca5jwjjme4s24tkr7rvdmczad6f2xbqt7yux2xoqt4 number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index f149df2d3..b02b91f69 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -52,7 +52,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigjzzanv7pvhhkpbsf7neoq3ti5ilvitkafmsabmbtxcxffukqey4 +- valory/conditional_tokens:0.1.0:bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 472836fd1..96e28be59 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibpvgcxi5clvprcxxbaaey26pwamkmt7j3l2blb46bm2ra22nr2eq +- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 2cd852fc2..81359104a 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeiaxqgb7ovgnz4c7aau2iyuoyqfnzmey7w5gfxukaqr7hsjd36v7tu +- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: From 3047b5454e037938fa6947370f0182703518395d Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 1 Dec 2023 19:16:02 +0100 Subject: [PATCH 3/7] fix: use a threadpool executor --- packages/packages.json | 12 ++++----- packages/valory/agents/trader/aea-config.yaml | 8 +++--- .../contracts/conditional_tokens/contract.py | 25 +++---------------- .../conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 +-- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 19 insertions(+), 38 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 523c11489..bab6a146c 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum", - "skill/valory/trader_abci/0.1.0": "bafybeigxwjuoqi3xts2xa6qf6qo34csptruxjn2agmv3fvzlkjfj4as54y", + "skill/valory/decision_maker_abci/0.1.0": "bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom", + "skill/valory/trader_abci/0.1.0": "bafybeiffwyrejr3r5gdfp4eofs6gulfkwrewfgilbpgdsk7grngm2x4rai", "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeibu7mijugx4ca5jwjjme4s24tkr7rvdmczad6f2xbqt7yux2xoqt4", - "service/valory/trader/0.1.0": "bafybeiht3ed5lr4kqp77itni7rrlku52pvoxaqzairw3plluqgmdg3ciji", + "agent/valory/trader/0.1.0": "bafybeiasx2xbzsxy7mteedz4am4dujw6gpvpvmhgjc6pguf6cjiuumgsou", + "service/valory/trader/0.1.0": "bafybeiaj33tuja2kwpdhpdb27pzat6ovnqspd5g5qadsrdp5vz3sujltya", "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa", + "contract/valory/conditional_tokens/0.1.0": "bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e", "contract/valory/agent_registry/0.1.0": "bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi", "contract/valory/service_staking_token/0.1.0": "bafybeig2pnb3f4y65hlhhva52fsrwb6k3dqkqttq43sxd5kb4drgob65oy", "skill/valory/staking_abci/0.1.0": "bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 84ae3b77a..124c6545f 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -22,7 +22,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa +- valory/conditional_tokens:0.1.0:bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum -- valory/trader_abci:0.1.0:bafybeigxwjuoqi3xts2xa6qf6qo34csptruxjn2agmv3fvzlkjfj4as54y +- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom +- valory/trader_abci:0.1.0:bafybeiffwyrejr3r5gdfp4eofs6gulfkwrewfgilbpgdsk7grngm2x4rai - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe default_ledger: ethereum required_ledgers: diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 6d276523c..4d482eb7e 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -53,17 +53,7 @@ def check_redeemed( ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" - def get_redeem_events( - ledger_api: LedgerApi, - contract_address: str, - redeemer: str, - from_block: int, - to_block: int, - collateral_tokens: List[str], - parent_collection_ids: List[bytes], - condition_ids: List[HexBytes], - index_sets: List[List[int]], - ) -> Union[List[Dict[str, Any]], str]: + def get_redeem_events() -> Union[List[Dict[str, Any]], str]: """Get the redeem events.""" contract_instance = cls.get_instance(ledger_api, contract_address) to_checksum = ledger_api.api.to_checksum_address @@ -92,19 +82,10 @@ def get_redeem_events( return msg # Create a ProcessPoolExecutor with a maximum of 1 worker (process) - with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor: + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: # Submit the function to the executor future = executor.submit( get_redeem_events, - ledger_api, - contract_address, - redeemer, - from_block, - to_block, - collateral_tokens, - parent_collection_ids, - condition_ids, - index_sets, ) try: @@ -124,7 +105,7 @@ def get_redeem_events( args = redeeming.get("args", {}) condition_id = args.get("conditionId", None) payout = args.get("payout", 0) - if condition_id is not None and payout > 0: + if condition_id isg not None and payout > 0: if isinstance(condition_id, bytes): condition_id = condition_id.hex() payouts[condition_id] = payout diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 1712db652..5db9b2f3f 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeigm4dcxvxpzwhm6pza45q2l53ss5nvtwxint26w6s6gogurm3l2dy + contract.py: bafybeibnpcl5glhlvliylq4htztogz4wlczwpwbvhfljimkmldhznztt4u fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 8bd6f658b..b8e7ca95a 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeibu7mijugx4ca5jwjjme4s24tkr7rvdmczad6f2xbqt7yux2xoqt4 +agent: valory/trader:0.1.0:bafybeiasx2xbzsxy7mteedz4am4dujw6gpvpvmhgjc6pguf6cjiuumgsou number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index b02b91f69..1a82c1570 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -52,7 +52,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigma7b6umu75pc6gzj23hqjrsyjdb4on4rkj2manoef2mmbkjogxa +- valory/conditional_tokens:0.1.0:bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 96e28be59..0606a3b7d 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifnjghnly3ztbhzb22lhrctybiv2lhqdpbsgvtfdqlcnvgi4b7gme +- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 81359104a..563bff353 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeigfc73xma2k767cyb7rf7nxwlng2se24huf3u7ivsypcjc73a5kum +- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: From 8c0cdce6d7015b89eaa350b7b0187a6c54fef4aa Mon Sep 17 00:00:00 2001 From: Ardian Date: Fri, 1 Dec 2023 19:25:11 +0100 Subject: [PATCH 4/7] chore: typo --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- .../valory/contracts/conditional_tokens/contract.py | 2 +- .../contracts/conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index bab6a146c..a6001e7d8 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom", - "skill/valory/trader_abci/0.1.0": "bafybeiffwyrejr3r5gdfp4eofs6gulfkwrewfgilbpgdsk7grngm2x4rai", + "skill/valory/decision_maker_abci/0.1.0": "bafybeia7rebxcqvguozpfoaabvjwkarvkzbbus3tkj7qajfmx544xbzhxe", + "skill/valory/trader_abci/0.1.0": "bafybeifwkuvptiwqaocw4mmrhbajqcvngdlf5wyw7iohzmvglq564o5q4e", "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeiasx2xbzsxy7mteedz4am4dujw6gpvpvmhgjc6pguf6cjiuumgsou", - "service/valory/trader/0.1.0": "bafybeiaj33tuja2kwpdhpdb27pzat6ovnqspd5g5qadsrdp5vz3sujltya", + "agent/valory/trader/0.1.0": "bafybeifmug3qrcyw72yl3zlpeozts4cy63y6l7vvjqreyl6klhirhjl36q", + "service/valory/trader/0.1.0": "bafybeib3otz7ylfeazflg5cdqrvgamlnir32qttog6e4dtfhx7stf7iw4a", "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigzqa43ohdu66ojly36rp3z2lidgmezzuetp2mt6finmd6i7jvjxi", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e", + "contract/valory/conditional_tokens/0.1.0": "bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce", "contract/valory/agent_registry/0.1.0": "bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi", "contract/valory/service_staking_token/0.1.0": "bafybeig2pnb3f4y65hlhhva52fsrwb6k3dqkqttq43sxd5kb4drgob65oy", "skill/valory/staking_abci/0.1.0": "bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 124c6545f..8f4dec634 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -22,7 +22,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e +- valory/conditional_tokens:0.1.0:bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigzqa43ohdu66ojly36rp3z2lidgmezzuetp2mt6finmd6i7jvjxi - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom -- valory/trader_abci:0.1.0:bafybeiffwyrejr3r5gdfp4eofs6gulfkwrewfgilbpgdsk7grngm2x4rai +- valory/decision_maker_abci:0.1.0:bafybeia7rebxcqvguozpfoaabvjwkarvkzbbus3tkj7qajfmx544xbzhxe +- valory/trader_abci:0.1.0:bafybeifwkuvptiwqaocw4mmrhbajqcvngdlf5wyw7iohzmvglq564o5q4e - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe default_ledger: ethereum required_ledgers: diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 4d482eb7e..61986092e 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -105,7 +105,7 @@ def get_redeem_events() -> Union[List[Dict[str, Any]], str]: args = redeeming.get("args", {}) condition_id = args.get("conditionId", None) payout = args.get("payout", 0) - if condition_id isg not None and payout > 0: + if condition_id is not None and payout > 0: if isinstance(condition_id, bytes): condition_id = condition_id.hex() payouts[condition_id] = payout diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 5db9b2f3f..088d9f06f 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeibnpcl5glhlvliylq4htztogz4wlczwpwbvhfljimkmldhznztt4u + contract.py: bafybeiffdi76pfzxdqillrqmbtkvy64csmbjt2bs5e6pajnq6i7xeaueva fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index b8e7ca95a..df03d8c34 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiasx2xbzsxy7mteedz4am4dujw6gpvpvmhgjc6pguf6cjiuumgsou +agent: valory/trader:0.1.0:bafybeifmug3qrcyw72yl3zlpeozts4cy63y6l7vvjqreyl6klhirhjl36q number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 1a82c1570..29c9f0955 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -52,7 +52,7 @@ contracts: - valory/erc20:0.1.0:bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeicphtdu4oab6v5ocpn44sbvwmu4o6riftlxtg6axrwjdwmx4y375e +- valory/conditional_tokens:0.1.0:bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce - valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 0606a3b7d..90da4679c 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq - valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 - valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif3dfduvr2ney6q77wdmlqrbrtahhfbi2dw3uad5bf5rtixoeftri +- valory/decision_maker_abci:0.1.0:bafybeia7rebxcqvguozpfoaabvjwkarvkzbbus3tkj7qajfmx544xbzhxe +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigzqa43ohdu66ojly36rp3z2lidgmezzuetp2mt6finmd6i7jvjxi - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 563bff353..733089137 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeie2gmfc2rnptmgojiv2nqwfyzmkzgb63na4et5slx3emdx5bhsnom +- valory/decision_maker_abci:0.1.0:bafybeia7rebxcqvguozpfoaabvjwkarvkzbbus3tkj7qajfmx544xbzhxe - valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe behaviours: main: From bfd49c64bc3efbd53b5e19f6152651804e247fd7 Mon Sep 17 00:00:00 2001 From: Ardian Date: Mon, 4 Dec 2023 12:57:29 +0100 Subject: [PATCH 5/7] chore: generators --- packages/packages.json | 24 +++++++++---------- packages/valory/agents/trader/aea-config.yaml | 6 ++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 18 +++++++------- .../tx_settlement_multiplexer_abci/skill.yaml | 6 ++--- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 1d5eac9bb..8649829ff 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,20 +1,20 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym", - "skill/valory/trader_abci/0.1.0": "bafybeieszk2tzxxi5ulku6v5x3i3zltvzbxhgbm6f3pwxbzsejrdru6cla", - "contract/valory/market_maker/0.1.0": "bafybeid5jnetbsusgxkpqzwyiqlwut55xktfbeloipxcemcuu5oopmqtl4", - "agent/valory/trader/0.1.0": "bafybeifneutrvfu462ebebzoi7belih7j2jjaxex7f4tsaum4tzl42rus4", - "service/valory/trader/0.1.0": "bafybeif4g4626hotgl7k6vfvdc5zezynkpm3fkuih7xhs7lejuiegbppcu", - "contract/valory/erc20/0.1.0": "bafybeiepg5ymxhtylgijs3mf3lezz6cwcsougbrv2gr4xcq3bp5wxusi64", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu", + "skill/valory/market_manager_abci/0.1.0": "bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq", + "skill/valory/decision_maker_abci/0.1.0": "bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a", + "skill/valory/trader_abci/0.1.0": "bafybeiaicobvt6zkvo7gmpahn3buahauo3fqoks5epznrxe2rfov7tt65i", + "contract/valory/market_maker/0.1.0": "bafybeiehszwvmurz5b5vpqbxbvcm5ty4z553jqpsnernqwdq6d62r3z5wa", + "agent/valory/trader/0.1.0": "bafybeidubzpluxo2h6ssq7pbcueqktljf3ytondohjmh2gegd2e4wyv5xa", + "service/valory/trader/0.1.0": "bafybeihdmgrvyphoqtfxorop2fgfre67gkd43gbyedzapjijkgvvkm66rq", + "contract/valory/erc20/0.1.0": "bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai", "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei", - "contract/valory/agent_registry/0.1.0": "bafybeibezt4xtzgf25eidmwev6moki74eufmb4hx7cpvd6odbyoxo42hxi", - "contract/valory/service_staking_token/0.1.0": "bafybeig2pnb3f4y65hlhhva52fsrwb6k3dqkqttq43sxd5kb4drgob65oy", - "skill/valory/staking_abci/0.1.0": "bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe" + "contract/valory/conditional_tokens/0.1.0": "bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce", + "contract/valory/agent_registry/0.1.0": "bafybeicznp6b7t7n6gju35xa2mr2vo3vshtj72l5odwhtdvz3uard27csq", + "contract/valory/service_staking_token/0.1.0": "bafybeifrbsyszkg6hhqnx32ha2wwyidi2nzaece74niopsnzmb4szbpahi", + "skill/valory/staking_abci/0.1.0": "bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 0275b77c0..f371b045e 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeidzajbe3erygeh2xbd6lrjv7nsptznjuzrt24ykgvhgotdeyhfnba - valory/termination_abci:0.1.0:bafybeie4zvjfxvdu7qrulmur3chpjz3kpj5m4bjsxvpk4gvj5zbyyayfaa - valory/transaction_settlement_abci:0.1.0:bafybeiaefgqbs7zsn5xe5kdwrujj7ivygkn3ujpw6crnvi3knvxw75qmja -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihkjceuiw6cwaul5a5ngydma7gik46cgp2cinhibhsysv7qvc3mba +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai - valory/market_manager_abci:0.1.0:bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq -- valory/decision_maker_abci:0.1.0:bafybeic474g73pukavqdpqu5pocsyhfa4eididi6v36jbzo53c3lo4tmfy -- valory/trader_abci:0.1.0:bafybeieu5ufh3hvksdhzzur7hwfzz3dohqlehvuavbet3xpbw4dmzbf2q4 +- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a +- valory/trader_abci:0.1.0:bafybeiaicobvt6zkvo7gmpahn3buahauo3fqoks5epznrxe2rfov7tt65i - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 3dbe3647f..4190a5555 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifn45eermdfe66i3tx3aevvtngsr3punhu55kvrpmlk5ut3cgzif4 +agent: valory/trader:0.1.0:bafybeidubzpluxo2h6ssq7pbcueqktljf3ytondohjmh2gegd2e4wyv5xa number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 61c23715c..427831cfa 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -19,15 +19,15 @@ connections: [] contracts: [] protocols: [] skills: -- valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/registration_abci:0.1.0:bafybeif4tgr7zqzguknrjzxr4h766fxp7vr4tod25xii4jzzwsbvyzdzkq -- valory/reset_pause_abci:0.1.0:bafybeiencz2uytz6fqj5wg7mcunevxjh4xg5gd6pqcgkshgqywhcimweyi -- valory/transaction_settlement_abci:0.1.0:bafybeigk3debp6dswutqsuls2lqfvyj4ghe6kwjc2zfinnsvj6hujynxtq -- valory/termination_abci:0.1.0:bafybeigainmpy37gb33ogbrpggjbkuasodhthh5oz4vbzjdfjozerpf224 -- valory/market_manager_abci:0.1.0:bafybeic7o4pclkhnugyn7js5g3asxuqhkxpvunlp3mpup7aovhg2fto22i -- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicgaji7zj2zqjq4ppvurd3ecdfdjtyhrxzn3meyncji74ndivubdu -- valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe +- valory/abstract_round_abci:0.1.0:bafybeiaqcl7h2famylusiffigwem7tevkcsyocdu5xd42jkmgq6kvowzgq +- valory/registration_abci:0.1.0:bafybeic2ynseiak7jpta7jfwuqwyp453b4p7lolr4wihxmpn633uekv5am +- valory/reset_pause_abci:0.1.0:bafybeidzajbe3erygeh2xbd6lrjv7nsptznjuzrt24ykgvhgotdeyhfnba +- valory/transaction_settlement_abci:0.1.0:bafybeiaefgqbs7zsn5xe5kdwrujj7ivygkn3ujpw6crnvi3knvxw75qmja +- valory/termination_abci:0.1.0:bafybeie4zvjfxvdu7qrulmur3chpjz3kpj5m4bjsxvpk4gvj5zbyyayfaa +- valory/market_manager_abci:0.1.0:bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq +- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai +- valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca behaviours: main: args: {} diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index ba51ceb83..3d76dac86 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,9 +20,9 @@ contracts: [] protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: -- valory/abstract_round_abci:0.1.0:bafybeidau7loztcfy3mxvoqrv7otbpciemd2wf3lsxyjraq4dcvuvib25e -- valory/decision_maker_abci:0.1.0:bafybeicbv5yf6rfabezmxjpwm7tjufop2yrquby6tq6kimo2tppvknhlym -- valory/staking_abci:0.1.0:bafybeia3acxumkjg566dvgagv3swz7htf5xpvwq6ovmecvp5j2zdxdoabe +- valory/abstract_round_abci:0.1.0:bafybeiaqcl7h2famylusiffigwem7tevkcsyocdu5xd42jkmgq6kvowzgq +- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a +- valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca behaviours: main: args: {} From 9c298bed4a2d79e5f9e61d2639dac82219535783 Mon Sep 17 00:00:00 2001 From: Ardian Date: Mon, 4 Dec 2023 14:45:10 +0100 Subject: [PATCH 6/7] feat: add timeouts to all filter ops --- packages/packages.json | 16 ++-- packages/valory/agents/trader/aea-config.yaml | 14 +-- .../contracts/conditional_tokens/contract.py | 49 ++++++---- .../conditional_tokens/contract.yaml | 2 +- packages/valory/contracts/mech/contract.py | 94 +++++++++++++------ packages/valory/contracts/mech/contract.yaml | 2 +- .../valory/contracts/realitio/contract.py | 66 ++++++++++--- .../valory/contracts/realitio/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 10 +- .../behaviours/decision_receive.py | 1 + .../decision_maker_abci/behaviours/reedem.py | 3 +- .../skills/decision_maker_abci/models.py | 4 +- .../skills/decision_maker_abci/skill.yaml | 14 +-- packages/valory/skills/trader_abci/skill.yaml | 6 +- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 15 files changed, 183 insertions(+), 102 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 8649829ff..c85e42778 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a", - "skill/valory/trader_abci/0.1.0": "bafybeiaicobvt6zkvo7gmpahn3buahauo3fqoks5epznrxe2rfov7tt65i", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam", + "skill/valory/trader_abci/0.1.0": "bafybeibuaonngf33m63co5ezcerovfvjdfdit4gz3l44a3c5dl52nskfxq", "contract/valory/market_maker/0.1.0": "bafybeiehszwvmurz5b5vpqbxbvcm5ty4z553jqpsnernqwdq6d62r3z5wa", - "agent/valory/trader/0.1.0": "bafybeidubzpluxo2h6ssq7pbcueqktljf3ytondohjmh2gegd2e4wyv5xa", - "service/valory/trader/0.1.0": "bafybeihdmgrvyphoqtfxorop2fgfre67gkd43gbyedzapjijkgvvkm66rq", + "agent/valory/trader/0.1.0": "bafybeic3a2dxfw4xvg7ptunpnjxnji73qdvl7l2fa3pgto4k4a2k7hr4by", + "service/valory/trader/0.1.0": "bafybeidmpidrckgu2ue4lhis4ufjytmstu3cmvfswgwxozuubu6uljqw3i", "contract/valory/erc20/0.1.0": "bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai", - "contract/valory/mech/0.1.0": "bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju", - "contract/valory/realitio/0.1.0": "bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihvwp3rlxaepfggkzi6ptcojbpayaul2hrruawz4pcjpuqfutcjqi", + "contract/valory/mech/0.1.0": "bafybeigvha4ya64ccjl7tbroa3zjqlxm64wxsqx5k2cz2xs3a7igu5qgxa", + "contract/valory/realitio/0.1.0": "bafybeicllaewp72lf5mlohsgu2h2gqemaltn7lkbzotwlq3wyg3wk2nunm", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce", + "contract/valory/conditional_tokens/0.1.0": "bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu", "contract/valory/agent_registry/0.1.0": "bafybeicznp6b7t7n6gju35xa2mr2vo3vshtj72l5odwhtdvz3uard27csq", "contract/valory/service_staking_token/0.1.0": "bafybeifrbsyszkg6hhqnx32ha2wwyidi2nzaece74niopsnzmb4szbpahi", "skill/valory/staking_abci/0.1.0": "bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index f371b045e..38b357375 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -21,9 +21,9 @@ contracts: - valory/market_maker:0.1.0:bafybeiehszwvmurz5b5vpqbxbvcm5ty4z553jqpsnernqwdq6d62r3z5wa - valory/erc20:0.1.0:bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce -- valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa +- valory/mech:0.1.0:bafybeigvha4ya64ccjl7tbroa3zjqlxm64wxsqx5k2cz2xs3a7igu5qgxa +- valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu +- valory/realitio:0.1.0:bafybeicllaewp72lf5mlohsgu2h2gqemaltn7lkbzotwlq3wyg3wk2nunm - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeicznp6b7t7n6gju35xa2mr2vo3vshtj72l5odwhtdvz3uard27csq - valory/service_staking_token:0.1.0:bafybeifrbsyszkg6hhqnx32ha2wwyidi2nzaece74niopsnzmb4szbpahi @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeidzajbe3erygeh2xbd6lrjv7nsptznjuzrt24ykgvhgotdeyhfnba - valory/termination_abci:0.1.0:bafybeie4zvjfxvdu7qrulmur3chpjz3kpj5m4bjsxvpk4gvj5zbyyayfaa - valory/transaction_settlement_abci:0.1.0:bafybeiaefgqbs7zsn5xe5kdwrujj7ivygkn3ujpw6crnvi3knvxw75qmja -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihvwp3rlxaepfggkzi6ptcojbpayaul2hrruawz4pcjpuqfutcjqi - valory/market_manager_abci:0.1.0:bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq -- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a -- valory/trader_abci:0.1.0:bafybeiaicobvt6zkvo7gmpahn3buahauo3fqoks5epznrxe2rfov7tt65i +- valory/decision_maker_abci:0.1.0:bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam +- valory/trader_abci:0.1.0:bafybeibuaonngf33m63co5ezcerovfvjdfdit4gz3l44a3c5dl52nskfxq - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca default_ledger: ethereum required_ledgers: @@ -207,7 +207,7 @@ models: agent_balance_threshold: ${int:10000000000000000} refill_check_interval: ${int:10} tool_punishment_multiplier: ${int:1} - check_redeemed_timeout: ${float:300.0} + contract_timeout: ${float:300.0} --- public_id: valory/p2p_libp2p_client:0.1.0 type: connection diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 61986092e..8038a1b5a 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -19,7 +19,7 @@ """This module contains the conditional tokens contract definition.""" import concurrent.futures -from typing import List, Any, Dict, Union +from typing import List, Any, Dict, Union, Callable from requests.exceptions import ReadTimeout as RequestsReadTimeoutError from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError @@ -37,6 +37,32 @@ class ConditionalTokensContract(Contract): contract_id = PublicId.from_str("valory/conditional_tokens:0.1.0") + @staticmethod + def execute_with_timeout(func: Callable, timeout: float) -> Any: + """Execute a function with a timeout.""" + + # Create a ProcessPoolExecutor with a maximum of 1 worker (process) + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: + # Submit the function to the executor + future = executor.submit( + func, + ) + + try: + # Wait for the result with a 5-minute timeout + data = future.result(timeout=timeout) + except TimeoutError: + # Handle the case where the execution times out + err = f"The RPC didn't respond in {timeout}." + return None, err + + # Check if an error occurred + if isinstance(data, str): + # Handle the case where the execution failed + return None, data + + return data, None + @classmethod def check_redeemed( cls, @@ -81,24 +107,9 @@ def get_redeem_events() -> Union[List[Dict[str, Any]], str]: ) return msg - # Create a ProcessPoolExecutor with a maximum of 1 worker (process) - with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: - # Submit the function to the executor - future = executor.submit( - get_redeem_events, - ) - - try: - # Wait for the result with a 5-minute timeout - redeemed = future.result(timeout=timeout) - except TimeoutError: - # Handle the case where the execution times out - msg = f"The RPC didn't respond in {timeout}." - return dict(error=msg) - - # Check if an error occurred - if isinstance(redeemed, str): - return dict(error=redeemed) + redeemed, err = cls.execute_with_timeout(get_redeem_events, timeout) + if err is not None: + return dict(error=err) payouts = {} for redeeming in redeemed: diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 088d9f06f..960bd653e 100644 --- a/packages/valory/contracts/conditional_tokens/contract.yaml +++ b/packages/valory/contracts/conditional_tokens/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeidhdxio3oq5gqdnxmngumvt3fcd6zyiyrpk5f2k4dwhflbg4e5iky build/ConditionalTokens.json: bafybeia2ahis7zx2yhhf23kpkcxu56hto6fwg6ptjg5ld46lp4dgz7cz3e - contract.py: bafybeiffdi76pfzxdqillrqmbtkvy64csmbjt2bs5e6pajnq6i7xeaueva + contract.py: bafybeiesym65thjsazplbgjhqleci6sdriytubqljpc3smtjitrpthhaam fingerprint_ignore_patterns: [] class_name: ConditionalTokensContract contract_interface_paths: diff --git a/packages/valory/contracts/mech/contract.py b/packages/valory/contracts/mech/contract.py index 85966e0d5..387448ac7 100644 --- a/packages/valory/contracts/mech/contract.py +++ b/packages/valory/contracts/mech/contract.py @@ -18,8 +18,8 @@ # ------------------------------------------------------------------------------ """This module contains the class to connect to a Mech contract.""" - -from typing import Dict, Optional, cast, List, Any +import concurrent.futures +from typing import Dict, Optional, cast, List, Any, Callable from aea.common import JSONLike from aea.configurations.base import PublicId @@ -30,6 +30,7 @@ from web3.types import TxReceipt, EventData, BlockIdentifier, BlockData PUBLIC_ID = PublicId.from_str("valory/mech:0.1.0") +FIVE_MINUTES = 300.0 class Mech(Contract): @@ -37,6 +38,32 @@ class Mech(Contract): contract_id = PUBLIC_ID + @staticmethod + def execute_with_timeout(func: Callable, timeout: float) -> Any: + """Execute a function with a timeout.""" + + # Create a ProcessPoolExecutor with a maximum of 1 worker (process) + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: + # Submit the function to the executor + future = executor.submit( + func, + ) + + try: + # Wait for the result with a 5-minute timeout + data = future.result(timeout=timeout) + except TimeoutError: + # Handle the case where the execution times out + err = f"The RPC didn't respond in {timeout}." + return None, err + + # Check if an error occurred + if isinstance(data, str): + # Handle the case where the execution failed + return None, data + + return data, None + @classmethod def get_price( cls, @@ -154,36 +181,43 @@ def get_response( request_id: int, from_block: BlockIdentifier = "earliest", to_block: BlockIdentifier = "latest", + timeout: float = FIVE_MINUTES, ) -> JSONLike: """Filter the `Deliver` events emitted by the contract and get the data of the given `request_id`.""" - ledger_api = cast(EthereumApi, ledger_api) - contract_instance = cls.get_instance(ledger_api, contract_address) - - deliver_filter = contract_instance.events.Deliver.build_filter() - deliver_filter.fromBlock = from_block - deliver_filter.toBlock = to_block - deliver_filter.args.requestId.match_single(request_id) - delivered = list(deliver_filter.deploy(ledger_api.api).get_all_entries()) - n_delivered = len(delivered) - - if n_delivered == 0: - info = f"The mech ({contract_address}) has not delivered a response yet for request with id {request_id}." - return {"info": info} - - if n_delivered != 1: - error = ( - f"A single response was expected by the mech ({contract_address}) for request with id {request_id}. " - f"Received {n_delivered} responses: {delivered}." - ) - return {"error": error} - - delivered_event = delivered.pop() - deliver_args = delivered_event.get("args", None) - if deliver_args is None or "data" not in deliver_args: - error = f"The mech's response does not match the expected format: {delivered_event}" - return {"error": error} - - return dict(data=deliver_args["data"]) + def get_responses() -> Any: + """Get the responses from the contract.""" + contract_instance = cls.get_instance(ledger_api, contract_address) + deliver_filter = contract_instance.events.Deliver.build_filter() + deliver_filter.fromBlock = from_block + deliver_filter.toBlock = to_block + deliver_filter.args.requestId.match_single(request_id) + delivered = list(deliver_filter.deploy(ledger_api.api).get_all_entries()) + n_delivered = len(delivered) + + if n_delivered == 0: + info = f"The mech ({contract_address}) has not delivered a response yet for request with id {request_id}." + return {"info": info} + + if n_delivered != 1: + error = ( + f"A single response was expected by the mech ({contract_address}) for request with id {request_id}. " + f"Received {n_delivered} responses: {delivered}." + ) + return error + + delivered_event = delivered.pop() + deliver_args = delivered_event.get("args", None) + if deliver_args is None or "data" not in deliver_args: + error = f"The mech's response does not match the expected format: {delivered_event}" + return error + + return {"data": deliver_args["data"]} + + data, err = cls.execute_with_timeout(get_responses, timeout=timeout) + if err is not None: + return {"error": err} + + return data @classmethod def get_mech_id( diff --git a/packages/valory/contracts/mech/contract.yaml b/packages/valory/contracts/mech/contract.yaml index 63c3768b5..a209103c3 100644 --- a/packages/valory/contracts/mech/contract.yaml +++ b/packages/valory/contracts/mech/contract.yaml @@ -9,7 +9,7 @@ fingerprint: README.md: bafybeibl4uw7rs6mwh7zuvdnqmj2o2xyr7nx5qk3w7torwx3jg6farn6ca __init__.py: bafybeicx5pxh3cxnml2biuuoebvafvu5tvy6mgkzyjzuubuoeebb5yzjsm build/mech.json: bafybeia3zf47nhljgahe4ijvw6mfcswhn6r5ntw572y63hbse7bvgsydaq - contract.py: bafybeifbfa6p3jcwn6j7s5aiiqxb3ne4vbmvoggr5zpptmd727gpsjqjpe + contract.py: bafybeifnpv6d7vwxayii4rsoauc6ymzujbxc5b4sqj56e544tapcjr32ji fingerprint_ignore_patterns: [] contracts: [] class_name: Mech diff --git a/packages/valory/contracts/realitio/contract.py b/packages/valory/contracts/realitio/contract.py index 64ba949f2..130bb5113 100644 --- a/packages/valory/contracts/realitio/contract.py +++ b/packages/valory/contracts/realitio/contract.py @@ -18,8 +18,8 @@ # ------------------------------------------------------------------------------ """This module contains the Realitio_v2_1 contract definition.""" - -from typing import List, Tuple, Union, Dict +import concurrent.futures +from typing import List, Tuple, Union, Dict, Callable, Any from aea.common import JSONLike from aea.configurations.base import PublicId @@ -33,12 +33,40 @@ List[bytes], List[ChecksumAddress], List[int], List[bytes] ] +FIVE_MINUTES = 300.0 + class RealitioContract(Contract): """The Realitio_v2_1 smart contract.""" contract_id = PublicId.from_str("valory/realitio:0.1.0") + @staticmethod + def execute_with_timeout(func: Callable, timeout: float) -> Any: + """Execute a function with a timeout.""" + + # Create a ProcessPoolExecutor with a maximum of 1 worker (process) + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: + # Submit the function to the executor + future = executor.submit( + func, + ) + + try: + # Wait for the result with a 5-minute timeout + data = future.result(timeout=timeout) + except TimeoutError: + # Handle the case where the execution times out + err = f"The RPC didn't respond in {timeout}." + return None, err + + # Check if an error occurred + if isinstance(data, str): + # Handle the case where the execution failed + return None, data + + return data, None + @classmethod def check_finalized( cls, @@ -59,23 +87,31 @@ def get_claim_params( from_block: int, to_block: int, question_id: bytes, + timeout: float = FIVE_MINUTES, ) -> Dict[str, Union[str, list]]: """Filters the `LogNewAnswer` event by question id to calculate the history hashes.""" contract_instance = cls.get_instance(ledger_api, contract_address) - try: - answer_filter = contract_instance.events.LogNewAnswer.build_filter() - answer_filter.fromBlock = from_block - answer_filter.toBlock = to_block - answer_filter.args.question_id.match_single(question_id) - answered = list(answer_filter.deploy(ledger_api.api).get_all_entries()) - except (Urllib3ReadTimeoutError, RequestsReadTimeoutError): - msg = ( - "The RPC timed out! This usually happens if the filtering is too wide. " - f"The service tried to filter from block {from_block} to {to_block}. " - f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" - ) - return dict(error=msg) + def get_claim_params() -> Any: + """Get claim params.""" + try: + answer_filter = contract_instance.events.LogNewAnswer.build_filter() + answer_filter.fromBlock = from_block + answer_filter.toBlock = to_block + answer_filter.args.question_id.match_single(question_id) + answered = list(answer_filter.deploy(ledger_api.api).get_all_entries()) + return answered + except (Urllib3ReadTimeoutError, RequestsReadTimeoutError): + msg = ( + "The RPC timed out! This usually happens if the filtering is too wide. " + f"The service tried to filter from block {from_block} to {to_block}. " + f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" + ) + return msg + + answered, err = cls.execute_with_timeout(get_claim_params, timeout=timeout) + if err is not None: + return dict(error=err) msg = ( f"Found {len(answered)} answer(s) for question with id {question_id.hex()} " diff --git a/packages/valory/contracts/realitio/contract.yaml b/packages/valory/contracts/realitio/contract.yaml index 27bebe76d..b79855d8f 100644 --- a/packages/valory/contracts/realitio/contract.yaml +++ b/packages/valory/contracts/realitio/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeictahkgfmlqv5kksvj6klmxtmjdpeq4sp3x7dp2yr5x4kmzbcihse build/Realitio.json: bafybeiagi7zoeoy5s7duhg4oeuekj2s6z5mad2z6g2pn3n5elsvze25qiu - contract.py: bafybeicre6tumch2ng7rpgx2qle3cqg65rra6s2otl5agdp7jzweiffxby + contract.py: bafybeibyaryco5w3ns4hexwxnpmrqvvtrxe2eeh63cbhit3joe3w3afg3a fingerprint_ignore_patterns: [] class_name: RealitioContract contract_interface_paths: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 4190a5555..29adf513a 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidubzpluxo2h6ssq7pbcueqktljf3ytondohjmh2gegd2e4wyv5xa +agent: valory/trader:0.1.0:bafybeic3a2dxfw4xvg7ptunpnjxnji73qdvl7l2fa3pgto4k4a2k7hr4by number_of_agents: 4 deployment: {} --- @@ -121,7 +121,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} + contract_timeout: ${contract_timeout:float:300.0} benchmark_tool: &id005 args: log_dir: ${LOG_DIR:str:/benchmarks} @@ -203,7 +203,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} + contract_timeout: ${contract_timeout:float:300.0} benchmark_tool: *id005 2: models: @@ -283,7 +283,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} + contract_timeout: ${contract_timeout:float:300.0} benchmark_tool: *id005 3: models: @@ -363,7 +363,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - check_redeemed_timeout: ${CHECK_REDEEMED_TIMEOUT:float:300.0} + contract_timeout: ${contract_timeout:float:300.0} benchmark_tool: *id005 --- public_id: valory/ledger:0.19.0 diff --git a/packages/valory/skills/decision_maker_abci/behaviours/decision_receive.py b/packages/valory/skills/decision_maker_abci/behaviours/decision_receive.py index fda584961..2c075448d 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/decision_receive.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/decision_receive.py @@ -156,6 +156,7 @@ def _get_response_hash(self) -> WaitableConditionType: placeholder=get_name(DecisionReceiveBehaviour.response_hex), request_id=self.request_id, from_block=self.from_block, + timeout=self.params.contract_timeout, ) if result: diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index fa1acd963..9da4f8a7a 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -437,7 +437,7 @@ def _check_already_redeemed(self) -> WaitableConditionType: redeemer=safe_address_lower, from_block=from_block, to_block=to_block, - timeout=self.params.check_redeemed_timeout, + timeout=self.params.contract_timeout, **kwargs, ) @@ -580,6 +580,7 @@ def get_claim_params(self) -> WaitableConditionType: from_block=from_block, to_block=to_block, question_id=self.current_question_id, + timeout=self.params.contract_timeout, ) if not result and n_retries == self.params.max_filtering_retries: diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 97a9630ba..205f54fee 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -256,9 +256,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.tool_punishment_multiplier: int = self._ensure( "tool_punishment_multiplier", kwargs, int ) - self.check_redeemed_timeout: float = self._ensure( - "check_redeemed_timeout", kwargs, float - ) + self.contract_timeout: float = self._ensure("contract_timeout", kwargs, float) super().__init__(*args, **kwargs) @property diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index c7c05ab03..e70a58d50 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -15,17 +15,17 @@ fingerprint: behaviours/base.py: bafybeifwz5zbbaia4q4oll6cldtvt47w2hw2qadptkmmtovmitzgpizyki behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeierwdzn6vav54l6zym77hhx2vdx3jtnnwpbhwmwwyrqzncwjwkxu4 - behaviours/decision_receive.py: bafybeifacce2ke7oltnwnpdjdqfd74eaaw5wxnjfzk6c5tqdsxsmbzjj3m + behaviours/decision_receive.py: bafybeihdbdfpueqfnsa337a437fei2ebhmoe6emnmjccyrzm4gkpidueii behaviours/decision_request.py: bafybeievr7vae43e7jr4eqqhwe3emvgiih7ysa66jcb5g2oz5lbxua232q behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/reedem.py: bafybeibndrzx5zcynhf3uh4ajpl2qnyii5zhizbtre23conm4muzsi3s2u + behaviours/reedem.py: bafybeia4atyw2i7o7uwxinw2wliao2miycw53zpozed7ohy4eisvgmxwdm behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeifpvrrbftlkjsoiysnasihzttousk6hxnukzrln6z2d33e3zexkje dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeidqrxj3l3e555znk4wxx6spwaijz3bhc5yialhzbhd6ngk52w7jbq handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy - models.py: bafybeifjzkye2uounzdbkd5bmics66eshkwadmjhfrcngsrullw2afgxn4 + models.py: bafybeifitzp72u7snpw7fxgrzmbb52tnai3rrmubqwydey7wnrwcvmvexa payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm @@ -51,9 +51,9 @@ contracts: - valory/market_maker:0.1.0:bafybeiehszwvmurz5b5vpqbxbvcm5ty4z553jqpsnernqwdq6d62r3z5wa - valory/erc20:0.1.0:bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y -- valory/mech:0.1.0:bafybeieo65rtidzgrx22la7z7azoqbisd35hnoqfw7l3xxctotvctjlkju -- valory/conditional_tokens:0.1.0:bafybeigvz2ozwly3vhfv4nrcmkm5uhr6uxsf5dewuibdhczwhwavbxykce -- valory/realitio:0.1.0:bafybeieoily22pasgkzzcyawhqyrsko7b52lghnvwuskhomavb7tlb6pxa +- valory/mech:0.1.0:bafybeigvha4ya64ccjl7tbroa3zjqlxm64wxsqx5k2cz2xs3a7igu5qgxa +- valory/conditional_tokens:0.1.0:bafybeigucumqbsk74nj4rpm4p2cpiky4dj6uws7nfmgpimuviaxcamwqnu +- valory/realitio:0.1.0:bafybeicllaewp72lf5mlohsgu2h2gqemaltn7lkbzotwlq3wyg3wk2nunm - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeicznp6b7t7n6gju35xa2mr2vo3vshtj72l5odwhtdvz3uard27csq protocols: @@ -209,7 +209,7 @@ models: - stabilityai-stable-diffusion-512-v2-1 - stabilityai-stable-diffusion-768-v2-1 tool_punishment_multiplier: 1 - check_redeemed_timeout: 300.0 + contract_timeout: 300.0 class_name: DecisionMakerParams mech_response: args: diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 427831cfa..9c492c13f 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeiaefgqbs7zsn5xe5kdwrujj7ivygkn3ujpw6crnvi3knvxw75qmja - valory/termination_abci:0.1.0:bafybeie4zvjfxvdu7qrulmur3chpjz3kpj5m4bjsxvpk4gvj5zbyyayfaa - valory/market_manager_abci:0.1.0:bafybeietothjpt3472icsfoelihq437dclsckldsstz4sui46lblxfugsq -- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieccn47jk5axve6hkastkik57xs35pq6f2bgg2twz3fbkbe27whai +- valory/decision_maker_abci:0.1.0:bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihvwp3rlxaepfggkzi6ptcojbpayaul2hrruawz4pcjpuqfutcjqi - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca behaviours: main: @@ -192,7 +192,7 @@ models: refill_check_interval: 10 redeem_round_timeout: 3600.0 tool_punishment_multiplier: 1 - check_redeemed_timeout: 300.0 + contract_timeout: 300.0 class_name: TraderParams network_subgraph: args: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 3d76dac86..10c532de9 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeiaqcl7h2famylusiffigwem7tevkcsyocdu5xd42jkmgq6kvowzgq -- valory/decision_maker_abci:0.1.0:bafybeigralyfommiw4tzk6zuvmjcmpbhx3waoyslzgbkj4l43p3tictg2a +- valory/decision_maker_abci:0.1.0:bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca behaviours: main: From 371e3b2f67efbc4aa14cc5020f59ffec37fb2e43 Mon Sep 17 00:00:00 2001 From: Ardian Date: Mon, 4 Dec 2023 16:10:05 +0100 Subject: [PATCH 7/7] chore: update env var --- packages/packages.json | 2 +- packages/valory/services/trader/service.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index c85e42778..f9a41f946 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -5,7 +5,7 @@ "skill/valory/trader_abci/0.1.0": "bafybeibuaonngf33m63co5ezcerovfvjdfdit4gz3l44a3c5dl52nskfxq", "contract/valory/market_maker/0.1.0": "bafybeiehszwvmurz5b5vpqbxbvcm5ty4z553jqpsnernqwdq6d62r3z5wa", "agent/valory/trader/0.1.0": "bafybeic3a2dxfw4xvg7ptunpnjxnji73qdvl7l2fa3pgto4k4a2k7hr4by", - "service/valory/trader/0.1.0": "bafybeidmpidrckgu2ue4lhis4ufjytmstu3cmvfswgwxozuubu6uljqw3i", + "service/valory/trader/0.1.0": "bafybeig47lvkke2vg22obi3vkhbyr6kjxiqvxpxlsku4kzlidi6unhqmlq", "contract/valory/erc20/0.1.0": "bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui", "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihvwp3rlxaepfggkzi6ptcojbpayaul2hrruawz4pcjpuqfutcjqi", "contract/valory/mech/0.1.0": "bafybeigvha4ya64ccjl7tbroa3zjqlxm64wxsqx5k2cz2xs3a7igu5qgxa", diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 29adf513a..20225cfc8 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -121,7 +121,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - contract_timeout: ${contract_timeout:float:300.0} + contract_timeout: ${CONTRACT_TIMEOUT:float:300.0} benchmark_tool: &id005 args: log_dir: ${LOG_DIR:str:/benchmarks} @@ -203,7 +203,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - contract_timeout: ${contract_timeout:float:300.0} + contract_timeout: ${CONTRACT_TIMEOUT:float:300.0} benchmark_tool: *id005 2: models: @@ -283,7 +283,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - contract_timeout: ${contract_timeout:float:300.0} + contract_timeout: ${CONTRACT_TIMEOUT:float:300.0} benchmark_tool: *id005 3: models: @@ -363,7 +363,7 @@ type: skill refill_check_interval: ${REFILL_CHECK_INTERVAL:int:10} tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1} redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0} - contract_timeout: ${contract_timeout:float:300.0} + contract_timeout: ${CONTRACT_TIMEOUT:float:300.0} benchmark_tool: *id005 --- public_id: valory/ledger:0.19.0