Skip to content

Switch to monotonic time when calculating the delayed precommit timeout #2622

@rach-id

Description

@rach-id

After merging the temporary change in #2619, we should fix the core issue which is using the monotonic time instead of the wall one.

Wall clock is a subjective clock that can forward/backward in time depending on circumstances. Daylight saving for example, timezones, and sometimes even the wall clock can be delayed.

Now the issue is in comet we use the wall clock to make it easier to handle time:

return t.Round(0).UTC()

But when we're handling the delayed precommit, we're using: time.Until() which uses the canonical clock:

waitTime := time.Until(precommitVoteTime)

This results in the difference between the values. Because when you apply any operation on a canonical clock and a wall clock, the canonical clock is stripped of the canonical part and only the wall part is left.

This was introduced in tendermint/tendermint#2203 (comment) because the way time was handled in comet is only when serializing/deserializing data. But our delay use case needs to have spot on clocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions