mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 01:01:04 +00:00
Move pallet-bridge-dispatch types to primitives (#948)
* message dispatch support multiple instances * Move pallet-bridge-dispatch types to primitives * remove pallet-bridge-dispatch dependency * Update cargo.lock (remove pallet-bridge-dispatch in substrate-relay) * remove extra dependencies
This commit is contained in:
@@ -8,7 +8,7 @@ messages module into your runtime. Basic prerequisites of these helpers are:
|
||||
- all message lanes are identical and may be used to transfer the same messages;
|
||||
- the messages sent over the bridge are dispatched using
|
||||
[call dispatch module](../../modules/dispatch/README.md);
|
||||
- the messages are `pallet_bridge_dispatch::MessagePayload` structures, where `call` field is
|
||||
- the messages are `bp_message_dispatch::MessagePayload` structures, where `call` field is
|
||||
encoded `Call` of the target chain. This means that the `Call` is opaque to the
|
||||
[messages module](../../modules/messages/README.md) instance at the source chain.
|
||||
It is pre-encoded by the message submitter;
|
||||
@@ -118,7 +118,7 @@ are: `maximal_message_size`, `verify_chain_message`, `verify_messages_delivery_p
|
||||
`estimate_message_dispatch_and_delivery_fee`.
|
||||
|
||||
`FromThisChainMessagePayload` is a message that the sender sends through our bridge. It is the
|
||||
`pallet_bridge_dispatch::MessagePayload`, where `call` field is encoded target chain call. So
|
||||
`bp_message_dispatch::MessagePayload`, where `call` field is encoded target chain call. So
|
||||
at this chain we don't see internals of this call - we just know its size.
|
||||
|
||||
`FromThisChainMessageVerifier` is an implementation of `bp_messages::LaneMessageVerifier`. It
|
||||
@@ -131,8 +131,8 @@ has following checks in its `verify_message` method:
|
||||
|
||||
1. it'll reject a message if it has the wrong dispatch origin declared. Like if the submitter is not
|
||||
the root of this chain, but it tries to dispatch the message at the target chain using
|
||||
`pallet_bridge_dispatch::CallOrigin::SourceRoot` origin. Or he has provided wrong signature
|
||||
in the `pallet_bridge_dispatch::CallOrigin::TargetAccount` origin;
|
||||
`bp_message_dispatch::CallOrigin::SourceRoot` origin. Or he has provided wrong signature
|
||||
in the `bp_message_dispatch::CallOrigin::TargetAccount` origin;
|
||||
|
||||
1. it'll reject a message if the delivery and dispatch fee that the submitter wants to pay is lesser
|
||||
than the fee that is computed using the `estimate_message_dispatch_and_delivery_fee` function.
|
||||
|
||||
@@ -180,7 +180,7 @@ pub mod source {
|
||||
pub type BridgedChainOpaqueCall = Vec<u8>;
|
||||
|
||||
/// Message payload for This -> Bridged chain messages.
|
||||
pub type FromThisChainMessagePayload<B> = pallet_bridge_dispatch::MessagePayload<
|
||||
pub type FromThisChainMessagePayload<B> = bp_message_dispatch::MessagePayload<
|
||||
AccountIdOf<ThisChain<B>>,
|
||||
SignerOf<BridgedChain<B>>,
|
||||
SignatureOf<BridgedChain<B>>,
|
||||
@@ -395,14 +395,14 @@ pub mod target {
|
||||
use super::*;
|
||||
|
||||
/// Call origin for Bridged -> This chain messages.
|
||||
pub type FromBridgedChainMessageCallOrigin<B> = pallet_bridge_dispatch::CallOrigin<
|
||||
pub type FromBridgedChainMessageCallOrigin<B> = bp_message_dispatch::CallOrigin<
|
||||
AccountIdOf<BridgedChain<B>>,
|
||||
SignerOf<ThisChain<B>>,
|
||||
SignatureOf<ThisChain<B>>,
|
||||
>;
|
||||
|
||||
/// Decoded Bridged -> This message payload.
|
||||
pub type FromBridgedChainMessagePayload<B> = pallet_bridge_dispatch::MessagePayload<
|
||||
pub type FromBridgedChainMessagePayload<B> = bp_message_dispatch::MessagePayload<
|
||||
AccountIdOf<BridgedChain<B>>,
|
||||
SignerOf<ThisChain<B>>,
|
||||
SignatureOf<ThisChain<B>>,
|
||||
@@ -931,7 +931,7 @@ mod tests {
|
||||
let message_on_bridged_chain = source::FromThisChainMessagePayload::<OnBridgedChainBridge> {
|
||||
spec_version: 1,
|
||||
weight: 100,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: ThisChainCall::Transfer.encode(),
|
||||
}
|
||||
.encode();
|
||||
@@ -945,7 +945,7 @@ mod tests {
|
||||
target::FromBridgedChainMessagePayload::<OnThisChainBridge> {
|
||||
spec_version: 1,
|
||||
weight: 100,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: target::FromBridgedChainEncodedMessageCall::<OnThisChainBridge> {
|
||||
encoded_call: ThisChainCall::Transfer.encode(),
|
||||
_marker: PhantomData::default(),
|
||||
@@ -962,7 +962,7 @@ mod tests {
|
||||
source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||
spec_version: 1,
|
||||
weight: 100,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![42],
|
||||
}
|
||||
}
|
||||
@@ -1012,7 +1012,7 @@ mod tests {
|
||||
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||
spec_version: 1,
|
||||
weight: 100,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![42],
|
||||
};
|
||||
|
||||
@@ -1055,7 +1055,7 @@ mod tests {
|
||||
let payload = source::FromThisChainMessagePayload::<OnThisChainBridge> {
|
||||
spec_version: 1,
|
||||
weight: 100,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceAccount(ThisChainAccountId(1)),
|
||||
origin: bp_message_dispatch::CallOrigin::SourceAccount(ThisChainAccountId(1)),
|
||||
call: vec![42],
|
||||
};
|
||||
|
||||
@@ -1122,7 +1122,7 @@ mod tests {
|
||||
> {
|
||||
spec_version: 1,
|
||||
weight: 5,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![1, 2, 3, 4, 5, 6],
|
||||
},)
|
||||
.is_err()
|
||||
@@ -1137,7 +1137,7 @@ mod tests {
|
||||
> {
|
||||
spec_version: 1,
|
||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT + 1,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![1, 2, 3, 4, 5, 6],
|
||||
},)
|
||||
.is_err()
|
||||
@@ -1152,7 +1152,7 @@ mod tests {
|
||||
> {
|
||||
spec_version: 1,
|
||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as usize + 1],
|
||||
},)
|
||||
.is_err()
|
||||
@@ -1167,7 +1167,7 @@ mod tests {
|
||||
> {
|
||||
spec_version: 1,
|
||||
weight: BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT,
|
||||
origin: pallet_bridge_dispatch::CallOrigin::SourceRoot,
|
||||
origin: bp_message_dispatch::CallOrigin::SourceRoot,
|
||||
call: vec![0; source::maximal_message_size::<OnThisChainBridge>() as _],
|
||||
},),
|
||||
Ok(()),
|
||||
|
||||
Reference in New Issue
Block a user