Skip to content

Conversation

@MSevey
Copy link
Contributor

@MSevey MSevey commented Jun 27, 2024

Overview

Related to #1736

CI wasn't catching errors when the node can't start but also can't stop.

Note: this is uncovering a bug on main so the CI is expected to now be failing until the fix is corrected.

rollkit % rollkit start --ci
Error intercepting command:  Reading rollkit.toml: no rollkit.toml found
I[2024-06-27|11:27:00.328] Found private validator                      module=main keyFile=/Users/matt/.rollkit/config/priv_validator_key.json stateFile=/Users/matt/.rollkit/data/priv_validator_state.json
I[2024-06-27|11:27:00.328] Found node key                               module=main path=/Users/matt/.rollkit/config/node_key.json
I[2024-06-27|11:27:00.328] Found genesis file                           module=main path=/Users/matt/.rollkit/config/genesis.json
I[2024-06-27|11:27:00.331] service start                                module=proxy msg="Starting multiAppConn service" impl=multiAppConn
I[2024-06-27|11:27:00.331] service start                                module=abci-client connection=query msg="Starting localClient service" impl=localClient
I[2024-06-27|11:27:00.332] service start                                module=abci-client connection=snapshot msg="Starting localClient service" impl=localClient
I[2024-06-27|11:27:00.332] service start                                module=abci-client connection=mempool msg="Starting localClient service" impl=localClient
I[2024-06-27|11:27:00.332] service start                                module=abci-client connection=consensus msg="Starting localClient service" impl=localClient
I[2024-06-27|11:27:00.332] service start                                module=events msg="Starting EventBus service" impl=EventBus
I[2024-06-27|11:27:00.332] service start                                module=pubsub msg="Starting PubSub service" impl=PubSub
I[2024-06-27|11:27:00.370] Using default mempool ttl                    module=BlockManager MempoolTTL=25
I[2024-06-27|11:27:00.373] service start                                module=txindex msg="Starting IndexerService service" impl=IndexerService
I[2024-06-27|11:27:00.373] service start                                module=main msg="Starting RPC service" impl=RPC
I[2024-06-27|11:27:00.373] service start                                module=main msg="Starting Node service" impl=Node
I[2024-06-27|11:27:00.373] starting P2P client                          module=main
I[2024-06-27|11:27:00.373] serving HTTP                                 module=main listenaddress=127.0.0.1:26657
I[2024-06-27|11:27:00.381] listening on                                 module=p2p address=/ip4/127.0.0.1/tcp/26656/p2p/12D3KooWA5tb8TCm9i2rBxEE7gwKRxWi5afrAXLKCsca12V8d3Y4
I[2024-06-27|11:27:00.381] listening on                                 module=p2p address=/ip4/192.168.1.160/tcp/26656/p2p/12D3KooWA5tb8TCm9i2rBxEE7gwKRxWi5afrAXLKCsca12V8d3Y4
I[2024-06-27|11:27:00.381] no seed nodes - only listening for connections module=p2p
E[2024-06-27|11:27:00.382] failed to parse peer                         module=HeaderSyncService address= error="failed to parse multiaddr \"\": empty multiaddr"
E[2024-06-27|11:27:00.382] failed to parse peer                         module=BlockSyncService address= error="failed to parse multiaddr \"\": empty multiaddr"
I[2024-06-27|11:27:00.383] Started node                                 module=main
ERROR: node hasn't produced any blocks

Summary by CodeRabbit

  • Bug Fixes
    • Added a check to ensure nodes have produced blocks before stopping, to prevent errors during the shutdown process.

@MSevey MSevey added T:bug Something isn't working C:ci Component: Continuous Integration labels Jun 27, 2024
@MSevey MSevey self-assigned this Jun 27, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Walkthrough

In the cmd/rollkit/commands/run_node.go file, a new check was introduced within the NewRunNodeCmd function. This update ensures that before stopping a node, the system verifies if the node has produced any blocks. If no blocks have been produced, the function will return an error to prevent premature termination of the node.

Changes

Files Change Summary
cmd/rollkit/commands/run_node.go Added a check in NewRunNodeCmd to ensure the node has produced blocks before it can be stopped.

