Skip to content

Align p2p knobs with Lotus #7616

Description

@LesnyRumcajs

Summary

rust-libp2p ships with different defaults than Lotus and its go-libp2p

This needs to be investigated; we probably want to align with Lotus, but there might be some additional considerations due to somehow different behaviour or feature set of both both libp2p implementations.

Claude-analysed discrepancies

Note ⏬ was generated by AI so it's just a rough overview of potential misalignment. There might be more (or less) knobs to turn.

Captured 2026-09-14, during the rust-libp2p 0.56 → 0.57 upgrade.

Sources, all read at a pinned revision:

  • Forest — src/libp2p/behaviour.rs (build_gossipsub), rust defaults where unset
  • Lotus — node/modules/lp2p/pubsub.go init(), which applies to every Lotus node; italic cells are not overridden and inherit the go default
  • rust — libp2p-gossipsub 0.50.0, src/config.rs + src/protocol.rs
  • go — go-libp2p-pubsub @ 892d7aaf6b8952c1ebfb540901b9a5656615d949, gossipsub.go var block + pubsub.go
  • js — @chainsafe/libp2p-gossipsub @ 5b1abf362b496b1e90096276e9ac63897524a6a1, src/constants.ts + src/index.ts opts block + src/message/decodeRpc.ts

Bold marks a divergence from Lotus, which is the Filecoin network's real baseline.

Mesh / overlay

concept rust knob Forest Lotus rust go js
mesh degree D mesh_n 6 8 6 6 6
mesh low Dlo mesh_n_low 5 6 5 5 4
mesh high Dhi mesh_n_high 12 12 12 12 12
outbound min Dout mesh_outbound_min 2 3 2 2 2
score-retained Dscore retain_scores 4 6 4 4 4
lazy gossip Dlazy gossip_lazy 6 12 6 6 6
gossip factor gossip_factor 0.25 0.1 0.25 0.25 0.25
PX prune peers prune_peers 0 16 0 16 16

Timing / cache

concept rust knob Forest Lotus rust go js
mcache history history_length 5 10 5 5 5
gossip window history_gossip 3 3 3 3 3
IWANT followup iwant_followup_time 3s 5s 3s 3s 3s
seen-message TTL duplicate_cache_time 60s 120s 60s 120s 120s
heartbeat interval heartbeat_interval 1s 1s 1s 1s 1s
heartbeat initial delay heartbeat_initial_delay 5s 100ms 5s 100ms 100ms
fanout TTL fanout_ttl 60s 60s 60s 60s 60s
prune backoff prune_backoff 60s 60s 60s 60s 60s
unsubscribe backoff unsubscribe_backoff 10s 10s 10s 10s 10s
graft flood threshold graft_flood_threshold 10s 10s 10s 10s 10s
opportunistic graft ticks / peers opportunistic_graft_ticks / _peers 60 / 2 60 / 2 60 / 2 60 / 2 60 / 2
direct connect ticks check_explicit_peers_ticks 300 300 300 300 300

Limits

concept rust knob Forest Lotus rust go js
max RPC bytes max_transmit_size 1 MiB 1 MiB 64 KiB 1 MiB 4 MiB
max control bytes max_control_message_size 512 KiB 512 KiB 16 KiB 512 KiB ∞
publish count / RPC max_publish_messages 5000 none 500 enforced none ∞
IHAVE ids sent max_control_messages_sent 5000 5000 5000 5000 5000
IHAVE msgs / heartbeat max_ihave_messages_heartbeat 10 10 10 10 10
gossip retransmission gossip_retransimission 3 3 3 3 3
IDONTWANT min size idontwant_message_size_threshold 1000 1024 1000 1024 512
flood publish flood_publish true true true false true
signature policy validation_mode Strict StrictSign Strict StrictSign StrictSign

Peer score thresholds already match Lotus exactly (-500 / -1000 / -2500 / 1000 / 3.5), see src/libp2p/gossip_params.rs.

Completion Criteria

  • investigate the defaults between two implementations and decide which constants should be aligned - it might be that we have an objectively better setting somewhere than Lotus or go-libp2p
  • Some mismatches might be worth raising to the rust-libp2p maintainers.

Additional Links & Resources

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: TaskDiscrete task to implement

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions