Merge branch 'pallet-slow-clap'

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-11-10 20:55:37 +03:00
commit 8123295f91
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-slow-clap" name = "ghost-slow-clap"
version = "0.3.51" version = "0.3.52"
description = "Applause protocol for the EVM bridge" description = "Applause protocol for the EVM bridge"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -118,7 +118,6 @@ enum OffchainErr<NetworkId> {
UnknownNetworkType(NetworkId), UnknownNetworkType(NetworkId),
OffchainTimeoutPeriod(NetworkId), OffchainTimeoutPeriod(NetworkId),
TooManyRequests(NetworkId), TooManyRequests(NetworkId),
AuthorityDisabled(AuthIndex),
} }
impl<NetworkId: core::fmt::Debug> core::fmt::Debug for OffchainErr<NetworkId> { impl<NetworkId: core::fmt::Debug> core::fmt::Debug for OffchainErr<NetworkId> {
@ -144,7 +143,6 @@ impl<NetworkId: core::fmt::Debug> core::fmt::Debug for OffchainErr<NetworkId> {
OffchainErr::UnknownNetworkType(ref network_id) => write!(fmt, "Unknown type for network #{:?}.", network_id), OffchainErr::UnknownNetworkType(ref network_id) => write!(fmt, "Unknown type for network #{:?}.", network_id),
OffchainErr::OffchainTimeoutPeriod(ref network_id) => write!(fmt, "Offchain request should be in-flight for network #{:?}.", network_id), OffchainErr::OffchainTimeoutPeriod(ref network_id) => write!(fmt, "Offchain request should be in-flight for network #{:?}.", network_id),
OffchainErr::TooManyRequests(ref network_id) => write!(fmt, "Too many requests over RPC endpoint for network #{:?}.", network_id), OffchainErr::TooManyRequests(ref network_id) => write!(fmt, "Too many requests over RPC endpoint for network #{:?}.", network_id),
OffchainErr::AuthorityDisabled(ref authority_index) => write!(fmt, "Authority index {:?} is disabled in current session.", authority_index),
} }
} }
} }
@ -768,14 +766,6 @@ impl<T: Config> Pallet<T> {
network_id: NetworkIdOf<T>, network_id: NetworkIdOf<T>,
network_data: &NetworkData, network_data: &NetworkData,
) -> OffchainResult<T, ()> { ) -> OffchainResult<T, ()> {
if ClapsInSession::<T>::get(&session_index)
.get(&authority_index)
.map(|info| info.disabled)
.unwrap_or_default()
{
return Err(OffchainErr::AuthorityDisabled(authority_index));
}
let network_id_encoded = network_id.encode(); let network_id_encoded = network_id.encode();
let block_number_key = Self::create_storage_key(b"block-", &network_id_encoded); let block_number_key = Self::create_storage_key(b"block-", &network_id_encoded);
@ -914,6 +904,20 @@ impl<T: Config> Pallet<T> {
Ok(Some(new_evm_block)) Ok(Some(new_evm_block))
} }
EvmResponseType::TransactionLogs(evm_logs) => { EvmResponseType::TransactionLogs(evm_logs) => {
if ClapsInSession::<T>::get(&session_index)
.get(&authority_index)
.map(|info| info.disabled)
.unwrap_or_default()
{
log::info!(
target: LOG_TARGET,
"🧐 Authority #{:?} disabled in session {:?}; no claps available",
authority_index,
session_index
);
return Ok(None);
}
let claps: Vec<_> = evm_logs let claps: Vec<_> = evm_logs
.iter() .iter()
.filter_map(|log| { .filter_map(|log| {