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: The time.Now() timestamp is incorrect #2960

Open
thinhnx-var opened this issue Oct 16, 2024 · 5 comments
Open

Gnodev: The time.Now() timestamp is incorrect #2960

thinhnx-var opened this issue Oct 16, 2024 · 5 comments
Labels
review/triage-pending PRs opened by external contributors that are waiting for the 1st review

Comments

@thinhnx-var
Copy link
Contributor

thinhnx-var commented Oct 16, 2024

Gnodev timestamp time.Now() incorrect.

Description

Not happens with test4, portal loop. Localchain is not tested.
I make a transaction with gnokey to gnodev in-memory node, the timestamp time.Now() is incorrect. It will always recognize the timestamp of the previous command as the start time of current command. I tried with default macOS / iterm terminal, with ohmyzsh and p10k extension.

Your environment

  • Go version: 1.22
  • OS and CPU architecture: MacOS Ventura
  • Gno commit hash causing the issue: latest

Steps to reproduce

  1. Put time.Now() debug in realms / package. Like ufmt.Println("request at: ", time.Now())
  2. Start gnodev
  3. Make a gnokey call to function. Lets say the time is 1:00:00 now
  4. Wait for about 10 seconds. (Do nothing)
  5. Make a gnokey call to function again.

Expected behaviour

The log should be request at: 1:00:10 <- now

Actual behaviour

The log shows that request at: 1:00:00 <- time of previous command

Proposed solution

I do not really know where the problem is, maybe come from my terminal or the way the timestamp freeze. Let see if anyone has same issues.

Ref image I tested with gnodev - using zsh shell -> date and LogTime return the time.Now().
image

@jefft0 jefft0 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 16, 2024
@jefft0
Copy link
Contributor

jefft0 commented Oct 16, 2024

I can't reproduce the error. I'm using gnodev and I modified r/demo/boards to include the seconds in the timestamp. I use gnokey to make two "CreateThread" transactions. Here is the render. The timestamps are 1:36:01pm and 1:36:08pm

test1 - @test1, 2024-10-16 1:36:01pm UTC [x] (0 replies) (0 reposts)
testing - @test1, 2024-10-16 1:36:08pm UTC [x] (0 replies) (0 reposts)

(Be careful not to reload gnodev. There is the known bug that this resets all the timestamps to the same value.)

@thinhnx-var
Copy link
Contributor Author

@jefft0
I just tried again with r/demo/boards and other realms and still have same issue. So maybe the problem comes from ohmyzsh or p10k extension on my terminal.

Let me disable them and try again.
If the issue is from terminal / env, I will close this topic soon.

Thank for fast response sir 🙏

@thinhnx-var
Copy link
Contributor Author

after disabling extension and use pure mac terminal, I still face the issue. Let me know if anyone has same issue while I try to figure it out 🙏

@MalekLahbib
Copy link
Contributor

From what I remember, @leohhhn told me that gnodev doesn't create another block if there's not a new transaction, and time.Now() changes if a new block is created. I had exactly the same problem when I was doing tests on a realm.

@thehowl
Copy link
Member

thehowl commented Oct 22, 2024

cc @gfanton

maybe related #1510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review/triage-pending PRs opened by external contributors that are waiting for the 1st review
Projects
None yet
Development

No branches or pull requests

4 participants