-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Resolves #4768 --------- Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com> Co-authored-by: Jan Beneš <janbenes1234@gmail.com> Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com> Co-authored-by: josh crites <critesjosh@gmail.com> Co-authored-by: Aztec Bot <49558828+AztecBot@users.noreply.github.com>
- Loading branch information
1 parent
438d16f
commit 6421a3d
Showing
14 changed files
with
856 additions
and
56 deletions.
There are no files selected for viewing
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
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
62 changes: 62 additions & 0 deletions
62
l1-contracts/src/core/interfaces/messagebridge/INewOutbox.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,62 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2024 Aztec Labs. | ||
pragma solidity >=0.8.18; | ||
|
||
import {DataStructures} from "../../libraries/DataStructures.sol"; | ||
|
||
/** | ||
* @title INewOutbox | ||
* @author Aztec Labs | ||
* @notice Lives on L1 and is used to consume L2 -> L1 messages. Messages are inserted by the Rollup | ||
* and will be consumed by the portal contracts. | ||
*/ | ||
// TODO: rename to IOutbox once all the pieces of the new message model are in place. | ||
interface INewOutbox { | ||
event RootAdded(uint256 indexed l2BlockNumber, bytes32 indexed root, uint256 height); | ||
event MessageConsumed( | ||
uint256 indexed l2BlockNumber, | ||
bytes32 indexed root, | ||
bytes32 indexed messageHash, | ||
uint256 leafIndex | ||
); | ||
|
||
/** | ||
* @notice Inserts the root of a merkle tree containing all of the L2 to L1 messages in | ||
* a block specified by _l2BlockNumber. | ||
* @dev Only callable by the rollup contract | ||
* @dev Emits `RootAdded` upon inserting the root successfully | ||
* @param _l2BlockNumber - The L2 Block Number in which the L2 to L1 messages reside | ||
* @param _root - The merkle root of the tree where all the L2 to L1 messages are leaves | ||
* @param _height - The height of the merkle tree that the root corresponds to | ||
*/ | ||
function insert(uint256 _l2BlockNumber, bytes32 _root, uint256 _height) external; | ||
|
||
/** | ||
* @notice Consumes an entry from the Outbox | ||
* @dev Only useable by portals / recipients of messages | ||
* @dev Emits `MessageConsumed` when consuming messages | ||
* @param _l2BlockNumber - The block number specifying the block that contains the message we want to consume | ||
* @param _leafIndex - The index inside the merkle tree where the message is located | ||
* @param _message - The L2 to L1 message | ||
* @param _path - The sibling path used to prove inclusion of the message, the _path length directly depends | ||
* on the total amount of L2 to L1 messages in the block. i.e. the length of _path is equal to the depth of the | ||
* L1 to L2 message tree. | ||
*/ | ||
function consume( | ||
uint256 _l2BlockNumber, | ||
uint256 _leafIndex, | ||
DataStructures.L2ToL1Msg calldata _message, | ||
bytes32[] calldata _path | ||
) external; | ||
|
||
/** | ||
* @notice Checks to see if an index of the L2 to L1 message tree for a specific block has been consumed | ||
* @dev - This function does not throw. Out-of-bounds access is considered valid, but will always return false | ||
* @param _l2BlockNumber - The block number specifying the block that contains the index of the message we want to check | ||
* @param _leafIndex - The index of the message inside the merkle tree | ||
*/ | ||
function hasMessageBeenConsumedAtBlockAndIndex(uint256 _l2BlockNumber, uint256 _leafIndex) | ||
external | ||
view | ||
returns (bool); | ||
} |
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
Oops, something went wrong.