Skip to content

fix: stale auth state poisoning#618

Open
aromancev wants to merge 1 commit into
foxssake:mainfrom
aromancev:fix/history-stale-auth-state
Open

fix: stale auth state poisoning#618
aromancev wants to merge 1 commit into
foxssake:mainfrom
aromancev:fix/history-stale-auth-state

Conversation

@aromancev

@aromancev aromancev commented Jun 22, 2026

Copy link
Copy Markdown

Currently, a stale auth state can poison history preventing local corrections when diff states are enabled.

Failure mode:

  1. Server recorded history with state X for ticks 1 and 2 and sent it to the client for tick 1 (no need to send 2 because no diff from 1).
  2. Client recorded tick 1 as auth and carried forward tick 2 (also as auth) with state X.
  3. Server received client input for tick 1 and resimulated local state to Y for ticks 1 and 2. It then calculated the diff and sent state Y for tick 1 to the client (no need to send 2 because no diff from 1).
  4. Client received the correct state Y for tick 1 and started resimulating from tick 1 but unable to correct state for 2 because it's marked as auth.
  5. Carry-forward for state Y for tick 2 does not happen on the client because some state already exists. Corrected auth state Y for tick 2 will never be sent from the server because there is no diff between 1 and 2. The situation only resolves at the next full state send, which produces visible artifacts, such as HP jumping back and forth.

This change truncates all local history on receiving auth state from the past. Tested with out of order delivery and did not discover any new failure modes.

This is just one edge case with diff + auth state history. It is probably less risky and easier to maintain if it's truncated to avoid playing whack-a-mole with more edge cases.

@aromancev aromancev force-pushed the fix/history-stale-auth-state branch from 02e1edc to 45642d0 Compare June 22, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant