3

Good evening,

I am trying to parse the output hash of nextAuthorities details retrieved by storage function.

I would like to know how to parse the output sent per validator, is it an hashproof generated by babe session key?

Same question for heartbeat received in each block from candidate validators.

Thanks for support

1 Answer 1

1

In BABE, the authorities are block producers. What you get when you query the nextAuthorities() is the AuthorityId and the BabeAuthorityWeightof the next block producers.

/// Next epoch authorities.
#[pallet::storage]
pub(super) type NextAuthorities<T: Config> = StorageValue<
    _,
    WeakBoundedVec<(AuthorityId, BabeAuthorityWeight), T::MaxAuthorities>,
    ValueQuery,
>;

The AuthorityId you want to parse is the Babe authority identifier. Which is equivalent to the schnorrkel public key used in the main Babe module. See the definition here.

For the Heartbeat event you get the authority Id of the validator that has sent the heartbeat, which is a signed transaction.

From the docs:

If the local node is a validator (i.e. contains an authority key), this module gossips a heartbeat transaction with each new session. The heartbeat functions as a simple mechanism to signal that the node is online in the current era.

See the event HeartbeatReceived on the im-online pallet.

    #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
    /// A new heartbeat was received from `AuthorityId`.
    HeartbeatReceived { authority_id: T::AuthorityId },
2
  • Thanks Alex, another question. What about the identifier in the "authority_id" of Im_online module events? Is the stash' im_online identifier of the current epoch or of the next epoch?
    – a_dotter
    Mar 1 at 22:02
  • updated response! hope it answers this second question too
    – Alex Bean
    Mar 2 at 10:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.