High-Level Documentation (#565)

* High level docs - start.

* Clean up README

* Start adding details to high level docs

* More docs on the header sync pallet

* Testing scenarios document.

* Add some scenarios.

* Add multi-sig scenario.

* Start writing about message dispatch pallet

* Move content from old README into PoA specific doc

* Apply suggestions from code review

Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>

* GRANDPA for consistency.

* Describe scenario steps.

* WiP

* Add notes about block production and forks

* Update.

* Add sequence diagram for Millau to Rialto transfer

* Clean up header sync pallet overview

* Remove leftover example code

* Clean up testing scenarios and amend sequence diagram.

* Linking docs.

* Add some more docs.

* Do a bit of cleanup on the high-level docs

* Clean up the testing scenario

* Fix typos in flow charts

* Fix small typo

* Fix indentation of Rust block

* Another attempt at rendering block correctly

* TIL about lazy list numbering in Markdown

* Add list numbers across sections

* Start counting from correct number

* Update README to use correct path to local scripts

* Wrap ASCII art in code block

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>
This commit is contained in:
Hernando Castano
2020-12-14 18:44:19 -05:00
committed by Bastian Köcher
parent 5a790c9874
commit d47658c92e
8 changed files with 283 additions and 188 deletions
+8 -8
View File
@@ -21,7 +21,7 @@
//! It has a simple interface for achieving this. First it can import headers to the runtime
//! storage. During this it will check the validity of the headers and ensure they don't conflict
//! with any existing headers (e.g they're on a different finalized chain). Secondly it can finalize
//! an already imported header (and its ancestors) given a valid Grandpa justification.
//! an already imported header (and its ancestors) given a valid GRANDPA justification.
//!
//! With these two functions the pallet is able to form a "source of truth" for what headers have
//! been finalized on a given Substrate chain. This can be a useful source of info for other
@@ -94,17 +94,17 @@ decl_storage! {
/// Hash of the best finalized header.
BestFinalized: BridgedBlockHash<T>;
/// The set of header IDs (number, hash) which enact an authority set change and therefore
/// require a Grandpa justification.
/// require a GRANDPA justification.
RequiresJustification: map hasher(identity) BridgedBlockHash<T> => BridgedBlockNumber<T>;
/// Headers which have been imported into the pallet.
ImportedHeaders: map hasher(identity) BridgedBlockHash<T> => Option<ImportedHeader<BridgedHeader<T>>>;
/// The current Grandpa Authority set.
/// The current GRANDPA Authority set.
CurrentAuthoritySet: AuthoritySet;
/// The next scheduled authority set change for a given fork.
///
/// The fork is indicated by the header which _signals_ the change (key in the mapping).
/// Note that this is different than a header which _enacts_ a change.
// Grandpa doesn't require there to always be a pending change. In fact, most of the time
// GRANDPA doesn't require there to always be a pending change. In fact, most of the time
// there will be no pending change available.
NextScheduledChange: map hasher(identity) BridgedBlockHash<T> => Option<ScheduledChange<BridgedBlockNumber<T>>>;
/// Optional pallet owner.
@@ -448,10 +448,10 @@ pub trait BridgeStorage {
/// Returns None if it is not known to the pallet.
fn header_by_hash(&self, hash: <Self::Header as HeaderT>::Hash) -> Option<ImportedHeader<Self::Header>>;
/// Get the current Grandpa authority set.
/// Get the current GRANDPA authority set.
fn current_authority_set(&self) -> AuthoritySet;
/// Update the current Grandpa authority set.
/// Update the current GRANDPA authority set.
///
/// Should only be updated when a scheduled change has been triggered.
fn update_current_authority_set(&self, new_set: AuthoritySet);
@@ -462,13 +462,13 @@ pub trait BridgeStorage {
#[allow(clippy::result_unit_err)]
fn enact_authority_set(&mut self, signal_hash: <Self::Header as HeaderT>::Hash) -> Result<(), ()>;
/// Get the next scheduled Grandpa authority set change.
/// Get the next scheduled GRANDPA authority set change.
fn scheduled_set_change(
&self,
signal_hash: <Self::Header as HeaderT>::Hash,
) -> Option<ScheduledChange<<Self::Header as HeaderT>::Number>>;
/// Schedule a Grandpa authority set change in the future.
/// Schedule a GRANDPA authority set change in the future.
///
/// Takes the hash of the header which scheduled this particular change.
fn schedule_next_set_change(