MetaMask / MetaMask/metamask-extension
[Bug]: Contract Interaction - Incorrect screen and MetaMask stays loading indefinetly if I trigger a contract interaction with a colliding function as `0x095ea7b3`(approve)
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
if I trigger a contract interaction with a colliding function for `0x095ea7b3`(approve):
- In current prod 12.7.2, MM stays loading, right after triggering the tx
- In 12.9.0:
- we display an incorrect custom screen: Revoke permissions
- MM stays loading indefinitely, if we reject it from inside the wallet or if we trigger another tx from another dapp, and accept/reject that (see below)
**Screenshots/Recordings**
Triggering the contract interaction and then cancelling from inside the wallet, and the full view remains loading:
https://github.com/user-attachments/assets/396544d4-712a-48b4-a2fc-4835e042c520
Triggering the contract interaction and then triggering another tx from another dapp, and the popup remains loading:
https://github.com/user-attachments/assets/1a6b0bb2-fae3-4a0e-ba9e-a473f5f1797b
**Steps to reproduce**
1. Go to Remix
2. Paste the contract below
3. Deploy it
4. Interact with the function (test data: `0x1234567890abcdef1234567890abcdef` and `12345678901234567890`)
5. See how the screen displayed is Revoke permissions
Variant 1:
6. Without accepting it, go to the full view
7. Click on the unapproved tx
8. Reject it
9. See MM Stays loading
Variant 2:
6. Go to the test dapp
7. Trigger another tx there
8. Accept/reject, the second one
9. See MM stays loading
Note: this will happen not only with the below function, but with any function which has a collision
```
pragma solidity 0.6.12;
/**
* SPDX-License-Identifier: Apache-2.0
**/
contract Test {
function sign_szabo_bytecode(bytes16,uint128) public {
}
}
```
**Detection stage**
In production (default)
**Version**
12.7.2 12.9.0
**Build type**
None
**Browser**
Chrome
**Operating system**
Linux
Contributor guide
Research direction
Reproduce the collision in Remix using the provided Solidity contract and test data, then trace MetaMask's contract-interaction handling for the 0x095ea7b3 selector. Done means the correct interaction screen appears and the loading state clears after rejection or after another dapp transaction is handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity, typescript
- Domain
- blockchain, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100