Skip to content

fix: validate user operation hash before lookup#385

Open
samsamtrum wants to merge 1 commit into
etherspot:developfrom
samsamtrum:fix-userop-hash-validation
Open

fix: validate user operation hash before lookup#385
samsamtrum wants to merge 1 commit into
etherspot:developfrom
samsamtrum:fix-userop-hash-validation

Conversation

@samsamtrum

@samsamtrum samsamtrum commented May 24, 2026

Copy link
Copy Markdown

Validates eth_getUserOperationByHash input before checking the mempool or chain logs.

Missing, non-hex, or non-bytes32 hashes now return the existing INVALID_USEROP error instead of being passed through to lookup code.

Validation:

  • git diff --check
  • npm run lint -- --quiet packages/executor/src/modules/eth.ts blocked by an existing eslint-plugin-prettier / Prettier API mismatch: prettier.resolveConfig.sync is not a function
  • npx tsc -p packages/executor/tsconfig.build.json --noEmit blocked because workspace packages such as @skandha/types/lib/... and @skandha/params/lib/... are not built in this checkout

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The Eth module now validates user operation hashes before lookup. It imports isHex from viem and applies strict hex validation (length 66) in getUserOperationByHash. Invalid hashes throw an RpcError with code INVALID_USEROP before any mempool or entry-point queries execute.

Changes

Hash Validation

Layer / File(s) Summary
Hash validation with strict hex check
packages/executor/src/modules/eth.ts
Import isHex validator and apply it in getUserOperationByHash to verify hash is a valid 66-character hex string, rejecting invalid hashes with INVALID_USEROP error before mempool/entry-point lookups.

🎯 2 (Simple) | ⏱️ ~10 minutes

A hash so fine, must pass the hex line,
Strict validation guards each sign,
Invalid ones thrown with care,
Before the mempool's midnight air. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing the required 'Types of changes' section and 'Further comments' section from the template. Add the 'Types of changes' section with appropriate checkboxes marked and optionally include 'Further comments'. At minimum, indicate whether this is a bugfix, new feature, or other type of change.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding validation for user operation hash before lookup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@samsamtrum samsamtrum changed the title Validate user operation hash before lookup fix: validate user operation hash before lookup May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant