diff --git a/src/pseudo_peer/cli.rs b/src/pseudo_peer/cli.rs index 7e90742c6..4411b1561 100644 --- a/src/pseudo_peer/cli.rs +++ b/src/pseudo_peer/cli.rs @@ -9,15 +9,19 @@ pub struct BlockSourceArgs { /// Example: /home/user/personal/evm-blocks /// /// For S3, you can use environment variables like AWS_PROFILE, etc. - #[arg(long)] + #[arg(long, alias = "ingest-dir")] block_source: Option, - #[arg(long)] + #[arg(long, alias = "local-ingest-dir")] block_source_from_node: Option, /// Shorthand of --block-source=s3://hl-mainnet-evm-blocks - #[arg(long = "s3", default_value_t = false)] + #[arg(long, default_value_t = false)] s3: bool, + + /// Shorthand of --block-source-from-node=~/hl/data/evm_blocks_and_receipts + #[arg(long)] + local: bool, } impl BlockSourceArgs { @@ -32,6 +36,10 @@ impl BlockSourceArgs { return Ok(BlockSourceConfig::s3_default().await); } + if self.local { + return Ok(BlockSourceConfig::local_default()); + } + let Some(value) = self.block_source.as_ref() else { return Err(eyre::eyre!( "You need to specify a block source e.g., --s3 or --block-source=/path/to/blocks" diff --git a/src/pseudo_peer/config.rs b/src/pseudo_peer/config.rs index 5635020ab..e12d3636b 100644 --- a/src/pseudo_peer/config.rs +++ b/src/pseudo_peer/config.rs @@ -35,6 +35,19 @@ impl BlockSourceConfig { Self { source_type: BlockSourceType::Local { path }, block_source_from_node: None } } + pub fn local_default() -> Self { + Self { + source_type: BlockSourceType::Local { + path: home_dir() + .expect("home dir not found") + .join("hl") + .join("data") + .join("evm_blocks_and_receipts"), + }, + block_source_from_node: None, + } + } + pub fn with_block_source_from_node(mut self, block_source_from_node: String) -> Self { self.block_source_from_node = Some(block_source_from_node); self