referrerpolicy=no-referrer-when-downgrade

cumulus_pallet_parachain_system/validate_block/
mod.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Cumulus.
3// SPDX-License-Identifier: Apache-2.0
4
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// 	http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17//! A module that enables a runtime to work as parachain.
18
19#[cfg(not(feature = "std"))]
20#[doc(hidden)]
21pub mod implementation;
22#[cfg(test)]
23mod tests;
24
25#[cfg(not(feature = "std"))]
26#[doc(hidden)]
27pub mod trie_cache;
28
29#[cfg(any(test, not(feature = "std")))]
30#[doc(hidden)]
31pub mod trie_recorder;
32
33#[cfg(not(feature = "std"))]
34#[doc(hidden)]
35pub use alloc::{boxed::Box, slice};
36#[cfg(not(feature = "std"))]
37#[doc(hidden)]
38pub use bytes;
39#[cfg(not(feature = "std"))]
40#[doc(hidden)]
41pub use codec::decode_from_bytes;
42#[cfg(not(feature = "std"))]
43#[doc(hidden)]
44pub use polkadot_parachain_primitives;
45#[cfg(not(feature = "std"))]
46#[doc(hidden)]
47pub use sp_runtime::traits::GetRuntimeBlockType;
48#[cfg(not(feature = "std"))]
49#[doc(hidden)]
50pub use sp_std;
51
52/// Basically the same as
53/// [`ValidationParams`](polkadot_parachain_primitives::primitives::ValidationParams), but a little
54/// bit optimized for our use case here.
55///
56/// `block_data` and `head_data` are represented as [`bytes::Bytes`] to make them reuse
57/// the memory of the input parameter of the exported `validate_blocks` function.
58///
59/// The layout of this type must match exactly the layout of
60/// [`ValidationParams`](polkadot_parachain_primitives::primitives::ValidationParams) to have the
61/// same SCALE encoding.
62#[derive(codec::Decode)]
63#[cfg_attr(feature = "std", derive(codec::Encode))]
64#[doc(hidden)]
65pub struct MemoryOptimizedValidationParams {
66	pub parent_head: bytes::Bytes,
67	pub block_data: bytes::Bytes,
68	pub relay_parent_number: cumulus_primitives_core::relay_chain::BlockNumber,
69	pub relay_parent_storage_root: cumulus_primitives_core::relay_chain::Hash,
70}