Repository navigation
Conversation
…PerGas Without chain fee hooks, estimateFeesPerGas requested the block and then the priority fee, although the priority fee does not depend on the block. They are now requested together, and legacy fees no longer request the block, which only chain fee hooks read. prepareTransactionRequest no longer requests the block for legacy fees either. The block error still takes precedence over the priority fee error, and chains with fee hooks keep the sequential order. Co-authored-by: jxom <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a1e1b3-ba60-755b-bfd0-1a31a4a5bf1e
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 4094aa0 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 |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b832fd33ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { createTestClient, defineChain } from '../../index.js' | ||
| import type { Block } from '../../types/block.js' | ||
| import type { Chain } from '../../types/chain.js' |
There was a problem hiding this comment.
Import newly used public APIs through the package entrypoint
The newly added defineChain and Chain imports use relative source paths, contrary to the explicit test-import requirement in AGENTS.md. Both are public exports of viem, so import them from 'viem'; the exceptions for internal helpers and chain definitions do not apply to these exports. This keeps the new tests exercising the supported package surface rather than bypassing it.
AGENTS.md reference: AGENTS.md:L188-L193
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4094aa0: defineChain and Chain now come from 'viem'.
|
Published pnpm add viem@pr-5527
pnpm add [email protected] |
|
Bundled into #5543 as its own commit, so this PR is superseded. Closing in favour of the bundle. |
Without chain fee hooks,
estimateFeesPerGasrequested the latest block and then the priority fee, although the priority fee does not depend on the block. It also requested the block for legacy fees, which only chain fee hooks read.prepareTransactionRequestdid the same for legacy fees.estimateFeesPerGasnow requests the block and the priority fee together (EIP-1559), and skips the block for legacy fees.prepareTransactionRequestpasses the block to legacy fee estimation only when the chain has fee hooks (it reuses the type-detection block when there is one).Effect
Real in-process
node:httpJSON-RPC server adding 50 ms per request, real Viem clients overhttp(url). Depth is the longest chain of requests that each wait for the previous one.mainestimateFeesPerGas(EIP-1559)estimateFeesPerGas({ type: 'legacy' })prepareTransactionRequest,type: 'legacy'on an EIP-1559 networkprepareTransactionRequest, legacy network (type cache warm)prepareTransactionRequest, default on an EIP-1559 networkBehavior
feeskeep the sequential order (multiplier, block, then the hook or the priority fee), and legacy fees still request the block for them.BaseFeeScalarErroris still thrown before any request. Every early-started promise has.catch(() => {})attached when it is created.estimateFeesPerGas()with the defaulttype: 'eip1559'now sendseth_maxPriorityFeePerGasbefore throwing the sameEip1559FeesNotSupportedError.Tests
httptransport'sonFetchRequestandonFetchResponsehooks against Anvil: block and priority fee overlap, legacy fees skip the block, and both stay sequential with a fee hook (inestimateFeesPerGasandprepareTransactionRequest).createRpcProxytest delays a failing block and fails the priority fee and its gas price fallback right away. It reports the block error, and reports the gas price error if the priority fee is awaited first.estimateFeesPerGas.test.tspasses. InprepareTransactionRequest.test.ts, onlywith eth_fillTransaction > args: maxFeePerGas (under default tip)fails, and it fails the same way onmainwith Anvil 1.9.0.The nonce manager (#5528) and cold-client priority fee (#5529) changes to
prepareTransactionRequestare separate PRs. All three merge cleanly together, and the combined branch passes type checks and the same tests.