mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-08-08 16:25:44 +00:00
262574fc49
* update primitives * correct parent_head field * make hrmp field pub * refactor validation data: runtime * refactor validation data: messages * add arguments to full_validation_data runtime API * port runtime API * mostly port over candidate validation * remove some parameters from ValidationParams * guide: update candidate validation * update candidate outputs * update ValidationOutputs in primitives * port over candidate validation * add a new test for no-transient behavior * update util runtime API wrappers * candidate backing * fix missing imports * change some fields of validation data around * runtime API impl * update candidate validation * fix backing tests * grumbles from review * fix av-store tests * fix some more crates * fix provisioner tests * fix availability distribution tests * port collation-generation to new validation data * fix overseer tests * Update roadmap/implementers-guide/src/node/utility/candidate-validation.md Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
64 lines
1.9 KiB
Rust
64 lines
1.9 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)]
|
|
|
|
use sp_std::result;
|
|
use sp_runtime::traits::BadOrigin;
|
|
use primitives::v1::Id as ParaId;
|
|
use codec::{Decode, Encode};
|
|
|
|
pub mod configuration;
|
|
pub mod inclusion;
|
|
pub mod inclusion_inherent;
|
|
pub mod initializer;
|
|
pub mod paras;
|
|
pub mod scheduler;
|
|
pub mod validity;
|
|
|
|
pub mod runtime_api_impl;
|
|
|
|
mod util;
|
|
|
|
#[cfg(test)]
|
|
mod mock;
|
|
|
|
/// Origin for the parachains.
|
|
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
|
|
#[cfg_attr(feature = "std", derive(Debug))]
|
|
pub enum Origin {
|
|
/// It comes from a parachain.
|
|
Parachain(ParaId),
|
|
}
|
|
|
|
/// Ensure that the origin `o` represents a parachain.
|
|
/// Returns `Ok` with the parachain ID that effected the extrinsic or an `Err` otherwise.
|
|
pub fn ensure_parachain<OuterOrigin>(o: OuterOrigin) -> result::Result<ParaId, BadOrigin>
|
|
where OuterOrigin: Into<result::Result<Origin, OuterOrigin>>
|
|
{
|
|
match o.into() {
|
|
Ok(Origin::Parachain(id)) => Ok(id),
|
|
_ => Err(BadOrigin),
|
|
}
|
|
}
|