Closed levino closed 5 years ago
Could this be a problem with Infura?
When connected to any of the metamask provided networks, running web3.eth.getCode(emptyAddress, (err, result) => console.log(result))
in my browser console returns 0x
.
When I switch to metamask to localhost:8545
and use my local blockchain instance with ganache-cli, it returns 0x0
.
When I connect to Infura on my own by setting the provider to https://mainnet.infura.io/v3/<api-key>
, it returns 0x
.
So the issue is upstream at infura, which MetaMask is using. Metamask should check the result it gets from infura or any rpc server for the correct format anyhow. Does anyone want to report this to infura?
Why was this closed?
@Levino, I fixed it here in MetaMask #5283
And also here in Ganache: trufflesuite/ganache-core#171
0x
is the standard, not 0x0
. But in the future, Ganache will return 0x
, and MetaMask will handle both.
Thanks for clarifying.
The injected
web3
instance retuns0x
when one callsweb3.eth.getCode(address)
whenaddress
has no contract deployed to it. The normalweb3
however returns0x0
. This inconsistency is not only annoying but very dangerous. See also https://github.com/Neufund/TypeChain/issues/50 and https://github.com/MetaMask/metamask-extension/issues/1789. I think this issue should be addressed quickly and is a low hanging fruit. Happy to write a test and possibly fix for this but I am not sure where this is actually generated in the code.