From 3869e53bdd25e3df1c97d40773005955ef623861 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Sun, 11 Oct 2020 01:27:49 -0300 Subject: [PATCH] Add blink quorums, highlight currently active quorum --- observer.py | 18 +++++++----------- static/style.css | 23 +++++++++++------------ templates/index.html | 5 +---- templates/quorums.html | 40 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 55 insertions(+), 31 deletions(-) diff --git a/observer.py b/observer.py index 2a41dfd..35a712e 100644 --- a/observer.py +++ b/observer.py @@ -195,24 +195,21 @@ def get_sns(sns_future, info_future): def get_quorums_future(lmq, lokid, height): return FutureJSON(lmq, lokid, 'rpc.get_quorum_state', 30, - args={ 'start_height': height-50, 'end_height': height }) + args={ 'start_height': height-55, 'end_height': height }) def get_quorums(quorums_future): - oblig_quorums, checkpoint_quorums, pulse_quorums = [], [], [] + qkey = ["obligation", "checkpoint", "blink", "pulse"] + quo = {x: [] for x in qkey} quorums = quorums_future.get() quorums = quorums['quorums'] if 'quorums' in quorums else [] for q in quorums: - if q['quorum_type'] == 0: - oblig_quorums.append(q) - elif q['quorum_type'] == 1: - checkpoint_quorums.append(q) - elif q['quorum_type'] == 3: - pulse_quorums.append(q) + if q['quorum_type'] <= len(qkey): + quo[qkey[q['quorum_type']]].append(q) else: print("Something getting wrong in quorums: found unknown quorum_type={}".format(q['quorum_type']), file=sys.stderr) - return oblig_quorums, checkpoint_quorums, pulse_quorums + return quo @app.context_processor @@ -596,11 +593,10 @@ def show_quorums(): lmq, lokid = lmq_connection() info = FutureJSON(lmq, lokid, 'rpc.get_info', 1) quos = get_quorums_future(lmq, lokid, info.get()['height']) - obl_q, cp_q, pulse_q = get_quorums(quos) return flask.render_template('quorums.html', info=info.get(), - quorums=dict(obligation=obl_q, checkpoint=cp_q, pulse=pulse_q), + quorums=get_quorums(quos) ) diff --git a/static/style.css b/static/style.css index 23b1bc5..fd2199d 100644 --- a/static/style.css +++ b/static/style.css @@ -322,6 +322,7 @@ div.quorums { flex-wrap: wrap; justify-content: space-evenly; padding: 0; + margin: 0 -5px; } div.quorums>div { @@ -329,27 +330,19 @@ div.quorums>div { border-radius: 5px; padding: 0; flex-grow: 1; + margin: 5px; } div.quorums.obligations>div { flex-basis: 300px; - margin: 5px; -} -div.quorums.obligations { - margin: 0 -5px; } div.quorums.checkpoint>div { flex-basis: 200px; - margin: 5px; -} -div.quorums.checkpoint { - margin: 0 -5px; } div.quorums.pulse>div { flex-basis: 200px; - margin: 5px; } -div.quorums.checkpoint { - margin: 0 -5px; +div.quorums.blink>div { + flex-basis: 275px; } h4.curr-height { margin-top: 0px; @@ -363,7 +356,7 @@ div.quorums>div>.workers { /*justify-content: center;*/ /*space-between;*/ } -.quorums.obligations .workers, .quorums.pulse .validators { +.quorums.obligations .workers, .quorums.pulse .validators, .quorums.blink .validators.q1 { border-top: 2px solid #008522; } .quorums .workers label, .quorums .validators label { @@ -406,6 +399,12 @@ div.quorums h2 { font-weight: bold; margin: 0; } +div.quorums>div.now h2 { + background-color: #78be20; +} +div.quorums>div.now, div.quorums.obligations>div.now .workers, div.quorums.blink>div.now { + border-color: #78be20; +} div.quorums h5 { margin: 0; } diff --git a/templates/index.html b/templates/index.html index 58fada3..4c542fb 100644 --- a/templates/index.html +++ b/templates/index.html @@ -192,10 +192,7 @@ {%endif%}
-

Note: The quorum shown here is the currently active voting height - which is not necessarily the latest quorum. Quorums can only be voted on - after a number of blocks have transpired.

-

Click here to see the last 1hrs worth of the stored quorum states

+

View recent stored testing/checkpoint/blink/pulse quorums

{% endblock %} diff --git a/templates/quorums.html b/templates/quorums.html index 9239989..1c233cf 100644 --- a/templates/quorums.html +++ b/templates/quorums.html @@ -10,7 +10,7 @@
{%for q in quorums.obligation[-18:] | reverse%} -
+

{# quorum height + 13 here because a node only does an obligations test once the node has at least 11 blocks on top of it, which means it is 13 blocks below the @@ -44,7 +44,7 @@ {%if quorums.pulse%} -

Recent pulse quorums:

+

Recent Pulse quorums:

Current block height: {{info.height}}

@@ -67,7 +67,7 @@
{%for v in q.quorum.validators%} - {{v}} + {{v}} {%endfor%}
@@ -76,7 +76,7 @@ {%endif%} -

Recent checkpoint quorums:

+

Recent Checkpoint quorums:

Current block height: {{info.height}}

@@ -99,6 +99,38 @@ Validator {{loop.index}}/{{q.quorum.validators | length}}">{{v}}
+

Recent Blink quorums:

+

Current block height: {{info.height}}

+
+ + + {%endfor%} + + + {% endblock %}