Skip to main content

im retreivingI'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 iI did the following:

authorities.into_iter().map(|id| Public::from_h256(H256::from_slice(id.as_slice())));

imI'm doing it this way because for some reason in AuthorityId i dontAuthorityId I don't have access to any method like sp_core::sr25519::Public, (iI 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 iI call the runtime api authorities()authorities() and iI 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, im stuck with IAuthorityIdm stuck with AuthorityId` which has literally zero methods? and are there simpler ways to retreiveretrieve the Public keys of the current authorities that does not require all this mess?

Ps: iI tried importing the trait use sp_core::ByteArray; but it still didn't work.

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

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, Im 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.

added 43 characters in body
Source Link
dadzerlaze
  • 1.1k
  • 3
  • 16

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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:

id.as_slice() no method notnamed `as_slice` found infor 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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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:

id.as_slice() method not found in `<T as pallet_aura::Config>::AuthorityId`

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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

added 62 characters in body
Source Link
dadzerlaze
  • 1.1k
  • 3
  • 16

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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:

id.as_slice() method not found in `<T as pallet_aura::Config>::AuthorityId`

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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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:

id.as_slice() method not found in `<T as pallet_aura::Config>::AuthorityId`

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, and are there simpler ways to retreive 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.

im retreiving 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())));

im doing it this way because for some reason in AuthorityId i dont 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:

id.as_slice() method not found in `<T as pallet_aura::Config>::AuthorityId`

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, im stuck with AuthorityId which has literally zero methods? and are there simpler ways to retreive 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.

Source Link
dadzerlaze
  • 1.1k
  • 3
  • 16
Loading