Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocl): check blockId in getBlock and getBlockV2 #18327

Merged
merged 1 commit into from
Oct 28, 2024
Merged
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
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
Loading