Skip to content

Commit

Permalink
Added log to find about index overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zktony committed May 13, 2024
1 parent 8f669e1 commit c42474a
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 c42474a

Please sign in to comment.