Remove fund account checks from upgrade. (#1111)

This commit is contained in:
Tomasz Drwięga
2021-09-06 10:40:50 +02:00
committed by Bastian Köcher
parent e20163c4ea
commit 2101ed9cc5
3 changed files with 4 additions and 26 deletions
@@ -57,20 +57,15 @@ where
{
type Error = &'static str;
fn initialize(relayer_fund_account: &T::AccountId) -> usize {
assert!(
frame_system::Pallet::<T>::account_exists(relayer_fund_account),
"The relayer fund account ({:?}) must exist for the message lanes pallet to work correctly.",
relayer_fund_account,
);
1
}
fn pay_delivery_and_dispatch_fee(
submitter: &Sender<T::AccountId>,
fee: &Currency::Balance,
relayer_fund_account: &T::AccountId,
) -> Result<(), Self::Error> {
if !frame_system::Pallet::<T>::account_exists(relayer_fund_account) {
return Err("The relayer fund account must exist for the message lanes pallet to work correctly.");
}
let root_account = RootAccount::get();
let account = match submitter {
Sender::Signed(submitter) => submitter,
-9
View File
@@ -184,15 +184,6 @@ pub mod pallet {
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
/// Ensure runtime invariants.
fn on_runtime_upgrade() -> Weight {
let reads = T::MessageDeliveryAndDispatchPayment::initialize(&Self::relayer_fund_account_id());
T::DbWeight::get().reads(reads as u64)
}
}
#[pallet::call]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Change `PalletOwner`.
@@ -125,14 +125,6 @@ pub trait MessageDeliveryAndDispatchPayment<AccountId, Balance> {
relayers_rewards: RelayersRewards<AccountId, Balance>,
relayer_fund_account: &AccountId,
);
/// Perform some initialization in externalities-provided environment.
///
/// For instance you may ensure that particular required accounts or storage items are present.
/// Returns the number of storage reads performed.
fn initialize(_relayer_fund_account: &AccountId) -> usize {
0
}
}
/// Messages bridge API to be used from other pallets.