-
Notifications
You must be signed in to change notification settings - Fork 293
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
feat(tools): block ETA #3829
feat(tools): block ETA #3829
Conversation
WalkthroughWalkthroughThe changes introduce a new command-line tool called Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant RPC
participant Node
User->>CLI: Execute command with RPC endpoint and block height
CLI->>RPC: Validate inputs
RPC->>Node: Retrieve current status
Node-->>RPC: Return current block height and time
RPC-->>CLI: Provide node status
CLI->>CLI: Calculate estimated arrival time
CLI-->>User: Display estimated arrival time and details
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (1)
Additional context usedMarkdownlint
Additional comments not posted (3)
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
Documentation and Community
|
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: 2
func Run() error { | ||
if len(os.Args) < 3 { | ||
fmt.Printf("Usage: %s <node_rpc> <target_block_height>\n", os.Args[0]) | ||
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight) | ||
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight) | ||
return nil |
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.
Print error messages to os.Stderr
.
Error messages should be printed to os.Stderr
instead of os.Stdout
for better error handling.
Apply this diff to print error messages to os.Stderr
:
fmt.Printf("Usage: %s <node_rpc> <target_block_height>\n", os.Args[0])
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight)
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight)
return nil
- fmt.Printf("ERROR: %s", err.Error())
+ fmt.Fprintf(os.Stderr, "ERROR: %s", err.Error())
fmt.Printf("Usage: %s <node_rpc> <target_block_height>\n", os.Args[0]) | ||
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight) | ||
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight) | ||
return nil |
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.
Improve the usage message.
The usage message can be improved for better readability.
Apply this diff to improve the usage message:
- fmt.Printf("Usage: %s <node_rpc> <target_block_height>\n", os.Args[0])
- fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight)
- fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight)
+ fmt.Fprintf(os.Stderr, "Usage: %s <node_rpc> <target_block_height>\n", os.Args[0])
+ fmt.Fprintf(os.Stderr, "Example (Arabica): %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight)
+ fmt.Fprintf(os.Stderr, "Example (Mocha): %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
fmt.Printf("Usage: %s <node_rpc> <target_block_height>\n", os.Args[0]) | |
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight) | |
fmt.Printf("Example: %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight) | |
return nil | |
fmt.Fprintf(os.Stderr, "Usage: %s <node_rpc> <target_block_height>\n", os.Args[0]) | |
fmt.Fprintf(os.Stderr, "Example (Arabica): %s %s %v\n", os.Args[0], exampleArabicaRPC, exampleArabicaHeight) | |
fmt.Fprintf(os.Stderr, "Example (Mocha): %s %s %v\n", os.Args[0], exampleMochaRPC, exampleMochaHeight) | |
return nil |
tools/blocketa/README.md
Outdated
> [!NOTE] | ||
> The block time is currently hard-coded. If you're running this for a network with a different block time, you'll need to update the blocktime constant in the main.go 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.
You could mention the blocktime tool to estimate the cadence of block production
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
> [!NOTE] | ||
> The block time is currently hard-coded. If you're running this for a network with a different block time, you'll need to update the `blockTime` constant in the main.go file. You can use https://www.mintscan.io/celestia/block/ or the blocktime tool. |
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.
Address the bare URL issue.
The Markdownlint tool flagged the use of a bare URL. It's best practice to use descriptive text for URLs to improve readability and accessibility.
Consider updating the URL to use descriptive text. For example:
- You can use the [Mintscan Celestia Block Explorer](https://www.mintscan.io/celestia/block/) or the blocktime tool.
Tools
Markdownlint
18-18: null
Bare URL used(MD034, no-bare-urls)
I used this tool to predict the arrival time of the v2 activation height on Mocha.