Repository navigation
feat: add requestsHash to Block type - #5647
Merged
Merged
Conversation
|
@mortezashojaei is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 2dc4d79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #5646
Why
Since Prague, nodes return
requestsHash(EIP-7685) on block objects, and it's in the execution-apis block schema.formatBlockalready passes it through at runtime (the existinggetBlockpending-block key snapshot includes"requestsHash"), butBlock/RpcBlockdon't declare it. Code that rebuilds block headers fromgetBlock()ends up working around it: an intersection type in bgd-labs/aave-governance-ui-helpers,@ts-expect-errorin axiom-crypto/keystore-quickstart,RpcBlock & { requestsHash?: Hex }in OffchainLabs/l1-voting-tooling, and a rawas unknownRPC call in NethermindEth/aztec-l1-read-benchmarks. Permalinks are in #5646.What
src/types/block.ts: addsrequestsHash?: Hash | undefinedwith TSDoc, next to the other optional post-merge header fields. This matchesox'sBlocktype. It's type-only, and there's no runtime change.getBlock.test-d.ts: adds arequestsHashassertion to the existingblockTag = "latest"case.Usage
Validation
tsc -p src/tsconfig.json --noEmit: passes.getBlock.test-d.tsplus a header-reconstruction PoC, typechecked through a temporary tsconfig that extendstest/tsconfig.json: passes with this change. Without it, they fail withTS2339: Property 'requestsHash' does not exist on type 'Block'. (pnpm test:typecheckreports no matching files in this repo config, so I verified the type test this way.)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-existingtest.skip).biome checkon 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 theparentBeaconBlockRootprecedent (#2719).AI assistance
I prepared this with help from an AI coding assistant (Claude Code). I reviewed the evidence, diff, and test results.