Skip to content

Commit

Permalink
fix(protocl): check blockId in getBlock and getBlockV2 (#18327)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Oct 28, 2024
1 parent 75feb5b commit 4288fb6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/protocol/contracts/layer1/based/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents {
/// @param _blockId Index of the block.
/// @return blk_ The block.
function getBlock(uint64 _blockId) external view returns (TaikoData.Block memory blk_) {
require(_blockId < getConfig().ontakeForkHeight, L1_INVALID_PARAMS());
(TaikoData.BlockV2 memory blk,) = LibUtils.getBlock(state, getConfig(), _blockId);
blk_ = LibData.blockV2toV1(blk);
}

/// @inheritdoc ITaikoL1
function getBlockV2(uint64 _blockId) external view returns (TaikoData.BlockV2 memory blk_) {
require(_blockId >= getConfig().ontakeForkHeight, L1_INVALID_PARAMS());
(blk_,) = LibUtils.getBlock(state, getConfig(), _blockId);
}

Expand Down

0 comments on commit 4288fb6

Please sign in to comment.