From d57715fa6ed509c2b0bab03c11998d6483a9ecde Mon Sep 17 00:00:00 2001 From: Luciferian Ink Date: Thu, 14 Dec 2023 21:17:10 -0600 Subject: [PATCH 1/2] add IPFS integration --- src/lightning_hivemind/strategy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lightning_hivemind/strategy.py b/src/lightning_hivemind/strategy.py index fe6b809..8cbeaf3 100644 --- a/src/lightning_hivemind/strategy.py +++ b/src/lightning_hivemind/strategy.py @@ -105,6 +105,9 @@ class HivemindStrategy(Strategy): initial_peers: If connecting to a running process, a list of initial peers needs to be passed in. This can also be set via the env variable ``INITIAL_PEERS``. + use_ipfs: Use IPFS to find initial_peers. If enabled, you only need to provide /p2p/XXXX part of the + multiaddrs for the initial_peers (no need to specify a particular IPv4/IPv6 host and port)" + **optimizer_kwargs: kwargs are passed to the :class:`hivemind.Optimizer` class. """ @@ -128,6 +131,7 @@ def __init__( averager_opts: Optional[Dict] = None, host_maddrs: Optional[List] = None, initial_peers: Optional[Union[str, List]] = None, + use_ipfs: bool = False, **optimizer_kwargs: Any, ): if platform.system() != "Linux": @@ -165,6 +169,8 @@ def __init__( start=True, initial_peers=initial_peers, host_maddrs=host_maddrs if host_maddrs is not None else ["/ip4/0.0.0.0/tcp/0", "/ip4/0.0.0.0/udp/0/quic"], + use_ipfs=use_ipfs, + ensure_bootstrap_success=True if not use_ipfs else False, ) visible_addresses = [ From e6fa0b4cc90180c6de31c0b952c36dc3335a7752 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:27:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning_hivemind/strategy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning_hivemind/strategy.py b/src/lightning_hivemind/strategy.py index 8cbeaf3..3a3a8da 100644 --- a/src/lightning_hivemind/strategy.py +++ b/src/lightning_hivemind/strategy.py @@ -170,7 +170,7 @@ def __init__( initial_peers=initial_peers, host_maddrs=host_maddrs if host_maddrs is not None else ["/ip4/0.0.0.0/tcp/0", "/ip4/0.0.0.0/udp/0/quic"], use_ipfs=use_ipfs, - ensure_bootstrap_success=True if not use_ipfs else False, + ensure_bootstrap_success=bool(not use_ipfs), ) visible_addresses = [