Kagome
Polkadot Runtime Engine in C++17
|
Namespaces | |
detail | |
reputation | |
Typedefs | |
using | Stream = libp2p::connection::Stream |
using | Protocol = libp2p::peer::Protocol |
using | Protocols = libp2p::StreamProtocols |
using | PeerId = libp2p::peer::PeerId |
using | PeerInfo = libp2p::peer::PeerInfo |
using | Host = libp2p::Host |
using | ProtocolName = std::string |
using | Reputation = std::int32_t |
using | Signature = crypto::Sr25519Signature |
using | ParachainId = uint32_t |
using | CollatorPublicKey = crypto::Sr25519PublicKey |
using | ValidatorIndex = uint32_t |
using | UpwardMessage = common::Buffer |
using | ParachainRuntime = common::Buffer |
using | HeadData = common::Buffer |
using | CandidateHash = primitives::BlockHash |
using | ChunkProof = std::vector< common::Buffer > |
using | Dummy = std::tuple<> |
NU element. More... | |
using | ViewUpdate = Dummy |
ViewUpdate message. Maybe will be implemented later. More... | |
using | ReqCollationResponseData = boost::variant< CollationResponse > |
using | CandidateState = boost::variant< Dummy, CommittedCandidateReceipt, primitives::BlockHash > |
using | SignedBitfield = Signed< scale::BitVec > |
Signed availability bitfield. More... | |
using | CollationMessage = boost::variant< CollatorDeclaration, CollatorAdvertisement, Dummy, Dummy, Seconded > |
using | ProtocolMessage = boost::variant< CollationMessage > |
using | WireMessage = boost::variant< Dummy, ProtocolMessage, ViewUpdate > |
using | GrandpaMessage = boost::variant< GrandpaVote, FullCommitMessage, GrandpaNeighborMessage, CatchUpRequest, CatchUpResponse > |
Enumerations | |
enum | AdaptersError : int { AdaptersError::EMPTY_DATA = 1, AdaptersError::DATA_SIZE_CORRUPTED, AdaptersError::PARSE_FAILED, AdaptersError::UNEXPECTED_VARIANT, AdaptersError::CAST_FAILED } |
interface adapters errors More... | |
enum | PeerType { PeerType::PEER_TYPE_IN = 0, PeerType::PEER_TYPE_OUT } |
enum | ProtocolError { ProtocolError::GONE = 1, ProtocolError::PROTOCOL_NOT_IMPLEMENTED, ProtocolError::CAN_NOT_CREATE_STATUS, ProtocolError::NODE_NOT_SYNCHRONIZED_YET, ProtocolError::GENESIS_NO_MATCH, ProtocolError::HANDSHAKE_ERROR } |
enum | BlockAttribute : uint8_t { BlockAttribute::HEADER = 1u, BlockAttribute::BODY = 1u << 1u, BlockAttribute::RECEIPT = 1u << 2u, BlockAttribute::MESSAGE_QUEUE = 1u << 3u, BlockAttribute::JUSTIFICATION = 1u << 4u } |
enum | Direction : uint8_t { Direction::ASCENDING = 0, Direction::DESCENDING = 1 } |
Functions | |
template<typename T > | |
std::vector< uint8_t >::iterator | appendToVec (const T &msg, std::vector< uint8_t > &out, std::vector< uint8_t >::iterator loaded) |
void | streamReadBuffer (libp2p::StreamAndProtocol &result) |
void | streamReadBuffer (libp2p::StreamAndProtocolOrError &result) |
KAGOME_DEFINE_CACHE (BlockAnnounceProtocol) | |
KAGOME_DECLARE_CACHE (BlockAnnounceProtocol, KAGOME_CACHE_UNIT(BlockAnnounce)) | |
KAGOME_DEFINE_CACHE (GrandpaProtocol) | |
KAGOME_DECLARE_CACHE (GrandpaProtocol, KAGOME_CACHE_UNIT(GrandpaMessage)) | |
KAGOME_DEFINE_CACHE (PropagateTransactionsProtocol) | |
KAGOME_DECLARE_CACHE (PropagateTransactionsProtocol, KAGOME_CACHE_UNIT(PropagatedExtrinsics)) | |
constexpr BlockAttributes | operator| (const BlockAttribute &lhs, const BlockAttribute &rhs) |
constexpr BlockAttributes | operator~ (const BlockAttribute &attribute) |
template<class Stream , typename = std::enable_if_t<Stream::is_encoder_stream>> | |
Stream & | operator<< (Stream &s, const BlockAttributes &v) |
outputs object of type BlockAttributes to stream More... | |
template<class Stream , typename = std::enable_if_t<Stream::is_decoder_stream>> | |
Stream & | operator>> (Stream &s, BlockAttributes &attributes) |
CandidateHash | candidateHash (const crypto::Hasher &hasher, const CandidateReceipt &receipt) |
CandidateHash | candidateHash (const crypto::Hasher &hasher, const CommittedCandidateReceipt &receipt) |
CandidateHash | candidateHash (const crypto::Hasher &hasher, const CandidateState &statement) |
SCALE_EMPTY_CODER (NoData) | |
bool | operator== (const NoData &lhs, const NoData &rhs) |
compares two Status instances More... | |
bool | operator== (const Roles &lhs, const Roles &rhs) |
compares two Roles instances More... | |
template<class Stream , typename = std::enable_if_t<Stream::is_encoder_stream>> | |
Stream & | operator<< (Stream &s, const Roles &v) |
outputs object of type Roles to stream More... | |
template<class Stream , typename = std::enable_if_t<Stream::is_decoder_stream>> | |
Stream & | operator>> (Stream &s, Roles &v) |
decodes object of type Roles from stream More... | |
template<class Stream , typename = std::enable_if_t<Stream::is_encoder_stream>> | |
Stream & | operator<< (Stream &s, const Status &v) |
outputs object of type Status to stream More... | |
template<class Stream , typename = std::enable_if_t<Stream::is_decoder_stream>> | |
Stream & | operator>> (Stream &s, Status &v) |
decodes object of type Status from stream More... | |
Variables | |
static constexpr uint32_t | CURRENT_VERSION = 6 |
Current protocol version. More... | |
static constexpr uint32_t | MIN_VERSION = 3 |
Lowest version we support. More... | |
const libp2p::peer::Protocol | kStateProtocol = "/{}/state/2" |
const libp2p::peer::Protocol | kSyncProtocol = "/{}/sync/2" |
const libp2p::peer::Protocol | kPropagateTransactionsProtocol |
const libp2p::peer::Protocol | kBlockAnnouncesProtocol |
const libp2p::peer::Protocol | kGrandpaProtocolLegacy = "/paritytech/grandpa/1" |
const libp2p::peer::Protocol | kGrandpaProtocol = "/{}/grandpa/1" |
const libp2p::peer::Protocol | kCollationProtocol {"/polkadot/collation/1"} |
const libp2p::peer::Protocol | kValidationProtocol {"/polkadot/validation/1"} |
const libp2p::peer::Protocol | kReqCollationProtocol |
static constexpr auto | kResponsesCacheCapacity = 500 |
static constexpr auto | kResponsesCacheExpirationTimeout |
static constexpr auto | kMaxCacheEntriesPerPeer = 5 |
constexpr size_t | kMaxBlocksInResponse = 256 |
Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
round_number_, Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
struct kagome::network::BlocksResponse |
Response to the BlockRequest
Definition at line 19 of file blocks_response.hpp.
Class Members | ||
---|---|---|
SLVector< BlockData, kMaxBlocksInResponse > |
blocks |
struct kagome::network::CollatorState |
Definition at line 25 of file peer_manager.hpp.
Class Members | ||
---|---|---|
unordered_set< BlockHash > | advertisements | |
CollatorPublicKey | collator_id | |
ParachainId | parachain_id |
struct kagome::network::KeyValueStateEntry |
A key value state.
Definition at line 21 of file state_response.hpp.
Class Members | ||
---|---|---|
bool | complete | Set to true when there are no more keys to return. |
vector< StateEntry > | entries | A collection of keys-values. |
RootHash | state_root |
Root of for this level, empty length bytes if top level. |
struct kagome::network::Message |
Definition at line 21 of file messages.hpp.
Class Members | ||
---|---|---|
typedef RW | ReadWriter |
Class Members | ||
---|---|---|
T | data |
struct kagome::network::NoData |
Is the structure without any data.
Definition at line 16 of file no_data_message.hpp.
struct kagome::network::NoSink |
NoSink is used to break the MessageReadWriter ancestor execute sequence.
Definition at line 22 of file message_read_writer.hpp.
struct kagome::network::ParachainState |
Definition at line 40 of file peer_manager.hpp.
Class Members | ||
---|---|---|
unordered_map< BlockHash, bool > | our_view |
struct kagome::network::PeerDescriptor |
Definition at line 47 of file peer_manager_impl.hpp.
Class Members | ||
---|---|---|
PeerType | peer_type | |
TimePoint | time_point |
struct kagome::network::PeeringConfig |
Definition at line 13 of file peering_config.hpp.
struct kagome::network::PeerState |
Definition at line 44 of file peer_manager.hpp.
Class Members | ||
---|---|---|
BlockInfo | best_block | |
optional< CollatorState > | collator_state | |
BlockNumber | last_finalized | |
Roles | roles | |
optional< RoundNumber > | round_number | |
optional< VoterSetId > | set_id | |
TimePoint | time |
struct kagome::network::PendingCollation |
Definition at line 31 of file peer_manager.hpp.
Class Members | ||
---|---|---|
ParachainId | para_id | |
PeerId const & | peer_id | |
BlockHash const & | relay_parent |
struct kagome::network::ProtobufMessageAdapter |
Definition at line 21 of file protobuf.hpp.
struct kagome::network::Roles.flags |
struct kagome::network::StateEntry |
A key-value pair.
Definition at line 15 of file state_response.hpp.
Class Members | ||
---|---|---|
Buffer | key | |
Buffer | value |
struct kagome::network::StateResponse |
Response to the StateRequest
Definition at line 34 of file state_response.hpp.
Class Members | ||
---|---|---|
vector< KeyValueStateEntry > | entries |
A collection of keys-values states. Only populated if |
Buffer | proof |
If no_proof is false in request, this contains proof nodes. |
struct kagome::network::Status |
Is the structure to send to a new connected peer. It contains common information about current peer and used by the remote peer to detect the posibility of the correct communication with it.
Definition at line 26 of file status.hpp.
Class Members | ||
---|---|---|
BlockInfo | best_block |
Best block |
BlockHash | genesis_hash |
Genesis block hash. |
Roles | roles |
Supported roles. |
using kagome::network::CandidateHash = typedef primitives::BlockHash |
Definition at line 32 of file collator_messages.hpp.
using kagome::network::CandidateState = typedef boost::variant< Dummy, CommittedCandidateReceipt, primitives::BlockHash > |
Definition at line 202 of file collator_messages.hpp.
using kagome::network::ChunkProof = typedef std::vector<common::Buffer> |
Definition at line 33 of file collator_messages.hpp.
using kagome::network::CollationMessage = typedef boost::variant< CollatorDeclaration, CollatorAdvertisement, Dummy, Dummy, Seconded > |
Collator -> Validator and Validator -> Collator if statement message. Type of the appropriate message.
Definition at line 233 of file collator_messages.hpp.
using kagome::network::CollatorPublicKey = typedef crypto::Sr25519PublicKey |
Definition at line 27 of file collator_messages.hpp.
using kagome::network::Dummy = typedef std::tuple<> |
NU element.
Definition at line 51 of file collator_messages.hpp.
using kagome::network::GrandpaMessage = typedef boost::variant<GrandpaVote, FullCommitMessage, GrandpaNeighborMessage, CatchUpRequest, CatchUpResponse> |
Definition at line 91 of file grandpa_message.hpp.
using kagome::network::HeadData = typedef common::Buffer |
Definition at line 31 of file collator_messages.hpp.
using kagome::network::Host = typedef libp2p::Host |
Definition at line 28 of file protocol_base_impl.hpp.
using kagome::network::ParachainId = typedef uint32_t |
Definition at line 26 of file collator_messages.hpp.
using kagome::network::ParachainRuntime = typedef common::Buffer |
Definition at line 30 of file collator_messages.hpp.
typedef libp2p::peer::PeerId kagome::network::PeerId |
Definition at line 26 of file protocol_base_impl.hpp.
typedef libp2p::peer::PeerInfo kagome::network::PeerInfo |
Definition at line 27 of file protocol_base_impl.hpp.
typedef libp2p::peer::Protocol kagome::network::Protocol |
Definition at line 24 of file protocol_base_impl.hpp.
using kagome::network::ProtocolMessage = typedef boost::variant<CollationMessage > |
Collation protocol message.
Definition at line 240 of file collator_messages.hpp.
using kagome::network::ProtocolName = typedef std::string |
Definition at line 29 of file protocol_base_impl.hpp.
typedef libp2p::StreamProtocols kagome::network::Protocols |
Definition at line 25 of file protocol_base_impl.hpp.
typedef std::int32_t kagome::network::Reputation |
Definition at line 15 of file reputation_change.hpp.
using kagome::network::ReqCollationResponseData = typedef boost::variant<CollationResponse> |
Definition at line 142 of file collator_messages.hpp.
using kagome::network::Signature = typedef crypto::Sr25519Signature |
Definition at line 25 of file collator_messages.hpp.
using kagome::network::SignedBitfield = typedef Signed<scale::BitVec> |
Signed availability bitfield.
Definition at line 220 of file collator_messages.hpp.
typedef libp2p::connection::Stream kagome::network::Stream |
Definition at line 23 of file protocol_base_impl.hpp.
using kagome::network::UpwardMessage = typedef common::Buffer |
Definition at line 29 of file collator_messages.hpp.
using kagome::network::ValidatorIndex = typedef uint32_t |
Definition at line 28 of file collator_messages.hpp.
using kagome::network::ViewUpdate = typedef Dummy |
ViewUpdate message. Maybe will be implemented later.
Definition at line 54 of file collator_messages.hpp.
using kagome::network::WireMessage = typedef boost::variant<Dummy, ProtocolMessage, ViewUpdate > |
Common WireMessage that represents messages in NetworkBridge.
Definition at line 248 of file collator_messages.hpp.
|
strong |
interface adapters errors
Enumerator | |
---|---|
EMPTY_DATA | |
DATA_SIZE_CORRUPTED | |
PARSE_FAILED | |
UNEXPECTED_VARIANT | |
CAST_FAILED |
Definition at line 15 of file adapter_errors.hpp.
|
strong |
Masks of bits, combination of which shows, which fields are to be presented in the BlockResponse
Enumerator | |
---|---|
HEADER |
Include block header. |
BODY |
Include block body. |
RECEIPT |
Include block receipt. |
MESSAGE_QUEUE |
Include block message queue. |
JUSTIFICATION |
Include a justification for the block. |
Definition at line 21 of file block_attributes.hpp.
|
strong |
Direction, in which to retrieve the blocks
Enumerator | |
---|---|
ASCENDING |
from child to parent |
DESCENDING |
from parent to canonical child |
Definition at line 20 of file block_direction.hpp.
|
strong |
Enumerator | |
---|---|
PEER_TYPE_IN | |
PEER_TYPE_OUT |
Definition at line 45 of file peer_manager_impl.hpp.
|
strong |
Enumerator | |
---|---|
GONE | |
PROTOCOL_NOT_IMPLEMENTED | |
CAN_NOT_CREATE_STATUS | |
NODE_NOT_SYNCHRONIZED_YET | |
GENESIS_NO_MATCH | |
HANDSHAKE_ERROR |
Definition at line 13 of file protocol_error.hpp.
|
inline |
Definition at line 24 of file protobuf.hpp.
|
inline |
Definition at line 250 of file collator_messages.hpp.
|
inline |
Definition at line 255 of file collator_messages.hpp.
|
inline |
Definition at line 265 of file collator_messages.hpp.
kagome::network::KAGOME_DECLARE_CACHE | ( | BlockAnnounceProtocol | , |
KAGOME_CACHE_UNIT(BlockAnnounce) | |||
) |
kagome::network::KAGOME_DECLARE_CACHE | ( | GrandpaProtocol | , |
KAGOME_CACHE_UNIT(GrandpaMessage) | |||
) |
kagome::network::KAGOME_DECLARE_CACHE | ( | PropagateTransactionsProtocol | , |
KAGOME_CACHE_UNIT(PropagatedExtrinsics) | |||
) |
kagome::network::KAGOME_DEFINE_CACHE | ( | BlockAnnounceProtocol | ) |
kagome::network::KAGOME_DEFINE_CACHE | ( | PropagateTransactionsProtocol | ) |
kagome::network::KAGOME_DEFINE_CACHE | ( | GrandpaProtocol | ) |
Stream& kagome::network::operator<< | ( | Stream & | s, |
const Status & | v | ||
) |
outputs object of type Status to stream
Stream | output stream type |
s | stream reference |
v | value to output |
Definition at line 52 of file status.hpp.
Stream& kagome::network::operator<< | ( | Stream & | s, |
const BlockAttributes & | v | ||
) |
outputs object of type BlockAttributes to stream
Stream | output stream type |
s | stream reference |
v | value to output |
Definition at line 163 of file block_attributes.hpp.
compares two Status instances
lhs | first instance |
rhs | second instance |
Definition at line 25 of file no_data_message.hpp.
Stream& kagome::network::operator>> | ( | Stream & | s, |
Status & | v | ||
) |
decodes object of type Status from stream
Stream | input stream type |
s | stream reference |
v | value to decode |
Definition at line 66 of file status.hpp.
Stream& kagome::network::operator>> | ( | Stream & | s, |
BlockAttributes & | attributes | ||
) |
decodes object of type BlockAttributes from stream
Stream | input stream type |
s | stream reference |
v | value to decode |
Definition at line 176 of file block_attributes.hpp.
|
inline |
Definition at line 141 of file block_attributes.hpp.
|
inline |
Definition at line 148 of file block_attributes.hpp.
kagome::network::SCALE_EMPTY_CODER | ( | NoData | ) |
|
inline |
Wrap stream from setProtocolHandler
. Makes reading from stream buffered.
Definition at line 122 of file stream_read_buffer.hpp.
|
inline |
Wrap stream from newStream
. Makes reading from stream buffered.
Definition at line 132 of file stream_read_buffer.hpp.
|
static |
Current protocol version.
Definition at line 13 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kBlockAnnouncesProtocol |
Definition at line 21 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kCollationProtocol {"/polkadot/collation/1"} |
Definition at line 26 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kGrandpaProtocol = "/{}/grandpa/1" |
Definition at line 24 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kGrandpaProtocolLegacy = "/paritytech/grandpa/1" |
Definition at line 23 of file common.hpp.
constexpr size_t kagome::network::kMaxBlocksInResponse = 256 |
Definition at line 14 of file blocks_response.hpp.
|
static |
Definition at line 32 of file sync_protocol_impl.hpp.
const libp2p::peer::Protocol kagome::network::kPropagateTransactionsProtocol |
Definition at line 19 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kReqCollationProtocol |
Definition at line 28 of file common.hpp.
|
static |
Definition at line 29 of file sync_protocol_impl.hpp.
|
static |
Definition at line 30 of file sync_protocol_impl.hpp.
const libp2p::peer::Protocol kagome::network::kStateProtocol = "/{}/state/2" |
Definition at line 17 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kSyncProtocol = "/{}/sync/2" |
Definition at line 18 of file common.hpp.
const libp2p::peer::Protocol kagome::network::kValidationProtocol {"/polkadot/validation/1"} |
Definition at line 27 of file common.hpp.
|
static |
Lowest version we support.
Definition at line 15 of file common.hpp.