Skip to content

Commit 316e6c7

Browse files
authored
make DumpWitnessCommand properly accessible programmatically (#80)
1 parent 6812150 commit 316e6c7

File tree

7 files changed

+26
-19
lines changed

7 files changed

+26
-19
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ rustc-hash = "2.1"
7676
thiserror = "1.0"
7777
tiny-keccak = "2.0"
7878
tower = "0.5"
79-
url = "2.5"
79+
url = ">=2.5.3"
8080

8181
# binary dependencies
8282
anyhow = "1.0"
@@ -109,6 +109,7 @@ sbv-kv = { path = "crates/kv" }
109109
sbv-primitives = { path = "crates/primitives" }
110110
sbv-trie = { path = "crates/trie" }
111111
sbv-helpers = { path = "crates/helpers" }
112+
sbv-utils = { path = "crates/utils" }
112113

113114
[workspace.dependencies.revm]
114115
git = "https://github.com/scroll-tech/revm"

crates/utils/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ url.workspace = true
2828
sbv.workspace = true
2929

3030
[features]
31-
scroll = []
31+
scroll = ["sbv/scroll"]

crates/utils/src/commands/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use clap::Subcommand;
22

3-
mod witness;
3+
pub mod witness;
44

5-
#[derive(Subcommand)]
5+
#[derive(Debug, Subcommand)]
66
pub enum Commands {
77
#[command(subcommand, about = "Witness commands")]
88
Witness(witness::WitnessCommands),

crates/utils/src/commands/witness/dump.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,52 @@ use sbv::primitives::{
1919
use std::{path::PathBuf, time::Instant};
2020
use url::Url;
2121

22-
#[derive(Args)]
22+
#[derive(Debug, Args)]
2323
pub struct DumpWitnessCommand {
2424
#[arg(
2525
long,
2626
help = "URL to the RPC server",
2727
default_value = "http://localhost:8545"
2828
)]
29-
rpc: Url,
29+
pub rpc: Url,
3030
#[arg(long, help = "Block number")]
31-
block: u64,
31+
pub block: u64,
3232
#[arg(long, help = "Ancestor blocks", default_value_t = 256)]
33-
ancestors: u64,
33+
pub ancestors: u64,
3434
#[arg(long, help = "Output directory", default_value_os_t = std::env::current_dir().unwrap())]
35-
out_dir: PathBuf,
35+
pub out_dir: PathBuf,
3636
#[arg(long, help = "Output json")]
37-
json: bool,
37+
pub json: bool,
3838
#[arg(long, help = "Output rkyv")]
39-
rkyv: bool,
39+
pub rkyv: bool,
4040

4141
// Concurrency Limit
4242
#[arg(
4343
long,
4444
help = "Concurrency Limit: maximum number of concurrent requests",
4545
default_value = "10"
4646
)]
47-
max_concurrency: usize,
47+
pub max_concurrency: usize,
4848

4949
// Retry parameters
5050
#[arg(
5151
long,
5252
help = "Retry Backoff: maximum number of retries",
5353
default_value = "10"
5454
)]
55-
max_retry: u32,
55+
pub max_retry: u32,
5656
#[arg(
5757
long,
5858
help = "Retry Backoff: backoff duration in milliseconds",
5959
default_value = "100"
6060
)]
61-
backoff: u64,
61+
pub backoff: u64,
6262
#[arg(
6363
long,
6464
help = "Retry Backoff: compute units per second",
6565
default_value = "100"
6666
)]
67-
cups: u64,
67+
pub cups: u64,
6868
}
6969

7070
impl DumpWitnessCommand {

crates/utils/src/commands/witness/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use clap::Subcommand;
22

3-
mod dump;
4-
mod rkyv_convert;
3+
pub mod dump;
4+
pub mod rkyv_convert;
55

6-
#[derive(Subcommand)]
6+
#[derive(Debug, Subcommand)]
77
pub enum WitnessCommands {
88
#[command(about = "Dump a witness from reth RPC")]
99
Dump(dump::DumpWitnessCommand),

crates/utils/src/commands/witness/rkyv_convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rkyv::{rancor, vec::ArchivedVec};
33
use sbv::primitives::types::{ArchivedBlockWitness, BlockWitness};
44
use std::path::PathBuf;
55

6-
#[derive(Args)]
6+
#[derive(Debug, Args)]
77
pub struct RkyvConvertCommand {
88
/// Path to the witness json file
99
witnesses: Vec<PathBuf>,

crates/utils/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! This crate allows programmatical access to CLI commands
2+
3+
#[doc(hidden)]
4+
pub mod commands;
5+
#[doc(hidden)]
6+
pub mod helpers;

0 commit comments

Comments
 (0)