Port safe commits from master to polkadot-staging (#2761)

* introduce bp_messages::ChainWithMessages (#2171)

* Move Chain::ID from relay-level Chain to primitives-level Chain (#2181)

* move Chain::ID from relay-level Chain to primitives-level Chain

* removed chain IDs from bp-runtime

* add missing file header

* Some code grooming (#2276)

* some code grooming: enable warn(missing_docs) for all piblic crates + added missing documentation + removed obsolete clippy/deny workarounds

* removed strange allow + added comment related to other allow

* removed incorrect_clone_impl_on_copy_type which is unknown to CI clippy
This commit is contained in:
Svyatoslav Nikolsky
2024-01-11 12:39:23 +03:00
committed by Bastian Köcher
parent 37bb1e7909
commit 4004742e85
56 changed files with 389 additions and 268 deletions
+1
View File
@@ -16,6 +16,7 @@
//! Common types/functions that may be used by runtimes of all bridged chains.
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
use crate::messages_call_ext::MessagesCallSubType;
@@ -14,6 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Signed extension for the `pallet-bridge-messages` that is able to reject obsolete
//! (and some other invalid) transactions.
use crate::messages::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
};
@@ -116,7 +119,9 @@ impl ReceiveMessagesDeliveryProofInfo {
/// which tries to update a single lane.
#[derive(PartialEq, RuntimeDebug)]
pub enum CallInfo {
/// Messages delivery call info.
ReceiveMessagesProof(ReceiveMessagesProofInfo),
/// Messages delivery confirmation call info.
ReceiveMessagesDeliveryProof(ReceiveMessagesDeliveryProofInfo),
}
@@ -132,7 +137,7 @@ impl CallInfo {
/// Helper struct that provides methods for working with a call supported by `CallInfo`.
pub struct CallHelper<T: Config<I>, I: 'static> {
pub _phantom_data: sp_std::marker::PhantomData<(T, I)>,
_phantom_data: sp_std::marker::PhantomData<(T, I)>,
}
impl<T: Config<I>, I: 'static> CallHelper<T, I> {
@@ -40,11 +40,14 @@ use sp_std::{fmt::Debug, marker::PhantomData};
use xcm::prelude::*;
use xcm_builder::{DispatchBlob, DispatchBlobError};
/// Message dispatch result type for single message
/// Message dispatch result type for single message.
#[derive(CloneNoBound, EqNoBound, PartialEqNoBound, Encode, Decode, Debug, TypeInfo)]
pub enum XcmBlobMessageDispatchResult {
/// We've been unable to decode message payload.
InvalidPayload,
/// Message has been dispatched.
Dispatched,
/// Message has **NOT** been dispatched because of given error.
NotDispatched(#[codec(skip)] Option<DispatchBlobError>),
}
+6
View File
@@ -314,6 +314,8 @@ impl From<BridgedChainOrigin>
pub struct ThisUnderlyingChain;
impl Chain for ThisUnderlyingChain {
const ID: ChainId = *b"tuch";
type BlockNumber = ThisChainBlockNumber;
type Hash = ThisChainHash;
type Hasher = ThisChainHasher;
@@ -354,6 +356,8 @@ pub struct BridgedUnderlyingParachain;
pub struct BridgedChainCall;
impl Chain for BridgedUnderlyingChain {
const ID: ChainId = *b"buch";
type BlockNumber = BridgedChainBlockNumber;
type Hash = BridgedChainHash;
type Hasher = BridgedChainHasher;
@@ -380,6 +384,8 @@ impl ChainWithGrandpa for BridgedUnderlyingChain {
}
impl Chain for BridgedUnderlyingParachain {
const ID: ChainId = *b"bupc";
type BlockNumber = BridgedChainBlockNumber;
type Hash = BridgedChainHash;
type Hasher = BridgedChainHasher;
@@ -84,5 +84,5 @@ where
let (relay_block_number, relay_block_hash) =
insert_header_to_grandpa_pallet::<R, R::BridgesGrandpaPalletInstance>(state_root);
(relay_block_number, relay_block_hash, ParaHeadsProof(proof), parachain_heads)
(relay_block_number, relay_block_hash, ParaHeadsProof { storage_proof: proof }, parachain_heads)
}
@@ -116,7 +116,7 @@ where
/// Refund calculator.
pub trait RefundCalculator {
// The underlying integer type in which the refund is calculated.
/// The underlying integer type in which the refund is calculated.
type Balance;
/// Compute refund for given transaction.
@@ -986,7 +986,7 @@ mod tests {
ParaId(TestParachain::get()),
[parachain_head_at_relay_header_number as u8; 32].into(),
)],
parachain_heads_proof: ParaHeadsProof(vec![]),
parachain_heads_proof: ParaHeadsProof { storage_proof: vec![] },
})
}
@@ -1732,7 +1732,7 @@ mod tests {
(ParaId(TestParachain::get()), [1u8; 32].into()),
(ParaId(TestParachain::get() + 1), [1u8; 32].into()),
],
parachain_heads_proof: ParaHeadsProof(vec![]),
parachain_heads_proof: ParaHeadsProof { storage_proof: vec![] },
}),
message_delivery_call(200),
],