Skip to content

Commit

Permalink
Merge pull request #391 from valory-xyz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
annasambrook authored Jan 22, 2025
2 parents b590c9e + c723e0c commit b331127
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ security:
.PHONY: generators
generators: clean-cache fix-abci-app-specs
tox -e abci-docstrings
tomte format-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription --exclude-part mech --exclude-part mech_interact_abci --exclude-part http_server
tomte format-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription --exclude-part mech --exclude-part mech_interact_abci --exclude-part http_server --exclude-part mech_marketplace
autonomy packages lock
tox -e fix-doc-hashes

.PHONY: common-checks-1
common-checks-1:
tomte check-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription --exclude-part mech --exclude-part mech_interact_abci --exclude-part http_server
tomte check-copyright --author valory --exclude-part abci --exclude-part http_client --exclude-part ipfs --exclude-part ledger --exclude-part p2p_libp2p_client --exclude-part gnosis_safe --exclude-part gnosis_safe_proxy_factory --exclude-part multisend --exclude-part service_registry --exclude-part protocols --exclude-part abstract_abci --exclude-part abstract_round_abci --exclude-part registration_abci --exclude-part reset_pause_abci --exclude-part termination_abci --exclude-part transaction_settlement_abci --exclude-part websocket_client --exclude-part contract_subscription --exclude-part mech --exclude-part mech_interact_abci --exclude-part http_server --exclude-part mech_marketplace
tomte check-doc-links
tox -p -e check-hash -e check-packages -e check-doc-hashes -e analyse-service

