3

I'm trying to add parachain-staking pallet in the solochain which is based on POA with Aura. For that I need to integrate pallet session but in the integrating of pallet-session in chain spec I'm getting this error:

 node/src/chain_spec.rs:372:10
    |
372 |               keys: initial_authorities
    |  ___________________^
373 | |                 .iter()
374 | |                 .cloned()
375 | |                 .map(|(aura, grandpa)| {
...   |
381 | |                 })
382 | |                 .collect::<Vec<_>>(),
    | |____________________________________^ expected `Vec<(AccountId32, AccountId32, ...)>`, found `Vec<(Public, Public, SessionKeys)>`
    |
    = note: expected struct `Vec<(AccountId32, AccountId32, SessionKeys)>`
               found struct `Vec<(sp_consensus_aura::sr25519::app_sr25519::Public, sp_consensus_grandpa::app::Public, SessionKeys)>`

Here is my code:

session: node_runtime::SessionConfig {
            keys: initial_authorities
                .iter()
                .cloned()
                .map(|(aura, grandpa)| {
                    (
                        aura.clone(),                 // account id
                        grandpa.clone(),                         // validator id
                        template_session_keys(aura,grandpa), // session keys
                    )
                })
                .collect::<Vec<_>>(),
        },

Template_session_key implementation:

pub fn template_session_keys(Akeys: AuraId, GKeys: GrandpaId) -> node_runtime::SessionKeys {
    node_runtime::SessionKeys { aura: Akeys, grandpa: GKeys }
}

SessionKey implemenation:

impl_opaque_keys! {
    pub struct SessionKeys {
        pub aura: Aura,
        pub grandpa: Grandpa,
    }
}

How to solve this issue?

Thanks!

3
  • You should convert sp_consensus_aura::sr25519::app_sr25519::Public type and sp_consensus_grandpa::app::Public type into AccountId type
    – CocDap
    Oct 27, 2023 at 9:18
  • @CocDap Thank you for you answer. Can you please elaborate how can I convert this? Oct 27, 2023 at 11:35
  • How is the initial_authorities?
    – Alex Bean
    Oct 30, 2023 at 8:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.