From 30abc4a46f0b3425d868b55addef40cc20d4744d Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Thu, 5 Sep 2024 14:59:56 +0900 Subject: [PATCH] Update LibProposing.sol --- .../protocol/contracts/L1/libs/LibProposing.sol | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index b4a4373fac..1b51a23a8d 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -57,9 +57,8 @@ library LibProposing { public returns (TaikoData.BlockMetadataV2[] memory metas_) { - require( - _paramsArr.length != 0 && _paramsArr.length == _txListArr.length, L1_INVALID_PARAMS() - ); + require(_paramsArr.length != 0, L1_INVALID_PARAMS()); + require(_paramsArr.length == _txListArr.length, L1_INVALID_PARAMS()); metas_ = new TaikoData.BlockMetadataV2[](_paramsArr.length); @@ -149,22 +148,22 @@ library LibProposing { // The other constraint is that the L1 block number needs to be larger than or equal // the one in the previous L2 block. require( - local.params.anchorBlockId + _config.maxAnchorHeightOffset >= block.number // - && local.params.anchorBlockId < block.number - && local.params.anchorBlockId >= parentBlk.proposedIn, + local.params.anchorBlockId + _config.maxAnchorHeightOffset >= block.number, L1_INVALID_ANCHOR_BLOCK() ); + require(local.params.anchorBlockId < block.number, L1_INVALID_ANCHOR_BLOCK()); + require(local.params.anchorBlockId >= parentBlk.proposedIn, L1_INVALID_ANCHOR_BLOCK()); // Verify the passed in timestamp. // We only allow the timestamp to be 2 epochs old. // The other constraint is that the timestamp needs to be larger than or equal the // one in the previous L2 block. require( - local.params.timestamp + _config.maxAnchorHeightOffset * 12 >= block.timestamp - && local.params.timestamp <= block.timestamp - && local.params.timestamp >= parentBlk.proposedAt, + local.params.timestamp + _config.maxAnchorHeightOffset * 12 >= block.timestamp, L1_INVALID_TIMESTAMP() ); + require(local.params.timestamp <= block.timestamp, L1_INVALID_TIMESTAMP()); + require(local.params.timestamp >= parentBlk.proposedAt, L1_INVALID_TIMESTAMP()); // Check if parent block has the right meta hash. This is to allow the proposer to make // sure the block builds on the expected latest chain state.