Adds Snowbridge to Rococo runtime (#2522)

# Description

Adds Snowbridge to the Rococo bridge hub runtime. Includes config
changes required in Rococo asset hub.

---------

Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>
Co-authored-by: ron <yrong1997@gmail.com>
Co-authored-by: Vincent Geddes <vincent.geddes@hey.com>
Co-authored-by: claravanstaden <Cats 4 life!>
This commit is contained in:
Clara van Staden
2023-12-21 18:06:36 +02:00
committed by GitHub
parent 9f5221cc2f
commit 18d53dbf91
151 changed files with 19379 additions and 149 deletions
+21 -15
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
pub use codec::{Decode, Encode, EncodeLike};
pub use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
pub use lazy_static::lazy_static;
pub use log;
pub use paste;
@@ -245,7 +245,7 @@ pub trait Parachain: Chain {
type LocationToAccountId: ConvertLocation<AccountIdOf<Self::Runtime>>;
type ParachainInfo: Get<ParaId>;
type ParachainSystem;
type MessageProcessor: ProcessMessage<Origin = CumulusAggregateMessageOrigin> + ServiceQueues;
type MessageProcessor: ProcessMessage + ServiceQueues;
fn init();
@@ -576,7 +576,7 @@ macro_rules! decl_test_parachains {
XcmpMessageHandler: $xcmp_message_handler:path,
LocationToAccountId: $location_to_account:path,
ParachainInfo: $parachain_info:path,
// MessageProcessor: $message_processor:path,
MessageOrigin: $message_origin:path,
},
pallets = {
$($pallet_name:ident: $pallet_path:path,)*
@@ -615,7 +615,7 @@ macro_rules! decl_test_parachains {
type LocationToAccountId = $location_to_account;
type ParachainSystem = $crate::ParachainSystemPallet<<Self as $crate::Chain>::Runtime>;
type ParachainInfo = $parachain_info;
type MessageProcessor = $crate::DefaultParaMessageProcessor<$name<N>>;
type MessageProcessor = $crate::DefaultParaMessageProcessor<$name<N>, $message_origin>;
// We run an empty block during initialisation to open HRMP channels
// and have them ready for the next block
@@ -1007,7 +1007,7 @@ macro_rules! decl_test_networks {
<$parachain<Self>>::ext_wrapper(|| {
let _ = <$parachain<Self> as Parachain>::MessageProcessor::process_message(
&msg[..],
$crate::CumulusAggregateMessageOrigin::Parent,
$crate::CumulusAggregateMessageOrigin::Parent.into(),
&mut weight_meter,
&mut msg.using_encoded($crate::blake2_256),
);
@@ -1313,17 +1313,23 @@ macro_rules! decl_test_sender_receiver_accounts_parameter_types {
};
}
pub struct DefaultParaMessageProcessor<T>(PhantomData<T>);
pub struct DefaultParaMessageProcessor<T, M>(PhantomData<(T, M)>);
// Process HRMP messages from sibling paraids
impl<T> ProcessMessage for DefaultParaMessageProcessor<T>
impl<T, M> ProcessMessage for DefaultParaMessageProcessor<T, M>
where
M: codec::FullCodec
+ MaxEncodedLen
+ Clone
+ Eq
+ PartialEq
+ frame_support::pallet_prelude::TypeInfo
+ Debug,
T: Parachain,
T::Runtime: MessageQueueConfig,
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin:
PartialEq<CumulusAggregateMessageOrigin>,
MessageQueuePallet<T::Runtime>: EnqueueMessage<CumulusAggregateMessageOrigin> + ServiceQueues,
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin: PartialEq<M>,
MessageQueuePallet<T::Runtime>: EnqueueMessage<M> + ServiceQueues,
{
type Origin = CumulusAggregateMessageOrigin;
type Origin = M;
fn process_message(
msg: &[u8],
@@ -1340,13 +1346,13 @@ where
Ok(true)
}
}
impl<T> ServiceQueues for DefaultParaMessageProcessor<T>
impl<T, M> ServiceQueues for DefaultParaMessageProcessor<T, M>
where
M: MaxEncodedLen,
T: Parachain,
T::Runtime: MessageQueueConfig,
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin:
PartialEq<CumulusAggregateMessageOrigin>,
MessageQueuePallet<T::Runtime>: EnqueueMessage<CumulusAggregateMessageOrigin> + ServiceQueues,
<<T::Runtime as MessageQueueConfig>::MessageProcessor as ProcessMessage>::Origin: PartialEq<M>,
MessageQueuePallet<T::Runtime>: EnqueueMessage<M> + ServiceQueues,
{
type OverweightMessageAddress = ();