Skip to content
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

Problem: rustc in nixpkgs is too old #1316

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Feb 16, 2024

Solution:

  • update nixpkgs to release-23.11

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features
    • Introduced support for macOS-14 in build configurations.
    • Enhanced multi-architecture support in release processes, including checksum naming adjustments for clarity.
  • Refactor
    • Updated dependency management and build configurations for improved compatibility and performance.
    • Streamlined build scripts and workflows for better efficiency and platform support.
  • Bug Fixes
    • Fixed issues related to cross-compilation for Darwin platforms, ensuring better support for different architectures.
  • Chores
    • Removed unused dependencies and adjusted package imports for a cleaner setup.
  • Documentation
    • Adjustments in internal documentation to reflect changes in dependency management and build configurations.

@yihuang yihuang requested a review from a team as a code owner February 16, 2024 06:55
@yihuang yihuang requested review from calvinaco and thomas-nguy and removed request for a team February 16, 2024 06:55
Copy link

socket-security bot commented Feb 16, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: pypi/[email protected], pypi/[email protected]

View full report↗︎

Copy link
Contributor

coderabbitai bot commented Feb 16, 2024

Walkthrough

The recent updates focus on refining build configurations and dependencies across various components, emphasizing conditional logic for better compatibility and efficiency. Key adjustments include updates for rocksdb handling, macOS-specific tweaks, and a shift towards using vendorHash for Go modules. Additionally, the workflow and release processes are enhanced for broader OS support, including macOS 14, and improved cross-compilation for Darwin platforms. These changes aim to streamline development and deployment processes, ensuring a smoother build environment.

Changes

Files Change Summaries
default.nix, .../default.nix Updated CGO_LDFLAGS, postFixup with conditional logic; Added poetry2nix import; Updated cosmovisor, rly with buildGo120Module and vendorHash.
integration_tests/shell.nix Removed/commented out gorc; Adjusted solc executable renaming.
nix/build_overlay.nix Removed zstd, go_1_20 override; Focused on rocksdb.
nix/go-ethereum.nix, nix/testenv.nix Renamed vendorSha256 to vendorHash; Updated dependencies.
nix/bundle-win-exe.nix Updated DLL paths for Windows executable bundling.
.github/workflows/... Added macos-14, changed OS for golangci to macos-latest, introduced macOS runner matrix, updated checksum naming in release.yml.
scripts/release.sh Adjusted hosts variable for Darwin, addressing cross-compilation issues.

Poem

In the land of code and byte,
Where the bits roam free and bright,
🐇 A rabbit hopped, with glee and might,
Through files and scripts, day and night.

