Why does `Governol.sol` measure voting period in terms of block number instead of timestamp?

In Governor.sol, we have

struct ProposalCore {
    Timers.BlockNumber voteStart;
    Timers.BlockNumber voteEnd;
    bool executed;
    bool canceled;

which measures the voting period in terms of block number rather than timestamp. I understand that block.timestamp can be chosen to some extent by the block miner. However, assuming that the one's Governor.sol contract is going to be deployed long-term, and the block production rate could change, is it not better to use block.timestamp? I am assuming a voting period of roughly 7 days.

It is better to use block.timestamp. We went with block numbers to remain compatible with the existing Governor ecosystem that had developed around Compound's GovernorBravo.

We may consider switching to or adding an option for timestamps later.

1 Like