Kagome
Polkadot Runtime Engine in C++17
vote_crypto_provider_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_CONSENSUS_GRANDPA_IMPL_VOTE_CRYPTO_PROVIDER_IMPL_HPP
7 #define KAGOME_CORE_CONSENSUS_GRANDPA_IMPL_VOTE_CRYPTO_PROVIDER_IMPL_HPP
8 
12 
14 
16  public:
17  ~VoteCryptoProviderImpl() override = default;
18 
20  const std::shared_ptr<crypto::Ed25519Keypair> &keypair,
21  std::shared_ptr<crypto::Ed25519Provider> ed_provider,
22  RoundNumber round_number,
23  std::shared_ptr<VoterSet> voter_set);
24 
26  const SignedMessage &primary_propose) const override;
27  bool verifyPrevote(const SignedMessage &prevote) const override;
28  bool verifyPrecommit(const SignedMessage &precommit) const override;
29 
30  std::optional<SignedMessage> signPrimaryPropose(
31  const PrimaryPropose &primary_propose) const override;
32  std::optional<SignedMessage> signPrevote(
33  const Prevote &prevote) const override;
34  std::optional<SignedMessage> signPrecommit(
35  const Precommit &precommit) const override;
36 
37  private:
38  std::optional<SignedMessage> sign(Vote vote) const;
39  bool verify(const SignedMessage &vote, RoundNumber number) const;
40 
41  const std::shared_ptr<crypto::Ed25519Keypair> &keypair_;
42  std::shared_ptr<crypto::Ed25519Provider> ed_provider_;
44  std::shared_ptr<VoterSet> voter_set_;
45  };
46 
47 } // namespace kagome::consensus::grandpa
48 
49 #endif // KAGOME_CORE_CONSENSUS_GRANDPA_IMPL_VOTE_CRYPTO_PROVIDER_IMPL_HPP
bool verifyPrevote(const SignedMessage &prevote) const override
bool verify(const SignedMessage &vote, RoundNumber number) const
std::optional< SignedMessage > sign(Vote vote) const
boost::variant< Prevote, Precommit, PrimaryPropose > Vote
Note: order of types in variant matters.
Definition: structs.hpp:38
bool verifyPrecommit(const SignedMessage &precommit) const override
std::optional< SignedMessage > signPrimaryPropose(const PrimaryPropose &primary_propose) const override
bool verifyPrimaryPropose(const SignedMessage &primary_propose) const override
std::optional< SignedMessage > signPrevote(const Prevote &prevote) const override
const std::shared_ptr< crypto::Ed25519Keypair > & keypair_
VoteCryptoProviderImpl(const std::shared_ptr< crypto::Ed25519Keypair > &keypair, std::shared_ptr< crypto::Ed25519Provider > ed_provider, RoundNumber round_number, std::shared_ptr< VoterSet > voter_set)
std::shared_ptr< crypto::Ed25519Provider > ed_provider_
std::optional< SignedMessage > signPrecommit(const Precommit &precommit) const override