Repository navigation
Conversation
|
1d44ffe to
4c04076
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Arbitrum fee handling can block transactions on valid zero-reward startup histories, drop L1 gas allowance from replacement transactions, and reuse stale fee prices during forced retries.
3 open issues
What changed in this PR
Adds opt-in EIP-1559 pricing to the Arbitrum estimator for priority-fee auctions, while retaining legacy pricing for existing configurations. Default chain configurations remain unchanged.
Changes:
- Delegates dynamic pricing to
FeeHistoryEstimator, adds Arbitrum L1 calldata costs to dynamic gas-limit estimates, and reuses the existing oracle. - Makes the connectivity percentile configurable and applies Arbitrum’s wider base-fee buffer.
- Adds tests for dynamic estimates, gas-limit enforcement, forced L1 refreshes, and percentile configuration.
| File | Description |
|---|---|
pkg/gas/models.go |
Wires estimator configuration, reuses the Arbitrum oracle, and adjusts dynamic gas limits. |
pkg/gas/fee_history_estimator.go |
Adds configurable connectivity percentiles and Arbitrum-specific fee buffering. |
pkg/gas/fee_history_estimator_test.go |
Tests percentile validation, custom thresholds, and Arbitrum buffering. |
pkg/gas/arbitrum_estimator.go |
Selects the pricing delegate and extracts shared L1 gas-limit calculation. |
pkg/gas/arbitrum_estimator_test.go |
Tests dynamic pricing, L1 allowances, limit enforcement, and forced refreshes. |
pkg/config/chaintype/chaintype.go |
Updates the IsL2 comment to describe fee-error retries; no behavior change. |
Review effort: Balanced
| ConnectivityPercentile: float64(cfg.BlockHistory().CheckInclusionPercentile()), | ||
| ChainType: chaintype.ChainArbitrum, | ||
| } | ||
| priceEstimator = NewFeeHistoryEstimator(lggr, ethClient, fhCfg, chainID, l1Oracle) |
There was a problem hiding this comment.
This happens only once, and it's expected that a chain that has PGA enabled, will have at least 1 valid priority fee within a reasonable timeframe. This is a tradeoff we're making instead of blindly allowing 0 fees, because the current implementation cannot distinguish between empty blocks and valid 0 priced transactions.
| if arb, ok := e.EvmEstimator.(*arbitrumEstimator); ok { | ||
| return arb.gasLimitWithL1Cost(ctx, calldata, feeLimit, opts...) |
| fee.GasFeeCap = dynamicFee.GasFeeCap | ||
| fee.GasTipCap = dynamicFee.GasTipCap | ||
| chainSpecificFeeLimit = feeLimit | ||
| if chainSpecificFeeLimit, err = e.dynamicFeeLimit(ctx, calldata, feeLimit, opts...); err != nil { |
There was a problem hiding this comment.
We make this tradeoff here, because to change the behaviour we would either have to:
- Break existing interfaces
- Refactor Arbitrum path so it doesn't get treated as an L2 in terms of transmission, but retain the other functionalities, plus avoid breaking backwards compatibility with chains that have not yet migrate, but still use the chaintype.


Summary
Enables EIP-1559 dynamic fee estimation (backed by
FeeHistoryEstimator) inArbitrumEstimatorto support Arbitrum's transition to a priority fee auction model, while preserving the existing Arbitrum L1 calldata gas limit calculation (ArbGasInfo.getPricesInArbGas()) and keeping full backwards compatibility for other Arbitrum-stack chains still operating in FIFO / legacy mode.Changes
pkg/gas/arbitrum_estimator.go,pkg/gas/models.go):NewArbitrumEstimatornow delegates pricing toFeeHistoryEstimatorwhenEIP1559DynamicFeesis enabled, and continues delegating toSuggestedPriceEstimatorwhen disabled (no behavior change for existing configs such as Corn, L3X, Mind, or default Arbitrum configs until migrated).gasLimitWithL1Cost(preservingIfStarted,OptForceRefetch, andLimitMaxenforcement) and applied it to EIP-1559GetFee/GetMaxFeecalls viaevmFeeEstimator.dynamicFeeLimit.ArbL1GasOraclealready created byrollups.NewL1GasOracleinNewEstimatorinstead of instantiating a duplicate oracle.FeeHistoryEstimatorconfiguration (pkg/gas/fee_history_estimator.go):ChainTypeandConnectivityPercentilefields toFeeHistoryEstimatorConfig(preserving the existingNewFeeHistoryEstimatorsignature and falling back to85whenConnectivityPercentileis unset).ConnectivityPercentilefrom the existingBlockHistory.CheckInclusionPercentileconfig.NoMempoolBaseFeeBufferPercentage(90%) forchaintype.ChainArbitrumeven whenBlockHistorySize > 0, since ArbOS base fees have no EIP-1559 per-block cap.BumpFee(pkg/gas/models.go) no longer appliesLimitMultiplier. It returns the limit it's given, which must be the previous attempt's adjusted limit.Backwards Compatibility
SuggestedPriceEstimatoruntilEIP1559DynamicFees = trueandBlockHistorySize > 0are configured.