-
Notifications
You must be signed in to change notification settings - Fork 85
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
Don't use domain when storing routers #1962
Don't use domain when storing routers #1962
Conversation
ensure!(domain != Domain::Centrifuge, Error::<T>::DomainNotSupported); | ||
|
||
//TODO(cdamian): Outbound - Call router.init() for each router? | ||
<Routers<T>>::set(router_ids.clone()); |
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.
Still a bit confused by this setup since the routers that we're storing are not the ones that we are using when processing...
Anyway, here I'm storing all the available routers right @lemunozm?
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 think when processing, you should check the router to process is on that Routers
list. We do not want to process a message if the user removes that router. But just 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.
So if a message comes from a not configured router, then the gateway will discard it
fn get_expected_proof_count(domain: &Domain) -> Result<u32, DispatchError> { | ||
let routers = Routers::<T>::get(domain).ok_or(Error::<T>::RoutersNotFound)?; | ||
fn get_expected_proof_count() -> Result<u32, DispatchError> { | ||
let routers = Routers::<T>::get(); |
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.
And here, for example, I should instead use T::RouterId::for_domain...
?
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.
Yes, because we want to get only the valid routers for the domain where the message comes
Main question would be, when to use |
|
Still not sure what the benefit is from doing all of this, instead of keeping track which router IDs are set for each domain, in storage, like the current approach. |
Because basically, This list:
|
But what's wrong about having this relation in storage? If this changes at any time, we'll have to do a RU right? If we store this, we just update the storage with whatever we need. |
In the current implementation, the gateway knows about this relation. And I would also argue that the gateway should know, going forward. |
The gateway doesn't know because not all Domain can be mapped to all Routers |
The relation is not something the operator can choose, is something inherent from how the chain is coded, statically |
Suppose, you use that storage. The user operator can add an entry Domain::Centrifuge with router AxelarEvm, which could not exists. Also the gateway can not check the relation is wrong |
OK, this is the case in the current implementation and one can definitely screw up the domain to router relationship.
^ fixes that. Thank you for clarifying @lemunozm! |
Will adjust some things here then merge so I can continue working on the initial branch for multi-routers. |
317631c
into
feat/lp-v2-gateway-multi-router
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip
* wip * lp-gateway: Add router hash for inbound messages, extrinsic to set inbound routers, session ID storage * lp-gateway: Add router hash for inbound messages, extrinsic to set inbound routers, session ID storage * lp-gateway: Use router hashes for inbound, use session ID, update inbound message processing logic * lp-gateway: Add and use InboundProcessingInfo * lp-gateway: Unit tests WIP * lp-gateway: Unit tests WIP 2 * docs: Improve comments * lp-gateway: Move message processing logic to a new file * lp-gateway: Merge inbound/outbound routers extrinsics into one, add logic for removing invalid session IDs on idle * lp-gateway: Unit tests WIP * lp-gateway: Add extrinsic for executing message recovery * rebase: WIP * Don't use domain when storing routers (#1962) * lp-gateway: Unit tests WIP * lp-gateway: Don't store routers under domain * wip * wip * lp-gateway: Unit test WIP * lp-gateway: Rename RouterSupport to RouterProvider, add separate entity that implements it * lp-gateway: Add more asserts in unit tests * lp-gateway: Attempt to execute message during recovery * lp-gateway: Remove extra constraints from SessionId * lp-gateway: Drop session ID invalidation (#1965) * lp-gateway: Drop session ID invalidation * lp-gateway: Add test for invalid router * lp-gateway: Add more unit tests * lp-gateway: Move InboundEntry logic to implementation * lp-gateway: Use safe math * lp-gateway: Add more unit tests * checks: Fix clippy, taplo, formatting * review: Remove mock-builder dep, rename LP encoding proof methods * lp-gateway: Remove Default impls for RouterId and GatewayMessage * lp-gateway: Allow empty list of routers * lp-gateway: Drop InboundProcessingInfo * lp-gateway: Rename LP encoding methods to get_proof and to_proof_message * lp-gateway: Move outbound processing logic back to pallet * review: Small fixes * lp-gateway: Add comment for post voting dispatch error case * lp-gatway: Drop session ID check in create_post_voting_entry * lp: Remove unused import * integration-tests: Register routers during setup (#1968) * integration-tests: Set routers in all setup funcs and tests
No description provided.