davinci-paper/v2/figures/state-tree.drawio
v2/figures/state-tree.drawioRaw
1<mxfile host="drawio"><diagram name="state-tree" id="state-tree"><mxGraphModel dx="1200" dy="800" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="1100" pageHeight="850" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="c3" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=11;fillColor=none;strokeColor=#000000;fontFamily=Courier New;verticalAlign=top;align=center;spacingTop=4;spacingLeft=6;fontStyle=1;" vertex="1" parent="1"><mxGeometry x="0" y="0" width="940" height="360" as="geometry"/></mxCell><mxCell id="c4" value="<b>state tree</b>: sparse Merkle tree, depth 64, SHA-256, 64-bit keys; its root is the on-chain <b>stateRoot</b>" style="text;html=1;whiteSpace=wrap;fontSize=11;fontFamily=Courier New;align=center;verticalAlign=middle;fontColor=#000000;" vertex="1" parent="1"><mxGeometry x="20" y="10" width="900" height="22" as="geometry"/></mxCell><mxCell id="c5" value="<b>configuration</b>" style="rounded=0;whiteSpace=wrap;html=1;fontSize=11;fillColor=#f5f5f5;strokeColor=#666666;fontFamily=Courier New;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="20" y="56" width="190" height="40" as="geometry"/></mxCell><mxCell id="c6" value="<b>encrypted ballots</b> (one slot per voter)" style="rounded=0;whiteSpace=wrap;html=1;fontSize=11;fillColor=#ffe6cc;strokeColor=#d79b00;fontFamily=Courier New;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="210" y="56" width="360" height="40" as="geometry"/></mxCell><mxCell id="c7" value="<b>vote identifiers</b> (one per ballot cast)" style="rounded=0;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Courier New;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="570" y="56" width="350" height="40" as="geometry"/></mxCell><mxCell id="c8" value="0x00" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=left;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="20" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c9" value="0x0F" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=right;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="108" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c10" value="0x10" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=left;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="212" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c11" value="2<sup>63</sup>&minus;1" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=right;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="470" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c12" value="2<sup>63</sup>" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=left;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="572" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c13" value="2<sup>64</sup>&minus;1" style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=right;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="820" y="96" width="100" height="18" as="geometry"/></mxCell><mxCell id="c14" value="<div style='text-align:left;font-size:10px;line-height:1.5'>0x00 &nbsp;processID<br>0x02 &nbsp;ballotMode (packed)<br>0x03 &nbsp;H(encryptionKey)<br>0x04 &nbsp;H(encryptedResults)<br>0x06 &nbsp;censusOrigin<br>0x07 &nbsp;ballotVKHash<br><font color='#666666'>0x01, 0x05, 0x08&ndash;0x0F<br>reserved</font></div>" style="rounded=0;whiteSpace=wrap;html=1;fontSize=10;fillColor=#ffffff;strokeColor=#000000;fontFamily=Courier New;align=left;verticalAlign=middle;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="20" y="130" width="190" height="150" as="geometry"/></mxCell><mxCell id="c15" value="<div style='text-align:left;font-size:10px;line-height:1.5'><b>key</b> = slot<br>&bull; Merkle census:<br>&nbsp;&nbsp;0x10 + (H(&quot;davinci-slot-v1&quot; || address)<sub>[0..8]</sub><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mod (2<sup>63</sup> &minus; 16))<br>&bull; CSP census: 0x10 + idx<br><b>value</b> = H(reEncryptedBallot)<br><font color='#666666'>written by new votes and overwrites,<br>refreshed by silent re-encryptions</font></div>" style="rounded=0;whiteSpace=wrap;html=1;fontSize=10;fillColor=#ffffff;strokeColor=#000000;fontFamily=Courier New;align=left;verticalAlign=middle;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="232" y="130" width="316" height="150" as="geometry"/></mxCell><mxCell id="c16" value="<div style='text-align:left;font-size:10px;line-height:1.5'><b>key</b> = voteID =<br>&nbsp;&nbsp;2<sup>63</sup> + (Poseidon(processID, address, k)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mod 2<sup>63</sup>)<br><b>value</b> = 0<br><font color='#666666'>insert-only: a vote identifier<br>can never be reused, which lets a<br>voter check that the ballot was<br>recorded without revealing its slot</font></div>" style="rounded=0;whiteSpace=wrap;html=1;fontSize=10;fillColor=#ffffff;strokeColor=#000000;fontFamily=Courier New;align=left;verticalAlign=middle;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="592" y="130" width="306" height="150" as="geometry"/></mxCell><mxCell id="c17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=none;startArrow=none;endSize=6;startSize=6;fontSize=10;fontFamily=Courier New;strokeColor=#000000;strokeWidth=1;dashed=1;labelBackgroundColor=#ffffff;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c5" target="c14"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell><mxCell id="c18" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=none;startArrow=none;endSize=6;startSize=6;fontSize=10;fontFamily=Courier New;strokeColor=#000000;strokeWidth=1;dashed=1;labelBackgroundColor=#ffffff;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c6" target="c15"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell><mxCell id="c19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=none;startArrow=none;endSize=6;startSize=6;fontSize=10;fontFamily=Courier New;strokeColor=#000000;strokeWidth=1;dashed=1;labelBackgroundColor=#ffffff;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="c7" target="c16"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell><mxCell id="c20" value="H = SHA-256 (leaf value read as a big-endian integer). Leaf hash: H(key<sub>LE8</sub> || value<sub>LE32</sub> || 0x01); internal node: H(left || right). Genesis: the registry computes the root of the six configuration leaves at creation, with the accumulator set to the encryption of zero (all identity points)." style="text;html=1;whiteSpace=wrap;fontSize=9;fontFamily=Courier New;align=left;verticalAlign=middle;fontColor=#333333;" vertex="1" parent="1"><mxGeometry x="20" y="296" width="900" height="54" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>