<metaname="description"content="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.">
<metaproperty="og:description"content="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."/>
</ul><p>The reliability of <code>13/WAKU2-STORE</code> 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.</p>
<h1id="method-description">
Method description
<aclass="anchor"href="#method-description">#</a>
</h1>
<p>As the first step towards making the <code>13/WAKU2-STORE</code> 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.</p>
<p>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.</p>
<h1id="wire-specification">
Wire Specification
<aclass="anchor"href="#wire-specification">#</a>
</h1>
<p>We extend the <ahref="/spec/13#payloads">HistoryQuery</a> protobuf message with two fields of <code>start_time</code> and <code>end_time</code> to signify the time range to be queried.</p>
<p><code>start_time</code>: 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.<br>
The <code>messages</code> field of the corresponding <ahref="/spec/13#HistoryResponse"><code>HistoryResponse</code></a> MUST contain historical waku messages whose <ahref="/spec/14#Payloads"><code>timestamp</code></a> is larger than or equal to the <code>start_time</code>.</p>
</li>
<li>
<p><code>end_time</code> 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 <code>messages</code> field of the corresponding <ahref="/spec/13#HistoryResponse"><code>HistoryResponse</code></a> MUST contain historical waku messages whose <ahref="/spec/14#Payloads"><code>timestamp</code></a> is less than or equal to the <code>end_time</code>.</p>
<p>A time-based query is considered valid if its <code>end_time</code> is larger than or equal to the <code>start_time</code>.
Queries that do not adhere to this condition will not get through e.g. an open-end time query in which the <code>start_time</code> is given but no <code>end_time</code> is supplied is not valid.
If both <code>start_time</code> and <code>end_time</code> are omitted then no time-window filter takes place.</p>
</li>
</ul>
<p>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 [<code>l</code>,<code>r</code>] then the history query SHOULD be made for <code>[start_time: l - 20s, end_time: r + 20s]</code>.</p>
<p>Note that <code>HistoryQuery</code> preserves <code>AND</code> operation among the queried attributes.
As such, The <code>messages</code> field of the corresponding <ahref="/spec/13#HistoryResponse"><code>HistoryResponse</code></a> MUST contain historical waku messages that satisfy the indicated <code>pubsubtopic</code> AND <code>contentFilters</code> AND the time range [<code>start_time</code>, <code>end_time</code>].</p>