diff --git a/packages/packages.json b/packages/packages.json index 47b151453..f9a41f946 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": "bafybeic474g73pukavqdpqu5pocsyhfa4eididi6v36jbzo53c3lo4tmfy", - "skill/valory/trader_abci/0.1.0": "bafybeieu5ufh3hvksdhzzur7hwfzz3dohqlehvuavbet3xpbw4dmzbf2q4", + "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": "bafybeifn45eermdfe66i3tx3aevvtngsr3punhu55kvrpmlk5ut3cgzif4", - "service/valory/trader/0.1.0": "bafybeiccwofazsng2vgws22ior4dxouwk7f75teqx6y6xdvof75xpehera", + "agent/valory/trader/0.1.0": "bafybeic3a2dxfw4xvg7ptunpnjxnji73qdvl7l2fa3pgto4k4a2k7hr4by", + "service/valory/trader/0.1.0": "bafybeig47lvkke2vg22obi3vkhbyr6kjxiqvxpxlsku4kzlidi6unhqmlq", "contract/valory/erc20/0.1.0": "bafybeihisiakfcftxs2hwx7yxzovao4qjuk3kqbzntiekzv5v75vpax3ui", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihkjceuiw6cwaul5a5ngydma7gik46cgp2cinhibhsysv7qvc3mba", - "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": "bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei", + "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 a03e36f53..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:bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei -- 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:bafybeihkjceuiw6cwaul5a5ngydma7gik46cgp2cinhibhsysv7qvc3mba +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihvwp3rlxaepfggkzi6ptcojbpayaul2hrruawz4pcjpuqfutcjqi - 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:bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam +- valory/trader_abci:0.1.0:bafybeibuaonngf33m63co5ezcerovfvjdfdit4gz3l44a3c5dl52nskfxq - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca 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} + 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 6dc296e75..8038a1b5a 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, Callable from requests.exceptions import ReadTimeout as RequestsReadTimeoutError from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError @@ -30,11 +30,39 @@ from hexbytes import HexBytes +FIVE_MINUTES = 300.0 + class ConditionalTokensContract(Contract): """The ConditionalTokens smart 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, @@ -47,31 +75,41 @@ 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) - 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) - 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.""" + 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) + 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 + + 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 1a09d137b..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: bafybeic34mnydr5m7xncg42tgg5qrjxkltsxxudnvog4jjcs6elg64z5ty + 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 3bc65fc5f..20225cfc8 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:bafybeic3a2dxfw4xvg7ptunpnjxnji73qdvl7l2fa3pgto4k4a2k7hr4by 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} + contract_timeout: ${CONTRACT_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} + contract_timeout: ${CONTRACT_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} + contract_timeout: ${CONTRACT_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} + 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 8c4af0263..9da4f8a7a 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.contract_timeout, **kwargs, ) @@ -579,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 4604ac3f0..205f54fee 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -256,6 +256,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.tool_punishment_multiplier: int = self._ensure( "tool_punishment_multiplier", kwargs, int ) + 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 1748389e0..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: bafybeifegxnjid4obmbodlc7ogw2ahoa64bgfneeltxw6mdubglfijylq4 + 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: bafybeif3ubulx7cr7bh7yvwhik2footnfi6ofvjoioym3w6eka3owi67pe + 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:bafybeifu5axib5ifzq6bomfscs7nnx5qknkzymlz6gfn7ohjsb2shghrei -- 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,6 +209,7 @@ models: - stabilityai-stable-diffusion-512-v2-1 - stabilityai-stable-diffusion-768-v2-1 tool_punishment_multiplier: 1 + 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 4f6410ca4..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:bafybeic474g73pukavqdpqu5pocsyhfa4eididi6v36jbzo53c3lo4tmfy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihkjceuiw6cwaul5a5ngydma7gik46cgp2cinhibhsysv7qvc3mba +- 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,6 +192,7 @@ models: refill_check_interval: 10 redeem_round_timeout: 3600.0 tool_punishment_multiplier: 1 + 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 313696857..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:bafybeic474g73pukavqdpqu5pocsyhfa4eididi6v36jbzo53c3lo4tmfy +- valory/decision_maker_abci:0.1.0:bafybeiepex3nukg5w6x75xngdiimjettpakpti64mnpfmjoapomt2hxqam - valory/staking_abci:0.1.0:bafybeiebu4qeblyjbacjvkiiiorxb4p3yy4nuhvsssgbailmqqtgrhwcca behaviours: main: