-
Notifications
You must be signed in to change notification settings - Fork 21
feat: bera-reth console #244
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
Open
camembera
wants to merge
22
commits into
main
Choose a base branch
from
feat/reth-console
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f2371e3
feat(cli): add console subcommand for operator RPC access
camembera 894d6aa
chore: remove http_headers dead code from console
camembera a71e401
fix: address PR review findings
camembera 03ba0b6
fix: tighten wei heuristic, add IPC timeout, harden completions
camembera d2587f6
fix(console): detect endpoint transport case-insensitively
camembera d2d0a5e
test(console): cover IPC paths without URL schemes
camembera eeeb239
fix(console): parse .map() selector with balanced parentheses
camembera 8c6a901
fix(console): clarify rpc_modules JSON parse failures
camembera 8559746
fix(console): show empty state for detailed peers table
camembera 2d1bcfb
refactor(console): remove named alias table and shortcuts
camembera 732a4e5
feat(console): restore removeAllPeers batch admin.removePeer flow
camembera 9b1363e
docs(console): mention removeAllPeers in --exec help
camembera 3607147
fix(console): Unicode-safe peer/reason truncation in output formatting
camembera 3af49a4
refactor(console): replace rustyline with reedline
camembera 7681683
chore(ci): fmt, dprint, rustdoc, and machete allowlist
camembera 08609bf
fix(deps): bump rand for RUSTSEC-2026-0097
camembera 6c4c5ba
Merge branch 'main' into feat/reth-console
camembera 54e4656
fix(console): align beraAdmin startup snapshot with node status JSON
camembera dd05c97
fix(console): ignore null JSON-RPC error field on IPC responses
camembera 24934db
fix(console): use beradmin_* JSON-RPC namespace
camembera d6e0b98
refactor(console): remove HTTP and WebSocket transport support
camembera ddc11ab
cargo fmt
camembera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| //! Berachain-specific CLI subcommands (extension to reth Ethereum CLI). | ||
|
|
||
| use clap::Subcommand; | ||
| use reth_cli_runner::CliRunner; | ||
| use reth_ethereum_cli::app::ExtendedCommand; | ||
|
|
||
| #[derive(Debug, Subcommand)] | ||
| pub enum BerachainSubcommands { | ||
| /// JSON-RPC console over IPC, HTTP, or WebSocket. | ||
| Console(crate::console::ConsoleCommand), | ||
| } | ||
|
|
||
| impl ExtendedCommand for BerachainSubcommands { | ||
| fn execute(self, runner: CliRunner) -> eyre::Result<()> { | ||
| match self { | ||
| Self::Console(cmd) => cmd.run(runner), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use crate::chainspec::BerachainChainSpecParser; | ||
| use clap::Parser; | ||
| use reth_cli_commands::node::NoArgs; | ||
| use reth_ethereum_cli::interface::{Cli, Commands}; | ||
| use reth_rpc_server_types::DefaultRpcModuleValidator; | ||
|
|
||
| #[test] | ||
| fn parses_console_subcommand() { | ||
| let err = Cli::< | ||
| BerachainChainSpecParser, | ||
| NoArgs, | ||
| DefaultRpcModuleValidator, | ||
| BerachainSubcommands, | ||
| >::try_parse_from(["bera-reth", "console", "--help"]) | ||
| .unwrap_err(); | ||
| assert_eq!(err.kind(), clap::error::ErrorKind::DisplayHelp); | ||
| } | ||
|
|
||
| #[test] | ||
| fn ext_console_variant_reachable() { | ||
| let cli = Cli::< | ||
| BerachainChainSpecParser, | ||
| NoArgs, | ||
| DefaultRpcModuleValidator, | ||
| BerachainSubcommands, | ||
| >::try_parse_from(["bera-reth", "console", "--exec", "eth_blockNumber"]) | ||
| .unwrap(); | ||
| match cli.command { | ||
| Commands::Ext(BerachainSubcommands::Console(ref c)) => { | ||
| assert_eq!(c.exec.as_deref(), Some("eth_blockNumber")); | ||
| } | ||
| _ => panic!("expected console ext"), | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| use clap::Args; | ||
| use reth_cli_runner::CliRunner; | ||
|
|
||
| /// JSON-RPC console over IPC. | ||
| #[derive(Debug, Clone, Args)] | ||
| pub struct ConsoleCommand { | ||
| /// IPC path. If omitted, uses the platform default datadir with `reth.ipc`. | ||
| #[arg(value_name = "ENDPOINT")] | ||
| pub endpoint: Option<String>, | ||
|
|
||
| /// Run a single command and print raw JSON (implies raw output; no prompts). | ||
| #[arg(long = "exec")] | ||
| pub exec: Option<String>, | ||
|
|
||
| /// In REPL mode, print raw JSON instead of tables and annotations. | ||
| #[arg(long)] | ||
| pub raw: bool, | ||
| } | ||
|
|
||
| impl ConsoleCommand { | ||
| pub fn run(self, runner: CliRunner) -> eyre::Result<()> { | ||
| runner.block_on(super::run::run_console(self)) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use clap::Parser; | ||
|
|
||
| #[derive(clap::Parser)] | ||
| #[command(name = "bera-reth")] | ||
| struct Top { | ||
| #[command(subcommand)] | ||
| sub: Sub, | ||
| } | ||
|
|
||
| #[derive(clap::Subcommand)] | ||
| enum Sub { | ||
| Console(ConsoleCommand), | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_exec_and_raw() { | ||
| let Top { sub: Sub::Console(c) } = | ||
| Top::try_parse_from(["bera-reth", "console", "--exec", "eth.blockNumber", "--raw"]) | ||
| .unwrap(); | ||
| assert_eq!(c.exec.as_deref(), Some("eth.blockNumber")); | ||
| assert!(c.raw); | ||
| assert!(c.endpoint.is_none()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_positional_endpoint() { | ||
| let Top { sub: Sub::Console(c) } = | ||
| Top::try_parse_from(["bera-reth", "console", "/tmp/reth.ipc"]).unwrap(); | ||
| assert_eq!(c.endpoint.as_deref(), Some("/tmp/reth.ipc")); | ||
| assert!(!c.raw); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: berachain/bera-reth
Length of output: 4764
🏁 Script executed:
Repository: berachain/bera-reth
Length of output: 125
🏁 Script executed:
Repository: berachain/bera-reth
Length of output: 5275
🏁 Script executed:
Repository: berachain/bera-reth
Length of output: 1818
🏁 Script executed:
Repository: berachain/bera-reth
Length of output: 104
Pin
reth-*git dependencies to explicit revisionsAll 41
reth-*crates (lines 41–81, 96–98) use the mutable branchpog/provenance-callback. Although Cargo.lock resolves all to commitab0c215ee7276dab1f9cc944258b530a7cef466a, this approach reduces reproducibility if the lock file is refreshed or regenerated. Replace the branch reference with an explicitrevpin to make dependency resolution immutable and improve supply-chain control.Proposed manifest direction
Apply the same revision across all
reth-*entries.📝 Committable suggestion
🤖 Prompt for AI Agents