fix: align browser fee caps with suggested tips#14894
Conversation
stevencartavia
left a comment
There was a problem hiding this comment.
- Moved the
eth_maxPriorityFeePerGasbump incast erc20behind a newbrowser: boolflag onfill_tx, so non browser sponsor flows don't make the extra RPC or get a silently-raised tip. - Added a
priority <= maxFeecheck after fee filling in botherc20.rsandcreate.rsto reject invalid EIP-1559 pairs locally instead of sending them to the wallet/RPC. - Placed that check outside the inner
if, so it also catches the case where the user explicitly supplies both--gas priceand--priority-gas-pricewithpriority > maxFee.
|
@stevencartavia Thanks for the update and approval. LGTM! |
|
@figtracer Updated, please take another look, thanks. |
| } else { | ||
| if tx.max_fee_per_gas().is_none() || tx.max_priority_fee_per_gas().is_none() { | ||
| let mut estimate = provider.estimate_eip1559_fees().await?; | ||
| if browser |
There was a problem hiding this comment.
cast send --browser still uses the shared fee filler without this tip bump, so the same browser fee-cap issue can still happen outside cast erc20.
let's move this into the shared builder
a better long-term solution for all of these would be an actual robust provider filler for the browser wallet as mentioned by @mablr... but we can keep this as-is for now i think
There was a problem hiding this comment.
Yep def need to revamp all these browser cheats/workarounds. Not the scope of this PR.
|
@mablr @figtracer Done, please take another look, thanks. |
|
can you fix conflicts pls? @Perico-perica46 |
Motivation
Browser wallets can replace the locally estimated priority fee with the value from
eth_maxPriorityFeePerGas. The script broadcast path already accounts for that by raisingmaxFeePerGaswhen the browser-suggested tip is higher than the fee-history estimate.forge create --browserandcast erc20 ... --browserstill used the raw EIP-1559 estimate, which can leave the fee cap below the tip the wallet submits.Solution
When filling browser-submitted transactions without an explicit priority fee, compare the EIP-1559 estimate with
eth_maxPriorityFeePerGas. If the suggested tip is higher, raise the fee cap by the same delta and use that tip before sending the request to the browser wallet.