diff --git a/foundry.toml b/foundry.toml index aa93785905..c81a92dcce 100644 --- a/foundry.toml +++ b/foundry.toml @@ -53,3 +53,6 @@ runs = 256 [invariant] depth = 15 runs = 10 + +[lint] +lint_on_build = false \ No newline at end of file diff --git a/src/utils/BlockHashLib.sol b/src/utils/BlockHashLib.sol index c26fbabb25..ac79a73e57 100644 --- a/src/utils/BlockHashLib.sol +++ b/src/utils/BlockHashLib.sol @@ -22,10 +22,10 @@ library BlockHashLib { /// consistent with the EVM's native `BLOCKHASH` behavior. function blockHash(uint256 blockNumber) internal view returns (bytes32 result) { unchecked { - // If `blockNumber + 256` overflows: - // - Typical chain height (`block.number > 255`) -> `staticcall` -> 0. - // - Very early chain (`block.number <= 255`) -> `blockhash` -> 0. - if (block.number <= blockNumber + 256) return blockhash(blockNumber); + // If `blockNumber + 257` overflows: + // - Typical chain height (`block.number > 256`) -> `staticcall` -> 0. + // - Very early chain (`block.number <= 256`) -> `blockhash` -> 0. + if (block.number < blockNumber + 257) return blockhash(blockNumber); } /// @solidity memory-safe-assembly assembly {