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

Avoid multisig reentrancy #6445

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions frame/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,13 @@ impl<T: Trait> Module<T> {
// verify weight
ensure!(call.get_dispatch_info().weight <= max_weight, Error::<T>::WeightTooLow);

let result = call.dispatch(RawOrigin::Signed(id.clone()).into());
T::Currency::unreserve(&m.depositor, m.deposit);
// Clean up storage before executing call to avoid an possibility of reentrancy
// attack.
<Multisigs<T>>::remove(&id, call_hash);
Self::clear_call(&call_hash);
T::Currency::unreserve(&m.depositor, m.deposit);

let result = call.dispatch(RawOrigin::Signed(id.clone()).into());
Self::deposit_event(RawEvent::MultisigExecuted(
who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error)
));
Expand Down