Bounty
XE-16824 · Bounty

[Low] SwapBlock unwinding a lease_cancel deletes the reputation aggregate via Revert, losing activity timestamps

Closed · duplicate —claimed Minor xe#662 filed 2026-11-17 06:23 UTC by kecedanzz77-bit

Report

Summary

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.

Counters are all zero in both states, so no counter data is lost — only the timestamps plus determinism. Severity Low.

Root cause

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.

Verification

Found 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.

Note on related reports

Distinct from:

  • #654 — Revert never restores FirstActivityAt/LastActivityAt (stale timestamps after a partial fork unwind). This report is about deletion of the record, not stale values.
  • #226 v3 — renewal durations dropped from LeaseHoursSettled + fallback timestamp uses base duration; different mechanism and code path.

Suggested fix

Preserve the record (and its timestamps) when FirstActivityAt/LastActivityAt are set, or include timestamp presence in the deletion condition.

Thread

Joseph Denneteam2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-7716, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-16824 and says what differs; it is read like any other.