mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-08 18:17:22 +00:00
ec98120f0e
* disputes module skeleton and storage * implement dispute module initialization logic * implement disputes session change logic * provide dispute skeletons * deduplication & ancient check * fix a couple of warnings * begin provide_dispute_data impl * flesh out statement set import somewhat * move ApprovalVote to shared primitives * add a signing-payload API to explicit dispute statements * implement statement signature checking * some bitflags glue for observing changes in disputes * implement dispute vote import logic * flesh out everything except slashing * guide: tweaks * declare and use punishment trait * punish validators for inconclusive disputes * guide: tiny fix * guide: update docs * add disputes getter fn * guide: small change to spam slots handling * improve spam slots handling and fix some bugs * finish API of disputes runtime * define and deposit `RevertTo` log * begin integrating disputes into para_inherent * use precomputed slash_for/against * return candidate hash from process_bitfields * implement inclusion::collect_disputed * finish integration into rest of runtime * add Disputes to initializer * address suggestions * use pallet macro * fix typo * Update runtime/parachains/src/disputes.rs * add test: fix pruning * document specific behavior * deposit events on dispute changes * add an allow(unused) on fn disputes * add a dummy PunishValidators implementation * add disputes module to Rococo * add disputes module to westend runtime * add disputes module to test runtime * add disputes module to kusama runtime * guide: prepare for runtime API for checking frozenness * remove revert digests in favor of state variable * merge reversions * Update runtime/parachains/src/disputes.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update runtime/parachains/src/disputes.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update runtime/parachains/src/disputes.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * add byzantine_threshold and supermajority_threshold utilities to primitives * use primitive helpers * deposit revert event when freezing chain * deposit revert log when freezing chain * test revert event and log are generated when freezing * add trait to decouple disputes handling from paras inherent handling * runtime: fix compilation and setup dispute handler * disputes: add hook for filtering out dispute statements * disputes: add initializer hooks to DisputesHandler * runtime: remove disputes pallet from all runtimes * tag TODOs * don't import any dispute statements just yet... * address grumbles * fix spellcheck, hopefully * maybe now? * last spellcheck round * fix runtime tests * fix test-runtime Co-authored-by: thiolliere <gui.thiolliere@gmail.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <andrerfosilva@gmail.com>
73 lines
2.3 KiB
Rust
73 lines
2.3 KiB
Rust
// Copyright 2020 Parity Technologies (UK) Ltd.
|
|
// This file is part of Polkadot.
|
|
|
|
// Polkadot is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Polkadot is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Runtime modules for parachains code.
|
|
//!
|
|
//! It is crucial to include all the modules from this crate in the runtime, in
|
|
//! particular the `Initializer` module, as it is responsible for initializing the state
|
|
//! of the other modules.
|
|
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
|
|
|
pub mod configuration;
|
|
pub mod disputes;
|
|
pub mod shared;
|
|
pub mod inclusion;
|
|
pub mod initializer;
|
|
pub mod paras;
|
|
pub mod paras_inherent;
|
|
pub mod scheduler;
|
|
pub mod session_info;
|
|
pub mod origin;
|
|
pub mod dmp;
|
|
pub mod ump;
|
|
pub mod hrmp;
|
|
pub mod reward_points;
|
|
|
|
pub mod runtime_api_impl;
|
|
|
|
mod util;
|
|
|
|
#[cfg(test)]
|
|
mod mock;
|
|
|
|
pub use origin::{Origin, ensure_parachain};
|
|
use primitives::v1::Id as ParaId;
|
|
pub use paras::ParaLifecycle;
|
|
|
|
/// Schedule a para to be initialized at the start of the next session with the given genesis data.
|
|
pub fn schedule_para_initialize<T: paras::Config>(
|
|
id: ParaId,
|
|
genesis: paras::ParaGenesisArgs,
|
|
) -> Result<(), ()> {
|
|
<paras::Pallet<T>>::schedule_para_initialize(id, genesis).map_err(|_| ())
|
|
}
|
|
|
|
/// Schedule a para to be cleaned up at the start of the next session.
|
|
pub fn schedule_para_cleanup<T: paras::Config>(id: primitives::v1::Id) -> Result<(), ()> {
|
|
<paras::Pallet<T>>::schedule_para_cleanup(id).map_err(|_| ())
|
|
}
|
|
|
|
/// Schedule a parathread to be upgraded to a parachain.
|
|
pub fn schedule_parathread_upgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
|
|
paras::Pallet::<T>::schedule_parathread_upgrade(id).map_err(|_| ())
|
|
}
|
|
|
|
/// Schedule a parachain to be downgraded to a parathread.
|
|
pub fn schedule_parachain_downgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
|
|
paras::Pallet::<T>::schedule_parachain_downgrade(id).map_err(|_| ())
|
|
}
|