Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::babe::Babe Class Referenceabstract

#include <babe.hpp>

Inheritance diagram for kagome::consensus::babe::Babe:
Collaboration diagram for kagome::consensus::babe::Babe:

Public Types

enum  State {
  State::WAIT_REMOTE_STATUS, State::HEADERS_LOADING, State::HEADERS_LOADED, State::STATE_LOADING,
  State::CATCHING_UP, State::WAIT_BLOCK_ANNOUNCE, State::SYNCHRONIZED
}
 

Public Member Functions

 ~Babe () override=default
 
virtual void runEpoch (EpochDescriptor epoch)=0
 
virtual State getCurrentState () const =0
 
virtual bool wasSynchronized () const =0
 
- Public Member Functions inherited from kagome::network::BlockAnnounceObserver
virtual ~BlockAnnounceObserver ()=default
 
virtual void onRemoteStatus (const libp2p::peer::PeerId &peer_id, const Status &remote_status)=0
 
virtual void onBlockAnnounce (const libp2p::peer::PeerId &peer_id, const BlockAnnounce &announce)=0
 
virtual void onSynchronized ()=0
 

Detailed Description

BABE protocol, used for block production in the Polkadot consensus. One of the two parts in that consensus; the other is Grandpa finality Read more: https://research.web3.foundation/en/latest/polkadot/BABE/Babe/

Definition at line 21 of file babe.hpp.

Member Enumeration Documentation

Enumerator
WAIT_REMOTE_STATUS 
HEADERS_LOADING 
HEADERS_LOADED 
STATE_LOADING 
CATCHING_UP 
WAIT_BLOCK_ANNOUNCE 
SYNCHRONIZED 

Definition at line 25 of file babe.hpp.

Constructor & Destructor Documentation

kagome::consensus::babe::Babe::~Babe ( )
overridedefault

Member Function Documentation

virtual State kagome::consensus::babe::Babe::getCurrentState ( ) const
pure virtual
Returns
current state

Implemented in kagome::consensus::babe::BabeImpl.

virtual void kagome::consensus::babe::Babe::runEpoch ( EpochDescriptor  epoch)
pure virtual

Start a Babe production

Parameters
epoch- epoch, which is going to be run epoch.starting_slot_finish_time - when the slot, from which the BABE starts, ends; for example, we start from 5th slot of the some epoch. Then, we need to set time when 5th slot finishes; most probably, that time will be calculated using Median algorithm
Note
the function will automatically continue launching all further epochs of the Babe production
in fact, it is an implementation of "Invoke-Block-Authoring" from the spec

Implemented in kagome::consensus::babe::BabeImpl.

virtual bool kagome::consensus::babe::Babe::wasSynchronized ( ) const
pure virtual

Checks whether the node was in a synchronized state at least once since startup.

Returns
true when current state was ever set to synchronized during the current run, otherwise - false.

Implemented in kagome::consensus::babe::BabeImpl.


The documentation for this class was generated from the following file: