Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/prometheus endpoint #369

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
383737f
feat: prometheus endpoint
annasambrook Dec 13, 2024
c97ef40
fix: metric labels
annasambrook Dec 13, 2024
547a4ba
Merge remote-tracking branch 'origin/develop' into feat/prometheus-en…
annasambrook Dec 13, 2024
b30afc8
chore: generators
annasambrook Dec 13, 2024
829bdd4
chore: generators
annasambrook Dec 16, 2024
d1c9603
Merge branch 'refs/heads/develop' into feat/prometheus-endpoint
annasambrook Dec 16, 2024
aa31df2
chore: generators
annasambrook Dec 16, 2024
a4fdacd
refactor: move wallet balance to market manager
annasambrook Dec 17, 2024
47caf37
enhance: add staking contract slots to metrics endpoint
annasambrook Dec 18, 2024
9fdab40
fix: changes after code checks
annasambrook Dec 19, 2024
662e48f
chore: generators
annasambrook Dec 19, 2024
9fec4ef
fix: add missing dependency to the skill
Adamantios Dec 19, 2024
79bb146
chore: run tox -e check-dependencies
Adamantios Dec 19, 2024
20962c8
chore: ignore missing prometheus client imports
Adamantios Dec 19, 2024
48874d5
chore: run generators
Adamantios Dec 19, 2024
0902d35
fix: registry duplicated timeseries error
annasambrook Dec 19, 2024
1565bb4
Merge remote-tracking branch 'origin/feat/prometheus-endpoint' into f…
annasambrook Dec 19, 2024
abba52b
chore: generators
annasambrook Dec 19, 2024
1e9d3a0
Update packages/valory/skills/decision_maker_abci/skill.yaml
annasambrook Dec 19, 2024
4476197
Update packages/valory/skills/market_manager_abci/skill.yaml
annasambrook Dec 19, 2024
cce8e0f
chore: autonomy packages lock
annasambrook Dec 19, 2024
ae56e81
fix: tests
annasambrook Dec 19, 2024
572ce4b
fix: test decision request payload
annasambrook Dec 19, 2024
eddd0fa
chore: generators
annasambrook Dec 19, 2024
7132eb2
fix: check stop trading payload test
annasambrook Dec 19, 2024
c37cdd2
fix: tests
annasambrook Dec 19, 2024
8edd3af
fix: keywords must be strings
annasambrook Dec 20, 2024
b565ad6
fix: yield balance check
annasambrook Dec 23, 2024
d6f1cbc
chore: generators
annasambrook Dec 23, 2024
0c54647
fix: olas balance contract call
annasambrook Dec 23, 2024
061e153
add: service owner address
annasambrook Dec 23, 2024
c979c0d
Merge branch 'refs/heads/develop' into feat/prometheus-endpoint
annasambrook Dec 23, 2024
84dbcf7
fix: servie owner address duplication
annasambrook Dec 23, 2024
518f4ec
refactor: make olas token address param
annasambrook Dec 27, 2024
204764e
fix: gitleaksignore
annasambrook Dec 27, 2024
4c6c7a1
fix: trader skill
annasambrook Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/decision_maker_a
ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154
9d8617ddd58c172f8d9dd32a7b74f22aa3d27dfb:packages/valory/skills/mech_interact_abci/skill.yaml:generic-api-key:151
0b4170ce2e876c28a9585081117e6468db17f0b9:packages/valory/services/trader_omen_gnosis/service.yaml:generic-api-key:48
0c54647f03886d75fca4522420ea72b58d6c3dcc:packages/valory/skills/market_manager_abci/behaviours.py:generic-api-key:59
ce332275857ab3dabb2c0c57330fb2137b6b77f7:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:263
518f4ec1e1b80f45420c3626613833a27b0aab5d:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:263
18 changes: 9 additions & 9 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"contract/valory/mech_activity/0.1.0": "bafybeibmqmle5fnal3gxlpdmcos2kogzra4q3pr3o5nh7shplxuilji3t4",
"contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy",
"contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4",
"skill/valory/market_manager_abci/0.1.0": "bafybeiaru2d32wpmcgqs64eepxud4idgubc3vmsbdwbia7gygipql2mmqi",
"skill/valory/decision_maker_abci/0.1.0": "bafybeig5oivc24sqhgyxfhjbl2xsoa5yssv72lcu5ezunbcpwu3xo4jglm",
"skill/valory/trader_abci/0.1.0": "bafybeicmtcs4gaabwbyr4im2ux7co73y5n6ugj4abk6dayxzew7jly2zhe",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifpf3sk5evrvwxyht7mswcml3qy4nhzo5ddvjvgklapwsjwq6mera",
"skill/valory/staking_abci/0.1.0": "bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeieduekpd4zbvjztyxyooppqnmjvup6jfp74uo6hhupvtvzzscdzkq",
"agent/valory/trader/0.1.0": "bafybeih3r5xefwfqfdmmwx3e5n3i4df7pv3mvhqlk7qen2i75anj27ds4u",
"service/valory/trader/0.1.0": "bafybeid2xxc5plszxy644kbhcqxjwmpc6ay6xqhewc2c6bb3dqv3llt63u",
"service/valory/trader_pearl/0.1.0": "bafybeiaihaivsiyotduxvnmecvdf23t42bwnphwmswxcpfdhi3k6w57gze"
"skill/valory/market_manager_abci/0.1.0": "bafybeiaempf6otwzyjssxsztskv2zdv7ohsher2wkbzemsjcv2h47zuqsi",
"skill/valory/decision_maker_abci/0.1.0": "bafybeid52rs2v2zpognldegvlfbzbtchyfccchl7zqusvnbi77h7wti77y",
"skill/valory/trader_abci/0.1.0": "bafybeihjydpznncyru7iwx2d5ti6dye2jinzfkscozjhe5iap2mayhm3uu",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihonvyfs2lc4olih2jirqmzbngccsxsrxqkkzfaqltjm7vkrnjrya",
"skill/valory/staking_abci/0.1.0": "bafybeihwaf4gimmzhytwyzujxpg4gt4iq3wpoz5zyduxhbxo2uezm2scg4",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeigcvlllbqzn632nmw3eowwkesthlqk56ls4x22tytilver4sasetq",
"agent/valory/trader/0.1.0": "bafybeidw7p5akevcfjyqvh7kzkxxe7mpceup2dl3weasfudzhpepp6ehdm",
"service/valory/trader/0.1.0": "bafybeib2utrngazrxtuf44xzcvy5szd3dwvipzr6plnukyjv3g7cgfb2ga",
"service/valory/trader_pearl/0.1.0": "bafybeif6pijjqsev6szs2cajgtnrp376xrfvw76j7jpt6ab3msxyf3kkgy"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
14 changes: 8 additions & 6 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ contracts:
- valory/service_staking_token:0.1.0:bafybeihhcs3ewwzhy7yto4y36uqmice3pdvyl54fvxxv6jsxonesie4dxu
- valory/transfer_nft_condition:0.1.0:bafybeid6z2tf7nc4rhwggktxk5f62bowxdczykrxc3y76sbt2ttlw5hmtq
- valory/erc20:0.1.0:bafybeid2p2jyvjjlcsqugnawksdzsca6ljghpqbp2kfi3cxuxoy2233dbi
- valory/relayer:0.1.0:bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4
protocols:
- open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi
- valory/abci:0.1.0:bafybeiaqmp7kocbfdboksayeqhkbrynvlfzsx4uy4x6nohywnmaig4an7u
Expand All @@ -45,12 +46,12 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba
- valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm
- valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifpf3sk5evrvwxyht7mswcml3qy4nhzo5ddvjvgklapwsjwq6mera
- valory/market_manager_abci:0.1.0:bafybeiaru2d32wpmcgqs64eepxud4idgubc3vmsbdwbia7gygipql2mmqi
- valory/decision_maker_abci:0.1.0:bafybeig5oivc24sqhgyxfhjbl2xsoa5yssv72lcu5ezunbcpwu3xo4jglm
- valory/trader_abci:0.1.0:bafybeicmtcs4gaabwbyr4im2ux7co73y5n6ugj4abk6dayxzew7jly2zhe
- valory/staking_abci:0.1.0:bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq
- valory/check_stop_trading_abci:0.1.0:bafybeieduekpd4zbvjztyxyooppqnmjvup6jfp74uo6hhupvtvzzscdzkq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihonvyfs2lc4olih2jirqmzbngccsxsrxqkkzfaqltjm7vkrnjrya
- valory/market_manager_abci:0.1.0:bafybeiaempf6otwzyjssxsztskv2zdv7ohsher2wkbzemsjcv2h47zuqsi
- valory/decision_maker_abci:0.1.0:bafybeid52rs2v2zpognldegvlfbzbtchyfccchl7zqusvnbi77h7wti77y
- valory/trader_abci:0.1.0:bafybeihjydpznncyru7iwx2d5ti6dye2jinzfkscozjhe5iap2mayhm3uu
- valory/staking_abci:0.1.0:bafybeihwaf4gimmzhytwyzujxpg4gt4iq3wpoz5zyduxhbxo2uezm2scg4
- valory/check_stop_trading_abci:0.1.0:bafybeigcvlllbqzn632nmw3eowwkesthlqk56ls4x22tytilver4sasetq
- valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm
customs:
- valory/mike_strat:0.1.0:bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m
Expand Down Expand Up @@ -249,6 +250,7 @@ models:
mech_invalid_response: ${str:Invalid Response}
mech_consecutive_failures_threshold: ${int:2}
tool_quarantine_duration: ${int:18000}
olas_token_address: ${str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
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:bafybeih3r5xefwfqfdmmwx3e5n3i4df7pv3mvhqlk7qen2i75anj27ds4u
agent: valory/trader:0.1.0:bafybeidw7p5akevcfjyqvh7kzkxxe7mpceup2dl3weasfudzhpepp6ehdm
number_of_agents: 4
deployment:
agent:
Expand Down Expand Up @@ -149,6 +149,7 @@ type: skill
mech_invalid_response: ${MECH_INVALID_RESPONSE:str:Invalid Response}
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
olas_token_address: ${OLAS_TOKEN_ADDRESS:str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
benchmark_tool: &id004
args:
log_dir: ${LOG_DIR:str:/benchmarks}
Expand Down Expand Up @@ -376,6 +377,7 @@ type: skill
mech_invalid_response: ${MECH_INVALID_RESPONSE:str:Invalid Response}
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
olas_token_address: ${OLAS_TOKEN_ADDRESS:str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
benchmark_tool: *id004
acc_info_fields: *id005
network_subgraph: *id006
Expand Down Expand Up @@ -497,6 +499,7 @@ type: skill
mech_invalid_response: ${MECH_INVALID_RESPONSE:str:Invalid Response}
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
olas_token_address: ${OLAS_TOKEN_ADDRESS:str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
benchmark_tool: *id004
acc_info_fields: *id005
network_subgraph: *id006
Expand Down Expand Up @@ -618,6 +621,7 @@ type: skill
mech_invalid_response: ${MECH_INVALID_RESPONSE:str:Invalid Response}
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
olas_token_address: ${OLAS_TOKEN_ADDRESS:str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
benchmark_tool: *id004
acc_info_fields: *id005
network_subgraph: *id006
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:bafybeih3r5xefwfqfdmmwx3e5n3i4df7pv3mvhqlk7qen2i75anj27ds4u
agent: valory/trader:0.1.0:bafybeidw7p5akevcfjyqvh7kzkxxe7mpceup2dl3weasfudzhpepp6ehdm
number_of_agents: 1
deployment:
agent:
Expand Down Expand Up @@ -107,6 +107,7 @@ models:
mech_invalid_response: ${MECH_INVALID_RESPONSE:str:Invalid Response}
mech_consecutive_failures_threshold: ${MECH_CONSECUTIVE_FAILURES_THRESHOLD:int:2}
tool_quarantine_duration: ${TOOL_QUARANTINE_DURATION:int:18000}
olas_token_address: ${OLAS_TOKEN_ADDRESS:str:0xcE11e14225575945b8E6Dc0D4F2dD4C570f79d9f}
benchmark_tool:
args:
log_dir: /benchmarks
Expand Down
25 changes: 21 additions & 4 deletions packages/valory/skills/check_stop_trading_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CheckStopTradingBehaviour(StakingInteractBaseBehaviour):
def __init__(self, **kwargs: Any) -> None:
"""Initialize the behaviour."""
super().__init__(**kwargs)
self._mech_requests_since_last_cp: int = 0
self._mech_request_count: int = 0

@property
Expand All @@ -69,6 +70,16 @@ def mech_request_count(self, mech_request_count: int) -> None:
"""Set the liveness period."""
self._mech_request_count = mech_request_count

@property
def mech_requests_since_last_cp(self) -> int:
"""Get the mech requests since last checkpoint."""
return self._mech_requests_since_last_cp

@mech_requests_since_last_cp.setter
def mech_requests_since_last_cp(self, mech_requests_since_last_cp: int) -> None:
"""Set the mech requests since last checkpoint."""
self._mech_requests_since_last_cp = mech_requests_since_last_cp

def _get_mech_request_count(self) -> WaitableConditionType:
"""Get the mech request count."""
status = yield from self.contract_interact(
Expand All @@ -89,13 +100,15 @@ def is_first_period(self) -> bool:
@property
def params(self) -> CheckStopTradingParams:
"""Return the params."""

return cast(CheckStopTradingParams, self.context.params)

def is_staking_kpi_met(self) -> Generator[None, None, bool]:
"""Return whether the staking KPI has been met (only for staked services)."""
yield from self.wait_for_condition_with_sleep(self._check_service_staked)
self.context.logger.debug(f"{self.service_staking_state=}")
if self.service_staking_state != StakingState.STAKED:
self.mech_requests_since_last_cp = 0
return False

yield from self.wait_for_condition_with_sleep(self._get_mech_request_count)
Expand All @@ -118,10 +131,10 @@ def is_staking_kpi_met(self) -> Generator[None, None, bool]:
liveness_ratio = self.liveness_ratio
self.context.logger.debug(f"{liveness_ratio=}")

mech_requests_since_last_cp = (
self.mech_requests_since_last_cp = (
mech_request_count - mech_request_count_on_last_checkpoint
)
self.context.logger.debug(f"{mech_requests_since_last_cp=}")
self.context.logger.debug(f"{self.mech_requests_since_last_cp=}")

current_timestamp = self.synced_timestamp
self.context.logger.debug(f"{current_timestamp=}")
Expand All @@ -136,7 +149,7 @@ def is_staking_kpi_met(self) -> Generator[None, None, bool]:
)
self.context.logger.debug(f"{required_mech_requests=}")

if mech_requests_since_last_cp >= required_mech_requests:
if self.mech_requests_since_last_cp >= required_mech_requests:
return True
return False

Expand Down Expand Up @@ -169,7 +182,11 @@ def async_act(self) -> Generator:
with self.context.benchmark_tool.measure(self.behaviour_id).local():
stop_trading = yield from self._compute_stop_trading()
self.context.logger.info(f"Computed {stop_trading=}")
payload = CheckStopTradingPayload(self.context.agent_address, stop_trading)
payload = CheckStopTradingPayload(
self.context.agent_address,
stop_trading,
self.mech_requests_since_last_cp,
)

with self.context.benchmark_tool.measure(self.behaviour_id).consensus():
yield from self.send_a2a_transaction(payload)
Expand Down
2 changes: 2 additions & 0 deletions packages/valory/skills/check_stop_trading_abci/payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""This module contains the transaction payloads for the check stop trading abci."""

from dataclasses import dataclass
from typing import Optional

from packages.valory.skills.abstract_round_abci.base import BaseTxPayload

Expand All @@ -29,3 +30,4 @@ class CheckStopTradingPayload(BaseTxPayload):
"""A transaction payload for the check stop trading abci."""

vote: bool
n_mech_requests_this_epoch: Optional[int]
17 changes: 16 additions & 1 deletion packages/valory/skills/check_stop_trading_abci/rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def _get_deserialized(self, key: str) -> DeserializedCollection:
serialized = self.db.get_strict(key)
return CollectionRound.deserialize_collection(serialized)

@property
def is_staking_kpi_met(self) -> bool:
"""Get the status of the staking kpi."""
return bool(self.db.get("is_staking_kpi_met", False))
Expand All @@ -77,6 +78,15 @@ class CheckStopTradingRound(VotingRound):
no_majority_event = Event.NO_MAJORITY
collection_key = get_name(SynchronizedData.participant_to_votes)

@property
def n_mech_requests_this_epoch(self) -> int:
"""Get the mech request count from the payload."""
payload = self.payloads[0]

if not hasattr(payload, "n_mech_requests_this_epoch"):
return 0
return payload.n_mech_requests_this_epoch

def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]:
"""Process the end of the block."""
res = super().end_block()
Expand All @@ -85,7 +95,12 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]:
return None

is_staking_kpi_met = self.positive_vote_threshold_reached
self.synchronized_data.update(is_staking_kpi_met=is_staking_kpi_met)
n_mech_requests_this_epoch = self.n_mech_requests_this_epoch

self.synchronized_data.update(
is_staking_kpi_met=is_staking_kpi_met,
n_mech_requests_this_epoch=n_mech_requests_this_epoch,
)

return res

Expand Down
12 changes: 6 additions & 6 deletions packages/valory/skills/check_stop_trading_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
README.md: bafybeif2pq7fg5upl6vmfgfzpiwsh4nbk4zaeyz6upyucqi5tasrxgq4ee
__init__.py: bafybeifc23rlw2hzhplp3wfceixnmwq5ztnixhh7jp4dd5av3crwp3x22a
behaviours.py: bafybeie5mkpxsd6z3vjsoacvswin6zz4q4um5gqp6jhwtn65fepx2kma3m
behaviours.py: bafybeif3edw4ddrhzivercrij3rz3wu5vhg6e35737hzg5cijv6y6gnwmi
dialogues.py: bafybeictrrnwcijiejczy23dfvbx5kujgef3dulzqhs3etl2juvz5spm2e
fsm_specification.yaml: bafybeihhau35a5xclncjpxh5lg7qiw34xs4d5qlez7dnjpkf45d3gc57ai
handlers.py: bafybeiard64fwxib3rtyp67ymhf222uongcyqhfhdyttpsyqkmyh5ajipu
models.py: bafybeigwdhgianx5rizlb7ebmm6pdtkixh4uehbvu5c24ysvyvojs74dfq
payloads.py: bafybeidh5bqywun4chrbsci2xbcrnnzuys5sswxwbxq3yl2ksawi3xsi5q
rounds.py: bafybeift7b2afck4e5so2cpgyoywa76t6el6d4qwfoitvfdjw6kgf4fwie
payloads.py: bafybeifcwsf3pkkm5wk5nbhotubdoaz2ppcx2uxn7gtzqgz63ldjk6gbwm
rounds.py: bafybeib3e4qggah6cmf4oaqcjx3z7jlzgyaklwqtvwt7xebp7ss7kd3pzi
tests/__init__.py: bafybeihv2cjk4va5bc5ncqtppqg2xmmxcro34bma36trtvk32gtmhdycxu
tests/test_dialogues.py: bafybeia5ac27w7ijx2nyx5dqyrnv4troo4572gjq7nrcxdncexoxucnqti
tests/test_handlers.py: bafybeigpmtx2hyunzn6nxk2x4bvvybek7jvuhbk34fqlj7fgfsszcoqhxy
tests/test_payloads.py: bafybeih7q7kdfxsf4ejxxqwjumwglfwwcrbqcjnuy42mkhnfwccxuhiviy
tests/test_rounds.py: bafybeidgbc7mi7r2fpk7ak6xceohuoq2zkpkberkokcb3sb2uzwkxoluae
tests/test_payloads.py: bafybeid5x5zu7bv2hp7z2hh4d43udglqdw6bjfs34sap46qoe4azmyxnry
tests/test_rounds.py: bafybeihglyjeg6pgxzro2eqk27e736l2qwiqe24ema2u2bexxyuopaez4e
fingerprint_ignore_patterns: []
connections: []
contracts:
- valory/mech:0.1.0:bafybeiejfjfoxqggghcme43sx53q5gruefrws3k2jam2opkxl5uzffoarm
protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u
- valory/staking_abci:0.1.0:bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq
- valory/staking_abci:0.1.0:bafybeihwaf4gimmzhytwyzujxpg4gt4iq3wpoz5zyduxhbxo2uezm2scg4
behaviours:
main:
args: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
def test_check_stop_trading_payload() -> None:
"""Test `CheckStopTradingPayload`."""

payload = CheckStopTradingPayload(sender="sender", vote=True)
payload = CheckStopTradingPayload(
sender="sender", vote=True, n_mech_requests_this_epoch=1
)

assert payload.vote
assert payload.data == {"vote": True}
assert payload.n_mech_requests_this_epoch
assert payload.data == {"vote": True, "mech_request_count": 1}
assert CheckStopTradingPayload.from_json(payload.json) == payload
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def get_participant_to_votes(
"""participant_to_votes"""

return {
participant: CheckStopTradingPayload(sender=participant, vote=vote)
participant: CheckStopTradingPayload(
sender=participant, vote=vote, n_mech_requests_this_epoch=1
)
for participant in participants
}

Expand All @@ -102,10 +104,11 @@ def get_participant_to_votes_serialized(
def get_payloads(
payload_cls: Type[CheckStopTradingPayload],
data: Optional[str],
mech_request_count: int,
) -> Mapping[str, CheckStopTradingPayload]:
"""Get payloads."""
return {
participant: payload_cls(participant, data is not None)
participant: payload_cls(participant, data is not None, mech_request_count)
for participant in get_participants()
}

Expand Down Expand Up @@ -198,6 +201,7 @@ class TestCheckStopTradingRound(BaseCheckStopTradingRoundTest):
payloads=get_payloads(
payload_cls=CheckStopTradingPayload,
data=get_dummy_check_stop_trading_payload_serialized(),
mech_request_count=1,
),
final_data={},
event=Event.SKIP_TRADING,
Expand All @@ -217,6 +221,7 @@ class TestCheckStopTradingRound(BaseCheckStopTradingRoundTest):
payloads=get_payloads(
payload_cls=CheckStopTradingPayload,
data=get_dummy_check_stop_trading_payload_serialized(),
mech_request_count=1,
),
final_data={},
event=Event.NO_MAJORITY,
Expand Down
Loading
Loading