-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Truncate linkerObject at the beginning, not end #3918
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
Conversation
The format for a fully qualified library name is path:name, where name is the simple library name. Before this change, we truncate fully qualified names on at the end, which means we lose part of the library name rather than the path. If you have a large project with many libraries in different directories, then the beginning of the library path is more likely to be similar than then end (i.e. library name and filename). Thus, truncate the beginning of the fully qualified library name rather than the beginning. Also, if you specify absolute paths for your import statements then the unresolved names not likely to be unique.
Thank you for the pull request! In my opinion, this change is a breaking change and cannot be done before 0.5.0. I would actually rather remove the truncated library names than change their alignment. |
This merge would require ethereum/solc-js#213 if merged |
@chriseth I agree, removing the truncation would be much nicer. I can see two options:
What do you think? |
I think they are entirely deprecated because the new JSON format gives offsets properly. For a proper big break, I'd consider to change each value to:
This way the content is still parseable, but cannot be used without the standard JSON format, which is the aim. |
@seanyoung a hash sounds nice too, but has to be less than 160 bits given the requirement of underscores on both sides. Otherwise the contract may be deployed with random "linked" addresses. |
Allow me to comment as I worked with @seanyoung on this.
This change would be transparent to type 1.) projects (or any project where the import path fits into the 40 bytes). Type 2.) project would also not be affected by this change as they rely on json output. We tried using We're currently using this patch on top of 0.4.21 to compile and link without resorting to standard-json output and we're interested in helping create a long-term solution that is more reliable. Do you think this ticket is a good place to discuss or is there a separate one that you're aware of? |
Please note that every other mode of operation is deprecated and will be removed in the future.
Not really. Please create issues whenever they are encountered to give us a chance fixing them 😉
Do you distribute that version? If so, what is the version number (do you append a marker to the version)? Otherwise it is quite hard for outsiders to validate your contracts.
Usually we prefer having issues for discussions (because PRs are more transient discussion wise and a lot of people are only checking issues and not PRs), so if you think this will take longer to resolve, please open an issue. Actually, I think it will make much more sense discussing this in an issue, with more context and problems you've encountered. Can you please create one? |
Closing because standard-json provides a better fix and this would be a breaking change that does not properly fix the underlying issue. Created a new issue for the local file resolution. |
When a importing a library with a long path, the unresolved name in the bin file gets truncated at tail end, and contract name is lost. This makes it impossible to link against.
Before this PR:
After this PR: