Skip to content

Commit

Permalink
generators
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravleen-Solulab committed Sep 16, 2024
1 parent 6edb6f2 commit c569c94
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 63 deletions.
12 changes: 6 additions & 6 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4",
"contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u",
"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": "bafybeieya5jxda7vacxeaowaoyafqtyldzjsloxnj5gcnschxoicfmua3y",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeic6w4wdyvicy3mvmvskp3fg2snthofb3z5kmqhfohqfiv65k7hlgq",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifxnl3jg3h6ophtowo3c5ar24x5vsfa32nkrbxzccxsaqi4bp3jiu",
"skill/valory/trader_abci/0.1.0": "bafybeibbmpo6xajxg4wrzdkqhguvizqy7peifmhon3o3tvhzgwpvu7zqoe",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeih2x6y5jt3ypuca4ekv2an5s4v2v7l3wlv2ft6mseulogfdppalgy",
"skill/valory/staking_abci/0.1.0": "bafybeiegy5iny4x3jk2kjuykebxksoqhfl7irdcldbcwzrsvpopxooys2q",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeif6w4uc3pzrbuuhyktgehvwsq2gxv6udeivhlhijlguhmctxokdqa",
"agent/valory/trader/0.1.0": "bafybeibm4sgqk4yn5ywszcpjyml5th7ln7kogexyaww3p6ot4n3anmekbu",
"service/valory/trader/0.1.0": "bafybeign7gk2aitnzesypm5wek6sbuhapt34abhgzmn7mtm2rhlqvoy6pu",
"service/valory/trader_pearl/0.1.0": "bafybeifxjejy4sy5fyb6geiljtyn26eusidyesiltcx32dcc3b7y7sj27q"
"agent/valory/trader/0.1.0": "bafybeidnvrdll7ivqfapt2ji3y3vmgil3m6jvwk2y56muubzbvidb7qh7u",
"service/valory/trader/0.1.0": "bafybeiboty3qi7wbqehwtthowknga73tw5j2ysmx5xt6rpkaxsjl2yxqaq",
"service/valory/trader_pearl/0.1.0": "bafybeifzvid4rvku4axuuy4cxhc372jhhdonqudgbuxotmvktfu2m2jmqq"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:bafybeic6w4wdyvicy3mvmvskp3fg2snthofb3z5kmqhfohqfiv65k7hlgq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih2x6y5jt3ypuca4ekv2an5s4v2v7l3wlv2ft6mseulogfdppalgy
- valory/market_manager_abci:0.1.0:bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra
- valory/decision_maker_abci:0.1.0:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy
- valory/trader_abci:0.1.0:bafybeieya5jxda7vacxeaowaoyafqtyldzjsloxnj5gcnschxoicfmua3y
- valory/decision_maker_abci:0.1.0:bafybeifxnl3jg3h6ophtowo3c5ar24x5vsfa32nkrbxzccxsaqi4bp3jiu
- valory/trader_abci:0.1.0:bafybeibbmpo6xajxg4wrzdkqhguvizqy7peifmhon3o3tvhzgwpvu7zqoe
- valory/staking_abci:0.1.0:bafybeiegy5iny4x3jk2kjuykebxksoqhfl7irdcldbcwzrsvpopxooys2q
- valory/check_stop_trading_abci:0.1.0:bafybeif6w4uc3pzrbuuhyktgehvwsq2gxv6udeivhlhijlguhmctxokdqa
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeibm4sgqk4yn5ywszcpjyml5th7ln7kogexyaww3p6ot4n3anmekbu
agent: valory/trader:0.1.0:bafybeidnvrdll7ivqfapt2ji3y3vmgil3m6jvwk2y56muubzbvidb7qh7u
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader_pearl/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeibm4sgqk4yn5ywszcpjyml5th7ln7kogexyaww3p6ot4n3anmekbu
agent: valory/trader:0.1.0:bafybeidnvrdll7ivqfapt2ji3y3vmgil3m6jvwk2y56muubzbvidb7qh7u
number_of_agents: 1
deployment:
agent:
Expand Down
2 changes: 2 additions & 0 deletions packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ fingerprint:
tests/behaviours/dummy_strategy/dummy_strategy.py: bafybeig5e3xfr7gxsakfj4stbxqcwdiljl7klvgahkuwe3obzxgkg3qt2e
tests/behaviours/test_base.py: bafybeif6pglmr7pvojylatfzaxtlk65igx6a2omyrbxfihnnft6o7p75p4
tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude
tests/test_dialogues.py: bafybeibbfupq3fmbgxofpzj24r7mcipyj7zjnzc5xusjchluj6hx6asdim
tests/test_handlers.py: bafybeihpkgtjjm3uegpup6zkznpoaxqpu6kmp3ujiggrzbe73p5fzlq7im
tests/test_payloads.py: bafybeigsftkoc7ursy7okfznbwfiy3pk2kitndfgbn35ebbz4yoptkw3zy
tests/test_rounds.py: bafybeigqrh7trm3qp2vz3lfgve6gx56v5jjxgvxsilcq2swvqcpndfdci4
utils/__init__.py: bafybeiazrfg3kwfdl5q45azwz6b6mobqxngxpf4hazmrnkhinpk4qhbbf4
utils/nevermined.py: bafybeigallaqxhqopznhjhefr6bukh4ojkz5vdtqyzod5dksshrf24fjgi
utils/scaling.py: bafybeialr3z4zogp4k3l2bzcjfi4igvxzjexmlpgze2bai2ufc3plaow4y
Expand Down
110 changes: 61 additions & 49 deletions packages/valory/skills/decision_maker_abci/tests/test_rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,53 @@