With each leap, a change was sown,
Across the code, improvements shown.
🌟 "To better builds!" the rabbit crowed,
In this digital field, where progress flowed.

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@yihuang yihuang requested a review from mmsqe February 16, 2024 06:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 4e65bd9 and 1b4de2a.
Files ignored due to path filters (5)
  • flake.lock is excluded by: !**/*.lock
  • go.mod is excluded by: !**/*.mod
  • integration_tests/poetry.lock is excluded by: !**/*.lock
  • integration_tests/pyproject.toml is excluded by: !**/*.toml
  • nix/sources.json is excluded by: !**/*.json
Files selected for processing (6)
  • flake.nix (1 hunks)
  • integration_tests/shell.nix (1 hunks)
  • nix/build_overlay.nix (1 hunks)
  • nix/default.nix (3 hunks)
  • nix/go-ethereum.nix (1 hunks)
  • nix/testenv.nix (1 hunks)
Additional comments: 7
nix/build_overlay.nix (1)
  • 1-3: The changes focusing solely on rocksdb in the build overlay simplify the configuration. Ensure that the removal of zstd and go_1_20 does not adversely affect any dependencies or the build process that might still require them.
integration_tests/shell.nix (2)
  • 17-17: Commenting out pkgs.dapp and pkgs.chain-maind suggests a reconfiguration of the testing environment. Verify that this does not impact the required integration tests or if these dependencies are being replaced or temporarily removed for troubleshooting.

Also applies to: 23-23

  • 17-22: Renaming executables for different solc versions using renameExe appears to be a compatibility adjustment for testing with specific Solidity versions. This change seems appropriate for ensuring that tests run with the correct compiler versions.
nix/testenv.nix (1)
  • 10-10: Updating the pystarport dependency to include "poetry-core" and "setuptools", and adding flake8-isort with "hatchling" to buildSystems are positive changes that likely improve the Python testing environment. Verify that these updates align with the project's testing workflow and do not introduce any compatibility issues.

Also applies to: 16-16

nix/go-ethereum.nix (1)
  • 22-22: Renaming vendorSha256 to vendorHash aligns with a broader shift in managing vendor hashes. Ensure that the new vendorHash value is correct and does not negatively impact the build process.
nix/default.nix (1)
  • 16-16: Adding ${sources.poetry2nix}/overlay.nix and updating cosmovisor and rly with pkgs.buildGo120Module and vendorHash are significant improvements. Ensure that these changes enhance the build reproducibility and dependency management without introducing any compatibility issues.

Also applies to: 47-51, 60-60

flake.nix (1)
  • 3-3: Updating the NixOS/nixpkgs version to "release-23.11" is a key update aimed at addressing the outdated rustc issue. Ensure that this update does not introduce any compatibility issues with the project's dependencies or build process.

integration_tests/shell.nix Outdated Show resolved Hide resolved
@yihuang yihuang force-pushed the nixpkgs-23-11 branch 2 times, most recently from 6d1df84 to 6fdd202 Compare February 16, 2024 07:14
Copy link
Collaborator

@mmsqe mmsqe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just not sure if we need update nixpkgs in ci as well

@yihuang
Copy link
Collaborator Author

yihuang commented Feb 16, 2024

LGTM, just not sure if we need update nixpkgs in ci as well

no, that one is only for the basic shell, the actual one is pinned internally.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 4e65bd9 and 80347f9.
Files ignored due to path filters (5)
  • flake.lock is excluded by: !**/*.lock
  • go.mod is excluded by: !**/*.mod
  • integration_tests/poetry.lock is excluded by: !**/*.lock
  • integration_tests/pyproject.toml is excluded by: !**/*.toml
  • nix/sources.json is excluded by: !**/*.json
Files selected for processing (6)
  • flake.nix (1 hunks)
  • integration_tests/shell.nix (1 hunks)
  • nix/build_overlay.nix (1 hunks)
  • nix/default.nix (3 hunks)
  • nix/go-ethereum.nix (1 hunks)
  • nix/testenv.nix (1 hunks)
Files skipped from review as they are similar to previous changes (6)
  • flake.nix
  • integration_tests/shell.nix
  • nix/build_overlay.nix
  • nix/default.nix
  • nix/go-ethereum.nix
  • nix/testenv.nix

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (185bb08) 15.85% compared to head (db166c4) 36.31%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1316       +/-   ##
===========================================
+ Coverage   15.85%   36.31%   +20.46%     
===========================================
  Files          80      118       +38     
  Lines        6249    10774     +4525     
===========================================
+ Hits          991     3913     +2922     
- Misses       5178     6481     +1303     
- Partials       80      380      +300     

