I'm retrieving the list of authorities from aura in the pallet like this:
let authorities = pallet_aura::Pallet::<T>::authorities();
this should return a Vec<T::AuthorityId>
which is supposedly the same as sp_core::sr25519::Public
since AuthorityId
in Aura is defined like that here, so I did the following:
authorities.into_iter().map(|id| Public::from_h256(H256::from_slice(id.as_slice())));
I'm doing it this way because for some reason in AuthorityId
I don't have access to any method like sp_core::sr25519::Public
, (I specifically need the verify method) which is why in the pallet it throws an error:
no method named `as_slice` found for associated type `<T as pallet_aura::Config>::AuthorityId` in the current scope
now, having said that, in outer node if I call the runtime api authorities()
and I try to create sr25519 keys from it, it works:
let authorities= client
.runtime_api()
.authorities(&block_id)
.expect("error");
authorities
.iter()
.map(|pubkey| Public::from_h256(H256::from_slice(pubkey.as_slice())))
.collect()
- why is this happening, even though its completely the same function, I
m stuck with
AuthorityId` which has literally zero methods? and are there simpler ways to retrieve the Public keys of the current authorities that does not require all this mess?
Ps: I tried importing the trait use sp_core::ByteArray;
but it still didn't work.