Metamask-extension: Web3.js 1.2.5 tx sending broken in v8?

Created on 5 Jul 2020  路  6Comments  路  Source: MetaMask/metamask-extension

User on reddit reports txs sent with web3.js on Mmv8 return promises that never resolve, even on ropsten.
https://www.reddit.com/r/ethdev/comments/hlp4i6/issues_with_metamaks_v8_on_firefox/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

Ref: #8894

T00-bug

Most helpful comment

I've just confirmed that this was fixed by #8921. This will be included in v8.0.3, which we're hoping to publish sometime today.

Thanks for the excellent bug report @hbarcelos!

All 6 comments

_Edited because I was wrong_

~Partially(?)~ Cannot reproduce with [email protected]. web3.eth.sendTransaction has two signatures in [email protected]; the first just takes the transaction parameters, the other also takes a callback. Both return a Promise (actually, a PromiEvent, but that should be irrelevant).

The promise resolves in both cases if the transaction is mined. The callback is called immediately with the transaction hash. The behavior is identical on develop and 7.7.9. I'm starting to suspect we've already fixed this.

See updated previous comment; I cannot reproduce, and am beginning to suspect we've fixed it.

I'm the user from Reddit who reported the problem.

More context:

  1. This happens on Kovan on Firefox with MetaMask 8.x.
  2. Chrome still running 7.x, so everything works as it should.

A few days ago I reported yet another bug of Kovan being reported as having chain ID 66 instead of 42 (https://twitter.com/hbarcelos909/status/1279071557214748673) which @rekmarks fixed, but maybe it's related.

I'm running v8.0.2:
MetaMask Version

It happens with any transaction where I interact with a Smart Contract.

To give you a concrete example, my code is exaclty this one:

async function submitTranslation({ ID, text }, { from, gas, gasPrice } = {}) {
  const tx = linguo.methods.submitTranslation(ID, text).send({
    from,
    gas,
    gasPrice,
  });

  return { tx };
}

Specifically for this call, gas and gasPrice are undefined.

tx above is the infamous PromiEvent from web3.js. The promise is never fulfilled or rejected, neither the receipt, confirmation or error events are ever emitted.

Here's the source code for the contract instance in linguo variable:
https://github.com/kleros/kleros-interaction/blob/master/contracts/standard/arbitration/Linguo.sol#L270

I included some console.debug statements where I can see the following:

debug

The timestamps are in UTC-3.

Notice now that the transaction was actually mined a few seconds later:
https://kovan.etherscan.io/tx/0x421e98f3c12230499962a73c58bf0ad368ca82d59c4a220b1c67a0c9e620cf07

txn

I'm here 20+ minutes later with a reference to tx and if I console.log it, I still get:

console.log

@hbarcelos would you be able to share a minimal complete example? Maybe a https://codesandbox.io or JS Bin?

I was able to reproduce the problem using [email protected] and MetaMask v8.0.2. It has been fixed on develop though. I'm currently confirming which commit is responsible for this being fixed. (here is the codesandbox example I used)

I've just confirmed that this was fixed by #8921. This will be included in v8.0.3, which we're hoping to publish sometime today.

Thanks for the excellent bug report @hbarcelos!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DISC30 picture DISC30  路  3Comments

estebanmino picture estebanmino  路  3Comments

hellobart picture hellobart  路  3Comments

rossbulat picture rossbulat  路  3Comments

whyrusleeping picture whyrusleeping  路  3Comments