diff options
| author | tv <tv@krebsco.de> | 2026-11-19 01:48:57 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-19 03:18:49 +0100 |
| commit | 03744437a5ffc36fbb5e973a0ddfd6b91945b212 (patch) | |
| tree | 227eb42b4e7cac546b857cfacb79ab890e8bb137 /src/federation/party.rs | |
| parent | f24063e90d02ef76d87401d6e74cf8c9f489ff7d (diff) | |
federation: votes on the events proposing a checkpoint above its heads
Anyone could propose a checkpoint's version again, by an event beside its heads. A node
voting by itself, and a party's client, built a vote on every event proposing what it
voted on, so every vote was beside the heads, and no version event written on them was
taken: the checkpoint could never move the store. And the voters' rule refused it once
that event was held for a while, as the heads left it out.
They vote on the events proposing it that are above the heads it names
(`State::proposing`), which `GET /events/counts` lists as `proposals`; where there are
none, `none` says so, the node casts nothing and the client says why. The voters' rule
leaves proposals and votes aside, as they lapse with the move.
Row 70 is tested (`federation_attack_70`).
Diffstat (limited to 'src/federation/party.rs')
| -rw-r--r-- | src/federation/party.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs index 04837c3..162f8bd 100644 --- a/src/federation/party.rs +++ b/src/federation/party.rs @@ -696,6 +696,9 @@ async fn vote( }; let proposals = ids(&proposal, "proposals"); let Some(proposing) = proposals.first().copied() else { + if let Some(why) = ballots[proposal.to_string()]["none"].as_str() { + bail!("{proposal}: {why}"); + } bail!("no proposal of hash {proposal} on the current version, as the node reads it"); }; let proposed = match Event::read(&node.event(&proposing).await?) { @@ -731,8 +734,8 @@ async fn vote( let kept = record .may_vote(¤t, proposal, &proposed, yes, &nays) .map_err(|why| anyhow!(why))?; - // On the events proposing it: above the heads it names for a checkpoint wherever they - // are, so a version event may be written on it. + // On the events proposing it the node shows, those above the heads it names for a + // checkpoint, so a version event may be written on it. let cast = signer.sign(&proposals, event::vote(current.hash, proposal, yes))?; record.cast(¤t, &cast, kept); record.save(path).map_err(|why| anyhow!(why))?; @@ -799,6 +802,9 @@ async fn proposals(node: &Node) -> Result<()> { parties(&proposal["no"]) ); let Some(id) = proposal["proposals"][0].as_str() else { + if let Some(why) = proposal["none"].as_str() { + println!(" backed by no client: {why}"); + } continue; }; let id = Id::from_hex(id).ok_or_else(|| anyhow!("the node names no event ID: {id}"))?; |
