fix/mantle lack operator fee#8837
Open
jeremytsng wants to merge 1 commit into
Open
Conversation
d661f99 to
08620b9
Compare
Julink-eth
previously approved these changes
May 19, 2026
…d` is missing `OracleLayer1GasFeeFlow` skipped the operator-fee oracle call whenever `transactionMeta.gasUsed` was unset. Mantle has no value for `gasUsed` during the pre-confirmation lifecycle, so the operator fee silently collapsed to zero and the displayed L1 fee under-reported the actual on-chain cost. Expose a `protected getOperatorFeeGas` hook on the base flow so subclasses can supply a fallback value, and override it in `MantleLayer1GasFeeFlow` to fall back to `txParams.gas` (or `txParams.gasLimit`) when `gasUsed` is not available. Gas limit is an upper bound on actual gas used, so the resulting operator fee over-estimates rather than under-reports.
5b00cd4 to
f7003fe
Compare
Julink-eth
approved these changes
May 20, 2026
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.
Explanation
We observed the confirmation screen showing
0.10 MNTfor a transaction that ended up costing0.12 MNT— the ~0.02 MNT delta is the operator-fee component of Mantle's Arsia gas model, which never reached the displayed total.Root cause is in
OracleLayer1GasFeeFlow.#getOperatorLayer1GasFee: the method skips the operator-fee oracle call whenevertransactionMeta.gasUsedis unset. That field is populated by the transaction simulation backend, and Mantle is not in its supported-networks list —getBalanceChangesthrowsSimulationChainNotSupportedError, the catch returnsgasUsed: undefined, and the operator-fee path silently collapses to zero for the entire pre-confirmation lifecycle (initial render, gas-fee poller re-poll, edit-gas). The UI sumslayer1GasFeestraight into the displayed total inuseFeeCalculations.ts, so the dropped operator fee flows directly to the user.The fix introduces a
protected getOperatorFeeGashook onOracleLayer1GasFeeFlow. The base default returnstransactionMeta.gasUsed, soOptimismLayer1GasFeeFlow,ScrollLayer1GasFeeFlow, and any other current or future subclass keep their existing behaviour.MantleLayer1GasFeeFlowoverrides the hook to fall back totxParams.gas ?? txParams.gasLimitwhengasUsedis unavailable.The transaction's gas limit is an upper bound on actual gas used (it carries the
updateGasbuffer when populated by the controller, and is the caller-supplied value otherwise). Mantle's operator-fee oracle is strictly linear in its input gas (verified on-chain at0x420000000000000000000000000000000000000F—getOperatorFee(21000) = 2.1e14,getOperatorFee(500000) = 5e15, same per-gas rate), so the operator fee returned for a gas-limit input is an upper bound on the realised operator fee. The displayed total will be a hair above the actual on-chain cost rather than under-reporting it. This matches the over-estimate direction already used for the Optimism L1 data fee.Caller coverage with the override in place:
addTransactionflow):updateGaspopulatestxParams.gasin#updateGasPropertiesbeforeupdateTransactionLayer1GasFeeruns in the same method.GasFeePoller10s re-poll: reads the sametxParams.gasfrom state.updateEditableParams(user edits gas): uses the newtxParams.gasafter the edit.bridge-controller'sappendL1GasFeesis allowlisted to Optimism + Base only today, so Mantle quotes don't reach this code. The?? gasLimitarm future-proofs the bridgegetLayer1GasFeecall shape if Mantle is added later.References
Fixes the operator-fee under-reporting flagged by the Mantle team following the Arsia gas model rollout.
Checklist
Note
Medium Risk
Touches fee estimation logic used to display L1 gas costs; incorrect fallbacks could over/under-estimate user-facing fees on Mantle (and potentially other OP-stack subclasses if overridden in future).
Overview
Fixes Mantle L1 gas fee estimation so the operator-fee component is still included when simulated
transactionMeta.gasUsedis unavailable.OracleLayer1GasFeeFlownow routes the operator-fee oracle call through a new overridable hook,getOperatorFeeGas, andMantleLayer1GasFeeFlowoverrides it to fall back totxParams.gas(thentxParams.gasLimit) instead of skipping the operator fee entirely. Tests are updated/expanded to cover the new fallback and the “skip when no gas value exists” behavior, and theCHANGELOG.mddocuments the fix.Reviewed by Cursor Bugbot for commit f7003fe. Bugbot is set up for automated code reviews on this repo. Configure here.