Changed maxPriorityFee → maxFee for polygon gas station parsing
#1007
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.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
Polygon Gas Fee Bug Analysis
Root Cause
In
src/ethereum/ethereumSchema.ts, the Polygon gas station response parser was incorrectly usingmaxPriorityFeeinstead ofmaxFee.EIP-1559 Fee Structure
EIP-1559 transactions have two fee components:
Total Fee = Base Fee + Priority Fee
The Polygon Gas Station API
The Polygon gas station (
https://gasstation.polygon.technology/v2) returns:{ "safeLow": { "maxPriorityFee": 20, "maxFee": 35 }, "standard": { "maxPriorityFee": 25, "maxFee": 40 }, "fast": { "maxPriorityFee": 30, "maxFee": 50 } }maxPriorityFee= just the tip portion (~20 Gwei)maxFee= total fee needed (baseFee + tip, ~35 Gwei)The Bug
The code used
maxPriorityFee(20 Gwei) as if it were the total required fee, when it should have usedmaxFee(35 Gwei).Impact
Transactions were underpriced by approximately the base fee amount:
This caused transactions to:
Evidence
Transaction
0x79884703a6d10dcdae3e0caf50c4d0e193c52ad9708fb6098de287888272359b:maxPriorityFeefrom gas station)The miner tip value (~20 Gwei) directly correlates with
maxPriorityFee, confirming the bug.The Fix
Additional Fix: Reduced Fee Update Interval
The default fee polling interval is 10 minutes, which can lead to stale fees during volatile periods. Added
feeUpdateFrequencyMs: 60000topolygonInfo.tsto update fees every 1 minute instead.Files Changed
src/ethereum/ethereumSchema.ts: ChangedmaxPriorityFee→maxFeefor polygon gas station parsingsrc/ethereum/info/polygonInfo.ts: AddedfeeUpdateFrequencyMs: 60000to reduce fee polling from 10 minutes to 1 minuteNote
Switch Polygon gas parsing to maxFee and cut fee polling interval to 1 minute.
maxFee(notmaxPriorityFee) forsafeLow/average/fast/fastestinsrc/ethereum/ethereumSchema.ts.feeUpdateFrequencyMs: 60000insrc/ethereum/info/polygonInfo.tsto update fees every minute.CHANGELOG.mdto reflect the above changes.Written by Cursor Bugbot for commit 40d6bcf. This will update automatically on new commits. Configure here.