@@ -17,6 +17,12 @@ interface IDependencySet {
1717 function isInDependencySet (uint256 _chainId ) external view returns (bool );
1818}
1919
20+ /// @notice Thrown when the caller is not DEPOSITOR_ACCOUNT when calling `setInteropStart()`
21+ error NotDepositor ();
22+
23+ /// @notice Thrown when attempting to set interop start when it's already set.
24+ error InteropStartAlreadySet ();
25+
2026/// @notice Thrown when a non-written transient storage slot is attempted to be read from.
2127error NotEntered ();
2228
@@ -35,6 +41,10 @@ error TargetCallFailed();
3541/// @notice The CrossL2Inbox is responsible for executing a cross chain message on the destination
3642/// chain. It is permissionless to execute a cross chain message on behalf of any user.
3743contract CrossL2Inbox is ICrossL2Inbox , ISemver , TransientReentrancyAware {
44+ /// @notice Storage slot that the interop start timestamp is stored at.
45+ /// Equal to bytes32(uint256(keccak256("crossl2inbox.interopstart")) - 1)
46+ bytes32 internal constant INTEROP_START_SLOT = 0x5c769ee0ee8887661922049dc52480bb60322d765161507707dd9b190af5c149 ;
47+
3848 /// @notice Transient storage slot that the origin for an Identifier is stored at.
3949 /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.origin")) - 1)
4050 bytes32 internal constant ORIGIN_SLOT = 0xd2b7c5071ec59eb3ff0017d703a8ea513a7d0da4779b0dbefe845808c300c815 ;
@@ -55,15 +65,42 @@ contract CrossL2Inbox is ICrossL2Inbox, ISemver, TransientReentrancyAware {
5565 /// Equal to bytes32(uint256(keccak256("crossl2inbox.identifier.chainid")) - 1)
5666 bytes32 internal constant CHAINID_SLOT = 0x6e0446e8b5098b8c8193f964f1b567ec3a2bdaeba33d36acb85c1f1d3f92d313 ;
5767
68+ /// @notice The address that represents the system caller responsible for L1 attributes
69+ /// transactions.
70+ address internal constant DEPOSITOR_ACCOUNT = 0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001 ;
71+
5872 /// @notice Semantic version.
59- /// @custom:semver 1.0.0-beta.4
60- string public constant version = "1.0.0-beta.4 " ;
73+ /// @custom:semver 1.0.0-beta.5
74+ string public constant version = "1.0.0-beta.5 " ;
6175
6276 /// @notice Emitted when a cross chain message is being executed.
6377 /// @param msgHash Hash of message payload being executed.
6478 /// @param id Encoded Identifier of the message.
6579 event ExecutingMessage (bytes32 indexed msgHash , Identifier id );
6680
81+ /// @notice Sets the Interop Start Timestamp for this chain. Can only be performed once and when the caller is the
82+ /// DEPOSITOR_ACCOUNT.
83+ function setInteropStart () external {
84+ // Check that caller is the DEPOSITOR_ACCOUNT
85+ if (msg .sender != DEPOSITOR_ACCOUNT) revert NotDepositor ();
86+
87+ // Check that it has not been set already
88+ if (interopStart () != 0 ) revert InteropStartAlreadySet ();
89+
90+ // Set Interop Start to block.timestamp
91+ assembly {
92+ sstore (INTEROP_START_SLOT, timestamp ())
93+ }
94+ }
95+
96+ /// @notice Returns the interop start timestamp.
97+ /// @return interopStart_ interop start timestamp.
98+ function interopStart () public view returns (uint256 interopStart_ ) {
99+ assembly {
100+ interopStart_ := sload (INTEROP_START_SLOT)
101+ }
102+ }
103+
67104 /// @notice Returns the origin address of the Identifier. If not entered, reverts.
68105 /// @return Origin address of the Identifier.
69106 function origin () external view notEntered returns (address ) {
@@ -140,7 +177,7 @@ contract CrossL2Inbox is ICrossL2Inbox, ISemver, TransientReentrancyAware {
140177 /// is in the destination chain's dependency set.
141178 /// @param _id Identifier of the message.
142179 function _checkIdentifier (Identifier calldata _id ) internal view {
143- if (_id.timestamp > block .timestamp ) revert InvalidTimestamp ();
180+ if (_id.timestamp > block .timestamp || _id.timestamp <= interopStart () ) revert InvalidTimestamp ();
144181 if (! IDependencySet (Predeploys.L1_BLOCK_ATTRIBUTES).isInDependencySet (_id.chainId)) {
145182 revert InvalidChainId ();
146183 }
0 commit comments