9 #include "scale/scale.hpp" 14 const std::shared_ptr<crypto::Ed25519Keypair> &keypair,
15 std::shared_ptr<kagome::crypto::Ed25519Provider> ed_provider,
17 std::shared_ptr<VoterSet> voter_set)
28 auto signature =
ed_provider_->sign(*keypair_.get(), payload).value();
29 return {{.message = std::move(vote),
30 .signature = signature,
31 .id = keypair_->public_key}};
38 auto verifying_result =
40 bool result = verifying_result.has_value() and verifying_result.value();
41 #ifndef NDEBUG // proves really useful for debugging voter set and round number 45 for (
auto n = number - 100; n < number + 100; n++) {
47 auto payload = scale::encode(vote.
message, n,
id).value();
48 auto verifying_result =
50 if (verifying_result.has_value() and verifying_result.value()) {
52 "Correct set id and number are {} {}, actual are {} {}",
62 SL_DEBUG(
logger,
"Failed to find correct set id");
84 return sign(primary_propose);
94 return sign(precommit);
bool verifyPrevote(const SignedMessage &prevote) const override
bool verify(const SignedMessage &vote, RoundNumber number) const
std::optional< SignedMessage > sign(Vote vote) const
std::shared_ptr< VoterSet > voter_set_
boost::variant< Prevote, Precommit, PrimaryPropose > Vote
Note: order of types in variant matters.
bool verifyPrecommit(const SignedMessage &precommit) const override
std::optional< SignedMessage > signPrimaryPropose(const PrimaryPropose &primary_propose) const override
const RoundNumber round_number_
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)
Logger createLogger(const std::string &tag)
std::shared_ptr< crypto::Ed25519Provider > ed_provider_
std::optional< SignedMessage > signPrecommit(const Precommit &precommit) const override