Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
54 changes: 35 additions & 19 deletions frame/recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,22 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A recovery process has been set up for an \[account\].
RecoveryCreated(T::AccountId),
/// A recovery process has been set up for an account.
RecoveryCreated { account: T::AccountId },
/// A recovery process has been initiated for lost account by rescuer account.
/// \[lost, rescuer\]
RecoveryInitiated(T::AccountId, T::AccountId),
RecoveryInitiated { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// A recovery process for lost account by rescuer account has been vouched for by sender.
/// \[lost, rescuer, sender\]
RecoveryVouched(T::AccountId, T::AccountId, T::AccountId),
RecoveryVouched {
lost_account: T::AccountId,
rescuer_account: T::AccountId,
sender: T::AccountId,
},
/// A recovery process for lost account by rescuer account has been closed.
/// \[lost, rescuer\]
RecoveryClosed(T::AccountId, T::AccountId),
RecoveryClosed { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// Lost account has been successfully recovered by rescuer account.
/// \[lost, rescuer\]
AccountRecovered(T::AccountId, T::AccountId),
/// A recovery process has been removed for an \[account\].
RecoveryRemoved(T::AccountId),
AccountRecovered { lost_account: T::AccountId, rescuer_account: T::AccountId },
/// A recovery process has been removed for an account.
RecoveryRemoved { lost_account: T::AccountId },
}

#[pallet::error]
Expand Down Expand Up @@ -409,7 +409,10 @@ pub mod pallet {
ensure_root(origin)?;
// Create the recovery storage item.
<Proxy<T>>::insert(&rescuer, &lost);
Self::deposit_event(Event::<T>::AccountRecovered(lost, rescuer));
Self::deposit_event(Event::<T>::AccountRecovered {
lost_account: lost,
rescuer_account: rescuer,
});
Ok(())
}

Expand Down Expand Up @@ -472,7 +475,7 @@ pub mod pallet {
// Create the recovery configuration storage item
<Recoverable<T>>::insert(&who, recovery_config);

Self::deposit_event(Event::<T>::RecoveryCreated(who));
Self::deposit_event(Event::<T>::RecoveryCreated { account: who });
Ok(())
}

Expand Down Expand Up @@ -519,7 +522,10 @@ pub mod pallet {
};
// Create the active recovery storage item
<ActiveRecoveries<T>>::insert(&account, &who, recovery_status);
Self::deposit_event(Event::<T>::RecoveryInitiated(account, who));
Self::deposit_event(Event::<T>::RecoveryInitiated {
lost_account: account,
rescuer_account: who,
});
Ok(())
}

Expand Down Expand Up @@ -568,7 +574,11 @@ pub mod pallet {
}
// Update storage with the latest details
<ActiveRecoveries<T>>::insert(&lost, &rescuer, active_recovery);
Self::deposit_event(Event::<T>::RecoveryVouched(lost, rescuer, who));
Self::deposit_event(Event::<T>::RecoveryVouched {
lost_account: lost,
rescuer_account: rescuer,
sender: who,
});
Ok(())
}

Expand Down Expand Up @@ -617,7 +627,10 @@ pub mod pallet {
frame_system::Pallet::<T>::inc_consumers(&who).map_err(|_| Error::<T>::BadState)?;
// Create the recovery storage item
Proxy::<T>::insert(&who, &account);
Self::deposit_event(Event::<T>::AccountRecovered(account, who));
Self::deposit_event(Event::<T>::AccountRecovered {
lost_account: account,
rescuer_account: who,
});
Ok(())
}

Expand Down Expand Up @@ -656,7 +669,10 @@ pub mod pallet {
BalanceStatus::Free,
);
debug_assert!(res.is_ok());
Self::deposit_event(Event::<T>::RecoveryClosed(who, rescuer));
Self::deposit_event(Event::<T>::RecoveryClosed {
lost_account: who,
rescuer_account: rescuer,
});
Ok(())
}

Expand Down Expand Up @@ -692,7 +708,7 @@ pub mod pallet {

// Unreserve the initial deposit for the recovery configuration.
T::Currency::unreserve(&who, recovery_config.deposit);
Self::deposit_event(Event::<T>::RecoveryRemoved(who));
Self::deposit_event(Event::<T>::RecoveryRemoved { lost_account: who });
Ok(())
}

Expand Down
6 changes: 3 additions & 3 deletions frame/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,9 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event {
/// New session has happened. Note that the argument is the \[session_index\], not the
/// New session has happened. Note that the argument is the session index, not the
/// block number as the type might suggest.
NewSession(SessionIndex),
NewSession { session_index: SessionIndex },
}

/// Old name generated by `decl_event`.
Expand Down Expand Up @@ -703,7 +703,7 @@ impl<T: Config> Pallet<T> {
<QueuedChanged<T>>::put(next_changed);

// Record that this happened.
Self::deposit_event(Event::NewSession(session_index));
Self::deposit_event(Event::NewSession { session_index });

// Tell everyone about the new session keys.
T::SessionHandler::on_new_session::<T::Keys>(changed, &session_keys, &queued_amalgamated);
Expand Down