-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
- Loading branch information
Showing
14 changed files
with
506 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crate::{types::*, *}; | ||
use hex_literal::hex; | ||
|
||
/// These multisigs have historical issues where the deposit is missing for the creator. | ||
const KNOWN_BAD_MULTISIGS: &[AccountId32] = &[ | ||
AccountId32::new(hex!("e64d5c0de81b9c960c1dd900ad2a5d9d91c8a683e60dd1308e6bc7f80ea3b25f")), | ||
AccountId32::new(hex!("d55ec415b6703ddf7bec9d5c02a0b642f1f5bd068c6b3c50c2145544046f1491")), | ||
AccountId32::new(hex!("c2ff4f84b7fcee1fb04b4a97800e72321a4bc9939d456ad48d971127fc661c48")), | ||
AccountId32::new(hex!("0a8933d3f2164648399cc48cb8bb8c915abb94a2164c40ad6b48cee005f1cb6e")), | ||
AccountId32::new(hex!("ebe3cd53e580c4cd88acec1c952585b50a44a9b697d375ff648fee582ae39d38")), | ||
AccountId32::new(hex!("e64d5c0de81b9c960c1dd900ad2a5d9d91c8a683e60dd1308e6bc7f80ea3b25f")), | ||
AccountId32::new(hex!("caafae0aaa6333fcf4dc193146945fe8e4da74aa6c16d481eef0ca35b8279d73")), | ||
AccountId32::new(hex!("d429458e57ba6e9b21688441ff292c7cf82700550446b061a6c5dec306e1ef05")), | ||
]; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn do_receive_multisigs(multisigs: Vec<RcMultisigOf<T>>) -> Result<(), Error<T>> { | ||
Self::deposit_event(Event::MultisigBatchReceived { count: multisigs.len() as u32 }); | ||
let (mut count_good, mut count_bad) = (0, 0); | ||
log::info!(target: LOG_TARGET, "Integrating {} multisigs", multisigs.len()); | ||
|
||
for multisig in multisigs { | ||
match Self::do_receive_multisig(multisig) { | ||
Ok(()) => count_good += 1, | ||
Err(e) => { | ||
count_bad += 1; | ||
log::error!(target: LOG_TARGET, "Error while integrating multisig: {:?}", e); | ||
}, | ||
} | ||
} | ||
Self::deposit_event(Event::MultisigBatchProcessed { count_good, count_bad }); | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn do_receive_multisig(multisig: RcMultisigOf<T>) -> Result<(), Error<T>> { | ||
log::debug!(target: LOG_TARGET, "Integrating multisig {}, {:?}", multisig.creator.to_ss58check(), multisig.deposit); | ||
|
||
let missing = <T as pallet_multisig::Config>::Currency::unreserve( | ||
&multisig.creator, | ||
multisig.deposit, | ||
); | ||
if missing != Default::default() { | ||
if KNOWN_BAD_MULTISIGS.contains(&multisig.creator) { | ||
log::warn!(target: LOG_TARGET, "Failed to unreserve deposit for known bad multisig {}, missing: {:?}", multisig.creator.to_ss58check(), missing); | ||
|
||
log::warn!("{:?}", frame_system::Account::<T>::get(&multisig.creator)); | ||
} else { | ||
log::error!(target: LOG_TARGET, "Failed to unreserve deposit for multisig {} missing {:?}, details: {:?}", multisig.creator.to_ss58check(), missing, multisig.details); | ||
} | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.