refactor(GasEstimator): Separate OptimisticMultiplier from stop margin#12088
refactor(GasEstimator): Separate OptimisticMultiplier from stop margin#12088manusw7 wants to merge 6 commits into
Conversation
|
Claude finished @manusw7's task in 3m 40s —— View job Code Review
SummaryThe production code changes are correct: separating FindingsMedium
The assertions The scenario where the split matters is Low
Notes (no action needed)
|
|
@claude review |
|
Claude finished @manusw7's task in 3m 12s —— View job Code Review
SummaryThe production-code changes are correct and well-motivated. Both the Production Code (
|
|
Claude finished @manusw7's task in 5m 13s —— View job PR Review: refactor(GasEstimator): Separate OptimisticMultiplier from stop marginTodo list:
SummaryThe two production changes are semantically correct: separating the EIP-150 However, the accompanying tests have quality issues: neither new test actually detects a regression to the previous behavior. Three Medium findings below. FindingsMedium —
|
|
@claude test updated. Review again |
|
Claude finished @manusw7's task in 5m 27s —— View job Code Review (updated tests)
SummaryBoth tests are genuine improvements over the previous version. The production code remains correct. One naming issue in Test 1 —
|
|
@claude review again |
|
Claude finished @manusw7's task in 1m 33s —— View job Code Review (re-review)
SummaryAll previously flagged findings are now addressed. The production code is correct and the tests are adequate smoke tests for the fix paths. What changed since the last review
The parameter at line 173 is now Production Code — all correct ✅
Tests — acceptable ✅Both tests are improved and pass correctly. Their inherent limitations are well-understood:
Neither limitation warrants blocking the PR — they are accepted smoke tests for paths that require more complex mock infrastructure to assert on probe-level behavior. VerdictMergeable. All Medium findings from prior reviews have been addressed. No new issues found. |
| private const double BasisPointsDivisor = 10000d; | ||
|
|
||
| // EIP-150: each CALL site reserves 1/64 for the caller, so the optimistic guess must use 64/63, not the search-stop margin. | ||
| private const double OptimisticMultiplier = 64d / 63d; |
There was a problem hiding this comment.
Can it be covered by just using a bit different error margin? It's now 150, seems like you suggest ~158
There was a problem hiding this comment.
The issue with that is that the two values serve different purposes
The error margin controls search accuracy and is user-configurable. The 64/63 is a fixed EVM property from EIP-150
Fixes #12087
Changes
OptimisticMultiplier = 64d / 63dinGasEstimator.csto compensate for EIP-150's 1/64 child-call reservation, matching Geth's approachOptimisticMultipliertoTryOptimisticEstimateinstead ofmarginMultiplier, keepingmarginMultiplierfor the binary-search stop threshold onlyIsSimpleTransferto returnfalsefor EIP-7702 SetCodeTx with anauthorizationList, ensuring those transactions go through the binary searchTypes of changes
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Two unit tests added to
GasEstimationTests.cs:Estimate_subcall_contract_uses_optimistic_multiplier_not_margin_multiplier— verifies the optimistic guess correctly accounts for EIP-150's child-call budgetIsSimpleTransfer_returns_false_for_SetCodeTx_with_authorization_list— verifies SetCodeTx goes through the full binary searchDocumentation
Requires documentation update
Requires explanation in Release Notes