Skip to content
Snippets Groups Projects
Unverified Commit 0ce506ef authored by Emanuele Valzano's avatar Emanuele Valzano Committed by GitHub
Browse files

incrementing sufficient accounts references with saturating_add for safety. (#2768)


Even though it is difficult to overflow the sufficients variable, since
an attacker that is willing to rapidly increase the number must every
time deposit a minimum deposit of a given asset, it is safer to use
saturating_add().

---------

Co-authored-by: default avatarBastian Köcher <git@kchr.de>
Co-authored-by: default avatarjoe petrowski <25483142+joepetrowski@users.noreply.github.com>
parent b62df695
Branches
No related merge requests found
Pipeline #428664 canceled with stages
in 15 minutes and 47 seconds
......@@ -77,7 +77,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
}
} else if d.is_sufficient {
frame_system::Pallet::<T>::inc_sufficients(who);
d.sufficients += 1;
d.sufficients.saturating_inc();
ExistenceReason::Sufficient
} else {
frame_system::Pallet::<T>::inc_consumers(who)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment