mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 18:37:59 +00:00
Avoid multisig reentrancy (#6445)
This commit is contained in:
@@ -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)
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user