-
Notifications
You must be signed in to change notification settings - Fork 51
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
Update zksync flow #901
Update zksync flow #901
Conversation
WalkthroughThis pull request introduces several changes across multiple scripts and configuration files. It adds entries to the Changes
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
script/helperFunctions.sh (3)
3750-3768
: Ensure reliable download by handling failed attemptsThe download section uses either
curl
orwget
based on availability. Consider adding error handling to check if neither tool is available and provide a clear error message. Additionally, ensure that if the download fails, the script exits gracefully.Apply this diff to improve error handling:
if command -v curl &> /dev/null; then curl -L -o "${install_dir}/${filename}" "$download_url" + DOWNLOAD_STATUS=$? elif command -v wget &> /dev/null; then wget -O "${install_dir}/${filename}" "$download_url" + DOWNLOAD_STATUS=$? else echo "Neither curl nor wget is installed" return 1 fi -# Check if download was successful -# $? contains the return status of the last command -if [ $? -ne 0 ]; then +if [ $DOWNLOAD_STATUS -ne 0 ]; then echo "Download failed" return 1 fi
3714-3723
: Enhance operating system detection for broader compatibilityThe current OS detection handles
darwin
andlinux-gnu
cases. Consider expanding the pattern matching to include other variations of Linux identifiers, such aslinux-gnueabihf
orlinux-musl
, to ensure broader compatibility across different Linux distributions.Example modification:
elif [[ "$OSTYPE" == "linux-"* ]]; then os="linux"
3769-3777
: Verify the integrity of downloaded filesTo ensure the security and integrity of the downloaded binaries, consider adding a checksum verification step after downloading the file. This can prevent issues arising from corrupted or tampered files.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
foundry-zksync/.gitignore
(1 hunks)foundry-zksync/Dockerfile
(0 hunks)script/deploy/deploySingleContract.sh
(2 hunks)script/helperFunctions.sh
(3 hunks)script/scriptMaster.sh
(1 hunks)
💤 Files with no reviewable changes (1)
- foundry-zksync/Dockerfile
✅ Files skipped from review due to trivial changes (1)
- foundry-zksync/.gitignore
🧰 Additional context used
📓 Learnings (1)
script/deploy/deploySingleContract.sh (1)
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: script/deploy/deploySingleContract.sh:231-231
Timestamp: 2024-11-26T01:18:52.125Z
Learning: In the `deploySingleContract.sh` script, environment variable assignments preceding the `forge script` command (e.g., `DEPLOYSALT=$DEPLOYSALT ... forge script ...`) are acceptable and function correctly, even when variable expansions like `$DIAMOND_TYPE` and `$NETWORK` are used later in the same command.
🪛 Shellcheck (0.10.0)
script/deploy/deploySingleContract.sh
[warning] 227-227: This assignment is only seen by the forked process.
(SC2097)
[warning] 227-227: This expansion will not see the mentioned assignment.
(SC2098)
🔇 Additional comments (3)
script/deploy/deploySingleContract.sh (2)
210-213
: Ensure environment variables are correctly used with zkSync-specific commands
The added commands set FOUNDRY_PROFILE=zksync
and invoke the zkSync-specific forge
commands. This is appropriate for handling zkSync deployments. Ensure that the environment variable FOUNDRY_PROFILE
is recognized by the forge
command and that the --zksync
flag is necessary for your build process.
226-227
: Confirm environment variable assignments in command invocation
The line assigns multiple environment variables before invoking the forge script
command for zkSync deployments. While this pattern works in many shells, some static analysis tools may warn about variable assignments preceding commands not being visible within the command. Since prior learnings indicate that this approach functions correctly in your environment, you can proceed but consider validating to ensure compatibility.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 227-227: This assignment is only seen by the forked process.
(SC2097)
[warning] 227-227: This expansion will not see the mentioned assignment.
(SC2098)
script/scriptMaster.sh (1)
137-138
: Ensure zkSync binaries are installed before deployment
By invoking install_foundry_zksync
, the script now proactively checks and installs the zkSync-specific Foundry binaries if they are not already present. This enhances the robustness of deployments to the zkSync network by ensuring that all necessary tools are available.
Test Coverage ReportLine Coverage: 77.92% (2139 / 2745 lines) |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
script/helperFunctions.sh (1)
3741-3818
: Consider adding checksum verification for downloaded binaries.While the installation logic is well-implemented, it would be safer to verify the integrity of downloaded binaries using checksums before execution.
# Download the file using curl or wget, whichever is available if command -v curl &> /dev/null; then curl -L -o "${install_dir}/${filename}" "$download_url" + # Download checksum file + curl -L -o "${install_dir}/${filename}.sha256" "${download_url}.sha256" elif command -v wget &> /dev/null; then wget -O "${install_dir}/${filename}" "$download_url" + # Download checksum file + wget -O "${install_dir}/${filename}.sha256" "${download_url}.sha256" else echo "Neither curl nor wget is installed" return 1 fi +# Verify checksum +if ! sha256sum -c "${install_dir}/${filename}.sha256"; then + echo "Checksum verification failed" + rm -f "${install_dir}/${filename}" "${install_dir}/${filename}.sha256" + return 1 +fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
script/helperFunctions.sh
(3 hunks)
🧰 Additional context used
📓 Learnings (1)
script/helperFunctions.sh (1)
Learnt from: ezynda3
PR: lifinance/contracts#901
File: script/helperFunctions.sh:3693-3701
Timestamp: 2024-12-10T09:27:41.956Z
Learning: In the Bash script `script/helperFunctions.sh`, the `install_foundry_zksync` function does not require external specification of `FOUNDRY_ZKSYNC_VERSION` via environment variables. The hardcoded version is acceptable.
🔇 Additional comments (3)
script/helperFunctions.sh (3)
1430-1431
: LGTM: ZKSync verification integration looks good!
The code properly integrates ZKSync contract verification using foundry-zksync, with appropriate handling of debug/non-debug modes and correct chain configuration.
Also applies to: 1439-1440, 1449-1450, 1456-1457, 1459-1459
3680-3701
: LGTM: Well-documented function with proper version handling!
The function documentation and version handling are well-implemented. The hardcoded version is acceptable as confirmed in the learnings.
3713-3740
: LGTM: Robust platform detection implementation!
The code implements comprehensive platform detection with:
- Support for macOS and Linux
- Handling of x86_64 and ARM architectures
- Clear error handling for unsupported platforms
Which Jira task belongs to this PR?
Why did I implement it this way?
Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)