fix: normalize eth_estimateGas for Hardhat on hpp#351
Merged
yashvanthbl137-crypto merged 1 commit intomasterfrom Apr 14, 2026
Merged
fix: normalize eth_estimateGas for Hardhat on hpp#351yashvanthbl137-crypto merged 1 commit intomasterfrom
yashvanthbl137-crypto merged 1 commit intomasterfrom
Conversation
016ddf8 to
3d55b6c
Compare
3d55b6c to
616c00e
Compare
Contributor
Author
Contributor
Author
nvrakesh06
approved these changes
Apr 14, 2026
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.




Summary
Fixes failed
eth_estimateGasduring Hardhat contract deploys on HPP mainnet (--network hpp) when the estimate request includes gas / EIP-1559 fields from Hardhat + ethers. The hook normalizes the RPC payload to match a minimal{ from, data, … }estimate (same idea as a minimalcurl).Problem
On HPP mainnet,
eth_estimateGascould fail withcontract creation code storage out of gaswhen the transaction object included fields such asgasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas, ortype. The same bytecode could estimate successfully when those fields were omitted.@nomicfoundation/hardhat-ethersusesprovider.send("eth_estimateGas", [...]), so adjusting onlyrequest()is not sufficient.Solution
config/hppHardhatEstimateGasFix.ts:extendEnvironmentwrapssendandrequestwhenhre.network.name === 'hpp'(HPP mainnet only). Foreth_estimateGas, strip:gas,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,typebefore forwarding.hardhat.config.ts: import the module right afterdotenv.config()so it loads for all Hardhat entrypoints.HPP Sepolia (
thpp) is unchanged — the workaround is not applied there.Actual transaction broadcast / deploy txs are unchanged; only the estimateGas RPC shape is adjusted.
Ticket: CGARD-454