Skip to content

Commit

Permalink
Added log to find about index overflow (#958)
Browse files Browse the repository at this point in the history
## Describe your changes
Added log to find about index overflow.
  • Loading branch information
Gauthamastro authored May 14, 2024
2 parents 8f669e1 + c42474a commit 9f27667
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pallets/ocex/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,13 @@ impl<T: Config> Pallet<T> {
) -> 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,
Expand Down

0 comments on commit 9f27667

Please sign in to comment.