Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l1-contracts/contracts/common/L1ContractErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ error BaseTokenTransferFailed();
error BatchHashMismatch(bytes32 expected, bytes32 actual);
// 0xbd4455ff
error BatchNumberMismatch(uint256 expectedBatchNumber, uint256 providedBatchNumber);
error BatchTimestampGreaterThanLastL2BlockTimestamp();
// 0x6cf12312
error BridgeHubAlreadyRegistered();
// 0xdb538614
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {IChainTypeManager} from "../../IChainTypeManager.sol";
import {IL1DAValidator, L1DAValidatorOutput} from "../../chain-interfaces/IL1DAValidator.sol";
import {
BatchNumberMismatch,
BatchTimestampGreaterThanLastL2BlockTimestamp,
CanOnlyProcessOneBatch,
EmptyPrecommitData,
HashMismatch,
Expand Down Expand Up @@ -458,6 +459,9 @@ contract CommitterFacet is ZKChainBase, ICommitter {
revert InvalidTxCountInPriorityMode(_newBatch.numberOfLayer2Txs, _newBatch.numberOfLayer1Txs);
}

if (_newBatch.firstBlockTimestamp > _newBatch.lastBlockTimestamp) {
revert BatchTimestampGreaterThanLastL2BlockTimestamp();
}
if (block.timestamp - COMMIT_TIMESTAMP_NOT_OLDER > _newBatch.firstBlockTimestamp) {
revert TimeNotReached(_newBatch.firstBlockTimestamp, block.timestamp - COMMIT_TIMESTAMP_NOT_OLDER);
}
Expand Down Expand Up @@ -583,6 +587,13 @@ contract CommitterFacet is ZKChainBase, ICommitter {
}

uint256 lastL2BlockTimestamp = _packedBatchAndL2BlockTimestamp & PACKED_L2_BLOCK_TIMESTAMP_MASK;

// Ensure that batchTimestamp <= lastL2BlockTimestamp, which is required for the
// [batchTimestamp, lastL2BlockTimestamp] range to be valid.
if (batchTimestamp > lastL2BlockTimestamp) {
revert BatchTimestampGreaterThanLastL2BlockTimestamp();
}

// All L2 blocks have timestamps within the range of [batchTimestamp, lastL2BlockTimestamp].
// So here we need to only double check that:
// - The timestamp of the batch is not too small.
Expand Down