Gossip
Telcoin Network nodes flood four gossipsub topics: certificates, consensus output, epoch votes, and worker batch digests. All four are permissioned. A node accepts a gossip message only when the publisher’s BLS public key is on that topic’s allowlist for the current epoch, and it rejects everything else before re-propagating it.
This page is for RPC providers, dapp and indexer operators, bridge partners, and validators. It gives the topic names, who may publish on each, how a publisher is authenticated, the message size limit, and which peer is penalized when a message is rejected.
The implementation lives in
crates/network-libp2p/src/consensus.rs and
crates/config/src/network.rs.
Transport covers the QUIC transport these topics ride on,
Discovery covers the signed node records that resolve publisher identities,
and Peers covers the reputation system that the gossip penalties feed.
The four topics
| Topic | Authorized publishers | Payload |
|---|---|---|
tn-primary-{chain_id} | current committee | Certificate |
tn-consensus-output-{chain_id} | previous, current, and next committee | ConsensusResult |
tn-epoch-vote-{chain_id} | previous, current, and next committee | EpochVote |
tn-worker-{chain_id}-{worker_id} | current committee | batch digest, (Epoch, BlockHash) |
Topics are identity-hashed, so the strings above are exactly what appears on the wire. On the Adiri testnet, whose chain id is 2017, a single-worker node uses these four names:
tn-primary-2017
tn-consensus-output-2017
tn-epoch-vote-2017
tn-worker-2017-0
The gossipsub protocol id is chain-scoped for the same reason the topics are:
the builder yields /tn-meshsub-2017/1.1.0 and /tn-meshsub-2017/1.0.0.
Without that, meshsub would be the one wire protocol two chains still shared.
What “permissioned” means
Each subscribed topic carries an allowlist of BLS public keys. Verification of an inbound message reads that entry and resolves the message author’s libp2p peer id to a BLS key:
entry absent -> topic not subscribed here -> reject
entry is an allowlist -> accept only if the author's resolved BLS key is in it
entry is None -> subscribed, any publisher accepted
The None case is a real capability of the mechanism: it makes a topic permissionless.
Note
No production topic uses it. All four topics are subscribed with an explicit committee allowlist, on every node, on every epoch. A message from a peer outside the allowlist is rejected and is never re-propagated by an honest node.
Rejection is not the same as ignoring. A rejected message is dropped and, where a culprit can be identified, costs that peer reputation.
Topic scoping
Topics are scoped by chain and, for batch digests, by worker id. They are never scoped by epoch. Epoch scoping happens instead by re-subscribing to the same topic name at the start of every epoch, which overwrites the stored allowlist with the new committee’s keys.
Subscriptions live on a process-lifetime swarm, so a topic subscribed in one epoch stays subscribed until it is explicitly dropped. Unsubscribing must therefore remove the allowlist entry, not merely stop reading. An absent entry means “not subscribed here, reject”, which is the correct state for a topic this node has left. A stale entry left behind would pin the topic to whichever committee was current when the node last subscribed, and honest publishers from every later committee would be rejected as unauthorized.
Why two topics span three committees
Certificates and batch digests are current-epoch traffic, so the current committee is the whole allowlist.
Epoch votes and consensus output are epoch-boundary traffic. An epoch’s closing vote and its final consensus output are authored by the outgoing committee and gossipped into the next epoch. A current-committee-only allowlist would reject exactly those in-flight boundary messages during rotation, and stop re-propagating them, stalling certification of the epoch that just closed. A validator rotating in may likewise start publishing slightly early. Widening the allowlist to the previous, current, and next committee also makes it agree with the window the peer manager already uses for validator penalty exemption, so the propagation-authorization window and the penalty-exemption window cannot disagree. Peers that were never on a committee remain excluded.
The authentication chain
An accepted gossip message has passed three independent checks, in this order.
- Message authenticity.
Gossipsub runs in
Signedauthenticity mode, so every message carries the source peer id and a signature over the message made with that peer’s libp2p network key. This proves the author owns the network key, and nothing more. - Identity resolution.
The peer manager maps a libp2p peer id to a BLS public key only through a signed node record it has verified, and the record’s signature is bound to a
(chain, role)domain so a record signed for one network never verifies on another. A record is accepted only when the network key it advertises matches the identity that published it, so relaying someone else’s record never lets the relayer claim that identity. Discovery covers the record itself, and Peers covers the mapping. - Allowlist membership. The resolved BLS key must appear in the topic’s allowlist for the current epoch.
The chain has no shortcuts. A peer with no resolved BLS identity fails step 3 on every restricted topic, regardless of how well-formed its message is.
Message size
MAX_GOSSIP_MESSAGE_SIZE is 12,000 bytes, sized to hold the largest legitimate gossip payload, a Certificate.
It is a network-wide protocol constant, not a per-node tunable, and it is deliberately not readable from operator configuration. The reason is the penalty path. An oversized message fatally bans the peer that relayed it, and that attribution is sound only when every honest node applies the identical bound. If one operator raised the limit locally, that node would forward payloads its neighbours consider oversized, and those honest neighbours would ban it. If an operator lowered it, that node would ban honest peers forwarding legitimate traffic.
The bound is enforced symmetrically. A node refuses to publish a message larger than the limit rather than emitting one its peers must reject, so on the first hop the originator is never the victim of its own ban.
Frame limits
Every gossip message is signed, and gossipsub verifies one signature for each message in a received frame.
That work runs before the duplicate cache and before the MAX_GOSSIP_MESSAGE_SIZE check, so the node sets explicit frame limits that the codec applies first, on the raw bytes, before it decodes the frame or verifies a signature.
A frame that breaks a limit closes the stream, and none of its messages are delivered.
- Frame size: 24,579 bytes. One honest frame is at most 16,387 bytes: one 12,000-byte payload plus a 512-byte bound on its envelope, or one 16 KiB control field plus its length prefix.
The node’s own
IHAVEgossip fits in that control field because of the cap on message ids perIHAVEbelow. The codec reads in 8 KiB chunks and checks the size of its whole read buffer, not of one frame, so the limit adds one read chunk. Without that slack, two maximum frames sent back to back can close an honest stream. The 16,387-byte bound covers the frames an author sends and the frames a node forwards, because the node rejects the one unsigned field that a forwarder could grow (see thekeyitem below). - Publish entries per frame: 8. An honest peer sends one message per frame. The library default of 500 would let one frame force 500 signature checks. This is a per-frame bound, not a rate bound.
- Control bytes per frame: 16 KiB. This equals the library default, set explicitly so that an upgrade cannot change it.
- Message ids per
IHAVEsent: 198. Each heartbeat, gossipsub sends oneIHAVEper topic to subscribed peers outside the mesh, except explicit peers. TheIHAVElists the validated message ids of the last three heartbeats, and gossipsub puts no byte cap on it. A message id is 71 bytes today, so on a 15-byte topic anIHAVEof 225 ids passes the 16 KiB control limit, and the receiver closes the stream. The library default allows 5000 ids. The node caps the ids perIHAVEat 198, which fits the limit with an 80-byte id on a 64-byte topic. Above the cap, each peer gets a different random subset of the ids, so gossip coverage drops but the stream stays open. The same setting caps the ids that the node requests from one peer withIWANTin one heartbeat. The cap changes only the frames that the node sends, so peers on other versions need no change. - Unsigned
keyfield: rejected. The author signsfrom,data,seqnoandtopic, but notkey. A node forwards a message as it received it, so without this check a peer could add bytes inkeyto a valid message, and every honest node would forward the larger copy. An ed25519 author never sendskey, because its public key is inlined in its peer id, so the node drops every message that carrieskey(issue #1699). This check drops the message only, and the stream stays open. It runs before the duplicate cache, so a later clean copy of the same message is accepted. The node does not penalize the peer, because a node on an older release forwards such a message without fault.
No topic has its own size limit, because MAX_GOSSIP_MESSAGE_SIZE applies to every topic.
The limits and the order in which the library applies them are recorded at gossipsub_config, with the resolved library versions.
A dependency upgrade must re-check both.
Penalty attribution
Rejection never propagates the message. The reason for the rejection decides only which peer, if any, loses reputation.
- Oversized payload: the relayer’s fault. An honest node never originates an oversized message and, under strict validation, never forwards one, so delivering one is misbehavior by the peer that delivered it. The relaying peer takes a fatal penalty.
- Unauthorized author: the author’s fault, charged only on the author’s own delivery. A forwarder that relayed content authored by someone else is not accountable for that content, so the relayer takes no penalty. The resolved author takes the fatal penalty only when the frame arrived over the author’s own connection, which is the one delivery that is the author’s act. A signed frame is static, and gossipsub remembers its id for only the 60 s duplicate-cache window, so any peer that received the frame while the author held a committee slot could deliver it again after the author left the previous, current and next window. Charging the author for such a delivery would let any connected peer ban an ex-committee validator at will (GHSA-vw36-8f6c-vppp), so a frame delivered by a peer other than its author is dropped and no one is charged.
If the accountable identity has not resolved — a peer can be connected and relaying before its node record arrives — the node skips the penalty entirely rather than charging whichever peer happens to be in hand. The same skip covers an anonymous message, a frame delivered by a peer other than its author, and the case where this node’s committee view lags a neighbour’s. Accepted messages carry both the relayer and the author onward, as optional identities, so a fault that only deep validation can surface is still charged to the author rather than the forwarder.
Validation configuration
Gossipsub runs with strict validation mode, manual message validation, and a one-second heartbeat interval. Manual validation is what allows the allowlist check to run before a message is re-propagated: the node reports accept or reject explicitly, and a rejected message is never forwarded.
Gossipsub’s own peer scoring is deliberately left disabled. The peer manager is the authoritative reputation system, and running gossipsub scoring alongside it would double-count the same misbehavior — once as a gossipsub score decay and again as a peer-manager penalty — with two sets of thresholds that could disagree about when to disconnect. Two gossipsub events do feed the peer manager directly: a peer that does not support gossipsub is fatally penalized, and a peer that persistently fails to keep up with the mesh takes a mild one.
Keeping scoring off has two consequences inside the library.
Upstream gossipsub removes an expired IWANT promise only from the scoring branch of its heartbeat, so a peer that advertises ids with IHAVE and never delivers would grow the promise map without bound.
Upstream also skips an advertised id while any peer holds a pending promise for it, so one peer’s unanswered promise, renewed with each IHAVE at no cost, would suppress the IWANT to every other advertiser of that id.
The node therefore carries patches/libp2p-gossipsub, which expires promises on every heartbeat, applies the broken-promise penalty only while scoring is active, and skips an advertised id only when the advertising peer itself already holds a pending promise for it; patches/libp2p-gossipsub/PATCH.md records the patch and its retirement criteria.
Topic re-validation in the application layer
Passing network-layer verification is not the end of the check. Every application handler re-reads the topic name on the message it received and confirms it matches the topic that payload type belongs on. A certificate delivered on the epoch-vote topic, or a batch digest delivered on a different worker’s topic, is a mismatch.
A mismatch is a fatal ban, charged to the author rather than the relayer, because the declared topic is part of the content the author produced. The check exists because the two layers are configured independently: the network layer knows only that the publisher was allowlisted for whichever topic the message declared, not that the payload belongs there.
Worker batch subscription is node-mode gated
The batch digest topic is the only one whose subscription depends on the node’s role for the epoch. Committee validators subscribe, which warms the batch cache the voting path reads. Observers unsubscribe.
Observers gain nothing from the digest announcements: batch bodies already reach them inside the verified consensus output and epoch packs they download, so prefetching would refetch bytes already in flight. The decision is two-sided rather than a simple skip, for the reason above — a node that subscribed as a validator in one epoch stays subscribed after it becomes an observer unless the subscription is explicitly dropped, and skipping would also skip the only refresh of that topic’s allowlist. See Network architecture for the node roles this gate reads.
Source of truth
| Behavior | Code |
|---|---|
| Topic names | crates/config/src/network.rs (LibP2pConfig topic constructors) |
| Message size limit | crates/config/src/network.rs (MAX_GOSSIP_MESSAGE_SIZE) |
Gossipsub configuration, frame limits, the IHAVE id cap and key rejection | crates/network-libp2p/src/gossip_config.rs (gossipsub_config, RejectGossipKey), called from ConsensusNetwork::new |
| Allowlist check and subscribe/unsubscribe | crates/network-libp2p/src/consensus.rs (verify_gossip, NetworkCommand::Subscribe) |
| Penalty attribution | crates/network-libp2p/src/consensus.rs (RejectReason::penalty) |
| Per-epoch subscription and allowlists | crates/node/src/manager/node/start_epoch.rs (spawn_primary_network_for_epoch, spawn_worker_network_for_epoch) |
| Application-layer topic re-validation | crates/consensus/primary/src/network/handler.rs, crates/consensus/worker/src/network/handler.rs |
This page mirrors those files. Update this page when those files change.