-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure MessageQueue for compatibility with Snowbridge #2146
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,15 +91,30 @@ pub enum AggregateMessageOrigin { | |
/// | ||
/// This is used by the HRMP queue. | ||
Sibling(ParaId), | ||
/// This is used by the snowbridge-outbound-queue pallet | ||
Export(MessageOrigin), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope we can make this more general somehow. But just so that i understand, this is the outbound queue for bridged messages? I am not sure if we actually need to change this in the SDK, or if there could be an enum type in the runtime that has this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I thought about this, came to the conclusion that a generalized solution wouldn't really help, as we can't predict the requirements (or even a need) for the generalized solution. So we could end designing something that will never be used by any projects other than Snowbridge.
Yes. Essentially it takes inbound XCM messages, processes them, and puts them back on the
Nope.
I kinda originally tried something like that in the other old draft PR. Though as you said, it would increase the complexity of runtime upgrades. enum AggregateMessageOrigin {
Xcmp(XcmpOrigin)
Snowbridge(SnowbridgeOrigin)
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I see the snowbridge MR to the Polkadot-SDK please? To me it seems like you change this enum but we will never use it in the SDK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to clarify, Snowbridge is a set of pallets which will be installed on these system runtimes:
So within those runtimes, the XCMP and Snowbridge subsystems will need to agree on a common For example here we install the pallets in the Here we configure the And here's our interim Is hard to give you a clean MR right now, as the base branch for our working branch is a bit of frankenstein at the moment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then there should maybe be a uniform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes very good sense, narrowing the change down to the BridgeHub level. Let me try that. |
||
} | ||
/// The origin of a message | ||
#[derive(Encode, Decode, MaxEncodedLen, Clone, Eq, PartialEq, TypeInfo, Debug)] | ||
pub enum MessageOrigin { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is with the naming here? Just |
||
/// The message came from the para-chain itself. | ||
Here, | ||
/// The message came from the relay-chain. | ||
Parent, | ||
/// The message came from a sibling para-chain. | ||
Sibling(ParaId), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these variants the same as in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our Ethereum bridge acts as an adaptor over XCM, essentially allowing parachains to send XCM messages to Ethereum. On BridgeHub, to process these XCM messages, we need to track their origin, with the granularity shown in Messages from different Polkadot origins are treated differently, for example in this implementation of QueuePausedQuery: https://github.com/Snowfork/snowbridge/blob/c9196e196f650e1362dfdf7e911dc9b292cf0859/parachain/pallets/outbound-queue/src/queue_paused_query_impl.rs#L17 And that's why its difficult to reuse the old |
||
} | ||
|
||
impl From<AggregateMessageOrigin> for xcm::v3::MultiLocation { | ||
fn from(origin: AggregateMessageOrigin) -> Self { | ||
use AggregateMessageOrigin::*; | ||
match origin { | ||
AggregateMessageOrigin::Here => MultiLocation::here(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we design the enum AggregateMessageOrigin {
Xcmp(XcmpOrigin)
Snowbridge(SnowbridgeOrigin)
} Then this change would be less hacky, as we would only need to implement |
||
AggregateMessageOrigin::Parent => MultiLocation::parent(), | ||
AggregateMessageOrigin::Sibling(id) => | ||
MultiLocation::new(1, Junction::Parachain(id.into())), | ||
Here => MultiLocation::here(), | ||
Parent => MultiLocation::parent(), | ||
Sibling(id) => MultiLocation::new(1, Junction::Parachain(id.into())), | ||
Export(MessageOrigin::Here) => MultiLocation::here(), | ||
Export(MessageOrigin::Parent) => MultiLocation::parent(), | ||
Export(MessageOrigin::Sibling(id)) => MultiLocation::new(1, Junction::Parachain(id.into())), | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its necessary as we need to install a pallet OutboundQueue, documented here, with an on_initialize handler that must run before any messages are consumed from
MessageQueue
.This
on_initialize
handler kills storage (obsolete processed messages) from the previous block. For the new block, we only want to fill up storage with new processed messages sourced from MessageQueue.