rfc/spec/21/index.html

351 lines
13 KiB
HTML
Raw Normal View History

2022-12-01 07:58:41 +00:00
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
2022-12-01 08:37:15 +00:00
<meta name="generator" content="Hugo 0.106.0">
2022-12-01 07:58:41 +00:00
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="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.">
<meta name="theme-color" content="#FFFFFF"><meta property="og:title" content="21/WAKU2-FAULT-TOLERANT-STORE" />
<meta property="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." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://rfc.vac.dev/spec/21/" /><meta property="article:section" content="docs" />
<title>21/WAKU2-FAULT-TOLERANT-STORE | Vac RFC</title>
<link rel="manifest" href="/manifest.json">
<link rel="icon" href="/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/book.min.e935e20bd0d469378cb482f0958edf258c731a4f895dccd55799c6fbc8043f23.css" integrity="sha256-6TXiC9DUaTeMtILwlY7fJYxzGk&#43;JXczVV5nG&#43;8gEPyM=">
2023-05-05 07:53:01 +00:00
<script defer src="/en.search.min.9abea09ce55c72bde78df1b2649402d67199114dce4bec38dfb0526b83bf7203.js" integrity="sha256-mr6gnOVccr3njfGyZJQC1nGZEU3OS&#43;w437BSa4O/cgM="></script>
2022-12-01 07:58:41 +00:00
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->
</head>
<body dir="ltr">
<input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex">
<aside class="book-menu">
<div class="book-menu-content">
<nav>
<h2 class="book-brand">
<a href="/"><span>Vac RFC</span>
</a>
</h2>
<div class="book-search">
<input type="text" id="book-search-input" placeholder="Search" aria-label="Search" maxlength="64" data-hotkeys="s/" />
<div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul>
</div>
<ul>
<li>Raw
<ul>
<li><a href="/spec/20/">20/TOY-ETH-PM</a></li>
<li><a href="/spec/24/">24/STATUS-CURATION</a></li>
<li><a href="/spec/28/">28/STATUS-FEATURING</a></li>
<li><a href="/spec/31/">31/WAKU2-ENR</a></li>
2023-03-23 10:35:12 +00:00
<li><a href="/spec/32/">32/RLN-V1</a></li>
2022-12-01 07:58:41 +00:00
<li><a href="/spec/34/">34/WAKU2-PEER-EXCHANGE</a></li>
<li><a href="/spec/35/">35/WAKU2-NOISE</a></li>
<li><a href="/spec/37/">37/WAKU2-NOISE-SESSIONS</a></li>
2022-12-06 09:59:38 +00:00
<li><a href="/spec/38/">38/CONSENSUS-CLARO</a></li>
2022-12-01 07:58:41 +00:00
<li><a href="/spec/43/">43/WAKU2-NOISE-PAIRING</a></li>
<li><a href="/spec/44/">44/WAKU2-DANDELION</a></li>
<li><a href="/spec/45/">45/WAKU2-ADVERSARIAL-MODELS</a></li>
2022-12-02 14:32:42 +00:00
<li><a href="/spec/46/">46/GOSSIPSUB-TOR-PUSH</a></li>
<li><a href="/spec/47/">47/WAKU2-TOR-PUSH</a></li>
2023-01-12 10:30:30 +00:00
<li><a href="/spec/48/">48/RLN-INTEREP-SPEC</a></li>
2023-01-30 13:47:41 +00:00
<li><a href="/spec/51/">51/WAKU2-RELAY-SHARDING</a></li>
<li><a href="/spec/52/">52/WAKU2-RELAY-STATIC-SHARD-ALLOC</a></li>
2023-03-17 08:04:39 +00:00
<li><a href="/spec/57/">57/STATUS-Simple-Scaling</a></li>
2023-03-23 10:35:12 +00:00
<li><a href="/spec/58/">58/RLN-V2</a></li>
2022-12-01 07:58:41 +00:00
</ul>
</li>
<li>Draft
<ul>
<li><a href="/spec/1/">1/COSS</a></li>
<li><a href="/spec/3/">3/REMOTE-LOG</a></li>
<li><a href="/spec/4/">4/MVDS-META</a></li>
<li><a href="/spec/10/">10/WAKU2</a></li>
<li><a href="/spec/12/">12/WAKU2-FILTER</a></li>
<li><a href="/spec/13/">13/WAKU2-STORE</a></li>
<li><a href="/spec/14/">14/WAKU2-MESSAGE</a></li>
<li><a href="/spec/15/">15/WAKU2-BRIDGE</a></li>
<li><a href="/spec/16/">16/WAKU2-RPC</a></li>
<li><a href="/spec/17/">17/WAKU2-RLN-RELAY</a></li>
<li><a href="/spec/18/">18/WAKU2-SWAP</a></li>
<li><a href="/spec/19/">19/WAKU2-LIGHTPUSH</a></li>
<li><a href="/spec/21/"class=active>21/WAKU2-FTSTORE</a></li>
<li><a href="/spec/22/">22/TOY-CHAT</a></li>
<li><a href="/spec/23/">23/WAKU2-TOPICS</a></li>
<li><a href="/spec/26/">26/WAKU2-PAYLOAD</a></li>
<li><a href="/spec/27/">27/WAKU2-PEERS</a></li>
<li><a href="/spec/29/">29/WAKU2-CONFIG</a></li>
<li><a href="/spec/30/">30/ADAPTIVE-NODES</a></li>
<li><a href="/spec/33/">33/WAKU2-DISCV5</a></li>
<li><a href="/spec/36/">36/WAKU2-BINDINGS-API</a></li>
2023-02-21 11:48:38 +00:00
<li><a href="/spec/53/">53/WAKU2-X3DH</a></li>
<li><a href="/spec/54/">54/WAKU2-X3DH-SESSIONS</a></li>
<li><a href="/spec/55/">55/STATUS-1TO1-CHAT</a></li>
2023-02-21 16:18:47 +00:00
<li><a href="/spec/56/">56/STATUS-COMMUNITIES</a></li>
2022-12-01 07:58:41 +00:00
</ul>
</li>
<li>Stable
<ul>
<li><a href="/spec/2/">2/MVDS</a></li>
<li><a href="/spec/6/">6/WAKU1</a></li>
<li><a href="/spec/7/">7/WAKU-DATA</a></li>
<li><a href="/spec/8/">8/WAKU-MAIL</a></li>
<li><a href="/spec/9/">9/WAKU-RPC</a></li>
<li><a href="/spec/11/">11/WAKU2-RELAY</a></li>
</ul>
</li>
<li>Deprecated
<ul>
<li><a href="/spec/5/">5/WAKU0</a></li>
</ul>
</li>
<li>Retired</li>
</ul>
</nav>
2022-12-01 08:37:15 +00:00
<script>(function(){var e=document.querySelector("aside.book-menu nav");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script>
2022-12-01 07:58:41 +00:00
</div>
</aside>
<div class="book-page">
<header class="book-header">
<div class="flex align-center justify-between">
<label for="menu-control">
<img src="/svg/menu.svg" class="book-icon" alt="Menu" />
</label>
<strong>21/WAKU2-FAULT-TOLERANT-STORE</strong>
<label for="toc-control">
<img src="/svg/toc.svg" class="book-icon" alt="Table of Contents" />
</label>
</div>
<aside class="hidden clearfix">
<nav id="TableOfContents">
<ul>
<li><a href="#payloads">Payloads</a>
<ul>
<li><a href="#historyquery">HistoryQuery</a></li>
</ul>
</li>
</ul>
</nav>
</aside>
</header>
<article class="markdown">
2022-12-01 08:37:15 +00:00
<h1 id="21waku2-fault-tolerant-store">
21/WAKU2-FAULT-TOLERANT-STORE
<a class="anchor" href="#21waku2-fault-tolerant-store">#</a>
</h1>
2022-12-01 07:58:41 +00:00
2022-12-01 08:37:15 +00:00
<h1 id="waku-v2-fault-tolerant-store">
Waku v2 Fault-Tolerant Store
<a class="anchor" href="#waku-v2-fault-tolerant-store">#</a>
</h1>
2022-12-01 07:58:41 +00:00
<img src="https://img.shields.io/badge/status-draft-blue?style=flat-square" />
<ul>
<li>Status: draft</li>
<li>Editor: Sanaz Taheri <a href="mailto:sanaz@status.im">sanaz@status.im</a></li>
</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>
<h1 id="method-description">
Method description
<a class="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>
<h1 id="security-consideration">
Security Consideration
<a class="anchor" href="#security-consideration">#</a>
</h1>
<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&rsquo;s activity pattern which can lead to inference attacks.</p>
<h1 id="wire-specification">
Wire Specification
<a class="anchor" href="#wire-specification">#</a>
</h1>
<p>We extend the <a href="/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>
<h2 id="payloads">
Payloads
<a class="anchor" href="#payloads">#</a>
</h2>
2022-12-01 08:37:15 +00:00
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-diff" data-lang="diff"><span style="display:flex;"><span>syntax = &#34;proto3&#34;;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>message HistoryQuery {
</span></span><span style="display:flex;"><span> // the first field is reserved for future use
</span></span><span style="display:flex;"><span> string pubsubtopic = 2;
</span></span><span style="display:flex;"><span> repeated ContentFilter contentFilters = 3;
</span></span><span style="display:flex;"><span> PagingInfo pagingInfo = 4;
</span></span><span style="display:flex;"><span> + sint64 start_time = 5;
</span></span><span style="display:flex;"><span> + sint64 end_time = 6;
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><h3 id="historyquery">
2022-12-01 07:58:41 +00:00
HistoryQuery
<a class="anchor" href="#historyquery">#</a>
</h3>
<p>RPC call to query historical messages.</p>
<ul>
<li>
<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 <a href="/spec/13#HistoryResponse"><code>HistoryResponse</code></a> MUST contain historical waku messages whose <a href="/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 <a href="/spec/13#HistoryResponse"><code>HistoryResponse</code></a> MUST contain historical waku messages whose <a href="/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 <a href="/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>
<h1 id="copyright">
Copyright
<a class="anchor" href="#copyright">#</a>
</h1>
<p>Copyright and related rights waived via
<a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>.</p>
</article>
<footer class="book-footer">
<div class="flex flex-wrap justify-between">
</div>
</footer>
<div class="book-comments">
</div>
<label for="menu-control" class="hidden book-menu-overlay"></label>
</div>
<aside class="book-toc">
<div class="book-toc-content">
<nav id="TableOfContents">
<ul>
<li><a href="#payloads">Payloads</a>
<ul>
<li><a href="#historyquery">HistoryQuery</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</aside>
</main>
</body>
</html>