From 4e3eb1b89f633af073ecf4be78c4d5f8f2058db9 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 30 Oct 2023 16:02:54 +0200 Subject: [PATCH 01/20] revert: "fix: rpc timeout issue" This reverts commit 26a1405d --- packages/valory/agents/trader/aea-config.yaml | 1 - .../contracts/conditional_tokens/contract.py | 2 -- packages/valory/services/trader/service.yaml | 4 --- .../graph_tooling/queries/omen.py | 1 - .../graph_tooling/requests.py | 7 +--- .../skills/market_manager_abci/models.py | 35 ------------------- .../skills/market_manager_abci/skill.yaml | 1 - packages/valory/skills/trader_abci/skill.yaml | 1 - 8 files changed, 1 insertion(+), 51 deletions(-) diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 823d1cb07..af8ece81b 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -186,7 +186,6 @@ models: realitio_address: ${str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} redeeming_batch_size: ${int:5} slippage: ${float:0.01} - redeem_margin_days: ${int:15} policy_epsilon: ${float:0.1} policy_store_path: ${str:/data/} irrelevant_tools: ${list:["openai-text-davinci-002", "openai-text-davinci-003", diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 74548a8f6..1e2feeaab 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -95,8 +95,6 @@ def check_redeemed( f"Did the creation happen too long in the past?\n" f"The market with condition id {earliest_condition_id!r} " f"is the oldest one and the block filtering was set based on it." - "If the issue persists, try to decrease the value of `redeem_margin_days` " - f"in the agent's configuration, based on the date corresponding to the block number {earliest_block}." ) return dict(error=msg) diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 4c420e7dd..09be53313 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -103,7 +103,6 @@ type: skill realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} - redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15} policy_epsilon: ${POLICY_EPSILON:float:0.1} policy_store_path: ${POLICY_STORE_PATH:str:/data/} irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003", @@ -173,7 +172,6 @@ type: skill realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} - redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15} policy_epsilon: ${POLICY_EPSILON:float:0.1} policy_store_path: ${POLICY_STORE_PATH:str:/data/} irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003", @@ -241,7 +239,6 @@ type: skill realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} - redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15} policy_epsilon: ${POLICY_EPSILON:float:0.1} policy_store_path: ${POLICY_STORE_PATH:str:/data/} irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003", @@ -309,7 +306,6 @@ type: skill realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} - redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15} policy_epsilon: ${POLICY_EPSILON:float:0.1} policy_store_path: ${POLICY_STORE_PATH:str:/data/} irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003", diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/omen.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/omen.py index 3f18fc881..96f3e6654 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/queries/omen.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/omen.py @@ -62,7 +62,6 @@ creator: "${creator}", fpmm_: { answerFinalizedTimestamp_not: null, - creationTimestamp_gt: "${from_timestamp}", isPendingArbitration: false } } diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index f4dcfdcc4..80ef43e61 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -41,9 +41,6 @@ from packages.valory.skills.market_manager_abci.rounds import SynchronizedData -DAY_UNIX = 24 * 60 * 60 - - def to_content(query: str) -> bytes: """Convert the given query string to payload content, i.e., add it under a `queries` key and convert it to bytes.""" finalized_query = {"query": query} @@ -187,9 +184,7 @@ def _fetch_redeem_info(self) -> Generator[None, None, Optional[list]]: self._fetch_status = FetchStatus.IN_PROGRESS safe = self.synchronized_data.safe_contract_address - redeem_margin = self.params.redeem_margin_days * DAY_UNIX - from_timestamp = self.synced_time - redeem_margin - query = trades.substitute(creator=safe.lower(), from_timestamp=from_timestamp) + query = trades.substitute(creator=safe.lower()) # workaround because we cannot have multiple response keys for a single `ApiSpec` res_key_backup = self.current_subgraph.response_info.response_key diff --git a/packages/valory/skills/market_manager_abci/models.py b/packages/valory/skills/market_manager_abci/models.py index f23744b88..8419734c4 100644 --- a/packages/valory/skills/market_manager_abci/models.py +++ b/packages/valory/skills/market_manager_abci/models.py @@ -38,9 +38,6 @@ BenchmarkTool = BaseBenchmarkTool -GNOSIS_RPC_TIMEOUT_DAYS = 25 - - class SharedState(BaseSharedState): """Keep the current shared state of the skill.""" @@ -75,40 +72,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.languages: List[str] = self._ensure("languages", kwargs, List[str]) self.average_block_time: int = self._ensure("average_block_time", kwargs, int) self.abt_error_mult: int = self._ensure("abt_error_mult", kwargs, int) - self._redeem_margin_days: int = 0 - self.redeem_margin_days = self._ensure("redeem_margin_days", kwargs, int) super().__init__(*args, **kwargs) - @property - def redeem_margin_days(self) -> int: - """Get the margin in days of the redeeming information.""" - return self._redeem_margin_days - - @redeem_margin_days.setter - def redeem_margin_days(self, redeem_margin_days: int) -> None: - """Get the margin in days of the redeeming information.""" - value_enforcement = ( - f"The value needs to be in the exclusive range (0, {GNOSIS_RPC_TIMEOUT_DAYS}) " - f"and manual redeeming has to be performed for markets older than {GNOSIS_RPC_TIMEOUT_DAYS - 1} days." - ) - - if redeem_margin_days <= 0: - raise ValueError( - "The margin in days for the redeeming information (`redeem_margin_days`) " - f"cannot be set to {redeem_margin_days} <= 0. {value_enforcement}" - ) - if redeem_margin_days >= GNOSIS_RPC_TIMEOUT_DAYS: - raise ValueError( - "Due to a constraint of the Gnosis RPCs, it is not possible to configure the redeeming " - f"information's time window to exceed {GNOSIS_RPC_TIMEOUT_DAYS - 1} days " - f"(currently {redeem_margin_days=}). To clarify, these RPCs experience timeouts " - "when attempting to filter for historical on-chain events. " - "Practical testing of the service has revealed that timeouts consistently occur for blocks " - f"approximately {GNOSIS_RPC_TIMEOUT_DAYS} days old. {value_enforcement}" - ) - - self._redeem_margin_days = redeem_margin_days - @property def creators_iterator(self) -> Iterator[Tuple[str, List[str]]]: """Return an iterator of market per creators.""" diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index e7edd85e7..f6f54234b 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -137,7 +137,6 @@ models: - en_US average_block_time: 5 abt_error_mult: 5 - redeem_margin_days: 15 class_name: MarketManagerParams network_subgraph: args: diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index cbdad3b49..b229e7d11 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -168,7 +168,6 @@ models: realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57' redeeming_batch_size: 5 slippage: 0.01 - redeem_margin_days: 15 policy_epsilon: 0.1 policy_store_path: /data/ irrelevant_tools: From 986cac72a475d503628736c8bb7db663a766702c Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 30 Oct 2023 16:12:30 +0200 Subject: [PATCH 02/20] refactor: remove invalid instruction --- packages/valory/contracts/conditional_tokens/contract.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index 1e2feeaab..a4d5c39d0 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -55,7 +55,6 @@ def check_redeemed( ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" earliest_block = DEFAULT_FROM_BLOCK - earliest_condition_id = HexBytes("") for condition_id, from_block in from_block_numbers.items(): if ( @@ -64,7 +63,6 @@ def check_redeemed( or earliest_block == DEFAULT_FROM_BLOCK ): earliest_block = from_block - earliest_condition_id = condition_id contract_instance = cls.get_instance(ledger_api, contract_address) to_checksum = ledger_api.api.to_checksum_address @@ -90,11 +88,9 @@ def check_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 {earliest_block} to latest, " + f"The service tried to filter from block {earliest_block} to latest, with a step {chunk_size}," f"as the earliest market creation transaction took place at block {earliest_block}. " - f"Did the creation happen too long in the past?\n" - f"The market with condition id {earliest_condition_id!r} " - f"is the oldest one and the block filtering was set based on it." + f"If this issue persists, please try lowering the step size!" ) return dict(error=msg) From 78b1e4719d6ac440418ef34c9107a287a53469e1 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 30 Oct 2023 16:19:18 +0200 Subject: [PATCH 03/20] chore: run generators --- packages/packages.json | 14 +++++++------- packages/valory/agents/trader/aea-config.yaml | 10 +++++----- .../contracts/conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 4 ++-- .../valory/skills/market_manager_abci/skill.yaml | 6 +++--- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 388e20e91..4208a3840 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m", - "skill/valory/decision_maker_abci/0.1.0": "bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y", - "skill/valory/trader_abci/0.1.0": "bafybeifrvvhiaioqqjzyouhi3ga37jk7ataxz5sox275mccqqszcsiehju", + "skill/valory/market_manager_abci/0.1.0": "bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4", + "skill/valory/decision_maker_abci/0.1.0": "bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m", + "skill/valory/trader_abci/0.1.0": "bafybeic7ztyme3wlzdykvnnpxvaxxpy4byqjxt6uunoalbz7etzo6uhfza", "contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m", - "agent/valory/trader/0.1.0": "bafybeidfoajq7jno5ojcgvdkcacialgqr4rsayivkspjdyhcd2povbkiri", - "service/valory/trader/0.1.0": "bafybeihwzztpxd5g3pq5awpdtvbirdkwzt66bj26lpulzay2afsrzubfnq", + "agent/valory/trader/0.1.0": "bafybeid2e66zg5gx33xskdxmfcw7vtluvy4bwnoda3ouchu6rsmhtlkgsi", + "service/valory/trader/0.1.0": "bafybeicdmgkvyefq4fn4amoqhtfi4h5bgbidwt57fwerlpziaon3rsvmzi", "contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeib5s5ubudn67phubygrx7lmlzfrhwhy4lo6biusef7ffk2jyipn6a", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq", "contract/valory/mech/0.1.0": "bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga", "contract/valory/realitio/0.1.0": "bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeif5jwc6owfe6brmqq5sfnhrwo2ajdtt4glrmyhlqxcvtkyofahwsa", + "contract/valory/conditional_tokens/0.1.0": "bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi", "contract/valory/agent_registry/0.1.0": "bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty" }, "third_party": { diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index af8ece81b..5ee3372b2 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:bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga -- valory/conditional_tokens:0.1.0:bafybeif5jwc6owfe6brmqq5sfnhrwo2ajdtt4glrmyhlqxcvtkyofahwsa +- valory/conditional_tokens:0.1.0:bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi - valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 protocols: @@ -41,10 +41,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib5s5ubudn67phubygrx7lmlzfrhwhy4lo6biusef7ffk2jyipn6a -- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m -- valory/decision_maker_abci:0.1.0:bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y -- valory/trader_abci:0.1.0:bafybeifrvvhiaioqqjzyouhi3ga37jk7ataxz5sox275mccqqszcsiehju +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq +- valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 +- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m +- valory/trader_abci:0.1.0:bafybeic7ztyme3wlzdykvnnpxvaxxpy4byqjxt6uunoalbz7etzo6uhfza default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index e27735501..03acd85ac 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: bafybeigzkxofon5npsqksdnfxeq4azsbeost2mgqqdlyvyvaom7wtsf7bi + contract.py: bafybeie73lgxfuhqhksqqm6mthwqyw3rau2h2eul6mp7vyswpv37vgyz2a 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 09be53313..dc1830eb6 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:bafybeidfoajq7jno5ojcgvdkcacialgqr4rsayivkspjdyhcd2povbkiri +agent: valory/trader:0.1.0:bafybeid2e66zg5gx33xskdxmfcw7vtluvy4bwnoda3ouchu6rsmhtlkgsi 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 49333f5e1..e34c57b74 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -49,7 +49,7 @@ contracts: - valory/erc20:0.1.0:bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga -- valory/conditional_tokens:0.1.0:bafybeif5jwc6owfe6brmqq5sfnhrwo2ajdtt4glrmyhlqxcvtkyofahwsa +- valory/conditional_tokens:0.1.0:bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi - valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty @@ -57,7 +57,7 @@ protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq -- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m +- valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy behaviours: main: diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index f6f54234b..ca4442035 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -15,10 +15,10 @@ fingerprint: graph_tooling/__init__.py: bafybeigzo7nhbzafyq3fuhrlewksjvmzttiuk4vonrggtjtph4rw4ncpk4 graph_tooling/queries/__init__.py: bafybeihbybnl53i7k57ql5ujt5ru5n2eg324jfndh4lcnm4fk52mwbkjda graph_tooling/queries/network.py: bafybeigeq72ys2nrjqspj2uacaudrgljrne5a3o5jvzsktldxdq6m2xmeu - graph_tooling/queries/omen.py: bafybeicatte7cinlzcmubkoyne7fgvuedimvotf4pvhacozsy7ndftmmdy - graph_tooling/requests.py: bafybeicv7hdo4a56pqteaxoxi5tskfbb34u2ajmhu7canoco3mi3jv6fmy + graph_tooling/queries/omen.py: bafybeidza3jmqaapfjxuuxhil2t6ibdphyxdyfnz5f7ggrdz63wxphtvhy + graph_tooling/requests.py: bafybeicz4rszvcmdmc2jms6en5c65mfsdhwsj3qzg2sl7s5fz6einbgwha handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu - models.py: bafybeiaplszooak63fo3i6agaoyol4tpof4q4tvoj4j6f2cr2corajnl3a + models.py: bafybeifmb4cojxesv2lcw6j3pm3yqjpsiuwyxpuexjbz656fpapdqcj2ba payloads.py: bafybeiamavgddfbzofpsjthmw6j7g2dyxm7fb6hvdb47kweyrx4w2ihcfi rounds.py: bafybeib2jkzzpnmx6eebw3cw6t2hlzxktumbzrerjlowlpv532eink6g7e fingerprint_ignore_patterns: [] diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index b229e7d11..c0843949b 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy -- valory/market_manager_abci:0.1.0:bafybeigmy3g2klkzdhttti2ouxf575ua5y7ajmh4a3yfpukeukqxjky47m -- valory/decision_maker_abci:0.1.0:bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib5s5ubudn67phubygrx7lmlzfrhwhy4lo6biusef7ffk2jyipn6a +- valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 +- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq 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 0fb9b460a..fc3747311 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,7 +20,7 @@ contracts: [] protocols: [] skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq -- valory/decision_maker_abci:0.1.0:bafybeichzmhpgyhk5gc6gepocdaghdwyoutq4x3ul4w7av4lasp7bxfb3y +- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m behaviours: main: args: {} From e9f08479e1689a23f16b6f93f496887151320781 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Mon, 30 Oct 2023 16:41:52 +0200 Subject: [PATCH 04/20] chore: ignore `gitleaks` false positive --- .gitleaksignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitleaksignore b/.gitleaksignore index 09699f347..7bb661cc2 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -8,3 +8,4 @@ e601530b1b2503589126e99070459e3e46a789d5:packages/valory/skills/decision_maker_a e601530b1b2503589126e99070459e3e46a789d5:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:159 9150ab78d5e30f576226cf38fb4cc62d73b09752:packages/valory/contracts/conditional_tokens/contract.yaml:generic-api-key:10 cd8a3159e660a5eb6838657db4d7537912e657bf:packages/valory/skills/market_manager_abci/skill.yaml:generic-api-key:17 +ce811dab0e95cdd63ea00e1ed8207801f464d773:packages/valory/contracts/service_staking_token/contract.yaml:generic-api-key:10 From 7e8669988ece724422fc0a555302fa83004a4232 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:21:19 +0200 Subject: [PATCH 05/20] feat: create property for the shared state --- .../valory/skills/decision_maker_abci/behaviours/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/base.py b/packages/valory/skills/decision_maker_abci/behaviours/base.py index ed7cebcea..0f6d5f669 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/base.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/base.py @@ -42,6 +42,7 @@ from packages.valory.skills.decision_maker_abci.models import ( DecisionMakerParams, MultisendBatch, + SharedState, ) from packages.valory.skills.decision_maker_abci.policy import EGreedyPolicy from packages.valory.skills.decision_maker_abci.states.base import SynchronizedData @@ -88,6 +89,11 @@ def params(self) -> DecisionMakerParams: """Return the params.""" return cast(DecisionMakerParams, self.context.params) + @property + def shared_state(self) -> SharedState: + """Get the shared state.""" + return cast(SharedState, self.context.state) + @property def synchronized_data(self) -> SynchronizedData: """Return the synchronized data.""" From 55a96f7bb6abc659882d125a6ba70a45427648cf Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:22:48 +0200 Subject: [PATCH 06/20] feat: create a structure to store the redeeming progress --- .../skills/decision_maker_abci/models.py | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 059ca3135..52c143088 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -22,13 +22,16 @@ import json import os import re -from dataclasses import dataclass +from collections import defaultdict +from dataclasses import dataclass, field from pathlib import Path from string import Template -from typing import Any, Dict, Optional, Set +from typing import Any, Dict, Optional, Set, Union from aea.exceptions import enforce +from aea.skills.base import SkillContext from hexbytes import HexBytes +from web3.types import BlockIdentifier from packages.valory.contracts.multisend.contract import MultiSendOperation from packages.valory.skills.abstract_round_abci.models import ApiSpecs @@ -39,12 +42,18 @@ from packages.valory.skills.abstract_round_abci.models import ( SharedState as BaseSharedState, ) +from packages.valory.skills.decision_maker_abci.policy import EGreedyPolicy +from packages.valory.skills.decision_maker_abci.redeem_info import Trade from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp from packages.valory.skills.market_manager_abci.models import MarketManagerParams RE_CONTENT_IN_BRACKETS = r"\{([^}]*)\}" REQUIRED_BET_TEMPLATE_KEYS = {"yes", "no", "question"} +DEFAULT_FROM_BLOCK = "earliest" + + +FromBlockMappingType = Dict[HexBytes, Union[int, str]] class PromptTemplate(Template): @@ -57,6 +66,28 @@ class PromptTemplate(Template): BenchmarkTool = BaseBenchmarkTool +@dataclass +class RedeemingProgress: + """A structure to keep track of the redeeming check progress.""" + + trades: Set[Trade] = field(default_factory=lambda: set()) + utilized_tools: Dict[str, int] = field(default_factory=lambda: {}) + policy: Optional[EGreedyPolicy] = None + claimable_amounts: Dict[HexBytes, int] = field(default_factory=lambda: {}) + from_block_mapping: FromBlockMappingType = field( + default_factory=lambda: defaultdict(lambda: DEFAULT_FROM_BLOCK) + ) + from_block: BlockIdentifier = "earliest" + to_block: BlockIdentifier = "latest" + payouts: Dict[str, int] = field(default_factory=lambda: {}) + started: bool = False + + @property + def finished(self) -> bool: + """Whether the check has finished.""" + return self.started and self.from_block == self.to_block + + class SharedState(BaseSharedState): """Keep the current shared state of the skill.""" From 790b03f5ddc4cf18bf9a375698b978415813b9fc Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:23:32 +0200 Subject: [PATCH 07/20] feat: create a redeeming progress object in the shared state --- packages/valory/skills/decision_maker_abci/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 52c143088..d291d1726 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -93,6 +93,11 @@ class SharedState(BaseSharedState): abci_app_cls = DecisionMakerAbciApp + def __init__(self, *args: Any, skill_context: SkillContext, **kwargs: Any) -> None: + """Initialize the state.""" + super().__init__(*args, skill_context=skill_context, **kwargs) + self.redeeming_progress: RedeemingProgress = RedeemingProgress() + def extract_keys_from_template(delimiter: str, template: str) -> Set[str]: """Extract the keys from a string template, given the delimiter.""" From d807de59375fd27703ae813c4607d28374524d66 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:24:56 +0200 Subject: [PATCH 08/20] feat: create a method to get the latest block's timestamp --- .../decision_maker_abci/behaviours/reedem.py | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index aee5073bd..d68f4f306 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -34,6 +34,7 @@ from packages.valory.contracts.realitio.contract import RealitioContract from packages.valory.contracts.realitio_proxy.contract import RealitioProxyContract from packages.valory.protocols.contract_api import ContractApiMessage +from packages.valory.protocols.ledger_api import LedgerApiMessage from packages.valory.skills.abstract_round_abci.base import get_name from packages.valory.skills.decision_maker_abci.behaviours.base import ( DecisionMakerBaseBehaviour, @@ -55,10 +56,8 @@ ZERO_HEX = HASH_ZERO[2:] ZERO_BYTES = bytes.fromhex(ZERO_HEX) -DEFAULT_FROM_BLOCK = "earliest" - - -FromBlockMappingType = Dict[HexBytes, Union[int, str]] +BLOCK_TIMESTAMP_KEY = "timestamp" +DEFAULT_TO_BLOCK = "latest" class RedeemInfoBehaviour(DecisionMakerBaseBehaviour, QueryingBehaviour, ABC): @@ -181,6 +180,7 @@ class RedeemBehaviour(RedeemInfoBehaviour): def __init__(self, **kwargs: Any) -> None: """Initialize `RedeemBehaviour`.""" super().__init__(**kwargs) + self._latest_block_timestamp: Optional[int] = None self._finalized: bool = False self._already_resolved: bool = False self._payouts: Dict[str, int] = {} @@ -189,6 +189,23 @@ def __init__(self, **kwargs: Any) -> None: self._expected_winnings: int = 0 self._history_hash: bytes = ZERO_BYTES + @property + def latest_block_timestamp(self) -> int: + """Get the latest block timestamp.""" + if self._latest_block_timestamp is None: + error = "Attempting to retrieve the latest block number, but it hasn't been set yet." + raise ValueError(error) + return self._latest_block_timestamp + + @latest_block_timestamp.setter + def latest_block_timestamp(self, latest_block_timestamp: str) -> None: + """Set the latest block timestamp.""" + try: + self._latest_block_timestamp = int(latest_block_timestamp) + except (TypeError, ValueError) as exc: + error = f"{latest_block_timestamp=} cannot be converted to a valid integer." + raise ValueError(error) from exc + @property def current_redeem_info(self) -> Trade: """Get the current redeem info.""" @@ -321,6 +338,21 @@ def _conditional_tokens_interact( ) return status + def _get_latest_block(self) -> WaitableConditionType: + """Get the latest block's timestamp.""" + ledger_api_response = yield from self.get_ledger_api_response( + performative=LedgerApiMessage.Performative.GET_STATE, # type: ignore + ledger_callable="get_block", + block_identifier=DEFAULT_TO_BLOCK, + ) + if ledger_api_response.performative != LedgerApiMessage.Performative.STATE: + self.context.logger.error(f"Failed to get block: {ledger_api_response}") + return False + self.latest_block_timestamp = ledger_api_response.state.body.get( + BLOCK_TIMESTAMP_KEY + ) + return True + def _check_already_redeemed(self) -> WaitableConditionType: """Check whether we have already redeemed for this bet.""" if len(self.trades) == 0: From f2ab0bc8b642febc2390134361d110c16e49bd4c Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:28:10 +0200 Subject: [PATCH 09/20] feat: store the redeeming progress in case of a timeout --- .../contracts/conditional_tokens/contract.py | 50 +++----- .../decision_maker_abci/behaviours/reedem.py | 110 +++++++++++++++--- 2 files changed, 106 insertions(+), 54 deletions(-) diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index a4d5c39d0..fe50fe7a8 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.""" -from typing import List, Dict +from typing import List from requests.exceptions import ReadTimeout as RequestsReadTimeoutError from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError @@ -28,11 +28,6 @@ from aea.contracts.base import Contract from aea.crypto.base import LedgerApi from hexbytes import HexBytes -from web3.types import BlockIdentifier - - -DEFAULT_FROM_BLOCK = "earliest" -DEFAULT_TO_BLOCK = "latest" class ConditionalTokensContract(Contract): @@ -46,51 +41,36 @@ def check_redeemed( 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]], - from_block_numbers: Dict[HexBytes, BlockIdentifier], - chunk_size: int = 5_000, ) -> JSONLike: """Filter to find out whether a position has already been redeemed.""" - earliest_block = DEFAULT_FROM_BLOCK - - for condition_id, from_block in from_block_numbers.items(): - if ( - isinstance(earliest_block, int) - and earliest_block > from_block - or earliest_block == DEFAULT_FROM_BLOCK - ): - earliest_block = from_block - 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 ] - latest_block = ledger_api.api.eth.block_number try: - redeemed = [] - for from_block in range(earliest_block, latest_block, chunk_size): - to_block = min(from_block + chunk_size, latest_block) - 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_chunk = list(payout_filter.deploy(ledger_api.api).get_all_entries()) - redeemed.extend(redeemed_chunk) + 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 {earliest_block} to latest, with a step {chunk_size}," - f"as the earliest market creation transaction took place at block {earliest_block}. " - f"If this issue persists, please try lowering the step size!" + f"The service tried to filter from block {from_block} to {to_block}." + # TODO add EVENT_FILTERING_BATCH_SIZE to params + f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" ) return dict(error=msg) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index d68f4f306..67ca7b0dd 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -40,7 +40,12 @@ DecisionMakerBaseBehaviour, WaitableConditionType, ) -from packages.valory.skills.decision_maker_abci.models import MultisendBatch +from packages.valory.skills.decision_maker_abci.models import ( + DEFAULT_FROM_BLOCK, + FromBlockMappingType, + MultisendBatch, + RedeemingProgress, +) from packages.valory.skills.decision_maker_abci.payloads import RedeemPayload from packages.valory.skills.decision_maker_abci.redeem_info import ( Condition, @@ -58,6 +63,7 @@ ZERO_BYTES = bytes.fromhex(ZERO_HEX) BLOCK_TIMESTAMP_KEY = "timestamp" DEFAULT_TO_BLOCK = "latest" +EVENT_FILTERING_BATCH_SIZE = 5000 class RedeemInfoBehaviour(DecisionMakerBaseBehaviour, QueryingBehaviour, ABC): @@ -189,6 +195,16 @@ def __init__(self, **kwargs: Any) -> None: self._expected_winnings: int = 0 self._history_hash: bytes = ZERO_BYTES + @property + def redeeming_progress(self) -> RedeemingProgress: + """Get the redeeming check progress from the shared state.""" + return self.shared_state.redeeming_progress + + @redeeming_progress.setter + def redeeming_progress(self, payouts: RedeemingProgress) -> None: + """Set the redeeming check progress in the shared state.""" + self.shared_state.redeeming_progress = payouts + @property def latest_block_timestamp(self) -> int: """Get the latest block timestamp.""" @@ -254,12 +270,12 @@ def is_dust(self) -> bool: return self.current_claimable_amount < self.params.dust_threshold @property - def payouts(self) -> Dict[str, int]: + def payouts_batch(self) -> Dict[str, int]: """Get the trades' transaction hashes mapped to payouts for the current market.""" return self._payouts - @payouts.setter - def payouts(self, payouts: Dict[str, int]) -> None: + @payouts_batch.setter + def payouts_batch(self, payouts: Dict[str, int]) -> None: """Set the trades' transaction hashes mapped to payouts for the current market.""" self._payouts = payouts @@ -308,6 +324,22 @@ def built_data(self, built_data: Union[str, bytes]) -> None: """Set the built transaction's data.""" self._built_data = HexBytes(built_data) + def _store_progress(self) -> None: + """Store the redeeming progress.""" + self.redeeming_progress.trades = self.trades + self.redeeming_progress.utilized_tools = self.utilized_tools + self.redeeming_progress.policy = self.policy + self.redeeming_progress.claimable_amounts = self.claimable_amounts + self.redeeming_progress.from_block_mapping = self.from_block_mapping + + def _load_progress(self) -> None: + """Load the redeeming progress.""" + self.trades = self.redeeming_progress.trades + self.utilized_tools = self.redeeming_progress.utilized_tools + self._policy = self.redeeming_progress.policy + self.claimable_amounts = self.redeeming_progress.claimable_amounts + self.from_block_mapping = self.redeeming_progress.from_block_mapping + def _get_redeem_info( self, ) -> Generator: @@ -358,6 +390,7 @@ def _check_already_redeemed(self) -> WaitableConditionType: if len(self.trades) == 0: return True + safe_address_lower = self.synchronized_data.safe_contract_address.lower() kwargs: Dict[str, Any] = { key: [] for key in ( @@ -374,28 +407,53 @@ def _check_already_redeemed(self) -> WaitableConditionType: kwargs["condition_ids"].append(trade.fpmm.condition.id) kwargs["index_sets"].append(trade.fpmm.condition.index_sets) - kwargs["from_block_numbers"] = self.from_block_mapping + blocks = [ + block + for block in self.from_block_mapping.values() + if block != DEFAULT_FROM_BLOCK + ] + earliest_block = DEFAULT_FROM_BLOCK if len(blocks) == 0 else min(blocks) + + if not self.redeeming_progress.started: + self.redeeming_progress.from_block = earliest_block + yield from self.wait_for_condition_with_sleep(self._get_latest_block) + self.redeeming_progress.to_block = self.latest_block_timestamp + self.redeeming_progress.started = True + + for from_block in range( + self.redeeming_progress.from_block, + self.redeeming_progress.to_block, + EVENT_FILTERING_BATCH_SIZE, + ): + max_to_block = from_block + EVENT_FILTERING_BATCH_SIZE + to_block = min(max_to_block, self.redeeming_progress.to_block) + result = yield from self._conditional_tokens_interact( + contract_callable="check_redeemed", + data_key="payouts", + placeholder=get_name(RedeemBehaviour.payouts_batch), + redeemer=safe_address_lower, + from_block=from_block, + to_block=to_block, + **kwargs, + ) + if not result: + return False + self.redeeming_progress.payouts.update(self.payouts_batch) + self.redeeming_progress.from_block = to_block - safe_address_lower = self.synchronized_data.safe_contract_address.lower() - result = yield from self._conditional_tokens_interact( - contract_callable="check_redeemed", - data_key="payouts", - placeholder=get_name(RedeemBehaviour.payouts), - redeemer=safe_address_lower, - **kwargs, - ) - return result + return True def _clean_redeem_info(self) -> Generator: """Clean the redeeming information based on whether any positions have already been redeemed.""" yield from self.wait_for_condition_with_sleep(self._check_already_redeemed) - payout_so_far = sum(self.payouts.values()) + payout_so_far = sum(self.redeeming_progress.payouts.values()) if payout_so_far > 0: self.trades = { trade for trade in self.trades - if trade.fpmm.condition.id not in self.payouts.keys() + if trade.fpmm.condition.id not in self.redeeming_progress.payouts.keys() } + self.redeeming_progress.trades = self.trades msg = f"The total payout so far has been {self.wei_to_native(payout_so_far)} wxDAI." self.context.logger.info(msg) @@ -628,8 +686,17 @@ def _store_utilized_tools(self) -> None: def async_act(self) -> Generator: """Do the action.""" with self.context.benchmark_tool.measure(self.behaviour_id).local(): - yield from self._get_redeem_info() - yield from self._clean_redeem_info() + if not self.redeeming_progress.started: + yield from self._get_redeem_info() + self._store_progress() + else: + msg = "Picking up progress from where it was left off before the timeout occurred." + self.context.logger.info(msg) + self._load_progress() + + if not self.redeeming_progress.finished: + yield from self._clean_redeem_info() + agent = self.context.agent_address redeem_tx_hex = yield from self._prepare_safe_tx() tx_submitter = policy = utilized_tools = None @@ -641,5 +708,10 @@ def async_act(self) -> Generator: payload = RedeemPayload( agent, tx_submitter, redeem_tx_hex, policy, utilized_tools ) - self._store_utilized_tools() + yield from self.finish_behaviour(payload) + + def clean_up(self) -> None: + """Clean up operations.""" + self.redeeming_progress = RedeemingProgress() + self._store_utilized_tools() From 452e09b76010695930025b581e392d300a347460 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:40:53 +0200 Subject: [PATCH 10/20] refactor: make `EVENT_FILTERING_BATCH_SIZE` configurable --- packages/valory/agents/trader/aea-config.yaml | 1 + packages/valory/contracts/conditional_tokens/contract.py | 1 - packages/valory/services/trader/service.yaml | 4 ++++ .../valory/skills/decision_maker_abci/behaviours/reedem.py | 6 +++--- packages/valory/skills/decision_maker_abci/models.py | 6 ++++++ packages/valory/skills/decision_maker_abci/skill.yaml | 1 + packages/valory/skills/trader_abci/skill.yaml | 1 + 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 5ee3372b2..86dc109ab 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -184,6 +184,7 @@ models: conditional_tokens_address: ${str:0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce} realitio_proxy_address: ${str:0xAB16D643bA051C11962DA645f74632d3130c81E2} realitio_address: ${str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} + event_filtering_batch_size: ${int:5000} redeeming_batch_size: ${int:5} slippage: ${float:0.01} policy_epsilon: ${float:0.1} diff --git a/packages/valory/contracts/conditional_tokens/contract.py b/packages/valory/contracts/conditional_tokens/contract.py index fe50fe7a8..157f72dbe 100644 --- a/packages/valory/contracts/conditional_tokens/contract.py +++ b/packages/valory/contracts/conditional_tokens/contract.py @@ -69,7 +69,6 @@ def check_redeemed( 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}." - # TODO add EVENT_FILTERING_BATCH_SIZE to params f"If this issue persists, please try lowering the `EVENT_FILTERING_BATCH_SIZE`!" ) return dict(error=msg) diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index dc1830eb6..4b3317358 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -101,6 +101,7 @@ type: skill conditional_tokens_address: ${CONDITIONAL_TOKENS_ADDRESS:str:0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce} realitio_proxy_address: ${REALITIO_PROXY_ADDRESS:str:0xAB16D643bA051C11962DA645f74632d3130c81E2} realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} + event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} policy_epsilon: ${POLICY_EPSILON:float:0.1} @@ -170,6 +171,7 @@ type: skill conditional_tokens_address: ${CONDITIONAL_TOKENS_ADDRESS:str:0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce} realitio_proxy_address: ${REALITIO_PROXY_ADDRESS:str:0xAB16D643bA051C11962DA645f74632d3130c81E2} realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} + event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} policy_epsilon: ${POLICY_EPSILON:float:0.1} @@ -237,6 +239,7 @@ type: skill conditional_tokens_address: ${CONDITIONAL_TOKENS_ADDRESS:str:0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce} realitio_proxy_address: ${REALITIO_PROXY_ADDRESS:str:0xAB16D643bA051C11962DA645f74632d3130c81E2} realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} + event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} policy_epsilon: ${POLICY_EPSILON:float:0.1} @@ -304,6 +307,7 @@ type: skill conditional_tokens_address: ${CONDITIONAL_TOKENS_ADDRESS:str:0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce} realitio_proxy_address: ${REALITIO_PROXY_ADDRESS:str:0xAB16D643bA051C11962DA645f74632d3130c81E2} realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57} + event_filtering_batch_size: ${EVENT_FILTERING_BATCH_SIZE:int:5000} redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1} slippage: ${SLIPPAGE:float:0.01} policy_epsilon: ${POLICY_EPSILON:float:0.1} diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index 67ca7b0dd..b6439d1fc 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -63,7 +63,6 @@ ZERO_BYTES = bytes.fromhex(ZERO_HEX) BLOCK_TIMESTAMP_KEY = "timestamp" DEFAULT_TO_BLOCK = "latest" -EVENT_FILTERING_BATCH_SIZE = 5000 class RedeemInfoBehaviour(DecisionMakerBaseBehaviour, QueryingBehaviour, ABC): @@ -420,12 +419,13 @@ def _check_already_redeemed(self) -> WaitableConditionType: self.redeeming_progress.to_block = self.latest_block_timestamp self.redeeming_progress.started = True + batch_size = self.params.event_filtering_batch_size for from_block in range( self.redeeming_progress.from_block, self.redeeming_progress.to_block, - EVENT_FILTERING_BATCH_SIZE, + batch_size, ): - max_to_block = from_block + EVENT_FILTERING_BATCH_SIZE + max_to_block = from_block + batch_size to_block = min(max_to_block, self.redeeming_progress.to_block) result = yield from self._conditional_tokens_interact( contract_callable="check_redeemed", diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index d291d1726..d8f2b2a30 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -154,6 +154,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: "realitio_proxy_address", kwargs, str ) self.realitio_address = self._ensure("realitio_address", kwargs, str) + # this is the maximum batch size that will be used when filtering blocks for events. + # increasing this number allows for faster filtering operations, + # but also increases the chances of getting a timeout error from the RPC + self.event_filtering_batch_size = self._ensure( + "event_filtering_batch_size", kwargs, int + ) # this is the max number of redeeming operations that will be batched on a single multisend transaction. # increasing this number equals fewer fees but more chances for the transaction to fail self.redeeming_batch_size = self._ensure("redeeming_batch_size", kwargs, int) diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index e34c57b74..a76eee560 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -183,6 +183,7 @@ models: conditional_tokens_address: '0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce' realitio_proxy_address: '0xAB16D643bA051C11962DA645f74632d3130c81E2' realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57' + event_filtering_batch_size: 5000 redeeming_batch_size: 5 policy_store_path: /data/ slippage: 0.01 diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index c0843949b..f720948c4 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -166,6 +166,7 @@ models: conditional_tokens_address: '0xCeAfDD6bc0bEF976fdCd1112955828E00543c0Ce' realitio_proxy_address: '0xAB16D643bA051C11962DA645f74632d3130c81E2' realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57' + event_filtering_batch_size: 5000 redeeming_batch_size: 5 slippage: 0.01 policy_epsilon: 0.1 From 78d1b3bb1792d04afc7147887dad2b732e8d54db Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 15:46:39 +0200 Subject: [PATCH 11/20] chore: run generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- .../contracts/conditional_tokens/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 8 ++++---- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 4208a3840..c2afac4b3 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,17 +1,17 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m", - "skill/valory/trader_abci/0.1.0": "bafybeic7ztyme3wlzdykvnnpxvaxxpy4byqjxt6uunoalbz7etzo6uhfza", + "skill/valory/decision_maker_abci/0.1.0": "bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq", + "skill/valory/trader_abci/0.1.0": "bafybeicasejkmyvgmfmzjtp5koxi6fu2s5ximnhjosjv2jcp32avykgium", "contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m", - "agent/valory/trader/0.1.0": "bafybeid2e66zg5gx33xskdxmfcw7vtluvy4bwnoda3ouchu6rsmhtlkgsi", - "service/valory/trader/0.1.0": "bafybeicdmgkvyefq4fn4amoqhtfi4h5bgbidwt57fwerlpziaon3rsvmzi", + "agent/valory/trader/0.1.0": "bafybeihhyvkklgyj24t4q62nazwg45emkg6ng6n4qcosgg4rb6wacihsbi", + "service/valory/trader/0.1.0": "bafybeiezncpykn7bcgd7kkpjnu47ygax7b4zgctss2ksa3hkm447oosnwy", "contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq", "contract/valory/mech/0.1.0": "bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga", "contract/valory/realitio/0.1.0": "bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", - "contract/valory/conditional_tokens/0.1.0": "bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi", + "contract/valory/conditional_tokens/0.1.0": "bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque", "contract/valory/agent_registry/0.1.0": "bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty" }, "third_party": { diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 86dc109ab..7b3eacb3b 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:bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga -- valory/conditional_tokens:0.1.0:bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi +- valory/conditional_tokens:0.1.0:bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque - valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 protocols: @@ -41,10 +41,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq - valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 -- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m -- valory/trader_abci:0.1.0:bafybeic7ztyme3wlzdykvnnpxvaxxpy4byqjxt6uunoalbz7etzo6uhfza +- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq +- valory/trader_abci:0.1.0:bafybeicasejkmyvgmfmzjtp5koxi6fu2s5ximnhjosjv2jcp32avykgium default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/conditional_tokens/contract.yaml b/packages/valory/contracts/conditional_tokens/contract.yaml index 03acd85ac..638425b19 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: bafybeie73lgxfuhqhksqqm6mthwqyw3rau2h2eul6mp7vyswpv37vgyz2a + contract.py: bafybeigzlqbxka2fxjt2ho26ppryvf2lcxecorwtcmfybu4bhqnmpfgqri 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 4b3317358..226da2523 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:bafybeid2e66zg5gx33xskdxmfcw7vtluvy4bwnoda3ouchu6rsmhtlkgsi +agent: valory/trader:0.1.0:bafybeihhyvkklgyj24t4q62nazwg45emkg6ng6n4qcosgg4rb6wacihsbi 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 a76eee560..67c880a07 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -12,20 +12,20 @@ fingerprint: README.md: bafybeia367zzdwndvlhw27rvnwodytjo3ms7gbc3q7mhrrjqjgfasnk47i __init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky - behaviours/base.py: bafybeidny4y4w4jbjbp5d5qivur6jm37fnuik4mqzchzshiuvpozxe7vwy + behaviours/base.py: bafybeibt4fn3l52xwfat2vqn5nae2vm3ahjrddahjukkqxg33dcaumwcei behaviours/bet_placement.py: bafybeiauzdizqawjgzc3ugx33vuh726e25juhacqdr7c6uztpn6tra5dva behaviours/blacklisting.py: bafybeicl6b4hcmqmekta2mcuhkkydnzk7jmic6k44e6ns3u2ibad3awzvu behaviours/decision_receive.py: bafybeiesgn3gaj34n554apuxhq7jldtjgnir77fvnkr3tw5t4fprbvqhum behaviours/decision_request.py: bafybeibrk6jxalkgspinmjboqr3o6d6hl6mxtlkif74a5p32vp2zzhhzua behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/reedem.py: bafybeihywv5332ngbz4hhcwjbaglctblwjbfhdenppznnlxbsgnxdhrrim + behaviours/reedem.py: bafybeibzm7nofamdgudq423cwa4mt6zb2uf5czuiyml6mvhemj526fnuze behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeiadikynvkaofbko72jc45xthhmmjfmlkpgramormhxwk5u47rnwdu behaviours/tool_selection.py: bafybeigfr2frkljrxyfxs5p3j42equzehgaqtkyuxk6eiujyudr6ajqakm dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy - models.py: bafybeihy4igjg72xsgcntawxnzhimsrq2rlucmlbceeglqdgnihazoclxu + models.py: bafybeiadxxclsqs7fzirwugar7gqgng2hjnh6q2p3d2x3izar2tioxrfc4 payloads.py: bafybeiawx6ix2ljvf545fe3wocdoh7frds6gjvzgv62b3w6huaolgvywqi policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm @@ -49,7 +49,7 @@ contracts: - valory/erc20:0.1.0:bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga -- valory/conditional_tokens:0.1.0:bafybeicbkivacygycd26mqwvsp4c7velo2lpbxzwmrsgxg65prnvri6yoi +- valory/conditional_tokens:0.1.0:bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque - valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index f720948c4..769c13932 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:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 -- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeif22r6jg3lptvm2jwyxpozr4wdk63j52rpnmkq7fepst4s4dt4auq +- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq 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 fc3747311..837a8646f 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,7 +20,7 @@ contracts: [] protocols: [] skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq -- valory/decision_maker_abci:0.1.0:bafybeihcwzgpl5cgxmbi2ttqum5khnryxnp3cdrxm64q6dgerjr7weqk2m +- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq behaviours: main: args: {} From aa8cd769b9a3ca978c4b34d00fc0f8279b6414c7 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:01:38 +0200 Subject: [PATCH 12/20] fix: add missing contract --- packages/valory/agents/trader/aea-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 7b3eacb3b..9b68020ec 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -25,6 +25,7 @@ contracts: - valory/conditional_tokens:0.1.0:bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque - valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 +- valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty protocols: - open_aea/signing:1.0.0:bafybeie7xyems76v5b4wc2lmaidcujizpxfzjnnwdeokmhje53g7ym25ii - valory/abci:0.1.0:bafybeihmzlmmb4pdo3zkhg6ehuyaa4lhw7bfpclln2o2z7v3o6fcep26iu From 81ff72379b8c2e1fc37907b00545b93075b9b733 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:01:52 +0200 Subject: [PATCH 13/20] fix: add missing protocol --- packages/valory/skills/decision_maker_abci/skill.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 67c880a07..95e6780b9 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -55,6 +55,7 @@ contracts: - valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty protocols: - valory/contract_api:1.0.0:bafybeialhbjvwiwcnqq3ysxcyemobcbie7xza66gaofcvla5njezkvhcka +- valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq - valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 From d1dc582a5cc2c35fe226854709877ad1d58497ba Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:02:45 +0200 Subject: [PATCH 14/20] fix: use the decision maker's state as the parent state --- packages/valory/skills/decision_maker_abci/models.py | 5 +++-- packages/valory/skills/trader_abci/models.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index d8f2b2a30..d5fe24af8 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -26,7 +26,7 @@ from dataclasses import dataclass, field from pathlib import Path from string import Template -from typing import Any, Dict, Optional, Set, Union +from typing import Any, Dict, Optional, Set, Type, Union from aea.exceptions import enforce from aea.skills.base import SkillContext @@ -34,6 +34,7 @@ from web3.types import BlockIdentifier from packages.valory.contracts.multisend.contract import MultiSendOperation +from packages.valory.skills.abstract_round_abci.base import AbciApp from packages.valory.skills.abstract_round_abci.models import ApiSpecs from packages.valory.skills.abstract_round_abci.models import ( BenchmarkTool as BaseBenchmarkTool, @@ -91,7 +92,7 @@ def finished(self) -> bool: class SharedState(BaseSharedState): """Keep the current shared state of the skill.""" - abci_app_cls = DecisionMakerAbciApp + abci_app_cls: Type[AbciApp] = DecisionMakerAbciApp def __init__(self, *args: Any, skill_context: SkillContext, **kwargs: Any) -> None: """Initialize the state.""" diff --git a/packages/valory/skills/trader_abci/models.py b/packages/valory/skills/trader_abci/models.py index 373113b77..9d95429c0 100644 --- a/packages/valory/skills/trader_abci/models.py +++ b/packages/valory/skills/trader_abci/models.py @@ -26,9 +26,6 @@ BenchmarkTool as BaseBenchmarkTool, ) from packages.valory.skills.abstract_round_abci.models import Requests as BaseRequests -from packages.valory.skills.abstract_round_abci.models import ( - SharedState as BaseSharedState, -) from packages.valory.skills.decision_maker_abci.models import ( AgentToolsSpecs as DecisionMakerAgentToolsSpecs, ) @@ -36,6 +33,9 @@ from packages.valory.skills.decision_maker_abci.models import ( MechResponseSpecs as DecisionMakerMechResponseSpecs, ) +from packages.valory.skills.decision_maker_abci.models import ( + SharedState as BaseSharedState, +) from packages.valory.skills.decision_maker_abci.rounds import ( Event as DecisionMakerEvent, ) From 497658e19b7710bb07c2149459b1b148970a4f09 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:05:16 +0200 Subject: [PATCH 15/20] fix: use the number instead of the timestamp --- .../decision_maker_abci/behaviours/reedem.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index b6439d1fc..6973eedd4 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -61,7 +61,7 @@ ZERO_HEX = HASH_ZERO[2:] ZERO_BYTES = bytes.fromhex(ZERO_HEX) -BLOCK_TIMESTAMP_KEY = "timestamp" +BLOCK_NUMBER_KEY = "number" DEFAULT_TO_BLOCK = "latest" @@ -185,7 +185,7 @@ class RedeemBehaviour(RedeemInfoBehaviour): def __init__(self, **kwargs: Any) -> None: """Initialize `RedeemBehaviour`.""" super().__init__(**kwargs) - self._latest_block_timestamp: Optional[int] = None + self._latest_block_number: Optional[int] = None self._finalized: bool = False self._already_resolved: bool = False self._payouts: Dict[str, int] = {} @@ -205,20 +205,20 @@ def redeeming_progress(self, payouts: RedeemingProgress) -> None: self.shared_state.redeeming_progress = payouts @property - def latest_block_timestamp(self) -> int: - """Get the latest block timestamp.""" - if self._latest_block_timestamp is None: + def latest_block_number(self) -> int: + """Get the latest block number.""" + if self._latest_block_number is None: error = "Attempting to retrieve the latest block number, but it hasn't been set yet." raise ValueError(error) - return self._latest_block_timestamp + return self._latest_block_number - @latest_block_timestamp.setter - def latest_block_timestamp(self, latest_block_timestamp: str) -> None: - """Set the latest block timestamp.""" + @latest_block_number.setter + def latest_block_number(self, latest_block_number: str) -> None: + """Set the latest block number.""" try: - self._latest_block_timestamp = int(latest_block_timestamp) + self._latest_block_number = int(latest_block_number) except (TypeError, ValueError) as exc: - error = f"{latest_block_timestamp=} cannot be converted to a valid integer." + error = f"{latest_block_number=} cannot be converted to a valid integer." raise ValueError(error) from exc @property @@ -379,8 +379,8 @@ def _get_latest_block(self) -> WaitableConditionType: if ledger_api_response.performative != LedgerApiMessage.Performative.STATE: self.context.logger.error(f"Failed to get block: {ledger_api_response}") return False - self.latest_block_timestamp = ledger_api_response.state.body.get( - BLOCK_TIMESTAMP_KEY + self.latest_block_number = ledger_api_response.state.body.get( + BLOCK_NUMBER_KEY ) return True @@ -416,7 +416,7 @@ def _check_already_redeemed(self) -> WaitableConditionType: if not self.redeeming_progress.started: self.redeeming_progress.from_block = earliest_block yield from self.wait_for_condition_with_sleep(self._get_latest_block) - self.redeeming_progress.to_block = self.latest_block_timestamp + self.redeeming_progress.to_block = self.latest_block_number self.redeeming_progress.started = True batch_size = self.params.event_filtering_batch_size From 6cea961859d657bfa2581fb66139da8dfa4ed106 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:06:11 +0200 Subject: [PATCH 16/20] fix: do not use the `cleanup` as it is called on timeout --- .../skills/decision_maker_abci/behaviours/reedem.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index 6973eedd4..eef895e5f 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -35,7 +35,7 @@ from packages.valory.contracts.realitio_proxy.contract import RealitioProxyContract from packages.valory.protocols.contract_api import ContractApiMessage from packages.valory.protocols.ledger_api import LedgerApiMessage -from packages.valory.skills.abstract_round_abci.base import get_name +from packages.valory.skills.abstract_round_abci.base import BaseTxPayload, get_name from packages.valory.skills.decision_maker_abci.behaviours.base import ( DecisionMakerBaseBehaviour, WaitableConditionType, @@ -683,6 +683,12 @@ def _store_utilized_tools(self) -> None: with path.open("w") as f: json.dump(self.utilized_tools, f) + def finish_behaviour(self, payload: BaseTxPayload) -> Generator: + """Finish the behaviour.""" + self.redeeming_progress = RedeemingProgress() + self._store_utilized_tools() + yield from super().finish_behaviour(payload) + def async_act(self) -> Generator: """Do the action.""" with self.context.benchmark_tool.measure(self.behaviour_id).local(): @@ -710,8 +716,3 @@ def async_act(self) -> Generator: ) yield from self.finish_behaviour(payload) - - def clean_up(self) -> None: - """Clean up operations.""" - self.redeeming_progress = RedeemingProgress() - self._store_utilized_tools() From 53ba24a6098d3d37de9c8e01686506ca539e5c0c Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:07:21 +0200 Subject: [PATCH 17/20] fix: remove obsolete key --- packages/valory/skills/decision_maker_abci/behaviours/reedem.py | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index eef895e5f..37e388234 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -397,7 +397,6 @@ def _check_already_redeemed(self) -> WaitableConditionType: "parent_collection_ids", "condition_ids", "index_sets", - "from_block_numbers", ) } for trade in self.trades: From 6526a3b535e982c176704bcfdd54f6e8722108d0 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 18:08:11 +0200 Subject: [PATCH 18/20] refactor: use the earliest block instead of a block mapping --- .../decision_maker_abci/behaviours/reedem.py | 37 +++++++------------ .../skills/decision_maker_abci/models.py | 5 +-- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index 37e388234..58c2a3afe 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -21,7 +21,6 @@ import json from abc import ABC -from collections import defaultdict from sys import maxsize from typing import Any, Dict, Generator, Iterator, List, Optional, Set, Union @@ -41,8 +40,6 @@ WaitableConditionType, ) from packages.valory.skills.decision_maker_abci.models import ( - DEFAULT_FROM_BLOCK, - FromBlockMappingType, MultisendBatch, RedeemingProgress, ) @@ -73,11 +70,7 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.utilized_tools: Dict[str, int] = {} self.trades: Set[Trade] = set() - - # blocks in which the markets were created mapped to the corresponding condition ids - self.from_block_mapping: FromBlockMappingType = defaultdict( - lambda: DEFAULT_FROM_BLOCK - ) + self.earliest_block_number: int = 0 # this is a mapping from condition id to amount # the purpose of this attribute is to rectify the claimable amount within a redeeming information object. @@ -106,14 +99,13 @@ def _set_block_number(self, trade: Trade) -> Generator: if self._fetch_status != FetchStatus.IN_PROGRESS: break - condition_id = trade.fpmm.condition.id if self._fetch_status == FetchStatus.SUCCESS: block_number = block.get("id", "") if block_number.isdigit(): - self.from_block_mapping[condition_id] = int(block_number) + self.earliest_block_number = int(block_number) self.context.logger.info( - f"Chose block number {self.from_block_mapping[condition_id]!r} as closest to timestamp {timestamp!r}" + f"Chose block number {self.earliest_block_number!r} as closest to timestamp {timestamp!r}" ) def _update_policy(self, update: Trade) -> None: @@ -151,6 +143,7 @@ def update_redeem_info(self, chunk: list) -> Generator: <= self.synced_timestamp ) + is_first_update = True for update in trades_updates: self._update_policy(update) @@ -158,11 +151,14 @@ def update_redeem_info(self, chunk: list) -> Generator: if not update.is_winning: continue + if is_first_update: + yield from self._set_block_number(update) + is_first_update = False + condition_id = update.fpmm.condition.id - # If not in the trades, add it as is, along with its corresponding block number and claimable amount + # If not in the trades, add it as is, along with its claimable amount if update not in self.trades: self.trades.add(update) - yield from self._set_block_number(update) self.claimable_amounts[condition_id] = update.claimable_amount continue @@ -329,7 +325,7 @@ def _store_progress(self) -> None: self.redeeming_progress.utilized_tools = self.utilized_tools self.redeeming_progress.policy = self.policy self.redeeming_progress.claimable_amounts = self.claimable_amounts - self.redeeming_progress.from_block_mapping = self.from_block_mapping + self.redeeming_progress.earliest_block_number = self.earliest_block_number def _load_progress(self) -> None: """Load the redeeming progress.""" @@ -337,7 +333,7 @@ def _load_progress(self) -> None: self.utilized_tools = self.redeeming_progress.utilized_tools self._policy = self.redeeming_progress.policy self.claimable_amounts = self.redeeming_progress.claimable_amounts - self.from_block_mapping = self.redeeming_progress.from_block_mapping + self.earliest_block_number = self.redeeming_progress.earliest_block_number def _get_redeem_info( self, @@ -405,15 +401,8 @@ def _check_already_redeemed(self) -> WaitableConditionType: kwargs["condition_ids"].append(trade.fpmm.condition.id) kwargs["index_sets"].append(trade.fpmm.condition.index_sets) - blocks = [ - block - for block in self.from_block_mapping.values() - if block != DEFAULT_FROM_BLOCK - ] - earliest_block = DEFAULT_FROM_BLOCK if len(blocks) == 0 else min(blocks) - if not self.redeeming_progress.started: - self.redeeming_progress.from_block = earliest_block + self.redeeming_progress.from_block = self.earliest_block_number yield from self.wait_for_condition_with_sleep(self._get_latest_block) self.redeeming_progress.to_block = self.latest_block_number self.redeeming_progress.started = True @@ -532,7 +521,7 @@ def _build_claim_data(self) -> WaitableConditionType: contract_callable="build_claim_winnings", data_key="data", placeholder=get_name(RedeemBehaviour.built_data), - from_block=self.from_block_mapping[self.current_condition_id], + from_block=self.earliest_block_number, question_id=self.current_question_id, ) diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index d5fe24af8..bef03e4ac 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -22,7 +22,6 @@ import json import os import re -from collections import defaultdict from dataclasses import dataclass, field from pathlib import Path from string import Template @@ -75,9 +74,7 @@ class RedeemingProgress: utilized_tools: Dict[str, int] = field(default_factory=lambda: {}) policy: Optional[EGreedyPolicy] = None claimable_amounts: Dict[HexBytes, int] = field(default_factory=lambda: {}) - from_block_mapping: FromBlockMappingType = field( - default_factory=lambda: defaultdict(lambda: DEFAULT_FROM_BLOCK) - ) + earliest_block_number: int = 0 from_block: BlockIdentifier = "earliest" to_block: BlockIdentifier = "latest" payouts: Dict[str, int] = field(default_factory=lambda: {}) From 885ae116f666649330cc9fcbd4e4dbc9b00d5b1c Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 19:31:48 +0200 Subject: [PATCH 19/20] feat: store the claiming progress in case of a timeout --- .../valory/contracts/realitio/contract.py | 84 ++++++------------- .../decision_maker_abci/behaviours/reedem.py | 72 ++++++++++++---- .../skills/decision_maker_abci/models.py | 55 ++++++++++-- 3 files changed, 131 insertions(+), 80 deletions(-) diff --git a/packages/valory/contracts/realitio/contract.py b/packages/valory/contracts/realitio/contract.py index d3cdc772c..cbf501ae6 100644 --- a/packages/valory/contracts/realitio/contract.py +++ b/packages/valory/contracts/realitio/contract.py @@ -19,20 +19,19 @@ """This module contains the Realitio_v2_1 contract definition.""" -from typing import List, Tuple, Union +from typing import List, Tuple, Union, Dict -from requests.exceptions import ReadTimeout as RequestsReadTimeoutError -from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError from aea.common import JSONLike from aea.configurations.base import PublicId from aea.contracts.base import Contract from aea.crypto.base import LedgerApi from eth_typing import ChecksumAddress -from web3.constants import HASH_ZERO -from web3.types import BlockIdentifier +from requests.exceptions import ReadTimeout as RequestsReadTimeoutError +from urllib3.exceptions import ReadTimeoutError as Urllib3ReadTimeoutError -ZERO_HEX = HASH_ZERO[2:] -ZERO_BYTES = bytes.fromhex(ZERO_HEX) +ClaimParamsType = Tuple[ + List[bytes], List[ChecksumAddress], List[int], List[bytes] +] class RealitioContract(Contract): @@ -53,82 +52,53 @@ def check_finalized( return dict(finalized=is_finalized) @classmethod - def _get_claim_params( + def get_claim_params( cls, ledger_api: LedgerApi, contract_address: str, - from_block: BlockIdentifier, + from_block: int, + to_block: int, question_id: bytes, - chunk_size: int = 5_000, - ) -> Union[str, Tuple[bytes, List[bytes], List[ChecksumAddress], List[int], List[bytes]]]: + ) -> 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) - to_block = ledger_api.api.eth.block_number try: - answered = [] - for chunk in range(from_block, to_block, chunk_size): - answer_filter = contract_instance.events.LogNewAnswer.build_filter() - answer_filter.fromBlock = chunk - answer_filter.toBlock = min(chunk + chunk_size, to_block) - answer_filter.args.question_id.match_single(question_id) - answered.extend(list(answer_filter.deploy(ledger_api.api).get_all_entries())) + 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 latest, " - "as the market was created at this time. Did the market get created too long in the past?\n" - "Please consider manually redeeming for the market with question id " - f"{question_id!r} if this issue persists." + 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 - else: - n_answered = len(answered) - - if n_answered == 0: - msg = f"No answers have been given for question with id {question_id.hex()}!" - return msg + return dict(error=msg) - history_hashes = [] - addresses = [] - bonds = [] - answers = [] - for i, answer in enumerate(reversed(answered)): - # history_hashes second-last-to-first, the hash of each history entry, calculated as described here: - # https://realitio.github.io/docs/html/contract_explanation.html#answer-history-entries. - if i == n_answered - 1: - history_hashes.append(ZERO_BYTES) - else: - history_hashes.append(answered[i + 1]["args"]["history_hash"]) - - # last-to-first, the address of each answerer or commitment sender - addresses.append(answer["args"]["user"]) - # last-to-first, the bond supplied with each answer or commitment - bonds.append(answer["args"]["bond"]) - # last-to-first, each answer supplied, or commitment ID if the answer was supplied with commit->reveal - answers.append(answer["args"]["answer"]) + if len(answered) == 0: + msg = ( + f"No answers have been given for question with id {question_id.hex()} " + f"between blocks {from_block} and {to_block}." + ) + return dict(info=msg) - return question_id, history_hashes, addresses, bonds, answers + return dict(answered=answered) @classmethod def build_claim_winnings( cls, ledger_api: LedgerApi, contract_address: str, - from_block: BlockIdentifier, question_id: bytes, + claim_params: ClaimParamsType, ) -> JSONLike: """Build `claimWinnings` transaction.""" contract = cls.get_instance(ledger_api, contract_address) - claim_params = cls._get_claim_params( - ledger_api, contract_address, from_block, question_id - ) - if isinstance(claim_params, str): - return dict(error=claim_params) - data = contract.encodeABI( fn_name="claimWinnings", - args=claim_params, + args=(question_id, *claim_params), ) return dict(data=data) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py index 58c2a3afe..5e4732233 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/reedem.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/reedem.py @@ -181,6 +181,7 @@ class RedeemBehaviour(RedeemInfoBehaviour): def __init__(self, **kwargs: Any) -> None: """Initialize `RedeemBehaviour`.""" super().__init__(**kwargs) + self._claim_params_batch: list = [] self._latest_block_number: Optional[int] = None self._finalized: bool = False self._already_resolved: bool = False @@ -309,6 +310,16 @@ def already_resolved(self, flag: bool) -> None: """Set whether the current market has already been resolved.""" self._already_resolved = flag + @property + def claim_params_batch(self) -> list: + """Get the current batch of the claim parameters.""" + return self._claim_params_batch + + @claim_params_batch.setter + def claim_params_batch(self, claim_params_batch: list) -> None: + """Set the current batch of the claim parameters.""" + self._claim_params_batch = claim_params_batch + @property def built_data(self) -> HexBytes: """Get the built transaction's data.""" @@ -375,9 +386,7 @@ def _get_latest_block(self) -> WaitableConditionType: if ledger_api_response.performative != LedgerApiMessage.Performative.STATE: self.context.logger.error(f"Failed to get block: {ledger_api_response}") return False - self.latest_block_number = ledger_api_response.state.body.get( - BLOCK_NUMBER_KEY - ) + self.latest_block_number = ledger_api_response.state.body.get(BLOCK_NUMBER_KEY) return True def _check_already_redeemed(self) -> WaitableConditionType: @@ -401,20 +410,20 @@ def _check_already_redeemed(self) -> WaitableConditionType: kwargs["condition_ids"].append(trade.fpmm.condition.id) kwargs["index_sets"].append(trade.fpmm.condition.index_sets) - if not self.redeeming_progress.started: - self.redeeming_progress.from_block = self.earliest_block_number + if not self.redeeming_progress.check_started: + self.redeeming_progress.check_from_block = self.earliest_block_number yield from self.wait_for_condition_with_sleep(self._get_latest_block) - self.redeeming_progress.to_block = self.latest_block_number - self.redeeming_progress.started = True + self.redeeming_progress.check_to_block = self.latest_block_number + self.redeeming_progress.check_started = True batch_size = self.params.event_filtering_batch_size for from_block in range( - self.redeeming_progress.from_block, - self.redeeming_progress.to_block, + self.redeeming_progress.check_from_block, + self.redeeming_progress.check_to_block, batch_size, ): max_to_block = from_block + batch_size - to_block = min(max_to_block, self.redeeming_progress.to_block) + to_block = min(max_to_block, self.redeeming_progress.check_to_block) result = yield from self._conditional_tokens_interact( contract_callable="check_redeemed", data_key="payouts", @@ -427,7 +436,7 @@ def _check_already_redeemed(self) -> WaitableConditionType: if not result: return False self.redeeming_progress.payouts.update(self.payouts_batch) - self.redeeming_progress.from_block = to_block + self.redeeming_progress.check_from_block = to_block return True @@ -515,14 +524,49 @@ def _build_resolve_data(self) -> WaitableConditionType: self.multisend_batches.append(batch) return True + def get_claim_params(self) -> WaitableConditionType: + """Get the claim parameters using batches for the filtering events.""" + if not self.redeeming_progress.claim_started: + self.redeeming_progress.claim_from_block = self.earliest_block_number + self.redeeming_progress.claim_to_block = ( + self.redeeming_progress.check_to_block + ) + self.redeeming_progress.claim_started = True + + batch_size = self.params.event_filtering_batch_size + for from_block in range( + self.redeeming_progress.claim_from_block, + self.redeeming_progress.claim_to_block, + batch_size, + ): + max_to_block = from_block + batch_size + to_block = min(max_to_block, self.redeeming_progress.claim_to_block) + result = yield from self._conditional_tokens_interact( + contract_callable="get_claim_params", + data_key="claim_params", + placeholder=get_name(RedeemBehaviour.claim_params_batch), + from_block=from_block, + to_block=to_block, + question_id=self.current_question_id, + ) + if not result: + return False + self.redeeming_progress.answered.extend(self.claim_params_batch) + self.redeeming_progress.claim_from_block = to_block + + return True + def _build_claim_data(self) -> WaitableConditionType: """Prepare the safe tx to claim the winnings.""" + if not self.redeeming_progress.claim_finished: + yield from self.wait_for_condition_with_sleep(self.get_claim_params) + result = yield from self._realitio_interact( contract_callable="build_claim_winnings", data_key="data", placeholder=get_name(RedeemBehaviour.built_data), - from_block=self.earliest_block_number, question_id=self.current_question_id, + claim_params=self.redeeming_progress.claim_params, ) if not result: @@ -680,7 +724,7 @@ def finish_behaviour(self, payload: BaseTxPayload) -> Generator: def async_act(self) -> Generator: """Do the action.""" with self.context.benchmark_tool.measure(self.behaviour_id).local(): - if not self.redeeming_progress.started: + if not self.redeeming_progress.check_started: yield from self._get_redeem_info() self._store_progress() else: @@ -688,7 +732,7 @@ def async_act(self) -> Generator: self.context.logger.info(msg) self._load_progress() - if not self.redeeming_progress.finished: + if not self.redeeming_progress.check_finished: yield from self._clean_redeem_info() agent = self.context.agent_address diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index bef03e4ac..2ea38d3ca 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -25,11 +25,12 @@ from dataclasses import dataclass, field from pathlib import Path from string import Template -from typing import Any, Dict, Optional, Set, Type, Union +from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union from aea.exceptions import enforce from aea.skills.base import SkillContext from hexbytes import HexBytes +from web3.constants import HASH_ZERO from web3.types import BlockIdentifier from packages.valory.contracts.multisend.contract import MultiSendOperation @@ -48,12 +49,15 @@ from packages.valory.skills.market_manager_abci.models import MarketManagerParams +FromBlockMappingType = Dict[HexBytes, Union[int, str]] +ClaimParamsType = Tuple[List[bytes], List[str], List[int], List[bytes]] + + RE_CONTENT_IN_BRACKETS = r"\{([^}]*)\}" REQUIRED_BET_TEMPLATE_KEYS = {"yes", "no", "question"} DEFAULT_FROM_BLOCK = "earliest" - - -FromBlockMappingType = Dict[HexBytes, Union[int, str]] +ZERO_HEX = HASH_ZERO[2:] +ZERO_BYTES = bytes.fromhex(ZERO_HEX) class PromptTemplate(Template): @@ -75,15 +79,48 @@ class RedeemingProgress: policy: Optional[EGreedyPolicy] = None claimable_amounts: Dict[HexBytes, int] = field(default_factory=lambda: {}) earliest_block_number: int = 0 - from_block: BlockIdentifier = "earliest" - to_block: BlockIdentifier = "latest" + check_started: bool = False + check_from_block: BlockIdentifier = "earliest" + check_to_block: BlockIdentifier = "latest" payouts: Dict[str, int] = field(default_factory=lambda: {}) - started: bool = False + claim_started: bool = False + claim_from_block: BlockIdentifier = "earliest" + claim_to_block: BlockIdentifier = "latest" + answered: list = field(default_factory=lambda: []) @property - def finished(self) -> bool: + def check_finished(self) -> bool: """Whether the check has finished.""" - return self.started and self.from_block == self.to_block + return self.check_started and self.check_from_block == self.check_to_block + + @property + def claim_finished(self) -> bool: + """Whether the claiming has finished.""" + return self.claim_started and self.claim_from_block == self.claim_to_block + + @property + def claim_params(self) -> ClaimParamsType: + """The claim parameters, prepared for the `claimWinnings` call.""" + history_hashes = [] + addresses = [] + bonds = [] + answers = [] + for i, answer in enumerate(reversed(self.answered)): + # history_hashes second-last-to-first, the hash of each history entry, calculated as described here: + # https://realitio.github.io/docs/html/contract_explanation.html#answer-history-entries. + if i == len(self.answered) - 1: + history_hashes.append(ZERO_BYTES) + else: + history_hashes.append(self.answered[i + 1]["args"]["history_hash"]) + + # last-to-first, the address of each answerer or commitment sender + addresses.append(answer["args"]["user"]) + # last-to-first, the bond supplied with each answer or commitment + bonds.append(answer["args"]["bond"]) + # last-to-first, each answer supplied, or commitment ID if the answer was supplied with commit->reveal + answers.append(answer["args"]["answer"]) + + return history_hashes, addresses, bonds, answers class SharedState(BaseSharedState): From 6667a185b7b08b0ae4381d3f671fba7f6bda0ead Mon Sep 17 00:00:00 2001 From: Adamantios Date: Tue, 31 Oct 2023 20:34:28 +0200 Subject: [PATCH 20/20] chore: run generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- packages/valory/contracts/realitio/contract.yaml | 2 +- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 6 +++--- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index c2afac4b3..b79376665 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,15 +1,15 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4", - "skill/valory/decision_maker_abci/0.1.0": "bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq", - "skill/valory/trader_abci/0.1.0": "bafybeicasejkmyvgmfmzjtp5koxi6fu2s5ximnhjosjv2jcp32avykgium", + "skill/valory/decision_maker_abci/0.1.0": "bafybeigwmf5lrwsq4rvwmcmvdejbwcwb6zkndx5tcpljf4vvvb7fvz7nwe", + "skill/valory/trader_abci/0.1.0": "bafybeidw6qlawxhfjgvoul2lmgxx6c5hx6ehkxa6isy5fjtif4akkrskta", "contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m", - "agent/valory/trader/0.1.0": "bafybeihhyvkklgyj24t4q62nazwg45emkg6ng6n4qcosgg4rb6wacihsbi", - "service/valory/trader/0.1.0": "bafybeiezncpykn7bcgd7kkpjnu47ygax7b4zgctss2ksa3hkm447oosnwy", + "agent/valory/trader/0.1.0": "bafybeibq5he4r5okaleh7ysnoeusbmaxu7obcxiwb4obaoks6s3ai6jaea", + "service/valory/trader/0.1.0": "bafybeifgp6ml5xsjzyeehi6737fiulcupkbyjimlyfmnfg6s6nsrljol64", "contract/valory/erc20/0.1.0": "bafybeibysifjwhlcn7nntsjkowdmja53ed6urfzypi6sxfc7chtheecvpi", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeica2fsr66v7q4emhfrjsy5olplnb6asty6y4wzq76jgsvjqjii7fe", "contract/valory/mech/0.1.0": "bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga", - "contract/valory/realitio/0.1.0": "bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e", + "contract/valory/realitio/0.1.0": "bafybeid6kh4tiqswpeufkr7eowmq7seoyhkssnedgzw6pe4h7wswui6dlm", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", "contract/valory/conditional_tokens/0.1.0": "bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque", "contract/valory/agent_registry/0.1.0": "bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty" diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 9b68020ec..0719f954d 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -23,7 +23,7 @@ contracts: - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga - valory/conditional_tokens:0.1.0:bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque -- valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e +- valory/realitio:0.1.0:bafybeid6kh4tiqswpeufkr7eowmq7seoyhkssnedgzw6pe4h7wswui6dlm - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty protocols: @@ -42,10 +42,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeica2fsr66v7q4emhfrjsy5olplnb6asty6y4wzq76jgsvjqjii7fe - valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 -- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq -- valory/trader_abci:0.1.0:bafybeicasejkmyvgmfmzjtp5koxi6fu2s5ximnhjosjv2jcp32avykgium +- valory/decision_maker_abci:0.1.0:bafybeigwmf5lrwsq4rvwmcmvdejbwcwb6zkndx5tcpljf4vvvb7fvz7nwe +- valory/trader_abci:0.1.0:bafybeidw6qlawxhfjgvoul2lmgxx6c5hx6ehkxa6isy5fjtif4akkrskta default_ledger: ethereum required_ledgers: - ethereum diff --git a/packages/valory/contracts/realitio/contract.yaml b/packages/valory/contracts/realitio/contract.yaml index 3ec5122b9..bf6f146b4 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: bafybeibkmmgybvqu7tf6angouhrqmqzf6cu5piwu7jt5l4ddlren7fhkdy + contract.py: bafybeiawjv5qeouf6wac5adqzeudl5loaya3mszhc65whb22shsvivjwxm 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 226da2523..747b2cc2b 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:bafybeihhyvkklgyj24t4q62nazwg45emkg6ng6n4qcosgg4rb6wacihsbi +agent: valory/trader:0.1.0:bafybeibq5he4r5okaleh7ysnoeusbmaxu7obcxiwb4obaoks6s3ai6jaea 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 95e6780b9..effa19f9f 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: bafybeiesgn3gaj34n554apuxhq7jldtjgnir77fvnkr3tw5t4fprbvqhum behaviours/decision_request.py: bafybeibrk6jxalkgspinmjboqr3o6d6hl6mxtlkif74a5p32vp2zzhhzua behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm - behaviours/reedem.py: bafybeibzm7nofamdgudq423cwa4mt6zb2uf5czuiyml6mvhemj526fnuze + behaviours/reedem.py: bafybeic7i5tfgsl2rwbfxxpukqe6nmnpk3o6koyw2rn3xv5t5lbnubmnrq behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm behaviours/sampling.py: bafybeiadikynvkaofbko72jc45xthhmmjfmlkpgramormhxwk5u47rnwdu behaviours/tool_selection.py: bafybeigfr2frkljrxyfxs5p3j42equzehgaqtkyuxk6eiujyudr6ajqakm dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy - models.py: bafybeiadxxclsqs7fzirwugar7gqgng2hjnh6q2p3d2x3izar2tioxrfc4 + models.py: bafybeidd73nai777thcqsdofgt57hhinhxbkr6zeiypxaxa4oqjpgfyulu payloads.py: bafybeiawx6ix2ljvf545fe3wocdoh7frds6gjvzgv62b3w6huaolgvywqi policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm @@ -50,7 +50,7 @@ contracts: - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/mech:0.1.0:bafybeifaavuqr2bz7nypapjwkufc5c6vwxm5ifucmtd3w7sh42tne35nga - valory/conditional_tokens:0.1.0:bafybeifov35k2ifwagzyfvl7km6je6tmyvcqgrccldob3zmbx2af2wzque -- valory/realitio:0.1.0:bafybeic3wihpzz4deguslpzlnsgrlrabclq3njwuagyaiiv6rzqujfrs6e +- valory/realitio:0.1.0:bafybeid6kh4tiqswpeufkr7eowmq7seoyhkssnedgzw6pe4h7wswui6dlm - valory/realitio_proxy:0.1.0:bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4 - valory/agent_registry:0.1.0:bafybeifwdtwxdc2jdlhzdyxctqdmoz6zroxf5o4nhuok5l4luvnofqavty protocols: diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 769c13932..ad030eb13 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -13,7 +13,7 @@ fingerprint: dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeiaomt3gscv4pvxczc4scu6q6laza6bqhpvfi2bfiq37vksuchhqiy handlers.py: bafybeicamc6vmozij5dwvkxmbxjazsgf3sacojhstbjtq7vfggszxugvey - models.py: bafybeifj5y7qcoac72woe53zaz2lopkqir2472bbey3ypsqmprjmljms7i + models.py: bafybeihdsszlbuvustazamlav3zvaupxnsmmdv4qo526m4d6lbedaverge fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/market_manager_abci:0.1.0:bafybeidropskas24c4lcekzdbwoflhnzaglmeqxvpyuoa7cf7q2rf2yex4 -- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic7ejt5upmixi2ffb3nzjsp7scgmgnuorauljvvkup72kj5ikzmgq +- valory/decision_maker_abci:0.1.0:bafybeigwmf5lrwsq4rvwmcmvdejbwcwb6zkndx5tcpljf4vvvb7fvz7nwe +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeica2fsr66v7q4emhfrjsy5olplnb6asty6y4wzq76jgsvjqjii7fe 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 837a8646f..083bdad82 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,7 +20,7 @@ contracts: [] protocols: [] skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq -- valory/decision_maker_abci:0.1.0:bafybeibox22hch3r2ivogixgktl7jbdlnhyb67iu2ptupf4y3bn7uozvxq +- valory/decision_maker_abci:0.1.0:bafybeigwmf5lrwsq4rvwmcmvdejbwcwb6zkndx5tcpljf4vvvb7fvz7nwe behaviours: main: args: {}