Last active
April 29, 2021 15:58
-
-
Save ralexstokes/cf41fa6fe33c1620b21899e44157f68a to your computer and use it in GitHub Desktop.
validator-lifecycle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphviz import Digraph | |
font_name = "helvetica" | |
node_settings = {"fontname": font_name} | |
edge_settings = {"fontname": font_name} | |
title = "Validator lifecycle on the beacon chain (phase 0 spec)\n\n" | |
dot = Digraph( | |
title, | |
node_attr=node_settings, | |
edge_attr=edge_settings, | |
) | |
dot.attr(forcelabels="true") | |
dot.attr(nodesep="1.5") | |
dot.attr(ranksep="2.0") | |
dot.attr(labelloc="t") | |
dot.attr(label=title) | |
dot.attr(fontname=font_name) | |
dot.attr(fontsize="30") | |
with dot.subgraph() as s: | |
s.attr(rank="same") | |
s.node("5") | |
s.node("9") | |
dot.node("0", "32 ETH, validator parameters", peripheries="2") | |
dot.node("1", "deposited") | |
dot.node("2", "deposit processed", xlabel="epoch D") | |
dot.node("3", "eligible for activation queue", xlabel="D + 1") | |
dot.node("4", "in activation queue", xlabel="D + 3 or later") | |
dot.node("5", "active", xlabel="epoch A") | |
dot.node("6", "in exit queue", xlabel="epoch E > A + SHARD_COMMITTEE_PERIOD") | |
dot.node("7", "exited", xlabel="epoch W > E + 1 + MAX_SEED_LOOKAHEAD") | |
dot.node( | |
"8", | |
"withdrawable", | |
peripheries="2", | |
xlabel="W + MIN_VALIDATOR_WITHDRAWABILITY_DELAY", | |
) | |
dot.node("9", "active but slashed", style="filled", fillcolor="#ED6B86") | |
dot.node("11", "in exit queue but slashed", style="filled", fillcolor="#ED6B86") | |
dot.node("10", "exited but slashed", style="filled", fillcolor="#ED6B86") | |
dot.edge("0", "1", " `deposit` in the deposit contract at block B") | |
dot.edge( | |
"1", | |
"2", | |
" after ETH1_FOLLOW_DISTANCE blocks and eth1 data has been updated on beacon chain", | |
) | |
dot.edge("2", "3", " `process_registry_updates` during epoch processing of D") | |
dot.edge("3", "4", " once D + 1 is finalized") | |
dot.edge("4", "5", " after activation queue") | |
dot.edge("5", "6", " voluntary exit") | |
dot.edge("5", "6", " ejection via low balance") | |
dot.edge("6", "7", " after exit queue") | |
dot.edge("7", "8") | |
dot.edge("5", "9", " slashed!") | |
dot.edge("9", "11", " forced exit") | |
dot.edge("6", "11", " slashed!") | |
dot.edge("11", "10", " after exit queue") | |
dot.edge("7", "10", " slashed!") | |
dot.edge( | |
"10", | |
"8", | |
" EPOCHS_PER_SLASHINGS_VECTOR (or later if exit queue is deep) epochs later", | |
) | |
print(dot.source) | |
dot.render("validator-lifecycle", view=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment