diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 99f5f7e3627..4dd7c2085b5 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -49,6 +49,12 @@ contract TaikoL2 is CrossChainOwned { /// @notice The last synced L1 block height. uint64 public lastSyncedBlock; + /// @notice The parent block's timestamp. + uint64 public parentTimestamp; + + /// @notice The current block's timestamp. + uint64 private __currentBlockTimestamp; + uint256[47] private __gap; /// @notice Emitted when the latest L1 block details are anchored to L2. @@ -95,6 +101,7 @@ contract TaikoL2 is CrossChainOwned { gasExcess = _gasExcess; (publicInputHash,) = _calcPublicInputHash(block.number); + __currentBlockTimestamp = uint64(block.timestamp); } /// @notice Anchors the latest L1 block details to L2 for cross-layer @@ -154,6 +161,9 @@ contract TaikoL2 is CrossChainOwned { l2Hashes[parentId] = blockhash(parentId); publicInputHash = publicInputHashNew; + parentTimestamp = __currentBlockTimestamp; + __currentBlockTimestamp = uint64(block.timestamp); + emit Anchored(blockhash(parentId), gasExcess); }