Skip to content

Commit

Permalink
Add failure events for thea
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauthamastro committed Feb 14, 2024
1 parent d23b9f9 commit aad2333
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pallets/thea/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ pub mod pallet {
TheaSignatureFinalized(Network, u64),
/// Unable to parse public key
UnableToParsePublicKey(T::TheaId),
/// Unable to slice public key hash for evm chains
UnableToSlicePublicKeyHash(T::TheaId),
/// Unable to generate rotate validators payload for this network
UnableToGenerateValidatorSet(Network),
}

#[pallet::error]
Expand Down Expand Up @@ -771,6 +775,8 @@ impl<T: Config> Pallet<T> {
if let Ok(address) = hash[12..32].try_into() {
uncompressed_keys.push(address);
} else {
log::error!(target: "thea", "Unable to slice last 20 bytes of hash for Evm");
Self::deposit_event(Event::<T>::UnableToSlicePublicKeyHash(public_key.into()));
return;
}
} else {
Expand All @@ -791,6 +797,8 @@ impl<T: Config> Pallet<T> {
payload.encode(),
)
} else {
log::error!(target: "thea", "Unable to generate rotate validators payload");
Self::deposit_event(Event::<T>::UnableToGenerateValidatorSet(network));
continue;
}
},
Expand All @@ -802,6 +810,8 @@ impl<T: Config> Pallet<T> {
payload.encode(),
)
} else {
log::error!(target: "thea", "Unable to generate rotate validators payload");
Self::deposit_event(Event::<T>::UnableToGenerateValidatorSet(network));
continue;
}
},
Expand Down

0 comments on commit aad2333

Please sign in to comment.