Skip to content

Commit

Permalink
update: fixed db issue
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Nov 8, 2024
1 parent 6525c63 commit b8a7e4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 ####

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/orchestrator/src/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64> = env.expect("Couldn't get max block").parse().ok();
let max_block: Option<u64> = env.and_then(|s| if s.is_empty() { None } else { Some(s.parse::<u64>().unwrap()) });

let env = get_env_var_optional("MADARA_ORCHESTRATOR_MIN_BLOCK_NO_TO_PROCESS").expect("Couldn't get min block");
let min_block: Option<u64> = env.expect("Couldn't get min block").parse().ok();
let min_block: Option<u64> = env.and_then(|s| if s.is_empty() { None } else { Some(s.parse::<u64>().unwrap()) });

let service_config = ServiceParams { max_block_to_process: max_block, min_block_to_process: min_block };

Expand Down
10 changes: 4 additions & 6 deletions crates/orchestrator/src/workers/snos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u64>()
.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::<u64>().unwrap()
};

for block_num in block_start..latest_block_number + 1 {
Expand All @@ -57,4 +55,4 @@ impl Worker for SnosWorker {
tracing::trace!(log_type = "completed", category = "SnosWorker", "SnosWorker completed.");
Ok(())
}
}
}

0 comments on commit b8a7e4a

Please sign in to comment.