Skip to content

Commit

Permalink
add various address stats
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukaMa committed Oct 26, 2023
1 parent e925fd0 commit 522975d
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 95 deletions.
2 changes: 1 addition & 1 deletion aleo_types/vm_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,7 @@ def storage_cost(self) -> int:
return len(self.dump())

async def finalize_costs(self, db: "Database"):
finalize_costs = []
finalize_costs: list[int] = []
for transition in self.transitions:
from util.global_cache import get_program
program = await get_program(db, str(transition.program_id))
Expand Down
225 changes: 177 additions & 48 deletions db.py

Large diffs are not rendered by default.

39 changes: 36 additions & 3 deletions pg_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- PostgreSQL database dump
--

-- Dumped from database version 15.1
-- Dumped by pg_dump version 15.3
-- Dumped from database version 15.4 (Debian 15.4-3)
-- Dumped by pg_dump version 15.4

SET statement_timeout = 0;
SET lock_timeout = 0;
Expand Down Expand Up @@ -152,6 +152,16 @@ CREATE TABLE explorer._migration (
);


--
-- Name: address_transition; Type: TABLE; Schema: explorer; Owner: -
--

CREATE TABLE explorer.address_transition (
address text NOT NULL,
transition_id integer NOT NULL
);


--
-- Name: authority; Type: TABLE; Schema: explorer; Owner: -
--
Expand Down Expand Up @@ -1092,7 +1102,8 @@ CREATE TABLE explorer.program (
feature_hash bytea NOT NULL,
owner text,
signature text,
leo_source text
leo_source text,
address text NOT NULL
);


Expand Down Expand Up @@ -2373,6 +2384,20 @@ ALTER TABLE ONLY explorer.transition
ADD CONSTRAINT transition_pk PRIMARY KEY (id);


--
-- Name: address_transition_address_index; Type: INDEX; Schema: explorer; Owner: -
--

CREATE INDEX address_transition_address_index ON explorer.address_transition USING btree (address);


--
-- Name: address_transition_transition_id_index; Type: INDEX; Schema: explorer; Owner: -
--

CREATE INDEX address_transition_transition_id_index ON explorer.address_transition USING btree (transition_id);


--
-- Name: authority_block_id_index; Type: INDEX; Schema: explorer; Owner: -
--
Expand Down Expand Up @@ -2954,6 +2979,14 @@ CREATE INDEX transition_transaction_execute_id_index ON explorer.transition USIN
CREATE UNIQUE INDEX transition_transition_id_uindex ON explorer.transition USING btree (transition_id text_pattern_ops);


--
-- Name: address_transition address_stats_transition_transition_id_fk; Type: FK CONSTRAINT; Schema: explorer; Owner: -
--

ALTER TABLE ONLY explorer.address_transition
ADD CONSTRAINT address_stats_transition_transition_id_fk FOREIGN KEY (transition_id) REFERENCES explorer.transition(id);


--
-- Name: authority authority_block_id_fk; Type: FK CONSTRAINT; Schema: explorer; Owner: -
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pre {
font-family: monospace !important;
}

#transitions, #rejected-transitions {
#rejected-transitions {
margin-top: 20px;
}

Expand Down
2 changes: 1 addition & 1 deletion webui/templates/base.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% endif %}
}
</style>
<link rel="stylesheet" href="/static/base_style_v4.css">
<link rel="stylesheet" href="/static/base_style_v5.css">
{% block head %}{% endblock %}
</head>
<body hx-ext="morph" hx-indicator="#htmx-body">
Expand Down
8 changes: 4 additions & 4 deletions webui/templates/htmx/block.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
</div>

<ul class="tabs" data-tabs id="block-tabs">
<li class="tabs-title is-active"><a href="#info">Block info</a></li>
<li class="tabs-title"><a href="#transactions">Transactions</a></li>
<li class="tabs-title is-active"><a href="#transactions">Transactions</a></li>
<li class="tabs-title"><a href="#info">Block info</a></li>
<li class="tabs-title"><a href="#solutions">Puzzle solutions</a></li>
</ul>

<div class="tabs-content" data-tabs-content="block-tabs">
<div class="tabs-panel is-active" id="info">
<div class="tabs-panel" id="info">
{% call data_line("Cumulative weight") %}
{{ block.header.metadata.cumulative_weight | format_number | safe }}
{% endcall %}
Expand Down Expand Up @@ -79,7 +79,7 @@
{% endcall %}
</div>

<div class="tabs-panel" id="transactions">
<div class="tabs-panel is-active" id="transactions">
<table id="transactions-table" class="unstriped">
<thead>
<tr>
Expand Down
90 changes: 53 additions & 37 deletions webui/templates/htmx/transaction.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -65,42 +65,15 @@
{% endif %}
</div>

<div id="transitions">
<h4>{% if type == "Deploy" %}Fee transition{% else %}Transitions{% endif %}</h4>
<table id="transitions-table" class="unstriped">
<thead>
<tr>
<td>Index</td>
<td>Transition ID</td>
<td>Program / Function call</td>
</tr>
</thead>
<tbody>
{% for transition in transitions %}
<tr>
<td>{{ loop.index0 }}</td>
<td>
<span class="mono"><a href="/transition?id={{ transition.transition_id }}">{{ transition.transition_id }}</a></span>
</td>
<td><span class="mono">{{ transition.action }}</span></td>
</tr>
{% endfor %}
{% if fee_transition %}
<tr>
<td>Fee</td>
<td>
<span class="mono"><a href="/transition?id={{ fee_transition.transition_id }}">{{ fee_transition.transition_id }}</a></span>
</td>
<td><span class="mono">{{ fee_transition.action }}</span></td>
</tr>
{% endif %}
</tbody>
</table>
</div>
<ul class="tabs" data-tabs id="transaction-tabs">
<li class="tabs-title is-active"><a href="#transitions">Transitions</a></li>
<li class="tabs-title"><a href="#finalize-graph">Finalize call graph</a></li>
<li class="tabs-title"><a href="#mapping-operations">Mapping operations</a></li>
</ul>

{% if state == "Rejected" %}
<div id="rejected-transitions">
<h4>Rejected Transitions</h4>
<div class="tabs-content" data-tabs-content="transaction-tabs">
<div class="tabs-panel is-active" id="transitions">
{% if type == "Deploy" %}<h4>Fee transition</h4>{% endif %}
<table id="transitions-table" class="unstriped">
<thead>
<tr>
Expand All @@ -110,7 +83,7 @@
</tr>
</thead>
<tbody>
{% for transition in rejected_transitions %}
{% for transition in transitions %}
<tr>
<td>{{ loop.index0 }}</td>
<td>
Expand All @@ -119,11 +92,54 @@
<td><span class="mono">{{ transition.action }}</span></td>
</tr>
{% endfor %}
{% if fee_transition %}
<tr>
<td>Fee</td>
<td>
<span class="mono"><a href="/transition?id={{ fee_transition.transition_id }}">{{ fee_transition.transition_id }}</a></span>
</td>
<td><span class="mono">{{ fee_transition.action }}</span></td>
</tr>
{% endif %}
</tbody>
</table>

{% if state == "Rejected" %}
<div id="rejected-transitions">
<h4>Rejected Transitions</h4>
<table id="transitions-table" class="unstriped">
<thead>
<tr>
<td>Index</td>
<td>Transition ID</td>
<td>Program / Function call</td>
</tr>
</thead>
<tbody>
{% for transition in rejected_transitions %}
<tr>
<td>{{ loop.index0 }}</td>
<td>
<span class="mono"><a href="/transition?id={{ transition.transition_id }}">{{ transition.transition_id }}</a></span>
</td>
<td><span class="mono">{{ transition.action }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endif %}

<div class="tabs-panel" id="finalize-graph">
Coming soon
</div>

<div class="tabs-panel" id="mapping-operations">
Coming soon
</div>

</div>

</div>

Expand Down

0 comments on commit 522975d

Please sign in to comment.