Expand Down
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"contract/valory/relayer/0.1.0": "bafybeicreijhjycqrutdpbdn3vdcpmo233y3p66l3ovmr2goa2y2e6bshy",
"skill/valory/market_manager_abci/0.1.0": "bafybeiayhzwxlpqsevyvaxn6dtnnu745az5vcz7dckmghnmjywxdtvoyly",
"skill/valory/decision_maker_abci/0.1.0": "bafybeibi3b4tnal6c6cypszogn7iskerpolmueddeagnyt3fv65vhvxebq",
"skill/valory/trader_abci/0.1.0": "bafybeibxqfzlio67343yyeq25edo3xq3etsdko2x2ajubmiw46zasqzlka",
"skill/valory/trader_abci/0.1.0": "bafybeias2rt775gh5357uw5tbw3n7acdyp5yhx6x4noa3aqqqluselnkju",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiharmlmnezdeuyfzbq27ds7jtnbqrvo62k4qj34cdbjstwqe5occu",
"skill/valory/staking_abci/0.1.0": "bafybeiaasclr4lf3u2layekmfwyasckxrslbs2g4me7kvozz5goswlznjq",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeic3bismocli2yyxmjhjsevjbzpuf3ladsvlkazfx23vq3q6uxrn7m",
"agent/valory/trader/0.1.0": "bafybeidl42iyu5h6stfnpj3bbffg3uqzzwush5yqfdgwnpvzllukzkvylu",
"service/valory/trader/0.1.0": "bafybeigkiawzpbkwh7fxn6dvodn4xenpoa3nl5fdsx27fieudevv7qiybm",
"service/valory/trader_pearl/0.1.0": "bafybeif7owuohd5cfqn3k7pon34jkedlsbwc6o3g22s3s6l4fah2apnpya"
"agent/valory/trader/0.1.0": "bafybeib3y24ugudzpcgrqxfpuuhfihj2hzo4yx3am2gnel2zm4xlem237a",
"service/valory/trader/0.1.0": "bafybeicrabjh7amxbvhixacdwfefr2z6ekrqdpvm5gqmxr7mj4cbbvg4wi",
"service/valory/trader_pearl/0.1.0": "bafybeibk35wotlk4h7vjplcccjggk5w7ri6jjsdts7iuo4dzisvcxnqxsa"
},
"third_party": {
"protocol/valory/acn_data_share/0.1.0": "bafybeidbvo3jdbt54pqk3foqfso4uim2vaea5abg6jzktomdeklh6sm2rq",
Expand Down
3 changes: 2 additions & 1 deletion packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ skills:
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiharmlmnezdeuyfzbq27ds7jtnbqrvo62k4qj34cdbjstwqe5occu
- valory/market_manager_abci:0.1.0:bafybeiayhzwxlpqsevyvaxn6dtnnu745az5vcz7dckmghnmjywxdtvoyly
- valory/decision_maker_abci:0.1.0:bafybeibi3b4tnal6c6cypszogn7iskerpolmueddeagnyt3fv65vhvxebq
- valory/trader_abci:0.1.0:bafybeibxqfzlio67343yyeq25edo3xq3etsdko2x2ajubmiw46zasqzlka
- valory/trader_abci:0.1.0:bafybeias2rt775gh5357uw5tbw3n7acdyp5yhx6x4noa3aqqqluselnkju
- valory/staking_abci:0.1.0:bafybeiaasclr4lf3u2layekmfwyasckxrslbs2g4me7kvozz5goswlznjq
- valory/check_stop_trading_abci:0.1.0:bafybeic3bismocli2yyxmjhjsevjbzpuf3ladsvlkazfx23vq3q6uxrn7m
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
Expand Down Expand Up @@ -248,6 +248,7 @@ models:
mech_consecutive_failures_threshold: ${int:2}
tool_quarantine_duration: ${int:18000}
default_chain_id: ${str:gnosis}
mech_interact_round_timeout_seconds: ${int:5400}
benchmarking_mode:
args:
enabled: ${bool:false}
Expand Down
6 changes: 5 additions & 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:bafybeidl42iyu5h6stfnpj3bbffg3uqzzwush5yqfdgwnpvzllukzkvylu
agent: valory/trader:0.1.0:bafybeib3y24ugudzpcgrqxfpuuhfihj2hzo4yx3am2gnel2zm4xlem237a
number_of_agents: 4
deployment:
agent:
Expand Down Expand Up @@ -150,6 +150,7 @@ type: skill
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
default_chain_id: ${DEFAULT_CHAIN_ID:str:gnosis}
mech_interact_round_timeout_seconds: ${MECH_INTERACT_ROUND_TIMEOUT_SECONDS:int:5400}
benchmark_tool: &id003
args:
log_dir: ${LOG_DIR:str:/benchmarks}
Expand Down Expand Up @@ -372,6 +373,7 @@ type: skill
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
default_chain_id: ${DEFAULT_CHAIN_ID:str:gnosis}
mech_interact_round_timeout_seconds: ${MECH_INTERACT_ROUND_TIMEOUT_SECONDS:int:5400}
benchmark_tool: *id003
acc_info_fields: *id004
network_subgraph: *id005
Expand Down Expand Up @@ -495,6 +497,7 @@ type: skill
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
default_chain_id: ${DEFAULT_CHAIN_ID:str:gnosis}
mech_interact_round_timeout_seconds: ${MECH_INTERACT_ROUND_TIMEOUT_SECONDS:int:5400}
benchmark_tool: *id003
acc_info_fields: *id004
network_subgraph: *id005
Expand Down Expand Up @@ -618,6 +621,7 @@ type: skill
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
default_chain_id: ${DEFAULT_CHAIN_ID:str:gnosis}
mech_interact_round_timeout_seconds: ${MECH_INTERACT_ROUND_TIMEOUT_SECONDS:int:5400}
benchmark_tool: *id003
acc_info_fields: *id004
network_subgraph: *id005
Expand Down
3 changes: 2 additions & 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:bafybeidl42iyu5h6stfnpj3bbffg3uqzzwush5yqfdgwnpvzllukzkvylu
agent: valory/trader:0.1.0:bafybeib3y24ugudzpcgrqxfpuuhfihj2hzo4yx3am2gnel2zm4xlem237a
number_of_agents: 1
deployment:
agent:
Expand Down Expand Up @@ -102,6 +102,7 @@ models:
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
default_chain_id: ${DEFAULT_CHAIN_ID:str:gnosis}
mech_interact_round_timeout_seconds: ${MECH_INTERACT_ROUND_TIMEOUT_SECONDS:int:5400}
benchmark_tool:
args:
log_dir: /benchmarks
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/composition.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
# Copyright 2023-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -129,7 +129,7 @@
FinishedMechRequestRound: PreTxSettlementRound,
FinishedMechRequestTxRound: MechResponseRound,
FinishedMechResponseRound: DecisionReceiveRound,
FinishedMechResponseTimeoutRound: MechResponseRound,
FinishedMechResponseTimeoutRound: HandleFailedTxRound,
FinishedMechRequestSkipRound: RedeemRound,
FinishedSubscriptionRound: PreTxSettlementRound,
FinishedBetPlacementTxRound: RedeemRound,
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/trader_abci/fsm_specification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ transition_func:
(MechRequestRound, SKIP_REQUEST): RedeemRound
(MechResponseRound, DONE): DecisionReceiveRound
(MechResponseRound, NO_MAJORITY): MechResponseRound
(MechResponseRound, ROUND_TIMEOUT): MechResponseRound
(MechResponseRound, ROUND_TIMEOUT): HandleFailedTxRound
(PostTxSettlementRound, BET_PLACEMENT_DONE): RedeemRound
(PostTxSettlementRound, MECH_REQUESTING_DONE): MechResponseRound
(PostTxSettlementRound, REDEEMING_DONE): CallCheckpointRound
Expand Down
44 changes: 34 additions & 10 deletions packages/valory/skills/trader_abci/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
# Copyright 2023-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@

"""Custom objects for the trader ABCI application."""

from typing import Dict, Type, Union, cast
from typing import Any, Dict, Type, Union, cast

from packages.valory.skills.abstract_round_abci.models import ApiSpecs
from packages.valory.skills.abstract_round_abci.models import (
Expand Down Expand Up @@ -64,6 +64,7 @@
from packages.valory.skills.mech_interact_abci.models import (
MechResponseSpecs as BaseMechResponseSpecs,
)
from packages.valory.skills.mech_interact_abci.rounds import Event as MechInteractEvent
from packages.valory.skills.reset_pause_abci.rounds import Event as ResetPauseEvent
from packages.valory.skills.termination_abci.models import TerminationParams
from packages.valory.skills.trader_abci.composition import TraderAbciApp
Expand All @@ -78,9 +79,16 @@
Type[DecisionMakerEvent],
Type[TSEvent],
Type[ResetPauseEvent],
Type[MechInteractEvent],
]
EventToTimeoutMappingType = Dict[
Union[MarketManagerEvent, DecisionMakerEvent, TSEvent, ResetPauseEvent],
Union[
MarketManagerEvent,
DecisionMakerEvent,
TSEvent,
ResetPauseEvent,
MechInteractEvent,
],
float,
]

Expand Down Expand Up @@ -116,6 +124,13 @@ class TraderParams(
):
"""A model to represent the trader params."""

def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Initialize the parameters object."""
self.mech_interact_round_timeout_seconds: int = self._ensure(
"mech_interact_round_timeout_seconds", kwargs, type_=int
)
super().__init__(*args, **kwargs)


class SharedState(BaseSharedState):
"""Keep the current shared state of the skill."""
Expand All @@ -131,19 +146,28 @@ def setup(self) -> None:
"""Set up."""
super().setup()

events = (MarketManagerEvent, DecisionMakerEvent, TSEvent, ResetPauseEvent)
round_timeout = self.params.round_timeout_seconds
params = self.params
events = (
MarketManagerEvent,
DecisionMakerEvent,
TSEvent,
ResetPauseEvent,
)
round_timeout = params.round_timeout_seconds
round_timeout_overrides = {
cast(EventType, event).ROUND_TIMEOUT: round_timeout for event in events
}
reset_pause_timeout = self.params.reset_pause_duration + MARGIN
round_timeout_overrides[
MechInteractEvent.ROUND_TIMEOUT
] = params.mech_interact_round_timeout_seconds
reset_pause_timeout = params.reset_pause_duration + MARGIN
event_to_timeout_overrides: EventToTimeoutMappingType = {
**round_timeout_overrides,
TSEvent.RESET_TIMEOUT: round_timeout,
TSEvent.VALIDATE_TIMEOUT: self.params.validate_timeout,
TSEvent.FINALIZE_TIMEOUT: self.params.finalize_timeout,
TSEvent.CHECK_TIMEOUT: self.params.history_check_timeout,
DecisionMakerEvent.REDEEM_ROUND_TIMEOUT: self.params.redeem_round_timeout,
TSEvent.VALIDATE_TIMEOUT: params.validate_timeout,
TSEvent.FINALIZE_TIMEOUT: params.finalize_timeout,
TSEvent.CHECK_TIMEOUT: params.history_check_timeout,
DecisionMakerEvent.REDEEM_ROUND_TIMEOUT: params.redeem_round_timeout,
ResetPauseEvent.RESET_AND_PAUSE_TIMEOUT: reset_pause_timeout,
}

Expand Down
7 changes: 4 additions & 3 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ fingerprint:
README.md: bafybeiab4xgadptz4mhvno4p6xvkh7p4peg7iuhotabydriu74dmj6ljga
__init__.py: bafybeido7wa33h4dtleap57vzgyb4fsofk4vindsqcekyfo5i56i2rll2a
behaviours.py: bafybeigc6hszbu66ccajny5eh7thfgsrlr36je4mzziwp4mupgvtaeu6aa
composition.py: bafybeifxerfvssuhodqmtvkz6umlmrmdqjv5ptpszhnwlavzxaavdpdyly
composition.py: bafybeievziz7cajszkw3ugfd3xn6ycktms463kefxjk2qlcyyh73couqg4
dialogues.py: bafybeihouxm2nl2r6h3vlymmtrge43tcnwphtzhc2q3vludpgytigggguy
fsm_specification.yaml: bafybeigbedgadqt46yqw5qkm7yb2q4atiodwvruh7yuo6g6qyht76lniea
fsm_specification.yaml: bafybeid6u6esbfsahu3xqcgkpbsfhffghc3jgizgmzqbc4ww7wtjbkhuay
handlers.py: bafybeigrqsgqupy6kds2vqieacsymx3eucntwl52rlgi4cu4lrb6bglhti
models.py: bafybeigbnyvpuh7qq3bsgmcb27e6fz2kirp74eios55acar4352opv4ggm
models.py: bafybeiaf53hymwsqtvhm3bugly37id3hqitq5zyjjinvrhlbbl2aqedqiu
tests/__init__.py: bafybeiadatapyjh3e7ucg2ehz77oms3ihrbutwb2cs2tkjehy54utwvuyi
tests/tests_handlers.py: bafybeifxvd63qblqpsmyvj7k4dbqubab2pshao5zd2zs2srs7rt32zvciu
fingerprint_ignore_patterns: []
Expand Down Expand Up @@ -252,6 +252,7 @@ models:
mech_consecutive_failures_threshold: 2
tool_quarantine_duration: 18000
default_chain_id: gnosis
mech_interact_round_timeout_seconds: 5400
class_name: TraderParams
benchmarking_mode:
args:
Expand Down
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b331127

Please sign in to comment.