diff --git a/block_details_database.py b/block_details_database.py index 167d610..547d7f3 100644 --- a/block_details_database.py +++ b/block_details_database.py @@ -19,7 +19,8 @@ def find_block_by_slotnumber(slot_number: int): banking_stage_errors, total_cu_used, total_cu_requested, - heavily_writelocked_accounts + heavily_writelocked_accounts, + heavily_readlocked_accounts FROM banking_stage_results.blocks -- this critera uses index idx_blocks_slot WHERE slot = %s @@ -35,25 +36,22 @@ def find_block_by_slotnumber(slot_number: int): # format see BankingStageErrorsTrackingSidecar -> block_info.rs # parse (k:GubTBrbgk9JwkwX1FkXvsrF1UC2AP7iTgg8SGtgH14QE, cu_req:600000, cu_con:2243126) - parsed_accounts = [] - for acc in row["heavily_writelocked_accounts"]: - (k, cu_req, cu_con) = parse_accounts(acc) - parsed = {'k': k, 'cu_req': cu_req, 'cu_con': cu_con} - parsed_accounts.append(parsed) - - parsed_accounts.sort(key=lambda acc: int(acc['cu_con']), reverse=True) + parsed_accounts = json.loads(row["heavily_writelocked_accounts"]) + parsed_accounts.sort(key=lambda acc: int(acc['cu_consumed']), reverse=True) row["heavily_writelocked_accounts_parsed"] = parsed_accounts + parsed_accounts = json.loads(row["heavily_readlocked_accounts"]) + parsed_accounts.sort(key=lambda acc: int(acc['cu_consumed']), reverse=True) + row["heavily_readlocked_accounts_parsed"] = parsed_accounts + return maprows # parse (k:GubTBrbgk9JwkwX1FkXvsrF1UC2AP7iTgg8SGtgH14QE, cu_req:600000, cu_con:2243126) -def parse_accounts(acc): - groups = re.match(r"\((k:)(?P[a-zA-Z0-9]+)(, cu_req:)(?P[0-9]+)(, cu_con:)(?P[0-9]+)\)", acc) - return (groups.group('k'), groups.group('cu_req'), groups.group('cu_con')) - - +# def parse_accounts(acc): +# groups = re.match(r"\((k:)(?P[a-zA-Z0-9]+)(, cu_req:)(?P[0-9]+)(, cu_con:)(?P[0-9]+)\)", acc) +# return (groups.group('k'), groups.group('cu_req'), groups.group('cu_con')) def main(): find_block_by_slotnumber(226352855) diff --git a/recent_blocks_database.py b/recent_blocks_database.py index 2c56b41..fc4641d 100644 --- a/recent_blocks_database.py +++ b/recent_blocks_database.py @@ -12,14 +12,14 @@ def format_width_percentage(x): def calc_figures(row): successful_transactions = row['successful_transactions'] processed_transactions = row['processed_transactions'] - banking_stage_errors = row['banking_stage_errors'] + banking_stage_errors = row['banking_stage_errors'] or 0 txerrors = processed_transactions - successful_transactions row['txerrors'] = txerrors def calc_bars(row): successful_transactions = row['successful_transactions'] processed_transactions = row['processed_transactions'] - banking_stage_errors = row['banking_stage_errors'] + banking_stage_errors = row['banking_stage_errors'] or 0 total = processed_transactions + banking_stage_errors if total > 0: row['hide_bar'] = False @@ -81,6 +81,7 @@ def run_query(): for row in maprows: calc_bars(row) + row['banking_stage_errors'] = row['banking_stage_errors'] or 0 calc_figures(row) return maprows diff --git a/templates/_txlist.html b/templates/_txlist.html index 790bd85..eaaf50b 100644 --- a/templates/_txlist.html +++ b/templates/_txlist.html @@ -31,9 +31,9 @@
{% if tx.is_executed %} - {{ tx.signature }} + {{tx.signature}} {% else %} - {{ tx.signature }} + {{tx.signature}} {% endif %}
@@ -45,7 +45,22 @@ - {{ error }} + {{error}} + + + + {% endfor %} + + + + +
+ + {% for account_used in tx.account_used_array %} + + diff --git a/templates/block_details.html b/templates/block_details.html index 1ce172b..85ceef4 100644 --- a/templates/block_details.html +++ b/templates/block_details.html @@ -57,7 +57,8 @@ @@ -69,7 +70,7 @@
+ + {{account_used}}
- + @@ -78,17 +79,32 @@ {% for write_account in block.heavily_writelocked_accounts_parsed %} - - + + {% endfor %} +
Accounts CU requested CU consumed
- +
{{write_account.k}} + class="font-monospace">{{write_account.key}}
{{write_account.cu_req}}{{write_account.cu_con}}{{write_account.cu_requested}}{{write_account.cu_consumed}}
diff --git a/transaction_database.py b/transaction_database.py index b5f98d1..d48eb97 100644 --- a/transaction_database.py +++ b/transaction_database.py @@ -1,5 +1,5 @@ import postgres_connection - +import json def run_query(): con = postgres_connection.create_connection() @@ -9,7 +9,6 @@ def run_query(): SELECT * FROM ( SELECT signature, - message, errors, is_executed, is_confirmed, @@ -37,8 +36,8 @@ def run_query(): for index, row in enumerate(maprows): row['pos'] = index + 1 - # note: type changed from 'text' to 'text[]' - row['errors_array'] = row['errors'] + row['errors_array'] = json.loads(row['errors']) + row['accounts_used_array'] = json.loads(row['accounts_used']) return maprows @@ -52,7 +51,6 @@ def find_transaction_by_sig(tx_sig: str): SELECT * FROM ( SELECT signature, - message, errors, is_executed, is_confirmed, @@ -74,8 +72,8 @@ def find_transaction_by_sig(tx_sig: str): assert len(maprows) <= 1, "Tx Sig is primary key - find zero or one" for row in maprows: - # note: type changed from 'text' to 'text[]' - row['errors_array'] = row['errors'] + row['errors_array'] = json.loads(row['errors']) + row['accounts_used_array'] = json.loads(row['accounts_used']) return maprows