-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Open
Labels
featurehigh effortA lot to implement but still doable by a single person. The task is large or difficult.A lot to implement but still doable by a single person. The task is large or difficult.medium impactDefault level of impactDefault level of impactmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.
Description
Description
AST import leads to inconsistent bytecode.
Environment
- Compiler version: 0.8.25
- Target EVM version (as per compiler settings): No restrictions
- Framework/IDE: Command-line
- EVM execution environment / backend / blockchain client: None
- Operating system: Linux
Steps to Reproduce
contract C {
function f() public returns (bytes32) {
return address(this).codehash;
}
}
1. Get ast json
solc C.sol --combined-json ast >> C.json
2. Get bin-runtime by importing ast
solc --bin-runtime --import-ast C.json
6080604052348015600e575f80fd5b50600436106026575f3560e01c806326121ff014602a575b5f80fd5b60306044565b604051603b91906078565b60405180910390f35b5f3073ffffffffffffffffffffffffffffffffffffffff163f905090565b5f819050919050565b6072816062565b82525050565b5f60208201905060895f830184606b565b9291505056fea2646970667358221220fbde534a68865754b695d6f3d9100ab6db0b8f6d336671369335137e84faf43c64736f6c63430008180033
3. Get bin-runtime by directly compiling
solc --bin-runtime C.sol
6080604052348015600e575f80fd5b50600436106026575f3560e01c806326121ff014602a575b5f80fd5b60306044565b604051603b91906078565b60405180910390f35b5f3073ffffffffffffffffffffffffffffffffffffffff163f905090565b5f819050919050565b6072816062565b82525050565b5f60208201905060895f830184606b565b9291505056fea2646970667358221220a836f31a61ac087171816a7ee56fc5a4b688af164c9acd228bb73fd2c0644f1764736f6c63430008180033
4. Compare
The bytecode obtained from two methods differs, resulting in different return values for this function f()
Metadata
Metadata
Assignees
Labels
featurehigh effortA lot to implement but still doable by a single person. The task is large or difficult.A lot to implement but still doable by a single person. The task is large or difficult.medium impactDefault level of impactDefault level of impactmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.