Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnodev time.Now() drifting away from real time #1507

Closed
jefft0 opened this issue Jan 9, 2024 · 0 comments · Fixed by #1510
Closed

gnodev time.Now() drifting away from real time #1507

jefft0 opened this issue Jan 9, 2024 · 0 comments · Fixed by #1510

Comments

@jefft0
Copy link
Contributor

jefft0 commented Jan 9, 2024

gnodev

Description

While using gnodev, time.Now() seems to drift as described below.

Your environment

  • macOS Ventura 13.6.3
  • Go 1.20.7
  • Latest gnolang/gno as of posting
  • Latest commit: c6097cd

Steps to reproduce

  • Set up the test1 key for gnokey
  • Install gnodev
  • Start gnodev
  • Register the test1 user, create a board and post with CreateThread as follows:
gnokey maketx call -pkgpath "gno.land/r/demo/users" -func "Register" -args "" -args "test_1" -args "Profile description" -gas-fee "10000000ugnot" -gas-wanted "2000000" -send "200000000ugnot" -broadcast -chainid tendermint_test -remote 127.0.0.1:36657 test1
gnokey maketx call -pkgpath "gno.land/r/demo/boards" -func "CreateBoard" -args "myboard" -gas-fee "1000000ugnot" -gas-wanted "5000000" -broadcast -chainid tendermint_test -remote 127.0.0.1:36657 test1
gnokey maketx call -pkgpath "gno.land/r/demo/boards" -func "CreateThread" -gas-fee 1000000ugnot -gas-wanted 5000000 -broadcast -chainid tendermint_test -args "1" -args " mytitle" -args "post at <current UTC time>" -remote "127.0.0.1:36657" test1

Expected behaviour

The boards realm uses time.Now() for the displayed post time. This should match the real time when the post transaction is processed.

Actual behaviour

The value of time.Now() does not match the real time, as shown below. It looks like time.Now returns the time since the node started multiplied by some factor (about 2.2). If I post immediately after starting gnodev, time.Now() is correct. If I post 5 minutes after start, time.Now() is 11 minutes after start. If I post 10 minutes after start, time.Now() is 23 minutes after start. If I post 20 minutes after start, time.Now() is 44 minutes after start, etc. (This only happens in gnodev. If I run gnoland then the timestamps are correct.)

Screenshot 2024-01-09 at 09 52 53

thehowl pushed a commit that referenced this issue Jan 12, 2024
fix #1507 

It appears that using `TestConsensusConfig` as the default consensus
configuration in gnodev causes time drift. This can be fixed by setting
`cfg.Consensus.SkipTimeoutCommit` to `false`. However, I'm not certain
about the exact reason why this setting actually corrects the time
drifting issue.

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
gfanton added a commit to moul/gno that referenced this issue Jan 18, 2024
fix gnolang#1507 

It appears that using `TestConsensusConfig` as the default consensus
configuration in gnodev causes time drift. This can be fixed by setting
`cfg.Consensus.SkipTimeoutCommit` to `false`. However, I'm not certain
about the exact reason why this setting actually corrects the time
drifting issue.

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

1 participant