see 62 files with indirect coverage changes

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 4e65bd9 and 2c174cd.
Files ignored due to path filters (5)
  • flake.lock is excluded by: !**/*.lock
  • go.mod is excluded by: !**/*.mod
  • integration_tests/poetry.lock is excluded by: !**/*.lock
  • integration_tests/pyproject.toml is excluded by: !**/*.toml
  • nix/sources.json is excluded by: !**/*.json
Files selected for processing (6)
  • flake.nix (1 hunks)
  • integration_tests/shell.nix (1 hunks)
  • nix/build_overlay.nix (1 hunks)
  • nix/default.nix (3 hunks)
  • nix/go-ethereum.nix (1 hunks)
  • nix/testenv.nix (1 hunks)
Files skipped from review as they are similar to previous changes (6)
  • flake.nix
  • integration_tests/shell.nix
  • nix/build_overlay.nix
  • nix/default.nix
  • nix/go-ethereum.nix
  • nix/testenv.nix

@mmsqe mmsqe enabled auto-merge February 16, 2024 10:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 2c174cd and 30a4389.
Files selected for processing (1)
  • default.nix (1 hunks)
Additional comments: 2
default.nix (2)
  • 46-50: The conditional logic in CGO_LDFLAGS is well-structured and accounts for different scenarios: when rocksdb is not null, and based on the static flag and the platform (Windows or others). However, it's important to ensure that the libraries specified in the flags (-lrocksdb, -pthread, -lstdc++, -ldl, -lzstd, -lsnappy, -llz4, -lbz2, -lz) are compatible with the updated nixpkgs version and that they are available in the expected versions. This is crucial for maintaining the build's stability and avoiding potential runtime issues due to library incompatibilities.
  • 52-53: The postFixup script for Darwin platforms correctly updates the install_name for librocksdb.8.dylib to point to the rocksdb package's library path. This ensures that the dynamic library is correctly located at runtime on macOS. It's important to verify that the specific version of librocksdb (in this case, .8.dylib) matches the version provided by the updated nixpkgs and that this version is indeed required by the application. If the version of librocksdb has changed in the new nixpkgs release, this script may need to be updated to reflect the correct library version.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 30a4389 and 1e834d9.
Files selected for processing (1)
  • nix/bundle-win-exe.nix (1 hunks)
Additional comments: 1
nix/bundle-win-exe.nix (1)
  • 23-25: The updates to the paths for libmcfgthread-1.dll, libgcc_s_seh-1.dll, and libstdc++-6.dll are crucial for ensuring compatibility with the new nixpkgs release-23.11. It's important to verify that these changes align with the available libraries in the updated nixpkgs version and that they do not introduce any runtime issues for the Windows executable. If not already done, consider testing the application on a Windows environment to ensure these DLLs are correctly loaded and the application functions as expected.

@yihuang
Copy link
Collaborator Author

yihuang commented Feb 16, 2024

@mmsqe a blocker: NixOS/nixpkgs#273442, and the draft fix: NixOS/nixpkgs#256590

@yihuang
Copy link
Collaborator Author

yihuang commented Feb 19, 2024

on the other hand, we don't need to do cross-compiling for macos finally: https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 1e834d9 and cedd89b.
Files ignored due to path filters (1)
  • go.mod is excluded by: !**/*.mod
Files selected for processing (4)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (2 hunks)
  • scripts/release.sh (1 hunks)
Additional comments: 5
scripts/release.sh (1)
  • 40-44: The adjustments made to the hosts variable for Darwin platforms are a good approach to handling cross-compilation issues between x86_64-darwin and aarch64-darwin. This change is important for ensuring proper platform support and addressing known challenges in cross-compilation.

