Add documentation to public structs/functions in sc_tendermint

This commit is contained in:
Luke Parker 2022-10-30 12:27:16 -04:00
parent c4976ff97d
commit 8f065533dc
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
5 changed files with 12 additions and 0 deletions

View file

@ -62,12 +62,14 @@ struct ActiveAuthority<T: TendermintValidator> {
announce: T::Network,
}
/// Tendermint Authority. Participates in the block proposal and voting process.
pub struct TendermintAuthority<T: TendermintValidator> {
import: TendermintImport<T>,
active: Option<ActiveAuthority<T>>,
}
impl<T: TendermintValidator> TendermintAuthority<T> {
/// Create a new TendermintAuthority.
pub fn new(import: TendermintImport<T>) -> Self {
Self { import, active: None }
}

View file

@ -67,6 +67,12 @@ where
}
}
/// Tendermint's Select Chain, where the best chain is defined as the most recently finalized
/// block.
///
/// leaves panics on call due to not being applicable under Tendermint. Any provided answer would
/// have conflicts best left unraised.
//
// SelectChain, while provided by Substrate and part of PartialComponents, isn't used by Substrate
// It's common between various block-production/finality crates, yet Substrate as a system doesn't
// rely on it, which is good, because its definition is explicitly incompatible with Tendermint

View file

@ -102,6 +102,8 @@ pub trait TendermintValidator: TendermintClient {
pub type TendermintImportQueue<Block, Transaction> = BasicQueue<Block, Transaction>;
/// Create an import queue, additionally returning the Tendermint Import object iself, enabling
/// creating an author later as well.
pub fn import_queue<T: TendermintValidator>(
spawner: &impl sp_core::traits::SpawnEssentialNamed,
client: Arc<T::Client>,

View file

@ -22,6 +22,7 @@ use crate::{
authority::TendermintAuthority,
};
/// Tendermint import handler.
pub struct TendermintImport<T: TendermintValidator> {
_ta: PhantomData<T>,

View file

@ -79,6 +79,7 @@ impl<T: TendermintClient> Deref for Refresh<T> {
}
}
/// Tendermint validators observer, providing data on the active validators.
pub struct TendermintValidators<T: TendermintClient>(Refresh<T>);
impl<T: TendermintClient> TendermintValidators<T> {