From ed32b885d2c5b46b33b8449eb56dfc59443122ef Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 22 Aug 2024 16:51:17 +0530 Subject: [PATCH 01/12] market_manager_abci --- .../tests/test_dialogues.py | 28 +++ .../market_manager_abci/tests/test_rounds.py | 207 ++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 packages/valory/skills/market_manager_abci/tests/test_dialogues.py create mode 100644 packages/valory/skills/market_manager_abci/tests/test_rounds.py diff --git a/packages/valory/skills/market_manager_abci/tests/test_dialogues.py b/packages/valory/skills/market_manager_abci/tests/test_dialogues.py new file mode 100644 index 000000000..a07bc36e7 --- /dev/null +++ b/packages/valory/skills/market_manager_abci/tests/test_dialogues.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2021-2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""Test the dialogues.py module of the skill.""" + +# pylint: skip-file + +import packages.valory.skills.market_manager_abci.dialogues # noqa + + +def test_import() -> None: + """Test that the 'dialogues.py' Python module can be imported.""" \ No newline at end of file diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py new file mode 100644 index 000000000..12b6a1b7b --- /dev/null +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2023-2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This package contains the tests for rounds of MarketManagerAbciApp.""" + +import json +from dataclasses import dataclass, field +from typing import Any, Callable, Dict, FrozenSet, Hashable, List, Mapping, Optional +from unittest import mock + +import pytest + +from packages.valory.skills.abstract_round_abci.base import BaseTxPayload +from packages.valory.skills.abstract_round_abci.test_tools.rounds import ( + BaseCollectSameUntilThresholdRoundTest, +) +from packages.valory.skills.market_manager_abci.payloads import UpdateBetsPayload +from packages.valory.skills.market_manager_abci.rounds import ( + Event, + SynchronizedData, + UpdateBetsRound, + FinishedMarketManagerRound, + FailedMarketManagerRound, +) + + +DUMMY_BETS_HASH = "dummy_bets_hash" +DUMMY_PARTICIPANT_TO_BETS = { + "agent_0": "bet_1", + "agent_1": "bet_2", + "agent_2": "bet_3", +} + + +def get_participants() -> FrozenSet[str]: + """Participants""" + return frozenset([f"agent_{i}" for i in range(MAX_PARTICIPANTS)]) + + +def get_payloads( + payload_cls: BaseTxPayload, + data: Optional[str], +) -> Mapping[str, BaseTxPayload]: + """Get payloads.""" + if data is None: + return {} # Return empty dictionary if data is None + return { + participant: payload_cls(participant, data) + for participant in get_participants() + } + + +def get_dummy_update_bets_payload_serialized() -> str: + """Dummy update bets payload""" + return json.dumps( + { + "bets_hash": DUMMY_BETS_HASH, + "participant_to_bets": DUMMY_PARTICIPANT_TO_BETS, + }, + sort_keys=True, + ) + + +def get_dummy_update_bets_payload_error_serialized() -> str: + """Dummy update bets payload error""" + return json.dumps({"error": True}, sort_keys=True) + + +@dataclass +class RoundTestCase: + """RoundTestCase""" + + name: str + initial_data: Dict[str, Hashable] + payloads: Mapping[str, BaseTxPayload] + final_data: Dict[str, Hashable] + event: Event + most_voted_payload: Any + synchronized_data_attr_checks: List[Callable] = field(default_factory=list) + + +MAX_PARTICIPANTS: int = 4 + +class BaseMarketManagerRoundTestClass(BaseCollectSameUntilThresholdRoundTest): + """Base test class for MarketManager rounds.""" + + synchronized_data: SynchronizedData + _synchronized_data_class = SynchronizedData + _event_class = Event + + def run_test(self, test_case: RoundTestCase, **kwargs: Any) -> None: + """Run the test""" + + # Set initial data + self.synchronized_data.update(**test_case.initial_data) + + test_round = self.round_class( + synchronized_data=self.synchronized_data, context=mock.MagicMock() + ) + + # Add debug print to understand the input data + print(f"Running test: {test_case.name}") + print(f"Initial Data: {test_case.initial_data}") + print(f"Payloads: {test_case.payloads}") + + self._complete_run( + self._test_round( + test_round=test_round, + round_payloads=test_case.payloads, + synchronized_data_update_fn=lambda sync_data, _: sync_data.update( + **test_case.final_data + ), + synchronized_data_attr_checks=test_case.synchronized_data_attr_checks, + most_voted_payload=test_case.most_voted_payload, + exit_event=test_case.event, + ) + ) + + +class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): + """Tests for UpdateBetsRound.""" + + round_class = UpdateBetsRound + synchronized_data: SynchronizedData + _synchronized_data_class = SynchronizedData + _event_class = Event + + @pytest.mark.parametrize( + "test_case", + ( + RoundTestCase( + name="Happy path", + initial_data={}, + payloads=get_payloads( + payload_cls=UpdateBetsPayload, + data=get_dummy_update_bets_payload_serialized(), + ), + final_data={ + "bets_hash": DUMMY_BETS_HASH, + "participant_to_bets": DUMMY_PARTICIPANT_TO_BETS, + }, + event=Event.DONE, + most_voted_payload=get_dummy_update_bets_payload_serialized(), + synchronized_data_attr_checks=[ + lambda synchronized_data: synchronized_data.bets_hash == DUMMY_BETS_HASH, + lambda synchronized_data: synchronized_data.participant_to_bets == DUMMY_PARTICIPANT_TO_BETS, + ], + ), + RoundTestCase( + name="Fetch error", + initial_data={}, + payloads=get_payloads( + payload_cls=UpdateBetsPayload, + data=get_dummy_update_bets_payload_error_serialized(), + ), + final_data={}, + event=Event.FETCH_ERROR, + most_voted_payload=get_dummy_update_bets_payload_error_serialized(), + synchronized_data_attr_checks=[], + ), + RoundTestCase( + name="No majority", + initial_data={}, + payloads={}, # Handle the case with no payloads + final_data={}, + event=Event.NO_MAJORITY, + most_voted_payload=None, # Handle the case with no most voted payload + synchronized_data_attr_checks=[], + ), + ), + ) + def test_run(self, test_case: RoundTestCase) -> None: + """Run tests.""" + print(f"Running test case: {test_case.name}") + print(f"Initial Data: {test_case.initial_data}") + print(f"Payloads: {test_case.payloads}") + print(f"Expected Final Data: {test_case.final_data}") + + # Run the actual test + self.run_test(test_case) + + # Debug output after running the test + print(f"Debugging After Test:") + for behaviour_attr_getter in test_case.synchronized_data_attr_checks: + actual_value = behaviour_attr_getter(self.synchronized_data) + expected_value = behaviour_attr_getter( + deepcopy(self.synchronized_data) + ) + print(f"Attribute Getter: {behaviour_attr_getter}") + print(f"Actual Value: {actual_value}") + print(f"Expected Value: {expected_value}") From ef869812bcab8ae5b013dc6d2ff4fe8ab988ff6c Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Wed, 28 Aug 2024 17:10:33 +0530 Subject: [PATCH 02/12] debugging --- .../skills/market_manager_abci/tests/test_rounds.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 12b6a1b7b..085b6c832 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -152,8 +152,12 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): data=get_dummy_update_bets_payload_serialized(), ), final_data={ - "bets_hash": DUMMY_BETS_HASH, - "participant_to_bets": DUMMY_PARTICIPANT_TO_BETS, + "bets_hash": json.loads( + get_dummy_update_bets_payload_serialized() + )["bets_hash"], + "participant_to_bets": json.loads( + get_dummy_update_bets_payload_serialized() + )["participant_to_bets"], }, event=Event.DONE, most_voted_payload=get_dummy_update_bets_payload_serialized(), From 0cc3843c316cc6e272e1dbf3310ddc9b32138ba0 Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Fri, 30 Aug 2024 17:38:51 +0530 Subject: [PATCH 03/12] fixes:test case --- .../skills/market_manager_abci/rounds.py | 3 +- .../market_manager_abci/tests/test_rounds.py | 148 ++++++++++-------- 2 files changed, 82 insertions(+), 69 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/rounds.py b/packages/valory/skills/market_manager_abci/rounds.py index 1ac6ea310..5d01f1f83 100644 --- a/packages/valory/skills/market_manager_abci/rounds.py +++ b/packages/valory/skills/market_manager_abci/rounds.py @@ -22,7 +22,6 @@ from abc import ABC from enum import Enum from typing import Dict, Set, Tuple, Type, cast - from packages.valory.skills.abstract_round_abci.base import ( AbciApp, AbciAppTransitionFunction, @@ -66,7 +65,7 @@ def bets_hash(self) -> str: @property def participant_to_bets_hash(self) -> DeserializedCollection: """Get the participants to bets' hash.""" - return self._get_deserialized("participant_to_bets") + return self._get_deserialized("participant_to_bets_hash") class MarketManagerAbstractRound(AbstractRound[Event], ABC): diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 085b6c832..7faa902a1 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -1,30 +1,15 @@ -# -*- coding: utf-8 -*- -# ------------------------------------------------------------------------------ -# -# Copyright 2023-2024 Valory AG -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ------------------------------------------------------------------------------ - -"""This package contains the tests for rounds of MarketManagerAbciApp.""" - import json +from copy import deepcopy from dataclasses import dataclass, field from typing import Any, Callable, Dict, FrozenSet, Hashable, List, Mapping, Optional from unittest import mock +from unittest.mock import MagicMock import pytest +from packages.valory.skills.abstract_round_abci.base import ( + AbciAppDB, + get_name, +) from packages.valory.skills.abstract_round_abci.base import BaseTxPayload from packages.valory.skills.abstract_round_abci.test_tools.rounds import ( @@ -37,15 +22,30 @@ UpdateBetsRound, FinishedMarketManagerRound, FailedMarketManagerRound, + MarketManagerAbciApp ) +@pytest.fixture +def abci_app() -> MarketManagerAbciApp: + """Fixture for MarketManagerAbciApp.""" + # Create mocks for the required parameters + synchronized_data = MagicMock() + logger = MagicMock() + context = MagicMock() + + # Instantiate MarketManagerAbciApp with the required arguments + return MarketManagerAbciApp( + synchronized_data=synchronized_data, + logger=logger, + context=context + ) DUMMY_BETS_HASH = "dummy_bets_hash" -DUMMY_PARTICIPANT_TO_BETS = { +DUMMY_PARTICIPANT_TO_BETS_HASH = json.dumps({ "agent_0": "bet_1", "agent_1": "bet_2", "agent_2": "bet_3", -} +}) def get_participants() -> FrozenSet[str]: @@ -58,8 +58,6 @@ def get_payloads( data: Optional[str], ) -> Mapping[str, BaseTxPayload]: """Get payloads.""" - if data is None: - return {} # Return empty dictionary if data is None return { participant: payload_cls(participant, data) for participant in get_participants() @@ -71,7 +69,6 @@ def get_dummy_update_bets_payload_serialized() -> str: return json.dumps( { "bets_hash": DUMMY_BETS_HASH, - "participant_to_bets": DUMMY_PARTICIPANT_TO_BETS, }, sort_keys=True, ) @@ -114,11 +111,6 @@ def run_test(self, test_case: RoundTestCase, **kwargs: Any) -> None: synchronized_data=self.synchronized_data, context=mock.MagicMock() ) - # Add debug print to understand the input data - print(f"Running test: {test_case.name}") - print(f"Initial Data: {test_case.initial_data}") - print(f"Payloads: {test_case.payloads}") - self._complete_run( self._test_round( test_round=test_round, @@ -149,21 +141,15 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): initial_data={}, payloads=get_payloads( payload_cls=UpdateBetsPayload, - data=get_dummy_update_bets_payload_serialized(), + data=DUMMY_BETS_HASH, ), final_data={ - "bets_hash": json.loads( - get_dummy_update_bets_payload_serialized() - )["bets_hash"], - "participant_to_bets": json.loads( - get_dummy_update_bets_payload_serialized() - )["participant_to_bets"], + "bets_hash": DUMMY_BETS_HASH, }, event=Event.DONE, - most_voted_payload=get_dummy_update_bets_payload_serialized(), + most_voted_payload=DUMMY_BETS_HASH, synchronized_data_attr_checks=[ lambda synchronized_data: synchronized_data.bets_hash == DUMMY_BETS_HASH, - lambda synchronized_data: synchronized_data.participant_to_bets == DUMMY_PARTICIPANT_TO_BETS, ], ), RoundTestCase( @@ -171,41 +157,69 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): initial_data={}, payloads=get_payloads( payload_cls=UpdateBetsPayload, - data=get_dummy_update_bets_payload_error_serialized(), + data=None, ), final_data={}, event=Event.FETCH_ERROR, - most_voted_payload=get_dummy_update_bets_payload_error_serialized(), - synchronized_data_attr_checks=[], - ), - RoundTestCase( - name="No majority", - initial_data={}, - payloads={}, # Handle the case with no payloads - final_data={}, - event=Event.NO_MAJORITY, - most_voted_payload=None, # Handle the case with no most voted payload + most_voted_payload=None, synchronized_data_attr_checks=[], ), ), ) def test_run(self, test_case: RoundTestCase) -> None: """Run tests.""" - print(f"Running test case: {test_case.name}") - print(f"Initial Data: {test_case.initial_data}") - print(f"Payloads: {test_case.payloads}") - print(f"Expected Final Data: {test_case.final_data}") - - # Run the actual test + self.run_test(test_case) - # Debug output after running the test - print(f"Debugging After Test:") - for behaviour_attr_getter in test_case.synchronized_data_attr_checks: - actual_value = behaviour_attr_getter(self.synchronized_data) - expected_value = behaviour_attr_getter( - deepcopy(self.synchronized_data) - ) - print(f"Attribute Getter: {behaviour_attr_getter}") - print(f"Actual Value: {actual_value}") - print(f"Expected Value: {expected_value}") + + +class TestFinishedMarketManagerRound: + """Tests for FinishedMarketManagerRound.""" + + def test_finished_market_manager_round_initialization(self) -> None: + """Test the initialization of FinishedMarketManagerRound.""" + round_ = FinishedMarketManagerRound( + synchronized_data=MagicMock(), context=MagicMock() + ) + assert isinstance(round_, FinishedMarketManagerRound) + + +class TestFailedMarketManagerRound: + """Tests for FailedMarketManagerRound.""" + + def test_failed_market_manager_round_initialization(self) -> None: + """Test the initialization of FailedMarketManagerRound.""" + round_ = FailedMarketManagerRound( + synchronized_data=MagicMock(), context=MagicMock() + ) + assert isinstance(round_, FailedMarketManagerRound) + + +def test_market_manager_abci_app_initialization(abci_app: MarketManagerAbciApp) -> None: + """Test the initialization of MarketManagerAbciApp.""" + assert abci_app.initial_round_cls is UpdateBetsRound + assert abci_app.final_states == { + FinishedMarketManagerRound, + FailedMarketManagerRound, + } + assert abci_app.transition_function == { + UpdateBetsRound: { + Event.DONE: FinishedMarketManagerRound, + Event.FETCH_ERROR: FailedMarketManagerRound, + Event.ROUND_TIMEOUT: UpdateBetsRound, + Event.NO_MAJORITY: UpdateBetsRound, + }, + FinishedMarketManagerRound: {}, + FailedMarketManagerRound: {}, + } + assert abci_app.event_to_timeout == {Event.ROUND_TIMEOUT: 30.0} + assert abci_app.db_pre_conditions == {UpdateBetsRound: set()} + assert abci_app.db_post_conditions == { + FinishedMarketManagerRound: {get_name(SynchronizedData.bets_hash)}, + FailedMarketManagerRound: set(), + } + +def test_synchronized_data_initialization() -> None: + """Test the initialization and attributes of SynchronizedData.""" + data = SynchronizedData(db=AbciAppDB(setup_data={"test": ["test"]})) + assert data.db._data == {0: {"test": ["test"]}} From 471d7b67100a7e3428f8092ab53b2a8e1ac734a0 Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Wed, 4 Sep 2024 17:12:35 +0530 Subject: [PATCH 04/12] fixes: missing code --- .../market_manager_abci/tests/test_rounds.py | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 7faa902a1..6c7ed00e9 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -1,3 +1,22 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2024 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + import json from copy import deepcopy from dataclasses import dataclass, field @@ -38,7 +57,7 @@ def abci_app() -> MarketManagerAbciApp: synchronized_data=synchronized_data, logger=logger, context=context - ) + ) DUMMY_BETS_HASH = "dummy_bets_hash" DUMMY_PARTICIPANT_TO_BETS_HASH = json.dumps({ @@ -69,6 +88,7 @@ def get_dummy_update_bets_payload_serialized() -> str: return json.dumps( { "bets_hash": DUMMY_BETS_HASH, + "participnt_to_bets_hash": DUMMY_PARTICIPANT_TO_BETS_HASH, }, sort_keys=True, ) @@ -145,6 +165,7 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): ), final_data={ "bets_hash": DUMMY_BETS_HASH, + "participant_to_bets_hash": DUMMY_PARTICIPANT_TO_BETS_HASH, }, event=Event.DONE, most_voted_payload=DUMMY_BETS_HASH, @@ -170,7 +191,16 @@ def test_run(self, test_case: RoundTestCase) -> None: """Run tests.""" self.run_test(test_case) - + + def test_return_no_majority_event(self) -> None: + """Test the _return_no_majority_event method.""" + # Mock synchronized data and create an instance of the round + synchronized_data = MagicMock(spec=SynchronizedData) + update_bets_round = UpdateBetsRound(synchronized_data=synchronized_data, context=MagicMock()) + + # Call the method and check the results + result = update_bets_round._return_no_majority_event() + assert result == (synchronized_data, Event.NO_MAJORITY) class TestFinishedMarketManagerRound: From ba744bd903dc23d282672ee51c1efabc951d588b Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 5 Sep 2024 12:24:22 +0530 Subject: [PATCH 05/12] fix: missing code --- .../skills/market_manager_abci/tests/test_rounds.py | 5 +++++ tox.ini | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 6c7ed00e9..c3dbe903c 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -252,4 +252,9 @@ def test_market_manager_abci_app_initialization(abci_app: MarketManagerAbciApp) def test_synchronized_data_initialization() -> None: """Test the initialization and attributes of SynchronizedData.""" data = SynchronizedData(db=AbciAppDB(setup_data={"test": ["test"]})) + synchronized_data = SynchronizedData(db=AbciAppDB(setup_data={"participant_to_bets_hash":["participant_to_bets_hash"]})) + + # Call the _get_deserialized method + deserialized_data = synchronized_data._get_deserialized assert data.db._data == {0: {"test": ["test"]}} + diff --git a/tox.ini b/tox.ini index 9671ff90a..74da91eca 100644 --- a/tox.ini +++ b/tox.ini @@ -99,10 +99,18 @@ commands = autonomy init --reset --author ci --remote --ipfs --ipfs-node "/dns/registry.autonolas.tech/tcp/443/https" autonomy packages sync -[commands-packages] +[commands-packages] commands = {[commands-base]commands} - pytest -rfE {env:SKILLS_PATHS}/decision_maker_abci/tests --cov={env:SKILLS_PATHS}/decision_maker_abci --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc {posargs} + pytest -rfE \ + {env:SKILLS_PATHS}/decision_maker_abci/tests \ + {env:SKILLS_PATHS}/check_stop_trading_abci/tests \ + {env:SKILLS_PATHS}/market_manager_abci/tests \ + --cov={env:SKILLS_PATHS}/decision_maker_abci \ + --cov-report=xml \ + --cov-report=term \ + --cov-report=term-missing \ + --cov-config=.coveragerc {posargs} [testenv:py3.8-linux] basepython = python3.8 From 15a620a0bf182d5f78e3297f1b93ada6e3407066 Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 5 Sep 2024 13:26:10 +0530 Subject: [PATCH 06/12] fix:tox.ini --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 74da91eca..67d8e9cd4 100644 --- a/tox.ini +++ b/tox.ini @@ -107,6 +107,8 @@ commands = {env:SKILLS_PATHS}/check_stop_trading_abci/tests \ {env:SKILLS_PATHS}/market_manager_abci/tests \ --cov={env:SKILLS_PATHS}/decision_maker_abci \ + --cov={env:SKILLS_PATHS}/check_stop_trading_abci \ + --cov={env:SKILLS_PATHS}/market_manager_abci \ --cov-report=xml \ --cov-report=term \ --cov-report=term-missing \ From e01a66a70e8aaa61f7198b813f1fbf07444701ec Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 5 Sep 2024 15:10:32 +0530 Subject: [PATCH 07/12] fix:tox.ini --- tox.ini | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 67d8e9cd4..5c5eef2d8 100644 --- a/tox.ini +++ b/tox.ini @@ -104,10 +104,28 @@ commands = {[commands-base]commands} pytest -rfE \ {env:SKILLS_PATHS}/decision_maker_abci/tests \ - {env:SKILLS_PATHS}/check_stop_trading_abci/tests \ - {env:SKILLS_PATHS}/market_manager_abci/tests \ --cov={env:SKILLS_PATHS}/decision_maker_abci \ + --cov-report=xml \ + --cov-report=term \ + --cov-report=term-missing \ + --cov-config=.coveragerc {posargs} + +[commands-packages] +commands = + {[commands-base]commands} + pytest -rfE \ + {env:SKILLS_PATHS}/check_stop_trading_abci/tests \ --cov={env:SKILLS_PATHS}/check_stop_trading_abci \ + --cov-report=xml \ + --cov-report=term \ + --cov-report=term-missing \ + --cov-config=.coveragerc {posargs} + +[commands-packages] +commands = + {[commands-base]commands} + pytest -rfE \ + {env:SKILLS_PATHS}/market_manager_abci/tests \ --cov={env:SKILLS_PATHS}/market_manager_abci \ --cov-report=xml \ --cov-report=term \ From 2611787a72f3428e88e0a88578979e29d9ea9855 Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 5 Sep 2024 15:18:37 +0530 Subject: [PATCH 08/12] fix:tox.ini --- tox.ini | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/tox.ini b/tox.ini index 5c5eef2d8..1d83e9988 100644 --- a/tox.ini +++ b/tox.ini @@ -102,35 +102,9 @@ commands = [commands-packages] commands = {[commands-base]commands} - pytest -rfE \ - {env:SKILLS_PATHS}/decision_maker_abci/tests \ - --cov={env:SKILLS_PATHS}/decision_maker_abci \ - --cov-report=xml \ - --cov-report=term \ - --cov-report=term-missing \ - --cov-config=.coveragerc {posargs} - -[commands-packages] -commands = - {[commands-base]commands} - pytest -rfE \ - {env:SKILLS_PATHS}/check_stop_trading_abci/tests \ - --cov={env:SKILLS_PATHS}/check_stop_trading_abci \ - --cov-report=xml \ - --cov-report=term \ - --cov-report=term-missing \ - --cov-config=.coveragerc {posargs} - -[commands-packages] -commands = - {[commands-base]commands} - pytest -rfE \ - {env:SKILLS_PATHS}/market_manager_abci/tests \ - --cov={env:SKILLS_PATHS}/market_manager_abci \ - --cov-report=xml \ - --cov-report=term \ - --cov-report=term-missing \ - --cov-config=.coveragerc {posargs} + pytest -rfE {env:SKILLS_PATHS}/decision_maker_abci/tests --cov={env:SKILLS_PATHS}/decision_maker_abci --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc {posargs} + pytest -rfE {env:SKILLS_PATHS}/check_stop_trading_abci/tests --cov={env:SKILLS_PATHS}/check_stop_trading_abci --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc {posargs} + pytest -rfE {env:SKILLS_PATHS}/market_manager_abci/tests --cov={env:SKILLS_PATHS}/market_manager_abci --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc {posargs} [testenv:py3.8-linux] basepython = python3.8 From 905cb423ced84f8bbb58c0be8bdb7815ea2d9166 Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Thu, 5 Sep 2024 16:59:19 +0530 Subject: [PATCH 09/12] fix: synchronized --- .../market_manager_abci/tests/test_rounds.py | 63 ++++++++++++++++--- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index c3dbe903c..676ec51d3 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -22,7 +22,7 @@ from dataclasses import dataclass, field from typing import Any, Callable, Dict, FrozenSet, Hashable, List, Mapping, Optional from unittest import mock -from unittest.mock import MagicMock +from unittest.mock import MagicMock, patch import pytest from packages.valory.skills.abstract_round_abci.base import ( @@ -249,12 +249,61 @@ def test_market_manager_abci_app_initialization(abci_app: MarketManagerAbciApp) FailedMarketManagerRound: set(), } + + +# Mock serialized collections for different keys +DUMMY_PARTICIPANT_TO_BETS_HASH = { + "agent_0": {"sender": "agent_0", "data": "bet_1"}, + "agent_1": {"sender": "agent_1", "data": "bet_2"}, +} +DUMMY_BETS_HASH = {"bets_hash": "dummy_bets_hash"} + +DUMMY_SERIALIZED_PARTICIPANT_TO_BETS_HASH = json.dumps(DUMMY_PARTICIPANT_TO_BETS_HASH) +DUMMY_SERIALIZED_BETS_HASH = json.dumps(DUMMY_BETS_HASH) + + +@pytest.mark.parametrize( + "key,serialized_data,expected_result", + [ + ( + "participant_to_bets_hash", + DUMMY_SERIALIZED_PARTICIPANT_TO_BETS_HASH, + DUMMY_PARTICIPANT_TO_BETS_HASH, + ), + ( + "bets_hash", + DUMMY_SERIALIZED_BETS_HASH, + DUMMY_BETS_HASH, + ), + ], +) +@patch("packages.valory.skills.market_manager_abci.rounds.CollectionRound.deserialize_collection") +def test_synchronized_data_get_deserialized( + mock_deserialize_collection, key, serialized_data, expected_result +) -> None: + """Test the _get_deserialized method in SynchronizedData.""" + # Mock the db.get_strict to return the serialized data + mock_db = mock.MagicMock() + mock_db.get_strict.return_value = serialized_data + synchronized_data = SynchronizedData(db=mock_db) + + # Mock the deserialize_collection function to return the expected deserialized result + mock_deserialize_collection.return_value = expected_result + deserialized_data = synchronized_data._get_deserialized(key) + + # Ensure that get_strict is called with the correct key + mock_db.get_strict.assert_called_once_with(key) + + # Ensure that deserialize_collection is called with the correct serialized data + mock_deserialize_collection.assert_called_once_with(serialized_data) + + # Check that the deserialized data is correct + assert deserialized_data == expected_result + + def test_synchronized_data_initialization() -> None: """Test the initialization and attributes of SynchronizedData.""" - data = SynchronizedData(db=AbciAppDB(setup_data={"test": ["test"]})) - synchronized_data = SynchronizedData(db=AbciAppDB(setup_data={"participant_to_bets_hash":["participant_to_bets_hash"]})) - - # Call the _get_deserialized method - deserialized_data = synchronized_data._get_deserialized - assert data.db._data == {0: {"test": ["test"]}} + setup_data = {"test": ["test"]} + synchronized_data = SynchronizedData(db=AbciAppDB(setup_data=setup_data)) + assert synchronized_data.db._data == {0: {"test": ["test"]}} From 020cd3cf02305c0af786bf24590a920bf3368abd Mon Sep 17 00:00:00 2001 From: Ravleen-Solulab Date: Fri, 6 Sep 2024 13:00:46 +0530 Subject: [PATCH 10/12] code fixes --- .../skills/market_manager_abci/rounds.py | 1 + .../tests/test_dialogues.py | 2 +- .../market_manager_abci/tests/test_rounds.py | 111 +++++++++++------- 3 files changed, 73 insertions(+), 41 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/rounds.py b/packages/valory/skills/market_manager_abci/rounds.py index 5d01f1f83..ba8a16e44 100644 --- a/packages/valory/skills/market_manager_abci/rounds.py +++ b/packages/valory/skills/market_manager_abci/rounds.py @@ -22,6 +22,7 @@ from abc import ABC from enum import Enum from typing import Dict, Set, Tuple, Type, cast + from packages.valory.skills.abstract_round_abci.base import ( AbciApp, AbciAppTransitionFunction, diff --git a/packages/valory/skills/market_manager_abci/tests/test_dialogues.py b/packages/valory/skills/market_manager_abci/tests/test_dialogues.py index a07bc36e7..cdcfd1185 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_dialogues.py +++ b/packages/valory/skills/market_manager_abci/tests/test_dialogues.py @@ -25,4 +25,4 @@ def test_import() -> None: - """Test that the 'dialogues.py' Python module can be imported.""" \ No newline at end of file + """Test that the 'dialogues.py' Python module can be imported.""" diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 676ec51d3..0d1b4e547 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -17,33 +17,45 @@ # # ------------------------------------------------------------------------------ +"""This module contains the test for rounds for the MarketManager ABCI application.""" + import json -from copy import deepcopy from dataclasses import dataclass, field -from typing import Any, Callable, Dict, FrozenSet, Hashable, List, Mapping, Optional +from typing import ( + Any, + Callable, + Dict, + FrozenSet, + Hashable, + List, + Mapping, + Optional, + Type, +) from unittest import mock from unittest.mock import MagicMock, patch import pytest + from packages.valory.skills.abstract_round_abci.base import ( AbciAppDB, + BaseTxPayload, get_name, ) - -from packages.valory.skills.abstract_round_abci.base import BaseTxPayload from packages.valory.skills.abstract_round_abci.test_tools.rounds import ( BaseCollectSameUntilThresholdRoundTest, ) from packages.valory.skills.market_manager_abci.payloads import UpdateBetsPayload from packages.valory.skills.market_manager_abci.rounds import ( Event, + FailedMarketManagerRound, + FinishedMarketManagerRound, + MarketManagerAbciApp, SynchronizedData, UpdateBetsRound, - FinishedMarketManagerRound, - FailedMarketManagerRound, - MarketManagerAbciApp ) + @pytest.fixture def abci_app() -> MarketManagerAbciApp: """Fixture for MarketManagerAbciApp.""" @@ -51,20 +63,21 @@ def abci_app() -> MarketManagerAbciApp: synchronized_data = MagicMock() logger = MagicMock() context = MagicMock() - + # Instantiate MarketManagerAbciApp with the required arguments return MarketManagerAbciApp( - synchronized_data=synchronized_data, - logger=logger, - context=context - ) + synchronized_data=synchronized_data, logger=logger, context=context + ) + DUMMY_BETS_HASH = "dummy_bets_hash" -DUMMY_PARTICIPANT_TO_BETS_HASH = json.dumps({ - "agent_0": "bet_1", - "agent_1": "bet_2", - "agent_2": "bet_3", -}) +DUMMY_PARTICIPANT_TO_BETS_HASH = json.dumps( + { + "agent_0": "bet_1", + "agent_1": "bet_2", + "agent_2": "bet_3", + } +) def get_participants() -> FrozenSet[str]: @@ -73,7 +86,7 @@ def get_participants() -> FrozenSet[str]: def get_payloads( - payload_cls: BaseTxPayload, + payload_cls: Type[BaseTxPayload], data: Optional[str], ) -> Mapping[str, BaseTxPayload]: """Get payloads.""" @@ -114,12 +127,14 @@ class RoundTestCase: MAX_PARTICIPANTS: int = 4 + class BaseMarketManagerRoundTestClass(BaseCollectSameUntilThresholdRoundTest): """Base test class for MarketManager rounds.""" synchronized_data: SynchronizedData _synchronized_data_class = SynchronizedData _event_class = Event + round_class = UpdateBetsRound def run_test(self, test_case: RoundTestCase, **kwargs: Any) -> None: """Run the test""" @@ -170,7 +185,7 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): event=Event.DONE, most_voted_payload=DUMMY_BETS_HASH, synchronized_data_attr_checks=[ - lambda synchronized_data: synchronized_data.bets_hash == DUMMY_BETS_HASH, + lambda synchronized_data: synchronized_data.bets_hash, ], ), RoundTestCase( @@ -189,18 +204,20 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): ) def test_run(self, test_case: RoundTestCase) -> None: """Run tests.""" - + self.run_test(test_case) def test_return_no_majority_event(self) -> None: """Test the _return_no_majority_event method.""" # Mock synchronized data and create an instance of the round synchronized_data = MagicMock(spec=SynchronizedData) - update_bets_round = UpdateBetsRound(synchronized_data=synchronized_data, context=MagicMock()) + update_bets_round = UpdateBetsRound( + synchronized_data=synchronized_data, context=MagicMock() + ) # Call the method and check the results result = update_bets_round._return_no_majority_event() - assert result == (synchronized_data, Event.NO_MAJORITY) + assert result == (synchronized_data, Event.NO_MAJORITY) class TestFinishedMarketManagerRound: @@ -250,55 +267,69 @@ def test_market_manager_abci_app_initialization(abci_app: MarketManagerAbciApp) } - # Mock serialized collections for different keys -DUMMY_PARTICIPANT_TO_BETS_HASH = { - "agent_0": {"sender": "agent_0", "data": "bet_1"}, - "agent_1": {"sender": "agent_1", "data": "bet_2"}, -} -DUMMY_BETS_HASH = {"bets_hash": "dummy_bets_hash"} +DUMMY_PARTICIPANT_TO_BETS_HASH = json.dumps( + { + "agent_0": {"sender": "agent_0", "data": "bet_1"}, + "agent_1": {"sender": "agent_1", "data": "bet_2"}, + } +) +DUMMY_BETS_HASH = json.dumps({"bets_hash": "dummy_bets_hash"}) DUMMY_SERIALIZED_PARTICIPANT_TO_BETS_HASH = json.dumps(DUMMY_PARTICIPANT_TO_BETS_HASH) DUMMY_SERIALIZED_BETS_HASH = json.dumps(DUMMY_BETS_HASH) @pytest.mark.parametrize( - "key,serialized_data,expected_result", + "key,serialized_data,expected_result,property_to_check", [ ( "participant_to_bets_hash", DUMMY_SERIALIZED_PARTICIPANT_TO_BETS_HASH, - DUMMY_PARTICIPANT_TO_BETS_HASH, + json.loads(DUMMY_PARTICIPANT_TO_BETS_HASH), + "participant_to_bets_hash", ), ( "bets_hash", DUMMY_SERIALIZED_BETS_HASH, - DUMMY_BETS_HASH, + json.loads(DUMMY_BETS_HASH), + "bets_hash", ), ], ) -@patch("packages.valory.skills.market_manager_abci.rounds.CollectionRound.deserialize_collection") +@patch( + "packages.valory.skills.market_manager_abci.rounds.CollectionRound.deserialize_collection" +) def test_synchronized_data_get_deserialized( - mock_deserialize_collection, key, serialized_data, expected_result + mock_deserialize_collection: MagicMock, + key: str, + serialized_data: str, + expected_result: Mapping[str, Any], + property_to_check: str, ) -> None: - """Test the _get_deserialized method in SynchronizedData.""" + """Test the _get_deserialized method and properties in SynchronizedData.""" # Mock the db.get_strict to return the serialized data mock_db = mock.MagicMock() mock_db.get_strict.return_value = serialized_data + + # Initialize SynchronizedData with the mocked db synchronized_data = SynchronizedData(db=mock_db) # Mock the deserialize_collection function to return the expected deserialized result mock_deserialize_collection.return_value = expected_result - deserialized_data = synchronized_data._get_deserialized(key) + + if property_to_check == "participant_to_bets_hash": + deserialized_data = synchronized_data.participant_to_bets_hash + else: + deserialized_data = synchronized_data.bets_hash # Ensure that get_strict is called with the correct key mock_db.get_strict.assert_called_once_with(key) - # Ensure that deserialize_collection is called with the correct serialized data - mock_deserialize_collection.assert_called_once_with(serialized_data) - - # Check that the deserialized data is correct - assert deserialized_data == expected_result + # Ensure that deserialize_collection is called with the correct serialized data only for collection fields + if property_to_check == "participant_to_bets_hash": + mock_deserialize_collection.assert_called_once_with(serialized_data) + assert deserialized_data == expected_result def test_synchronized_data_initialization() -> None: From f577fccad6fa3b34987977e04b0dac613a6cc6bf Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 6 Sep 2024 13:06:55 +0300 Subject: [PATCH 11/12] fix: typing issues --- .../market_manager_abci/tests/test_rounds.py | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/tests/test_rounds.py b/packages/valory/skills/market_manager_abci/tests/test_rounds.py index 0d1b4e547..33b184c69 100644 --- a/packages/valory/skills/market_manager_abci/tests/test_rounds.py +++ b/packages/valory/skills/market_manager_abci/tests/test_rounds.py @@ -30,7 +30,7 @@ List, Mapping, Optional, - Type, + Union, ) from unittest import mock from unittest.mock import MagicMock, patch @@ -86,32 +86,15 @@ def get_participants() -> FrozenSet[str]: def get_payloads( - payload_cls: Type[BaseTxPayload], data: Optional[str], ) -> Mapping[str, BaseTxPayload]: """Get payloads.""" return { - participant: payload_cls(participant, data) + participant: UpdateBetsPayload(participant, data) for participant in get_participants() } -def get_dummy_update_bets_payload_serialized() -> str: - """Dummy update bets payload""" - return json.dumps( - { - "bets_hash": DUMMY_BETS_HASH, - "participnt_to_bets_hash": DUMMY_PARTICIPANT_TO_BETS_HASH, - }, - sort_keys=True, - ) - - -def get_dummy_update_bets_payload_error_serialized() -> str: - """Dummy update bets payload error""" - return json.dumps({"error": True}, sort_keys=True) - - @dataclass class RoundTestCase: """RoundTestCase""" @@ -136,11 +119,13 @@ class BaseMarketManagerRoundTestClass(BaseCollectSameUntilThresholdRoundTest): _event_class = Event round_class = UpdateBetsRound - def run_test(self, test_case: RoundTestCase, **kwargs: Any) -> None: + def run_test(self, test_case: RoundTestCase) -> None: """Run the test""" # Set initial data - self.synchronized_data.update(**test_case.initial_data) + self.synchronized_data.update( + self._synchronized_data_class, **test_case.initial_data + ) test_round = self.round_class( synchronized_data=self.synchronized_data, context=mock.MagicMock() @@ -175,7 +160,6 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): name="Happy path", initial_data={}, payloads=get_payloads( - payload_cls=UpdateBetsPayload, data=DUMMY_BETS_HASH, ), final_data={ @@ -192,7 +176,6 @@ class TestUpdateBetsRound(BaseMarketManagerRoundTestClass): name="Fetch error", initial_data={}, payloads=get_payloads( - payload_cls=UpdateBetsPayload, data=None, ), final_data={}, @@ -318,6 +301,7 @@ def test_synchronized_data_get_deserialized( # Mock the deserialize_collection function to return the expected deserialized result mock_deserialize_collection.return_value = expected_result + deserialized_data: Union[str, Mapping[str, BaseTxPayload]] if property_to_check == "participant_to_bets_hash": deserialized_data = synchronized_data.participant_to_bets_hash else: From 757d5f5aa7e4afdfee15b2175a630a1b96113906 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 6 Sep 2024 13:06:59 +0300 Subject: [PATCH 12/12] chore: run generators --- packages/packages.json | 14 +++++++------- packages/valory/agents/trader/aea-config.yaml | 8 ++++---- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- .../valory/skills/market_manager_abci/skill.yaml | 4 +++- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index b190dd212..01f458c42 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -15,15 +15,15 @@ "contract/valory/mech_activity/0.1.0": "bafybeiec6nnvfs6captlncrtjfygpp275vkfajvj4frrnab7thsca6337e", "contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4", "contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u", - "skill/valory/market_manager_abci/0.1.0": "bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e", - "skill/valory/decision_maker_abci/0.1.0": "bafybeigh2ajmwscmgvl3t4wkwyeclszs5ujykm5omget7yap7zmwironkq", - "skill/valory/trader_abci/0.1.0": "bafybeifjeeulkss2c4dnhzs24u63556w2vq3xxbfykxn7hcl7wirwvjqcq", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibyverkghpxz7di3wgxdixwcofrxec35b4tb4ac5pebpseax76eby", + "skill/valory/market_manager_abci/0.1.0": "bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra", + "skill/valory/decision_maker_abci/0.1.0": "bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy", + "skill/valory/trader_abci/0.1.0": "bafybeigpelxc6kppckpx4phewwyi24mejyz54fi6g5i7swnm3xi2x5olve", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibgzwhazshodynrpsowbnvy7awtl6vgzrf3yunvicgrha4hfzbsi4", "skill/valory/staking_abci/0.1.0": "bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeiat5hmo6i2r6t6ufyfnidvepixmbnppotdmztu4dad5j4hiewdh64", - "agent/valory/trader/0.1.0": "bafybeibwds53c4mtfnrymruw56o4nzmtv4zwu7nbhbxi7ix2ra4izk6tx4", - "service/valory/trader/0.1.0": "bafybeigwmrak2lnnzjx3o3la6jaxgp7tlm4wr4lks3movgveqgvwou7s7a", - "service/valory/trader_pearl/0.1.0": "bafybeigwl2i45vuovylfaymuid73x4c2efwkwcbau7dthv3k7raohfgqqy" + "agent/valory/trader/0.1.0": "bafybeibj2ezsqdnqa5kcwnhv5ke6z6fgspfxlewnkakz5ci73nmen43cpe", + "service/valory/trader/0.1.0": "bafybeibocmmtkoqnx2k4uhovfzk563ki7onukirkpex7pjnwwaesilqf7a", + "service/valory/trader_pearl/0.1.0": "bafybeigin5i6pvy4mwcgarcna2xetlhrofnnj4l7fbfiirrecpzvn3vshe" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index e729218cf..b573664c2 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -47,10 +47,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie - valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibyverkghpxz7di3wgxdixwcofrxec35b4tb4ac5pebpseax76eby -- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e -- valory/decision_maker_abci:0.1.0:bafybeigh2ajmwscmgvl3t4wkwyeclszs5ujykm5omget7yap7zmwironkq -- valory/trader_abci:0.1.0:bafybeifjeeulkss2c4dnhzs24u63556w2vq3xxbfykxn7hcl7wirwvjqcq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibgzwhazshodynrpsowbnvy7awtl6vgzrf3yunvicgrha4hfzbsi4 +- valory/market_manager_abci:0.1.0:bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra +- valory/decision_maker_abci:0.1.0:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy +- valory/trader_abci:0.1.0:bafybeigpelxc6kppckpx4phewwyi24mejyz54fi6g5i7swnm3xi2x5olve - valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi - valory/check_stop_trading_abci:0.1.0:bafybeiat5hmo6i2r6t6ufyfnidvepixmbnppotdmztu4dad5j4hiewdh64 - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 4957ba9fa..bd0a928fe 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:bafybeibwds53c4mtfnrymruw56o4nzmtv4zwu7nbhbxi7ix2ra4izk6tx4 +agent: valory/trader:0.1.0:bafybeibj2ezsqdnqa5kcwnhv5ke6z6fgspfxlewnkakz5ci73nmen43cpe number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index b427fa875..540be3783 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeibwds53c4mtfnrymruw56o4nzmtv4zwu7nbhbxi7ix2ra4izk6tx4 +agent: valory/trader:0.1.0:bafybeibj2ezsqdnqa5kcwnhv5ke6z6fgspfxlewnkakz5ci73nmen43cpe number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 786f8208d..eb00cdd54 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -85,7 +85,7 @@ protocols: - valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae skills: - valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui -- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e +- valory/market_manager_abci:0.1.0:bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e behaviours: diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index ea81341a8..0f1a57752 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -24,10 +24,12 @@ fingerprint: handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu models.py: bafybeibjttnga54y4auz6f33ecfrngyw53b2xzpompm72drjsr4xoytmiy payloads.py: bafybeicfymvvtdpkcgmkvthfzmb7dqakepkzslqrz6rcs7nxkz7qq3mrzy - rounds.py: bafybeigdwc4sr7gvxth4suaz36x7fmrn3jhlertwq4rcch4clyuxq435wa + rounds.py: bafybeiflb2k6ritv5tlexlfxyg2okadtviijprqnc7sa7zxdlhr7nnqxfy tests/__init__.py: bafybeigaewntxawezvygss345kytjijo56bfwddjtfm6egzxfajsgojam4 + tests/test_dialogues.py: bafybeiet646su5nsjmvruahuwg6un4uvwzyj2lnn2jvkye6cxooz22f3ja tests/test_handlers.py: bafybeiaz3idwevvlplcyieaqo5oeikuthlte6e2gi4ajw452ylvimwgiki tests/test_payloads.py: bafybeidvld43p5c4wpwi7m6rfzontkheqqgxdchjnme5b54wmldojc5dmm + tests/test_rounds.py: bafybeidahkavof43y3o4omnihh6yxdx7gqofio7kzukdydymxbebylempu fingerprint_ignore_patterns: [] connections: [] contracts: [] diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index db01e5186..3a2e90685 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -26,9 +26,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie - valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote - valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq -- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e -- valory/decision_maker_abci:0.1.0:bafybeigh2ajmwscmgvl3t4wkwyeclszs5ujykm5omget7yap7zmwironkq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibyverkghpxz7di3wgxdixwcofrxec35b4tb4ac5pebpseax76eby +- valory/market_manager_abci:0.1.0:bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra +- valory/decision_maker_abci:0.1.0:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibgzwhazshodynrpsowbnvy7awtl6vgzrf3yunvicgrha4hfzbsi4 - valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi - valory/check_stop_trading_abci:0.1.0:bafybeiat5hmo6i2r6t6ufyfnidvepixmbnppotdmztu4dad5j4hiewdh64 - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 64d0f16e4..e97464c4a 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui -- valory/decision_maker_abci:0.1.0:bafybeigh2ajmwscmgvl3t4wkwyeclszs5ujykm5omget7yap7zmwironkq +- valory/decision_maker_abci:0.1.0:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy - valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi - valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e behaviours: