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

Fix hardware wallet plugin protobuf incompatibility #667

Merged
4 changes: 2 additions & 2 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"connection/fetchai/http_server/0.22.0": "bafybeihvscddpxjbtqsetngmxo3kiht2wqhosmwiyuh3f6zjti3x3byu5u",
"connection/fetchai/stub/0.21.0": "bafybeictgpdqbpyppmoxn2g7jkaxvulihew7zaszv4xyhgvsntq7tqs7wi",
"connection/valory/ledger/0.19.0": "bafybeiauyqzizmocjldnfuzvnihrqubfqzn5u2hp6ue7v3ka5kj54kd3zm",
"connection/valory/p2p_libp2p/0.1.0": "bafybeig7haxmib5ahjgrf5fu3ng6gfgkolxljcwa75upaa2rhmxsqgqpoy",
"connection/valory/p2p_libp2p/0.1.0": "bafybeiaykya7tvir7k5scovjzuagpfcftvptxoi2od5qqqvukwglsrrtzy",
"connection/valory/p2p_libp2p_client/0.1.0": "bafybeihge56dn3xep2dzomu7rtvbgo4uc2qqh7ljl3fubqdi2lq44gs5lq",
"connection/valory/p2p_libp2p_mailbox/0.1.0": "bafybeieufv6tbei3vza7bg7ggzsvyvwmzps5kghxlar3drhme6d7mxawvy",
"contract/fetchai/erc1155/0.22.0": "bafybeiff7a6xncyad53o2r7lekpnhexcspze6ocy55xtpzqeuacnlpunm4",
Expand All @@ -30,7 +30,7 @@
"agent/open_aea/my_first_aea/0.1.0": "bafybeibv7nlyxldyj5ntivsu74ylul4dltpfvkfa46k2pbveetfpkvz4jm",
"connection/fetchai/local/0.20.0": "bafybeigukufpgy2sdkv5qqde47dhigbjitxcrxwg6sl6unlpbc7wbxqyhm",
"connection/valory/http_client/0.23.0": "bafybeifgeqgryx6b3s6eseyzyezygmeitcpt3tkor2eiycozoi6clgdrny",
"connection/valory/test_libp2p/0.1.0": "bafybeidbpxsqkdpjv7vy6wsswuvvy67duaw67ekfjvmudwvlbhjmbbsooe",
"connection/valory/test_libp2p/0.1.0": "bafybeidkohugfy2tququ7euq3tlde45t24uwe3j53gk67jekcuwnwvbmoq",
"protocol/fetchai/tac/1.0.0": "bafybeiaukfwe7wbpikztprlmrfpphsxqpdzgamkbhvqyz54tl3k73kzsvi",
"skill/fetchai/erc1155_client/0.28.0": "bafybeifpscpj3oor5ek7too6evd4cktffwrsyx6qmintdwywdkzwsgeaum",
"skill/fetchai/erc1155_deploy/0.30.0": "bafybeiaaxhi4rpb2ezvdbc4q7z23nilpo4vxzqnu3jz5zfphqzhhpguifi",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/connections/p2p_libp2p/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ fingerprint:
libp2p_node/utils/utils.go: bafybeihbd2br74nm3pupy4qkijm2tnuyl7pbq3uwasidmql5znhbr575k4
libp2p_node/utils/utils_test.go: bafybeig2kkgqy7miml66w2byomeqjp4czzv45gb4jas76cxildo3lxi4xq
tests/__init__.py: bafybeieftcbmxxpe7okvm3ycualpyec6xys4nx5tihcjii7lqxd3w5lx7e
tests/base.py: bafybeibn5afb3fiy2lakt7j53kalfbi22vfd35ls25iqzddm7etwvqmiry
tests/test_aea_cli.py: bafybeicyqnu4pzdl26pd765qcommyqccwvge7uh3keuk6cswpnbc47ovii
tests/test_build.py: bafybeicacwij2ptpg4vbwdwtwrzwnp4afoewtsaq2woxfooipwy7z2hmxe
tests/base.py: bafybeif4bslxqlqz2xppqz6rx44ydh7v4i2n542muip6jzznu36cmn4iwi
tests/test_aea_cli.py: bafybeic3aczdlcvbzdi2l77m36dkbjqva3itv3kbmsiuxrk26va4qtfzli
tests/test_build.py: bafybeigzxvb57sauddmb7t6pwwtxu476wceklktg42bidphl5zkcnghlfu
tests/test_errors.py: bafybeigfwg7cmxbgo7j2pce5vy55wvqze7wv67d4v37k3wpcflwbgzege4
tests/test_go_code_matching_acn.py: bafybeificee4dtvgtr2ejegokahlbqyvmvvtgxhs5b3ps4ezyjkz46b23u
fingerprint_ignore_patterns: []
Expand Down
10 changes: 9 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 Valory AG
# Copyright 2022-2023 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 @@ -23,10 +23,13 @@
import functools
import inspect
import itertools
import platform
import tempfile
from typing import Any, Callable, Type
from unittest import mock

import pytest

from packages.fetchai.protocols.default.message import DefaultMessage


Expand All @@ -40,6 +43,11 @@
DefaultMessage.protocol_specification_id
)

SKIP_WINDOWS = pytest.mark.skipif(
condition=(platform.system() == "Windows"),
reason="https://github.com/golang/go/issues/51007",
)


def libp2p_log_on_failure(fn: Callable) -> Callable:
"""Decorate a method running a libp2p node to print its logs in case test fails."""
Expand Down
8 changes: 6 additions & 2 deletions packages/valory/connections/p2p_libp2p/tests/test_aea_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2022-2023 Valory AG
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -38,14 +38,18 @@
LIBP2P_CERT_NOT_AFTER,
LIBP2P_CERT_NOT_BEFORE,
)
from packages.valory.connections.p2p_libp2p.tests.base import libp2p_log_on_failure_all
from packages.valory.connections.p2p_libp2p.tests.base import (
SKIP_WINDOWS,
libp2p_log_on_failure_all,
)


p2p_libp2p_path = f"vendor.{p2p_libp2p.__name__.split('.', 1)[-1]}"
DEFAULT_NET_SIZE = 4
LIBP2P_LAUNCH_TIMEOUT = 20 # may downloads up to ~66Mb


@SKIP_WINDOWS
class BaseP2PLibp2pConnectionAEATest(AEATestCaseEmpty):
"""Base class for AEA CLI tests"""

Expand Down
4 changes: 3 additions & 1 deletion packages/valory/connections/p2p_libp2p/tests/test_build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2022-2023 Valory AG
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -40,6 +40,7 @@
check_versions as base_check_versions,
)
from packages.valory.connections.p2p_libp2p.check_dependencies import version_to_string
from packages.valory.connections.p2p_libp2p.tests.base import SKIP_WINDOWS


def check_versions() -> None:
Expand Down Expand Up @@ -95,6 +96,7 @@ def test_check_versions_negative_cannot_parse_version(capsys: CaptureFixture) ->
)


@SKIP_WINDOWS
def test_build_node() -> None:
"""Test build node function."""
with tempfile.TemporaryDirectory() as build_dir:
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/connections/test_libp2p/connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ fingerprint:
readme.md: bafybeihg5yfzgqvg5ngy7r2o5tfeqnelx2ffxw4po5hmheqjfhumpmxpoq
tests/__init__.py: bafybeiarz6mhky6pnkdihibcuqrfpx3qo55roygneoaoq2mndi5lzdlcj4
tests/acn_image.py: bafybeidkaavxkfocmg5c6y3i32fmbdf5i77jmqteoylmutifoh4zig3pr4
tests/base.py: bafybeiezhwp66aft6332mb34olbtuy2bgjcuit6zn5rrkoidvzqjqlapui
tests/base.py: bafybeia36ey5vlpi72pgn2tlmqe36lg2rhhwkwjc4sq6d3fwzruemalfoe
tests/conftest.py: bafybeifkjrvsysdb7ujp2wxurzgytzy3ecu6fv247zfszfymdvb7y7klpu
tests/test_certificate_dates.py: bafybeif4t76wsvsfvvplkmi4gecgod6ijff3bbqgtaqmpep6ywfapfptfm
tests/test_dht.py: bafybeienykwwpdjlbjzxzttxjhgas2edp2f657gbsexjtkztehoq4yfb7m
tests/test_p2p_libp2p/__init__.py: bafybeig7f7s5ptqtscf74y25dtqvhp75joekcxi6qnuzxgxyzictpsp4dm
tests/test_p2p_libp2p/test_aea_cli.py: bafybeiej55kwbxuqjvjjz4tc7we54pxur7kvsh5o36lau7b7utltzwkc34
tests/test_p2p_libp2p/test_communication.py: bafybeihnkle2pokfzfkguegmq4ptatvpcaezxrv564l76atjnuec57b2am
tests/test_p2p_libp2p/test_errors.py: bafybeifyl3anbjjm22xey73vhgdkosnd3nubyyl7xxr4kxbigsiwdsk25u
tests/test_p2p_libp2p/test_errors.py: bafybeig7lnly3e5sb2ztkns5vjaukof74g4s6mpxoj5b3x4yemtcizgggi
tests/test_p2p_libp2p/test_fault_tolerance.py: bafybeigbzraksxj35q3q6thnkbvgvybixapkow4dz6vyo7jlbgnyulbv4a
tests/test_p2p_libp2p/test_integration.py: bafybeicidfdxwbesfamxtpevhq74udl5ne5xeqt523ggc2v2enam7yenyu
tests/test_p2p_libp2p/test_slow_queue.py: bafybeihx6dga3bxiy7i67ggf6gnoakygyf5djyzv6prias5tcjpxawlpyy
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:bafybeig7haxmib5ahjgrf5fu3ng6gfgkolxljcwa75upaa2rhmxsqgqpoy
- valory/p2p_libp2p:0.1.0:bafybeiaykya7tvir7k5scovjzuagpfcftvptxoi2od5qqqvukwglsrrtzy
- valory/p2p_libp2p_client:0.1.0:bafybeihge56dn3xep2dzomu7rtvbgo4uc2qqh7ljl3fubqdi2lq44gs5lq
- valory/p2p_libp2p_mailbox:0.1.0:bafybeieufv6tbei3vza7bg7ggzsvyvwmzps5kghxlar3drhme6d7mxawvy
protocols:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/connections/test_libp2p/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def setup_class(cls):
cls.cwd, cls.tmp = os.getcwd(), TEMP_LIBP2P_TEST_DIR
if Path(cls.tmp).exists():
cls.remove_temp_test_dir()
Path(cls.tmp).mkdir()
Path(cls.tmp).mkdir(exist_ok=True)
os.chdir(cls.tmp)

@classmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2022-2023 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 @@ -134,6 +134,10 @@ def test_libp2p_connection_mixed_ip_address() -> None:
assert _ip_all_private_or_all_public(["fetch.ai", "acn.fetch.ai"]) is True


@pytest.mark.skipif(
condition=(platform.system() == "Windows"),
reason="https://github.com/golang/go/issues/51007",
)
Comment on lines +137 to +140
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we address this issue on a separate PR

def test_libp2p_connection_node_config_registration_delay() -> None:
"""Test node registration delay configuration"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@

"""Python package wrapping the public and private key cryptography and support for hardware wallet interactions."""

import os


if os.environ.get("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION", None) != "python":
print(
(
'Please export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION="python" '
"to use the hardware wallet without any issues"
)
)

from aea_ledger_ethereum_hwi.hwi import ( # noqa: F401
EthereumHWIApi,
EthereumHWICrypto,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_all_extras() -> Dict:
cli_deps = [
"click==8.0.2",
"pyyaml==6.0.1",
"jsonschema<5.0.0,>=4.16.0",
"jsonschema<=4.19.0,>=4.16.0",
"packaging>=23.1,<24.0",
"pytest>=7.0.0,<7.3.0",
"coverage>=6.4.4,<8.0.0",
Expand All @@ -55,7 +55,7 @@ def get_all_extras() -> Dict:
base_deps = [
"semver>=2.9.1,<3.0.0",
"base58>=1.0.3,<3.0.0",
"jsonschema<5.0.0,>=4.16.0",
"jsonschema<=4.19.0,>=4.16.0",
"packaging>=23.1,<24.0",
"protobuf>=4.21.6,<5.0.0",
"pymultihash==0.8.2",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def test_run_with_profiling():
logfile=sys.stdout,
)

process.expect("Start processing messages", timeout=10)
process.expect("Start processing messages", timeout=60)
process.expect("Profiling details", timeout=10)
process.control_c()
process.wait_to_complete(10)
Expand Down
12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ basepython = python3.10
usedevelop = True
deps = {[test-plugins-lte-3.9]deps}
commands = {[test-plugins-lte-3.9]commands}
; Since the ledgerwallet still uses protobufs compiled using protoc<=3.20
setenv =
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

[testenv:py3.11]
basepython = python3.11
Expand All @@ -165,6 +168,9 @@ basepython = python3.11
usedevelop = True
deps = {[test-plugins-lte-3.9]deps}
commands = {[test-plugins-lte-3.9]commands}
; Since the ledgerwallet still uses protobufs compiled using protoc<=3.20
setenv =
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

[testenv:bandit]
skipsdist = True
Expand Down Expand Up @@ -433,11 +439,17 @@ deps =
{[testenv_multi]deps}
pytest-custom-exit-code==0.3.0
commands = {[test-plugins]commands}
; Since the ledgerwallet still uses protobufs compiled using protoc<=3.20
setenv =
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

[testenv:plugins-py3.9]
basepython = python3.9
deps = {[test-plugins-lte-3.9]deps}
commands = {[test-plugins-lte-3.9]commands}
; Since the ledgerwallet still uses protobufs compiled using protoc<=3.20
setenv =
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

[testenv:check-api-docs]
skipsdist = True
Expand Down