fix: include Mantle operator fee in post-confirmation layer1GasFee#9630
Open
adaOctopus wants to merge 1 commit into
Open
fix: include Mantle operator fee in post-confirmation layer1GasFee#9630adaOctopus wants to merge 1 commit into
adaOctopus wants to merge 1 commit into
Conversation
Derive L1 + operator fees from receipt fields on confirmation and in client-utils activity fee mapping so Activity Details match what was paid. Co-authored-by: Cursor <cursoragent@cursor.com>
adaOctopus
temporarily deployed
to
default-branch
July 23, 2026 11:45 — with
GitHub Actions
Inactive
matthewwalsh0
self-requested a review
July 23, 2026 12:01
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
After WPN-1001, confirmation estimates include Mantle’s L1 data fee + operator fee via
transactionMeta.layer1GasFee. Activity Details still under-reported the fee after confirmation because:l1Fee(L1 data fee), ignoring Mantle ArsiaoperatorFeeScalar/operatorFeeConstant.PendingTransactionTrackerstored the receipt but never refreshedlayer1GasFeewith inclusion-time L1 + operator values.Mantle receipts expose:
This PR:
References
Checklist
Test plan
Suggested short summary if you need one line for the PR overview: refresh
layer1GasFeefrom Mantle/OP receipt fields on confirm and include L1 + operator in client-utils activity fees.Note
Medium Risk
Changes fee math shown to users on rollup chains; logic is well-tested but wrong formulas would misstate costs on Mantle/Optimism.
Overview
Fixes under-reported network fees on Mantle and other OP Stack rollups after confirmation by accounting for L1 data fee + Mantle operator fee, not L2 gas alone.
In
@metamask/transaction-controller, receipt typing gains optionaloperatorFeeScalar,operatorFeeConstant, andtokenRatio. NewgetOperatorFeeFromReceipt/getLayer1FeeFromReceipthelpers compute operator fee (gasUsed × scalar × 100 + constant) and combined L1+operator totals;PendingTransactionTrackeroverwriteslayer1GasFeefrom the receipt on confirm when those fields exist (inclusion-time values, not stale pre-confirm estimates).In
@metamask/client-utils,getLocalTransactionFeesadds L1/operator on top ofgasUsed × effectiveGasPrice, preferringlayer1GasFeeon meta and otherwise deriving from receipt fields (mirroring the controller logic, without double-counting).Reviewed by Cursor Bugbot for commit 34af464. Bugbot is set up for automated code reviews on this repo. Configure here.