From c67eb25bdb3c0b4acf326f7e409c3b575f1d0746 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Tue, 17 Dec 2024 17:44:14 -0300 Subject: [PATCH] simplify get_context_block --- core/node/da_clients/src/eigen/verifier.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/node/da_clients/src/eigen/verifier.rs b/core/node/da_clients/src/eigen/verifier.rs index d1deabd993a9..7750b99ba54c 100644 --- a/core/node/da_clients/src/eigen/verifier.rs +++ b/core/node/da_clients/src/eigen/verifier.rs @@ -295,10 +295,9 @@ impl Verifier { .map_err(|_| VerificationError::ServiceManagerError)? .as_u64(); - if self.cfg.settlement_layer_confirmation_depth == 0 { - return Ok(latest); - } - Ok(latest - (self.cfg.settlement_layer_confirmation_depth as u64 - 1)) + let depth = self.cfg.settlement_layer_confirmation_depth.saturating_sub(1); + let block_to_return = latest - depth as u64; + Ok(block_to_return) } async fn call_batch_id_to_metadata_hash(