Skip to content

Commit

Permalink
Merge pull request #773 from valory-xyz/fix/get-tx-receipt-failed-txs
Browse files Browse the repository at this point in the history
fix: get tx receipt should return even if reverted tx
  • Loading branch information
0xArdi authored Dec 12, 2024
2 parents 2ad8211 + b654724 commit 436e63e
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 63 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ jobs:
continue-on-error: False
strategy:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
os: [ubuntu-latest, macos-14-large, windows-latest]
python_version: ["3.10",]
timeout-minutes: 10
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -271,7 +271,7 @@ jobs:
sys:
- { os: windows-latest, shell: "msys2 {0}" }
- { os: ubuntu-latest, shell: bash }
# - { os: macos-12, shell: bash }
# - { os: macos-14-large, shell: bash }
python_version: ["3.10",]
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -433,7 +433,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
os: [ubuntu-latest, windows-latest]
python_version: ['3.8', '3.9', '3.10', '3.11']
timeout-minutes: 120
steps:
Expand Down Expand Up @@ -469,8 +469,8 @@ jobs:
# sudo apt-get install -y protobuf-compiler
# use sudo rm /var/lib/apt/lists/lock above in line above update if dependency install failures persist
# use sudo apt-get dist-upgrade above in line below update if dependency install failures persist
- if: matrix.os == 'macos-12'
name: Install dependencies (macos-12)
- if: matrix.os == 'macos-14-large'
name: Install dependencies (macos-14-large)
run: |
pip install tomte[tox]==0.2.13
brew install gcc
Expand Down Expand Up @@ -558,7 +558,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
os: [ubuntu-latest, macos-14-large, windows-latest]
python-version: ["3.10"]
timeout-minutes: 45
steps:
Expand Down
4 changes: 2 additions & 2 deletions docs/p2p-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Create one AEA as follows:
``` bash
aea create my_genesis_aea
cd my_genesis_aea
aea add connection valory/p2p_libp2p:0.1.0:bafybeic2u7azbwjny2nhaltqnbohlvysx3x6ectzbege7sxwrbzcz4lcma --remote
aea add connection valory/p2p_libp2p:0.1.0:bafybeihmzdqkdukajnw4fjvkrgsyanrwxnuptlzbaxof7zfq7suvk5fknq --remote
aea config set agent.default_connection valory/p2p_libp2p:0.1.0
aea install
aea build
Expand Down Expand Up @@ -58,7 +58,7 @@ Create a second AEA:
``` bash
aea create my_other_aea
cd my_other_aea
aea add connection valory/p2p_libp2p:0.1.0:bafybeic2u7azbwjny2nhaltqnbohlvysx3x6ectzbege7sxwrbzcz4lcma --remote
aea add connection valory/p2p_libp2p:0.1.0:bafybeihmzdqkdukajnw4fjvkrgsyanrwxnuptlzbaxof7zfq7suvk5fknq --remote
aea config set agent.default_connection valory/p2p_libp2p:0.1.0
aea install
aea build
Expand Down
14 changes: 7 additions & 7 deletions docs/package_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
| contract/fetchai/erc1155/0.22.0 | `bafybeiff7a6xncyad53o2r7lekpnhexcspze6ocy55xtpzqeuacnlpunm4` |
| connection/fetchai/gym/0.19.0 | `bafybeicqqvl4tt3qbulnkoffciagmfd6p3hxxi3i2mrrqtnbycv757pn6y` |
| connection/fetchai/stub/0.21.0 | `bafybeibybboiwgklfiqpkkcw6rwj65s5jalzfzf6mh6fstxdlt6habzwvy` |
| connection/valory/ledger/0.19.0 | `bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e` |
| connection/valory/ledger/0.19.0 | `bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm` |
| connection/valory/http_server/0.22.0 | `bafybeihpgu56ovmq4npazdbh6y6ru5i7zuv6wvdglpxavsckyih56smu7m` |
| connection/valory/p2p_libp2p/0.1.0 | `bafybeic2u7azbwjny2nhaltqnbohlvysx3x6ectzbege7sxwrbzcz4lcma` |
| connection/valory/p2p_libp2p/0.1.0 | `bafybeihmzdqkdukajnw4fjvkrgsyanrwxnuptlzbaxof7zfq7suvk5fknq` |
| connection/valory/p2p_libp2p_client/0.1.0 | `bafybeihs5zlwa5wlozct3rjlxsirm3ve3e4buse5nfehiky6ymnnfrobne` |
| connection/valory/p2p_libp2p_mailbox/0.1.0 | `bafybeiecclc65ogngs3piaxpwhiyl77mlpqun5ejlyv4kamwzrrh746guq` |
| connection/fetchai/local/0.20.0 | `bafybeiema4rnxi54luhzbrccb27pfrwlohemka45eqf4nidgmtkwwmxeyi` |
| connection/valory/http_client/0.23.0 | `bafybeihi772xgzpqeipp3fhmvpct4y6e6tpjp4sogwqrnf3wqspgeilg4u` |
| connection/valory/test_libp2p/0.1.0 | `bafybeiasj7ppsmn24mes2yw3o72nlmcircscalpl3j5ujzxstknlassa3q` |
| connection/valory/test_libp2p/0.1.0 | `bafybeihgujnszlu2nd7gdary25tanimrmlbpiigid2xregwlz654x2usy4` |
| skill/fetchai/echo/0.19.0 | `bafybeicoawiackcbgqo3na3e56tpdc62atag4yxknur77py37caqq4mmya` |
| skill/fetchai/error_test_skill/0.1.0 | `bafybeihsbtlpe7h6fsvoxban5rilkmwviwkokul5cqym6atoolirontiyu` |
| skill/fetchai/gym/0.20.0 | `bafybeie7y2fsxfuhsqxqcaluo5exskmrm5q3a6e2hfcskcuvzvxjjhijh4` |
| skill/fetchai/http_echo/0.20.0 | `bafybeicfiri2juaqh3azeit3z3rf44kgxdo6oj4lgxjgvnowq6m7j47qrm` |
| skill/fetchai/erc1155_client/0.28.0 | `bafybeih7q6b2lcqcbh7rln3mgcnbtzlw7cpzjl23znnz6jj74cc4noahvq` |
| skill/fetchai/erc1155_deploy/0.30.0 | `bafybeigoarj6k2czdhhfqzry5w5jn2ux7chszem37zxiqy3232jr2mxs64` |
| skill/fetchai/erc1155_client/0.28.0 | `bafybeiasrz6iflvwwyurssdxn2uxtdf2fjpsuamthic4fsdpdt4bhqtqam` |
| skill/fetchai/erc1155_deploy/0.30.0 | `bafybeibvwbjv4dvjmuj6cziafghitqtuuscrfig5r5nkfkfzn3l7wm2mjy` |
| skill/fetchai/error/0.17.0 | `bafybeicboomvykqhel3otyv4qg5t3hzpo6kmn5bk4ljluithhuieu7flsm` |
| skill/fetchai/fipa_dummy_buyer/0.2.0 | `bafybeidgso7lo5ay44mbxsp3lxilrgeek3ye44e6wus2ayq6kyxfvc3vjm` |
| skill/fetchai/generic_buyer/0.26.0 | `bafybeihzzcbki3p5l4nt5spbddx6nzbejv7b6nruhycwaxfrstjwmrfucq` |
| skill/fetchai/generic_seller/0.27.0 | `bafybeig3ffbcefeandebzepxabztob5sdkumydzla52k7pvztmjfegwflq` |
| skill/fetchai/generic_buyer/0.26.0 | `bafybeietldbnmgiegadjvzj6jrlvo5z3t5oaqsvhbrp32cq2nn775ykfgq` |
| skill/fetchai/generic_seller/0.27.0 | `bafybeicdwfe5avdsfj3nftkdxeeeadndoagvw4r4p6hgxjxskogu6sxozq` |
| skill/fetchai/task_test_skill/0.1.0 | `bafybeidv77u2xl52mnxakwvh7fuh46aiwfpteyof4eaptfd4agoi6cdble` |
| agent/fetchai/error_test/0.1.0 | `bafybeiecm675ndzbh35jkejtxn4ughoutztltjhgwzfbp57okabedjmnpq` |
| agent/fetchai/gym_aea/0.25.0 | `bafybeibzn3qomqmkaksgpd3gn6aijffvvw7rojswhoytiovohuc737fvfm` |
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchai/skills/erc1155_client/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fingerprint:
tests/test_strategy.py: bafybeicbxie3v6vue3gcnru6vsvggcgy3shxwrldis5gppizbuhooslcqa
fingerprint_ignore_patterns: []
connections:
- valory/ledger:0.19.0:bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e
- valory/ledger:0.19.0:bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm
contracts:
- fetchai/erc1155:0.22.0:bafybeiff7a6xncyad53o2r7lekpnhexcspze6ocy55xtpzqeuacnlpunm4
protocols:
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchai/skills/erc1155_deploy/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fingerprint:
tests/test_strategy.py: bafybeigxtw2j2c7vl6xhdwos62jbtmx62xfgdyadptm5eewmkesmcooyea
fingerprint_ignore_patterns: []
connections:
- valory/ledger:0.19.0:bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e
- valory/ledger:0.19.0:bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm
contracts:
- fetchai/erc1155:0.22.0:bafybeiff7a6xncyad53o2r7lekpnhexcspze6ocy55xtpzqeuacnlpunm4
protocols:
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchai/skills/generic_buyer/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fingerprint:
tests/test_models.py: bafybeibh72j3n72yseqvmpppucpu5wtidf6ebxbxkfnmrnlh4zv5y5apei
fingerprint_ignore_patterns: []
connections:
- valory/ledger:0.19.0:bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e
- valory/ledger:0.19.0:bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm
contracts: []
protocols:
- fetchai/default:1.0.0:bafybeihdvtmnz7fzy7kwi3wlo6rfl27f6q3g5entplgvq7y23i3v5uoz24
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchai/skills/generic_seller/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fingerprint:
tests/test_models.py: bafybeihabrc22zqssit3fmqhxptosy6qz6mx65ukhf5iayvirfv42xrhoq
fingerprint_ignore_patterns: []
connections:
- valory/ledger:0.19.0:bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e
- valory/ledger:0.19.0:bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm
contracts: []
protocols:
- fetchai/default:1.0.0:bafybeihdvtmnz7fzy7kwi3wlo6rfl27f6q3g5entplgvq7y23i3v5uoz24
Expand Down
14 changes: 7 additions & 7 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
"contract/fetchai/erc1155/0.22.0": "bafybeiff7a6xncyad53o2r7lekpnhexcspze6ocy55xtpzqeuacnlpunm4",
"connection/fetchai/gym/0.19.0": "bafybeicqqvl4tt3qbulnkoffciagmfd6p3hxxi3i2mrrqtnbycv757pn6y",
"connection/fetchai/stub/0.21.0": "bafybeibybboiwgklfiqpkkcw6rwj65s5jalzfzf6mh6fstxdlt6habzwvy",
"connection/valory/ledger/0.19.0": "bafybeigntoericenpzvwejqfuc3kqzo2pscs76qoygg5dbj6f4zxusru5e",
"connection/valory/ledger/0.19.0": "bafybeidon5zpvd2tke2z3fsxw3bf4g2i3m67r7yl5fzb7uoli7z5nnmoqm",
"connection/valory/http_server/0.22.0": "bafybeihpgu56ovmq4npazdbh6y6ru5i7zuv6wvdglpxavsckyih56smu7m",
"connection/valory/p2p_libp2p/0.1.0": "bafybeic2u7azbwjny2nhaltqnbohlvysx3x6ectzbege7sxwrbzcz4lcma",
"connection/valory/p2p_libp2p/0.1.0": "bafybeihmzdqkdukajnw4fjvkrgsyanrwxnuptlzbaxof7zfq7suvk5fknq",
"connection/valory/p2p_libp2p_client/0.1.0": "bafybeihs5zlwa5wlozct3rjlxsirm3ve3e4buse5nfehiky6ymnnfrobne",
"connection/valory/p2p_libp2p_mailbox/0.1.0": "bafybeiecclc65ogngs3piaxpwhiyl77mlpqun5ejlyv4kamwzrrh746guq",
"connection/fetchai/local/0.20.0": "bafybeiema4rnxi54luhzbrccb27pfrwlohemka45eqf4nidgmtkwwmxeyi",
"connection/valory/http_client/0.23.0": "bafybeihi772xgzpqeipp3fhmvpct4y6e6tpjp4sogwqrnf3wqspgeilg4u",
"connection/valory/test_libp2p/0.1.0": "bafybeiasj7ppsmn24mes2yw3o72nlmcircscalpl3j5ujzxstknlassa3q",
"connection/valory/test_libp2p/0.1.0": "bafybeihgujnszlu2nd7gdary25tanimrmlbpiigid2xregwlz654x2usy4",
"skill/fetchai/echo/0.19.0": "bafybeicoawiackcbgqo3na3e56tpdc62atag4yxknur77py37caqq4mmya",
"skill/fetchai/error_test_skill/0.1.0": "bafybeihsbtlpe7h6fsvoxban5rilkmwviwkokul5cqym6atoolirontiyu",
"skill/fetchai/gym/0.20.0": "bafybeie7y2fsxfuhsqxqcaluo5exskmrm5q3a6e2hfcskcuvzvxjjhijh4",
"skill/fetchai/http_echo/0.20.0": "bafybeicfiri2juaqh3azeit3z3rf44kgxdo6oj4lgxjgvnowq6m7j47qrm",
"skill/fetchai/erc1155_client/0.28.0": "bafybeih7q6b2lcqcbh7rln3mgcnbtzlw7cpzjl23znnz6jj74cc4noahvq",
"skill/fetchai/erc1155_deploy/0.30.0": "bafybeigoarj6k2czdhhfqzry5w5jn2ux7chszem37zxiqy3232jr2mxs64",
"skill/fetchai/erc1155_client/0.28.0": "bafybeiasrz6iflvwwyurssdxn2uxtdf2fjpsuamthic4fsdpdt4bhqtqam",
"skill/fetchai/erc1155_deploy/0.30.0": "bafybeibvwbjv4dvjmuj6cziafghitqtuuscrfig5r5nkfkfzn3l7wm2mjy",
"skill/fetchai/error/0.17.0": "bafybeicboomvykqhel3otyv4qg5t3hzpo6kmn5bk4ljluithhuieu7flsm",
"skill/fetchai/fipa_dummy_buyer/0.2.0": "bafybeidgso7lo5ay44mbxsp3lxilrgeek3ye44e6wus2ayq6kyxfvc3vjm",
"skill/fetchai/generic_buyer/0.26.0": "bafybeihzzcbki3p5l4nt5spbddx6nzbejv7b6nruhycwaxfrstjwmrfucq",
"skill/fetchai/generic_seller/0.27.0": "bafybeig3ffbcefeandebzepxabztob5sdkumydzla52k7pvztmjfegwflq",
"skill/fetchai/generic_buyer/0.26.0": "bafybeietldbnmgiegadjvzj6jrlvo5z3t5oaqsvhbrp32cq2nn775ykfgq",
"skill/fetchai/generic_seller/0.27.0": "bafybeicdwfe5avdsfj3nftkdxeeeadndoagvw4r4p6hgxjxskogu6sxozq",
"skill/fetchai/task_test_skill/0.1.0": "bafybeidv77u2xl52mnxakwvh7fuh46aiwfpteyof4eaptfd4agoi6cdble",
"agent/fetchai/error_test/0.1.0": "bafybeiecm675ndzbh35jkejtxn4ughoutztltjhgwzfbp57okabedjmnpq",
"agent/fetchai/gym_aea/0.25.0": "bafybeibzn3qomqmkaksgpd3gn6aijffvvw7rojswhoytiovohuc737fvfm",
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/connections/ledger/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ fingerprint:
base.py: bafybeifuoq2oqlcjlgeg2fg5l2ijiylb23v65xghv7u422helief2cjjuy
connection.py: bafybeicydkymhz2feqmihtkiwdfg7pp4pww2elqv4tijuhjcplyvawdk74
contract_dispatcher.py: bafybeidf2wu3rsp5pm45qwjlievbpmueeaj6hjw3kdyn67xhbocylwg3d4
ledger_dispatcher.py: bafybeicartiu3mcavtyd3eveonrbak3uaowqzymtaza6gqtoi5msid75ci
ledger_dispatcher.py: bafybeig5ql7aljikwbiytsopfsqoyifpjnxdvwj5blpucowtt7eevdw6na
tests/__init__.py: bafybeifku7ttsmbj4gfx6dkgjvwypx7v5ysfqlzof6vh4p7gujakjtuwhe
tests/conftest.py: bafybeid7vo7e2m76ey5beeadtbxywxx5ukefd5slwbc362rwmhht6i45ou
tests/test_contract_dispatcher.py: bafybeiag5lnpc7h25w23ash4hk4cowxsy5buxgpr474l3tfewnhf56eqyq
tests/test_ledger.py: bafybeigcedfr3yv3jse3xwrerrgwbelgb56uhgrvdus527d3daekh6dx4m
tests/test_ledger_api.py: bafybeihlwfzfffyr3gcrwa74g2ctoeymv76ahnxbxyal3xikgb7ftvpnl4
tests/test_ledger_api.py: bafybeiaicxq56bujtdqxy5czakzr5wpnf23q7ya4fc6oaimh5b5ydjhahi
fingerprint_ignore_patterns: []
connections: []
protocols:
Expand Down
20 changes: 4 additions & 16 deletions packages/valory/connections/ledger/ledger_dispatcher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2021-2023 Valory AG
# Copyright 2021-2024 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -267,10 +267,9 @@ async def get_transaction_receipt(
)

