-
Notifications
You must be signed in to change notification settings - Fork 84
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
Improve handling of "version" string from Etherscan #545
Conversation
WalkthroughThe recent update focuses on improving the handling of specific version formats in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crytic_compile/platform/etherscan.py
Outdated
if "+" in version: | ||
return version[1 : version.find("+")] | ||
return version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _convert_version
function now handles version strings without a +
character by returning the entire string if the +
character is not found. This change correctly addresses the issue described in the PR objectives. However, the function unnecessarily slices the version string from index 1, which could remove the first character of the version string unintentionally. This could lead to incorrect version handling if the version string does not start with 'v' or if the character is essential.
- return version[1 : version.find("+")]
+ return version[: version.find("+")]
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if "+" in version: | |
return version[1 : version.find("+")] | |
return version | |
if "+" in version: | |
return version[: version.find("+")] | |
return version |
crytic_compile/platform/etherscan.py
Outdated
return version[1 : version.find("+")] | ||
if "+" in version: | ||
return version[1 : version.find("+")] | ||
return version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do versions with no "+" also have no "v" in the beginning? With this change, versions without "+" won't have the first character removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not really necessary (as the code worked with the v
), but I pushed a quick fix for it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- crytic_compile/platform/etherscan.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- crytic_compile/platform/etherscan.py
crytic-compile fails to compile correctly contracts such as:
This is caused by the fact that the compiler version is
v0.7.6
, which does not contain any+
.Summary by CodeRabbit