Add blink quorums, highlight currently active quorum
This commit is contained in:
parent
453416fac3
commit
3869e53bdd
18
observer.py
18
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)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -192,10 +192,7 @@
|
|||
{%endif%}
|
||||
|
||||
<div class="Wrapper">
|
||||
<p> 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.</p>
|
||||
<p> <a class="" href="/quorums">Click here to see the last 1hrs worth of the stored quorum states</a> </p>
|
||||
<h2> <a href="/quorums">View recent stored testing/checkpoint/blink/pulse quorums</a> </p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div class="obligations quorums">
|
||||
{%for q in quorums.obligation[-18:] | reverse%}
|
||||
<div>
|
||||
<div{%if q.height + 13 == info.height%} class="now"{%endif%}>
|
||||
<h2 title="This testing quorum is determined by block {{q.height}}">
|
||||
{# 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%}
|
||||
<h2>Recent pulse quorums:</h2>
|
||||
<h2>Recent Pulse quorums:</h2>
|
||||
<h4 class="curr-height">Current block height: <span class="omg">{{info.height}}</span></h4>
|
||||
<div class="TitleUnderliner"></div>
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
<div class="validators">
|
||||
<label>Validators:</label>
|
||||
{%for v in q.quorum.validators%}
|
||||
<a class="sn" href="/sn/{{v}}" title="Validator {{loop.index}}/{{q.quorum.validators | length}}">{{v}}</a>
|
||||
<a class="sn" href="/sn/{{v}}" title="{{v}}">{{v}}</a>
|
||||
{%endfor%}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,7 +76,7 @@
|
|||
{%endif%}
|
||||
|
||||
|
||||
<h2>Recent checkpoint quorums:</h2>
|
||||
<h2>Recent Checkpoint quorums:</h2>
|
||||
<h4 class="curr-height">Current block height: <span class="omg">{{info.height}}</span></h4>
|
||||
<div class="TitleUnderliner"></div>
|
||||
|
||||
|
@ -99,6 +99,38 @@ Validator {{loop.index}}/{{q.quorum.validators | length}}">{{v}}</a>
|
|||
</div>
|
||||
|
||||
|
||||
<h2>Recent Blink quorums:</h2>
|
||||
<h4 class="curr-height">Current block height: <span class="omg">{{info.height}}</span></h4>
|
||||
<div class="TitleUnderliner"></div>
|
||||
|
||||
<div class="blink quorums">
|
||||
{# Blink quorums are not fully independent: a blink quorum at height H is subquorum 0 for txes submitted at blockchain height
|
||||
[H+35, H+39], and subquorum 1 for txes submitted at height [H+30, H+34]. We want to show the full quorum here for each 5-block
|
||||
range, which means each subquorum gets printed twice: as Q0 in one and Q1 in the next one.
|
||||
#}
|
||||
{%for q in quorums.blink[-9:-1] | reverse%}
|
||||
{%set qnext = quorums.blink[-loop.index]%}
|
||||
{%set current = q.height + 30 <= info.height <= q.height + 34%}
|
||||
<div{%if current%} class="now"{%endif%}>
|
||||
<h2 title="Determined by blocks {{q.height}} and {{qnext.height}}">Blocks {{q.height + 30}}–{{q.height + 34}}{%if current%} (current){%endif%}</h2>
|
||||
|
||||
<div class="validators q0">
|
||||
<label title="Subquorum 0; a blink must be approved by at least 7 service nodes from each subquorum">Q₀:</label>
|
||||
{%for v in qnext.quorum.validators%}
|
||||
<a class="sn" href="/sn/{{v}}" title="{{v}}">{{v}}</a>
|
||||
{%endfor%}
|
||||
</div>
|
||||
<div class="validators q1">
|
||||
<label title="Subquorum 1; a blink must be approved by at least 7 service nodes from each subquorum">Q₁:</label>
|
||||
{%for v in q.quorum.validators%}
|
||||
<a class="sn" href="/sn/{{v}}" title="{{v}}">{{v}}</a>
|
||||
{%endfor%}
|
||||
</div>
|
||||
</div>
|
||||
{%endfor%}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue