Skip to content
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

feat: handle message cancellations on L1 #1638

Open
apoorvsadana opened this issue Jun 24, 2024 · 2 comments
Open

feat: handle message cancellations on L1 #1638

apoorvsadana opened this issue Jun 24, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@apoorvsadana
Copy link
Collaborator

Currently, the Madara node listens to every new message on the L1 and executes the corresponding L1_HANDLER transaction. There's an edge case here related to L1 message cancellations. Currently, Starknet allows users to cancel L1 messages after a fixed L1L2_MESSAGE_CANCELLATION_DELAY (which is 5 days at the moment). This creates the following edge case

  1. User cancels the message immediately after sending it
  2. Madara reads the message at L1L2_MESSAGE_CANCELLATION_DELAY - X where X < SETTLEMENT_TIME.
  3. At L1L2_MESSAGE_CANCELLATION_DELAY, the user revokes the message
  4. Settlement happens after L1L2_MESSAGE_CANCELLATION_DELAY and state update fails because message was revoked

A simple solution to solve this would be

  1. When processing a new L1 message, check if the message has initiated the cancellation. If yes, skip the processing. (can there be any issues if the user doesn't cancel it later on + it's never processed? I don't think so but maybe we can confirm)
  2. As long as L1L2_MESSAGE_CANCELLATION_DELAY is sufficiently grater than SETTLEMENT_TIME this shouldn't cause any issue.
@apoorvsadana apoorvsadana added the enhancement New feature or request label Jun 24, 2024
@fishseabowl
Copy link
Contributor

@apoorvsadana could I take this? Thanks

@apoorvsadana
Copy link
Collaborator Author

Sure @fishseabowl, assigned!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants