[PR #5873] [MERGED] Anticheat prediction: a client still slowed by an item use the server ended isn't flagged #6530

Closed
opened 2026-11-03 06:22:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5873
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/prediction-item-use


📝 Commits (1)

  • 30dfdc3 Anticheat prediction: a client still slowed by an item use the server ended isn't flagged

📊 Changes

2 files changed (+169 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/lan/prediction.rs (+77 -2)
📝 tools/anticheat_e2e.py (+92 -10)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #5860.

On the official server (prediction check, log only), players using an item on the move get flagged in bursts. They move at the item-use speed (0.043 blocks/tick) while the replay walks faster: one player reached VL 131 in 10 seconds, another had a shield in the off hand each time. I reproduced it with a real Horizon client: a golden apple eaten while walking with the use key held, then the next one, was flagged and sent back.

Cause

The client finishes a use on its own ticks and the server on its own. The server can also stop a use for its own reasons (a shield disabled). The replay plays each client tick with the server's state at the end of the server tick that heard it, and only tries the other state on the one tick where the server's changed. So the client is still slowed for a few ticks after the server's use ended.

Change

  • For 10 ticks after the server's item use ends, candidate 2 (item use) also tries the client still slowed by it, at the speed the server last had.
  • Slower than the keys allow is no advantage. The other direction (a use the server has and the client may not) still counts at once, as before: the client's use packet comes before its tick's move, so a no-slow is caught.
  • Per-move cost: nothing on ticks outside those 10. Within them, the candidate loop runs the tick twice (one PlayerMotion clone), as it already does on the tick where the server's state changes.

Tests

  • item_uses_a_few_ticks_apart_from_the_servers_are_played: the client stays slowed 3 and 9 ticks after the server's use ends; nothing counts. It fails without the change.
  • a_use_without_its_slowdown_is_caught: a client at full speed through a 60-tick use the server started is caught on at least 40 of the 48 ticks after the window.
  • The 16 other replay tests pass unchanged.
  • tools/anticheat_e2e.py: two new checks, with a real Horizon client through the 20-120 ms jitter relay:
    • prediction-items: a shield raised from the off hand while walking, trying to sprint, switching hotbar slots, strafing, jumping and swinging at a cow, then raised in quick taps; two golden apples eaten in a row; a bow drawn while walking. Before the change it was flagged and sent back; after, it was never flagged in 3 runs out of 3.
      • One run with the slot switch and the start of eating in the same tick had a single tick off (VL 2.6, under the setback at 5). With the steps 10 ticks apart, as a player does them, nothing is flagged.
    • prediction-water: a pool 10 deep (sprint-swimming down and up, jump held at the surface, sinking, sneaking down, climbing out onto a ledge), a current, a bubble column. Never flagged, before and after. The water flags seen on the server don't reproduce in these cases; a follow-up adds the position to the log lines to find them.
    • --check prediction: the honest client is never flagged, and the bot is flagged 13 times and sent back 12 times.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 35f5e95f5, 7 min 33 s)

Check Result
Scope ✅ 2 files, +169 −12
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 515 passed (1 min 20 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 12 s)
tests: horizon-client ✅ 1689 passed (4 min 18 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 34 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 22 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5873 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/prediction-item-use` --- ### 📝 Commits (1) - [`30dfdc3`](https://github.com/horizon-rust/horizon/commit/30dfdc3e1ce0564acd78812e64f0531a946d725d) Anticheat prediction: a client still slowed by an item use the server ended isn't flagged ### 📊 Changes **2 files changed** (+169 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/prediction.rs` (+77 -2) 📝 `tools/anticheat_e2e.py` (+92 -10) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #5860. On the official server (prediction check, log only), players using an item on the move get flagged in bursts. They move at the item-use speed (0.043 blocks/tick) while the replay walks faster: one player reached VL 131 in 10 seconds, another had a shield in the off hand each time. I reproduced it with a real Horizon client: a golden apple eaten while walking with the use key held, then the next one, was flagged and sent back. ## Cause The client finishes a use on its own ticks and the server on its own. The server can also stop a use for its own reasons (a shield disabled). The replay plays each client tick with the server's state at the end of the server tick that heard it, and only tries the other state on the one tick where the server's changed. So the client is still slowed for a few ticks after the server's use ended. ## Change - For 10 ticks after the server's item use ends, candidate 2 (item use) also tries the client still slowed by it, at the speed the server last had. - Slower than the keys allow is no advantage. The other direction (a use the server has and the client may not) still counts at once, as before: the client's use packet comes before its tick's move, so a no-slow is caught. - Per-move cost: nothing on ticks outside those 10. Within them, the candidate loop runs the tick twice (one `PlayerMotion` clone), as it already does on the tick where the server's state changes. ## Tests - `item_uses_a_few_ticks_apart_from_the_servers_are_played`: the client stays slowed 3 and 9 ticks after the server's use ends; nothing counts. It fails without the change. - `a_use_without_its_slowdown_is_caught`: a client at full speed through a 60-tick use the server started is caught on at least 40 of the 48 ticks after the window. - The 16 other replay tests pass unchanged. - `tools/anticheat_e2e.py`: two new checks, with a real Horizon client through the 20-120 ms jitter relay: - `prediction-items`: a shield raised from the off hand while walking, trying to sprint, switching hotbar slots, strafing, jumping and swinging at a cow, then raised in quick taps; two golden apples eaten in a row; a bow drawn while walking. Before the change it was flagged and sent back; after, it was never flagged in 3 runs out of 3. - One run with the slot switch and the start of eating in the same tick had a single tick off (VL 2.6, under the setback at 5). With the steps 10 ticks apart, as a player does them, nothing is flagged. - `prediction-water`: a pool 10 deep (sprint-swimming down and up, jump held at the surface, sinking, sneaking down, climbing out onto a ledge), a current, a bubble column. Never flagged, before and after. The water flags seen on the server don't reproduce in these cases; a follow-up adds the position to the log lines to find them. - `--check prediction`: the honest client is never flagged, and the bot is flagged 13 times and sent back 12 times. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 35f5e95f5, 7 min 33 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +169 −12 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 515 passed (1 min 20 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 12 s) | | tests: horizon-client | ✅ 1689 passed (4 min 18 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 34 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 22 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:29 +07:00
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#6530
No description provided.