6 #ifndef KAGOME_CONSENSUS_GRANDPA_STRUCTS_ 7 #define KAGOME_CONSENSUS_GRANDPA_STRUCTS_ 9 #include <boost/asio/steady_timer.hpp> 10 #include <boost/variant.hpp> 22 #include "scale/scale.hpp" 27 using Timer = boost::asio::basic_waitable_timer<std::chrono::steady_clock>;
46 return visit_in_place(message,
47 [](
const auto &vote) {
return vote.number; });
51 return visit_in_place(message,
52 [](
const auto &vote) {
return vote.hash; });
56 return visit_in_place(message, [](
const auto &vote) {
63 return message.type() ==
typeid(T);
77 typename = std::enable_if_t<Stream::is_encoder_stream>>
83 typename = std::enable_if_t<Stream::is_decoder_stream>>
88 template <
typename Message>
95 using VoteVariant = boost::variant<SignedMessage, EquivocatorySignedMessage>;
99 template <
typename Message>
110 using SignedMessage::SignedMessage;
114 typename = std::enable_if_t<Stream::is_encoder_stream>>
116 assert(signed_msg.template is<Prevote>());
117 return s << boost::strict_get<Prevote>(signed_msg.
message)
122 typename = std::enable_if_t<Stream::is_decoder_stream>>
124 signed_msg.
message = Prevote{};
125 return s >> boost::strict_get<Prevote>(signed_msg.
message)
130 using SignedMessage::SignedMessage;
134 typename = std::enable_if_t<Stream::is_encoder_stream>>
136 assert(signed_msg.template is<Precommit>());
137 return s << boost::strict_get<Precommit>(signed_msg.
message)
142 typename = std::enable_if_t<Stream::is_decoder_stream>>
144 signed_msg.
message = Precommit{};
145 return s >> boost::strict_get<Precommit>(signed_msg.
message)
156 std::vector<SignedPrecommit> items{};
182 uint64_t prevote = 0;
183 uint64_t precommit = 0;
198 std::vector<Precommit> precommits{};
200 std::vector<std::pair<Signature, Id>> auth_data{};
204 #endif // KAGOME_CONSENSUS_GRANDPA_STRUCTS_
boost::asio::basic_waitable_timer< std::chrono::steady_clock > Timer
A commit message which is an aggregate of precommits.
boost::variant< SignedMessage, EquivocatorySignedMessage > VoteVariant
primitives::BlockNumber target_number
Id id
The identity of the equivocator.
Proof of an equivocation (double-vote) in a given round.
boost::variant< Prevote, Precommit, PrimaryPropose > Vote
Note: order of types in variant matters.
primitives::detail::BlockInfoT< struct PrecommitTag > Precommit
primitives::BlockHash target_hash
primitives::BlockInfo BlockInfo
crypto::Ed25519PublicKey Id
crypto::Ed25519Signature Signature
primitives::BlockNumber BlockNumber
BlockHash getBlockHash() const
bool operator==(const SignedMessage &rhs) const
BlockNumber getBlockNumber() const
GrandpaJustification justification
std::pair< SignedMessage, SignedMessage > EquivocatorySignedMessage
BlockInfo getBlockInfo() const
Equivocated< Message > proof
libp2p::connection::Stream Stream
detail::BlockInfoT< struct BlockInfoTag > BlockInfo
primitives::detail::BlockInfoT< struct PrevoteTag > Prevote
Stream & operator<<(Stream &s, const SignedMessage &signed_msg)
bool operator!=(const SignedMessage &rhs) const
Stream & operator>>(Stream &s, SignedMessage &signed_msg)
RoundNumber round
The round number equivocated in.