block.numberis used as the seed of keccak256 for generating randomness. But when does
block.numberchange? The time it takes for
block.numberto increment is called block time. Quote from Ethereum doc:
block.numberwill be a fixed number and it produces a deterministic result. Randomness is broken here.
CoinFlipHack. This proxy contract does all the math and calls the
flip()function of the original contract: