[GH-ISSUE #5132] Anticheat prediction: a burst of ticks loses the setback point (agreed is overwritten after an illegal tick) #1561

Closed
opened 2026-11-02 15:48:00 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @Joansitoh on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5132

Originally assigned to: @iseaprojects on GitHub.

🤖 Agent: Filed by Joansitoh's AI agent (Claude Code, Sonnet), not by Joansitoh personally.

Anticheat prediction: when an illegal tick and a legal one are replayed in the same catch_up, the setback point is already the cheated position.

In Replay::play_to (crates/horizon-client/src/lan/prediction.rs), play snaps the body to the position the client claimed, even for a tick over tolerance. The next tick is then replayed from that spot. If the client carries on legally from there (a blink or teleport), its offset is within tolerance and (self.agreed, self.drift) = (self.said, 0) overwrites agreed with a position that is already displaced. guest_replay (game/prediction.rs) calls catch_up once and reads agreed() once, so the setback sends the player to the cheated spot.

Repro on upstream/main (38a97ea), a temporary unit test next to a_cheat_counts_from_where_it_started (not committed): ticks 0-19 honest, tick 20 claims +3.0 in x, tick 21 is a legal move from there.

  • One catch_up per tick: after tick 20, over = {ticks: 1, worst: 3.0} and agreed = [20.5, 5.5, 24.4435] (the last honest position). Correct.
  • One catch_up covering ticks 20 and 21: over = {ticks: 1, worst: 3.0, weight: 5.0} but agreed = [23.5, 6.2532, 25.1574], the cheated position. The violation is counted, the setback does nothing.

a_cheat_counts_from_where_it_started calls catch_up once per tick and its cheat stays illegal on every tick, so neither it nor the step, spider and jesus tests reach this path. A sustained speed or fly hack is not affected (every tick stays over tolerance, agreed stays put). Ticks arrive in bursts whenever the server tick lags the client, so a one-tick position lie followed by an honest tick is enough.

Impact: prediction only logs by default in #5125 (setback/alert/kick at 0), so today this matters once the check is turned on to act. Not checked: whether #5125 changes anything in prediction.rs.

Possible fix: keep the anchor from the first over-tolerance tick for the rest of the call (for example a "violated since last agreed" flag in play_to, or carry the pre-violation anchor in Over), and add a test that replays an illegal and a legal tick in one catch_up.

Originally created by @Joansitoh on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5132 Originally assigned to: @iseaprojects on GitHub. > 🤖 Agent: Filed by Joansitoh's AI agent (Claude Code, Sonnet), not by Joansitoh personally. **Anticheat prediction: when an illegal tick and a legal one are replayed in the same `catch_up`, the setback point is already the cheated position.** In `Replay::play_to` (`crates/horizon-client/src/lan/prediction.rs`), `play` snaps the body to the position the client claimed, even for a tick over tolerance. The next tick is then replayed from that spot. If the client carries on legally from there (a blink or teleport), its offset is within tolerance and `(self.agreed, self.drift) = (self.said, 0)` overwrites `agreed` with a position that is already displaced. `guest_replay` (`game/prediction.rs`) calls `catch_up` once and reads `agreed()` once, so the setback sends the player to the cheated spot. **Repro on `upstream/main` (38a97ea)**, a temporary unit test next to `a_cheat_counts_from_where_it_started` (not committed): ticks 0-19 honest, tick 20 claims +3.0 in x, tick 21 is a legal move from there. - One `catch_up` per tick: after tick 20, `over = {ticks: 1, worst: 3.0}` and `agreed = [20.5, 5.5, 24.4435]` (the last honest position). Correct. - One `catch_up` covering ticks 20 and 21: `over = {ticks: 1, worst: 3.0, weight: 5.0}` but `agreed = [23.5, 6.2532, 25.1574]`, the cheated position. The violation is counted, the setback does nothing. `a_cheat_counts_from_where_it_started` calls `catch_up` once per tick and its cheat stays illegal on every tick, so neither it nor the step, spider and jesus tests reach this path. A sustained speed or fly hack is not affected (every tick stays over tolerance, `agreed` stays put). Ticks arrive in bursts whenever the server tick lags the client, so a one-tick position lie followed by an honest tick is enough. **Impact:** `prediction` only logs by default in #5125 (setback/alert/kick at 0), so today this matters once the check is turned on to act. Not checked: whether #5125 changes anything in `prediction.rs`. **Possible fix:** keep the anchor from the first over-tolerance tick for the rest of the call (for example a "violated since last agreed" flag in `play_to`, or carry the pre-violation anchor in `Over`), and add a test that replays an illegal and a legal tick in one `catch_up`.
Author
Owner

@apeirs commented on GitHub (Oct 31, 2026):

🤖 Agent: comment by apeirs's AI agent (Cursor, Grok 4.7), not by apeirs personally.

/claim

<!-- gh-comment-id:6544297245 --> @apeirs commented on GitHub (Oct 31, 2026): > 🤖 Agent: comment by apeirs's AI agent (Cursor, Grok 4.7), not by apeirs personally. /claim
Author
Owner

@apeirs commented on GitHub (Oct 31, 2026):

/unclaim

<!-- gh-comment-id:6544333426 --> @apeirs commented on GitHub (Oct 31, 2026): /unclaim
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

🤖 Claims: refused, You don't hold this issue. (asked by @apeirs)

<!-- gh-comment-id:6544335214 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): 🤖 Claims: refused, You don't hold this issue. (asked by @apeirs)
Author
Owner

@iseaprojects commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6544952161 --> @iseaprojects commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1561
No description provided.