Repository navigation
fix: honor gas limit in eth_estimateGas - #7703
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Walkthrough
ChangesGas-capped estimation
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant Caller
participant eth_estimate_gas
participant eth_gas_search
participant gas_search
Caller->>eth_estimate_gas: Submit call with optional gas
eth_estimate_gas->>eth_gas_search: Pass message and gas cap
eth_gas_search->>gas_search: Search up to the cap
gas_search-->>eth_gas_search: Return estimate or cap-specific error
eth_gas_search-->>Caller: Return estimate or error
Merge Risk: ⚪ Minimal · up to eth_estimateGas now honors the supplied gas limit as an upper bound and returns distinct errors when the limit is insufficient. No actionable merge-blocking risk remains after review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 76.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
✨ Simplify code
Warning Some tools did not complete. Review the errors below. 🔧 Clippy (1.98.1)Clippy execution failed Comment |
a00058c to
5fbddbe
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
5fbddbe to
9bec751
Compare
9bec751 to
a6cd9ba
Compare
Search for a gas limit within the caller's cap, and report unmet caps with reth's errors: -32000 below the inclusion cost, -32003 when the call needs more gas. Estimate with zero fees so the sender's balance doesn't change the result. Return out-of-gas errors unwrapped so they keep their RPC code, and drop the redundant re-execution on skip-sender estimate failures. Ref: ChainSafe/forest#7703
Search for a gas limit within the caller's cap, and report unmet caps with reth's errors: -32000 below the inclusion cost, -32003 when the call needs more gas. Estimate with zero fees so the sender's balance doesn't change the result. Return out-of-gas errors unwrapped so they keep their RPC code, and drop the redundant re-execution on skip-sender estimate failures. Ref: ChainSafe/forest#7703
Search for a gas limit within the caller's cap, and report unmet caps with reth's errors: -32000 below the inclusion cost, -32003 when the call needs more gas. Estimate with zero fees so the sender's balance doesn't change the result. Return out-of-gas errors unwrapped so they keep their RPC code, and drop the redundant re-execution on skip-sender estimate failures. Ref: ChainSafe/forest#7703
Summary of changes
Changes introduced in this pull request:
eth_estimateGasreth- the behavior in some cases is different than in Lotus but it should be more usable -eth_*consumers are mostly tuned forrethandgethReference issue to close (if applicable)
Closes #7702
Other information and links
AI summary on the behavior between different clients
f7236f6][forest-main])99e2be2][lotus] (unreleased, [#13865])gasgiven3gas search failed: message execution failed (...)3without thegas search failed:prefixNNignored (can exceedN)NNNN, otherwiseNafter a successful run atNNbelow the intrinsic gas / message inclusion costNignored-32000gas required exceeds allowance (N)N< 21000:Nignored, estimate; otherwise-32000gas required exceeds allowance (N)-32000gas required exceeds allowance (N)2call ran out of gasNNignored-32003out of gas: gas required exceeds: N-32000gas required exceeds allowance (N)-32003out of gas: gas required exceeds: N2call ran out of gas(3if a contract catches the inner out-of-gas and reverts)N, succeeds with more gas (e.g.require(gasleft() > X))3gas search failed: message execution failed (...)-32003out of gas: gas required exceeds: N3execution reverted[: reason]-32003out of gas: gas required exceeds: N3message execution failed (...)Nhigh enough3with the prefix (never searched)N(searched past the revert)NN3(never searched)3message execution failed (...)3message execution failed (...)3execution reverted[: reason]3execution reverted[: reason]3message execution failed (...)2call ran out of gas; contract or non-existent sender:3withexit=[SysErrOutOfGas(7)]-32003out of gas: gas required exceeds: N-32000gas required exceeds allowance (N)-32003out of gas: gas required exceeds: N1failed to estimate gas: call ran out of gas; contract or non-existent sender:3withexit=[SysErrOutOfGas(7)]3with the prefix andexit=[SysErrSenderStateInvalid(2)]if even the estimate isvaluemust still be coveredvaluestill checked (-32000insufficient funds for gas * price + value); with a gas price: the ceiling is capped at(balance - value) / feeCap3withexit=[SysErrSenderStateInvalid(2)](2ifNis below the inclusion cost)Change checklist
Outside contributions
Summary by CodeRabbit
eth_estimateGasnow honors a transaction’s supplied gas limit, capped at the block gas limit, when calculating estimates.