aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-08 22:47:10 +0000
committertv <tv@krebsco.de>2026-11-09 00:14:20 +0100
commite7d02e2d71cd4c339b386a751f32050d33f86b89 (patch)
tree350a7a7eec479c76768a7fa4d5797b184571fb4d /src/transport
parenteae437ce2734b8d65bf40aa207c134a3c641138f (diff)
swarm: no SIGNATURES
Signatures sent on their own (SIGNATURES, every second, to each peer not sent them yet) flooded every link: a signature made after its change left, or one that came with changes, went to every neighbour, whether or not it got the change along with its signature elsewhere. With every change of a node signed as it leaves (1217) and signatures going where their changes go (1218), none is left for them to carry: the message, its task and its traffic counter go (wire version 46). Signatures waiting for their changes are offered as before when sync messages bring them, and the changes waiting for signatures judged again with the next batch.
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/mod.rs16
-rw-r--r--src/transport/traffic.rs6
-rw-r--r--src/transport/wire.rs13
3 files changed, 2 insertions, 33 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index 640754a..d794271 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -252,8 +252,6 @@ pub(crate) enum ParsedMessage {
NeighbourReply(NeighbourAnswer),
/// Tells the recipient we are neighbours no more (`swarm::hyparview`).
Disconnect(NeighbourAnswer),
- /// Signatures of changes, sent on their own (`swarm::signatures`).
- Signatures(SignaturesMessage),
/// Changes the sender refused, of those the recipient brought (`swarm::refusals`).
Refusals(RefusalsMessage),
}
@@ -273,17 +271,6 @@ pub(crate) struct RefusalsMessage {
pub(crate) changes: Vec<crate::document::ChangeHash>,
}
-/// SIGNATURES: signatures of changes no sync message took (`swarm::signatures`).
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub(crate) struct SignaturesMessage {
- #[serde(with = "crate::transport::wire::codec::epoch")]
- pub(crate) epoch: Epoch,
- /// See `SyncEnvelope::epoch_seq`.
- pub(crate) epoch_seq: u32,
- /// As `SyncEnvelope::signatures`.
- pub(crate) signatures: serde_bytes::ByteBuf,
-}
-
/// A node's proof that it holds the key of its node ID (`identity`), sending from its
/// transport address to the recipient's: a signature over both addresses
/// (`transport::identity::signed`). WHO and ME end at the identity layer; the rest of
@@ -429,7 +416,6 @@ pub(crate) enum MessageKind {
Neighbour,
NeighbourReply,
Disconnect,
- Signatures,
Refusals,
}
@@ -453,7 +439,6 @@ impl ParsedMessage {
ParsedMessage::Neighbour(_) => MessageKind::Neighbour,
ParsedMessage::NeighbourReply(_) => MessageKind::NeighbourReply,
ParsedMessage::Disconnect(_) => MessageKind::Disconnect,
- ParsedMessage::Signatures(_) => MessageKind::Signatures,
ParsedMessage::Refusals(_) => MessageKind::Refusals,
}
}
@@ -480,7 +465,6 @@ impl ParsedMessage {
ParsedMessage::NeighbourReply(answer) | ParsedMessage::Disconnect(answer) => {
Some((answer.epoch, answer.epoch_seq))
}
- ParsedMessage::Signatures(message) => Some((message.epoch, message.epoch_seq)),
ParsedMessage::Refusals(message) => Some((message.epoch, message.epoch_seq)),
ParsedMessage::Who(_)
| ParsedMessage::Me(_)
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs
index e810595..b9506a9 100644
--- a/src/transport/traffic.rs
+++ b/src/transport/traffic.rs
@@ -57,8 +57,6 @@ pub(crate) struct ByKind {
pub(crate) plumtree: Counter,
/// NEIGHBOUR, NEIGHBOUR_REPLY and DISCONNECT (`swarm::hyparview`).
pub(crate) hyparview: Counter,
- /// SIGNATURES (`swarm::signatures`).
- pub(crate) signatures: Counter,
/// REFUSALS (`swarm::refusals`).
pub(crate) refusals: Counter,
}
@@ -77,7 +75,6 @@ impl ByKind {
MessageKind::Probe,
MessageKind::Prune,
MessageKind::Neighbour,
- MessageKind::Signatures,
MessageKind::Refusals,
] {
let theirs = *other.get(kind);
@@ -100,7 +97,6 @@ impl ByKind {
MessageKind::Neighbour | MessageKind::NeighbourReply | MessageKind::Disconnect => {
&self.hyparview
}
- MessageKind::Signatures => &self.signatures,
MessageKind::Refusals => &self.refusals,
}
}
@@ -120,7 +116,6 @@ impl ByKind {
MessageKind::Neighbour | MessageKind::NeighbourReply | MessageKind::Disconnect => {
&mut self.hyparview
}
- MessageKind::Signatures => &mut self.signatures,
MessageKind::Refusals => &mut self.refusals,
}
}
@@ -331,7 +326,6 @@ fn names(kind: MessageKind) -> (&'static str, &'static str) {
MessageKind::Neighbour => ("NEIGHBOUR", "hyparview"),
MessageKind::NeighbourReply => ("NEIGHBOUR_REPLY", "hyparview"),
MessageKind::Disconnect => ("DISCONNECT", "hyparview"),
- MessageKind::Signatures => ("SIGNATURES", "signatures"),
MessageKind::Refusals => ("REFUSALS", "refusals"),
}
}
diff --git a/src/transport/wire.rs b/src/transport/wire.rs
index 5763407..450ecb0 100644
--- a/src/transport/wire.rs
+++ b/src/transport/wire.rs
@@ -14,7 +14,7 @@ use super::{EncodedMessage, MessageKind, ParsedMessage};
/// The wire format's version, the first byte of every payload. Bump it with every change
/// to a message type or a codec (`golden_bytes` fails then).
-pub(crate) const VERSION: u8 = 45;
+pub(crate) const VERSION: u8 = 46;
/// What the second byte of a payload says.
fn tag(kind: MessageKind) -> u8 {
@@ -36,7 +36,6 @@ fn tag(kind: MessageKind) -> u8 {
MessageKind::Neighbour => 16,
MessageKind::NeighbourReply => 17,
MessageKind::Disconnect => 18,
- MessageKind::Signatures => 19,
MessageKind::Refusals => 20,
}
}
@@ -99,7 +98,6 @@ pub(crate) fn encode(message: &ParsedMessage) -> Result<Vec<u8>, WireError> {
ParsedMessage::NeighbourReply(answer) | ParsedMessage::Disconnect(answer) => {
rmp_serde::encode::write(&mut payload, answer)?
}
- ParsedMessage::Signatures(message) => rmp_serde::encode::write(&mut payload, message)?,
ParsedMessage::Refusals(message) => rmp_serde::encode::write(&mut payload, message)?,
}
Ok(payload)
@@ -180,8 +178,6 @@ pub(crate) fn decode(payload: &[u8]) -> Result<ParsedMessage, WireError> {
ParsedMessage::NeighbourReply(rmp_serde::from_slice(body)?)
} else if is(MessageKind::Disconnect) {
ParsedMessage::Disconnect(rmp_serde::from_slice(body)?)
- } else if is(MessageKind::Signatures) {
- ParsedMessage::Signatures(rmp_serde::from_slice(body)?)
} else if is(MessageKind::Refusals) {
ParsedMessage::Refusals(rmp_serde::from_slice(body)?)
} else {
@@ -545,11 +541,6 @@ pub(crate) fn samples() -> Vec<ParsedMessage> {
epoch_seq: 1,
agreed: false,
}),
- ParsedMessage::Signatures(crate::transport::SignaturesMessage {
- epoch,
- epoch_seq: 1,
- signatures: serde_bytes::ByteBuf::from(vec![9; 96]),
- }),
ParsedMessage::Refusals(crate::transport::RefusalsMessage {
epoch,
epoch_seq: 1,
@@ -586,7 +577,7 @@ mod tests {
#[test]
fn every_kind_round_trips() {
let samples = samples();
- assert_eq!(samples.len(), 19, "a kind is missing from `samples`");
+ assert_eq!(samples.len(), 18, "a kind is missing from `samples`");
for message in samples {
let bytes = encode(&message).unwrap();
let decoded = decode(&bytes).unwrap();