{"id":"XE-16824","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"662","source_url":"https://github.com/xeprotocol/xe/issues/662","reporter_id":2920,"title":"[Low] SwapBlock unwinding a lease_cancel deletes the reputation aggregate via Revert, losing activity timestamps","area":"node-api","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-7716","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:24:29.408864+00:00","updated_at":"2026-11-22T23:26:15.782845+00:00","source_created_at":"2026-11-17T06:23:54+00:00","told_at":"2026-11-22T23:26:15.808470+00:00","status_changed_at":"2026-11-22T23:26:15.793381+00:00","url":"https://bounty.xe.network/XE-16824","body":"## Summary\n\n`ReputationEngine.Revert` deletes the whole reputation aggregate when the counters hit zero — but the \"no counters\" check ignores `FirstActivityAt`/`LastActivityAt`, which the forward path recorded from other lease events. Swapping out a `lease_cancel` (the only counter event for the account) therefore deletes the record entirely, including timestamps recorded by other events. The post-swap ledger has NO reputation record for the account while replay-from-chains produces a zero-counter record: strict replay determinism is broken.\n\nCounters are all zero in both states, so no counter data is lost — only the timestamps plus determinism. Severity Low.\n\n## Root cause\n\n`ReputationEngine.Revert` (`core/reputation.go:203-226`) deletes the aggregate (memory + store via `DeleteReputation`, `:215`) when `hasNoCounters()` (`core/reputation.go:149-159`) is true after reverting. `hasNoCounters` checks only the 9 counters and never looks at `FirstActivityAt`/`LastActivityAt`.\n\n## Verification\n\nFound by stateful fuzzing of `Ledger.AddBlock` (40 instances in this round). Minimized reproducer, 27 blocks: lease `45386c5e` → cancel `3a56ca37` (swapped out); fork send `bfcaca53`. Replay 27/27 into a fresh ledger, `SwapBlock` succeeds, replay-from-chains state differs: reputation record missing in the first ledger, zero-counter record (`accP=0 accC=0 setP=0 setC=0 hrsP=0 hrsC=0 canC=0 unfP=0 unfC=0`) in the second. Supply post-swap conserved.\n\n## Note on related reports\n\nDistinct from:\n- #654 — `Revert` never *restores* `FirstActivityAt`/`LastActivityAt` (stale timestamps after a partial fork unwind). This report is about *deletion* of the record, not stale values.\n- #226 v3 — renewal durations dropped from `LeaseHoursSettled` + fallback timestamp uses base duration; different mechanism and code path.\n\n## Suggested fix\n\nPreserve the record (and its timestamps) when `FirstActivityAt`/`LastActivityAt` are set, or include timestamp presence in the deletion condition.","patch_refs":[],"thread":[{"id":18858,"source":"desk","source_ref":"reply:16535","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-7716, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-16824 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:15.782845+00:00"}]}