freeverseio / laos

GNU General Public License v3.0
16 stars 6 forks source link

Audit: apply fix of "No Logging on Minting Error" #733

Open ccubu opened 3 weeks ago

ccubu commented 3 weeks ago

Description

Found on commit: 16bd9e56d20c206cf927d961c8ec58f299308473 Location: ● pallets/parachain-staking/src/rewards/mint_rewards.rs: 50-55 Classification: ● CWE-778: Insufficient Logging3 If funds are not deposited for the collator when making a new block, the error is not registered anywhere. This can be seen in the following code, where there is no else clause

if let Ok(amount_transferred) = T::Currency::deposit_into_existing(&collator_id, amt) { Self::deposit_event(Event::Rewarded {
account: collator_id.clone(),
rewards: amount_transferred.peek(), });
}

Recommendation: Either generate an event showing the error or at least log the error.

ACCEPTANCE:

ccubu commented 3 weeks ago

https://github.com/freeverseio/laos/tree/audit-fixes