Skip to content

Commit

Permalink
deploy: 48177d5
Browse files Browse the repository at this point in the history
  • Loading branch information
Pana committed Dec 23, 2024
0 parents commit 749a586
Show file tree
Hide file tree
Showing 6,488 changed files with 707,678 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Empty file added .lock
Empty file.
Empty file added .nojekyll
Empty file.
2 changes: 2 additions & 0 deletions accumulator/all.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="List of all items in this crate"><title>List of all items in this crate</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b1a3e7f8283b8434.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="accumulator" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.0-nightly (635124704 2024-01-27)" data-channel="nightly" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod sys"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../accumulator/index.html">accumulator</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../accumulator/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.MerkleAccumulator.html">MerkleAccumulator</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.HashReader.html">HashReader</a></li></ul></section></div></main></body></html>
88 changes: 88 additions & 0 deletions accumulator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="This module provides algorithms for accessing and updating a Merkle Accumulator structure persisted in a key-value store. Note that this doesn’t write to the storage directly, rather, it reads from it via the `HashReader` trait and yields writes via an in memory `HashMap`."><title>accumulator - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b1a3e7f8283b8434.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="accumulator" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.0-nightly (635124704 2024-01-27)" data-channel="nightly" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../accumulator/index.html">accumulator</a><span class="version">0.1.0</span></h2></div><div class="sidebar-elems"><ul class="block">
<li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../accumulator/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">accumulator</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/accumulator/lib.rs.html#8-508">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module provides algorithms for accessing and updating a Merkle
Accumulator structure persisted in a key-value store. Note that this doesn’t
write to the storage directly, rather, it reads from it via the <code>HashReader</code>
trait and yields writes via an in memory <code>HashMap</code>.</p>
<h2 id="merkle-accumulator"><a class="doc-anchor" href="#merkle-accumulator">§</a>Merkle Accumulator</h2>
<p>Given an ever growing (append only) series of “leaf” hashes, we construct an
evolving Merkle Tree for which proofs of inclusion/exclusion of a leaf hash
at a leaf index in a snapshot of the tree (represented by root hash) can be
given.</p>
<h2 id="leaf-nodes"><a class="doc-anchor" href="#leaf-nodes">§</a>Leaf Nodes</h2>
<p>Leaf nodes carry hash values to be stored and proved. They are only appended
to the tree but never deleted or updated.</p>
<h2 id="internal-nodes"><a class="doc-anchor" href="#internal-nodes">§</a>Internal Nodes</h2>
<p>A non-leaf node carries the hash value derived from both its left and right
children.</p>
<h2 id="placeholder-nodes"><a class="doc-anchor" href="#placeholder-nodes">§</a>Placeholder Nodes</h2>
<p>To make sure each Leaf node has a Merkle Proof towards the root, placeholder
nodes are added so that along the route from a leaf to the root, each node
has a sibling. Placeholder nodes have the hash value
<code>ACCUMULATOR_PLACEHOLDER_HASH</code></p>
<p>A placeholder node can appear as either a Leaf node or a non-Leaf node, but
there is at most one placeholder leaf at any time.</p>
<h2 id="frozen-nodes--non-frozen-nodes"><a class="doc-anchor" href="#frozen-nodes--non-frozen-nodes">§</a>Frozen Nodes &amp; Non-frozen Nodes</h2>
<p>As leaves are added to the tree, placeholder nodes get replaced by
non-placeholder nodes, and when a node has all its descendants being
non-placeholder, it becomes “Frozen” – its hash value won’t change again in
the event of new leaves being added. All leaves appended (not counting the
one possible placeholder leaf) are by definition Frozen.</p>
<p>Other nodes, which have one or more placeholder descendants are Non-Frozen.
As new elements are appended to the accumulator the hash value of these
nodes will change.</p>
<h2 id="leaf-count"><a class="doc-anchor" href="#leaf-count">§</a>Leaf Count</h2>
<p>Given a count of the number of leaves in a Merkle Accumulator it is possible
to determine the shape of the accumulator – which nodes are filled and
which nodes are placeholder nodes.</p>
<p>Example:
Logical view of a Merkle Accumulator with 5 leaves:</p>
<div class="example-wrap"><pre class="language-text"><code> Non-fzn
/ \
/ \
/ \
Fzn2 Non-fzn
/ \ / \
/ \ / \
Fzn1 Fzn3 Non-fzn [Placeholder]
/ \ / \ / \
L0 L1 L2 L3 L4 [Placeholder]
</code></pre></div><h2 id="position-and-physical-representation"><a class="doc-anchor" href="#position-and-physical-representation">§</a>Position and Physical Representation</h2>
<p>As a Merkle Accumulator tree expands to the right and upwards, we number
newly frozen nodes monotonically. One way to do it is simply to use in-order
index of nodes, and this is what we do for the in-memory representation. We
call the stated numbers identifying nodes below simply “Position”, and
unless otherwise stated, this is the in-order position.</p>
<p>For writing to disk however, we write all the children of a node before the
parent. Thus for disk write order, it is more convenient to use the
post-order position as an index. And with that we can map a Merkle
Accumulator into a key-value storage: key is the post-order position of a
node, and the value is hash value it carries.</p>
<p>We store only Frozen nodes, and generate non-Frozen nodes on the fly when
accessing the tree. This way, the physical representation of the tree is
append-only, i.e. once written to physical storage, nodes won’t be either
modified or deleted.</p>
<p>Here is what we persist for the logical tree in the above example:</p>
<div class="example-wrap"><pre class="language-text"><code> Fzn2(6)
/ \
/ \
Fzn1(2) Fzn3(5)
/ \ / \
L0(0) L1(1) L2(3) L3(4) L4(7)
</code></pre></div>
<p>When the next leaf node is persisted, the physical representation will be:</p>
<div class="example-wrap"><pre class="language-text"><code> Fzn2(6)
/ \
/ \
Fzn1(2) Fzn3(5) Fzn4(9)
/ \ / \ / \
L0(0) L1(1) L2(3) L3(4) L4(7) L5(8)
</code></pre></div>
<p>The numbering corresponds to the post-order traversal of the tree.</p>
<p>To think in key-value pairs:</p>
<div class="example-wrap"><pre class="language-text"><code>|&lt;-key-&gt;|&lt;--value--&gt;|
| 0 | hash_L0 |
| 1 | hash_L1 |
| 2 | hash_Fzn1 |
| ... | ... |
</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.MerkleAccumulator.html" title="struct accumulator::MerkleAccumulator">MerkleAccumulator</a></div><div class="desc docblock-short">In this live Merkle Accumulator algorithms.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.HashReader.html" title="trait accumulator::HashReader">HashReader</a></div><div class="desc docblock-short">Defines the interface between <code>MerkleAccumulator</code> and underlying storage.</div></li></ul></section></div></main></body></html>
1 change: 1 addition & 0 deletions accumulator/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["MerkleAccumulator"],"trait":["HashReader"]};
Loading

0 comments on commit 749a586

Please sign in to comment.