-
Notifications
You must be signed in to change notification settings - Fork 91
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
connectors-gateway: Add gateway routers #1475
Conversation
1a05237
to
35dfaa1
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.
First Round 🏄♂️ A higher level review first mostly addressing the structure we are adopting here.
-
connectors-gateway-routers
is not an actual pallet - it has noConfig
, no storage, no extrinsics, etc. We can and imo should just make this a sub directory of theconnectors-gateway
pallet. -
Having
connectors-gateway-routers/routers/
hosting the "primitives" of the actual routers in the root dir (i.e,connectors-gateway-routers/axelar_evm.rs
,connectors-gateway-routers/ethereum_xcm.rs
, etc) is counter-intuitive. I suggest that we do:
./connectors-gateway/
|- ./routers/
|- ./mod.rs # contains all primitives used by the actual routers; if useful, can group them in `mod`s
|- axelar_evm.rs
|- axelar_xcm.rs
|- ethereum_xcm.rs
- the
do_init
pattern is something that I personally have never seen in Substate. Happy to change my mind, but as of now I'd rather drop that and write a migration instead that sets whatever state we may want to set once we are ready to do that (we know the right weights, chain ids, etc)
pallets/connectors-gateway/connectors-gateway-routers/Cargo.toml
Outdated
Show resolved
Hide resolved
pallets/connectors-gateway/connectors-gateway-routers/src/axelar_evm.rs
Outdated
Show resolved
Hide resolved
pallets/connectors-gateway/connectors-gateway-routers/src/axelar_evm.rs
Outdated
Show resolved
Hide resolved
pallets/connectors-gateway/connectors-gateway-routers/src/lib.rs
Outdated
Show resolved
Hide resolved
Regarding the last point - there are some pallets with init logic based on the genesis config, the session-info pallet would be one example IIRC. As for the second part regarding migration/setting of required states, I think it makes sense to have it like this since we would only need one governance step for adding a router, otherwise, in the case of XCM, we would need 2 calls to set the storages + 1 call to set the router, and I don't see a good reason for that. |
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.
Just some random comments, not a review at all!
Thanks again for spliting the PRs, much easier to understand everything!
pallets/connectors-gateway/connectors-gateway-routers/src/mock.rs
Outdated
Show resolved
Hide resolved
35dfaa1
to
afb5f32
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.
Looking better already, thanks for taking the comments in consideration 🙏
A few more comments. I will do another round later going through the details of the messages encoding since it's important to check those outs more carefully
7505ca8
to
cdb99c0
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.
LGTM! We will probably find some quirks when testing this on Moonbase Alpha but since it's all in development and appears correct we are good merging this imo.
The only thing I would still say is whether there really is a need for a separate crate for these routers over having them as a sub-dir of connectors-gateway
. Not a blocker for me!
Thanks a lot for all the work and all the positivity in taking in all the review comments 🙏
@mustermeiszer came with the idea of having routers in a separate crate, and given the xcm/evm dependencies that we need there I think it makes sense to have it like that and not to bloat the actual gateway. |
Fair points, this is fine 👍 |
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.
Nice setup! Pretty flexible!
pallet_xcm_transactor::Pallet::<T>::set_transact_info( | ||
<T as frame_system::Config>::RuntimeOrigin::root(), | ||
self.xcm_domain.location.clone(), | ||
self.xcm_domain.transact_info.transact_extra_weight, | ||
self.xcm_domain.transact_info.max_weight, | ||
self.xcm_domain.transact_info.transact_extra_weight_signed, | ||
)?; |
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.
Could we run into troubles if
RouterA
sets these values- time passes and we add a new
RouterB
RouterB
overwrites values with a new value?
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.
I don't think so. In theory, we should only have one router for a specific location, so if at some point we overwrite the router I think it makes sense to overwrite the xcm transactor info that is stored.
// The currency in which we want to pay fees. | ||
CurrencyPayment { | ||
currency: Currency::AsCurrencyId(self.xcm_domain.fee_currency.clone()), | ||
fee_amount: None, |
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 None
?
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 was as per the original connectors implementation found here -
fee_amount: None, |
Maybe @NunoAlexandre can provide more specific info?
Description
Part 3 of - #1376
The routers added in this PR will be used by the
Connectors Gateway
pallet when sending outgoing messages via EVM or XCM.Currently there are 3 routers:
Changes and Descriptions
Connectors Gateway
routersChecklist: