Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
452 changes: 277 additions & 175 deletions Cargo.lock

Large diffs are not rendered by default.

118 changes: 78 additions & 40 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,90 @@ alloy-rlp = "0.3.13"
alloy-rpc-types = "1.6.3"
alloy-rpc-types-eth = "1.6.3"
alloy-serde = "1.6.3"
alloy-signer = "1.6.3"
alloy-signer-local = "1.6.3"
alloy-sol-macro = "1.5.6"
alloy-sol-types = "1.5.6"
bytes = "1.10.1"
clap = { version = "4.5.40", features = ["derive"] }
derive_more = "2.0.1"
dirs = "6.0.0"
eyre = "0.6.12"
libc = "0.2.177"
reedline = "0.47"
sha2 = "0.10"

# rpc
jsonrpsee = "0.26.0"
jsonrpsee = { version = "0.26.0", features = ["http-client", "ws-client"] }
jsonrpsee-core = { version = "0.26.0", features = ["server"] }
jsonrpsee-proc-macros = "0.26.0"

async-trait = "0.1.88"
futures = "0.3.32"
modular-bitfield = "0.13.1"
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-codecs = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-consensus-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-db-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-engine-local = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-engine-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-ethereum-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-ethereum-engine-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-ethereum-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-ethereum-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-payload-validator = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc-convert = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc-eth-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
# RUSTSEC-2026-0097: use >=0.8.6 on the 0.8 release line.
rand = "0.8.6"
reth = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-basic-payload-builder = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-chainspec = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-cli = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-cli-commands = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-cli-runner = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-cli-util = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-codecs = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-consensus-common = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-db = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-db-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-engine-local = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-engine-primitives = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-errors = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-eth-wire-types = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-ethereum-cli = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-ethereum-engine-primitives = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-ethereum-payload-builder = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-ethereum-primitives = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-evm = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-evm-ethereum = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-metrics = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-network = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-network-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-network-peers = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-network-types = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-node-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-node-builder = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-node-core = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-node-ethereum = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-payload-primitives = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-payload-validator = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-primitives-traits = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-convert = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-engine-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-eth-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-eth-types = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-server-types = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-storage-api = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-transaction-pool = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
rusqlite = { version = "0.32", features = ["bundled"] }
serde = { version = "1.0", features = ["derive"], default-features = false }
serde_json = "1.0"
thiserror = "2.0"
tokio = "1.46.0"
tokio = { version = "1.46.0", features = ["macros", "rt-multi-thread", "net", "io-util"] }
tracing = "0.1.41"
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry"] }

[dev-dependencies]
alloy-provider = "1.6.3"
alloy-rpc-client = "1.6.3"
alloy-rpc-types-trace = "1.6.3"
eyre = "0.6.12"
reth-e2e-test-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-rpc-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.11.3" }
jsonrpsee = { version = "0.26.0", features = ["server"] }
reth-e2e-test-utils = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-rpc-builder = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
reth-trie-common = { git = "https://github.com/camembera/reth", branch = "pog/provenance-callback" }
revm-inspectors = "0.34.2"
serde_json = "1.0"
tempfile = "3"
test-fuzz = "7"

[build-dependencies]
Expand Down Expand Up @@ -110,7 +129,26 @@ opt-level = 3
lto = "thin"

[package.metadata.cargo-machete]
ignored = ["modular-bitfield"]
# cargo-machete misses macro/build.rs/test-only uses; keep explicit allowlist in sync when deps change.
ignored = [
"alloy-provider",
"alloy-rpc-client",
"alloy-signer",
"futures",
"modular-bitfield",
"rand",
"reth-eth-wire-types",
"reth-metrics",
"reth-network",
"reth-network-api",
"reth-network-types",
"reth-rpc-builder",
"rusqlite",
"test-fuzz",
"tracing-subscriber",
"vergen",
"vergen-git2",
]

# [patch."https://github.com/paradigmxyz/reth"]
# reth = { path = "../reth/bin/reth" }
Expand Down
58 changes: 58 additions & 0 deletions src/berachain_cli.rs
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"),
}
}
}
61 changes: 61 additions & 0 deletions src/console/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
use clap::Args;
use reth_cli_runner::CliRunner;

/// JSON-RPC console (IPC, HTTP, or WebSocket).
#[derive(Debug, Clone, Args)]
pub struct ConsoleCommand {
/// IPC path, or `http(s)://…`, or `ws(s)://…`. 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);
}
}
Loading