Skip to content

fix(bootstrap): age-bound and refresh close-group cache - #149

Open
dirvine wants to merge 3 commits into
mainfrom
fix/close-group-cache-hygiene
Open

fix(bootstrap): age-bound and refresh close-group cache#149
dirvine wants to merge 3 commits into
mainfrom
fix/close-group-cache-hygiene

Conversation

@dirvine

@dirvine dirvine commented Aug 6, 2026

Copy link
Copy Markdown
Member

Linear issue

V2-884 — Age-bound and refresh the saorsa-core close-group bootstrap cache

Risk tier

  • T0 — docs / tooling / CI / pure UX-output. Repo CI only.
  • T1 — client-only, no network-facing behavior change. CI + prod compat smoke.
  • T2 — node/client logic with behavioral surface, no protocol/format/economics change. Dev testnet + ADR.
  • T3 — protocol / storage format / payments / routing. T2 evidence + adversarial testing.

Compatibility

  • Wire: none; no protocol messages or peer validation rules change.
  • Storage: existing close_group_cache.json format is unchanged. Old cache files remain readable. Old serialized NodeConfig values that omit the new field receive the one-hour default; explicit null preserves disabled TTL.
  • API: adds NodeConfig::close_group_cache_max_age and a builder setter. This is source-breaking for downstream code that constructs the public NodeConfig with a struct literal; builder and deserialization callers remain compatible.

Semver impact

  • breaking
  • feature
  • fix

Test evidence

  • cargo check --all-targets --all-features — passed.
  • cargo test --lib — 475 passed; unrelated floating-point tolerance test adaptive::trust::tests::test_unit_weight_equivalence failed once at a 1.78e-10 difference, then passed 5/5 isolated reruns.
  • Earlier exact-head run before the diagnostics-only follow-up: 476 passed, 0 failed.
  • Focused cache/config/task lifecycle tests — passed.
  • cargo clippy --all-targets --all-features -- -D warnings — passed.
  • cargo fmt --all -- --check and git diff --check — passed.

The proposed T2 classification still requires dev-testnet evidence before release. Detailed matrix: V2-894.

New dependency

none

ADR

ADR-016 — Age-Bounded, Periodically Refreshed Close-Group Cache — Proposed; human acceptance pending.

Mitigation / rollback

Disable age enforcement with close_group_cache_max_age: null, disable cache persistence by omitting close_group_cache_dir, or revert this PR; configured bootstrap peers remain the fallback path.

@dirvine
dirvine force-pushed the fix/close-group-cache-hygiene branch from fd822d0 to 22326b5 Compare August 6, 2026 21:04
Hermes Agent added 2 commits August 7, 2026 15:57
…he, reject future timestamps

- Bind cached addresses to their expected PeerId at dial time; reject and
  disconnect on handshake identity mismatch so address reassignment cannot
  import trust from the wrong peer.
- Clear/replace the on-disk cache when the authoritative close group is
  empty instead of leaving stale entries intact.
- Reject cache timestamps more than five minutes in the future (also when
  max-age enforcement is disabled) so wall-clock skew cannot bypass TTL.
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.

1 participant