Task
Adopt dig-sex 0.4 in dig-node-core and thread residency into tier-0 selection.
This is not a mechanical version bump, and treating it as one silently defeats the change it adopts.
Why
dig-sex 0.4 makes the displacement margin reachable — SPEC 8.5's named primary defence against attacker-driven cache thrashing, previously implemented, tested, and unreachable through the only API a consumer calls.
It required two facts to reach selection, not one: the margin itself, and per-candidate incumbency. A margin alone cannot work, because hysteresis is a comparison between an incumbent and a challenger — a candidate set that cannot tell them apart cannot apply a margin whatever value it is handed.
The trap
tier0_prefetch::run_round has no residency information at all today. It samples from DHT probes, scores, selects and fetches with nothing consulting what is already held.
So resident: false would compile, would pass, and would reproduce exactly the churn the margin exists to stop — while the API now looks correct. That is the same defect one layer deeper and harder to see.
The call site
crates/dig-node-core/src/tier0_prefetch.rs, in run_round:
- line ~410 gains
resident: held.contains(&sc.content_id)
- line ~420 becomes
select_within_capacity(&selector_cands, SelectionPolicy::new(budget, SelectionSeed::from_peer_id(&node.peer_id)))
Thread the held-set in as an argument. run_round is deliberately pure — that purity is what fixed the #1991 parallel-runner env race — so the held-set joins the already-injected enabled / load / rate rather than being read from a global.
TieredPolicy::new is unchanged, so its two call sites need nothing.
Two minors, not one
Cargo.toml:348 still pins dig-sex = "0.2" while the crate is at 0.4.0. The 0.3.0 crate-root re-export work is also unadopted, so this covers both jumps.
Acceptance bar
A re-sampled already-held candidate is not re-fetched. That is the behaviour the margin buys and the only thing that proves the adoption is real rather than typed.
A test asserting resident is populated is not enough — it must assert the outcome, because a wrong-but-compiling resident: false passes any test that only checks the field exists.
Parent
Orchestrator epic: https://github.com/DIG-Network/dig_ecosystem/issues/3138
Task
Adopt
dig-sex0.4 indig-node-coreand thread residency into tier-0 selection.This is not a mechanical version bump, and treating it as one silently defeats the change it adopts.
Why
dig-sex0.4 makes the displacement margin reachable — SPEC 8.5's named primary defence against attacker-driven cache thrashing, previously implemented, tested, and unreachable through the only API a consumer calls.It required two facts to reach selection, not one: the margin itself, and per-candidate incumbency. A margin alone cannot work, because hysteresis is a comparison between an incumbent and a challenger — a candidate set that cannot tell them apart cannot apply a margin whatever value it is handed.
The trap
tier0_prefetch::run_roundhas no residency information at all today. It samples from DHT probes, scores, selects and fetches with nothing consulting what is already held.So
resident: falsewould compile, would pass, and would reproduce exactly the churn the margin exists to stop — while the API now looks correct. That is the same defect one layer deeper and harder to see.The call site
crates/dig-node-core/src/tier0_prefetch.rs, inrun_round:resident: held.contains(&sc.content_id)select_within_capacity(&selector_cands, SelectionPolicy::new(budget, SelectionSeed::from_peer_id(&node.peer_id)))Thread the held-set in as an argument.
run_roundis deliberately pure — that purity is what fixed the #1991 parallel-runner env race — so the held-set joins the already-injectedenabled/load/raterather than being read from a global.TieredPolicy::newis unchanged, so its two call sites need nothing.Two minors, not one
Cargo.toml:348still pinsdig-sex = "0.2"while the crate is at 0.4.0. The 0.3.0 crate-root re-export work is also unadopted, so this covers both jumps.Acceptance bar
A re-sampled already-held candidate is not re-fetched. That is the behaviour the margin buys and the only thing that proves the adoption is real rather than typed.
A test asserting
residentis populated is not enough — it must assert the outcome, because a wrong-but-compilingresident: falsepasses any test that only checks the field exists.Parent
Orchestrator epic: https://github.com/DIG-Network/dig_ecosystem/issues/3138