Skip to content

feat(puzzles): add deterministic solution checker with rate limiting - #868

Merged
dzekojohn4 merged 2 commits into
UnityChainxx:mainfrom
Penielka:fix/penielka-issue-713
Oct 21, 2026
Merged

dzekojohn4 merged 2 commits into
UnityChainxx:mainfrom
Penielka:fix/penielka-issue-713

Conversation

@Penielka

@Penielka Penielka commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds a centralized PuzzleSolutionCheckerService that validates off-chain puzzle answers against the server-side solution before on-chain submission.
  • Normalizes answers deterministically (Unicode NFKC, trim, case-insensitive) and compares SHA-256 digests with timingSafeEqual.
  • Rate limits checks per player/IP and puzzle, returning 429 when the limit is exceeded.
  • Persists every attempt (including rate-limited and unknown-puzzle attempts) with a hashed answer, outcome, IP, user agent, and duration for abuse detection. Raw answers are never stored.
  • Exposes POST /api/puzzle-solution/check.
  • Repairs the corrupted backend/src/main.ts bootstrap that prevented the Nest app (and new module) from compiling.

Tests

cd backend
npx jest src/puzzle-solution-checker --runInBand
npx eslint "src/puzzle-solution-checker/**/*.ts" "src/main.ts" "src/app.module.ts"

All 8 new tests pass. tsc -p tsconfig.build.json still reports pre-existing errors in unrelated modules.

Closes #713
closes #708
closes #760
closes #719

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@Penielka Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@dzekojohn4 dzekojohn4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dzekojohn4
dzekojohn4 merged commit 1bf5e83 into UnityChainxx:main Oct 21, 2026
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants