PR-A: reviewer remediation (S-02 v2, S-08, S-10) + PoC suite - #12
Merged
Conversation
… S-10 raw-sMax views + 26-file PoC suite Applies the three verified fixes from the 2026-08 external review (baseline 58971c05, artifacts zip per-file checksums 33/33): - S-02 v2 (Medium): evict ghost entry before re-entry; one address can never hold both a ghost and a live ranked lot - S-08: forward compaction preserves arrival order (swap-and-pop promoted the last staker at an honest staker's expense) - S-10: views divide by raw sMax, matching settlement (V.8 view==materialized) Adds the reviewer's 26 PoC/regression tests; 2 demonstration PoCs converted to regression form (marker patch_prA_s02_regression). Post-patch src/StakeEngine.sol sha256 a0f5bfdb…3a746490. Suite: 325 passed / 0 failed / 54 suites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR-A — independent security review remediation (vs freeze 58971c05)
Applies the three verified remediation patches delivered by the independent
reviewer (@ibnu76, engagement letter 2026-08-25, report 2026-08-24) and carries
his 26 proof-of-concept / adversarial test files into the suite.
Findings fixed
compactLotsused reverse swap-and-pop, silently promoting the last staker into the removed slot at another honest staker's expensesMaxwhile settlement (_forceSnapshot) divides by rawsMax, breaking V.8 (view == materialised) whenever the decay fallback is livesMax, matching settlementThe reviewer's superseded S-02 v1 patch (passes the green baseline but
orphans 500e18 of user funds — the concrete proof that a green baseline does
not validate a fix) is not applied; it is retained as a record in the
artifacts archive, and
S02FixOrphanCheckPoC.t.solis the regression testthat catches it.
Test suite
26 reviewer test files added (PoCs, validation, adversarial regression, scope
coverage, Z3-backed closures for S-06/S-07/S-04). Two demonstration-form PoCs
(
test_S02_Differential,test_S02_RealToken) asserted the presence of theS-02 advantage and were converted to regression form (marker
patch_prA_s02_regression): they now assert ghost-scenario ≡ fresh-scenarioexactly. Originals preserved unmodified in the artifacts archive.
Verification (reproduced independently before this PR)
sha256sum -c CHECKSUMS.sha256— 33/33 OKsrc/StakeEngine.solsha2567beaca7f…matches the reviewer's manifestbyte-for-byte; finding's PoC flips; 232 baseline stays green
forge fmt --checkclean, slither gate GREEN (89 baseline fingerprints, nonew findings)
src/StakeEngine.solsha256:a0f5bfdbeee955c951930dbda30a76040136bf047973a00221ecb2433a746490Notes
lots; it runs only on the rare ghost-re-entry branch.
S10ValidationPoCstays in the suite as the V.8 guard.sequenced with PR-C per SESSION-STATE.