Repository navigation
feat: return blob gas fields from getFeeHistory - #5634
Closed
mortezashojaei wants to merge 1 commit into
Closed
mortezashojaei wants to merge 1 commit into
mortezashojaei wants to merge 1 commit into
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: f22599e 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 |
mortezashojaei
force-pushed
the
feat/fee-history-blob-fields
branch
from
November 21, 2026 19:14
5097310 to
f22599e
Compare
Member
|
Thanks @mortezashojaei, this is a great addition! I've kept your commit and continued it in #5635 with a couple of small fixes on top: the formatter now omits the blob fields when a node doesn't return them (instead of leaving |
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.
Resolves discussion #4436.
Problem
eth_feeHistoryreturnsbaseFeePerBlobGasandblobGasUsedRatioon post-Dencun nodes, and both are in the execution-apis spec.formatFeeHistorycopies only the pre-4844 fields, sogetFeeHistorydrops them and theFeeHistory/RpcFeeHistorytypes don't declare them.Consumers who need blob fees fall back to an untyped
client.requestand cast the result:src/lib/feeHistory.ts("viem's getFeeHistory drops those"), call sitesdk/src/relay/l1Submitter.ts("Theeth_feeHistoryfields viem's typed result omits"), castOther tools that price blobs read these same fields from their own RPC clients, e.g. l2beat. Alloy's
FeeHistoryincludes them too.Solution
FeeHistorygains optionalbaseFeePerBlobGas?: quantity[] | undefinedandblobGasUsedRatio?: number[] | undefined, with TSDoc taken from the spec.RpcFeeHistory(and so theeth_feeHistoryEIP-1193 return type) picks them up through the generic.formatFeeHistorymapsbaseFeePerBlobGastobigintand passesblobGasUsedRatiothrough, following the existingreward?.mappattern.The fields are optional because pre-4844 nodes and some L2s don't return them. No new functions or options.
Tests
Folded into the existing cases:
src/utils/formatters/feeHistory.test.ts: added blob fields to the existing RPC fixture and snapshot.src/actions/public/getFeeHistory.test.ts: the existing snapshots now include the blob fields that the mainnet fork actually returns. Before this change those three snapshots stayed the same because the fields were dropped.src/actions/public/getFeeHistory.test-d.ts: assertsbaseFeePerBlobGas: bigint[] | undefinedandblobGasUsedRatio: number[] | undefined(fails againstmain's types).Docs: added the blob fields to the
// @log:response ingetFeeHistory.md.Commands run locally:
pnpm test --run src/actions/public/getFeeHistory.test.ts src/utils/formatters/feeHistory.test.ts src/actions/public/estimateFeesPerGas.test.ts src/actions/public/estimateMaxPriorityFeePerGas.test.ts: 4 files passed (37 passed, 1 skipped)pnpm test --run src/clients/decorators/public.test.ts:getFeeHistorypassed.getProoffailed against the default public fork RPC withdistance to target block exceeds maximum proof window, which is unrelated to this change.tsc -p src/tsconfig.json --noEmit: passedtscrun of the changed test files, includinggetFeeHistory.test-d.ts: passedbiome checkon the changed files: cleanCompatibility
Additive only: two optional fields on a return type. Existing code compiles and behaves the same, except that results now also contain the blob arrays (or
undefinedwhen the node omits them).AI assistance: prepared with Claude Code; I reviewed the diff and the test output.