MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.08k stars 4.93k forks source link

Transaction state is still pending while tx has already minted #22238

Closed in-eth closed 11 months ago

in-eth commented 11 months ago

What is this about?

I added customized network to metamask and tried to interact with it. What I tested is token sending. When I sent token in MM, eth_sendRawTransaction is sent. Request is processed and chain returned tx hash. After that, MM sent eth_getTransactionReceipt. Request is processed and chain returned the data but the tx state is still pending. I think that's because of logs and logBloom in the response of eth_getTransactionReceipt. Here's the log on chain side.

eth_sendRawTransaction "result": "0xFBCA7F7F7C77FC1BDED2CCA5A1C5CE8599FF432A9CB9A109CDCB0E4DA134A60E"

eth_getTransactionReceipt "result": { "blockHash": "0xEF9646A3A0BE9F9A03E419FAAC192C8B8E2D459099EFE34C047541923AFA552F", "blockNumber": "0xd1d7", "contractAddress": null, "cumulativeGasUsed": "0xa12515", "effectiveGasPrice": "0x5a9c688d4", "from": "0x8d133c22a7f4054e7adefb6c4df96d6d6763da0c", "gasUsed": "0xb4c8", "status": "0x1", "to": "0xf1829676db577682e944fc3493d451b67ff3e29f", "transactionHash": "0xFBCA7F7F7C77FC1BDED2CCA5A1C5CE8599FF432A9CB9A109CDCB0E4DA134A60E", "transactionIndex": "0x0", "type": "0x2" }

eth_getBlockByHash "result": { "difficulty": "0x0", "extraData": "0x737061726b706f6f6c2d636e2d6e6f64652d3132", "gasLimit": "0x1c9c380", "gasUsed": "0x79ccd3", "hash": "0xEF9646A3A0BE9F9A03E419FAAC192C8B8E2D459099EFE34C047541923AFA552F", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "miner": "0x841E7206A23609034C1CA3A888DD591AB687F0B1", "number": "0xd1d7", "parentHash": "0xd83d7b0f6ebce39136e74d7d175dc2001db6f4013504214513c075e00f04d00ec2f7ddf4145db9ec5d771760c5083e44", "receiptsRoot": "0x61D9A55504F6D53F2E7232BF1243E20A39D1A7C2F8946DD74369D77341957B3E", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "size": "0x41c7", "stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d", "timestamp": "0x18c58330380", "totalDifficulty": "0x12ac11391a2f3872fcd", "transactions": [ "0xfbca7f7f7c77fc1bded2cca5a1c5ce8599ff432a9cb9a109cdcb0e4da134a60e" ], "transactionsRoot": "0x61D9A55504F6D53F2E7232BF1243E20A39D1A7C2F8946DD74369D77341957B3E", "uncles": [] }

What's wrong with me?

Scenario

No response

Design

No response

Technical Details

No response

Threat Modeling Framework

No response

Acceptance Criteria

No response

Stakeholder review needed before the work gets merged

References

No response

httpJunkie commented 11 months ago

So, here is some basic info that might help:

  1. Transaction Receipt: After sending a transaction, you can get a transaction hash. With this hash, you can query the Ethereum node using eth_getTransactionReceipt. If the transaction has been mined and confirmed, this call will return a transaction receipt.

  2. Confirmation in Backend: Your backend server can listen to events emitted by the Ethereum network. When a transaction is confirmed, the backend can receive this event and update its status accordingly.

  3. MetaMask Status: MetaMask displays the transaction status as 'Pending' until it gets confirmed by miners. Even if your backend server or node confirms the transaction, MetaMask will display it as as successful once it's included in a block and the necessary confirmations are complete.

4, Regarding your question about MetaMask checking uppercase for hashes, it's important to note that Ethereum transaction hashes are case insensitive. When querying for a transaction receipt, it should return the same result AKAIK no matter using upper or lower case. Please anyone correct me if I am wrong.

Note: Blockchain transactions might take some time to get confirmed, especially during periods of network congestion. The transaction/gas fees you set affect the speed at which miners prioritize your transaction. If a transaction seems stuck or is taking longer than expected consider checking, consider checking Etherscan or let us know what Etherscan says about your transaction's status or confirmation. I didn't see that here.

in-eth commented 11 months ago

Thanks, it's working now.