Skip to content

fix: strip error keyword in normalizeSignature - #5290

Closed
wavebyrd wants to merge 1 commit into
wevm:mainfrom
wavebyrd:fix/normalize-signature-error
Closed

wavebyrd wants to merge 1 commit into
wevm:mainfrom
wavebyrd:fix/normalize-signature-error

Conversation

@wavebyrd

Copy link
Copy Markdown
Contributor

normalizeSignature strips a leading function or event keyword but not error, so string error signatures keep the keyword and hash to the wrong selector:

toFunctionSelector('error Foo(uint256)') // hashes "error Foo(uint256)"
toFunctionSelector('Foo(uint256)')       // 0x1176bd96

This adds error to the keywords it skips, which is what ox does too. The new normalizeSignature case fails without the change and the rest of src/utils/hash passes.

@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6e5a8f2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Oct 24, 2026

Copy link
Copy Markdown

@wavebyrd is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/viem@5290

commit: 6e5a8f2

jxom commented Oct 26, 2026

Copy link
Copy Markdown
Member

Thanks @wavebyrd, the fix is correct. Closing in favor of #5300, which keeps your commit and changeset as-is and adds a toFunctionSelector test for error signatures plus a TSDoc tweak.


Generated by Claude Code

@jxom jxom closed this Oct 26, 2026
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.

2 participants