From b8a7e4a54c62093908d97fc10f612e1a73ba78c0 Mon Sep 17 00:00:00 2001 From: Heemank Verma Date: Fri, 8 Nov 2024 16:24:18 +0530 Subject: [PATCH] update: fixed db issue --- .env.test | 5 ++--- crates/orchestrator/src/tests/config.rs | 4 ++-- crates/orchestrator/src/workers/snos.rs | 10 ++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.env.test b/.env.test index a8da70c1..a4ad346a 100644 --- a/.env.test +++ b/.env.test @@ -27,8 +27,7 @@ MADARA_ORCHESTRATOR_ETHEREUM_DA_RPC_URL=https://eth-sepolia.public.blastapi.io ## MONGODB ## MADARA_ORCHESTRATOR_MONGODB_CONNECTION_URL=mongodb://localhost:27017 -MADARA_ORCHESTRATOR_DATABASE_NAME=madara-orchestrator-test - +MADARA_ORCHESTRATOR_DATABASE_NAME=orchestrator #### PROVER #### @@ -57,7 +56,7 @@ MADARA_ORCHESTRATOR_SQS_BASE_QUEUE_URL=http://sqs.us-east-1.localhost.localstack ## ETHEREUM ## -# MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL= +MADARA_ORCHESTRATOR_ETHEREUM_SETTLEMENT_RPC_URL=https://eth-sepolia.public.blastapi.io MADARA_ORCHESTRATOR_ETHEREUM_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 MADARA_ORCHESTRATOR_L1_CORE_CONTRACT_ADDRESS=0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057 MADARA_ORCHESTRATOR_STARKNET_OPERATOR_ADDRESS=0x5b98B836969A60FEC50Fa925905Dd1D382a7db43 diff --git a/crates/orchestrator/src/tests/config.rs b/crates/orchestrator/src/tests/config.rs index 44b148ee..bc1f9e43 100644 --- a/crates/orchestrator/src/tests/config.rs +++ b/crates/orchestrator/src/tests/config.rs @@ -516,10 +516,10 @@ fn get_env_params() -> EnvParams { }; let env = get_env_var_optional("MADARA_ORCHESTRATOR_MAX_BLOCK_NO_TO_PROCESS").expect("Couldn't get max block"); - let max_block: Option = env.expect("Couldn't get max block").parse().ok(); + let max_block: Option = env.and_then(|s| if s.is_empty() { None } else { Some(s.parse::().unwrap()) }); let env = get_env_var_optional("MADARA_ORCHESTRATOR_MIN_BLOCK_NO_TO_PROCESS").expect("Couldn't get min block"); - let min_block: Option = env.expect("Couldn't get min block").parse().ok(); + let min_block: Option = env.and_then(|s| if s.is_empty() { None } else { Some(s.parse::().unwrap()) }); let service_config = ServiceParams { max_block_to_process: max_block, min_block_to_process: min_block }; diff --git a/crates/orchestrator/src/workers/snos.rs b/crates/orchestrator/src/workers/snos.rs index deb66500..56ee612e 100644 --- a/crates/orchestrator/src/workers/snos.rs +++ b/crates/orchestrator/src/workers/snos.rs @@ -32,18 +32,16 @@ impl Worker for SnosWorker { let latest_job_in_db = config.database().get_latest_job_by_type(JobType::SnosRun).await?; - let latest_job_id: u64 = match latest_job_in_db { + let latest_job_id = match latest_job_in_db { Some(job) => job.internal_id, None => "0".to_string(), - } - .parse::() - .unwrap(); + }; // To be used when testing in specific block range let block_start = if let Some(min_block_to_process) = config.service_config().min_block_to_process { min_block_to_process } else { - latest_job_id + latest_job_id.parse::().unwrap() }; for block_num in block_start..latest_block_number + 1 { @@ -57,4 +55,4 @@ impl Worker for SnosWorker { tracing::trace!(log_type = "completed", category = "SnosWorker", "SnosWorker completed."); Ok(()) } -} +} \ No newline at end of file