Kagome
Polkadot Runtime Engine in C++17
kagome::application::ChainSpecImpl Class Reference

#include <chain_spec_impl.hpp>

Inheritance diagram for kagome::application::ChainSpecImpl:
Collaboration diagram for kagome::application::ChainSpecImpl:

Public Types

enum  Error { Error::MISSING_ENTRY = 1, Error::MISSING_PEER_ID, Error::PARSER_ERROR, Error::NOT_IMPLEMENTED }
 

Public Member Functions

 ~ChainSpecImpl () override=default
 
const std::string & name () const override
 
const std::string & id () const override
 
const std::string & chainType () const override
 
const std::vector< libp2p::multi::Multiaddress > & bootNodes () const override
 Return ids of peer nodes of the current node. More...
 
const std::vector< std::pair< std::string, size_t > > & telemetryEndpoints () const override
 
const std::string & protocolId () const override
 
const std::map< std::string, std::string > & properties () const override
 
std::optional< std::reference_wrapper< const std::string > > getProperty (const std::string &property) const override
 
const std::set< primitives::BlockHash > & forkBlocks () const override
 
const std::set< primitives::BlockHash > & badBlocks () const override
 
std::optional< std::string > consensusEngine () const override
 
std::shared_ptr< const primitives::CodeSubstituteBlockIdscodeSubstitutes () const override
 
const GenesisRawDatagetGenesisTopSection () const override
 
const ChildrenDefaultRawDatagetGenesisChildrenDefaultSection () const override
 
outcome::result< common::BufferfetchCodeSubstituteByBlockInfo (const primitives::BlockInfo &block_info) const override
 
- Public Member Functions inherited from kagome::application::ChainSpec
virtual ~ChainSpec ()=default
 
bool idStartsWith (std::string_view prefix) const
 
bool isKusama () const
 
bool isRococo () const
 
bool isWococo () const
 
bool isVersi () const
 

Static Public Member Functions

static outcome::result< std::shared_ptr< ChainSpecImpl > > loadFrom (const std::string &config_path)
 

Private Member Functions

outcome::result< void > loadFromJson (const std::string &file_path)
 
outcome::result< void > loadFields (const boost::property_tree::ptree &tree)
 
outcome::result< void > loadGenesis (const boost::property_tree::ptree &tree)
 
outcome::result< void > loadBootNodes (const boost::property_tree::ptree &tree)
 
template<typename T >
outcome::result< std::decay_t< T > > ensure (std::string_view entry_name, boost::optional< T > opt_entry)
 
outcome::result< primitives::BlockIdparseBlockId (const std::string_view block_id_str) const
 
 ChainSpecImpl ()=default
 

Private Attributes

std::string name_
 
std::string id_
 
std::string chain_type_
 
std::string config_path_
 
std::vector< libp2p::multi::Multiaddress > boot_nodes_
 
std::vector< std::pair< std::string, size_t > > telemetry_endpoints_
 
std::string protocol_id_ {"sup"}
 
std::map< std::string, std::string > properties_
 
std::set< primitives::BlockHashfork_blocks_
 
std::set< primitives::BlockHashbad_blocks_
 
std::optional< std::string > consensus_engine_
 
std::shared_ptr< primitives::CodeSubstituteBlockIdsknown_code_substitutes_
 
GenesisRawData genesis_
 
ChildrenDefaultRawData children_default_
 
log::Logger log_ = log::createLogger("chain_spec", "kagome")
 

Detailed Description

Definition at line 18 of file chain_spec_impl.hpp.

Member Enumeration Documentation

Enumerator
MISSING_ENTRY 
MISSING_PEER_ID 
PARSER_ERROR 
NOT_IMPLEMENTED 

Definition at line 20 of file chain_spec_impl.hpp.

Constructor & Destructor Documentation

kagome::application::ChainSpecImpl::~ChainSpecImpl ( )
overridedefault
kagome::application::ChainSpecImpl::ChainSpecImpl ( )
privatedefault

Member Function Documentation

const std::set<primitives::BlockHash>& kagome::application::ChainSpecImpl::badBlocks ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 74 of file chain_spec_impl.hpp.

const std::vector<libp2p::multi::Multiaddress>& kagome::application::ChainSpecImpl::bootNodes ( ) const
inlineoverridevirtual

Return ids of peer nodes of the current node.

Implements kagome::application::ChainSpec.

Definition at line 44 of file chain_spec_impl.hpp.

const std::string& kagome::application::ChainSpecImpl::chainType ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 40 of file chain_spec_impl.hpp.

std::shared_ptr<const primitives::CodeSubstituteBlockIds> kagome::application::ChainSpecImpl::codeSubstitutes ( ) const
inlineoverridevirtual
Returns
runtime code substitution map

Implements kagome::application::ChainSpec.

Definition at line 82 of file chain_spec_impl.hpp.

std::optional<std::string> kagome::application::ChainSpecImpl::consensusEngine ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 78 of file chain_spec_impl.hpp.

template<typename T >
outcome::result<std::decay_t<T> > kagome::application::ChainSpecImpl::ensure ( std::string_view  entry_name,
boost::optional< T >  opt_entry 
)
inlineprivate

Definition at line 107 of file chain_spec_impl.hpp.

outcome::result< common::Buffer > kagome::application::ChainSpecImpl::fetchCodeSubstituteByBlockInfo ( const primitives::BlockInfo block_info) const
overridevirtual

