Commit a96b2282 authored by Hamdi Allam's avatar Hamdi Allam Committed by GitHub

sent message event and l2tol2cdm relayMessage entrypoint (#11592)

parent d141b53e
......@@ -112,8 +112,8 @@
"sourceCodeHash": "0xd08a2e6514dbd44e16aa312a1b27b2841a9eab5622cbd05a39c30f543fad673c"
},
"src/L2/L2ToL2CrossDomainMessenger.sol": {
"initCodeHash": "0x652e07372d45f0f861aa65b4a73db55871291b875ced02df893a405419de723a",
"sourceCodeHash": "0xc3e73c2d9abf3c7853d2505a83e475d58e96ab5fc5ad7770d04dea5feb9e5717"
"initCodeHash": "0x6f19eb8ff0950156b65cd92872240c0153ac5f3b6f0861d57bf561fdbcacbeac",
"sourceCodeHash": "0xfea53344596d735eff3be945ed1300dc75a6f8b7b2c02c0043af5b0036f5f239"
},
"src/L2/OptimismSuperchainERC20.sol": {
"initCodeHash": "0xe3dbb0851669708901a4c6bb7ad7d55f9896deeec02cbe53ac58d689ff95b88b",
......
......@@ -54,33 +54,40 @@
{
"inputs": [
{
"internalType": "uint256",
"name": "_destination",
"type": "uint256"
"components": [
{
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"internalType": "uint256",
"name": "_source",
"name": "blockNumber",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_nonce",
"name": "logIndex",
"type": "uint256"
},
{
"internalType": "address",
"name": "_sender",
"type": "address"
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "address",
"name": "_target",
"type": "address"
"internalType": "uint256",
"name": "chainId",
"type": "uint256"
}
],
"internalType": "struct ICrossL2Inbox.Identifier",
"name": "_id",
"type": "tuple"
},
{
"internalType": "bytes",
"name": "_message",
"name": "_sentMessage",
"type": "bytes"
}
],
......@@ -111,7 +118,7 @@
"outputs": [
{
"internalType": "bytes32",
"name": "msgHash_",
"name": "",
"type": "bytes32"
}
],
......@@ -153,6 +160,18 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "source",
"type": "uint256"
},
{
"indexed": true,
"internalType": "uint256",
"name": "messageNonce",
"type": "uint256"
},
{
"indexed": true,
"internalType": "bytes32",
......@@ -166,6 +185,18 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "source",
"type": "uint256"
},
{
"indexed": true,
"internalType": "uint256",
"name": "messageNonce",
"type": "uint256"
},
{
"indexed": true,
"internalType": "bytes32",
......@@ -176,9 +207,51 @@
"name": "RelayedMessage",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "destination",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "target",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "messageNonce",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "message",
"type": "bytes"
}
],
"name": "SentMessage",
"type": "event"
},
{
"inputs": [],
"name": "EventPayloadNotSentMessage",
"type": "error"
},
{
"inputs": [],
"name": "CrossL2InboxOriginNotL2ToL2CrossDomainMessenger",
"name": "IdOriginNotL2ToL2CrossDomainMessenger",
"type": "error"
},
{
......@@ -215,10 +288,5 @@
"inputs": [],
"name": "ReentrantCall",
"type": "error"
},
{
"inputs": [],
"name": "RelayMessageCallerNotCrossL2Inbox",
"type": "error"
}
]
\ No newline at end of file
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ICrossL2Inbox } from "src/L2/interfaces/ICrossL2Inbox.sol";
/// @title IL2ToL2CrossDomainMessenger
/// @notice Interface for the L2ToL2CrossDomainMessenger contract.
interface IL2ToL2CrossDomainMessenger {
......@@ -45,20 +47,7 @@ interface IL2ToL2CrossDomainMessenger {
/// @notice Relays a message that was sent by the other CrossDomainMessenger contract. Can only
/// be executed via cross-chain call from the other messenger OR if the message was
/// already received once and is currently being replayed.
/// @param _destination Chain ID of the destination chain.
/// @param _nonce Nonce of the message being relayed.
/// @param _sender Address of the user who sent the message.
/// @param _source Chain ID of the source chain.
/// @param _target Address that the message is targeted at.
/// @param _message Message to send to the target.
function relayMessage(
uint256 _destination,
uint256 _source,
uint256 _nonce,
address _sender,
address _target,
bytes calldata _message
)
external
payable;
/// @param _id Identifier of the SentMessage event to be relayed
/// @param _sentMessage Message payload of the `SentMessage` event
function relayMessage(ICrossL2Inbox.Identifier calldata _id, bytes calldata _sentMessage) external payable;
}
......@@ -122,8 +122,8 @@ library Hashing {
);
}
/// @notice Generates a unique hash for a message to be relayed across chains. This hash is
/// used to identify the message and ensure it is not relayed more than once.
/// @notice Generates a unique hash for cross l2 messages. This hash is used to identify
/// the message and ensure it is not relayed more than once.
/// @param _destination Chain ID of the destination chain.
/// @param _source Chain ID of the source chain.
/// @param _nonce Unique nonce associated with the message to prevent replay attacks.
......@@ -131,7 +131,7 @@ library Hashing {
/// @param _target Address of the contract or wallet that the message is targeting on the destination chain.
/// @param _message The message payload to be relayed to the target on the destination chain.
/// @return Hash of the encoded message parameters, used to uniquely identify the message.
function hashL2toL2CrossDomainMessengerRelayMessage(
function hashL2toL2CrossDomainMessage(
uint256 _destination,
uint256 _source,
uint256 _nonce,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment