diff --git a/catalyst-gateway/bin/src/follower.rs b/catalyst-gateway/bin/src/follower.rs index 4f88355d4ed..0b43c68ec95 100644 --- a/catalyst-gateway/bin/src/follower.rs +++ b/catalyst-gateway/bin/src/follower.rs @@ -253,16 +253,17 @@ async fn init_follower( // Block processing for Eras before staking are ignored. if valid_era(block.era()) { // index catalyst registrations - // match db.index_registration_data(block.txs(), slot, - // network).await { Ok(()) => (), - // Err(err) => { - // error!( - // "Unable to index registration data for block {:?} - - // skip..", err - // ); - // continue; - // }, - // } + match db.index_registration_data(block.txs(), slot, network).await { + Ok(()) => (), + Err(err) => { + error!( + "Unable to index registration data for block {:?} - + skip..", + err + ); + continue; + }, + } // Rewards } diff --git a/catalyst-gateway/bin/src/registration/mod.rs b/catalyst-gateway/bin/src/registration/mod.rs index ae7bfa1858a..a4819244d36 100644 --- a/catalyst-gateway/bin/src/registration/mod.rs +++ b/catalyst-gateway/bin/src/registration/mod.rs @@ -338,25 +338,27 @@ pub fn inspect_rewards_addr( Ok(rewards_address) } -#[allow(clippy::indexing_slicing)] /// Extract Nonce pub fn inspect_nonce(metamap: &[(Value, Value)]) -> Result> { - let nonce = match metamap[NONCE] { - (Value::Integer(_four), Value::Integer(nonce)) => Nonce(nonce.try_into()?), + let nonce: i128 = match metamap.get(NONCE).ok_or("Issue with nonce parsing")? { + (Value::Integer(_four), Value::Integer(nonce)) => i128::from(*nonce), _ => return Err("Invalid nonce".to_string().into()), }; - Ok(nonce) + + Ok(Nonce(nonce.try_into()?)) } -#[allow(clippy::indexing_slicing)] /// Extract optional voting purpose pub fn inspect_voting_purpose( metamap: &[(Value, Value)], ) -> Result, Box> { if metamap.len() == 5 { - match metamap[VOTE_PURPOSE] { + match metamap + .get(VOTE_PURPOSE) + .ok_or("Issue with voting purpose parsing")? + { (Value::Integer(_five), Value::Integer(purpose)) => { - Ok(Some(VotingPurpose(purpose.try_into()?))) + Ok(Some(VotingPurpose(i128::from(*purpose).try_into()?))) }, _ => Ok(None), }