-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Swarm hash of compiled contracts is dependent on compilation path #1621
Comments
Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem. |
Bump! I think that moving to relative paths for truffle-compile should be a change easy to implement, and would open the door to using |
Thanks for your response! This issue is no longer considered stale and someone from the Truffle team will try to respond as soon as they can. |
Cool, I'll try and see how we can resolve this! |
Note that this issue has been open since 2018, on the deprecated repository here: trufflesuite/truffle-compile#77 @eggplantzzz There is an investigation and even a coded solution in the old issue for this. |
How can we prioritise this? |
This issue has been solved in #4119. Now the example from the description produces the same bytecode regardless of the project location. |
Issue
Having the exact same project on two different paths yields two different swarm hashes for the same contract.
Steps to Reproduce
Set up a truffle project via
truffle init
and create a sample project with a small contract:Copy the same project via
cp -a
to a different path, and runtruffle compile
on both project folders, and then compare the ending of the bytecode for both of them:Note that the ending (apparently the swarm hash) changes between them, and the only difference is their paths.
Expected Behavior
I would expect that the same contract, compiled with the same compiler version, yielded exactly the same bytecode. This is especially important now that EXTCODEHASH is around the corner, since it means that there is no unique codehash for a given contract source+compiler, but the same contract will have different codehashes depending on which path it was compiled.
My gut feeling is that this may be caused by truffle-compile passing absolute paths to solc. Perhaps using relative paths may help?
Environment
truffle version
): v5.0.1 (installed globally with nvm)node --version
): v10.13.0npm --version
): 6.4.1The text was updated successfully, but these errors were encountered: