4

I need to define a specific time phase. Therefore, I wanted to use opening timestamp and closing timestamp using block.timestamp. I get the following warning:

Linter: security/no-block-members: Avoid using 'block.timestamp'.

with the explanation that block.timestamp can be manipulated by miners.

Is there another solution working with timestamp or defining a time phase resp.?

Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127
user66732
  • 455
  • 3
  • 14

1 Answers1

2

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.

Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127