Skip to content

feat: add requestsHash to Block type - #5647

Merged
jxom merged 1 commit into
wevm:mainfrom
mortezashojaei:feat/block-requests-hash
Nov 23, 2026
Merged

jxom merged 1 commit into
wevm:mainfrom
mortezashojaei:feat/block-requests-hash

Conversation

@mortezashojaei

Copy link
Copy Markdown
Contributor

Refs #5646

Why

Since Prague, nodes return requestsHash (EIP-7685) on block objects, and it's in the execution-apis block schema. formatBlock already passes it through at runtime (the existing getBlock pending-block key snapshot includes "requestsHash"), but Block / RpcBlock don't declare it. Code that rebuilds block headers from getBlock() ends up working around it: an intersection type in bgd-labs/aave-governance-ui-helpers, @ts-expect-error in axiom-crypto/keystore-quickstart, RpcBlock & { requestsHash?: Hex } in OffchainLabs/l1-voting-tooling, and a raw as unknown RPC call in NethermindEth/aztec-l1-read-benchmarks. Permalinks are in #5646.

What

  • src/types/block.ts: adds requestsHash?: Hash | undefined with TSDoc, next to the other optional post-merge header fields. This matches ox's Block type. It's type-only, and there's no runtime change.
  • getBlock.test-d.ts: adds a requestsHash assertion to the existing blockTag = "latest" case.
  • Patch changeset.

Usage

const block = await client.getBlock()
block.requestsHash // `0x${string}` | undefined

Validation

  • tsc -p src/tsconfig.json --noEmit: passes.
  • getBlock.test-d.ts plus a header-reconstruction PoC, typechecked through a temporary tsconfig that extends test/tsconfig.json: passes with this change. Without it, they fail with TS2339: Property 'requestsHash' does not exist on type 'Block'. (pnpm test:typecheck reports no matching files in this repo config, so I verified the type test this way.)
  • PoC against Anvil (Prague) using the typed getBlock() result with no cast: keccak256(rlp(header)) === block.hash. This was a throwaway script and isn't included in the PR.
  • pnpm test --run src/actions/public/getBlock.test.ts src/utils/formatters/block.test.ts src/actions/public/watchBlocks.test.ts: 42 passed, 1 skipped (pre-existing test.skip).
  • biome check on the changed files: clean.

Compatibility

This adds an optional field, so it isn't breaking. Pre-Prague blocks and chains without EIP-7685 get undefined. It follows the parentBeaconBlockRoot precedent (#2719).

AI assistance

I prepared this with help from an AI coding assistant (Claude Code). I reviewed the evidence, diff, and test results.

@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dc4d79

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

@jxom
jxom merged commit e3f5dc9 into wevm:main Nov 23, 2026
26 of 35 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 23, 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