Skip to content

fix(web): reject empty hex input in the auditor decoder - #296

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
s6pa1rta3n-lab:fix-issue-251
Sep 8, 2026
Merged

fix(web): reject empty hex input in the auditor decoder#296
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
s6pa1rta3n-lab:fix-issue-251

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown
Contributor

Summary of Changes

  • Auditor Decoder (apps/web/src/lib/hex.ts): Updated hexToBytes to reject empty (""), whitespace-only (" "), and prefix-only ("0x", "0X") strings with Error("invalid hex string") instead of returning an empty byte array.
  • Unit Tests (apps/web/src/lib/hex.test.ts): Added comprehensive tests covering empty inputs, whitespace-only, prefix-only, odd length, invalid characters, valid prefixed/unprefixed strings, whitespace trimming, byte encoding, and round-trips.
  • Test Script (apps/web/package.json): Included src/lib/hex.test.ts in the web workspace test command.

Closes #251

Acceptance Criteria Checklist

  • Empty, whitespace-only, and prefix-only inputs are rejected with "invalid hex string".
  • Valid prefixed and unprefixed hex still decode correctly.
  • Helper tests are included in the normal web test command.
  • Web tests (pnpm web:test) and typecheck (pnpm web:typecheck) pass.

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

@karagozemin
karagozemin marked this pull request as ready for review September 8, 2026 17:17
Copilot AI lite review requested due to automatic review settings September 8, 2026 17:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes match the stated acceptance criteria and include targeted test coverage for the updated helper contract.

Pull request overview

This PR tightens the hexToBytes helper contract in the web app so that missing/empty hex payloads fail early with a clear "invalid hex string" error, improving the auditor decoding flow and aligning behavior with Issue #251.

Changes:

  • Updated hexToBytes to reject empty/whitespace-only/prefix-only inputs instead of returning an empty Uint8Array.
  • Added focused unit tests for invalid/valid hex decoding plus bytesToHex encoding and round-trips.
  • Ensured the new test file is executed by the web workspace test script.
File summaries
File Description
apps/web/src/lib/hex.ts Rejects empty decoded payloads while keeping existing validation and decoding behavior for valid hex.
apps/web/src/lib/hex.test.ts Adds coverage for empty/prefix-only/invalid inputs and validates correct decoding/encoding behavior.
apps/web/package.json Includes the new hex helper test in the web:test script’s explicit test file list.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@karagozemin
karagozemin merged commit 0cdd8e4 into Sub-Rosa-Issue:main Sep 8, 2026
2 of 3 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

Development

Successfully merging this pull request may close these issues.

fix(web): reject empty hex input in the auditor decoder

3 participants