ethereum-optimism / ethereum-optimism/optimism
feat(messaging): add support for batched relay of L2-to-L2 messages
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 145
Description
Currently, `sendMessage()` and `relayMessage()` functions handle only one message per call. When executing complex workflows involving multiple cross-chain interactions, each message must be relayed separately. This introduces latency due to per-message block delays and increases the risk of partial execution.
**Describe the solution you'd like**
I propose the addition of a `relayBatchMessage()` function that enables relaying multiple L2-to-L2 messages atomically or in a tightly grouped context. The intention is to reduce overhead, simplify developer experience, and improve reliability in scenarios with multiple message dependencies.
```solidity
// pseudo-code
function relayBatchMessage(Identifier[] calldata ids, bytes[] calldata messages) external returns (bytes[] memory results);
```
**Describe alternatives you've considered**
- Using `sendMessage()` repeatedly with sequential relays, which introduces delay and complexity.
- Sending messages via a custom contract that later multicalls on the destination — not ideal as each call still requires a relay step.
**Additional context**
This would enable:
- Atomic execution of multiple dependent messages
- Reduced message latency
- Better UX for cross-chain apps using L2-to-L2 messaging
Contributor guide
Research direction
Start by locating the existing sendMessage() and relayMessage() entry points and tracing how L2-to-L2 messages are identified and executed. Clarify the atomicity and ordering requirements for relayBatchMessage(), then define completion around reliably handling multiple identifiers and payloads with the intended grouped or atomic behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100