-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect instruction list of the contract account #1772
Comments
Can you elaborate the difference between normal execution and debugging mode. Do you mean |
Although the two bytecodes in your images are different, the one with the lowest corresponds to the creation bytecode which is constructor + runtime bytecode, you can't cover runtime bytecode during creation, and 1.45% corresponds to the coverage of creation bytecode over creation + runtime bytecode, hence it is low. The one with 98% code coverage is the runtime bytecode's coverage during the runtime symbolic execution of the contract. |
I run mythril in Pycharm IDE. I explicitly add print statements in coverage_plugin.py to print coverage. The parameters given to myth.py in Pycharm IDE is: analyze path_to_solidity:contract_name. The normal execution just means to run myth.py by clicking the run button. 1.45% is not the coverage of the contract creation code. The contract creation code is 65.98%. |
From what I have checked |
Thank you for the explanation! |
You can look at the code. The variable |
Description
On a contract that only has constructor and fallback functions, there is a huge coverage gap in the normal execution and in debugging mode.
The normal execution has coverage 1.45% while the debugging has 98% code coverage.
In the normal execution:
In the debugging mode:
I have observed that in a message call transaction, the instruction list has abnormal instructions.
How to Reproduce
1, execute this contract normally in the default setting
2, execute this contract in the debugging mode
The code of the contract:
pragma solidity ^0.5.3;
contract Proxy {
address internal masterCopy;
constructor(address _masterCopy)
public
{
require(_masterCopy != address(0), "Invalid master copy address provided");
masterCopy = _masterCopy;
}
function ()
external
payable
{
assembly {
let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, masterCopy)
return(0, 0x20)
}
calldatacopy(0, 0, calldatasize())
let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if eq(success, 0) { revert(0, returndatasize()) }
return(0, returndatasize())
}
}
}
The text was updated successfully, but these errors were encountered: