Use execution result's MaxGasConsumed for gas estimation#889
Conversation
WalkthroughUpdates dependency versions in project and test go.mod files. Replaces use of GasConsumed+GasRefund with Result.MaxGasConsumed in gas estimation logic and updates a test to set MaxGasConsumed accordingly. No exported API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant R as Requester
participant F as FVM/EVM
C->>R: Request EstimateGas(call)
R->>F: Dry-run call with initial gas limit
F-->>R: result { MaxGasConsumed, ... }
Note over R: optimisticGasLimit = (MaxGasConsumed + CallStipend) * 64/63
alt optimisticGasLimit < passingGasLimit
R->>F: Dry-run with optimisticGasLimit
F-->>R: result / status
R->>R: Adjust bounds and continue binary search
else
R->>R: Keep existing bounds / proceed
end
R-->>C: Return estimated gas
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ea8aeb3 to
7c0737b
Compare
Depends on: onflow/flow-go#7951
Work towards: #840
Description
See also: ethereum/go-ethereum#31735
For contributor use:
masterbranchFiles changedin the Github PR explorerSummary by CodeRabbit
Bug Fixes
Tests
Chores