Skip to content

Timestamp millisecond conversion to time.Time #1007

@WhoSoup

Description

@WhoSoup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions