Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fetch authorities from validator pallet #462

Merged
merged 2 commits into from
Sep 26, 2022
Merged
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
11 changes: 9 additions & 2 deletions substrate-node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, Encode, OpaqueMetadata};
use sp_core::{crypto::KeyTypeId, sr25519, Encode, OpaqueMetadata};
use sp_runtime::traits::{
AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, OpaqueKeys,
SaturatedConversion, Verify,
Expand Down Expand Up @@ -832,7 +832,14 @@ impl_runtime_apis! {
}

fn authorities() -> Vec<AuraId> {
Aura::authorities().into_inner()
ValidatorSet::validators()
.iter()
.map(|account| {
let mut bytes = [0u8; 32];
bytes.copy_from_slice(&account.encode());
sr25519::Public::from_raw(bytes).into()
})
.collect()
}
}

Expand Down