-
Notifications
You must be signed in to change notification settings - Fork 103
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
Identify channels using a Hash type instead of parachain IDs #1005
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1005 +/- ##
==========================================
- Coverage 81.14% 80.98% -0.17%
==========================================
Files 53 52 -1
Lines 2132 2161 +29
Branches 72 72
==========================================
+ Hits 1730 1750 +20
- Misses 387 396 +9
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -14,6 +14,22 @@ function ParaIDNe(ParaID a, ParaID b) pure returns (bool) { | |||
return !ParaIDEq(a, b); | |||
} | |||
|
|||
function into(ParaID paraID) pure returns (ChannelID) { |
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.
This converts a ParaID
into a ChannelID
. Equivalent to impl From<ParaId> for ChannelId
on the substrate side.
|
Yes, it's scheduled in a round-robin manner. But there is one nuance if we remove the special handling(i.e. yield for high-priority message) in case governance message does not get the chance to execute in same block when congest of low priority sibling messages, I've added one test for that in 11e3efa Please check if that's the expected behavior. |
The
Its a chicken-and-egg problem. A consensus system initially needs to create an agent and channel over a bridgehub/governance channel. Only after that can children of that consensus system use the newly created agent/channel of their parent. And in indeed, certain commands such
This PR does make that easier to implement, post launch. But its not the goal of this change.
Yip, again, this PR aims to make easier to implement in future. For now though, channels and parachains have a 1-1 mapping in the background. Our approach of deriving |
This is fine. Having governance commands delayed by a single block isn't a problem. |
This allows us to extend the channel system in flexible ways in future, while right now it allows us to simplify handling of message priorities.
There are now two channels dedicated for governance commands:
Primary governance channel:
ID:
0x0000000000000000000000000000000000000000000000000000000000000001
Purpose: For high-priority messages such as
Upgrade
andSetOperatingMode
.Secondard governance channel:
ID:
0x0000000000000000000000000000000000000000000000000000000000000002
Purpose: For lower-priority messages such as
CreateAgent
andCreateChannel
.Having two channels means that higher-priority governance commands won't get backed up behind lower-priority governance commands, which other parachains can issue via XCM
All other channels have an ID deterministically derived from the parachain id:
keccak256(("para", para_id))
. For example, the channel ID for AssetHub is0xc173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539
.@yrong, I learned that the
MessageQueue
pallet processes messages from different queues in a fair manner, using a round-robin approach. So in Block K, messages from one queue will be processed, and in block K+1, messages from the next queue will be processed. This means we don't need to have any special handling for high-priority messages, as we can rely on theMessageQueue
pallet to have them processed fairly.Other Changes:
CreateChannel
command now also includes the initial operating mode and outboundFee.defaultFee
storage field from Gateway, asCreateChannel
command includes the outboundFee.