fix: refactor batcher gas config and fix Hemi deployment hang - #347
Merged
Conversation
nvrakesh06
marked this pull request as draft
April 1, 2026 10:26
nvrakesh06
force-pushed
the
fix/hemi-batcher-gas-estimation
branch
from
April 1, 2026 12:06
653072e to
daaa760
Compare
nvrakesh06
force-pushed
the
fix/hemi-batcher-gas-estimation
branch
from
April 1, 2026 12:08
daaa760 to
38474b7
Compare
Hardhat's ContractFactory.deploy() calls eth_estimateGas internally when no gasLimit is provided. On Hemi mainnet (43111) and testnet (743111) this RPC call hangs indefinitely, causing the batcher CI job to stall. The V4 deploy script works because chainConfig.ts hardcodes gasLimit: 3_000_000 for Hemi, so eth_estimateGas is never called. Fix: added a Hemi-specific block (mirroring the Somnia pattern) that manually estimates gas via a direct signer call and passes an explicit gasLimit into deploy(), bypassing Hardhat's internal estimation entirely. Tested: batcher deployed and verified on themieth (chainId 743111) Contract: 0xCec21E00B1a68F2452a14f13dF515cC5f38234B7 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nvrakesh06
force-pushed
the
fix/hemi-batcher-gas-estimation
branch
from
April 1, 2026 12:11
38474b7 to
723d89b
Compare
nvrakesh06
marked this pull request as ready for review
April 1, 2026 12:22
parasgarg-bitgo
approved these changes
Apr 1, 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.
Problem
The batcher deployment script hung indefinitely on Hemi (mainnet and testnet) after the balance check, never producing a contract.
Two distinct issues were present:
Issue 1 —
eth_estimateGashangs on HemideployBatcherContract.tscalledBatcher.deploy()with nogasLimit. Hardhat'sContractFactory.deploy()internally callseth_estimateGaswith EIP-1559 (type-2) params to determine the gas limit. Hemi's node rejects this call, causing the script to hang indefinitely.This was already known for the V4 wallet deployment (
deploy.ts), which works around it by supplying an explicitgasLimitviachainConfig.ts. The batcher script had no equivalent handling.Issue 2 — Hemi mempool drops EIP-1559 (type-2) transactions
Even after supplying an explicit
gasLimit, the deploy transaction itself was dropped. Hemi's RPC advertises EIP-1559 fee data (maxFeePerGas,maxPriorityFeePerGas) but its mempool silently discards type-2 transactions. Only legacy type-0 transactions (signed withgasPrice) are reliably mined.This is why the V4 deploy works:
chainConfig.tsforcesgasPricefor Hemi, producing a type-0 transaction. The batcher gas resolution did not carry over this requirement.Fix
Extracted all per-chain gas logic out of
deployBatcherContract.tsinto a dedicatedconfig/batcherDeployGasConfig.tsmodule with three explicit strategies:defaulteip1559-feeseth_estimateGasworks; supply explicit fee paramsmanual-gaseth_estimateGasrejects type-2 params; pre-estimate with a plain{ from, data }call and pass an explicitgasLimitAdded a
forceLegacyflag tomanual-gasfor chains like Hemi that additionally require type-0 transactions. When set,gasPriceis always used instead ofmaxFeePerGas/maxPriorityFeePerGas, regardless of what the node reports in its fee data.Chain assignments:
manual-gas+forceLegacy: truemanual-gas+capToBlockGasLimit: true(existing behaviour, now consolidated)eip1559-fees(existing behaviour, now consolidated)Why V4 was unaffected
deploy.tsreads gas config fromchainConfig.ts, which already had an explicitgasPrice+gasLimitoverride for Hemi added when the chain was first onboarded. The batcher script used a separate inline gas handling path that didn't carry over that knowledge.Tested
Deployed and verified on Hemi Testnet (chainId: 743111) from a fresh nonce-0 wallet:
0xc73b53CCC9f32C64616108d55DaB9063D98550270x060264062b73e70dc96e997477296f39b513cab418bb53cceffe4d3bc93884bb🤖 Generated with Claude Code