mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-02 09:27:24 +00:00
1afdba7464
* Initial commit Forked at:8f02e233daParent branch: origin/master * Reject blocks without justification * Revert "Reject blocks without justification" This reverts commit ee60e12097939d4ccfe987a71db9a876319ae5ba. * WIP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * CLEANUP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * CLEANUP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * WIP Forked at:8f02e233daParent branch: origin/master * Move HeadData to primitives * Update network/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update network/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * CLEANUP Forked at:8f02e233daParent branch: origin/master * fix * CLEANUP Forked at:8f02e233daParent branch: origin/master * messages * for the greater good * Update primitives/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update network/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update network/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update network/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
76 lines
2.6 KiB
Rust
76 lines
2.6 KiB
Rust
// Copyright 2020 Parity Technologies (UK) Ltd.
|
|
// This file is part of Cumulus.
|
|
|
|
// Substrate 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.
|
|
|
|
// Substrate 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Cumulus related primitive types and traits.
|
|
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
|
|
|
pub mod validation_function_params;
|
|
|
|
use codec::{Decode, Encode};
|
|
use sp_runtime::traits::Block as BlockT;
|
|
|
|
/// Identifiers and types related to Cumulus Inherents
|
|
pub mod inherents {
|
|
use sp_inherents::InherentIdentifier;
|
|
|
|
/// Inherent identifier for downward messages.
|
|
pub const DOWNWARD_MESSAGES_IDENTIFIER: InherentIdentifier = *b"cumdownm";
|
|
|
|
/// The type of the inherent downward messages.
|
|
pub type DownwardMessagesType = sp_std::vec::Vec<()>;
|
|
|
|
/// The identifier for the `validation_function_params` inherent.
|
|
pub const VALIDATION_FUNCTION_PARAMS_IDENTIFIER: InherentIdentifier = *b"valfunp0";
|
|
/// The type of the inherent.
|
|
pub type ValidationFunctionParamsType = crate::validation_function_params::ValidationFunctionParams;
|
|
}
|
|
|
|
/// Well known keys for values in the storage.
|
|
pub mod well_known_keys {
|
|
/// The storage key for the upward messages.
|
|
///
|
|
/// The upward messages are stored as SCALE encoded `Vec<()>`.
|
|
pub const UPWARD_MESSAGES: &'static [u8] = b":cumulus_upward_messages:";
|
|
|
|
/// Current validation function parameters.
|
|
pub const VALIDATION_FUNCTION_PARAMS: &'static [u8] = b":validation_function_params";
|
|
|
|
/// Code upgarde (set as appropriate by a pallet).
|
|
pub const NEW_VALIDATION_CODE: &'static [u8] = b":new_validation_code";
|
|
}
|
|
|
|
/// Something that should be called when a downward message is received.
|
|
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
|
pub trait DownwardMessageHandler {
|
|
/// Handle the given downward message.
|
|
fn handle_downward_message(msg: &());
|
|
}
|
|
|
|
/// Something that can send upward messages.
|
|
pub trait UpwardMessageSender {
|
|
/// Send an upward message to the relay chain.
|
|
///
|
|
/// Returns an error if sending failed.
|
|
fn send_upward_message(msg: &()) -> Result<(), ()>;
|
|
}
|
|
|
|
/// The head data of the parachain, stored in the relay chain.
|
|
#[derive(Decode, Encode, Debug)]
|
|
pub struct HeadData<Block: BlockT> {
|
|
pub header: Block::Header,
|
|
}
|