1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-01-18 21:35:13 +01:00

BIP8: add dot file for generating states diagram

This commit is contained in:
Anthony Towns 2020-07-26 14:12:46 +10:00 committed by Luke Dashjr
parent 903d7a3a91
commit 3c63846fc2
3 changed files with 151 additions and 54 deletions

34
bip-0008/states.dot Normal file
View File

@ -0,0 +1,34 @@
digraph {
rankdir=TD;
node [style="rounded,filled,bold", shape=box, fixedsize=true, width=1.3, fontname="Arial"];
edge [weight = 100];
"DEFINED" -> "STARTED" [label="height >= start_height"];
"STARTED" -> "FAILING" [label="height >= timeoutheight AND NOT lockinontimeout"];
"STARTED" -> "LOCKED_IN" [label="(height < timeoutheight AND threshold reached)\nOR\n(height >= timeoutheight AND lockinontimeout)"];
"LOCKED_IN" -> "ACTIVE" [label="always"];
"FAILING" -> "FAILED" [label="NOT all blocks signal"];
edge [weight = 1];
"FAILING" -> "ACTIVE" [label="all blocks signal"];
"DEFINED":sw -> "DEFINED":nw;
"STARTED":sw -> "STARTED":nw;
"ACTIVE":sw -> "ACTIVE":nw;
"FAILED":sw -> "FAILED":nw;
"STARTED" [fillcolor="#a0a0ff"];
"FAILING" [fillcolor="#ffffa0"];
"LOCKED_IN" [fillcolor="#ffffa0"];
"ACTIVE" [fillcolor="#a0ffa0", shape=box];
"FAILED" [fillcolor="#ffa0a0", shape=box];
"ACTIVE" -> "FAILED" [style=invis];
{ rank=same; "STARTED" "FAILING" }
{ rank=sink; "ACTIVE" "FAILED" }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -1,55 +1,118 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 848 464" width="905" height="495">
<defs>
<style type="text/css"><![CDATA[
rect {
fill: white;
stroke: black;
stroke-width: 1;
}
text {
fill: black;
}
svg>path {
stroke: black;
stroke-width: 2;
fill: none;
marker-end: url(#arrow);
}
]]></style>
<marker id="arrow" markerWidth="13" markerHeight="13" refX="8" refY="6" orient="auto">
<path d="M0,2 L0,11 L8,6 L0,2" style="fill: black;" />
</marker>
</defs>
<rect x="112" y="48" width="128" height="32"/>
<text x="176" y="72" font-size="20" text-anchor="middle">DEFINED</text>
<path d="M 128 80 a 24 32 0 1 1 0 -32"/><!-- loop -->
<path d="M 176 80 l 0 96"/>
<text x="182" y="128" font-size="12" text-anchor="start">startheight &lt;= height</text>
<rect x="112" y="176" width="128" height="32"/>
<text x="176" y="200" font-size="20" text-anchor="middle">STARTED</text>
<path d="M 128 208 a 24 32 0 1 1 0 -32"/><!-- loop -->
<path d="M 176 208 l 0 96"/>
<text x="182" y="232" font-size="12" text-anchor="start">(lockinontimeout == false) AND (height &lt; timeoutheight) AND (threshold reached)</text>
<text x="304" y="256" font-size="12" text-anchor="start">OR</text>
<text x="182" y="280" font-size="12" text-anchor="start">(lockinontimeout == true) AND ((height &gt;= timeoutheight) OR (threshold reached))</text>
<rect x="112" y="304" width="128" height="32"/>
<text x="176" y="328" font-size="20" text-anchor="middle">LOCKED_IN</text>
<path d="M 176 336 l 0 48"/>
<text x="182" y="360" font-size="12" text-anchor="start">Always</text>
<rect x="112" y="384" width="128" height="32"/>
<text x="176" y="408" font-size="20" text-anchor="middle">ACTIVE</text>
<path d="M 128 416 a 24 32 0 1 1 0 -32"/><!-- loop -->
<rect x="640" y="176" width="128" height="32"/>
<text x="704" y="200" font-size="20" text-anchor="middle">FAILING</text>
<path d="M 240 192 l 400 0"/>
<text x="408" y="184" font-size="12" text-anchor="middle">(lockinontimeout == false) AND (timeoutheight &lt;= height)</text>
<path d="M 704 208 l 0 176"/>
<text x="720" y="296" font-size="12" text-anchor="start">NOT all blocks signal</text>
<path d="M 656 208 c 0 196 -416 176 -416 176"/>
<text x="544" y="352" font-size="12" text-anchor="start">all blocks signal</text>
<rect x="640" y="384" width="128" height="32"/>
<text x="704" y="408" font-size="20" text-anchor="middle">FAILED</text>
<path d="M 756 416 a 24 32 0 1 0 0 -32"/><!-- loop -->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.42.3 (20191010.1750)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="598pt" height="348pt"
viewBox="0.00 0.00 598.00 348.37" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 344.37)">
<title>%3</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-344.37 594,-344.37 594,4 -4,4"/>
<!-- DEFINED -->
<g id="node1" class="node">
<title>DEFINED</title>
<path fill="lightgrey" stroke="black" stroke-width="2" d="M100,-333.75C100,-333.75 30,-333.75 30,-333.75 24,-333.75 18,-327.75 18,-321.75 18,-321.75 18,-309.75 18,-309.75 18,-303.75 24,-297.75 30,-297.75 30,-297.75 100,-297.75 100,-297.75 106,-297.75 112,-303.75 112,-309.75 112,-309.75 112,-321.75 112,-321.75 112,-327.75 106,-333.75 100,-333.75"/>
<text text-anchor="middle" x="65" y="-312.05" font-family="Arial" font-size="14.00">DEFINED</text>
</g>
<!-- DEFINED&#45;&gt;DEFINED -->
<g id="edge7" class="edge">
<title>DEFINED:sw&#45;&gt;DEFINED:nw</title>
<path fill="none" stroke="black" d="M18,-297.75C12,-287.25 0,-287.25 0,-315.75 0,-334.01 4.92,-340.57 10.04,-340.17"/>
<polygon fill="black" stroke="black" points="12.41,-342.75 18,-333.75 8.02,-337.3 12.41,-342.75"/>
</g>
<!-- STARTED -->
<g id="node2" class="node">
<title>STARTED</title>
<path fill="#a0a0ff" stroke="black" stroke-width="2" d="M100,-246.75C100,-246.75 30,-246.75 30,-246.75 24,-246.75 18,-240.75 18,-234.75 18,-234.75 18,-222.75 18,-222.75 18,-216.75 24,-210.75 30,-210.75 30,-210.75 100,-210.75 100,-210.75 106,-210.75 112,-216.75 112,-222.75 112,-222.75 112,-234.75 112,-234.75 112,-240.75 106,-246.75 100,-246.75"/>
<text text-anchor="middle" x="65" y="-225.05" font-family="Arial" font-size="14.00">STARTED</text>
</g>
<!-- DEFINED&#45;&gt;STARTED -->
<g id="edge1" class="edge">
<title>DEFINED&#45;&gt;STARTED</title>
<path fill="none" stroke="black" d="M65,-297.55C65,-285.91 65,-270.3 65,-256.99"/>
<polygon fill="black" stroke="black" points="68.5,-256.93 65,-246.93 61.5,-256.93 68.5,-256.93"/>
<text text-anchor="middle" x="126" y="-268.55" font-family="Times,serif" font-size="14.00">height &gt;= start_height</text>
</g>
<!-- STARTED&#45;&gt;STARTED -->
<g id="edge8" class="edge">
<title>STARTED:sw&#45;&gt;STARTED:nw</title>
<path fill="none" stroke="black" d="M18,-210.75C12,-200.25 0,-200.25 0,-228.75 0,-247.01 4.92,-253.57 10.04,-253.17"/>
<polygon fill="black" stroke="black" points="12.41,-255.75 18,-246.75 8.02,-250.3 12.41,-255.75"/>
</g>
<!-- FAILING -->
<g id="node3" class="node">
<title>FAILING</title>
<path fill="#ffffa0" stroke="black" stroke-width="2" d="M504,-246.75C504,-246.75 434,-246.75 434,-246.75 428,-246.75 422,-240.75 422,-234.75 422,-234.75 422,-222.75 422,-222.75 422,-216.75 428,-210.75 434,-210.75 434,-210.75 504,-210.75 504,-210.75 510,-210.75 516,-216.75 516,-222.75 516,-222.75 516,-234.75 516,-234.75 516,-240.75 510,-246.75 504,-246.75"/>
<text text-anchor="middle" x="469" y="-225.05" font-family="Arial" font-size="14.00">FAILING</text>
</g>
<!-- STARTED&#45;&gt;FAILING -->
<g id="edge2" class="edge">
<title>STARTED&#45;&gt;FAILING</title>
<path fill="none" stroke="black" d="M112.13,-228.75C186.54,-228.75 330.99,-228.75 411.42,-228.75"/>
<polygon fill="black" stroke="black" points="411.85,-232.25 421.85,-228.75 411.85,-225.25 411.85,-232.25"/>
<text text-anchor="middle" x="267" y="-235.55" font-family="Times,serif" font-size="14.00">height &gt;= timeoutheight AND NOT lockinontimeout</text>
</g>
<!-- LOCKED_IN -->
<g id="node4" class="node">
<title>LOCKED_IN</title>
<path fill="#ffffa0" stroke="black" stroke-width="2" d="M100,-129.75C100,-129.75 30,-129.75 30,-129.75 24,-129.75 18,-123.75 18,-117.75 18,-117.75 18,-105.75 18,-105.75 18,-99.75 24,-93.75 30,-93.75 30,-93.75 100,-93.75 100,-93.75 106,-93.75 112,-99.75 112,-105.75 112,-105.75 112,-117.75 112,-117.75 112,-123.75 106,-129.75 100,-129.75"/>
<text text-anchor="middle" x="65" y="-108.05" font-family="Arial" font-size="14.00">LOCKED_IN</text>
</g>
<!-- STARTED&#45;&gt;LOCKED_IN -->
<g id="edge3" class="edge">
<title>STARTED&#45;&gt;LOCKED_IN</title>
<path fill="none" stroke="black" d="M65,-210.28C65,-191.69 65,-161.99 65,-140.25"/>
<polygon fill="black" stroke="black" points="68.5,-140 65,-130 61.5,-140 68.5,-140"/>
<text text-anchor="middle" x="199.5" y="-181.55" font-family="Times,serif" font-size="14.00">(height &lt; timeoutheight AND threshold reached)</text>
<text text-anchor="middle" x="199.5" y="-166.55" font-family="Times,serif" font-size="14.00">OR</text>
<text text-anchor="middle" x="199.5" y="-151.55" font-family="Times,serif" font-size="14.00">(height &gt;= timeoutheight AND lockinontimeout)</text>
</g>
<!-- ACTIVE -->
<g id="node5" class="node">
<title>ACTIVE</title>
<path fill="#a0ffa0" stroke="black" stroke-width="2" d="M100,-42.75C100,-42.75 30,-42.75 30,-42.75 24,-42.75 18,-36.75 18,-30.75 18,-30.75 18,-18.75 18,-18.75 18,-12.75 24,-6.75 30,-6.75 30,-6.75 100,-6.75 100,-6.75 106,-6.75 112,-12.75 112,-18.75 112,-18.75 112,-30.75 112,-30.75 112,-36.75 106,-42.75 100,-42.75"/>
<text text-anchor="middle" x="65" y="-21.05" font-family="Arial" font-size="14.00">ACTIVE</text>
</g>
<!-- FAILING&#45;&gt;ACTIVE -->
<g id="edge6" class="edge">
<title>FAILING&#45;&gt;ACTIVE</title>
<path fill="none" stroke="black" d="M442.56,-210.75C415.9,-193.89 373.31,-167.76 335,-147.75 260.59,-108.89 171.32,-69.99 116.38,-46.9"/>
<polygon fill="black" stroke="black" points="117.44,-43.55 106.87,-42.92 114.74,-50.01 117.44,-43.55"/>
<text text-anchor="middle" x="344.5" y="-108.05" font-family="Times,serif" font-size="14.00">all blocks signal</text>
</g>
<!-- FAILED -->
<g id="node6" class="node">
<title>FAILED</title>
<path fill="#ffa0a0" stroke="black" stroke-width="2" d="M504,-42.75C504,-42.75 434,-42.75 434,-42.75 428,-42.75 422,-36.75 422,-30.75 422,-30.75 422,-18.75 422,-18.75 422,-12.75 428,-6.75 434,-6.75 434,-6.75 504,-6.75 504,-6.75 510,-6.75 516,-12.75 516,-18.75 516,-18.75 516,-30.75 516,-30.75 516,-36.75 510,-42.75 504,-42.75"/>
<text text-anchor="middle" x="469" y="-21.05" font-family="Arial" font-size="14.00">FAILED</text>
</g>
<!-- FAILING&#45;&gt;FAILED -->
<g id="edge5" class="edge">
<title>FAILING&#45;&gt;FAILED</title>
<path fill="none" stroke="black" d="M469,-210.53C469,-175.42 469,-95.34 469,-53.06"/>
<polygon fill="black" stroke="black" points="472.5,-52.93 469,-42.93 465.5,-52.93 472.5,-52.93"/>
<text text-anchor="middle" x="529.5" y="-108.05" font-family="Times,serif" font-size="14.00">NOT all blocks signal</text>
</g>
<!-- LOCKED_IN&#45;&gt;ACTIVE -->
<g id="edge4" class="edge">
<title>LOCKED_IN&#45;&gt;ACTIVE</title>
<path fill="none" stroke="black" d="M65,-93.55C65,-81.91 65,-66.3 65,-52.99"/>
<polygon fill="black" stroke="black" points="68.5,-52.93 65,-42.93 61.5,-52.93 68.5,-52.93"/>
<text text-anchor="middle" x="84" y="-64.55" font-family="Times,serif" font-size="14.00">always</text>
</g>
<!-- ACTIVE&#45;&gt;ACTIVE -->
<g id="edge9" class="edge">
<title>ACTIVE:sw&#45;&gt;ACTIVE:nw</title>
<path fill="none" stroke="black" d="M18,-6.75C12,3.75 0,3.75 0,-24.75 0,-43.01 4.92,-49.57 10.04,-49.17"/>
<polygon fill="black" stroke="black" points="12.41,-51.75 18,-42.75 8.02,-46.3 12.41,-51.75"/>
</g>
<!-- ACTIVE&#45;&gt;FAILED -->
<!-- FAILED&#45;&gt;FAILED -->
<g id="edge10" class="edge">
<title>FAILED:sw&#45;&gt;FAILED:nw</title>
<path fill="none" stroke="black" d="M422,-6.75C416,3.75 404,3.75 404,-24.75 404,-43.01 408.92,-49.57 414.04,-49.17"/>
<polygon fill="black" stroke="black" points="416.41,-51.75 422,-42.75 412.02,-46.3 416.41,-51.75"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB