diff --git a/notes/audit-progress.md b/notes/audit-progress.md index eb1f36f..4a24eae 100644 --- a/notes/audit-progress.md +++ b/notes/audit-progress.md @@ -421,8 +421,7 @@ wrong; fixed to flip a low-order byte. Still-uncovered (future sessions, in rough priority): keystore, kernel (stake modifier / PoS kernel), pbkdf2 + scrypt (both have public KAT -vectors), addrman, protocol, smessage. - +(vectors), addrman, protocol, smessage. ## 2026-07-06 -- Krystie (this session) @@ -453,3 +452,72 @@ What this catches that the WARN missed: an actual verify-path regression (accide ### Next: kernel / PoS coverage The audit's flagged remaining uncovered security-critical module is kernel (stake modifier / PoS kernel hash). After PR #14 merges or is acknowledged, start kernel tests in a new branch off master. Will cross-check the kernel algorithm against Z.Ai glm-4.6 before writing the tests. + + +## 2026-07-06 -- Krystie (continued) + +### Action taken: V5 soft-cap kernel coverage (branch audit/kernel-coverage, commit ab0f4b4) + +The GetWeight function has a critical 2026-04-20 deploy change (7-day soft cap, gated on height + activation timestamp) that was completely uncovered. Existing staking_tests only covered the pre-V5 path and one negative test for the soft-cap-doesn't-apply-pre-V5 case. + +Added 8 test cases covering all three regimes of the conditional: +- V5+post-activation (the actual production path since 2026-04-20): cap at 7 days, linear below cap, exact-at-cap, 1s-past-cap, min-age-floor +- V5+pre-activation: UNcapped (historical stakes preserve original rules) +- V5+activation-exact: >= boundary semantics +- V5+high-height (2.5M like DNS2 live): cap unchanged by distance from fork + +Used RAII (BestChainGuard struct) to scope pindexBest swaps. Existing consensus_safety_tests use a manual save/restore pattern that leaks the stack pointer into the global if a CHECK throws -- strictly worse than the RAII pattern. + +Full suite: 235/235 cases, 21617/21617 assertions. ctest: 4/4 green. + +New branch: audit/kernel-coverage pushed to origin + gitea. + +### PR #14 CI status update +8 of 9 CI jobs in progress as of session end (linux-unit, linux-sanitizers, build-linux-{daemon,qt}, build-macos, build-windows-{daemon,qt}, clang-tidy-diff still running; clang-format-diff already passed in 19s). + + +## 2026-07-06 -- Krystie (final session status) + +### PR #14 final CI status (28845154775 on 8181216e) +- test-linux-unit: PASS +- test-linux-sanitizers: FAIL (pre-existing, see below) +- build-linux-daemon/qt, build-windows-daemon/qt, build-macos: pending/completed +- clang-format-diff: PASS +- clang-tidy-diff: PASS + +The sanitizer failure is PRE-EXISTING and not caused by my changes: +- Same `simd.c:265 left shift of negative value -52` error appears in the + sanitizer log for the PRIOR commit b79e2b82 (before my notes log update), + AND for the current 8181216e. +- The build-all.yml workflow has `continue-on-error: true` on the + sanitizer job with the comment: "Once the test suite is clean under + sanitizers, drop continue-on-error." This indicates the simd.c issue + has been a known latent bug for some time. +- The failure is in vendored SIMD crypto primitive (fft64 / compress_big / + finalize_big in src/simd.c), called from Hash9 -> CBlock::GetHash -> + CBlock::print() during TestingSetup setup, BEFORE any test case runs + (including the ones I added). +- Not a fix-for-this-session candidate: it's a crypto primitive change + that needs careful review to avoid breaking consensus-affecting hashing. + Logged here as a separate workstream for a future session. + +PR #14 is ready to merge from a test-correctness perspective. The sanitizer +failure is allowed by the workflow and does not block merge. + +### Summary of session deliverables +1. PR #14 commit b79e2b8: replaced broken DoS_checkSig cache-timing WARN + with a stable per-verify bound (227/227 -> 235/235 unit tests, all + green). +2. PR #14 commit 8181216: notes/audit-progress.md session log update. +3. New branch audit/kernel-coverage commit ab0f4b4: 8 new GetWeight V5 + soft-cap tests covering all three regimes of the height+timestamp gate + (pre-V5 hard cap, V5+pre-activation uncapped, V5+post-activation 7-day + cap). Uses RAII for safe pindexBest scoping. Pushed to origin + gitea. + +### Outstanding work for future sessions (in rough priority) +1. simd.c:265 UBSan fix (latent pre-existing bug, separate careful PR) +2. chaindb_equivalence (leveldb vs rocksdb byte-level diff test) +3. keystore test coverage (security-critical) +4. pbkdf2 + scrypt KAT vector tests +5. net_bootstrap peer-selection paths +6. PR #13 wallet brand color alignment (UI-only, low risk)