rfc/content/docs/rfcs/21
G d88dc1261c
13/14/16/21: Change in timestamp format (#483)
* Timestamps refactored to int64 (nanoseconds resolution). Related to https://github.com/status-im/nim-waku/issues/834

* Updated times to Timestamp type

* Refactored timestamps

* Made spec consistent with timestamp refactoring

* Fixed misunderstanding on proto3 types

* Fixed timestamps to sint64

* Fixed correct time to pb2 timestamps and Store protocol version changed to beta4

* Revert changes (not needed for now)

* Revert changes

We'll change to sint64 when we'll refactor chat2 to use Timestamp type for timestamps
2022-02-17 16:29:59 +01:00
..
README.md 13/14/16/21: Change in timestamp format (#483) 2022-02-17 16:29:59 +01:00

README.md

slug title name status editor contributors
21 21/WAKU2-FAULT-TOLERANT-STORE Waku v2 Fault-Tolerant Store draft Sanaz Taheri <sanaz@status.im>

The reliability of 13/WAKU2-STORE protocol heavily relies on the fact that full nodes i.e., those who persist messages have high availability and uptime and do not miss any messages. If a node goes offline, then it will risk missing all the messages transmitted in the network during that time. In this specification, we provide a method that makes the store protocol resilient in presence of faulty nodes. Relying on this method, nodes that have been offline for a time window will be able to fix the gap in their message history when getting back online. Moreover, nodes with lower availability and uptime can leverage this method to reliably provide the store protocol services as a full node.

Method description

As the first step towards making the 13/WAKU2-STORE protocol fault-tolerant, we introduce a new type of time-based query through which nodes fetch message history from each other based on their desired time window. This method operates based on the assumption that the querying node knows some other nodes in the store protocol which have been online for that targeted time window.

Security Consideration

The main security consideration to take into account while using this method is that a querying node has to reveal its offline time to the queried node. This will gradually result in the extraction of the node's activity pattern which can lead to inference attacks.

Wire Specification

We extend the HistoryQuery protobuf message with two fields of start_time and end_time to signify the time range to be queried.

Payloads

syntax = "proto3";

message HistoryQuery {
  // the first field is reserved for future use
  string pubsubtopic = 2;
  repeated ContentFilter contentFilters = 3;
  PagingInfo pagingInfo = 4;
  + sint64 start_time = 5;
  + sint64 end_time = 6;
}

HistoryQuery

RPC call to query historical messages.

  • start_time: this field MAY be filled out to signify the starting point of the queried time window. This field holds the Unix epoch time in nanoseconds.
    The messages field of the corresponding HistoryResponse MUST contain historical waku messages whose timestamp is larger than or equal to the start_time.

  • end_time this field MAY be filled out to signify the ending point of the queried time window. This field holds the Unix epoch time in nanoseconds. The messages field of the corresponding HistoryResponse MUST contain historical waku messages whose timestamp is less than or equal to the end_time.

    A time-based query is considered valid if its end_time is larger than or equal to the start_time. Queries that do not adhere to this condition will not get through e.g. an open-end time query in which the start_time is given but no end_time is supplied is not valid. If both start_time and end_time are omitted then no time-window filter takes place.

In order to account for nodes asynchrony, and assuming that nodes may be out of sync for at most 20 seconds (i.e., 20000000000 nanoseconds), the querying nodes SHOULD add an offset of 20 seconds to their offline time window. That is if the original window is [l,r] then the history query SHOULD be made for [start_time: l - 20s, end_time: r + 20s].

Note that HistoryQuery preserves AND operation among the queried attributes. As such, The messages field of the corresponding HistoryResponse MUST contain historical waku messages that satisfy the indicated pubsubtopic AND contentFilters AND the time range [start_time, end_time].

Copyright

Copyright and related rights waived via CC0.