-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Description
During deployment of Augur, one of the contracts would not verify on Etherscan properly: the deployment process created one bytecode for "ZeroXTrade", while giving the Standard Json to Etherscan and having them compile created bytecode with VERY slightly different bytecode (of different lengths!).
Due to past issues with contract verification, Augur flattens all contracts prior to deployment. The Standard Json that is provided to solidity lists many contracts to be compiled, but all of them are completely flattened and self-contained (with significant code-duplication between them).
The issue is that the bytecode created for a self-contained contract changes depending on what OTHER self-contained contracts are compiled at the same time. In the example below, I have linked two different inputs that are identical except for an additional self-contained contract being compiled at the same time which demonstrates this issue.
Environment
- Compiler version: 0.5.17
- Target EVM version (as per compiler settings): 0.5.17
- Framework/IDE (e.g. Truffle or Remix): n/a
- EVM execution environment / backend / blockchain client:
- Operating system: Linux
Steps to Reproduce
standard-json examples that show the issue:
https://gist.github.com/epheph/20428a1ff7163bce1d47be7d7b623344
The only difference between these two files is the "Augur.sol" section (which jq is discarding the output of).
If you run each of these through solc 0.5.17:
$ cat 1-contract.json | solc-0.5.17 --standard-json \
| jq -r '.contracts["trading/ZeroXTrade.sol"].ZeroXTrade.evm.bytecode.object' | egrep -o '^.{64}'
60806040526000805461ffff1916905534801561001b57600080fd5b506147c2
$ cat 2-contracts.json | solc-0.5.17 --standard-json \
| jq -r '.contracts["trading/ZeroXTrade.sol"].ZeroXTrade.evm.bytecode.object' | egrep -o '^.{64}'
60806040526000805461ffff1916905534801561001b57600080fd5b506147d1
Look at the last characters, c2 vs d1. There are many other slight differences, but this is the first.
ZeroXTrade.sol makes NO reference to Augur.sol, so the fact that Augur.sol is compiled in the same solidity run should not change the ZeroXTrade's bytecode.
/cc @nuevoalex