Skip to content

Update Arbitrum estimator to enable PGA - #606

Open
dimriou wants to merge 5 commits into
developfrom
oev-2137_update_arbitrum_estimator
Open

dimriou wants to merge 5 commits into
developfrom
oev-2137_update_arbitrum_estimator

Conversation

@dimriou

@dimriou dimriou commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Enables EIP-1559 dynamic fee estimation (backed by FeeHistoryEstimator) in ArbitrumEstimator to 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

  • Arbitrum dynamic fee support (pkg/gas/arbitrum_estimator.go, pkg/gas/models.go):
    • NewArbitrumEstimator now delegates pricing to FeeHistoryEstimator when EIP1559DynamicFees is enabled, and continues delegating to SuggestedPriceEstimator when disabled (no behavior change for existing configs such as Corn, L3X, Mind, or default Arbitrum configs until migrated).
    • Extracted gasLimitWithL1Cost (preserving IfStarted, OptForceRefetch, and LimitMax enforcement) and applied it to EIP-1559 GetFee / GetMaxFee calls via evmFeeEstimator.dynamicFeeLimit.
    • Reused the ArbL1GasOracle already created by rollups.NewL1GasOracle in NewEstimator instead of instantiating a duplicate oracle.
  • FeeHistoryEstimator configuration (pkg/gas/fee_history_estimator.go):
    • Added optional ChainType and ConnectivityPercentile fields to FeeHistoryEstimatorConfig (preserving the existing NewFeeHistoryEstimator signature and falling back to 85 when ConnectivityPercentile is unset).
    • Wired ConnectivityPercentile from the existing BlockHistory.CheckInclusionPercentile config.
    • Applied NoMempoolBaseFeeBufferPercentage (90%) for chaintype.ChainArbitrum even when BlockHistorySize > 0, since ArbOS base fees have no EIP-1559 per-block cap.
  • Models:
    • BumpFee (pkg/gas/models.go) no longer applies LimitMultiplier. It returns the limit it's given, which must be the previous attempt's adjusted limit.

Backwards Compatibility

  • Default TOML configs are intentionally unchanged in this PR; chains continue using legacy SuggestedPriceEstimator until EIP1559DynamicFees = true and BlockHistorySize > 0 are configured.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-evm

⚠️ Breaking Changes (4)

pkg/gas (1)
  • NewArbitrumEstimator — Type changed:
func(
  github.com/smartcontractkit/chainlink-common/pkg/logger.Logger, 
  ArbConfig, 
  FeeEstimatorClient, 
  + *math/big.Int, 
  github.com/smartcontractkit/chainlink-evm/pkg/gas/rollups.ArbL1GasOracle
)
EvmEstimator
pkg/gas.ArbConfig (3)
  • BlockHistory — ➕ Added

  • EIP1559DynamicFees — ➕ Added

  • FeeHistory — ➕ Added

✅ Compatible Changes (2)

pkg/gas.FeeHistoryEstimatorConfig (2)
  • ChainType — ➕ Added

  • ConnectivityPercentile — ➕ Added


📄 View full apidiff report

@dimriou
dimriou force-pushed the oev-2137_update_arbitrum_estimator branch from 1d44ffe to 4c04076 Compare November 23, 2026 17:19
@dimriou
dimriou marked this pull request as ready for review November 23, 2026 17:42
@dimriou
dimriou requested review from a team as code owners November 23, 2026 17:42
Copilot AI balanced review requested due to automatic review settings November 23, 2026 17:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/gas/models.go
Comment on lines +384 to +385
if arb, ok := e.EvmEstimator.(*arbitrumEstimator); ok {
return arb.gasLimitWithL1Cost(ctx, calldata, feeLimit, opts...)
Comment thread pkg/gas/models.go
fee.GasFeeCap = dynamicFee.GasFeeCap
fee.GasTipCap = dynamicFee.GasTipCap
chainSpecificFeeLimit = feeLimit
if chainSpecificFeeLimit, err = e.dynamicFeeLimit(ctx, calldata, feeLimit, opts...); err != nil {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants