crates/lint/docs/block-timestamp.md
Severity: Low
ID: block-timestamp
Flags use of block.timestamp as an operand of a comparison, where its value can be slightly
manipulated by the block proposer.
Reports any comparison expression (<, <=, >, >=, ==, !=) that directly or
transitively reads block.timestamp.
Block proposers can adjust block.timestamp within a small window (a few seconds). This is
usually harmless, but for short-window logic — auctions ending, randomness, time-locked
withdrawals — a few seconds of manipulation can be enough for an attacker to capture value.
Using block.timestamp for general scheduling (hours/days) is fine; what's risky is fine-grained
timing and treating timestamps as a source of randomness.
function settle() external {
require(block.timestamp >= auctionEnd, "auction ongoing");
// ...
}
// Prefer block numbers for tight windows, or accept a clearly large grace period.
require(block.number >= endBlock, "auction ongoing");
This lint is intentionally conservative: not every flagged comparison is exploitable. Review each occurrence in context.