Skip to content

feat(tron): support vote witness and account permission update contracts - #561

Merged
ulissesferreira merged 1 commit into
mainfrom
WPN-2455-tron-contract-support
Nov 6, 2026
Merged

ulissesferreira merged 1 commit into
mainfrom
WPN-2455-tron-contract-support

Conversation

@ulissesferreira

@ulissesferreira ulissesferreira commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Adds support for signing VoteWitnessContract and AccountPermissionUpdateContract transactions.

The sign flow deserializes and rebuilds transactions before signing. TronWeb 6.1.0 does not support these contract types in its deserializer, so signing failed with WalletSignTransactionError: trasaction ... not supported. This upgrades TronWeb to 6.5.1, which includes deserializers for both contract types.

It also regenerates the local TronWeb patch against 6.5.1 with only the two changes the Snap still needs:

  • Preserve provider URLs as passed in, including trailing slashes used by Infura.
  • Allow self-sends (TRX and TRC-10) by removing TronWeb's client-side same-account validation.

TronWeb 6.5.1 depends on axios@1.18.0, which is flagged for known CVEs, so the existing axios@1.12.2 resolution is extended to resolve axios@1.18.0 to the already-used axios@1.20.0.

Adds regression coverage for trailing-slash provider URLs and for deserializing and rebuilding both newly supported contract types.

References

Ticket: WPN-2455

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

@socket-security

socket-security Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedtronweb@​6.1.0 ⏵ 6.5.198 +110010088 +3100

View full report

@socket-security

socket-security Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

MetaMask internal reviewing guidelines:

  • Do not ignore-all
  • Each alert has instructions on how to review if you don't know what it means. If lost, ask your Security Liaison or the supply-chain group
  • Copy-paste ignore lines for specific packages or a group of one kind with a note on what research you did to deem it safe.
    @SocketSecurity ignore npm/PACKAGE@VERSION
Priority Alert  (click "▶" to expand/collapse) Action
Low priority
Potential code anomaly (AI signal): npm tronweb is 62.0% likely to have a medium risk anomaly

Notes: This module is not overtly malicious by itself; it contains no explicit exfiltration, command execution, or credential handling. However, it is a high-privilege plugin installer that executes plugin constructors and dynamically overwrites TronWeb component methods (or extends the public API) using plugin-controlled code. While it blocks a limited set of protected modules and signing/private-key related methods, it does not sandbox or authenticate plugins, leaving meaningful supply-chain risk: a malicious or compromised plugin could tamper with non-protected TronWeb behaviors that execute during normal use.

Confidence: 0.62

Severity: 0.68

From: packages/tron-wallet-snap/package.json → npm/tronweb@6.5.1

ℹ Read more on: This package | This alert | What is an AI-detected potential code anomaly?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tronweb@6.5.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn

View full report

@ulissesferreira
ulissesferreira force-pushed the WPN-2455-tron-contract-support branch from 15141ed to 104788d Compare November 5, 2026 16:07
@ulissesferreira
ulissesferreira marked this pull request as ready for review November 5, 2026 16:21
@ulissesferreira
ulissesferreira requested review from a team as code owners November 5, 2026 16:21
Upgrade TronWeb to 6.5.1 so VoteWitnessContract and AccountPermissionUpdateContract transactions can be deserialized during signTransaction.

Regenerate the TronWeb patch with only the two required changes: preserve provider URLs (including trailing slashes used by Infura) and allow self-sends.
@ulissesferreira
ulissesferreira force-pushed the WPN-2455-tron-contract-support branch from 104788d to 7840239 Compare November 5, 2026 20:10
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@stanleyyconsensys stanleyyconsensys 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.

LGTM

small question, we need to path tron web, becoz we wanna unblock self send, and sth abt the host ?

@ulissesferreira

Copy link
Copy Markdown
Contributor Author

LGTM

small question, we need to path tron web, becoz we wanna unblock self send, and sth abt the host ?

Yes, precisely, patching Tronweb is done for:

  • Avoid Tronweb's corruption of Infura base URLs
  • Allow self-send

@ulissesferreira
ulissesferreira added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit c892d05 Nov 6, 2026
67 of 73 checks passed
@ulissesferreira
ulissesferreira deleted the WPN-2455-tron-contract-support branch November 6, 2026 09:25
LabinatorSolutions pushed a commit to LabinatorSolutions/metamask-extension that referenced this pull request Nov 7, 2026
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Bumps the Solana, Stellar, and Tron wallet snaps to the versions
released in internal-snaps `22.0.0`:

- `@metamask/solana-wallet-snap`: `^7.2.0` → `^7.3.0`
- `@metamask/stellar-wallet-snap`: `^2.0.0` → `^2.1.0`
- `@metamask/tron-wallet-snap`: `^4.3.1` → `^4.4.0`

All three are backwards-compatible minor updates; no application code
changes are required.

### @metamask/solana-wallet-snap 7.3.0

