referrerpolicy=no-referrer-when-downgrade

bp_parachains/
call_info.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Parity Bridges Common.
3
4// Parity Bridges Common is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// Parity Bridges Common is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with Parity Bridges Common.  If not, see <http://www.gnu.org/licenses/>.
16
17//! Defines structures related to calls of the `pallet-bridge-parachains` pallet.
18
19use crate::{ParaHash, ParaId, RelayBlockHash, RelayBlockNumber};
20
21use bp_polkadot_core::parachains::ParaHeadsProof;
22use bp_runtime::HeaderId;
23use codec::{Decode, Encode};
24use scale_info::TypeInfo;
25use sp_runtime::RuntimeDebug;
26use sp_std::vec::Vec;
27
28/// A minimized version of `pallet-bridge-parachains::Call` that can be used without a runtime.
29#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
30#[allow(non_camel_case_types)]
31pub enum BridgeParachainCall {
32	/// `pallet-bridge-parachains::Call::submit_parachain_heads`
33	#[codec(index = 0)]
34	submit_parachain_heads {
35		/// Relay chain block, for which we have submitted the `parachain_heads_proof`.
36		at_relay_block: (RelayBlockNumber, RelayBlockHash),
37		/// Parachain identifiers and their head hashes.
38		parachains: Vec<(ParaId, ParaHash)>,
39		/// Parachain heads proof.
40		parachain_heads_proof: ParaHeadsProof,
41	},
42}
43
44/// Info about a `SubmitParachainHeads` call which tries to update a single parachain.
45///
46/// The pallet supports updating multiple parachain heads at once,
47#[derive(PartialEq, RuntimeDebug)]
48pub struct SubmitParachainHeadsInfo {
49	/// Number and hash of the finalized relay block that has been used to prove parachain
50	/// finality.
51	pub at_relay_block: HeaderId<RelayBlockHash, RelayBlockNumber>,
52	/// Parachain identifier.
53	pub para_id: ParaId,
54	/// Hash of the bundled parachain head.
55	pub para_head_hash: ParaHash,
56	/// If `true`, then the call must be free (assuming that everything else is valid) to
57	/// be treated as valid.
58	pub is_free_execution_expected: bool,
59}