This linter advice is incorrect and in practice block.timestamp is safe. The risks of using block numbers are higher because the block production rate is not deterministic. The linter advice is based on non-realistic security assumptions that are not a concern under any kind of real scenario.
More information on this answer.
Yes, not very often.
A miner can assemble a block full of transactions it made itself or from others that pay no gas. If the miner finds a nonce then the miner can commit that block.
However, consensus algorithms make it difficult for a lone miner to win the privilege of doing it. Mining pools are uniquely positioned to leverage transient miner advantages.
Off-chain randomness requires trusting the outside source to be a reliable oracle. It can be gamed.
On-chain randomness is randomness generated within the (Ethereum) blockchain. That makes it trustworthy.
There are two major options for on-chain randomness on Ethereum:
VRF - which is permissioned by Chainlink; or
VOR - which is an open API by Unification
You can use block.number as a measure of duration, taking into account that you are considering an average time for block mining, which is independent of the network congestion.
By the way, the other answer is referring to block.timestamp, which is a different thing from your original question. You can find here further info when comparing timestamp and ...
Yes you can do that, but it is not a secure and safe way to do it.
If you do not have much at stake if a malicious miner manipulates the block timestamp, it's most likely ok. Otherwise, it's not.
From the doc:
Do not rely on block.timestamp or blockhash as a source of randomness,
unless you know what you are doing.
Both the timestamp and the block hash ...
TL;DR Transaction sender paid the miner to do it that way.
Whenever you see transactions which either:
Are suspiciously well-placed or
Have zero or near-zero gas price
(or both), it's probably a product of Miner Extractable Value (MEV). That basically means that someone offers payment to miners (or to a mining pool) to include his transaction in a block in ...