transaction_receipt = None
is_settled = False
attempts = 0
while (
not is_settled
transaction_receipt is None
and attempts < retry_attempts
and self.connection_state.get() == ConnectionStates.connected
):
Expand All @@ -286,13 +285,9 @@ async def get_transaction_receipt(
self.logger.warning(e)
transaction_receipt = None

if transaction_receipt is not None:
is_settled = api.is_transaction_settled(transaction_receipt)
attempts += 1
await asyncio.sleep(retry_timeout * attempts)
self.logger.debug(
f"Transaction receipt: {transaction_receipt}, settled: {is_settled}"
)
self.logger.debug(f"Transaction receipt: {transaction_receipt}")

attempts = 0
transaction = None
Expand All @@ -317,14 +312,7 @@ async def get_transaction_receipt(
await asyncio.sleep(retry_timeout * attempts)
self.logger.debug(f"Transaction: {transaction}")

if not is_settled:
response = self.get_error_message(
ValueError("Transaction not settled within timeout"),
api,
message,
dialogue,
)
elif transaction_receipt is None: # pragma: nocover
if transaction_receipt is None: # pragma: nocover
response = self.get_error_message(
ValueError("No transaction_receipt returned"), api, message, dialogue
)
Expand Down
12 changes: 3 additions & 9 deletions packages/valory/connections/ledger/tests/test_ledger_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ async def test_no_raw_tx(
@pytest.mark.asyncio
@pytest.mark.parametrize(
"failing_ledger_method_name",
("get_transaction_receipt", "is_transaction_settled", "get_transaction"),
("get_transaction_receipt", "get_transaction"),
)
@pytest.mark.parametrize("retries", (0, 5, 20))
@pytest.mark.parametrize("retry_timeout", (0.1,))
Expand Down Expand Up @@ -667,16 +667,10 @@ async def test_attempts_get_transaction_receipt(
assert dialogue is not None
assert isinstance(dialogue, LedgerApiDialogue)

mock_api.is_transaction_settled.return_value = (
True if failing_ledger_method_name == "get_transaction" else False
)
failing_ledger_method = getattr(mock_api, failing_ledger_method_name)
if (
ledger_raise_error
and failing_ledger_method_name != "is_transaction_settled"
):
if ledger_raise_error:
failing_ledger_method.side_effect = ValueError()
elif failing_ledger_method_name != "is_transaction_settled":
else:
failing_ledger_method.return_value = None

with patch.object(dispatcher, "retry_attempts", retries):
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/connections/p2p_libp2p/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fingerprint:
libp2p_node/utils/utils.go: bafybeihbd2br74nm3pupy4qkijm2tnuyl7pbq3uwasidmql5znhbr575k4
libp2p_node/utils/utils_test.go: bafybeig2kkgqy7miml66w2byomeqjp4czzv45gb4jas76cxildo3lxi4xq
tests/__init__.py: bafybeieftcbmxxpe7okvm3ycualpyec6xys4nx5tihcjii7lqxd3w5lx7e
tests/base.py: bafybeif4bslxqlqz2xppqz6rx44ydh7v4i2n542muip6jzznu36cmn4iwi
tests/base.py: bafybeiblwhd2bpngwwig2lrizxmvydy6whuarbnkpvedyo4w5bfcnso4oy
tests/test_aea_cli.py: bafybeic3aczdlcvbzdi2l77m36dkbjqva3itv3kbmsiuxrk26va4qtfzli
tests/test_build.py: bafybeigzxvb57sauddmb7t6pwwtxu476wceklktg42bidphl5zkcnghlfu
tests/test_errors.py: bafybeigfwg7cmxbgo7j2pce5vy55wvqze7wv67d4v37k3wpcflwbgzege4
Expand Down
6 changes: 5 additions & 1 deletion packages/valory/connections/p2p_libp2p/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022-2023 Valory AG
# Copyright 2022-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.
Expand Down Expand Up @@ -47,6 +47,10 @@
condition=(platform.system() == "Windows"),
reason="https://github.com/golang/go/issues/51007",
)
SKIP_MACOS = pytest.mark.skipif(
condition=(platform.system() == "Darwin"),
reason="go-ethereum not working on macos-12+",
)


def libp2p_log_on_failure(fn: Callable) -> Callable:
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/connections/test_libp2p/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fingerprint:
readme.md: bafybeihg5yfzgqvg5ngy7r2o5tfeqnelx2ffxw4po5hmheqjfhumpmxpoq
tests/__init__.py: bafybeiarz6mhky6pnkdihibcuqrfpx3qo55roygneoaoq2mndi5lzdlcj4
tests/acn_image.py: bafybeidkaavxkfocmg5c6y3i32fmbdf5i77jmqteoylmutifoh4zig3pr4
tests/base.py: bafybeicnngqp7pw6thjf4yjewk6kazaezpfumiob6mfwupdvwxaij6xwwm
tests/base.py: bafybeihk4x2opomphxttji6stortv6tzxll2aylk7ptlg7p65d4qajkkpa
tests/conftest.py: bafybeifkjrvsysdb7ujp2wxurzgytzy3ecu6fv247zfszfymdvb7y7klpu
tests/test_certificate_dates.py: bafybeif4t76wsvsfvvplkmi4gecgod6ijff3bbqgtaqmpep6ywfapfptfm
tests/test_dht.py: bafybeienykwwpdjlbjzxzttxjhgas2edp2f657gbsexjtkztehoq4yfb7m
Expand All @@ -34,7 +34,7 @@ fingerprint:
tests/test_p2p_libp2p_mailbox/test_mailbox_service.py: bafybeibp3bkwkrw57qahvuysjdlumywtlk3te5gsvusgrvhsc75k7rrk4u
fingerprint_ignore_patterns: []
connections:
- valory/p2p_libp2p:0.1.0:bafybeic2u7azbwjny2nhaltqnbohlvysx3x6ectzbege7sxwrbzcz4lcma
- valory/p2p_libp2p:0.1.0:bafybeihmzdqkdukajnw4fjvkrgsyanrwxnuptlzbaxof7zfq7suvk5fknq
- valory/p2p_libp2p_client:0.1.0:bafybeihs5zlwa5wlozct3rjlxsirm3ve3e4buse5nfehiky6ymnnfrobne
- valory/p2p_libp2p_mailbox:0.1.0:bafybeiecclc65ogngs3piaxpwhiyl77mlpqun5ejlyv4kamwzrrh746guq
protocols:
Expand Down
12 changes: 7 additions & 5 deletions packages/valory/connections/test_libp2p/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022-2023 Valory AG
# Copyright 2022-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.
Expand Down Expand Up @@ -64,6 +64,7 @@
)
from packages.valory.connections.p2p_libp2p.tests.base import (
MockDefaultMessageProtocol,
SKIP_MACOS,
SKIP_WINDOWS,
TEMP_LIBP2P_TEST_DIR,
TIMEOUT,
Expand Down Expand Up @@ -276,13 +277,14 @@ def _make_libp2p_connection(


@SKIP_WINDOWS
@SKIP_MACOS
class BaseP2PLibp2pTest:
"""Base class for ACN p2p libp2p tests"""

cwd: str
tmp: str
tmp_dir: str
tmp_client_dir: str
cwd: str = ""
tmp: str = ""
tmp_dir: str = ""
tmp_client_dir: str = ""
log_files: List[str] = []
multiplexers: List[Multiplexer] = []
capture_log = True
Expand Down
7 changes: 6 additions & 1 deletion tests/test_connections/test_sync_connection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2022-2024 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,6 +19,7 @@
# ------------------------------------------------------------------------------
"""This module contains the tests for the sync connection module."""
import asyncio
import platform
import time
from unittest.mock import MagicMock, Mock, patch

Expand Down Expand Up @@ -70,6 +71,10 @@ def on_disconnect(self):


@pytest.mark.asyncio
@pytest.mark.skipif(
condition=(platform.system() == "Darwin"),
reason="not working on macos-12+",
)
async def test_sync_connection():
"""Test sync connection example."""
conf = Mock()
Expand Down

0 comments on commit 436e63e

Please sign in to comment.