ethereum / remix-project

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
https://remix-ide.readthedocs.io
MIT License
2.37k stars 897 forks source link

Solidity contract compiles in JSVM, recieves error on compile in Injected Web3 #304

Open finleyexp opened 4 years ago

finleyexp commented 4 years ago

The Problem

I'm investigating a scammer's "guess the number" contract that was found (here). I've made patches to the contract in the attempt to understand how the scam worked as well as how the guessing game should have worked.

The Error

When I run my contract in the JSVM it compiles and deploys without problem. When I change to Injected Web3, login to Metamask, switch to Rinkeby, then hit compile I receive:

creation of iGuess errored: call to plugin has timed out compilerMetadata - deployMetadataOf - {"from":"udapp","isFromNative":true}

Downgrading the version of the compiler doesn't do anything until 0.4.26, which doesn't compile, but gives the error:

worker undefined

I'm willing to bet the issue has to do with my code. I'm attempting to understand how to use:

abi.encodePacked(...)

The System

Compiler: 0.5.8 Language: Solidity EVM: default Injected Web3: Metamask w/ Rinkeby Firefox: 72.0.1 Windows 8.1, Intel Pentium, 2.20 GHz

yann300 commented 4 years ago

Could you check for any error in the JavaScript console of the browser?

finleyexp commented 4 years ago

These are the warnings in the console:

MetaMask: MetaMask will soon stop reloading pages on network change. If you rely upon this behavior, add a 'networkChanged' event handler to trigger the reload manually: https://metamask.github.io/metamask-docs/API_Reference/Ethereum_Provider#ethereum.on(eventname%2C-callback) Set 'ethereum.autoRefreshOnNetworkChange' to 'false' to silence this warning: https://metamask.github.io/metamask-docs/API_Reference/Ethereum_Provider#ethereum.autorefreshonnetworkchange' inpage.js:1:2297

Successfully compiled asm.js code (total compilation time 402ms) app.js unreachable code after return statement app.js:27595:81

Source map error: Error: request failed with status 404 Resource URL: http://remix.ethereum.org/#optimize=true&evmVersion=null&version=soljson-v0.5.3+commit.10d17f24.js Source Map URL: ../sourcemaps/inpage.js.map

Source map error: Error: NetworkError when attempting to fetch resource. Resource URL: moz-extension://5c360784-d242-47b6-b6af-58a7d4646e11/contentscript.js Source Map URL: ../sourcemaps/contentscript.js.map

Thanks for helping check this out. ​