Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauthamastro committed May 6, 2024
1 parent 4f14036 commit 6a710e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions pallets/ocex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2367,17 +2367,21 @@ impl<T: Config> sp_application_crypto::BoundToRuntimeAppPublic for Pallet<T> {
impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> {
type Key = T::AuthorityId;

fn on_genesis_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, Self::Key)>>(authorities: I)
{
fn on_genesis_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, Self::Key)>>(
authorities: I,
) {
let authorities = authorities.map(|(_, k)| k).collect::<Vec<_>>();
<Authorities<T>>::insert(
GENESIS_AUTHORITY_SET_ID,
ValidatorSet::new(authorities, GENESIS_AUTHORITY_SET_ID),
);
}

fn on_new_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, Self::Key)>>(_changed: bool, authorities: I, queued_authorities: I)
{
fn on_new_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, Self::Key)>>(
_changed: bool,
authorities: I,
queued_authorities: I,
) {
let next_authorities = authorities.map(|(_, k)| k).collect::<Vec<_>>();
let next_queued_authorities = queued_authorities.map(|(_, k)| k).collect::<Vec<_>>();

Expand Down
12 changes: 8 additions & 4 deletions pallets/thea/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> {
type Key = T::TheaId;

fn on_genesis_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, T::TheaId)>>(validators: I)
{
fn on_genesis_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, T::TheaId)>>(
validators: I,
) {
let authorities = validators.map(|(_, k)| k).collect::<Vec<_>>();
// we panic here as runtime maintainers can simply reconfigure genesis and restart
// the chain easily
Self::initialize_authorities(&authorities).expect("Authorities vec too big");
}

fn on_new_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, T::TheaId)>>(_changed: bool, validators: I, queued_validators: I)
{
fn on_new_session<'a, I: 'a + Iterator<Item = (&'a T::AccountId, T::TheaId)>>(
_changed: bool,
validators: I,
queued_validators: I,
) {
// A new thea message will be sent on session changes when queued != next.
let next_authorities = validators.map(|(_, k)| k).collect::<Vec<_>>();
if next_authorities.len() as u32 > T::MaxAuthorities::get() {
Expand Down

0 comments on commit 6a710e4

Please sign in to comment.