diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 1f4a39f1bbf..43ad057fbe4 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -228,26 +228,28 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents { /// @return blockId_ The last verified block's ID. /// @return blockHash_ The last verified block's blockHash. /// @return stateRoot_ The last verified block's stateRoot. + /// @return verifiedAt_ The timestamp this block is verified at. function getLastVerifiedBlock() external view - returns (uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_) + returns (uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) { blockId_ = state.slotB.lastVerifiedBlockId; - (blockHash_, stateRoot_) = LibUtils.getBlockInfo(state, getConfig(), blockId_); + (blockHash_, stateRoot_, verifiedAt_) = LibUtils.getBlockInfo(state, getConfig(), blockId_); } /// @notice Returns information about the last synchronized block. /// @return blockId_ The last verified block's ID. /// @return blockHash_ The last verified block's blockHash. /// @return stateRoot_ The last verified block's stateRoot. + /// @return verifiedAt_ The timestamp this block is verified at. function getLastSyncedBlock() external view - returns (uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_) + returns (uint64 blockId_, bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) { blockId_ = state.slotA.lastSyncedBlockId; - (blockHash_, stateRoot_) = LibUtils.getBlockInfo(state, getConfig(), blockId_); + (blockHash_, stateRoot_, verifiedAt_) = LibUtils.getBlockInfo(state, getConfig(), blockId_); } /// @notice Gets the state variables of the TaikoL1 contract. diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 0eadc384343..3f7fa3c36e3 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -127,7 +127,7 @@ library LibUtils { ) internal view - returns (bytes32 blockHash_, bytes32 stateRoot_) + returns (bytes32 blockHash_, bytes32 stateRoot_, uint64 verifiedAt_) { (TaikoData.Block storage blk, uint64 slot) = getBlock(_state, _config, _blockId); @@ -137,6 +137,7 @@ library LibUtils { blockHash_ = transition.blockHash; stateRoot_ = transition.stateRoot; + verifiedAt_ = transition.timestamp; } }