Skip to content

Commit 9c2d9ef

Browse files
Merge pull request #47 from Blobscan/banner
feat: show banner
2 parents cf22754 + a47d608 commit 9c2d9ef

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ The indexer supports the following command-line arguments for configuring the in
9090

9191
- `-f, --from-slot <FROM_SLOT>`: It allows you to specify the starting slot for indexing ignoring the default behavior, which is starting from the latest slot stored in the database.
9292

93-
- `-n, --num-threads <NUM_THREADS>`: It allows you to specify the number of threads that will be utilized to parallelize the indexing process. If the argument is not provided, the number of cores of the machine will be used.
94-
- `-s, --slots-per-save <SLOTS_PER_SAVE>`: It allows you to specify the number of slots to be processed before saving the latest slot in the database.
93+
- `-n, --num-threads <NUM_THREADS>`: It allows you to specify the number of threads that will be utilized to parallelize the indexing process. Default: the number of CPU cores.
94+
- `-s, --slots-per-save <SLOTS_PER_SAVE>`: It allows you to specify the number of slots to be processed before saving the latest slot in the database. Default: 1000
9595

9696
### Example usage
9797

src/args.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ pub struct Args {
1313
pub num_threads: Option<u32>,
1414

1515
/// Amount of slots to be processed before saving latest slot in the database
16-
#[arg(short, long)]
17-
pub slots_per_save: Option<u32>,
16+
#[arg(short, long, default_value_t = 1000)]
17+
pub slots_per_save: u32,
1818
}

src/indexer.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,38 @@ use crate::{
1717
utils::exp_backoff::get_exp_backoff_config,
1818
};
1919

20+
pub fn print_banner(args: &Args, env: &Environment) {
21+
let num_threads = args.num_threads.unwrap_or_default();
22+
let sentry_dsn = env.sentry_dsn.clone();
23+
println!("____ _ _ ");
24+
println!("| __ )| | ___ | |__ ___ ___ __ _ _ __ ");
25+
println!("| _ \\| |/ _ \\| '_ \\/ __|/ __/ _` | '_ \\ ");
26+
println!("| |_) | | (_) | |_) \\__ \\ (_| (_| | | | |");
27+
println!("|____/|_|\\___/|_.__/|___/\\___\\__,_|_| |_|\n");
28+
println!("Blobscan indexer (EIP-4844 blob indexer) - blobscan.com");
29+
println!("=======================================================");
30+
if num_threads == 0 {
31+
println!("Number of threads: auto");
32+
} else {
33+
println!("Number of threads: {}", num_threads);
34+
}
35+
println!("Slot chunk size: {}", args.slots_per_save);
36+
println!("Blobscan API endpoint: {}", env.blobscan_api_endpoint);
37+
println!("CL endpoint: {}", env.beacon_node_endpoint);
38+
println!("EL endpoint: {}", env.execution_node_endpoint);
39+
println!("Sentry DSN: {}", sentry_dsn.unwrap_or_default());
40+
println!("\n");
41+
}
42+
2043
pub async fn run(env: Environment) -> Result<()> {
2144
let args = Args::parse();
2245

23-
let max_slot_per_save = args.slots_per_save.unwrap_or(1000);
2446
let slots_processor_config = args
2547
.num_threads
2648
.map(|threads_length| SlotsProcessorConfig { threads_length });
49+
50+
print_banner(&args, &env);
51+
2752
let context = match Context::try_new(ContextConfig::from(env)) {
2853
Ok(c) => c,
2954
Err(error) => {
@@ -100,7 +125,7 @@ pub async fn run(env: Environment) -> Result<()> {
100125
);
101126

102127
while unprocessed_slots > 0 {
103-
let slots_chunk = min(unprocessed_slots, max_slot_per_save);
128+
let slots_chunk = min(unprocessed_slots, args.slots_per_save);
104129
let chunk_initial_slot = current_slot;
105130
let chunk_final_slot = current_slot + slots_chunk;
106131

0 commit comments

Comments
 (0)