6 #ifndef KAGOME_PARACHAIN_VALIDATOR_SIGNER_HPP 7 #define KAGOME_PARACHAIN_VALIDATOR_SIGNER_HPP 25 constexpr std::array<uint8_t, 4> kMagic{
'B',
'K',
'N',
'G'};
26 return std::make_tuple(
27 kMagic, static_cast<uint8_t>(v.which()),
candidateHash(hasher, v));
34 static outcome::result<SigningContext>
make(
35 const std::shared_ptr<runtime::ParachainHost> ¶chain_api,
42 return scale::encode(std::tie(
signable, *
this)).value();
58 std::shared_ptr<crypto::Sr25519Keypair> keypair,
59 std::shared_ptr<crypto::Hasher> hasher,
60 std::shared_ptr<crypto::Sr25519Provider> sr25519_provider);
64 outcome::result<network::Signed<T>>
sign(T payload)
const {
65 auto data = context_.signable(*hasher_, payload);
66 OUTCOME_TRY(signature, sr25519_provider_->sign(*keypair_, data));
83 std::shared_ptr<crypto::Sr25519Keypair>
keypair_;
92 std::shared_ptr<runtime::ParachainHost> parachain_api,
93 std::shared_ptr<crypto::SessionKeys> session_keys,
94 std::shared_ptr<crypto::Hasher> hasher,
95 std::shared_ptr<crypto::Sr25519Provider> sr25519_provider);
98 outcome::result<std::optional<ValidatorSigner>> at(
109 #endif // KAGOME_PARACHAIN_VALIDATOR_SIGNER_HPP network::ValidatorIndex ValidatorIndex
std::shared_ptr< crypto::Sr25519Keypair > keypair_
runtime::SessionIndex session_index
Current session index.
std::shared_ptr< crypto::Sr25519Provider > sr25519_provider_
Payload signed by validator.
ValidatorIndex validator_index_
boost::variant< Dummy, CommittedCandidateReceipt, primitives::BlockHash > CandidateState
std::shared_ptr< crypto::Hasher > hasher_
auto signable(const crypto::Hasher &hasher, const T &payload) const
Make signable message for payload.
std::shared_ptr< runtime::ParachainHost > parachain_api_
std::shared_ptr< crypto::SessionKeys > session_keys_
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< crypto::Sr25519Provider > sr25519_provider_
static outcome::result< SigningContext > make(const std::shared_ptr< runtime::ParachainHost > ¶chain_api, const primitives::BlockHash &relay_parent)
Make signing context for given block.
Signs payload with signing context and validator keypair.
static auto toSignable(const crypto::Hasher &hasher, const network::CandidateState &v)
outcome::result< network::Signed< T > > sign(T payload) const
Sign payload.
CandidateHash candidateHash(const crypto::Hasher &hasher, const CandidateReceipt &receipt)
A type returned by runtime with current session index and a parent hash.
primitives::BlockHash relay_parent
Hash of the parent.
static auto & toSignable(const crypto::Hasher &, const scale::BitVec &v)
Creates validator signer.