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