Skip to content

fix(replication): require aged repair hints before audits#135

Merged
jacderida merged 3 commits into
WithAutonomi:rc-2026.6.2from
mickvandijke:fix/audit-repair-hint-min-age
Jun 12, 2026
Merged

fix(replication): require aged repair hints before audits#135
jacderida merged 3 commits into
WithAutonomi:rc-2026.6.2from
mickvandijke:fix/audit-repair-hint-min-age

Conversation

@mickvandijke

@mickvandijke mickvandijke commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

What this changes

The PR changes audit eligibility for replica chunks.

Previously, once this node had sent a peer a repair hint for a chunk, that peer could become audit-eligible for that chunk after the existing later sync-epoch gate.

Now, the repair hint must satisfy both conditions before the peer can be audited for that chunk:

  1. The hint was recorded in an earlier local sync epoch.
  2. The hint is at least 1 hour old.

Concretely:

  • Adds REPAIR_HINT_MIN_AGE = 1 hour.
  • Stores the local Instant when a repair hint is recorded as sent.
  • Updates has_mature_replica_hint to require elapsed time >= 1 hour.
  • Applies the same maturity check to normal audits and prune-confirmation audits.
  • Keeps production timestamp recording internal, so callers cannot spoof the send time.
  • Adds tests covering fresh hints being rejected and old hints being accepted.

This prevents this failure mode: we send a peer a repair hint for chunk K, then immediately audit that peer for K before it had a fair chance to fetch/store it.

Tests

  • cargo fmt --all -- --check
  • cargo test repair_proofs --lib
  • cargo test audit_key_filter_retains_stable_proofs_and_rejects_evicted_peers --lib
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --features test-utils --test e2e test_prune_pass_requires_remote_confirmation_before_delete -- --nocapture

…pair-hint-min-age

# Conflicts:
#	src/replication/pruning.rs
@jacderida jacderida merged commit d66ed8b into WithAutonomi:rc-2026.6.2 Jun 12, 2026
11 checks passed
jacderida added a commit that referenced this pull request Jun 16, 2026
Re-pin the saorsa-core git dep to the current rc-2026.6.2 commit (79f5ad6,
post-#135) so the lock reference matches the branch. Lock-only; no version
bump, no tag.
jacderida added a commit to grumbach/ant-node that referenced this pull request Jun 22, 2026
 logging to subtree/byte audits)

Resolve conflicts after main advanced (incl. WithAutonomi#157 audit-challenge logging,
WithAutonomi#135 aged repair hints, the prune-proof/admission gate, and the neighbor-sync
hints refactor):

- neighbor_sync: thread the gossiped commitment through main's hints-based
  sync path (sync_with_peer_with_hints). The commitment piggybacks on
  NeighborSync messages, so this is load-bearing for the gossip-triggered
  subtree audit (ADR-0002), not optional. Fixes a silent (non-marker)
  auto-merge breakage that referenced `commitment` without a parameter.
- mod.rs: keep the ADR-0002 gossip-audit trigger; combine main's per-batch
  sync hints with the per-round my_commitment snapshot at every sync call
  site; take main's new VERIFICATION_CYCLE_SLOW_LOG_MS.
- pruning: keep main's record_prune_lookup_groups prune-proof/admission gate
  AND re-apply the ADR-0002 commitment-retention veto (is_held) so a key still
  committed under a recently-gossiped commitment is never pruned.
- tests/e2e: union both sides' prune tests; fill the merged PrunePassContext
  (repair_proof_now + commitment_state) on every literal.

Fold WithAutonomi#157's audit-challenge logging convention into the subtree and byte
challenge responders (received + reply sent/not-sent via
send_replication_response_checked) and the capacity-dropped paths.

Verified: cargo fmt --check, cargo check --all-targets (+test-utils), and
cargo clippy --all-targets --features test-utils all clean; cargo test --lib
--features test-utils -> 674 passed, 0 failed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants