6 #ifndef KAGOME_CORE_PRIMITIVES_DIGEST 7 #define KAGOME_CORE_PRIMITIVES_DIGEST 9 #include <boost/variant.hpp> 18 #include "scale/scale.hpp" 60 boost::variant<Unused<0>,
68 boost::variant<Unused<0>,
79 static outcome::result<DecodedConsensusMessage>
create(
82 OUTCOME_TRY(payload, scale::decode<BabeDigest>(data));
85 OUTCOME_TRY(payload, scale::decode<GrandpaDigest>(data));
88 OUTCOME_TRY(payload, scale::decode<UnsupportedDigest_POL1>(data));
91 OUTCOME_TRY(payload, scale::decode<UnsupportedDigest_BEEF>(data));
94 BOOST_ASSERT_MSG(
false,
"Invalid consensus engine id");
95 BOOST_UNREACHABLE_RETURN({})
100 return boost::relaxed_get<BabeDigest>(digest);
103 template <
typename T>
106 && boost::get<T>(&asBabeDigest()) !=
nullptr;
111 return boost::relaxed_get<GrandpaDigest>(digest);
114 template <
typename T>
117 && boost::get<T>(&asGrandpaDigest()) !=
nullptr;
141 if constexpr (std::is_same_v<A, NextEpochData>
142 or std::is_same_v<A, NextConfigData>) {
145 }
else if constexpr (std::is_same_v<A, ScheduledChange>
146 or std::is_same_v<A, ForcedChange>
147 or std::is_same_v<A, OnDisabled>
148 or std::is_same_v<A, Pause>
149 or std::is_same_v<A, Resume>) {
153 BOOST_UNREACHABLE_RETURN();
158 outcome::result<DecodedConsensusMessage>
decode()
const {
198 #endif // KAGOME_CORE_PRIMITIVES_DIGEST
Class represents arbitrary (including empty) byte buffer.
bool isBabeDigestOf() const
boost::variant< Unused< 0 >, ScheduledChange, ForcedChange, OnDisabled, Pause, Resume > GrandpaDigest
https://github.com/paritytech/substrate/blob/polkadot-v0.9.8/primitives/finality-grandpa/src/lib.rs#L92
const GrandpaDigest & asGrandpaDigest() const
Runtime code or heap pages updated.
ConsensusEngineId consensus_engine_id
const auto kUnsupportedEngineId_POL1
const auto kUnsupportedEngineId_BEEF
Tagged< Empty, struct POL1 > UnsupportedDigest_POL1
const BabeDigest & asBabeDigest() const
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
static outcome::result< Blob< size_ > > fromString(std::string_view data)
constexpr size_t kMaxValidatorsNumber
boost::variant< Unused< 0 >, NextConfigDataV1 > NextConfigData
static outcome::result< DecodedConsensusMessage > create(ConsensusEngineId engine_id, const common::Buffer &data)
boost::variant< Other, Unused< 1 >, Unused< 2 >, Unused< 3 >, Consensus, Seal, PreRuntime, Unused< 7 >, RuntimeEnvironmentUpdated > DigestItem
common::SLBuffer< consensus::kMaxValidatorsNumber *1024 > data
const auto kGrandpaEngineId
boost::variant< Unused< 0 >, NextEpochData, OnDisabled, NextConfigData > BabeDigest
https://github.com/paritytech/substrate/blob/polkadot-v0.9.8/primitives/consensus/babe/src/lib.rs#L130
bool isGrandpaDigestOf() const
outcome::result< DecodedConsensusMessage > decode() const
ConsensusEngineId consensus_engine_id