check if validator disabled during the validate_unsigned and small typo fixes
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
cc141105bb
commit
7a710ec9cb
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ghost-slow-clap"
|
||||
version = "0.3.48"
|
||||
version = "0.3.49"
|
||||
description = "Applause protocol for the EVM bridge"
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
@ -399,6 +399,14 @@ pub mod pallet {
|
||||
None => return InvalidTransaction::BadSigner.into(),
|
||||
};
|
||||
|
||||
if ClapsInSession::<T>::get(&session_index)
|
||||
.get(&clap.authority_index)
|
||||
.map(|info| info.disabled)
|
||||
.unwrap_or_default()
|
||||
{
|
||||
return InvalidTransaction::BadSigner.into();
|
||||
}
|
||||
|
||||
let signature_valid =
|
||||
clap.using_encoded(|encoded_clap| authority.verify(&encoded_clap, signature));
|
||||
|
||||
@ -507,14 +515,14 @@ impl<T: Config> Pallet<T> {
|
||||
Error::<T>::CurrentValidatorIsDisabled
|
||||
);
|
||||
|
||||
let disabled_authorites = claps_in_session
|
||||
let disabled_authorities = claps_in_session
|
||||
.values()
|
||||
.filter(|info| info.disabled)
|
||||
.count();
|
||||
|
||||
let active_authorities = Authorities::<T>::get(&session_index)
|
||||
.len()
|
||||
.saturating_sub(disabled_authorites);
|
||||
.saturating_sub(disabled_authorities);
|
||||
|
||||
let received_claps_key = (session_index, &clap.transaction_hash, &clap_unique_hash);
|
||||
|
||||
@ -637,12 +645,12 @@ impl<T: Config> Pallet<T> {
|
||||
.cloned()
|
||||
.collect::<BTreeSet<T::AuthorityId>>();
|
||||
|
||||
let disabled_authorites = ClapsInSession::<T>::get(&prev_session_index)
|
||||
let disabled_authorities = ClapsInSession::<T>::get(&prev_session_index)
|
||||
.values()
|
||||
.filter(|info| info.disabled)
|
||||
.count();
|
||||
|
||||
let active_authorities = prev_authorities.len().saturating_sub(disabled_authorites);
|
||||
let active_authorities = prev_authorities.len().saturating_sub(disabled_authorities);
|
||||
|
||||
let summary_authority_claps_length = curr_received_claps
|
||||
.symmetric_difference(&prev_received_claps)
|
||||
|
||||
@ -710,7 +710,7 @@ fn should_throw_error_if_validator_disabled_and_ignore_later() {
|
||||
assert_eq!(Session::disable_index(0), true);
|
||||
assert_err!(
|
||||
do_clap_from(session_index, network_id, 0, false),
|
||||
Error::<Runtime>::CurrentValidatorIsDisabled
|
||||
DispatchError::Other("Invalid signing address")
|
||||
);
|
||||
|
||||
assert_eq!(pallet::ReceivedClaps::<Runtime>::get(&storage_key).len(), 0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user