fix(security): audit fixes across 9 custom pallets
- pez-rewards: checked arithmetic in parliamentary reward distribution - tiki: saturating_add in get_tiki_score fold, benchmarking cleanup - ping: saturating_add on PingCount - staking-score: saturating_mul on 4 duration multipliers - pez-treasury: proper error on TreasuryStartBlock None, saturating_add on NextReleaseMonth, doc fix 70->75% - messaging: InboxOverflow event on FIFO eviction - token-wrapper: reorder wrap/unwrap operations, add pallet balance pre-check - welati: u64 cast for turnout percentage overflow prevention - presale: fix refund calculation to use net_in_treasury (98%) instead of impossible 99%, update tests
This commit is contained in:
@@ -194,6 +194,8 @@ pub mod pezpallet {
|
||||
EraPurged { era: u32 },
|
||||
/// Era rotated
|
||||
EraRotated { old_era: u32, new_era: u32 },
|
||||
/// Oldest message was evicted from a full inbox (FIFO)
|
||||
InboxOverflow { recipient: T::AccountId, era: u32 },
|
||||
}
|
||||
|
||||
// ============= ERRORS =============
|
||||
@@ -435,6 +437,10 @@ pub mod pezpallet {
|
||||
if inbox.len() >= T::MaxInboxSize::get() as usize {
|
||||
// FIFO: remove oldest message to make room
|
||||
inbox.remove(0);
|
||||
Self::deposit_event(Event::InboxOverflow {
|
||||
recipient: to.clone(),
|
||||
era: current_era,
|
||||
});
|
||||
}
|
||||
inbox.try_push(message).map_err(|_| Error::<T>::InboxFull)?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user