-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
l1-contracts/src/core/interfaces/messagebridge/INewInbox.sol
This file contains 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,42 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Aztec Labs. | ||
pragma solidity >=0.8.18; | ||
|
||
import {DataStructures} from "../../libraries/DataStructures.sol"; | ||
|
||
/** | ||
* @title Inbox | ||
* @author Aztec Labs | ||
* @notice Lives on L1 and is used to pass messages into the rollup, e.g., L1 -> L2 messages. | ||
*/ | ||
// TODO: rename to IInbox once all the pieces of the new message model are in place. | ||
interface INewInbox { | ||
event LeafInserted(uint256 indexed blockNumber, uint256 index, bytes32 value); | ||
|
||
// docs:start:send_l1_to_l2_message | ||
/** | ||
* @notice Inserts a new message into the Inbox | ||
* @dev Emits `LeafInserted` with data for easy access by the sequencer | ||
* @param _recipient - The recipient of the message | ||
* @param _content - The content of the message (application specific) | ||
* @param _secretHash - The secret hash of the message (make it possible to hide when a specific message is consumed on L2) | ||
* @return The key of the message in the set | ||
*/ | ||
function sendL2Message( | ||
DataStructures.L2Actor memory _recipient, | ||
bytes32 _content, | ||
bytes32 _secretHash | ||
) external returns (bytes32); | ||
// docs:end:send_l1_to_l2_message | ||
|
||
// docs:start:inbox_batch_consume | ||
/** | ||
* @notice Consumes the current tree, and starts a new one if needed | ||
* @dev Only callable by the rollup contract | ||
* @dev In the first iteration we return empty tree root because first block's messages tree is always | ||
* empty because there has to be a 1 block lag to prevent sequencer DOS attacks | ||
* @return The root of the consumed tree | ||
*/ | ||
function consume() external returns (bytes32); | ||
// docs:end:inbox_batch_consume | ||
} |
This file contains 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