Poem

In code where nodes dance and play,
A blockless stop brings disarray,
But now a check leads the way,
Ensuring blocks have had their say,
Before the node can end its sway.
🎈✨ Happy coding every day! 🚀🐇


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 Configration 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.

@RollkitBot RollkitBot requested review from a team, Manav-Aggarwal, gupadhyaya and tzdybal and removed request for a team June 27, 2024 15:34
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: 2

Outside diff range and nitpick comments (2)
cmd/rollkit/commands/run_node.go (2)

Line range hint 257-265: Enhance error messaging for better debugging support.

When starting the mock server fails, the error message could provide more context to help with troubleshooting.

- return nil, err
+ return nil, fmt.Errorf("failed to start mock JSONRPC server: %w", err)

Line range hint 269-314: Standardize error handling and improve logging.

Error handling in file operations should be consistent. Also, consider enhancing the logging for better traceability of operations.

- return err
+ return fmt.Errorf("error generating node key: %w", err)
...
- return err
+ return fmt.Errorf("error saving genesis file: %w", err)
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between afa8680 and 73fdac2.

Files selected for processing (1)
  • cmd/rollkit/commands/run_node.go (1 hunks)
Additional comments not posted (1)
cmd/rollkit/commands/run_node.go (1)

Line range hint 243-254: Command-line flags setup appears robust.

The method for adding node flags is appropriately structured and uses the established libraries and patterns for CLI applications in Go. Good job maintaining consistency with the existing codebase.

Manav-Aggarwal
Manav-Aggarwal previously approved these changes Jun 27, 2024
Copy link
Contributor

@tuxcanfly tuxcanfly left a comment

Choose a reason for hiding this comment

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

OK.

Co-authored-by: Javed Khan <[email protected]>
Manav-Aggarwal
Manav-Aggarwal previously approved these changes Jun 27, 2024
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 73fdac2 and 14c2924.

Files selected for processing (1)
  • cmd/rollkit/commands/run_node.go (1 hunks)
Additional context used
golangci-lint
cmd/rollkit/commands/run_node.go

186-186: File is not goimports-ed with -local github.com/rollkit

(goimports)

Additional comments not posted (1)
cmd/rollkit/commands/run_node.go (1)

182-188: Refactor error handling to improve clarity and maintainability.

The changes made to improve error checking in the CI process are crucial for ensuring the node's reliability. However, the order of checks and the clarity of error messages can be further improved. Specifically, checking if the node is running should come before checking the block height to avoid unnecessary operations if the node isn't running. Additionally, the error message can be more descriptive to aid in troubleshooting.

[REFACTOR_SUGGESTion]

- if res.Block.Height  == 0 {
-     return fmt.Errorf("node hasn't produced any blocks")
- }
- if !rollnode.IsRunning() {
+ if !rollnode.IsRunning() {
+     return fmt.Errorf("node is not running")
+ }
+ if res.Block.Height == 0 {
      return fmt.Errorf("node hasn't produced any blocks, ensure your configuration is correct and the network is operational")
  }
Tools
golangci-lint

186-186: File is not goimports-ed with -local github.com/rollkit

(goimports)

@MSevey MSevey enabled auto-merge June 27, 2024 21:22
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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 14c2924 and 0fed2e5.

Files selected for processing (1)
  • cmd/rollkit/commands/run_node.go (1 hunks)
Additional context used
golangci-lint
cmd/rollkit/commands/run_node.go

191-191: File is not goimports-ed with -local github.com/rollkit

(goimports)

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0fed2e5 and 25fefd5.

Files selected for processing (1)
  • cmd/rollkit/commands/run_node.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • cmd/rollkit/commands/run_node.go

Copy link
Contributor

@tuxcanfly tuxcanfly left a comment

Choose a reason for hiding this comment

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

OK.

@tuxcanfly tuxcanfly requested a review from Manav-Aggarwal June 27, 2024 21:53
@MSevey MSevey added this pull request to the merge queue Jun 27, 2024
Merged via the queue into main with commit 8ab5e71 Jun 27, 2024
@MSevey MSevey deleted the sevey/cli-ci-fix branch June 27, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:ci Component: Continuous Integration T:bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants