diff --git a/contracts/docs/apis/ZKRollup.md b/contracts/docs/apis/ZKRollup.md index 695bc4672..6205d2ea7 100644 --- a/contracts/docs/apis/ZKRollup.md +++ b/contracts/docs/apis/ZKRollup.md @@ -232,6 +232,50 @@ function initialize(uint256 _chainId) external nonpayable |---|---|---| | _chainId | uint256 | undefined | +### isBlockFinalized + +```solidity +function isBlockFinalized(bytes32 _blockHash) external view returns (bool) +``` + +Return whether the block is finalized by block hash. + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _blockHash | bytes32 | undefined | + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | undefined | + +### isBlockFinalized + +```solidity +function isBlockFinalized(uint256 _blockHeight) external view returns (bool) +``` + +Return whether the block is finalized by block height. + + + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| _blockHeight | uint256 | undefined | + +#### Returns + +| Name | Type | Description | +|---|---|---| +| _0 | bool | undefined | + ### lastFinalizedBatchID ```solidity diff --git a/contracts/src/L1/L1ScrollMessenger.sol b/contracts/src/L1/L1ScrollMessenger.sol index 7da6d8557..b2269f7a5 100644 --- a/contracts/src/L1/L1ScrollMessenger.sol +++ b/contracts/src/L1/L1ScrollMessenger.sol @@ -97,7 +97,7 @@ contract L1ScrollMessenger is OwnableUpgradeable, PausableUpgradeable, ScrollMes require(!isMessageExecuted[_msghash], "Message successfully executed"); // @todo check proof - require(IZKRollup(rollup).verifyMessageStateProof(_proof.batchIndex, _proof.blockHeight), "invalid state proof"); + require(IZKRollup(rollup).isBlockFinalized(_proof.blockHeight), "invalid state proof"); require(ZkTrieVerifier.verifyMerkleProof(_proof.merkleProof), "invalid proof"); // @todo check `_to` address to avoid attack.