Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
a96b2282
Unverified
Commit
a96b2282
authored
Sep 27, 2024
by
Hamdi Allam
Committed by
GitHub
Sep 27, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sent message event and l2tol2cdm relayMessage entrypoint (#11592)
parent
d141b53e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
448 additions
and
379 deletions
+448
-379
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+2
-2
L2ToL2CrossDomainMessenger.json
...cts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json
+99
-31
L2ToL2CrossDomainMessenger.sol
...s/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol
+94
-67
IL2ToL2CrossDomainMessenger.sol
...bedrock/src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol
+5
-16
Hashing.sol
packages/contracts-bedrock/src/libraries/Hashing.sol
+3
-3
L2ToL2CrossDomainMessenger.t.sol
...ontracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol
+245
-260
No files found.
packages/contracts-bedrock/semver-lock.json
View file @
a96b2282
...
@@ -112,8 +112,8 @@
...
@@ -112,8 +112,8 @@
"sourceCodeHash"
:
"0xd08a2e6514dbd44e16aa312a1b27b2841a9eab5622cbd05a39c30f543fad673c"
"sourceCodeHash"
:
"0xd08a2e6514dbd44e16aa312a1b27b2841a9eab5622cbd05a39c30f543fad673c"
},
},
"src/L2/L2ToL2CrossDomainMessenger.sol"
:
{
"src/L2/L2ToL2CrossDomainMessenger.sol"
:
{
"initCodeHash"
:
"0x6
52e07372d45f0f861aa65b4a73db55871291b875ced02df893a405419de723a
"
,
"initCodeHash"
:
"0x6
f19eb8ff0950156b65cd92872240c0153ac5f3b6f0861d57bf561fdbcacbeac
"
,
"sourceCodeHash"
:
"0x
c3e73c2d9abf3c7853d2505a83e475d58e96ab5fc5ad7770d04dea5feb9e5717
"
"sourceCodeHash"
:
"0x
fea53344596d735eff3be945ed1300dc75a6f8b7b2c02c0043af5b0036f5f239
"
},
},
"src/L2/OptimismSuperchainERC20.sol"
:
{
"src/L2/OptimismSuperchainERC20.sol"
:
{
"initCodeHash"
:
"0xe3dbb0851669708901a4c6bb7ad7d55f9896deeec02cbe53ac58d689ff95b88b"
,
"initCodeHash"
:
"0xe3dbb0851669708901a4c6bb7ad7d55f9896deeec02cbe53ac58d689ff95b88b"
,
...
...
packages/contracts-bedrock/snapshots/abi/L2ToL2CrossDomainMessenger.json
View file @
a96b2282
...
@@ -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"
:
"_
m
essage"
,
"name"
:
"_
sentM
essage"
,
"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"
:
"
CrossL2Inbox
OriginNotL2ToL2CrossDomainMessenger"
,
"name"
:
"
Id
OriginNotL2ToL2CrossDomainMessenger"
,
"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
packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol
View file @
a96b2282
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol
View file @
a96b2282
// 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;
}
}
packages/contracts-bedrock/src/libraries/Hashing.sol
View file @
a96b2282
...
@@ -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 hashL2toL2CrossDomainMess
engerRelayMess
age(
function hashL2toL2CrossDomainMessage(
uint256 _destination,
uint256 _destination,
uint256 _source,
uint256 _source,
uint256 _nonce,
uint256 _nonce,
...
...
packages/contracts-bedrock/test/L2/L2ToL2CrossDomainMessenger.t.sol
View file @
a96b2282
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment