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.46k stars 952 forks source link

Debugger doesn’t loads target contract on DelegateCall when debugging a transaction on mainnet #297

Open ytrezq opened 5 years ago

ytrezq commented 5 years ago

When debugging a transaction on mainet, if a contracts performs a Delegatecall, then the Debugger doesn’t attempt to load the target contract code, and instead continues repeating over the same instruction as if nothing changes.

Example : http://etherscan.io/remix?txhash=0xe152b8a0d9e83ddaa0158d7ca9beb0636d66e53e9498e5deb5a25aa3a324fba7

yann300 commented 5 years ago

could you try the debugger from remix.ethereum.org ? load the debugger module from the plugin manager and paste the tx hash

ytrezq commented 5 years ago

@yann300 : Ok. Not a good example.

Remix also fails to decode the contract being executed on delegatecall return in the case of Uniswap : https://etherscan.io/tx/0x422ac5641af2fed5b3f85a0d8241a78f2814353d52630ecfa5748a987861b553

And that time it also fails with the latest version of http://remix.ethereum.org.

yann300 commented 5 years ago

ok I see there's an issue, But what do you mean by "decode" in to decode the contract? decode state variable or just show the opcode.

I see that for that tx, it loads the contract code at 0x2157a7894439191e520825fe9399ab8655e0f708 , the loaded code is wrong?

ytrezq commented 5 years ago

@yann300 : but after 0x2157a7894439191e520825fe9399ab8655e0f708 call a contract it doesn t load and resume from 0x2157a7894439191e520825fe9399ab8655e0f708 but from 0x2c4bd064b998838076fa341a83d007fc2fa50957 directly where of course stepping does nothing since the high code address of 0x2157a7894439191e520825fe9399ab8655e0f708 doesn’t exists in 0x2c4bd064b998838076fa341a83d007fc2fa50957.

yann300 commented 5 years ago

do you have the corresponding solidity source code, solidity version and compiler option used for compiling it?

ytrezq commented 5 years ago

@yann300 : I don’t think it’s relevant since the error happen at the assembly level (never got remix performing line by line debugging with the source code in the ɪᴅᴇ). And you got the point : it’s not solidity at all but Vhyper.