cumulus_client_consensus_relay_chain/lib.rs
1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Cumulus.
3// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
4
5// Cumulus is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9
10// Cumulus is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14
15// You should have received a copy of the GNU General Public License
16// along with Cumulus. If not, see <https://www.gnu.org/licenses/>.
17
18//! The relay-chain provided consensus algorithm for parachains.
19//!
20//! This is the simplest consensus algorithm you can use when developing a parachain. It is a
21//! permission-less consensus algorithm that doesn't require any staking or similar to join as a
22//! collator. In this algorithm the consensus is provided by the relay-chain. This works in the
23//! following way.
24//!
25//! 1. Each node that sees itself as a collator is free to build a parachain candidate.
26//!
27//! 2. This parachain candidate is send to the parachain validators that are part of the relay
28//! chain.
29//!
30//! 3. The parachain validators validate at most X different parachain candidates, where X is the
31//! total number of parachain validators.
32//!
33//! 4. The parachain candidate that is backed by the most validators is chosen by the relay-chain
34//! block producer to be added as backed candidate on chain.
35//!
36//! 5. After the parachain candidate got backed and included, all collators start at 1.
37
38mod import_queue;
39pub use import_queue::Verifier;