mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Move test utilities to tools (#356)
* move test factories to libp2p/tools * remove unused inits * move pubsub test utils to tools * cleanup test_interop * fix typing libp2p/tools/utils * add typing to pubsub utils * fix factories typing * fix typing for floodsub_integration_test_settings * fix rest of the typing * fix isort
This commit is contained in:
30
libp2p/tools/constants.py
Normal file
30
libp2p/tools/constants.py
Normal file
@ -0,0 +1,30 @@
|
||||
from typing import NamedTuple
|
||||
|
||||
import multiaddr
|
||||
|
||||
from libp2p.pubsub import floodsub, gossipsub
|
||||
|
||||
# Just a arbitrary large number.
|
||||
# It is used when calling `MplexStream.read(MAX_READ_LEN)`,
|
||||
# to avoid `MplexStream.read()`, which blocking reads until EOF.
|
||||
MAX_READ_LEN = 2 ** 32 - 1
|
||||
|
||||
|
||||
LISTEN_MADDR = multiaddr.Multiaddr("/ip4/127.0.0.1/tcp/0")
|
||||
|
||||
|
||||
FLOODSUB_PROTOCOL_ID = floodsub.PROTOCOL_ID
|
||||
GOSSIPSUB_PROTOCOL_ID = gossipsub.PROTOCOL_ID
|
||||
|
||||
|
||||
class GossipsubParams(NamedTuple):
|
||||
degree: int = 10
|
||||
degree_low: int = 9
|
||||
degree_high: int = 11
|
||||
time_to_live: int = 30
|
||||
gossip_window: int = 3
|
||||
gossip_history: int = 5
|
||||
heartbeat_interval: float = 0.5
|
||||
|
||||
|
||||
GOSSIPSUB_PARAMS = GossipsubParams()
|
||||
Reference in New Issue
Block a user