feat: add max-priority-fee-per-gas-cap (ceiling for the oracle tip) - #34
Open
SahilVasava wants to merge 5 commits into
Open
feat: add max-priority-fee-per-gas-cap (ceiling for the oracle tip)#34SahilVasava wants to merge 5 commits into
SahilVasava wants to merge 5 commits into
Conversation
The gas price manager has floors (floor-max-fee-per-gas / floor-max-priority-fee-per-gas) but no ceiling, so it bids whatever eth_maxPriorityFeePerGas returns verbatim. On low-traffic chains where the bundler is the dominant tx sender, the priority-fee oracle feedback-loops on the bundler's own past tips and reports an absurd value (observed: 500 gwei on Arc mainnet, where base fee sits at the 20 gwei protocol floor and blocks are empty). With no cap, the executor pays a ~500 gwei tip for txs that need ~0/1 gwei (per Arc's docs), costing ~0.24-0.36 USDC each vs a ~0.01 USDC target -- a ~25x overpay that drains the executor wallet. Add an optional max-priority-fee-per-gas-cap (gwei, like the floors). When set, the tip is capped to it and maxFeePerGas is reduced by the same delta, so we never overpay the tip and never push maxFeePerGas below the base-fee component. Applied after the floors so the cap wins if both are configured. No behavior change when unset. Refactors bumpTheGasPrice to a single return so floors + cap compose cleanly.
There was a problem hiding this comment.
Pull request overview
Adds an optional configuration ceiling for maxPriorityFeePerGas so the bundler doesn’t blindly follow an inflated eth_maxPriorityFeePerGas value on low-traffic chains (where the oracle can feedback-loop on the bundler’s own prior tips), while keeping the base-fee component intact by reducing maxFeePerGas by the same delta.
Changes:
- Refactors
bumpTheGasPriceto compute final floor-enforced fees via a single return. - Introduces
maxPriorityFeePerGasCaplogic that caps priority fee and reducesmaxFeePerGasby the same amount. - Wires the new
max-priority-fee-per-gas-capoption through CLI option definitions and Zod config schema parsing (gwei → wei viaparseGwei).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/handlers/gasPriceManager.ts | Adds cap application for priority fee and refactors floor composition logic. |
| src/cli/config/options.ts | Exposes a new CLI/config option description for max-priority-fee-per-gas-cap. |
| src/cli/config/bundler.ts | Adds Zod schema parsing for max-priority-fee-per-gas-cap using parseGwei. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
gasPriceManagerhas gas floors (floor-max-fee-per-gas,floor-max-priority-fee-per-gas) but no ceiling — it bids whatevereth_maxPriorityFeePerGasreturns, verbatim.On low-traffic chains where the bundler is the dominant tx sender, the priority-fee oracle feedback-loops on the bundler's own past tips and reports an absurd value. Observed on Arc mainnet:
eth_maxPriorityFeePerGasreturns 500 gwei, and the executor bids itThere's no config knob to cap this today (floors only raise;
gas-price-bump < 100scales a moving oracle and undershoots below base fee as the loop unwinds → stalls). So it needs a ceiling primitive.Change
Add an optional
max-priority-fee-per-gas-cap(gwei, parsed like the floors). When set:minBigIntmaxFeePerGasis reduced by the same delta, so the base-fee component is preserved (never pushes maxFee below the base fee) and we don't pay an inflated tipbumpTheGasPriceis refactored to a single return so floors + cap compose cleanly.It's also self-correcting: once the bundler bids capped tips, the oracle's percentile of recent tips drops within a few blocks and the loop unwinds.
Rollout
Set on the affected chain's config, e.g. Arc:
(5 gwei = 5× Arc's suggested tip, ~100× below the looped 500; lands at ~$0.01/tx — Arc's target. Base fee is still paid in full and can rise legitimately under real congestion.) Other low-traffic chains where the bundler dominates can set it as needed; leaving it unset preserves current behavior.