Skip to content

Commit

Permalink
Merge pull request #136 from HerodotusDev/more-chain
Browse files Browse the repository at this point in the history
clippy
  • Loading branch information
rkdud007 authored Sep 3, 2024
2 parents 16ad7d5 + 17d8c5e commit dff284c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 883 deletions.
40 changes: 0 additions & 40 deletions batch.json

This file was deleted.

31 changes: 6 additions & 25 deletions cli/src/interactive.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy::{primitives::U256, transports::http::reqwest::Url};
use alloy::primitives::U256;
use anyhow::bail;
use hdp::hdp_run;
use hdp::preprocessor::module_registry::ModuleRegistry;
Expand Down Expand Up @@ -63,7 +63,7 @@ pub async fn run_interactive() -> anyhow::Result<()> {
// 0. Chain ID
let chain_id: String = inquire::Text::new("Chain ID")
.with_help_message("What is the chain ID? (Enter to set default)")
.with_default("ETH_SEPOLIA")
.with_default("ETHEREUM_SEPOLIA")
.prompt()?;
// 1. Block range start
let block_range_start: u64 = inquire::Text::new("Block range start")
Expand Down Expand Up @@ -150,7 +150,7 @@ pub async fn run_interactive() -> anyhow::Result<()> {
// 0. Chain ID
let chain_id: String = inquire::Text::new("Chain ID")
.with_help_message("What is the chain ID? (Enter to set default)")
.with_default("ETH_SEPOLIA")
.with_default("ETHEREUM_SEPOLIA")
.prompt()?;
let target_block: u64 = inquire::Text::new("Enter target block number")
.with_help_message(
Expand Down Expand Up @@ -316,29 +316,10 @@ pub async fn run_interactive() -> anyhow::Result<()> {
.with_default(true)
.prompt()?;
if allow_run {
let rpc_url: Option<Url> = match inquire::Text::new("Enter RPC URL: ")
.with_help_message("Skip if you have it in your .env file")
.prompt()
{
Ok(url) => match url.as_str() {
"" => None,
_ => Some(url.parse()?),
},
Err(_) => None,
};
let chain_id: Option<ChainId> = match inquire::Text::new("Enter Chain ID: ")
.with_help_message("Skip if you have it in your .env file")
.prompt()
{
Ok(chain_id) => match chain_id.as_str() {
"" => None,
_ => Some(chain_id.parse()?),
},
Err(_) => None,
};
println!("Make sure to position correct rpc url related env variables.");

let output_file: PathBuf = inquire::Text::new("Enter Output file path: ")
.with_default("output.json")
let output_file: PathBuf = inquire::Text::new("Enter Batch proof file path: ")
.with_default("batch.json")
.prompt()?
.into();
let cairo_input: PathBuf = inquire::Text::new("Enter Cairo input file path:")
Expand Down
6 changes: 3 additions & 3 deletions hdp/src/hdp_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl HdpRunConfig {

// Iterate through environment variables to find RPC_URL and RPC_CHUNK_SIZE configurations
for (key, value) in env::vars() {
if key.starts_with("RPC_URL_") {
let chain_id: ChainId = key[8..]
if let Some(stripped_chain_id) = key.strip_prefix("RPC_URL_") {
let chain_id: ChainId = stripped_chain_id
.parse()
.expect("Invalid chain ID in RPC_URL env var");
let rpc_url: Url = value.parse().expect("Invalid URL in RPC_URL env var");
Expand All @@ -65,7 +65,7 @@ impl HdpRunConfig {
let rpc_chunk_size: u64 = env::var(&chunk_size_key)
.unwrap_or_else(|_| "40".to_string())
.parse()
.expect(&format!("{} must be a number", chunk_size_key));
.unwrap_or_else(|_| panic!("{} must be a number", chunk_size_key));

provider_config.insert(
chain_id,
Expand Down
Loading

0 comments on commit dff284c

Please sign in to comment.