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

Timestamp millisecond conversion to time.Time #1007

Open
WhoSoup opened this issue Jun 29, 2020 · 0 comments
Open

Timestamp millisecond conversion to time.Time #1007

WhoSoup opened this issue Jun 29, 2020 · 0 comments
Labels

Comments

@WhoSoup
Copy link
Member

WhoSoup commented Jun 29, 2020

Just came across this bug: when converting a factom Timestamp to a Golang time.Time, the milliseconds are not converted correctly. Example:

	fmt.Println(time.Now())
	ts := primitives.NewTimestampNow()
	fmt.Println(ts.GetTime())

Output:

2020-06-29 14:56:43.556323 +0200 CEST m=+0.002009801
2020-06-29 14:56:43.000556 +0200 CEST

The milliseconds shifted from milliseconds to being microseconds. Fortunately, factomd is mostly using Timestamp internally and doesn't convert to time.Time except for a few cases:

  • The Live API for admin block event ServerFault, DBlock headers, DBlock anchors, Entry Reveals, and Transactions
  • The HoldingList for testing if messages are stale (no major ramifications as long as it's consistent)
  • Processlist checking if messages are out of date (no major ramifications as long as it's consistent)
  • Message filter (no major ramifications as long as it's consistent)

The fix is incredibly simple: 6b9fde5

However, this might need to wait for a hard fork to be updated. Some nodes accepting messages that are less than 1ms away from being timed out and other nodes rejecting them could be an attack vector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants