From a924641aafb03eeb56feb121af5b245f741ef8ec Mon Sep 17 00:00:00 2001 From: kuel27 <35112637+kuel27@users.noreply.github.com> Date: Sat, 29 Aug 2026 18:49:43 +0300 Subject: [PATCH] Fix false TT hits for zero verification keys When a TT slot is cleared, it has a verification key zero, but zero is also a valid 21-bit verification key. So a probe with this key can match an unused slot and read zeroed data as a valid TT entry. To fix this, reserve verification key zero for unused slots. Skip TT reads and writes for positions with this key. Bench: 2957947 --- src/transposition.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/transposition.rs b/src/transposition.rs index cd37eef2c..618ecfe43 100644 --- a/src/transposition.rs +++ b/src/transposition.rs @@ -193,6 +193,11 @@ impl TranspositionTable { }; let key = verification_key(hash); + + if key.0 == 0 { + return None; + } + let index = cluster.lookup_key(key); if index < cluster.entries.len() { @@ -227,6 +232,11 @@ impl TranspositionTable { }; let key = verification_key(hash); + + if key.0 == 0 { + return; + } + let tt_age = self.age(); let replacement_index = {