Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 9cbda1e

Browse files
authored
Avoid multisig reentrancy (#6445)
1 parent f9d4d30 commit 9cbda1e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frame/multisig/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,13 @@ impl<T: Trait> Module<T> {
553553
// verify weight
554554
ensure!(call.get_dispatch_info().weight <= max_weight, Error::<T>::WeightTooLow);
555555

556-
let result = call.dispatch(RawOrigin::Signed(id.clone()).into());
557-
T::Currency::unreserve(&m.depositor, m.deposit);
556+
// Clean up storage before executing call to avoid an possibility of reentrancy
557+
// attack.
558558
<Multisigs<T>>::remove(&id, call_hash);
559559
Self::clear_call(&call_hash);
560+
T::Currency::unreserve(&m.depositor, m.deposit);
561+
562+
let result = call.dispatch(RawOrigin::Signed(id.clone()).into());
560563
Self::deposit_event(RawEvent::MultisigExecuted(
561564
who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error)
562565
));

0 commit comments

Comments
 (0)