From c42474a6f76f40f134b4ccccc9f8cf5ea7c1d103 Mon Sep 17 00:00:00 2001 From: zktony Date: Mon, 13 May 2024 15:35:25 +0530 Subject: [PATCH] Added log to find about index overflow --- pallets/ocex/src/validator.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pallets/ocex/src/validator.rs b/pallets/ocex/src/validator.rs index 96eb86352..398c9e932 100644 --- a/pallets/ocex/src/validator.rs +++ b/pallets/ocex/src/validator.rs @@ -756,7 +756,13 @@ impl Pallet { ) -> Result<(), &'static str> { let mut config = get_lmp_config(state, current_on_chain_epoch)?; // We wrap around the index if we overflow - let next_index = config.index.checked_add(1).unwrap_or(0); + let next_index = match config.index.checked_add(1) { + None => { + log::error!(target:"ocex","Index overflow for LMPConfig {:?}", config.index); + 0 + }, + Some(index) => index, + }; for (main, score) in scores { store_q_score_and_uptime( state,