-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Non-deterministic output according to filesystem path #9790
Comments
This is known behaviour. You tell the compiler: "Compile the file called If you want to abstract away the directories a / b / c, you have three options:
|
I'm curious about the hashing logic. What does the bytecode care about source imports? Any interfaces or library code should be effectively integrated or placeholdered at the point of bytecode output, no? I get why placeholder hashes might include file paths since it's very relevant, but not why that might effect contract bytecode. If you happen to move source files around but leave execution instructions all the same, I think most of us would expect the build to output the same bytecode at the end. Not a big deal to me, it's just unintuitive. Thank you for the options, those will be helpful. |
Of course, there are changes to filenames and paths that should not change the semantics of the contract, but if you exchange the names of to files, then this can have a big influence, especially if they define the same symbols. The idea is that we want a hash in the bytecode that basically is a watermark and allows re-compilation in exactly the same way as it was done before deployment, including the names of all files and all comments in the source code. |
Description
I'm seeing non-deterministic output according to filesystem path when compiling libraries. I've been able to reproduce it with multiple versions.
Environment
Steps to Reproduce
I put together a test case repository. If you run
run.sh /path/to/solc
it'll compile 3 identical libraries in 3 different directories displaying md5 hashes of the source contract and output.Example from my last run:
This may be related to #168 which was closed before resolution.
The text was updated successfully, but these errors were encountered: