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

Timestamps specification proposal #742

Closed
wants to merge 2 commits into from

Conversation

jonastheis
Copy link
Collaborator

@jonastheis jonastheis commented Sep 18, 2020

# Timestamps

## Motivation
In order to enable snapshotting based on time constraints rather than special messages in the Tangle (e.g., milestones), nodes need to share the same perception of time. Specifically, they need to have consensus on the *age of messages*. Therefore, messages contain a field `timestamp` which represents the creation time of the message and is signed by the issuing node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better not to mention milestones (say checkpoints?)
Another application for timestamps is for Adaptive PoW

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Luigi, I have added a comment on aPoW in the next sentence. Does it make sense?

Copy link
Contributor

@vekkiokonio vekkiokonio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on Timestamps specs

+ FPC: it's used to perform voting on timestamps.

## Parameters
- `D` gratuitous network delay ~5 minutes. We assume all messages are delivered within this time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these timings (D, w) updated? I recall we shortened them..

- `D` gratuitous network delay ~5 minutes. We assume all messages are delivered within this time.
- `w` window ~30 minutes. Require w>2D
- `Delta` max difference in consecutive timestamps. Require Delta>w+D
- `tw` transaction timestamp window. Max difference between message and transaction timestamp.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are definition of message and transaction timestamps explained elsewhere?



## Clock synchronization
Nodes need to share the same perception of time to fulfill `Req_1`. Therefore, we propose that nodes synchronize their clock on startup and resynchronize periodically every `60min` to counter [drift](https://en.wikipedia.org/wiki/Clock_drift) of local clocks. Instead of changing a nodes' system clock we introduce an `offset` parameter to adjust for differences between *network time* and local time of a node. Initially, the [Network Time Protocol (NTP)](https://en.wikipedia.org/wiki/Network_Time_Protocol) ([Go implementation](https://github.com/beevik/ntp)) can be used to achieve this task.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing a nodes' system clock we introduce an offset parameter to adjust for differences between network time and local time of a node.

Why do we do this? Is that easier from an implementation point of view?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, the Network Time Protocol (NTP) (Go implementation)

Should we have a second backup service to get network time in case NTP is down?

### Failure to (re)sync clock
We gracefully shut down the node if:
- initial synchronization of time fails
- resynchronization fails for more than `3` times
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to resynchronization specs here?

```

### Message timestamp vs transaction timestamp
Transactions contain a timestamp that is signed by the user when creating the transaction. It is thus different from the timestamp in the message which is created and signed by the node. We require
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this imply that PoW computation should be smaller than tw?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the order of magnitude of tw?

Copy link
Contributor

@vekkiokonio vekkiokonio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comment on Timestamps (Consensus section)

Clearly, in order to have a correct perception of the timestamp quality, **we assume the node is in sync** (see section [Not in Sync](#Not_in_Sync) otherwise).
Voting on timestamps should not occur for every messsage. Specifically, only for those that arrive around the border of the threshold +-`w`.

The initial opinion and level of knowledge are set according to the following rule:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this window should be symmetric around current time? Messages with future timestamps could probably only be received in case of malicious behavior and unsynced clocks. We maybe want to have more thinking around that

## Consensus
The timestamp should define the time when the message was created and issued to the Tangle, and this must be enforced to some degree through voting. Specifically, nodes will vote on whether the timestamp was issued within `w` of current local time. This time window is large to account for the network delay.
Clearly, in order to have a correct perception of the timestamp quality, **we assume the node is in sync** (see section [Not in Sync](#Not_in_Sync) otherwise).
Voting on timestamps should not occur for every messsage. Specifically, only for those that arrive around the border of the threshold +-`w`.
Copy link
Member

@Thoralf-M Thoralf-M Jan 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What protects against an attacker sending many messages that will arrive in the time around the threshold +-w? Couldn't that lead to a problem, because then quite a lot of voting is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. However, an attacker could also force a lot of voting by spamming double spends. So this does not really open a new attack vector.

We're currently restructuring a lot and need to update all the specs with the new details. In #880 you can see a new data flow (still subject to changes at the moment). Generally, everything that happens after the scheduler is governed by the congestion control algorithm. As such, an attacker can not force unlimited voting (be it through conflicts or timestamps) but is limited by its fair share

docs/timestamps.md Outdated Show resolved Hide resolved
## Motivation
In order to enable snapshotting based on time constraints rather than special messages in the Tangle (e.g., milestones), nodes need to share the same perception of time. Specifically, they need to have consensus on the *age of messages*. Therefore, messages contain a field `timestamp` which represents the creation time of the message and is signed by the issuing node.

Having consensus on the creation time of messages enables not only partial ordering but also new applications that require certain guarantees regarding time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Having consensus on the creation time of messages enables not only partial ordering but also new applications that require certain guarantees regarding time.
Having consensus on the creation time of messages enables not only partial ordering but also new applications that require certain guarantees regarding time such as adaptive PoW.

# Timestamps

## Motivation
In order to enable snapshotting based on time constraints rather than special messages in the Tangle (e.g., milestones), nodes need to share the same perception of time. Specifically, they need to have consensus on the *age of messages*. Therefore, messages contain a field `timestamp` which represents the creation time of the message and is signed by the issuing node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Luigi, I have added a comment on aPoW in the next sentence. Does it make sense?

docs/timestamps.md Outdated Show resolved Hide resolved
Having consensus on the creation time of messages enables not only partial ordering but also new applications that require certain guarantees regarding time.

In this document we propose a mechanism achieving consensus on message timestamps by combining a synchronous and an asynchronous approach. While online nodes can leverage FPC to vote on timestamps, nodes that join the network at a later time use an approach similar to On Tangle Voting to determine valid timestamps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than saying similar to onTangle voting we should say what the specific approach is. (approval weight? reorg?)

docs/timestamps.md Outdated Show resolved Hide resolved

## Parameters
- `D` gratuitous network delay ~5 minutes. We assume all messages are delivered within this time.
- `w` window ~30 minutes. Require w>2D
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is w used for?

docs/timestamps.md Outdated Show resolved Hide resolved
docs/timestamps.md Outdated Show resolved Hide resolved
docs/timestamps.md Outdated Show resolved Hide resolved
@jonastheis
Copy link
Collaborator Author

This will be included in #825.

@jonastheis jonastheis closed this May 31, 2021
@jonastheis jonastheis deleted the feat/timestamps-proposal branch May 31, 2021 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants