AcalaNetwork / bodhi.js

Apache License 2.0
33 stars 21 forks source link

Metamask cannot cancel or speed up a transaction. #230

Closed ntduan closed 2 years ago

ntduan commented 2 years ago

image

and will resend the transaction in an infinite loop. Even restarting the browser does not prevent it.

xlc commented 2 years ago

That will means sign a transaction with different gas price, which isn't what we can support at this stage.

ntduan commented 2 years ago

That will means sign a transaction with different gas price, which isn't what we can support at this stage.

But in any case, we need a way to cancel the transaction. Currently there is no way to cancel the transaction other than deleting the account.

shunjizhan commented 2 years ago

yeah I also seen this situation before, but I think this is caused by when using instant-sealing, after metamask send a tx, this tx isn't included in a new block, and node didn't trigger a new block either...

metmask keeps searching for this non-exist tx hash, and ignores following ones

shunjizhan commented 2 years ago

we can go to metamask settings => advanced => reset account to clear metamask cache. Then resending a tx should work

shunjizhan commented 2 years ago

I can do more experiment to see how to reproduce this issue (sendRawTx doesn't trigger a new block) deterministically, I have seen this very rarely and randomly

If I remember correctly, this will usually happen when node first start, the first tx of each address will sometimes trigger such issue, let me double check

shunjizhan commented 2 years ago

~UPDATE: got it, when first time sending token to a brand new account, it won't trigger a new block, because the tx didn't go through fully (kind of stuck in a middle stage), and next tx will complete this pending tx and trigger a new block.~

~Examples flow:~ ~- send 100 ACA to alice (branch new account)~ ~- alice.ACA_balance() => 0~ ~- send another 100 ACA to alice~ ~- alice.ACA_balance() => 200~

~Is it a bug on the instant-sealing itself? without instant-sealing this issue won't happen~

shunjizhan commented 2 years ago

I think I know what's happening: we have to clear metamask cache every time we restart mandala node... otherwise there will be some nonce issue, i.e. metamask will use cached tx to speculate currently nonce...

We can also manually set nonce for each tx if default one is not correct, for examples always manually set nonce 0 for first tx