Skip to content

fix(transaction-controller): broaden gas estimation for type-4 transactions with non-self target#8467

Draft
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/enforced-simulations-gas-estimation
Draft

fix(transaction-controller): broaden gas estimation for type-4 transactions with non-self target#8467
matthewwalsh0 wants to merge 1 commit intomainfrom
feat/enforced-simulations-gas-estimation

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

Explanation

The existing isUpgradeWithDataToSelf condition in gas estimation requires from === to for the split estimation path (upgrade gas + execution gas). This doesn't work for enforced simulations where to is the delegation manager, not the sender.

Changes:

  1. Split condition into isUpgradeWithData (no from === to check) and isUpgradeWithDataToSelf (preserves the original for downstream use)
  2. Use isUpgradeWithData to gate the split estimation path — any type-4 transaction with an authorization list and data qualifies
  3. Override to: txParams.from in the upgrade-only estimation (step 1) since a bare 7702 authorization upgrade is always a self-transaction, regardless of the actual transaction target

References

Companion to MetaMask/metamask-extension#41775

Changelog

@metamask/transaction-controller

Changed

  • Broadened gas estimation split path to support type-4 transactions where to differs from from
  • Upgrade-only estimation now explicitly targets from address for accurate 7702 upgrade gas calculation

…ctions with non-self target

Broaden isUpgradeWithData condition to support type-4 transactions where
to != from (e.g. enforced simulations targeting the delegation manager).
Override to=from in the upgrade-only estimation since a bare 7702
authorization upgrade is always a self-transaction.
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.

1 participant