Kagome
Polkadot Runtime Engine in C++17
grandpa_api.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_RUNTIME_GRANDPAAPI
7 #define KAGOME_RUNTIME_GRANDPAAPI
8 
9 #include <optional>
10 
11 #include "common/buffer.hpp"
12 #include "outcome/outcome.hpp"
13 #include "primitives/authority.hpp"
14 #include "primitives/block_id.hpp"
15 #include "primitives/common.hpp"
16 #include "primitives/digest.hpp"
19 
20 namespace kagome::runtime {
21  // https://github.com/paritytech/substrate/blob/8bf08ca63491961fafe6adf414a7411cb3953dcf/core/finality-grandpa/primitives/src/lib.rs#L56
22 
26  class GrandpaApi {
27  protected:
34 
35  public:
36  virtual ~GrandpaApi() = default;
44  virtual outcome::result<std::optional<ScheduledChange>> pending_change(
45  primitives::BlockHash const &block, const Digest &digest) = 0;
46 
55  virtual outcome::result<std::optional<ForcedChange>> forced_change(
56  primitives::BlockHash const &block, const Digest &digest) = 0;
57 
62  virtual outcome::result<AuthorityList> authorities(
63  const primitives::BlockId &block_id) = 0;
64 
68  virtual outcome::result<primitives::AuthoritySetId> current_set_id(
69  const primitives::BlockHash &block) = 0;
70  };
71 
72 } // namespace kagome::runtime
73 
74 #endif // KAGOME_RUNTIME_GRANDPAAPI
primitives::BlockNumber BlockNumber
Definition: grandpa_api.hpp:30
common::SLVector< DigestItem, kMaxItemsInDigest > Digest
Definition: digest.hpp:194
virtual outcome::result< std::optional< ScheduledChange > > pending_change(primitives::BlockHash const &block, const Digest &digest)=0
calls Grandpa_pending_change runtime api function, which checks a digest for pending changes...
interface for Grandpa runtime functions
Definition: grandpa_api.hpp:26
virtual ~GrandpaApi()=default
primitives::BlockId BlockId
Definition: grandpa_api.hpp:33
uint32_t BlockNumber
Definition: common.hpp:18
virtual outcome::result< primitives::AuthoritySetId > current_set_id(const primitives::BlockHash &block)=0
virtual outcome::result< std::optional< ForcedChange > > forced_change(primitives::BlockHash const &block, const Digest &digest)=0
calls Grandpa_forced_change runtime api function which checks a digest for forced changes ...
common::SLVector< Authority, consensus::kMaxValidatorsNumber > AuthorityList
Definition: authority.hpp:52
virtual outcome::result< AuthorityList > authorities(const primitives::BlockId &block_id)=0
calls Grandpa_authorities runtime api function
boost::variant< BlockHash, BlockNumber > BlockId
Block id is the variant over BlockHash and BlockNumber.
Definition: block_id.hpp:18