mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-12 05:19:33 +00:00
chore: bump nim-libp2p and mix-rln plugin for proof token reuse
- nim-libp2p: adds ProofResult, reclaimProofToken, same-epoch precomp - mix-rln-spam-protection-plugin: implements messageId reuse from discarded cover packets Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
acab10008e
commit
8add44d579
@ -12,7 +12,7 @@ for i in 1 2 3 4 5; do
|
||||
if [ -z "$metrics" ]; then
|
||||
echo " (unreachable)"
|
||||
else
|
||||
echo "$metrics" | grep -E "mix_cover_|mix_slots_" | grep -v "^#" || echo " (no cover metrics yet)"
|
||||
echo "$metrics" | grep -E "mix_cover_|mix_slot_" | grep -v "^#" || echo " (no cover metrics yet)"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
@ -27,5 +27,5 @@ nat = "extip:127.0.0.1"
|
||||
ext-multiaddr = ["/ip4/127.0.0.1/tcp/60001"]
|
||||
ext-multiaddr-only = true
|
||||
ip-colocation-limit=0
|
||||
mix-user-message-limit=2
|
||||
mix-disable-spam-protection=true
|
||||
mix-user-message-limit=4
|
||||
mix-disable-spam-protection=false
|
||||
|
||||
@ -28,6 +28,6 @@ nat = "extip:127.0.0.1"
|
||||
ext-multiaddr = ["/ip4/127.0.0.1/tcp/60002"]
|
||||
ext-multiaddr-only = true
|
||||
ip-colocation-limit=0
|
||||
mix-user-message-limit=2
|
||||
mix-disable-spam-protection=true
|
||||
mix-user-message-limit=4
|
||||
mix-disable-spam-protection=false
|
||||
#staticnode = ["/ip4/127.0.0.1/tcp/60001/p2p/16Uiu2HAmPiEs2ozjjJF2iN2Pe2FYeMC9w4caRHKYdLdAfjgbWM6o", "/ip4/127.0.0.1/tcp/60003/p2p/16Uiu2HAmTEDHwAziWUSz6ZE23h5vxG2o4Nn7GazhMor4bVuMXTrA","/ip4/127.0.0.1/tcp/60004/p2p/16Uiu2HAmPwRKZajXtfb1Qsv45VVfRZgK3ENdfmnqzSrVm3BczF6f","/ip4/127.0.0.1/tcp/60005/p2p/16Uiu2HAmRhxmCHBYdXt1RibXrjAUNJbduAhzaTHwFCZT4qWnqZAu"]
|
||||
|
||||
@ -28,6 +28,6 @@ nat = "extip:127.0.0.1"
|
||||
ext-multiaddr = ["/ip4/127.0.0.1/tcp/60003"]
|
||||
ext-multiaddr-only = true
|
||||
ip-colocation-limit=0
|
||||
mix-user-message-limit=2
|
||||
mix-disable-spam-protection=true
|
||||
mix-user-message-limit=4
|
||||
mix-disable-spam-protection=false
|
||||
#staticnode = ["/ip4/127.0.0.1/tcp/60001/p2p/16Uiu2HAmPiEs2ozjjJF2iN2Pe2FYeMC9w4caRHKYdLdAfjgbWM6o", "/ip4/127.0.0.1/tcp/60002/p2p/16Uiu2HAmLtKaFaSWDohToWhWUZFLtqzYZGPFuXwKrojFVF6az5UF","/ip4/127.0.0.1/tcp/60004/p2p/16Uiu2HAmPwRKZajXtfb1Qsv45VVfRZgK3ENdfmnqzSrVm3BczF6f","/ip4/127.0.0.1/tcp/60005/p2p/16Uiu2HAmRhxmCHBYdXt1RibXrjAUNJbduAhzaTHwFCZT4qWnqZAu"]
|
||||
|
||||
@ -28,6 +28,6 @@ nat = "extip:127.0.0.1"
|
||||
ext-multiaddr = ["/ip4/127.0.0.1/tcp/60004"]
|
||||
ext-multiaddr-only = true
|
||||
ip-colocation-limit=0
|
||||
mix-user-message-limit=2
|
||||
mix-disable-spam-protection=true
|
||||
mix-user-message-limit=4
|
||||
mix-disable-spam-protection=false
|
||||
#staticnode = ["/ip4/127.0.0.1/tcp/60002/p2p/16Uiu2HAmLtKaFaSWDohToWhWUZFLtqzYZGPFuXwKrojFVF6az5UF", "/ip4/127.0.0.1/tcp/60003/p2p/16Uiu2HAmTEDHwAziWUSz6ZE23h5vxG2o4Nn7GazhMor4bVuMXTrA","/ip4/127.0.0.1/tcp/60001/p2p/16Uiu2HAmPiEs2ozjjJF2iN2Pe2FYeMC9w4caRHKYdLdAfjgbWM6o","/ip4/127.0.0.1/tcp/60005/p2p/16Uiu2HAmRhxmCHBYdXt1RibXrjAUNJbduAhzaTHwFCZT4qWnqZAu"]
|
||||
|
||||
@ -28,6 +28,6 @@ nat = "extip:127.0.0.1"
|
||||
ext-multiaddr = ["/ip4/127.0.0.1/tcp/60005"]
|
||||
ext-multiaddr-only = true
|
||||
ip-colocation-limit=0
|
||||
mix-user-message-limit=2
|
||||
mix-disable-spam-protection=true
|
||||
mix-user-message-limit=4
|
||||
mix-disable-spam-protection=false
|
||||
#staticnode = ["/ip4/127.0.0.1/tcp/60001/p2p/16Uiu2HAmPiEs2ozjjJF2iN2Pe2FYeMC9w4caRHKYdLdAfjgbWM6o", "/ip4/127.0.0.1/tcp/60003/p2p/16Uiu2HAmTEDHwAziWUSz6ZE23h5vxG2o4Nn7GazhMor4bVuMXTrA","/ip4/127.0.0.1/tcp/60004/p2p/16Uiu2HAmPwRKZajXtfb1Qsv45VVfRZgK3ENdfmnqzSrVm3BczF6f","/ip4/127.0.0.1/tcp/60002/p2p/16Uiu2HAmLtKaFaSWDohToWhWUZFLtqzYZGPFuXwKrojFVF6az5UF"]
|
||||
|
||||
@ -20,7 +20,7 @@ import
|
||||
|
||||
const
|
||||
KeystorePassword = "mix-rln-password" # Must match protocol.nim
|
||||
DefaultUserMessageLimit = 2'u64 # ~12 msgs/min with 10s epochs
|
||||
DefaultUserMessageLimit = 4'u64 # R=4 slots per 10s epoch
|
||||
SpammerUserMessageLimit = 3'u64 # Higher limit for spammer testing
|
||||
|
||||
# Peer IDs derived from nodekeys in config files
|
||||
|
||||
2
vendor/mix-rln-spam-protection-plugin
vendored
2
vendor/mix-rln-spam-protection-plugin
vendored
@ -1 +1 @@
|
||||
Subproject commit bb787a684b1dd335c82790fc505595e5a54cd6dc
|
||||
Subproject commit bf56c9b9a640e612ce34aa3776c4eedfd5366ab3
|
||||
2
vendor/nim-libp2p
vendored
2
vendor/nim-libp2p
vendored
@ -1 +1 @@
|
||||
Subproject commit f7ebceb4ea3c9271a1e0eae404dbccd23dd51574
|
||||
Subproject commit 6ba3e3ae847c2dcf4030597034303cc85b1f76b4
|
||||
@ -9,8 +9,8 @@ import
|
||||
libp2p/[peerid, multiaddress, switch],
|
||||
libp2p/extended_peer_record,
|
||||
libp2p/crypto/curve25519,
|
||||
libp2p/protocols/[kademlia, kad_disco],
|
||||
libp2p/protocols/kademlia_discovery/types as kad_types,
|
||||
libp2p/protocols/[kademlia, service_discovery],
|
||||
libp2p/protocols/service_discovery/types as kad_types,
|
||||
libp2p/protocols/mix/mix_protocol
|
||||
|
||||
import waku/waku_core, waku/node/peer_manager
|
||||
@ -19,20 +19,20 @@ logScope:
|
||||
topics = "waku extended kademlia discovery"
|
||||
|
||||
const
|
||||
DefaultExtendedKademliaDiscoveryInterval* = chronos.seconds(5)
|
||||
ExtendedKademliaDiscoveryStartupDelay* = chronos.seconds(5)
|
||||
DefaultExtendedServiceDiscoveryInterval* = chronos.seconds(5)
|
||||
ExtendedServiceDiscoveryStartupDelay* = chronos.seconds(5)
|
||||
|
||||
type
|
||||
MixNodePoolSizeProvider* = proc(): int {.gcsafe, raises: [].}
|
||||
NodeStartedProvider* = proc(): bool {.gcsafe, raises: [].}
|
||||
|
||||
ExtendedKademliaDiscoveryParams* = object
|
||||
ExtendedServiceDiscoveryParams* = object
|
||||
bootstrapNodes*: seq[(PeerId, seq[MultiAddress])]
|
||||
mixPubKey*: Option[Curve25519Key]
|
||||
advertiseMix*: bool = false
|
||||
|
||||
WakuKademlia* = ref object
|
||||
protocol*: KademliaDiscovery
|
||||
protocol*: ServiceDiscovery
|
||||
peerManager: PeerManager
|
||||
discoveryLoop: Future[void]
|
||||
running*: bool
|
||||
@ -42,7 +42,7 @@ type
|
||||
proc new*(
|
||||
T: type WakuKademlia,
|
||||
switch: Switch,
|
||||
params: ExtendedKademliaDiscoveryParams,
|
||||
params: ExtendedServiceDiscoveryParams,
|
||||
peerManager: PeerManager,
|
||||
getMixNodePoolSize: MixNodePoolSizeProvider = nil,
|
||||
isNodeStarted: NodeStartedProvider = nil,
|
||||
@ -50,13 +50,13 @@ proc new*(
|
||||
if params.bootstrapNodes.len == 0:
|
||||
info "creating kademlia discovery as seed node (no bootstrap nodes)"
|
||||
|
||||
let kademlia = KademliaDiscovery.new(
|
||||
let kademlia = ServiceDiscovery.new(
|
||||
switch,
|
||||
bootstrapNodes = params.bootstrapNodes,
|
||||
config = KadDHTConfig.new(
|
||||
validator = kad_types.ExtEntryValidator(), selector = kad_types.ExtEntrySelector()
|
||||
),
|
||||
codec = ExtendedKademliaDiscoveryCodec,
|
||||
codec = ExtendedServiceDiscoveryCodec,
|
||||
)
|
||||
|
||||
try:
|
||||
@ -197,7 +197,7 @@ proc runDiscoveryLoop(
|
||||
while wk.running:
|
||||
# Wait for node to be started
|
||||
if not wk.isNodeStarted.isNil() and not wk.isNodeStarted():
|
||||
await sleepAsync(ExtendedKademliaDiscoveryStartupDelay)
|
||||
await sleepAsync(ExtendedServiceDiscoveryStartupDelay)
|
||||
continue
|
||||
|
||||
var records: seq[ExtendedPeerRecord]
|
||||
@ -247,7 +247,7 @@ proc runDiscoveryLoop(
|
||||
|
||||
proc start*(
|
||||
wk: WakuKademlia,
|
||||
interval: Duration = DefaultExtendedKademliaDiscoveryInterval,
|
||||
interval: Duration = DefaultExtendedServiceDiscoveryInterval,
|
||||
minMixPeers: int = 0,
|
||||
): Future[Result[void, string]] {.async: (raises: []).} =
|
||||
if wk.running:
|
||||
|
||||
@ -180,7 +180,7 @@ proc setupProtocols(
|
||||
|
||||
node.wakuKademlia = WakuKademlia.new(
|
||||
node.switch,
|
||||
ExtendedKademliaDiscoveryParams(
|
||||
ExtendedServiceDiscoveryParams(
|
||||
bootstrapNodes: conf.kademliaDiscoveryConf.get().bootstrapNodes,
|
||||
mixPubKey: mixPubKey,
|
||||
advertiseMix: conf.mixConf.isSome(),
|
||||
|
||||
@ -102,7 +102,7 @@ proc new*(
|
||||
let totalSlots = userMessageLimit.get(2)
|
||||
let ct = ConstantRateCoverTraffic.new(
|
||||
totalSlots = totalSlots,
|
||||
epochDurationSec = 10.0,
|
||||
epochDuration = 10.seconds,
|
||||
useInternalEpochTimer = disableSpamProtection,
|
||||
)
|
||||
|
||||
@ -137,8 +137,11 @@ proc new*(
|
||||
localMixNodeInfo,
|
||||
peermgr.switch,
|
||||
spamProtection = spamProtectionOpt,
|
||||
delayStrategy = Opt.some(DelayStrategy(
|
||||
ExponentialDelayStrategy.new(meanDelay = 100, rng = crypto.newRng()))),
|
||||
delayStrategy = Opt.some(
|
||||
DelayStrategy(
|
||||
ExponentialDelayStrategy.new(meanDelay = 100, rng = crypto.newRng())
|
||||
)
|
||||
),
|
||||
coverTraffic = Opt.some(CoverTraffic(ct)),
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user