tx details page: show block prio-fees per 'relevant slot'

This commit is contained in:
GroovieGermanikus 2023-12-19 18:18:38 +01:00
parent 9ab53561ae
commit c2509e0440
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
3 changed files with 51 additions and 5 deletions

View File

@ -65,14 +65,14 @@
<td class="w-100">Banking Stage Errors</td>
<td class="text-lg-end font-monospace"><span>{{ block.banking_stage_errors | map_count or 'n/a'}}</span></td>
</tr>
<tr>
<td class="w-100">Prioritization Fees Median</td>
<td class="text-lg-end font-monospace"><span>{{ block.supp_infos.p_median | lamports }} micro-lamports/CU</span></td>
</tr>
<tr>
<td class="w-100">Prioritization Fees Min</td>
<td class="text-lg-end font-monospace"><span>{{ block.supp_infos.p_min | lamports }} micro-lamports/CU</span></td>
</tr>
<tr>
<td class="w-100">Prioritization Fees Median</td>
<td class="text-lg-end font-monospace"><span>{{ block.supp_infos.p_median | lamports }} micro-lamports/CU</span></td>
</tr>
<tr>
<td class="w-100">Prioritization Fees Max</td>
<td class="text-lg-end font-monospace"><span>{{ block.supp_infos.p_max | lamports }} micro-lamports/CU</span></td>

View File

@ -93,9 +93,48 @@
</div>
{% for slot in transaction.relevant_slots %}
{% set block_details = transaction.block_details_per_slot[slot] %}
<div id="relevant-slot-{{slot}}" class="card">
<div class="card-header align-items-center"><h3 class="card-header-title">Slot {{ slot | slotnumber }} - Errors</h3></div>
<div class="table-responsive mb-0">
<table class="table table-sm table-nowrap card-table">
<thead>
<tr>
<th class="text-muted text-end table-cell-width-number">Min Prio Fees</th>
<th class="text-muted text-end table-cell-width-number">Median Prio Fees</th>
<th class="text-muted text-end table-cell-width-number">Max Prio Fees</th>
<th class="text-muted text-end table-cell-width-number">p75 Prio Fees</th>
<th class="text-muted text-end table-cell-width-number">p90 Prio Fees</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-end font-monospace">
<span class="font-monospace">{{ block_details.prioritization_fees.p_min }}</span>
</td>
<td class="text-end font-monospace">
<span class="font-monospace">{{ block_details.prioritization_fees.p_median }}</span>
</td>
<td class="text-end font-monospace">
<span class="font-monospace">{{ block_details.prioritization_fees.p_max }}</span>
</td>
<td class="text-end font-monospace">
<span class="font-monospace">{{ block_details.prioritization_fees.p_75 }}</span>
</td>
<td class="text-end font-monospace">
<span class="font-monospace">{{ block_details.prioritization_fees.p_90 }}</span>
</td>
<td class="text-end">
<span>(micro-lamports/CU)</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive mb-0">
<table class="table table-sm table-nowrap card-table">
<thead>

View File

@ -1,5 +1,7 @@
import postgres_connection
import json
import recent_blocks_database
import transaction_database
from collections import defaultdict
@ -83,12 +85,15 @@ def find_transaction_details_by_sig(tx_sig: str):
ORDER BY amb.total_cu_consumed DESC NULLS LAST, amt.acc_id
""", args=[list(relevant_slots), transaction_id]))
block_details_per_slot = dict()
write_lock_info = dict()
read_lock_info = dict()
for relevant_slot in relevant_slots:
account_info_expanded = []
block_details = recent_blocks_database.run_query(filter_slot=relevant_slot)[0]
block_details_per_slot[relevant_slot] = block_details
account_info_expanded = []
for account_info in all_accountinfos:
# slot is set if amb relation exists i.e. if the tx was included
maybe_slot = account_info['slot']
@ -123,9 +128,11 @@ def find_transaction_details_by_sig(tx_sig: str):
write_lock_info[relevant_slot] = [acc for acc in account_info_expanded if acc['is_account_write_locked'] is True]
read_lock_info[relevant_slot] = [acc for acc in account_info_expanded if acc['is_account_write_locked'] is False]
row["block_details_per_slot"] = block_details_per_slot
row["write_lock_info"] = write_lock_info
row["read_lock_info"] = read_lock_info
# note: effectively this is always one row
return maprows