mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 15:41:02 +00:00
Send messages using xcm pallet (#1518)
* send messages using xcm pallet * XcmBridge && XcmBridgeAdapter + (untested) config in RialtoParachain * impl encode_send_xcm for the rest * remove duplicate code * some fixes * cleanup * some more tests * cleanup * cleanup * send Rialto -> Millau messages using bridge-messages pallet * fmt * some clippy fixes * more clippy
This commit is contained in:
committed by
Bastian Köcher
parent
b21790b769
commit
c131a5e3c8
@@ -19,7 +19,7 @@
|
||||
// TODO: this is almost exact copy of `millau_messages.rs` from Rialto runtime.
|
||||
// Should be extracted to a separate crate and reused here.
|
||||
|
||||
use crate::Runtime;
|
||||
use crate::{OriginCaller, Runtime};
|
||||
|
||||
use bp_messages::{
|
||||
source_chain::{SenderOrigin, TargetHeaderChain},
|
||||
@@ -40,6 +40,8 @@ use scale_info::TypeInfo;
|
||||
use sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128};
|
||||
use sp_std::convert::TryFrom;
|
||||
|
||||
/// Default lane that is used to send messages to Millau.
|
||||
pub const DEFAULT_XCM_LANE_TO_MILLAU: LaneId = [0, 0, 0, 0];
|
||||
/// Initial value of `MillauToRialtoParachainConversionRate` parameter.
|
||||
pub const INITIAL_MILLAU_TO_RIALTO_PARACHAIN_CONVERSION_RATE: FixedU128 =
|
||||
FixedU128::from_inner(FixedU128::DIV);
|
||||
@@ -137,7 +139,22 @@ impl messages::ThisChainWithMessages for RialtoParachain {
|
||||
>;
|
||||
|
||||
fn is_message_accepted(send_origin: &Self::Origin, lane: &LaneId) -> bool {
|
||||
send_origin.linked_account().is_some() && (*lane == [0, 0, 0, 0] || *lane == [0, 0, 0, 1])
|
||||
let here_location = xcm::v3::MultiLocation::from(crate::UniversalLocation::get());
|
||||
match send_origin.caller {
|
||||
OriginCaller::PolkadotXcm(pallet_xcm::Origin::Xcm(ref location))
|
||||
if *location == here_location =>
|
||||
{
|
||||
log::trace!(target: "runtime::bridge", "Verifying message sent using XCM pallet to Millau");
|
||||
},
|
||||
_ => {
|
||||
// keep in mind that in this case all messages are free (in term of fees)
|
||||
// => it's just to keep testing bridge on our test deployments until we'll have a
|
||||
// better option
|
||||
log::trace!(target: "runtime::bridge", "Verifying message sent using messages pallet to Millau");
|
||||
},
|
||||
}
|
||||
|
||||
*lane == [0, 0, 0, 0] || *lane == [0, 0, 0, 1]
|
||||
}
|
||||
|
||||
fn maximal_pending_messages_at_outbound_lane() -> MessageNonce {
|
||||
|
||||
Reference in New Issue
Block a user