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

chore(kurtosis): unused function clean up #1768

Merged
merged 3 commits into from
Jul 23, 2024
Merged

chore(kurtosis): unused function clean up #1768

merged 3 commits into from
Jul 23, 2024

Conversation

nidhi-singh02
Copy link
Contributor

@nidhi-singh02 nidhi-singh02 commented Jul 23, 2024

Summary by CodeRabbit

  • Refactor
    • Streamlined the initialization and management process for the beacon node, enhancing maintainability and clarity.
    • Reduced the number of functions for initialization and validator management, resulting in a more efficient control flow.

Signed-off-by: nidhi-singh02 <trippin@berachain.com>
Signed-off-by: nidhi-singh02 <trippin@berachain.com>
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The recent changes represent a significant refactor of the beacon node's initialization and management processes. Several functions related to validator management and configuration have been removed, indicating a shift towards a more streamlined and centralized approach. The remaining functionality in the start method suggests enhanced efficiency and clarity by reducing complexity and consolidating logic, ultimately improving code maintainability.

Changes

Files Changed Change Summary
kurtosis/src/nodes/consensus/beacond/node.star Functions for initializing, managing validators, and configuration have been removed, leading to a more streamlined approach.

Poem

In the meadow where the code runs free,
A refactor sprouted like a bright green tree.
Functions trimmed, made light and spry,
A streamlined path, oh my, oh my!
With clearer flow and simpler ways,
We hop along through brighter days! 🐇✨


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 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

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

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 Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.65%. Comparing base (5f9596c) to head (42ac4e2).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1768   +/-   ##
=======================================
  Coverage   25.65%   25.65%           
=======================================
  Files         295      295           
  Lines       12701    12701           
  Branches       27       27           
=======================================
  Hits         3258     3258           
  Misses       9314     9314           
  Partials      129      129           

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)
kurtosis/src/nodes/consensus/beacond/node.star (1)

Line range hint 4-18:
Consolidate sed commands for maintainability.

The sed commands are used to modify multiple configuration settings. Consider consolidating these commands into a single script or configuration template for better maintainability and readability.

