referrerpolicy=no-referrer-when-downgrade

bridge_hub_common/
digest_item.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//! Custom digest items
16
17use codec::{Decode, Encode};
18use sp_core::{RuntimeDebug, H256};
19use sp_runtime::generic::DigestItem;
20
21/// Custom header digest items, inserted as DigestItem::Other
22#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, RuntimeDebug)]
23pub enum CustomDigestItem {
24	#[codec(index = 0)]
25	/// Merkle root of outbound Snowbridge messages.
26	Snowbridge(H256),
27	#[codec(index = 1)]
28	/// Merkle root of outbound Snowbridge V2 messages.
29	SnowbridgeV2(H256),
30}
31
32/// Convert custom application digest item into a concrete digest item
33impl From<CustomDigestItem> for DigestItem {
34	fn from(val: CustomDigestItem) -> Self {
35		DigestItem::Other(val.encode())
36	}
37}