Given the complexity of cross-compilation and the specific issues mentioned (NixOS/nixpkgs#180771 and NixOS/nixpkgs#273442), it would be beneficial to verify the effectiveness of these adjustments in practice. Testing the build process on both x86_64-darwin and aarch64-darwin platforms can help ensure that the changes achieve the desired outcome without introducing new issues.

.github/workflows/release.yml (2)
  • 51-53: The introduction of a matrix strategy for macOS runners is a positive change that enhances the flexibility and coverage of the CI/CD process. This approach allows for testing and building on multiple macOS versions, ensuring broader compatibility and catching potential issues early.

Consider adding comments to explain the choice of macOS versions in the matrix, especially if there are specific reasons for including both macos-latest and macos-14. This can help maintain clarity and make future updates to the workflow more straightforward.

  • 92-96: Updating the checksum file naming logic to include the architecture (checksums-darwin-$(uname -p).txt) is a thoughtful improvement. It enhances the organization and clarity of build artifacts, making it easier to identify and use the correct files for each architecture.

This change aligns well with the goal of supporting multiple architectures and simplifies the process of verifying the integrity of the binaries. It's a good practice to ensure that artifact names reflect their contents or target platforms, especially in projects with diverse target environments.

.github/workflows/lint.yml (1)
  • 20-20: Changing the operating system for the golangci job to macos-latest could offer benefits in terms of compatibility or performance for linting operations. It's important, however, to monitor the impact of this change on CI performance and costs, as macOS runners can be more resource-intensive than their Ubuntu counterparts.

Ensure that all dependencies and tools used in the linting process are fully compatible with macOS to avoid any unexpected issues. This change should also be reflected in documentation or CI/CD guidelines to maintain clarity and consistency across the project's workflows.

.github/workflows/build.yml (1)
  • 19-19: Including macos-14 in the matrix configuration for operating systems is a proactive step towards ensuring compatibility with the latest macOS version and hardware. This addition helps in early detection of potential compatibility issues and ensures that the project remains accessible to users on the newest platforms.

Consider adding comments within the workflow file to explain the rationale behind including macos-14, especially if there are specific compatibility considerations or testing goals. Monitoring the impact on CI performance and resource usage is also advisable, as testing on multiple macOS versions can increase the overall CI run time and resource consumption.

Solution:
- update nixpkgs to release-23.11

re-enable dapp

update pystarport

fix chain-main

fix chain-main

update chain-main

fix build

fix win bundle

fix release.sh on apple silicon

try our luck on mac

Problem: cross-compiling macos binaries is problematic in recent nixpkgs

Solution:
- use the github macos-14 arm mac runner to build arm mac binaries
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 185bb08 and 6ea2308.
Files ignored due to path filters (5)
  • flake.lock is excluded by: !**/*.lock
  • go.mod is excluded by: !**/*.mod
  • integration_tests/poetry.lock is excluded by: !**/*.lock
  • integration_tests/pyproject.toml is excluded by: !**/*.toml
  • nix/sources.json is excluded by: !**/*.json
Files selected for processing (12)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • .github/workflows/release.yml (2 hunks)
  • default.nix (1 hunks)
  • flake.nix (1 hunks)
  • integration_tests/shell.nix (1 hunks)
  • nix/build_overlay.nix (1 hunks)
  • nix/bundle-win-exe.nix (1 hunks)
  • nix/default.nix (3 hunks)
  • nix/go-ethereum.nix (1 hunks)
  • nix/testenv.nix (1 hunks)
  • scripts/release.sh (1 hunks)
Files skipped from review as they are similar to previous changes (11)
  • .github/workflows/lint.yml
  • .github/workflows/release.yml
  • default.nix
  • flake.nix
  • integration_tests/shell.nix
  • nix/build_overlay.nix
  • nix/bundle-win-exe.nix
  • nix/default.nix
  • nix/go-ethereum.nix
  • nix/testenv.nix
  • scripts/release.sh
Additional comments: 1
.github/workflows/build.yml (1)
  • 19-19: Adding macos-14 to the OS matrix is a good move for ensuring compatibility with the latest macOS version. However, it's important to verify that all steps in the build job, especially those involving external actions or dependencies, are compatible with macos-14. This includes actions like actions/checkout@v3, cachix/install-nix-action@v23, and any scripts or commands run during the job. Compatibility issues could lead to build failures or unexpected behavior on this new OS version.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 185bb08 and db166c4.
Files ignored due to path filters (5)
  • flake.lock is excluded by: !**/*.lock
  • go.mod is excluded by: !**/*.mod
  • integration_tests/poetry.lock is excluded by: !**/*.lock
  • integration_tests/pyproject.toml is excluded by: !**/*.toml
  • nix/sources.json is excluded by: !**/*.json
Files selected for processing (10)
  • .github/workflows/lint.yml (1 hunks)
  • default.nix (1 hunks)
  • flake.nix (1 hunks)
  • integration_tests/shell.nix (1 hunks)
  • nix/build_overlay.nix (1 hunks)
  • nix/bundle-win-exe.nix (1 hunks)
  • nix/default.nix (3 hunks)
  • nix/go-ethereum.nix (1 hunks)
  • nix/testenv.nix (1 hunks)
  • scripts/release.sh (1 hunks)
Files skipped from review as they are similar to previous changes (10)
  • .github/workflows/lint.yml
  • default.nix
  • flake.nix
  • integration_tests/shell.nix
  • nix/build_overlay.nix
  • nix/bundle-win-exe.nix
  • nix/default.nix
  • nix/go-ethereum.nix
  • nix/testenv.nix
  • scripts/release.sh

@mmsqe mmsqe added this pull request to the merge queue Feb 19, 2024
Merged via the queue into crypto-org-chain:main with commit 7c976f4 Feb 19, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants