From 0d067561292282eee8a0b8036daeafba0eaa7734 Mon Sep 17 00:00:00 2001 From: Ardian Date: Wed, 20 Nov 2024 00:49:23 +0100 Subject: [PATCH] fix: misc --- packages/packages.json | 10 +++++----- packages/valory/agents/mech/aea-config.yaml | 11 +++------- packages/valory/services/mech/service.yaml | 2 +- .../services/mech_quickstart/service.yaml | 18 +++++++++++++++++ packages/valory/skills/mech_abci/skill.yaml | 3 ++- .../valory/skills/task_execution/models.py | 6 +++--- .../valory/skills/task_execution/skill.yaml | 4 ++-- .../skills/task_execution/utils/apis.py | 4 ++-- .../skills/task_submission_abci/behaviours.py | 20 +++++++++++++++++++ .../skills/task_submission_abci/skill.yaml | 4 ++-- 10 files changed, 58 insertions(+), 24 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index e8d17ba2..d55c03c1 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -8,13 +8,13 @@ "contract/valory/mech_marketplace/0.1.0": "bafybeigulghv7bvx4evl6kmogvv6gjxovyt22tkwlbdmeretmop2crdmem", "connection/valory/websocket_client/0.1.0": "bafybeic4ag3gqc7kd3k2o3pucddj2odck5yrfbgmwh5veqny7zao5qayli", "skill/valory/contract_subscription/0.1.0": "bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy", - "skill/valory/mech_abci/0.1.0": "bafybeibf5gxrngzn6j7qr5zvsshjoaxitt5e2bj6bybj73k6e3gdbggzge", - "skill/valory/task_submission_abci/0.1.0": "bafybeigrhzhk6qkmb5kaslkymsr3mnagoycl2kxqtiqfp6whkuyqc65lim", - "skill/valory/task_execution/0.1.0": "bafybeiafdhx4tyke5qao47cx5yuqnaivl47kuuu4xfdx3ndym6mvng3jve", + "skill/valory/mech_abci/0.1.0": "bafybeidx5mjawpbqbiozdzx3sx2vd2pokc7ulyccns55ycxgutj2s3g5d4", + "skill/valory/task_submission_abci/0.1.0": "bafybeicctl2tlza5gwyzvah7hyw74ubsxrri6uovtfvk2rzuf3cn327b4y", + "skill/valory/task_execution/0.1.0": "bafybeigmps4dtqlvmrn42bt46cmsqoyvgtd7ltojm2t3ogf5rijxftmr5q", "skill/valory/websocket_client/0.1.0": "bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m", "skill/valory/subscription_abci/0.1.0": "bafybeicazs3nnrztew6j5vanmpb3lnhx4a2rclcqxjr7tmtu3adhn5dziy", - "agent/valory/mech/0.1.0": "bafybeigk33wlthqhriruwyv44gcx754xzlne3ywynxg6ezswabac7dcmmq", - "service/valory/mech/0.1.0": "bafybeihy67owel7dgyoaaugjqbcvk6x2edgw7ogsqn7qjvpu32rkjim4y4", + "agent/valory/mech/0.1.0": "bafybeiabaazxnizhqwlqvihrie6xpxhntdrpzaujhehs4xsecdp2d5envq", + "service/valory/mech/0.1.0": "bafybeiglvwbhic2loj3aezrxqp4onogz6lu33bfoo7bh6h26fwh2jxdyc4", "service/valory/mech_quickstart/0.1.0": "bafybeibx772eooap6m7cdjwfyt5pespe22i2mva24y255vw22cd5d7bfuq" }, "third_party": { diff --git a/packages/valory/agents/mech/aea-config.yaml b/packages/valory/agents/mech/aea-config.yaml index d33b4e86..c3e93811 100644 --- a/packages/valory/agents/mech/aea-config.yaml +++ b/packages/valory/agents/mech/aea-config.yaml @@ -39,12 +39,12 @@ skills: - valory/abstract_abci:0.1.0:bafybeieo7pe5wqjphs5izpz5aujjbubymlxub62b3rhx6yglu65ibalffu - valory/abstract_round_abci:0.1.0:bafybeibiw4oqwqvo4jccwz5fb73iardzychgvcl66tceiildohoju2ikti - valory/contract_subscription:0.1.0:bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy -- valory/mech_abci:0.1.0:bafybeibf5gxrngzn6j7qr5zvsshjoaxitt5e2bj6bybj73k6e3gdbggzge +- valory/mech_abci:0.1.0:bafybeidx5mjawpbqbiozdzx3sx2vd2pokc7ulyccns55ycxgutj2s3g5d4 - valory/registration_abci:0.1.0:bafybeib3n6vqkfbrcubcbliebjnuwyywdinxkbzt76n6gbn2kg7ace47dq - valory/reset_pause_abci:0.1.0:bafybeihkj6lmaypspyxe5qqrjgnolyck62pyvqoylr24ab6ue4steqcw7e - valory/subscription_abci:0.1.0:bafybeicazs3nnrztew6j5vanmpb3lnhx4a2rclcqxjr7tmtu3adhn5dziy -- valory/task_execution:0.1.0:bafybeiafdhx4tyke5qao47cx5yuqnaivl47kuuu4xfdx3ndym6mvng3jve -- valory/task_submission_abci:0.1.0:bafybeigrhzhk6qkmb5kaslkymsr3mnagoycl2kxqtiqfp6whkuyqc65lim +- valory/task_execution:0.1.0:bafybeigmps4dtqlvmrn42bt46cmsqoyvgtd7ltojm2t3ogf5rijxftmr5q +- valory/task_submission_abci:0.1.0:bafybeicctl2tlza5gwyzvah7hyw74ubsxrri6uovtfvk2rzuf3cn327b4y - valory/termination_abci:0.1.0:bafybeifi2uodnrjsrivj53g3sjutocmyusbx6mlsb6oanqdyt2mfbyvusy - valory/transaction_settlement_abci:0.1.0:bafybeigh2vkt74jrad5gtsczrgqcuhcqe7jkgjy7jdw56yamlzwwnaymjy - valory/websocket_client:0.1.0:bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m @@ -223,11 +223,6 @@ public_id: valory/ledger:0.19.0 type: connection config: ledger_apis: - ethereum: - address: ${str:https://rpc.gnosischain.com/} - chain_id: ${int:100} - poa_chain: ${bool:false} - default_gas_price_strategy: ${str:eip1559} gnosis: address: ${str:https://rpc.gnosischain.com/} chain_id: ${int:100} diff --git a/packages/valory/services/mech/service.yaml b/packages/valory/services/mech/service.yaml index 8ced5c87..b8e61d91 100644 --- a/packages/valory/services/mech/service.yaml +++ b/packages/valory/services/mech/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeif7ia4jdlazy6745ke2k2x5yoqlwsgwr6sbztbgqtwvs3ndm2p7ba fingerprint_ignore_patterns: [] -agent: valory/mech:0.1.0:bafybeigk33wlthqhriruwyv44gcx754xzlne3ywynxg6ezswabac7dcmmq +agent: valory/mech:0.1.0:bafybeiabaazxnizhqwlqvihrie6xpxhntdrpzaujhehs4xsecdp2d5envq number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/mech_quickstart/service.yaml b/packages/valory/services/mech_quickstart/service.yaml index 12ed03ed..6be23f47 100644 --- a/packages/valory/services/mech_quickstart/service.yaml +++ b/packages/valory/services/mech_quickstart/service.yaml @@ -66,6 +66,24 @@ type: skill mech_staking_instance_address: ${MECH_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} service_owner_share: ${SERVICE_SHARE:float:0} --- +public_id: valory/task_execution:0.1.0 +type: skill +0: + models: + params: + args: + task_deadline: ${TASK_DEADLINE:float:240.0} + tools_to_package_hash: ${TOOLS_TO_PACKAGE_HASH:dict:{}} + api_keys: ${API_KEYS:dict:{}} + polling_interval: ${POLLING_INTERVAL:float:30.0} + agent_index: ${AGENT_INDEX_0:int:0} + num_agents: ${NUM_AGENTS:int:1} + mech_marketplace_address: ${MECH_MARKETPLACE_ADDRESS:str:0x0000000000000000000000000000000000000000} + timeout_limit: ${TIMEOUT_LIMIT:int:3} + mech_to_config: ${MECH_TO_CONFIG:dict:{"0xFf82123dFB52ab75C417195c5fDB87630145ae81":{"use_dynamic_pricing":false,"is_marketplace_mech":false}, + "0x77af31De935740567Cf4fF1986D04B2c964A786a":{"use_dynamic_pricing":false,"is_marketplace_mech":false}}} + max_block_window: ${MAX_BLOCK_WINDOW:int:500} +--- public_id: valory/ledger:0.19.0 type: connection config: diff --git a/packages/valory/skills/mech_abci/skill.yaml b/packages/valory/skills/mech_abci/skill.yaml index e1dbf362..6e92b62a 100644 --- a/packages/valory/skills/mech_abci/skill.yaml +++ b/packages/valory/skills/mech_abci/skill.yaml @@ -23,7 +23,7 @@ skills: - valory/abstract_round_abci:0.1.0:bafybeibiw4oqwqvo4jccwz5fb73iardzychgvcl66tceiildohoju2ikti - valory/registration_abci:0.1.0:bafybeib3n6vqkfbrcubcbliebjnuwyywdinxkbzt76n6gbn2kg7ace47dq - valory/reset_pause_abci:0.1.0:bafybeihkj6lmaypspyxe5qqrjgnolyck62pyvqoylr24ab6ue4steqcw7e -- valory/task_submission_abci:0.1.0:bafybeigrhzhk6qkmb5kaslkymsr3mnagoycl2kxqtiqfp6whkuyqc65lim +- valory/task_submission_abci:0.1.0:bafybeicctl2tlza5gwyzvah7hyw74ubsxrri6uovtfvk2rzuf3cn327b4y - valory/termination_abci:0.1.0:bafybeifi2uodnrjsrivj53g3sjutocmyusbx6mlsb6oanqdyt2mfbyvusy - valory/transaction_settlement_abci:0.1.0:bafybeigh2vkt74jrad5gtsczrgqcuhcqe7jkgjy7jdw56yamlzwwnaymjy - valory/subscription_abci:0.1.0:bafybeicazs3nnrztew6j5vanmpb3lnhx4a2rclcqxjr7tmtu3adhn5dziy @@ -144,6 +144,7 @@ models: validate_timeout: 1205 task_wait_timeout: 15.0 use_slashing: false + default_chain_id: ethereum manual_gas_limit: 1000000 mech_staking_instance_address: '0x0000000000000000000000000000000000000000' mech_marketplace_address: '0x0000000000000000000000000000000000000000' diff --git a/packages/valory/skills/task_execution/models.py b/packages/valory/skills/task_execution/models.py index 7b8859f4..bea644fe 100644 --- a/packages/valory/skills/task_execution/models.py +++ b/packages/valory/skills/task_execution/models.py @@ -20,7 +20,7 @@ """This module contains the shared state for the abci skill of Mech.""" import dataclasses from collections import defaultdict -from typing import Any, Callable, Dict, Optional +from typing import Any, Callable, Dict, Optional, List from aea.exceptions import enforce from aea.skills.base import Model @@ -56,8 +56,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.in_flight_req: bool = False self.from_block: Optional[int] = None self.req_to_callback: Dict[str, Callable] = {} - self.api_keys: Dict[str, str] = self._ensure_get( - "api_keys", kwargs, Dict[str, str] + self.api_keys: Dict[str, List[str]] = self._ensure_get( + "api_keys", kwargs, Dict[str, List[str]] ) self.tools_to_package_hash: Dict[str, str] = self._ensure_get( "tools_to_package_hash", kwargs, Dict[str, str] diff --git a/packages/valory/skills/task_execution/skill.yaml b/packages/valory/skills/task_execution/skill.yaml index 693636ef..85582d89 100644 --- a/packages/valory/skills/task_execution/skill.yaml +++ b/packages/valory/skills/task_execution/skill.yaml @@ -10,9 +10,9 @@ fingerprint: behaviours.py: bafybeiexshowozpbzuomhezg3a5b2re77ikidjkiy3fov2tsfiqyk6dmwe dialogues.py: bafybeid4zxalqdlo5mw4yfbuf34hx4jp5ay5z6chm4zviwu4cj7fudtwca handlers.py: bafybeidbt5ezj74cgfogk3w4uw4si2grlnk5g54veyumw7g5yh6gdscywu - models.py: bafybeigszq73slogvebsaxh32p325fxthyuuwwtot7qxj3bdyho7x7spuq + models.py: bafybeibsnirbekd7ondvm2lkrabm5wxzwsl6xkf2ccmrbfugkz4cola77u utils/__init__.py: bafybeiccdijaigu6e5p2iruwo5mkk224o7ywedc7nr6xeu5fpmhjqgk24e - utils/apis.py: bafybeidqt5nqcymlpwlycnvpsheeeexk3tb3yboceeeizwpd6miqewtr7u + utils/apis.py: bafybeigu73lfz3g3mc6iupisrvlsp3fyl4du3oqlyajgdpfvtqypddh3w4 utils/benchmarks.py: bafybeiafnee7iay6dyjnatyqyzjov5c4ibl3ojamjmgfjri7cyghl7qayq utils/cost_calculation.py: bafybeighafxied73w3mcmgziwfp3u2x6t4qlztw4kyekyq2ddgyhdge74q utils/ipfs.py: bafybeicp6d2y4aguetcod2yzxrbiqqwkzarzccyf2iajuwvrcfckmn6jm4 diff --git a/packages/valory/skills/task_execution/utils/apis.py b/packages/valory/skills/task_execution/utils/apis.py index a6714db3..9d18ab3c 100644 --- a/packages/valory/skills/task_execution/utils/apis.py +++ b/packages/valory/skills/task_execution/utils/apis.py @@ -17,13 +17,13 @@ # # ------------------------------------------------------------------------------ """Utils for API integrations.""" -from typing import Dict +from typing import Dict, List class KeyChain: """Class for managing API keys.""" - def __init__(self, services: Dict[str, str]) -> None: + def __init__(self, services: Dict[str, List[str]]) -> None: """Initialize the KeyChain with a dictionary of service names and corresponding lists of API keys.""" if not isinstance(services, dict): raise ValueError( diff --git a/packages/valory/skills/task_submission_abci/behaviours.py b/packages/valory/skills/task_submission_abci/behaviours.py index b8e0d9bf..29d404ee 100644 --- a/packages/valory/skills/task_submission_abci/behaviours.py +++ b/packages/valory/skills/task_submission_abci/behaviours.py @@ -146,6 +146,26 @@ def to_multihash(hash_string: str) -> str: hex_multihash = multihash_bytes.hex() return hex_multihash[6:] + def get_contract_api_response( + self, + performative: ContractApiMessage.Performative, + contract_address: Optional[str], + contract_id: str, + contract_callable: str, + ledger_id: Optional[str] = None, + **kwargs: Any, + ) -> Generator[None, None, ContractApiMessage]: + """Get the contract api response.""" + return super().get_contract_api_response( + performative=performative, + contract_address=contract_address, + contract_id=contract_id, + contract_callable=contract_callable, + ledger_id=ledger_id, + chain_id=self.params.default_chain_id, + **kwargs, + ) + class TaskPoolingBehaviour(TaskExecutionBaseBehaviour, ABC): """TaskPoolingBehaviour""" diff --git a/packages/valory/skills/task_submission_abci/skill.yaml b/packages/valory/skills/task_submission_abci/skill.yaml index b86f3e52..8b1630c1 100644 --- a/packages/valory/skills/task_submission_abci/skill.yaml +++ b/packages/valory/skills/task_submission_abci/skill.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeiholqak7ltw6bbmn2c5tn3j7xgzkdlfzp3kcskiqsvmxoih6m4muq - behaviours.py: bafybeidd4roeiq3qtr65ewu7qwwmlkm7g6j5g66o4b3uec6n5ucgpbrsei + behaviours.py: bafybeihxka545wadqee7uaqevviqdmjn3tvqiakxoaah6g7f7urrpnlvri dialogues.py: bafybeibmac3m5u5h6ucoyjr4dazay72dyga656wvjl6z6saapluvjo54ne fsm_specification.yaml: bafybeidtmsmpunr3t77pshd3k2s6dd6hlvhze6inu3gj7xyvlg4wi3tnuu handlers.py: bafybeibe5n7my2vd2wlwo73sbma65epjqc7kxgtittewlylcmvnmoxtxzq @@ -32,7 +32,7 @@ protocols: skills: - valory/abstract_round_abci:0.1.0:bafybeibiw4oqwqvo4jccwz5fb73iardzychgvcl66tceiildohoju2ikti - valory/transaction_settlement_abci:0.1.0:bafybeigh2vkt74jrad5gtsczrgqcuhcqe7jkgjy7jdw56yamlzwwnaymjy -- valory/task_execution:0.1.0:bafybeiafdhx4tyke5qao47cx5yuqnaivl47kuuu4xfdx3ndym6mvng3jve +- valory/task_execution:0.1.0:bafybeigmps4dtqlvmrn42bt46cmsqoyvgtd7ltojm2t3ogf5rijxftmr5q behaviours: main: args: {}