Skip to content

fix(evm): decode web3_sha3 DATA before hashing - #2787

Open
vetclippy wants to merge 1 commit into
NibiruChain:mainfrom
vetclippy:main
Open

vetclippy wants to merge 1 commit into
NibiruChain:mainfrom
vetclippy:main

Conversation

@vetclippy

Copy link
Copy Markdown
Contributor

Abstract

  • Closes #<ISSUE_NUMBER>

web3_sha3 was accepting its input as a Go string. As a result, hexutil.Bytes(input) converted the hexadecimal string into its ASCII bytes instead of decoding the Ethereum DATA value.

Summary of Changes

  • Change APIWeb3.Sha3 to accept hexutil.Bytes.
  • Let the JSON-RPC layer decode the 0x-prefixed input.
  • Add direct unit coverage for the Keccak-256 result.
  • Add HTTP JSON-RPC coverage for web3_sha3.

Testing Approach

  • go test ./evm/jsonrpc -count=1
  • git diff --check

Why this Solution Works

hexutil.Bytes implements Ethereum-compatible hexadecimal JSON decoding. The method now hashes the decoded bytes, matching the behavior of Geth and the Ethereum JSON-RPC specification.

Signed-off-by: vetclippy <vetclippy@icloud.com>
@vetclippy
vetclippy requested a review from a team as a code owner October 2, 2026 09:37
@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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