diff --git a/pkgs/id/crates/id-events/src/event_store/ingest.rs b/pkgs/id/crates/id-events/src/event_store/ingest.rs
index 84b244d9f5..230e1b3006 100644
--- a/pkgs/id/crates/id-events/src/event_store/ingest.rs
+++ b/pkgs/id/crates/id-events/src/event_store/ingest.rs
@@ -7,8 +7,11 @@
//! rules. Anything that fails is refused as [`Refusal::Malformed`].
//! 2. **Duplicate.** An event whose ID is stored, or is one of its author's fork proof
//! headers, changes nothing.
-//! 3. **Frozen.** An event above its author's fork point is refused as
-//! [`Refusal::Frozen`].
+//! 3. **Fork point.** If the author has a fork proof at the event's own sequence number,
+//! the proof keeps the two lowest IDs there: an event that joins them replaces the
+//! proof (step 4), and one that displaces neither header is refused as
+//! [`Refusal::Frozen`]. An event above the fork point is not refused for sitting
+//! there: it goes on to the steps below, and is kept as voided evidence when it links.
//! 4. **Fork.** If the author has another event at the same sequence number, stored or
//! held, the two are a fork, whatever their backlinks and dependencies. The proof for that
//! sequence number holds the two lowest IDs there, and the proofs at higher points stay. The
@@ -79,12 +82,16 @@
//! the refused rival is sent again, while the other event is still held. The behaviour is
//! pinned by `test_a_rival_refused_by_the_cap_is_seen_only_when_sent_again`.
//!
-//! # Known limit: a rival refused as frozen
+//! # Events above a fork point are kept as evidence
//!
-//! An event above its author's fork point is refused as frozen when it arrives after the fork.
-//! When it arrives before, it is kept as voided. So an `after` hash that names such an event is
-//! present in some arrival orders and not in others. The batch property names rivals, but it
-//! compares the batch path with per-event ingest in one arrival order, so it holds either way.
+//! An event above its author's fork point is decided on its own conflicts, backlink, and
+//! dependencies, like any other event. When it links, it is stored as voided evidence: the
+//! resolution never applies it, but it is present, so an `after` hash that names it is
+//! satisfied in every arrival order — the same state as when it arrived before the fork and
+//! the fork voided it. One whose backlink can never link is parked, and one that waits is
+//! held, as below the fork point. Only an event at a fork proof's own sequence number that
+//! displaces neither of the proof's two headers is refused as frozen: the position holds
+//! one event, and the headers are the events present there.
//!
//! The property tests in `tests/event_store_properties.rs` check the applied state against
//! this definition, for every arrival order.
@@ -100,7 +107,7 @@ use super::waiting_rows::{Hold, Mirror};
use super::{
ACTIONS, APPLIED, CHAINS, Chain, DEVICE_OPS, EVENTS, EventStore, FORKS, ForkProof, HASHES,
PROOF_HEADERS, PROOF_IDS, StoreError, corrupt, decode_stored, lowest_proof, position_key,
- store_body, store_chain, store_event, store_fork,
+ proof_at, store_body, store_chain, store_event, store_fork,
};
use super::{Ingest, Refusal};
use id_core::membership::AuthId;
@@ -962,26 +969,29 @@ fn decide_in(
if let Some(stored) = stored_at(txn, &author, seq)? {
conflicts.push(stored);
}
- if let Some(proof) = read_proof(txn, &author)? {
- if seq > proof.seq {
+ // A proof at the event's own sequence number governs it, wherever that point sits:
+ // the proof keeps the two lowest IDs there, and an arrival that displaces neither
+ // header is refused as frozen. It cannot be kept as evidence instead: the position
+ // holds one event, and the two headers are the events present there.
+ if let Some(proof) = read_proof_at(txn, &author, seq)? {
+ conflicts.extend([proof.first.clone(), proof.second.clone(), event.clone()]);
+ let (first, second) = two_lowest(conflicts)?;
+ if first.id == proof.first.id && second.id == proof.second.id {
return Ok(Decision::Refuse(Refusal::Frozen));
}
- if seq == proof.seq {
- // Another event at the fork point. The proof keeps the two lowest IDs there.
- conflicts.extend([proof.first.clone(), proof.second.clone(), event.clone()]);
- let (first, second) = two_lowest(conflicts)?;
- if first.id == proof.first.id && second.id == proof.second.id {
- return Ok(Decision::Refuse(Refusal::Frozen));
- }
- store_fork(txn, &author, seq, &first, &second)?;
- return Ok(Decision::Fork {
- seq,
- proof: [first.id, second.id],
- });
- }
+ store_fork(txn, &author, seq, &first, &second)?;
+ return Ok(Decision::Fork {
+ seq,
+ proof: [first.id, second.id],
+ });
}
+ // Above the author's fork point the event is not refused for sitting there. It is
+ // decided on its own conflicts, backlink, and dependencies below, and kept as voided
+ // evidence when it links, so an `after` hash that names it is present in every
+ // arrival order — the state it would be in had it arrived before the fork. The
+ // resolution never applies it: it sits at or above the fork point.
if !conflicts.is_empty() {
- // The first conflict at this sequence number, or one below the fork point.
+ // The first conflict at this sequence number, at any point of the chain.
conflicts.push(event.clone());
let (first, second) = two_lowest(conflicts)?;
store_fork(txn, &author, seq, &first, &second)?;
@@ -1226,6 +1236,15 @@ fn read_proof(txn: &WriteTransaction, author: &AuthorKey) -> Result