-
Notifications
You must be signed in to change notification settings - Fork 23
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: minimal rpc client #160
Conversation
WalkthroughThe changes primarily focus on renaming and consolidating Rust packages within the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant RPC
participant BeaconAPI
User->>CLI: Start CLI with options
CLI->>RPC: Connect using RPC URL
alt Use Registry
CLI->>BeaconAPI: Fetch current slot
BeaconAPI-->>CLI: Return current slot
CLI->>RPC: Fetch lookahead data
else No Registry
CLI->>RPC: Get transaction details
end
CLI->>RPC: Submit transaction
RPC-->>CLI: Transaction response
CLI-->>User: Display result
Assessment against linked issues
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Are we using this as a replacement for the spammer packages? |
9cb292f
to
6b75112
Compare
@mempirate yes, see #163 |
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
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files ignored due to path filters (2)
bolt-client/Cargo.lock
is excluded by!**/*.lock
bolt-kurtosis-client/Cargo.lock
is excluded by!**/*.lock
Files selected for processing (6)
- bolt-client/.gitignore (1 hunks)
- bolt-client/Cargo.toml (1 hunks)
- bolt-client/README.md (1 hunks)
- bolt-client/src/main.rs (1 hunks)
- bolt-client/src/registry.rs (2 hunks)
- bolt-client/src/utils.rs (3 hunks)
Additional context used
LanguageTool
bolt-client/README.md
[uncategorized] ~21-~21: Loose punctuation mark.
Context: ...g on the RPC server: ---use-registry
: bool flag to fetch data from a local no...(UNLIKELY_OPENING_PUNCTUATION)
Additional comments not posted (14)
bolt-client/Cargo.toml (2)
2-2
: LGTM! The package renaming aligns with the PR objectives.The renaming of the package from
bolt-spammer-helder
tobolt-rpc-client
aligns with the consolidation and rebranding objectives outlined in the PR summary.
10-24
: LGTM! Dependency reorganization improves readability.The reorganization of dependencies enhances readability and maintainability of the
Cargo.toml
file.bolt-client/README.md (1)
1-29
: LGTM! The documentation is clear and informative.The
README.md
file provides a comprehensive overview of the Bolt CLI client, including requirements, usage instructions, and environment variables. This will help users get started quickly.Tools
LanguageTool
[uncategorized] ~21-~21: Loose punctuation mark.
Context: ...g on the RPC server: ---use-registry
: bool flag to fetch data from a local no...(UNLIKELY_OPENING_PUNCTUATION)
bolt-client/src/utils.rs (6)
13-13
: LGTM!The constant
NOICE_GAS_PRICE
is correctly declared as public.
14-14
: LGTM!The constant
DEAD_ADDRESS
is correctly declared as public.
16-22
: LGTM!The function
generate_random_tx
correctly generates a random Ethereum transaction.
Line range hint
25-36
:
LGTM!The function
generate_random_blob_tx
correctly generates a random blob transaction.
50-52
: LGTM!The function
get_current_slot
correctly returns the current slot from the beacon client.
54-65
: LGTM!The function
get_proposer_duties
correctly retrieves and filters proposer duties from the beacon API.bolt-client/src/main.rs (3)
1-13
: LGTM!The imports are correctly declared and necessary for the functionality of the
bolt-client
.
21-50
: LGTM!The
Opts
struct correctly defines the command-line options for thebolt-client
.
52-120
: LGTM!The
main
function correctly initializes thebolt-client
, parses command-line options, and sends transactions.bolt-client/src/registry.rs (2)
30-30
: LGTM!The attribute
#[allow(unused)]
correctly suppresses warnings related to unused code within the function.
163-163
: LGTM!The import statement for
ProposerDuty
is correctly added to the test module.
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.
Great job! Just some clap
nerdsnipes and minor things
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: 4
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (1)
- bolt-client/src/main.rs (1 hunks)
Additional comments not posted (2)
bolt-client/src/main.rs (2)
15-19
: Ensure modules are defined and used.Verify that the
registry
andutils
modules are defined and used appropriately in the code.Verification successful
Modules are defined and used appropriately.
The
registry
andutils
modules are both defined and used in the codebase as expected.
BoltRegistry
is defined inbolt-client/src/registry.rs
and used inbolt-client/src/main.rs
.- Items from
utils
are used inbolt-client/src/main.rs
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `registry` and `utils` modules are defined and used. # Test: Check for module definitions. Expect: Modules are defined. fd -t f | grep -E 'registry|utils'Length of output: 1534
Script:
#!/bin/bash # Description: Verify that `BoltRegistry` and items from `utils` are used in the codebase. # Check for usage of `BoltRegistry`. rg 'BoltRegistry' -A 5 # Check for usage of items from `utils`. rg 'utils::' -A 5Length of output: 18441
1-13
: Ensure all imported modules are used.Verify that all imported modules are utilized in the code to avoid unnecessary dependencies.
Verification successful
All imported modules are used.
All the imported modules in the provided snippet are utilized in the codebase, and there are no unnecessary dependencies.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all imported modules are used in the code. # Test: Check for unused imports. Expect: No unused imports. rg --type rust -A 5 $'use ' | awk '{print $2}' | sort | uniq -cLength of output: 10496
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: 4
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (1)
- bolt-client/src/main.rs (1 hunks)
Additional comments not posted (6)
bolt-client/src/main.rs (6)
1-8
: Imports look good!The necessary imports for the RPC client functionality are included.
15-19
: Module declarations look good!The necessary modules for registry and utilities are correctly declared.
21-50
: Command-line options look good!The
Opts
struct includes all necessary command-line options with appropriate annotations.
52-58
: Initialize dotenv before tracing.Initialize dotenv before tracing to ensure environment variables are loaded correctly.
- tracing_subscriber::fmt::init(); - info!("starting bolt-client"); - - let _ = dotenvy::dotenv(); + let _ = dotenvy::dotenv(); + tracing_subscriber::fmt::init(); + info!("starting bolt-client");
65-86
: Ensure error handling forreqwest::get
response.Add error handling for the
reqwest::get
response to avoid potential panics.- let lookahead_response = reqwest::get(url).await?.json::<serde_json::Value>().await?; - let next_preconfer_slot = lookahead_response[0].get("slot").unwrap().as_u64().unwrap(); + let lookahead_response = reqwest::get(url).await?.json::<serde_json::Value>().await?; + let next_preconfer_slot = lookahead_response.get(0) + .and_then(|v| v.get("slot")) + .and_then(|v| v.as_u64()) + .ok_or_else(|| eyre::eyre!("Failed to parse slot from lookahead response"))?;
88-91
: Optimize transaction generation and signing.Consider optimizing the transaction generation and signing process for better performance.
- let mut tx = if opts.blob { generate_random_blob_tx() } else { generate_random_tx() }; + let mut tx = match opts.blob { + true => generate_random_blob_tx(), + false => generate_random_tx(), + };
@@ -1,21 +1,24 @@ | |||
[package] | |||
name = "bolt-spammer-helder" | |||
name = "bolt-rpc-client" | |||
version = "0.1.0" |
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.
This actually counts for the sidecar as well, but on the next release we should bump these versions!
Co-authored-by: Lorenzo <[email protected]>
c742291
to
e912f34
Compare
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.
LGTM, some minor spec deviations
spammer
packages in a single one #163Summary by CodeRabbit
Summary by CodeRabbit
New Features
README.md
file detailing setup instructions, environment variables, and usage examples for the new CLI tool.Changes
bolt-spammer-helder
tobolt-rpc-client
to reflect its new focus on RPC functionalities..env
file from the ignore list to allow tracking of environment variables in version control.Bug Fixes