mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
Slash and prove membership of prior sessions (#2970)
* skeleton for tracking historical sessions * refactor OpaqueKeys * some more skeleton work * adjust session to new OpaqueKeys API * further refactoring of key-type-ids * session gets validator ID parameter * run up against compiler * tweak staking to support new session changes * first run at child storage for deduplication * Make session use `AccountId` as `ValidatorId` * run up against child trie issues * switch to using normal trie but with a fixed prefix * clear out some println * add dedup test * flesh out historical module more * introduce ExposureOf for staking * test the historical module * WASM compiles * tests all compile * do some mock change * fix bulk of tests * fix staking tests * test obsolecence mechanic * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * some more style nits * a couple more nits * tweak tries * fix typo thie -> this
This commit is contained in:
committed by
GitHub
parent
bb7ff32e77
commit
7df8e52cfe
@@ -126,6 +126,29 @@ pub trait VerifySeal<Header, Author> {
|
||||
fn verify_seal(header: &Header) -> Result<Option<Author>, &'static str>;
|
||||
}
|
||||
|
||||
/// Something which can compute and check proofs of
|
||||
/// a historical key owner and return full identification data of that
|
||||
/// key owner.
|
||||
pub trait KeyOwnerProofSystem<Key> {
|
||||
/// The proof of membership itself.
|
||||
type Proof: Codec;
|
||||
/// The full identification of a key owner.
|
||||
type FullIdentification: Codec;
|
||||
|
||||
/// Prove membership of a key owner in the current block-state.
|
||||
///
|
||||
/// This should typically only be called off-chain, since it may be
|
||||
/// computationally heavy.
|
||||
///
|
||||
/// Returns `Some` iff the key owner referred to by the given `key` is a
|
||||
/// member of the current set.
|
||||
fn prove(key: Key) -> Option<Self::Proof>;
|
||||
|
||||
/// Check a proof of membership on-chain. Return `Some` iff the proof is
|
||||
/// valid and recent enough to check.
|
||||
fn check_proof(key: Key, proof: Self::Proof) -> Option<Self::FullIdentification>;
|
||||
}
|
||||
|
||||
/// Handler for when some currency "account" decreased in balance for
|
||||
/// some reason.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user