-
Notifications
You must be signed in to change notification settings - Fork 44
feat: resend message #259
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
Merged
Merged
feat: resend message #259
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# [Project Name]: Design Doc | ||
|
||
| | | | ||
| ------------------ | --------------------------- | | ||
| Author | 0xDiscotech | | ||
| Created at | _2025-04-08_ | | ||
| Initial Reviewers | agusduha, skeletor-spaceman | | ||
| Need Approval From | | | ||
| Status | In Review | | ||
|
||
## Purpose | ||
|
||
To provide a mechanism for users to re-emit a previously sent message event on origin, ensuring that stale messages can be picked up and relayed on destination. | ||
|
||
## Summary | ||
|
||
This feature introduces a new function that allows a re-emission of the SentMessage event for messages that have been sent but not yet relayed. The re-emission helps offchain infrastructure detect and relay messages that might otherwise be ignored due to their age. It does not affect messages that have already been relayed on the destination chain. | ||
|
||
## Problem Statement + Context | ||
|
||
This feature introduces a new function that allows a re-emission of the `SentMessage` event for messages that have been sent but not yet relayed. The re-emission helps offchain infrastructure detect and relay messages that might otherwise be ignored due to their age. It does not affect messages that have already been relayed on the destination chain. | ||
|
||
## Proposed Solution | ||
|
||
We propose adding a new `resendMessage` function on the `L2ToL2CrossDomainMessenger` contract. This function will accept message hash inputs as parameters (with `source` being the exception since it will be hardcoded as the current chain id), it will calculate the message hash, check that it was sent and it will re-emit the corresponding `SentMessage` event. | ||
|
||
### Resource Usage | ||
|
||
- It adds an additional `sstore` on `L2ToL2CrossDomainMessenger#sendMessage` function to store the `messageHash` with `true` as the value on the `sentMessages` mapping. | ||
- It adds a new (small) function: `resendMessage`, which leads to a slightly higher deployment cost than the previous contract’s version. | ||
|
||
## Failure Mode Analysis | ||
|
||
- **Re-emitting a log for a valid message sent hash with different message params:** | ||
A hash collision could occur where different message params result in any valid message sent. This would involve a bug in the `Hashing` library logic or a hash collision, for which it’s likelihood is very low. | ||
|
||
## Risks | ||
|
||
- **Already Relayed Messages:** | ||
Re-emitting a message already relayed MUST HAVE no effect because the system MUST process each message only once. The logic on `relayMessage` should always handle this case in this way, as it currently does. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[nitpick] Consider correcting the contraction 'it’s' to 'its' and rephrasing the sentence for improved clarity.
Copilot uses AI. Check for mistakes.
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.
972aefc