Skip to content

fix: use toAddress instead of NULL_ADDRESS for fee calc#245

Closed
mikesposito wants to merge 1 commit into
mainfrom
mikesposito/fix/use-to-address-for-fee-calc
Closed

fix: use toAddress instead of NULL_ADDRESS for fee calc#245
mikesposito wants to merge 1 commit into
mainfrom
mikesposito/fix/use-to-address-for-fee-calc

Conversation

@mikesposito

@mikesposito mikesposito commented Mar 20, 2026

Copy link
Copy Markdown
Member

Explanation

[WIP]

Including toAddress when calculating fees as NULL_ADDRESS can cause issues with certain token contracts that have guards against sending to the zero address.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@mikesposito

Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/tron-wallet-snap": "1.24.0-preview-4831411"
}

ulissesferreira added a commit that referenced this pull request Mar 24, 2026
…ssing (#259)

## Explanation

`onAmountInput` currently estimates fees by building a transaction
before the recipient is always available. Closed PR #245 fixed part of
that by accepting `toAddress` in the request and using it for fee
estimation.

This PR ports that fix onto the `fix/incident-1528` branch and adds the
incident-specific safeguard we want on top: when `toAddress` is not
provided, the handler now skips fee validation and returns `valid: true`
after the normal asset-balance check. When `toAddress` is provided, fee
estimation uses the real recipient address.

This prevents fee-estimation failures for token contracts that reject
zero-address transfers while preserving correct fee validation once the
user has entered a recipient.

## References

- Related to
[incident-1528](https://consensys.slack.com/archives/C0AMFS19E0P)
- Adapts the changes from
[#245](#245)

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
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.

2 participants