Fetches code_substitute from json config on demand, by its BlockInfo. BlockInfo is being compared with BlockIds that were loaded on initial configuration and stored in set.

Implements kagome::application::ChainSpec.

Definition at line 197 of file chain_spec_impl.cpp.

const std::set<primitives::BlockHash>& kagome::application::ChainSpecImpl::forkBlocks ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 70 of file chain_spec_impl.hpp.

const ChildrenDefaultRawData& kagome::application::ChainSpecImpl::getGenesisChildrenDefaultSection ( ) const
inlineoverridevirtual
Returns
childrenDefault section

Implements kagome::application::ChainSpec.

Definition at line 91 of file chain_spec_impl.hpp.

const GenesisRawData& kagome::application::ChainSpecImpl::getGenesisTopSection ( ) const
inlineoverridevirtual
Returns
top section

Implements kagome::application::ChainSpec.

Definition at line 87 of file chain_spec_impl.hpp.

std::optional<std::reference_wrapper<const std::string> > kagome::application::ChainSpecImpl::getProperty ( const std::string &  property) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 61 of file chain_spec_impl.hpp.

const std::string& kagome::application::ChainSpecImpl::id ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 36 of file chain_spec_impl.hpp.

outcome::result< void > kagome::application::ChainSpecImpl::loadBootNodes ( const boost::property_tree::ptree &  tree)
private

Definition at line 276 of file chain_spec_impl.cpp.

outcome::result< void > kagome::application::ChainSpecImpl::loadFields ( const boost::property_tree::ptree &  tree)
private

Definition at line 65 of file chain_spec_impl.cpp.

outcome::result< std::shared_ptr< ChainSpecImpl > > kagome::application::ChainSpecImpl::loadFrom ( const std::string &  config_path)
static

Definition at line 35 of file chain_spec_impl.cpp.

outcome::result< void > kagome::application::ChainSpecImpl::loadFromJson ( const std::string &  file_path)
private

Definition at line 46 of file chain_spec_impl.cpp.

outcome::result< void > kagome::application::ChainSpecImpl::loadGenesis ( const boost::property_tree::ptree &  tree)
private

Definition at line 232 of file chain_spec_impl.cpp.

const std::string& kagome::application::ChainSpecImpl::name ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 32 of file chain_spec_impl.hpp.

outcome::result< primitives::BlockId > kagome::application::ChainSpecImpl::parseBlockId ( const std::string_view  block_id_str) const
private

Definition at line 178 of file chain_spec_impl.cpp.

const std::map<std::string, std::string>& kagome::application::ChainSpecImpl::properties ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 57 of file chain_spec_impl.hpp.

const std::string& kagome::application::ChainSpecImpl::protocolId ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 53 of file chain_spec_impl.hpp.

const std::vector<std::pair<std::string, size_t> >& kagome::application::ChainSpecImpl::telemetryEndpoints ( ) const
inlineoverridevirtual

Implements kagome::application::ChainSpec.

Definition at line 48 of file chain_spec_impl.hpp.

Member Data Documentation

std::set<primitives::BlockHash> kagome::application::ChainSpecImpl::bad_blocks_
private

Definition at line 131 of file chain_spec_impl.hpp.

std::vector<libp2p::multi::Multiaddress> kagome::application::ChainSpecImpl::boot_nodes_
private

Definition at line 126 of file chain_spec_impl.hpp.

std::string kagome::application::ChainSpecImpl::chain_type_
private

Definition at line 124 of file chain_spec_impl.hpp.

ChildrenDefaultRawData kagome::application::ChainSpecImpl::children_default_
private

Definition at line 135 of file chain_spec_impl.hpp.

std::string kagome::application::ChainSpecImpl::config_path_
private

Definition at line 125 of file chain_spec_impl.hpp.

std::optional<std::string> kagome::application::ChainSpecImpl::consensus_engine_
private

Definition at line 132 of file chain_spec_impl.hpp.

std::set<primitives::BlockHash> kagome::application::ChainSpecImpl::fork_blocks_
private

Definition at line 130 of file chain_spec_impl.hpp.

GenesisRawData kagome::application::ChainSpecImpl::genesis_
private

Definition at line 134 of file chain_spec_impl.hpp.

std::string kagome::application::ChainSpecImpl::id_
private

Definition at line 123 of file chain_spec_impl.hpp.

std::shared_ptr<primitives::CodeSubstituteBlockIds> kagome::application::ChainSpecImpl::known_code_substitutes_
private

Definition at line 133 of file chain_spec_impl.hpp.

log::Logger kagome::application::ChainSpecImpl::log_ = log::createLogger("chain_spec", "kagome")
private

Definition at line 136 of file chain_spec_impl.hpp.

std::string kagome::application::ChainSpecImpl::name_
private

Definition at line 122 of file chain_spec_impl.hpp.

std::map<std::string, std::string> kagome::application::ChainSpecImpl::properties_
private

Definition at line 129 of file chain_spec_impl.hpp.

std::string kagome::application::ChainSpecImpl::protocol_id_ {"sup"}
private

Definition at line 128 of file chain_spec_impl.hpp.

std::vector<std::pair<std::string, size_t> > kagome::application::ChainSpecImpl::telemetry_endpoints_
private

Definition at line 127 of file chain_spec_impl.hpp.


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