-
Notifications
You must be signed in to change notification settings - Fork 84
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
lp-gateway: Drop session ID invalidation #1965
lp-gateway: Drop session ID invalidation #1965
Conversation
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.
Thanks Cosmin! I like the new direction. A couple of questions
Question 1. Can you elaborate on why we need the InboundEntry
as an enum?
Could we not have something like (Option<Message>, SessionId, DomainAddress, count)
, avoiding to deal with the enum variants?
Question 2. How are we ensuring two proofs are not comming from the same router? Should not that information be stored somehow in the InboundEntry
? (maybe a list of RouterId
of the read proofs or similar)
session_id: T::SessionId, | ||
domain_address: DomainAddress, | ||
message: T::Message, | ||
expected_proof_count: u32, |
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 not always the expected_proof_count
be infered by knowing the number of routers under domain_address
?
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, but if we want to support duplicate messages and ensure they don't get lost, we need to keep track of this and increment it accordingly, as per this.
The enum made sense to me since it's a lot easier to deal with a struct-like entity like this instead of a tuple. Furthermore, it creates a clear distinction between message and message proof entries. Given that we have certain rules in place for defining which router can send what, such as these, this distinction allows us to perform validation such as this. |
We don't need to ensure this, if we would, we wouldn't be able to support duplicate messages. |
Yeah, when I wrote a tuple I wanted to write mostly a struct.
I'm pretty sure we need it... This is where the "vote" concept comes into play. Suppose you have 2 duplicated messages. Then you dispatch the first one to be processed once you have at least one vote from all associated routers. At least this is how it works in Solidity. |
We should expect multiple proofs from the same router. Given a setup with 3 routers x, y, z, where x is supposed to send the message, y and z are supposed to send the proofs, we would expect 1 message + 2 proofs in order to process 1 message. Given this, we can have a scenario where we receive 4 proofs from y and z, 2 each, and then 2 messages from x. Cases similar to what I described above are covered in the unit tests - here. |
Yes, and that is where the vote for that pair (message_hash, router) increments to 2. In the current implementation, we can receive a message from x, two proofs from y, and the message will be processed without waiting for z, or am I missing something? |
Ah ok, you're right! I didn't see well that part 👍🏻 So, to double-check. The current implementation can:
|
Correct! |
Anyway @lemunozm, this PR is dealing with some other changes not necessarily related to votes etc. Do you mind if I merge this in the main branch and continue discussions there? |
Yeah, sure! Having understood that, I think everything now is working as it should 👍🏻 Let's merge it |
6541a7f
into
feat/lp-v2-gateway-multi-router
Also, I think now |
* lp-gateway: Drop session ID invalidation * lp-gateway: Add test for invalid router
* lp-gateway: Drop session ID invalidation * lp-gateway: Add test for invalid router
* 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
Addressing some comments from - #1961.