"""This module contains the test for rounds for the DecisionMaker ABCI application."""

import pytest
from unittest.mock import MagicMock

import pytest

from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp
from packages.valory.skills.decision_maker_abci.states.base import Event
from packages.valory.skills.decision_maker_abci.states.bet_placement import BetPlacementRound
from packages.valory.skills.decision_maker_abci.states.blacklisting import BlacklistingRound
from packages.valory.skills.decision_maker_abci.states.check_benchmarking import CheckBenchmarkingModeRound
from packages.valory.skills.decision_maker_abci.states.claim_subscription import ClaimRound
from packages.valory.skills.decision_maker_abci.states.decision_receive import DecisionReceiveRound
from packages.valory.skills.decision_maker_abci.states.decision_request import DecisionRequestRound
from packages.valory.skills.decision_maker_abci.states.base import (
Event,
SynchronizedData,
)
from packages.valory.skills.decision_maker_abci.states.bet_placement import (
BetPlacementRound,
)
from packages.valory.skills.decision_maker_abci.states.blacklisting import (
BlacklistingRound,
)
from packages.valory.skills.decision_maker_abci.states.check_benchmarking import (
CheckBenchmarkingModeRound,
)
from packages.valory.skills.decision_maker_abci.states.claim_subscription import (
ClaimRound,
)
from packages.valory.skills.decision_maker_abci.states.decision_receive import (
DecisionReceiveRound,
)
from packages.valory.skills.decision_maker_abci.states.decision_request import (
DecisionRequestRound,
)
from packages.valory.skills.decision_maker_abci.states.final_states import (
BenchmarkingDoneRound,
BenchmarkingModeDisabledRound,
FinishedDecisionMakerRound,
FinishedDecisionRequestRound,
FinishedSubscriptionRound,
FinishedWithoutDecisionRound,
FinishedWithoutRedeemingRound,
ImpossibleRound,
RefillRequiredRound,
)
from packages.valory.skills.decision_maker_abci.states.order_subscription import (
SubscriptionRound,
)
from packages.valory.skills.decision_maker_abci.states.randomness import RandomnessRound
from packages.valory.skills.decision_maker_abci.states.redeem import RedeemRound
from packages.valory.skills.decision_maker_abci.states.sampling import SamplingRound
from packages.valory.skills.decision_maker_abci.states.tool_selection import ToolSelectionRound


from packages.valory.skills.decision_maker_abci.states.base import SynchronizedData
from packages.valory.skills.decision_maker_abci.states.tool_selection import (
ToolSelectionRound,
)


@pytest.fixture
def setup_app():
def setup_app() -> DecisionMakerAbciApp:
"""Set up the initial app instance for testing."""
# Create mock objects for the required arguments
synchronized_data = MagicMock(spec=SynchronizedData)
Expand All @@ -65,132 +76,133 @@ def setup_app():
return DecisionMakerAbciApp(synchronized_data, logger, context)


def test_initial_state(setup_app):
def test_initial_state(setup_app: DecisionMakerAbciApp) -> None:
"""Test the initial round of the application."""
app = setup_app
assert app.initial_round_cls == CheckBenchmarkingModeRound
assert CheckBenchmarkingModeRound in app.initial_states




def test_check_benchmarking_transition(setup_app):
def test_check_benchmarking_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from CheckBenchmarkingModeRound."""
app = setup_app
transition_function = app.transition_function[CheckBenchmarkingModeRound]

# Transition on benchmarking enabled
assert transition_function[Event.BENCHMARKING_ENABLED] == RandomnessRound

# Transition on benchmarking disabled
assert transition_function[Event.BENCHMARKING_DISABLED] == BenchmarkingModeDisabledRound

assert (
transition_function[Event.BENCHMARKING_DISABLED]
== BenchmarkingModeDisabledRound
)

# Test no majority
assert transition_function[Event.NO_MAJORITY] == CheckBenchmarkingModeRound


def test_sampling_round_transition(setup_app):
def test_sampling_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from SamplingRound."""
app = setup_app
transition_function = app.transition_function[SamplingRound]

# Transition on done
assert transition_function[Event.DONE] == SubscriptionRound

# Test none and no majority
assert transition_function[Event.NONE] == FinishedWithoutDecisionRound
assert transition_function[Event.NO_MAJORITY] == SamplingRound


def test_subscription_round_transition(setup_app):
def test_subscription_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from SubscriptionRound."""
app = setup_app
transition_function = app.transition_function[SubscriptionRound]

# Transition on done
assert transition_function[Event.DONE] == FinishedSubscriptionRound

# Mock transaction cases
assert transition_function[Event.MOCK_TX] == RandomnessRound
assert transition_function[Event.NO_SUBSCRIPTION] == RandomnessRound


def test_claim_round_transition(setup_app):
def test_claim_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from ClaimRound."""
app = setup_app
transition_function = app.transition_function[ClaimRound]

# Test transition on done
assert transition_function[Event.DONE] == RandomnessRound


def test_randomness_round_transition(setup_app):
def test_randomness_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from RandomnessRound."""
app = setup_app
transition_function = app.transition_function[RandomnessRound]

# Transition on done
assert transition_function[Event.DONE] == ToolSelectionRound


def test_tool_selection_round_transition(setup_app):
def test_tool_selection_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from ToolSelectionRound."""
app = setup_app
transition_function = app.transition_function[ToolSelectionRound]

# Test transition on done
assert transition_function[Event.DONE] == DecisionRequestRound


def test_decision_request_round_transition(setup_app):
def test_decision_request_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from DecisionRequestRound."""
app = setup_app
transition_function = app.transition_function[DecisionRequestRound]

# Test transition on done
assert transition_function[Event.DONE] == FinishedDecisionRequestRound
assert transition_function[Event.MOCK_MECH_REQUEST] == DecisionReceiveRound


def test_decision_receive_round_transition(setup_app):
def test_decision_receive_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from DecisionReceiveRound."""
app = setup_app
transition_function = app.transition_function[DecisionReceiveRound]

# Test transition on done
assert transition_function[Event.DONE] == BetPlacementRound


def test_blacklisting_round_transition(setup_app):
def test_blacklisting_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from BlacklistingRound."""
app = setup_app
transition_function = app.transition_function[BlacklistingRound]

# Test transition on done
assert transition_function[Event.DONE] == FinishedWithoutDecisionRound


def test_bet_placement_round_transition(setup_app):
def test_bet_placement_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from BetPlacementRound."""
app = setup_app
transition_function = app.transition_function[BetPlacementRound]

# Test transition on done
assert transition_function[Event.DONE] == FinishedDecisionMakerRound


def test_redeem_round_transition(setup_app):
def test_redeem_round_transition(setup_app: DecisionMakerAbciApp) -> None:
"""Test transitions from RedeemRound."""
app = setup_app
transition_function = app.transition_function[RedeemRound]

# Test transition on done
assert transition_function[Event.DONE] == FinishedDecisionMakerRound


def test_final_states(setup_app):
def test_final_states(setup_app: DecisionMakerAbciApp) -> None:
"""Test the final states of the application."""
app = setup_app
assert FinishedDecisionMakerRound in app.final_states
assert BenchmarkingModeDisabledRound in app.final_states
assert FinishedWithoutDecisionRound in app.final_states
assert FinishedWithoutDecisionRound in app.final_states
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/market_manager_abci:0.1.0:bafybeicymkyk7e5rohauml6xazai6mv2rqd3euz3ifbk2ftfkylhpgo4ra
- valory/decision_maker_abci:0.1.0:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic6w4wdyvicy3mvmvskp3fg2snthofb3z5kmqhfohqfiv65k7hlgq
- valory/decision_maker_abci:0.1.0:bafybeifxnl3jg3h6ophtowo3c5ar24x5vsfa32nkrbxzccxsaqi4bp3jiu
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih2x6y5jt3ypuca4ekv2an5s4v2v7l3wlv2ft6mseulogfdppalgy
- valory/staking_abci:0.1.0:bafybeiegy5iny4x3jk2kjuykebxksoqhfl7irdcldbcwzrsvpopxooys2q
- valory/check_stop_trading_abci:0.1.0:bafybeif6w4uc3pzrbuuhyktgehvwsq2gxv6udeivhlhijlguhmctxokdqa
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:bafybeicr3o4z5ytp6njmsxlj3p6cbaxyad6tdv5kyoxaeon5da2wn6hxqy
- valory/decision_maker_abci:0.1.0:bafybeifxnl3jg3h6ophtowo3c5ar24x5vsfa32nkrbxzccxsaqi4bp3jiu
- valory/staking_abci:0.1.0:bafybeiegy5iny4x3jk2kjuykebxksoqhfl7irdcldbcwzrsvpopxooys2q
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
behaviours:
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ 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}
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}/staking_abci/tests --cov={env:SKILLS_PATHS}/staking_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}

[testenv:py3.8-linux]
basepython = python3.8
Expand Down

0 comments on commit c569c94

Please sign in to comment.