# Using block.number vs block.timestamp in Governor.sol

**URL:** <https://forum.openzeppelin.com/t/using-block-number-vs-block-timestamp-in-governor-sol/30397>\
**Category:** Contracts\
**Created:** [July 13, 2022, 6:16pm UTC](https://forum.openzeppelin.com/t/using-block-number-vs-block-timestamp-in-governor-sol/30397 "2022-07-13T18:16:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian.avax](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/julian.avax/32/15708_2.png) [@Julian.avax](https://forum.openzeppelin.com/u/Julian.avax)\
**Post date:** [July 13, 2022, 6:16pm UTC](https://forum.openzeppelin.com/t/using-block-number-vs-block-timestamp-in-governor-sol/30397/1 "2022-07-13T18:16:17Z")

</div>

Hey all,

During a [conversation on discord](https://discord.com/channels/578992315641626624/578992911991963648/996455819593924618), the team discovered that there may be an opportunity to contribute to a Governance contract `Governor.sol` from OpenZeppelin in a way that would benefit Avalanche developers.

The contract above uses block.number as a timestamp which is unsuitable for users on networks such as Avalanche due to its volatile block production.

_summary_

> ...Avalanche nodes only work when there is work to be done.There’s no mining or polling to get new blocks. Transactions are broadcast to the wider network, who then hears them and begins voting. If there are no transactions to vote on, the nodes in the network don’t do anything except listen until new transactions are heard. This means block production can vary depending on how many transactions are being executed on the network.

Consensys has also mentioned that using [block.number may pose a security risk](https://consensys.github.io/smart-contract-best-practices/development-recommendations/solidity-specific/timestamp-dependence/)

> It is possible to estimate a time delta using the `block.number` property and average block time, however this is not future proof as block times may change (such as fork reorganisations and the difficulty bomb. In a sale spanning days, the 15-second rule allows one to achieve a more reliable estimate of time.

I'd like to understand the reason behind choosing block.number \> block.timestamp in for this and other Governance contracts.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![TtheBC01](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/tthebc01/32/14174_2.png) [@TtheBC01](https://forum.openzeppelin.com/u/TtheBC01)\
**Post date:** [July 13, 2022, 8:00pm UTC](https://forum.openzeppelin.com/t/using-block-number-vs-block-timestamp-in-governor-sol/30397/2 "2022-07-13T20:00:27Z")

</div>

I was planning to use the Governor library on an Avalanche Subnet in the near future, so I'd really like to understand this topic better as well.

---

<div class="post-metadata">

**Author:** ![Julian.avax](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/julian.avax/32/15708_2.png) [@Julian.avax](https://forum.openzeppelin.com/u/Julian.avax)\
**Post date:** [July 14, 2022, 1:53pm UTC](https://forum.openzeppelin.com/t/using-block-number-vs-block-timestamp-in-governor-sol/30397/3 "2022-07-14T13:53:47Z")

</div>

They are tracking this issue [here](https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3546)

Cheers!