- Remove the temporary fallback that injected `https://metamask.io` as
the request origin when `keyring_submitRequest` was called without one
([MetaMask#533](MetaMask/internal-snaps#533)).

### @metamask/stellar-wallet-snap 2.1.0

- `confirmSend` now throws when signing or submission fails after the
user confirms, instead of returning a JSON error response
([MetaMask#550](MetaMask/internal-snaps#550)).
- Bump `@stellar/stellar-sdk` from `^17.2.1` to `^17.4.0`
([MetaMask#545](MetaMask/internal-snaps#545)).
- Retry transient Token API, Price API, Security Alerts API, RPC, and
Horizon failures with bounded timeouts and circuit breaking
([MetaMask#534](MetaMask/internal-snaps#534),
[MetaMask#551](MetaMask/internal-snaps#551)).
- Fix `onAmountInput` to accept the optional destination as `toAddress`
instead of `to`
([MetaMask#558](MetaMask/internal-snaps#558)).

### @metamask/tron-wallet-snap 4.4.0

- Support `VoteWitnessContract` and `AccountPermissionUpdateContract`
transactions by upgrading TronWeb to 6.5.1
([MetaMask#561](MetaMask/internal-snaps#561)).
- Align transaction security warning copy and scan-loading behavior with
user preferences
([MetaMask#557](MetaMask/internal-snaps#557)).

## **Changelog**

CHANGELOG entry: null

## **Related issues**

n/a

## **Manual testing steps**

n/a

## **Screenshots/Recordings**

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [X] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've completed the PR template to the best of my ability
- [X] I’ve included tests if applicable
- [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
anxolin pushed a commit to anxolin/internal-snaps that referenced this pull request Nov 7, 2026
## Explanation

This release branch prepares version `22.0.0`. It contains:

- `@metamask/solana-wallet-snap` `7.2.0` → `7.3.0` (minor: remove
obsolete `https://metamask.io` origin fallback)
- `@metamask/stellar-wallet-snap` `2.0.0` → `2.1.0` (minor: fetch policy
for RPC, Horizon and HTTP clients, `@stellar/stellar-sdk` upgrade,
`onAmountInput` `toAddress` fix, `confirmSend` now throws after
confirmation failures)
- `@metamask/tron-wallet-snap` `4.3.1` → `4.4.0` (minor:
`VoteWitnessContract` and `AccountPermissionUpdateContract` support via
TronWeb 6.5.1, security warning copy and scan-loading alignment)
- Root monorepo version bumped to `22.0.0`

## References

- `@metamask/solana-wallet-snap`:
[MetaMask#533](MetaMask#533)
- `@metamask/stellar-wallet-snap`:
[MetaMask#550](MetaMask#550),
[MetaMask#545](MetaMask#545),
[MetaMask#534](MetaMask#534),
[MetaMask#551](MetaMask#551),
[MetaMask#558](MetaMask#558)
- `@metamask/tron-wallet-snap`:
[MetaMask#561](MetaMask#561),
[MetaMask#557](MetaMask#557)

## Checklist

- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
weitingsun pushed a commit to Poovarasan-Sandhanam/metamask-mobile that referenced this pull request Nov 10, 2026
…taMask#39134)

<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
-->

## **Description**

Bumps the Bitcoin, Solana, Stellar, and Tron wallet snaps to their
latest published versions:

- `@metamask/bitcoin-wallet-snap`: `^3.2.0` → `^3.3.0`
- `@metamask/solana-wallet-snap`: `^7.2.0` → `^7.3.0`
- `@metamask/stellar-wallet-snap`: `^2.0.0` → `^2.1.0`
- `@metamask/tron-wallet-snap`: `^4.3.0` → `^4.4.0`

All are backwards-compatible minor updates; no application code changes
are required.

### @metamask/bitcoin-wallet-snap 3.3.0

- Retry transient Bitcoin indexer, price API, and signed transaction
broadcast failures with the shared fetch policy, and treat duplicate
broadcasts as successful
([MetaMask#530](MetaMask/internal-snaps#530)).
- Fix formatting of small Bitcoin balances to avoid scientific notation
([MetaMask#543](MetaMask/internal-snaps#543)).

### @metamask/solana-wallet-snap 7.3.0

- Remove the temporary fallback that injected `https://metamask.io` as
the request origin when `keyring_submitRequest` was called without one
([MetaMask#533](MetaMask/internal-snaps#533)).

### @metamask/stellar-wallet-snap 2.1.0

- `confirmSend` now throws when signing or submission fails after the
user confirms, instead of returning a JSON error response
([MetaMask#550](MetaMask/internal-snaps#550)).
- Bump `@stellar/stellar-sdk` from `^17.2.1` to `^17.4.0`
([MetaMask#545](MetaMask/internal-snaps#545)).
- Retry transient Token API, Price API, Security Alerts API, RPC, and
Horizon failures with bounded timeouts and circuit breaking
([MetaMask#534](MetaMask/internal-snaps#534),
[MetaMask#551](MetaMask/internal-snaps#551)).
- Fix `onAmountInput` to accept the optional destination as `toAddress`
instead of `to`
([MetaMask#558](MetaMask/internal-snaps#558)).

### @metamask/tron-wallet-snap 4.4.0

- Support `VoteWitnessContract` and `AccountPermissionUpdateContract`
transactions by upgrading TronWeb to 6.5.1
([MetaMask#561](MetaMask/internal-snaps#561)).
- Align transaction security warning copy and scan-loading behavior with
user preferences
([MetaMask#557](MetaMask/internal-snaps#557)).

## **Changelog**

CHANGELOG entry: Updated the Solana, Stellar, and Tron wallet snaps to
their latest versions.

## **Related issues**

Fixes: N/A

## **Manual testing steps**

```gherkin
Feature: Bitcoin and non-EVM wallet flows

  Scenario: user views account assets
    Given the user has Bitcoin, Solana, Stellar, and Tron accounts with assets
    When user opens the wallet and switches between those networks
    Then the assets and balances load successfully

  Scenario: user sends funds on each network
    Given the user has funds on Bitcoin, Solana, Stellar, and Tron
    When user sends funds on each network
    Then the fee estimate and confirmation are displayed correctly
    And the transaction is broadcast and completes successfully
```

## **Screenshots/Recordings**

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
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