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

fix: broken start-erigon make target #2186

Merged
merged 3 commits into from
Nov 29, 2024
Merged

Conversation

fridrik01
Copy link
Contributor

@fridrik01 fridrik01 commented Nov 27, 2024

Fixes: #2169

This PR fixes the start-erigon make target. The root cause was invalid paths used as params to docker and that erigon Dockerfile had changed to a different userid/group. To address that I specified to docker to run as user 1000:1000 as it was before it was changed (now it defaults to having a erigon user with id 3473:3473)

Summary by CodeRabbit

  • Chores
    • Updated configuration for running Ethereum nodes to improve user permissions and streamline execution commands.
    • Adjusted file paths for data directories and authentication secrets for better clarity and functionality.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes made in the pull request primarily involve updates to the build/scripts/testing.mk file, enhancing the configuration for running various Ethereum node types. Key modifications include the addition of user specifications for the erigon node, adjustments to file paths for data directories and JWT secrets, and the removal of redundant flags in specific sections. These changes aim to improve the functionality and correctness of the node startup processes.

Changes

File Change Summary
build/scripts/testing.mk - Added --user 1000:1000 to docker run commands for erigon node.
- Updated --datadir path from .tmp/erigon to /.tmp/erigon.
- Changed --authrpc.jwtsecret path to /$(JWT_PATH).
- Removed redundant --rm flags in start-reth-bartio and start-geth-bartio.
- Corrected genesis file path in start-erigon to /${TESTAPP_FILES_DIR}/eth-genesis.json.

Assessment against linked issues

Objective Addressed Explanation
Fix make start-erigon command (2169)

🐰 In the meadow where the code does play,
A rabbit hops with joy today!
With paths corrected and users set,
The Ethereum nodes are ready, you bet!
No more errors, just smooth runs,
Hopping along, we’ve fixed the fun! 🌟


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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.64%. Comparing base (df1912e) to head (84919fa).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2186      +/-   ##
==========================================
+ Coverage   27.47%   27.64%   +0.17%     
==========================================
  Files         366      366              
  Lines       16662    16717      +55     
  Branches       12       12              
==========================================
+ Hits         4578     4622      +44     
- Misses      11777    11786       +9     
- Partials      307      309       +2     

see 3 files with indirect coverage changes

However, its still not solved as erigon does not respect the
--networkid which causes beacond to fail since its expecting
chainid 80087.

It seems this issue was fixed in erigontech/erigon#9408
but even with pulling a recent docker image its still not working
@fridrik01 fridrik01 force-pushed the fix-start-erigon-maketarget branch from 9e69e5f to 829de29 Compare November 28, 2024 11:03
@fridrik01 fridrik01 self-assigned this Nov 28, 2024
@fridrik01 fridrik01 changed the title [WIP] fix: genesis files not found when running start-erigon fix: genesis files not found when running start-erigon Nov 28, 2024
@fridrik01 fridrik01 marked this pull request as ready for review November 28, 2024 14: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.

Actionable comments posted: 0

🧹 Outside diff range comments (1)
build/scripts/testing.mk (1)

JWT file permissions need adjustment for container user

The JWT file currently has permissions 644 (-rw-r--r--) and is owned by jailuser, which may cause issues when running the container with UID 1000. To ensure proper operation, the JWT file should be readable by the container user.

  • testing/files/jwt.hex: Change ownership to UID 1000 or ensure the file has world-readable permissions

Example fix:

chmod 644 testing/files/jwt.hex
chown 1000:1000 testing/files/jwt.hex
🔗 Analysis chain

Line range hint 214-230: LGTM! Verify JWT file permissions.

The changes maintain consistency with the init phase and correctly handle paths within the container context. The JWT secret and data directory paths are properly aligned with their respective volume mounts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify JWT file permissions
# The JWT file should be readable by UID 1000

# Find JWT file
jwt_file=$(find . -name "jwt.hex")
if [ -n "$jwt_file" ]; then
    stat -c "JWT file permissions: %a Owner: %u:%g" "$jwt_file"
    # Check if user 1000 can read the file
    runuser -u \#1000 -- test -r "$jwt_file" && echo "UID 1000 can read JWT file" || echo "Warning: UID 1000 cannot read JWT file"
fi

Length of output: 506


Script:

#!/bin/bash
# Let's try with ls command which is more commonly available
jwt_file=$(find . -name "jwt.hex")
if [ -n "$jwt_file" ]; then
    ls -l "$jwt_file"
fi

Length of output: 198

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between df1912e and 881b8d5.

📒 Files selected for processing (1)
  • build/scripts/testing.mk (2 hunks)
🔇 Additional comments (1)
build/scripts/testing.mk (1)

203-208: LGTM! Verify user ID matches host system.

The changes correctly address the path resolution issues and user permissions by:

  1. Running as user 1000:1000 to match typical host user permissions
  2. Using absolute paths within the container context
✅ Verification successful

The user ID configuration is appropriate for Docker container isolation

The changes to use --user 1000:1000 are correct and safe because:

  1. It's a standard practice to use UID 1000 for Docker containers as it provides good isolation
  2. The container runs in an ephemeral mode (--rm flag) and only mounts specific volumes
  3. File permissions are scoped to the mounted volumes only

The inability to verify the host system's UID is not a concern since:

  • The container runs in isolation
  • The mounted volumes are relative to the project directory
  • It's an ephemeral testing environment
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that UID 1000 exists on the host system
# This helps ensure the Docker container's user permissions will work correctly

id 1000 || echo "Warning: UID 1000 does not exist on host system"

Length of output: 207


Script:

#!/bin/bash
# Let's check if the Dockerfile for erigon is available in the repository
# to verify the user configuration

fd Dockerfile | grep -i erigon

Length of output: 32


Script:

#!/bin/bash
# Let's also check the make target definition to understand the full context
rg "start-erigon:" -A 10

Length of output: 602


Script:

#!/bin/bash
# Search for any documentation or configuration files related to erigon setup
fd -e md -e txt -e conf | grep -i erigon

Length of output: 42

@fridrik01 fridrik01 changed the title fix: genesis files not found when running start-erigon fix: broken start-erigon make target Nov 28, 2024
Copy link
Collaborator

@chuck-bear chuck-bear left a comment

Choose a reason for hiding this comment

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

LGTM

@chuck-bear
Copy link
Collaborator

Tested and it's working 🎉

Copy link
Collaborator

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

only a nit, than I can merge

@fridrik01 fridrik01 merged commit fcdcb35 into main Nov 29, 2024
15 checks passed
@fridrik01 fridrik01 deleted the fix-start-erigon-maketarget branch November 29, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make start-erigon broken
4 participants