From 1b5189381173a6f2b7ca04be48fbfb8dfbc09c7d Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 22 Dec 2023 17:35:43 +0200 Subject: [PATCH 1/2] fix: init the cross-period keys also in case of a timeout --- .../decision_maker_abci/states/redeem.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/states/redeem.py b/packages/valory/skills/decision_maker_abci/states/redeem.py index dbcc2f670..6ea59a33c 100644 --- a/packages/valory/skills/decision_maker_abci/states/redeem.py +++ b/packages/valory/skills/decision_maker_abci/states/redeem.py @@ -20,7 +20,7 @@ """This module contains the redeem state of the decision-making abci app.""" from enum import Enum -from typing import Optional, Tuple, Type, cast +from typing import Optional, Tuple, Type from packages.valory.skills.abstract_round_abci.base import ( BaseSynchronizedData, @@ -52,17 +52,17 @@ class RedeemRound(TxPreparationRound): def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]: """Process the end of the block.""" res = super().end_block() - if res is None: - return None - - synced_data, event = cast(Tuple[SynchronizedData, Enum], res) - - if synced_data.period_count == 0: - # necessary for persisted keys to function properly and not raise an exception when the first period ends + if ( + res is None + and self.block_confirmations == self.synchronized_data.period_count == 0 + ): + # necessary for always setting the persisted keys and not raise an exception when the first period ends + # this also protects us in case a round timeout is raised update = { - db_key: synced_data.db.get(db_key, None) + db_key: self.synchronized_data.db.get(db_key, None) for db_key in RedeemRound.selection_key } - synced_data.db.update(**update) + self.synchronized_data.db.update(**update) + self.block_confirmations = 1 - return synced_data, event + return res From e5e5e00dcd8421664236310e6eafea388b010227 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 22 Dec 2023 18:06:04 +0200 Subject: [PATCH 2/2] chore: run generators --- packages/packages.json | 10 +++++----- packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 5bad9b0de..e75a5a4b5 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeievf7r6kz4z3hz2po6tkugjcmlk56xbrb5ixpoqb45evz57zjuuka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeic63dvasakghgtxgjcrhviqlmkipr6rm52jmwxvx3k7iewvaxbwzy", - "skill/valory/trader_abci/0.1.0": "bafybeido6xxqc5s7wlaeipwbwch6jcpwtxkgvegozwbprqzfzf6cxihwnm", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiaeb7ks3sbhi6ygdjjtgkyjp35wuh3nal5e65rup54a366wbxp3qu", + "skill/valory/trader_abci/0.1.0": "bafybeiajpkxe6qovbieyokuawf6qujuni4tlupvya4mllj727rra5vcw2a", "contract/valory/market_maker/0.1.0": "bafybeihcueo3ct3h5fqyrwsjeofr5winyxlnegnwdvofopwhrfzkhgpxte", - "agent/valory/trader/0.1.0": "bafybeideojzh53zu4mp3z3duxpke2iomnbh6k2ig2bhwyeo53i6hjflfsy", - "service/valory/trader/0.1.0": "bafybeiemzzkhhvzfzm5kthiucryomynomnfqs6f24ttqawtgacd4c2z2hy", + "agent/valory/trader/0.1.0": "bafybeibmmx3u7zmefqkrwuzm36mkwtbsx5fj2ft6746bgdyqmpiff2gozy", + "service/valory/trader/0.1.0": "bafybeiduuhqknqgq76rawaqrdsfaasndh46fsbdrtgmn4c3nekmlxgznea", "contract/valory/erc20/0.1.0": "bafybeiecuaahlywb2rw6s76av5rdqg4gad6j753to6aqrix7zmbbt6kj6q", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigxc2zgyyndtxfwvmv2xnafvhbh2ndnjj454vsjlt5f4n7ed45a7m", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibra6ic3i5ozllzbzpoke4wm4lyz7jc7gedtr4asfk64m6vc2scyi", "contract/valory/mech/0.1.0": "bafybeigmkbovcb6wcfqkkmmryo6kzqsai5qq325lzmsvtlxe4fn6rcmwoy", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 8dc3a0385..690ff4066 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeida6w2afp4m3dvnbkbwxz67ozjlry3wpsbkxwz7usalm3o2ghy46u - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/transaction_settlement_abci:0.1.0:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigxc2zgyyndtxfwvmv2xnafvhbh2ndnjj454vsjlt5f4n7ed45a7m +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibra6ic3i5ozllzbzpoke4wm4lyz7jc7gedtr4asfk64m6vc2scyi - valory/market_manager_abci:0.1.0:bafybeievf7r6kz4z3hz2po6tkugjcmlk56xbrb5ixpoqb45evz57zjuuka -- valory/decision_maker_abci:0.1.0:bafybeic63dvasakghgtxgjcrhviqlmkipr6rm52jmwxvx3k7iewvaxbwzy -- valory/trader_abci:0.1.0:bafybeido6xxqc5s7wlaeipwbwch6jcpwtxkgvegozwbprqzfzf6cxihwnm +- valory/decision_maker_abci:0.1.0:bafybeiaeb7ks3sbhi6ygdjjtgkyjp35wuh3nal5e65rup54a366wbxp3qu +- valory/trader_abci:0.1.0:bafybeiajpkxe6qovbieyokuawf6qujuni4tlupvya4mllj727rra5vcw2a - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 1d28c5653..c8e13bbfc 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:bafybeideojzh53zu4mp3z3duxpke2iomnbh6k2ig2bhwyeo53i6hjflfsy +agent: valory/trader:0.1.0:bafybeibmmx3u7zmefqkrwuzm36mkwtbsx5fj2ft6746bgdyqmpiff2gozy 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 a3bda8ea4..531adce1e 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -40,7 +40,7 @@ fingerprint: states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu states/final_states.py: bafybeidiwhuyd5zm2cq7vhv2owcrxdpm7fnvn3db6p6tql4jz5hgpalflu states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm - states/redeem.py: bafybeie63laufsdxhf4vngmon5lne7cpmvvosqervp6l2riysqnwuotzim + states/redeem.py: bafybeiblidmpt73ocac73wmakusrnf5267vs7s2foc5pqkrz4vuqgy3b4u states/sampling.py: bafybeidnvdogjlthjfe7jpaiuezm3xydrbxxukyoss4gx6t5fdin52rsta states/tool_selection.py: bafybeiaaijv6dukp3bmsptcwkcmumc6wu6ztzkvaqzsqqjbfn4ozgyuykq tests/__init__.py: bafybeiakpi3k3kc7wrjj7hrluvjcj36lu2gezpmrctwiz5yg2fe7ggnf3i diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 8c5028cf1..35c087d7d 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:bafybeidsfwslnbhhhplvgteeec7idrhm7gxpay4f36wwnkgl4mh7ogovke - valory/termination_abci:0.1.0:bafybeid5ipudhwuiuhbzvpn4usgdm3a3ow3naafuefvetmgbbcy6ugyuwi - valory/market_manager_abci:0.1.0:bafybeievf7r6kz4z3hz2po6tkugjcmlk56xbrb5ixpoqb45evz57zjuuka -- valory/decision_maker_abci:0.1.0:bafybeic63dvasakghgtxgjcrhviqlmkipr6rm52jmwxvx3k7iewvaxbwzy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigxc2zgyyndtxfwvmv2xnafvhbh2ndnjj454vsjlt5f4n7ed45a7m +- valory/decision_maker_abci:0.1.0:bafybeiaeb7ks3sbhi6ygdjjtgkyjp35wuh3nal5e65rup54a366wbxp3qu +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibra6ic3i5ozllzbzpoke4wm4lyz7jc7gedtr4asfk64m6vc2scyi - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 2802a1291..4eaae77f0 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeidbmd2cgffqqfwsyxws5dffsc6nbt5ijgkbhyzse5i42yddmwqlpy -- valory/decision_maker_abci:0.1.0:bafybeic63dvasakghgtxgjcrhviqlmkipr6rm52jmwxvx3k7iewvaxbwzy +- valory/decision_maker_abci:0.1.0:bafybeiaeb7ks3sbhi6ygdjjtgkyjp35wuh3nal5e65rup54a366wbxp3qu - valory/staking_abci:0.1.0:bafybeihmfcd3kp2jwt4zznoxcwyutyqmfg6myi3buehtaznpq6qfcu4l6u behaviours: main: