-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Inconsistent library address validations between CLI and Standard JSON #10299
Comments
@cameel i want to take up this issue. I have builded up the solidity compiler on in my local environment and have successfully run all the test. |
Sure. The problem is that checks in this part of solidity/solc/CommandLineInterface.cpp Lines 678 to 748 in 09578e7
and this one in StandardCompiler::parseInput() :solidity/libsolidity/interface/StandardCompiler.cpp Lines 836 to 871 in 09578e7
are not the same. In particular:
So the idea would be to make these checks as close as possible. I think it would be best to extract the validation into a single function called from both places. The PR should include at least minimal commandline tests covering these new cases (unless they're already covered - please check). Here are some of the existing tests:
There are more in subdirectories starting with Note that soltest does not execute these tests. There's a separate script for running them: We also have tests covering this code in |
Also, there's another issue that's related to this: #10298. You might want to take it once you fix this one. |
One more thing: there's a pending refactor that's likely to be merged into |
I wonder if we should target the breaking branch for this. |
Good point. Do we consider changes like that breaking? Technically it will now no longer be possible to use a library address with invalid checksum in Standard JSON, though we could also consider the lack of this check a bug. |
The thing is that if we require checksums, we require the "caller" to include the full keccak algorithm as a dependency. Does it create an error or a warning? In any case, @aaroosh-07 don't be discouraged by this discussion, we certainly want the feature, the question is just which version it should land in, but you can already start working on it regardless of that. |
Well,
It's an error: if (!passesAddressChecksum(addrString, false))
{
serr() << "Invalid checksum on address for library \"" << libName << "\": " << addrString << endl;
serr() << "The correct checksum is " << getChecksummedAddress(addrString) << endl;
return false;
} But it would not be hard to change it to a warning. Might actually be the best solution since it does not introduce any backwards-compatibility issues. |
If the recommended checksum is not too hard to parse, it may be a good solution for a caller that does not have a keccak library to just iterate. |
To solve this issue, I have to add checks which are not present in |
Yes. But also please try to extract the common parts of this code into a function that we can reuse in both places. The function could take the address as a |
progress till now
|
Had internal examinations past three days because of which had slow progress. |
@aaroosh-07 How is it going? Do you need any help with the implementation? |
sorry @cameel because of my university examinations going on, I have made not much progress on this issue. |
the exceptions throwed by constructor |
No worries. Take your time. Just checking if you're still on it or if the task should be marked as available for someone else to take.
Either way is ok, just make sure that the same mechanism is used in both places. If you leave exceptions in |
Hi everyone, Any help would be highly appreciated. Thanks & Regards |
Checks applied to the value of
--library
option in CLI are not exactly the same as the ones forlibraries
in Standard JSON. For example only CLI checks address checksum. The validations should be reviewed and unified.The text was updated successfully, but these errors were encountered: