-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add multi-router support in LP gateway. #1893
base: main
Are you sure you want to change the base?
Conversation
/// This can only be set by an admin. | ||
#[pallet::storage] | ||
#[pallet::getter(fn domain_multi_routers)] | ||
pub type DomainMultiRouters<T: Config> = |
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.
Added a separate storage and extrinsic since I'm not sure how to proceed in this case - do we eventually remove the old storage after a migration or can we nuke/replace it now?
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.
You can replace it now. If needed, the migration can go along with this PR, which I think is quite straightforward: just adding the current router, if it exists, into the vector and purge the old storage
Re-basing on main. |
cdc56a2
to
a5e30b1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1893 +/- ##
==========================================
+ Coverage 47.36% 47.38% +0.01%
==========================================
Files 176 176
Lines 13305 13325 +20
==========================================
+ Hits 6302 6314 +12
- Misses 7003 7011 +8 ☔ View full report in Codecov by Sentry. |
c145538
to
22a8f03
Compare
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.
Pretty straightforward change. Wanted to propose a few things if we are anyways working on this:
- Add a dedicated
Queue
for Inbound and Outbound that is currently served by on idle, so that we can easily switch toTasks
in the future. - (NOT SURE IF GOOD IDEA) Instead of iterating over all routers we could have a
DoubleMap
and then serving the message in a queue does take care of-
- Ensuring that a message can be send over each
Router
only once
- Ensuring that a message can be send over each
-
Furthermore
We will need to have the same for inbound logic. So a the Gateway
must take care of a few things
-
Outgoing
- Each Message is sent only once over each existing
Router
- Each Message is sent only once over each existing
-
Incoming
- Each Message is only forwarded to the
LiquidityPools
pallet once some information has been verified.
NOTE: It is to be determined how this will happen, but we should already take care right now that messages are "queued" until this verification has happened.
- Each Message is only forwarded to the
I think
|
@mustermeiszer we already have a queue in place for outbound messages - do you mean that we should replace that with a queue implementation that will serve both the LP gateway and the main LP pallet? |
I think now it makes sense, because there will be much more processing needed. Having a general The general idea of the multi router logic is. Sending:
Receiving
I really, really strongly am against exposing the I would have split the the enum into an For sending batches I would also say we have an |
match router.send(sender.clone(), message.serialize()) { | ||
Ok(dispatch_info) => Self::update_total_post_dispatch_info_weight( | ||
&mut post_dispatch_info, | ||
dispatch_info.actual_weight, | ||
read_weight, | ||
), | ||
Err(e) => { | ||
Self::update_total_post_dispatch_info_weight( | ||
&mut post_dispatch_info, | ||
e.post_info.actual_weight, | ||
read_weight, | ||
); | ||
|
||
return Err(DispatchErrorWithPostInfo { | ||
post_info: post_dispatch_info, | ||
error: e.error, | ||
}); | ||
} |
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.
Also for that:
- The first router must send the message
- The next routers must send a
MessageProof
of said message
Description
Adds a new storage and new extrinsic for adding multiple routers for a specific domain.
The outbound queue processing logic is now sending a message using all routers that are stored.
Checklist: