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
User cancels the message immediately after sending it
Madara reads the message at L1L2_MESSAGE_CANCELLATION_DELAY - X where X < SETTLEMENT_TIME.
At L1L2_MESSAGE_CANCELLATION_DELAY, the user revokes the message
Settlement happens after L1L2_MESSAGE_CANCELLATION_DELAY and state update fails because message was revoked
A simple solution to solve this would be
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)
As long as L1L2_MESSAGE_CANCELLATION_DELAY is sufficiently grater than SETTLEMENT_TIME this shouldn't cause any issue.
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 fixedL1L2_MESSAGE_CANCELLATION_DELAY
(which is 5 days at the moment). This creates the following edge caseA simple solution to solve this would be