- set_config = 'sed -i "s/^prometheus = false$/prometheus = {}/" {}/config/config.toml'.format("$BEACOND_ENABLE_PROMETHEUS", "$BEACOND_HOME")
- set_config += '\nsed -i "s/^prometheus_listen_addr = \\":26660\\"$/prometheus_listen_addr = \\"0.0.0.0:26660\\"/" {}/config/config.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^flush_throttle_timeout = \\".*\\"$/flush_throttle_timeout = \\"10ms\\"/" {}/config/config.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^timeout_propose = \\".*\\"$/timeout_propose = \\"{}\\"/" {}/config/config.toml'.format(config_settings.timeout_propose, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^timeout_propose_delta = \\".*\\"$/timeout_propose_delta = \\"500ms\\"/" {}/config/config.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^timeout_prevote = \\".*\\"$/timeout_prevote = \\"{}\\"/" {}/config/config.toml'.format(config_settings.timeout_prevote, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^timeout_precommit = \\".*\\"$/timeout_precommit = \\"{}\\"/" {}/config/config.toml'.format(config_settings.timeout_precommit, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^timeout_commit = \\".*\\"$/timeout_commit = \\"{}\\"/" {}/config/config.toml'.format(config_settings.timeout_commit, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^addr_book_strict = .*/addr_book_strict = false/" "{}/config/config.toml"'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^unsafe = false$/unsafe = true/" "{}/config/config.toml"'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^type = \\".*\\"$/type = \\"nop\\"/" {}/config/config.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^discard_abci_responses = false$/discard_abci_responses = true/" {}/config/config.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^# other sinks such as Prometheus.\nenabled = false$/# other sinks such as Prometheus.\nenabled = true/" {}/config/app.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^prometheus-retention-time = 0$/prometheus-retention-time = 60/" {}/config/app.toml'.format("$BEACOND_HOME")
- set_config += '\nsed -i "s/^payload-timeout = \\".*\\"$/payload-timeout = \\"{}\\"/" {}/config/app.toml'.format(app_settings.payload_timeout, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^enable-optimistic-payload-builds = \\".*\\"$/enable-optimistic-payload-builds = \\"{}\\"/" {}/config/app.toml'.format(app_settings.enable_optimistic_payload_builds, "$BEACOND_HOME")
- set_config += '\nsed -i "s/^suggested-fee-recipient = \\"0x0000000000000000000000000000000000000000\\"/suggested-fee-recipient = \\"0x$(printf \"%040d\" {})\\"/" {}/config/app.toml'.format(validator_index, "$BEACOND_HOME")
+ set_config = """
+ sed -i "s/^prometheus = false$/prometheus = {}/" {}/config/config.toml
+ sed -i "s/^prometheus_listen_addr = \\":26660\\"$/prometheus_listen_addr = \\"0.0.0.0:26660\\"/" {}/config/config.toml
+ sed -i "s/^flush_throttle_timeout = \\".*\\"$/flush_throttle_timeout = \\"10ms\\"/" {}/config/config.toml
+ sed -i "s/^timeout_propose = \\".*\\"$/timeout_propose = \\"{}\\"/" {}/config/config.toml
+ sed -i "s/^timeout_propose_delta = \\".*\\"$/timeout_propose_delta = \\"500ms\\"/" {}/config/config.toml
+ sed -i "s/^timeout_prevote = \\".*\\"$/timeout_prevote = \\"{}\\"/" {}/config/config.toml
+ sed -i "s/^timeout_precommit = \\".*\\"$/timeout_precommit = \\"{}\\"/" {}/config/config.toml
+ sed -i "s/^timeout_commit = \\".*\\"$/timeout_commit = \\"{}\\"/" {}/config/config.toml
+ sed -i "s/^addr_book_strict = .*/addr_book_strict = false/" "{}/config/config.toml"
+ sed -i "s/^unsafe = false$/unsafe = true/" "{}/config/config.toml"
+ sed -i "s/^type = \\".*\\"$/type = \\"nop\\"/" {}/config/config.toml
+ sed -i "s/^discard_abci_responses = false$/discard_abci_responses = true/" {}/config/config.toml
+ sed -i "s/^# other sinks such as Prometheus.\nenabled = false$/# other sinks such as Prometheus.\nenabled = true/" {}/config/app.toml
+ sed -i "s/^prometheus-retention-time = 0$/prometheus-retention-time = 60/" {}/config/app.toml
+ sed -i "s/^payload-timeout = \\".*\\"$/payload-timeout = \\"{}\\"/" {}/config/app.toml
+ sed -i "s/^enable-optimistic-payload-builds = \\".*\\"$/enable-optimistic-payload-builds = \\"{}\\"/" {}/config/app.toml
+ sed -i "s/^suggested-fee-recipient = \\"0x0000000000000000000000000000000000000000\\"/suggested-fee-recipient = \\"0x$(printf \"%040d\" {})\\"/" {}/config/app.toml
+ """.format("$BEACOND_ENABLE_PROMETHEUS", "$BEACOND_HOME", "$BEACOND_HOME", config_settings.timeout_propose, "$BEACOND_HOME", "$BEACOND_HOME", config_settings.timeout_prevote, "$BEACOND_HOME", config_settings.timeout_precommit, "$BEACOND_HOME", config_settings.timeout_commit, "$BEACOND_HOME", "$BEACOND_HOME", "$BEACOND_HOME", "$BEACOND_HOME", "$BEACOND_HOME", "$BEACOND_HOME", app_settings.payload_timeout, "$BEACOND_HOME", app_settings.enable_optimistic_payload_builds, "$BEACOND_HOME", validator_index, "$BEACOND_HOME")
Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 5f9596c and 42ac4e2.

Files selected for processing (1)
  • kurtosis/src/nodes/consensus/beacond/node.star (2 hunks)
Additional comments not posted (3)
kurtosis/src/nodes/consensus/beacond/node.star (3)

3-3: Ensure the existence and permissions of the target directory.

The mv_genesis command moves a file to a new location. Ensure that the target directory /root/.beacond/config/ exists and has the appropriate permissions.


Line range hint 19-22:
Review the construction of the start_node command.

The start_node command constructs a command to start the beacon node. Ensure that all the environment variables and paths used in the command are correctly set and accessible.


Line range hint 24-39:
LGTM!

The get_genesis_env_vars function is straightforward and correctly returns the required environment variables.

@ocnc ocnc merged commit 46eb1b7 into main Jul 23, 2024
18 checks passed
@ocnc ocnc deleted the kurtosis-node-cleanup branch July 23, 2024 15:00
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