Skip to content

Commit 4d330aa

Browse files
glpecileMauroToscanoNicolasRampoldi
authored
feat(explorer): add tx link and block to etherscan and other misc changes and improvements (#279)
Co-authored-by: MauroFab <maurotoscano2@gmail.com> Co-authored-by: NicolasRampoldi <58613770+NicolasRampoldi@users.noreply.github.com> Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com>
1 parent f7cfadd commit 4d330aa

11 files changed

Lines changed: 83 additions & 63 deletions

File tree

README.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
- [Local Devnet Setup](#local-devnet-setup)
1313
- [Deploying Aligned Contracts to Holesky or Testnet](#deploying-aligned-contracts-to-holesky-or-testnet)
1414
- [Metrics](#metrics)
15-
- [Notes on project creation / devnet deployment](#notes-on-project-creation--devnet-deployment)
1615
- [Explorer](#explorer)
16+
- [Notes on project creation / devnet deployment](#notes-on-project-creation--devnet-deployment)
1717
- [Tests](#tests)
1818
- [FAQ](#faq)
1919

@@ -405,7 +405,6 @@ To start the operator with a custom configuration, run:
405405
make operator_start CONFIG_FILE=<path_to_config_file>
406406
```
407407

408-
409408
### Batcher
410409

411410
#### Config
@@ -491,7 +490,6 @@ cd batcher/client/ && cargo run --release -- \
491490
--proof_generator_addr <proof_generator_addr>
492491
```
493492

494-
495493
### Task Sender
496494

497495
#### Config
@@ -600,7 +598,7 @@ go run task_sender/cmd/main.go loop-tasks
600598

601599
## Deploying Aligned Contracts to Holesky or Testnet
602600

603-
### Eigenlayer Contracts: Anvil
601+
### Eigenlayer Contracts: Anvil
604602

605603
If EigenLayer contracts change, the anvil state needs to be updated with:
606604

@@ -621,7 +619,6 @@ These contracts are not deployed by Aligned. Current EigenLayer contracts:
621619
- [Holesky Contracts](https://github.com/Layr-Labs/eigenlayer-contracts/blob/testnet-holesky/script/configs/holesky/Holesky_current_deployment.config.json)
622620
- [Mainnet Contracts](https://github.com/Layr-Labs/eigenlayer-contracts/blob/mainnet/script/configs/mainnet/Mainnet_current_deployment.config.json)
623621

624-
625622
### Aligned Contracts: Anvil
626623

627624
When changing Aligned contracts, the anvil state needs to be updated with:
@@ -680,6 +677,7 @@ You can find an example config file in `contracts/script/deploy/config/holesky/a
680677
### Bindings
681678

682679
Also make sure to re-generate the Go smart contract bindings:
680+
683681
```bash
684682
make bindings
685683
```
@@ -716,36 +714,9 @@ To install Prometheus, you can follow the instructions on the [official website]
716714
To install Grafana, you can follow the instructions on the [official website](https://grafana.com/docs/grafana/latest/setup-grafana/installation/).
717715

718716

719-
## Notes on project creation / devnet deployment
720-
721-
Eigenlayer middleware was installed as a submodule with:
722-
723-
```sh
724-
mkdir contracts
725-
cd contacts
726-
forge init . --no-commit
727-
forge install Layr-Labs/eigenlayer-middleware@mainnet
728-
```
729-
730-
Then to solve the issue <https://github.com/Layr-Labs/eigenlayer-middleware/issues/229>, we changed it to:
731-
732-
```forge install yetanotherco/eigenlayer-middleware@yac-mainnet --no-commit```
733-
734-
As soon as it gets fixed in mainnet we can revert it.
735-
736-
Base version of middleware used is ```7229f2b```.
737-
738-
The script to initialize the devnet can be found on ```contracts/scripts/anvil```.
717+
## Explorer
739718

740-
The addresses of the relevant contracts after running the anvil script is dumped on ```contracts/script/output/devnet```.
741-
742-
The state is backuped on ```contracts/scripts/anvil/state```.
743-
744-
Eigenlayer contract deployment is almost the same as the EigenLayer contract deployment on mainnet. Changes are described on the file.
745-
746-
747-
## Explorer
748-
### Requirements
719+
### Minimum Requirements
749720

750721
- [Erlang 26](https://github.com/asdf-vm/asdf-erlang)
751722
- [Elixir 1.16.2](https://elixir-ko.github.io/install.html), compiled with OTP 26
@@ -767,10 +738,10 @@ Create a `.env` file in the `/explorer` directory of the project. The `.env` fil
767738
| -------- | ----------- |
768739
| `RPC_URL` | The RPC URL of the network you want to connect to. |
769740
| `ENVIRONMENT` | The environment you want to run the application in. It can be `devnet`, `holesky` or `mainnet`. |
741+
| `PHX_HOST` | The host URL where the Phoenix server will be running. |
770742

771743
```make run_explorer```
772744

773-
774745
### Send example data
775746

776747
If you want to have some data to see on it, you can start our infinite task sender, which will constantly send new proofs to the batcher.
@@ -779,6 +750,35 @@ If you want to have some data to see on it, you can start our infinite task send
779750
make batcher_send_burst_groth16
780751
```
781752

753+
754+
## Notes on project creation / devnet deployment
755+
756+
Eigenlayer middleware was installed as a submodule with:
757+
758+
```sh
759+
mkdir contracts
760+
cd contacts
761+
forge init . --no-commit
762+
forge install Layr-Labs/eigenlayer-middleware@mainnet
763+
```
764+
765+
Then to solve the issue <https://github.com/Layr-Labs/eigenlayer-middleware/issues/229>, we changed it to:
766+
767+
```forge install yetanotherco/eigenlayer-middleware@yac-mainnet --no-commit```
768+
769+
As soon as it gets fixed in mainnet we can revert it.
770+
771+
Base version of middleware used is ```7229f2b```.
772+
773+
The script to initialize the devnet can be found on ```contracts/scripts/anvil```.
774+
775+
The addresses of the relevant contracts after running the anvil script is dumped on ```contracts/script/output/devnet```.
776+
777+
The state is backuped on ```contracts/scripts/anvil/state```.
778+
779+
Eigenlayer contract deployment is almost the same as the EigenLayer contract deployment on mainnet. Changes are described on the file.
780+
781+
782782
## Tests
783783

784784
To run the go tests
@@ -787,11 +787,12 @@ To run the go tests
787787
make test
788788
```
789789

790-
# Verify Proofs
791790

792-
## SP1
791+
## Verify Proofs
793792

794-
### Dependencies
793+
### SP1
794+
795+
#### Dependencies
795796
This guide assumes that:
796797
- sp1 prover installed (instructions [here](https://succinctlabs.github.io/sp1/getting-started/install.html))
797798
- sp1 project to generate the proofs (instructions [here](https://succinctlabs.github.io/sp1/generating-proofs/setup.html))
@@ -800,7 +801,7 @@ This guide assumes that:
800801
git clone https://github.com/yetanotherco/aligned_layer.git
801802
```
802803

803-
### How to generate a proof
804+
#### How to generate a proof
804805

805806
> AlignedLayer only verifies SP1 in compressed version.
806807
> You can check you are using compressed by opening script/src/main.rs
@@ -813,7 +814,7 @@ Then, run the following command to generate a proof:
813814
cargo run --release
814815
```
815816

816-
### How to get the proof verified by AlignedLayer
817+
#### How to get the proof verified by AlignedLayer
817818

818819
After generating the proof, you will have to find two different files:
819820
- proof file: usually found under `script` directory, with the name `proof.json` or similar
@@ -831,6 +832,7 @@ cargo run --release -- \
831832
--proof_generator_addr <proof_generator_addr>
832833
```
833834

835+
834836
## FAQ
835837

836838
### What is the objective of Aligned?

explorer/.env.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
RPC_URL=http://localhost:8545
22
ENVIRONMENT=devnet
3+
PHX_HOST=http://localhost:4000

explorer/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
RPC_URL=<rpc_url>
22
ENVIRONMENT=<devnet|holesky|mainnet>
3+
PHX_HOST=<phx_host_url>

explorer/config/runtime.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if config_env() == :prod do
3333
You can generate one by calling: mix phx.gen.secret
3434
"""
3535

36-
host = System.get_env("PHX_HOST") || "example.com"
36+
host = System.get_env("PHX_HOST") || "explorer.alignedlayer.com"
3737
port = String.to_integer(System.get_env("PORT") || "4000")
3838

3939
config :explorer, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")

explorer/lib/explorer_web/components/core_components.ex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ defmodule ExplorerWeb.CoreComponents do
281281
"""
282282
end
283283

284+
@doc """
285+
Renders an arrow icon.
286+
"""
284287
attr :class, :string, default: nil
285288

286289
def right_arrow(assigns) do
@@ -292,6 +295,21 @@ defmodule ExplorerWeb.CoreComponents do
292295
"""
293296
end
294297

298+
@doc """
299+
Renders an anchor tag.
300+
"""
301+
attr :class, :string, default: nil
302+
attr :rest, :global, include: ~w(href target)
303+
slot :inner_block, default: nil
304+
305+
def a(assigns) do
306+
~H"""
307+
<.link class={["underline underline-offset-4 font-medium after:content-['↗'] hover:after:content-['→'] transition-all duration-150", @class]} {@rest}>
308+
<%= render_slot(@inner_block) %>
309+
</.link>
310+
"""
311+
end
312+
295313
@doc """
296314
Renders an input with label and error messages.
297315

explorer/lib/explorer_web/components/layouts/app.html.heex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Batches
88
</a>
99
</div>
10-
<div class="flex items-center gap-4 font-semibold leading-6 text-foreground/80">
10+
<div class="items-center gap-4 font-semibold leading-6 text-foreground/80 flex [&>a]:hidden sm:[&>a]:inline-block">
1111
<a class="hover:text-foreground" target="_blank" href="https://x.com/alignedlayer">
1212
@alignedlayer
1313
</a>

explorer/lib/explorer_web/components/layouts/root.html.heex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<%!-- Description --%>
1111
<meta
1212
name="description"
13-
content="Explore the Aligned verification layer with Aligned Exlporer. Keep track of every task, block, its response and any other relevant information of Aligned!"
13+
content="Explore every aligned proof batch with Aligned Explorer!"
1414
/>
1515
<%!-- Emoji favicon --%>
1616
<link
@@ -23,7 +23,7 @@
2323
<meta property="og:title" content="Aligned Explorer" />
2424
<meta
2525
property="og:description"
26-
content="Explore the Aligned verification layer with Aligned Exlporer. Keep track of every task, block, its response and any other relevant information of Aligned!"
26+
content="Explore every aligned proof batch with Aligned Explorer!"
2727
/>
2828
<meta property="og:image" content={~p"/images/hero.jpeg"} />
2929
<!-- Twitter -->
@@ -32,7 +32,7 @@
3232
<meta property="twitter:title" content="Aligned Explorer" />
3333
<meta
3434
property="twitter:description"
35-
content="Explore the Aligned verification layer with Aligned Exlporer. Keep track of every task, block, its response and any other relevant information of Aligned!"
35+
content="Explore every aligned proof batch with Aligned Explorer!"
3636
/>
3737
<meta property="twitter:image" content={~p"/images/hero.jpeg"} />
3838
<meta name="csrf-token" content={get_csrf_token()} />

explorer/lib/explorer_web/live/pages/batch/index.html.heex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<h1 class="text-5xl font-bold font-foreground">Batch Details</h1>
44
<.card
55
class="px-6 py-5 min-h-fit flex flex-col rounded-3xl"
6-
inner_class="font-semibold inline-flex flex-col text-base gap-y-2"
6+
inner_class="font-semibold inline-flex flex-col text-base gap-y-2 text-muted-foreground [&>span]:text-foreground [&>a]:text-foreground"
77
>
88
Merkle Root Hash: <span class="break-all font-normal"><%= @merkle_root %></span>
9-
Address: <span class="break-all font-normal"><%= @newBatchInfo.address %></span>
109
Block Hash: <span class="break-all font-normal"><%= @newBatchInfo.block_hash %></span>
11-
Block Number: <span class="break-all font-normal"><%= @newBatchInfo.block_number %></span>
10+
Block Number: <.a target="_blank" rel="noopener" href={"https://holesky.etherscan.io/block/#{@newBatchInfo.block_number}"} class="break-all font-normal"><%= @newBatchInfo.block_number %></.a>
1211
Transaction Hash:
13-
<span class="break-all font-normal"><%= @newBatchInfo.transaction_hash %></span>
12+
<.a target="_blank" rel="noopener" href={"https://holesky.etherscan.io/tx/#{@newBatchInfo.transaction_hash}"} class="break-all font-normal"><%= @newBatchInfo.transaction_hash %></.a>
13+
Aligned Contract Address: <.a target="_blank" rel="noopener" href={"https://holesky.etherscan.io/address/#{@newBatchInfo.address}"} class="break-all font-normal"><%= @newBatchInfo.address %></.a>
1414
</.card>
1515
<% else %>
1616
<div class="flex flex-col space-y-6 justify-center grow relative text-center">
@@ -23,11 +23,11 @@
2323
alt="block not found"
2424
src={~p"/images/not-found.jpeg"}
2525
/>
26-
<a href="/">
26+
<.link navigate={~p"/"}>
2727
<.button>
2828
Go Home
2929
</.button>
30-
</a>
30+
</.link>
3131
</div>
3232
<% end %>
3333
</div>

explorer/lib/explorer_web/live/pages/batches/index.html.heex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
<%= for batch <- @batches do %>
1717
<tr class="text-foreground gap-y-2 [&>th]:pt-3">
1818
<th class="text-left">
19-
<a href={"/batches/#{batch.batch_merkle_root}"} class="group">
19+
<.link navigate={~p"/batches/#{batch.batch_merkle_root}"} class="group">
2020
<span
2121
title={batch.batch_merkle_root}
2222
class="inline-flex gap-x-3 col-span-2 items-center group-hover:text-foreground/80"
2323
>
2424
<%= Utils.shorten_block_hash(batch.batch_merkle_root) %>
2525
<.right_arrow />
2626
</span>
27-
</a>
27+
</.link>
2828
</th>
2929

3030
<th class="font-normal group-hover:text-foreground/80">
@@ -49,11 +49,11 @@
4949
</tbody>
5050
</table>
5151
</.card_background>
52-
<a href={"?page=#{@current_page + 1}"}>
52+
<.link navigate={~p"/batches?page=#{@current_page + 1}"}>
5353
<.button class="text-muted-foreground flex self-center">
5454
Show More
5555
</.button>
56-
</a>
56+
</.link>
5757
<% else %>
5858
<p class="text-lg">No batches found</p>
5959
<% end %>

explorer/lib/explorer_web/live/pages/home/index.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ defmodule ExplorerWeb.Home.Index do
2222
def mount(_, _, socket) do
2323
verified_batches = get_verified_batches_count()
2424

25-
shorthand_verified_batches = Utils.convert_number_to_shorthand(verified_batches)
26-
2725
operators_registered = get_operators_registered()
2826

2927
latest_batches =
@@ -33,7 +31,7 @@ defmodule ExplorerWeb.Home.Index do
3331

3432
{:ok,
3533
assign(socket,
36-
verified_batches: shorthand_verified_batches,
34+
verified_batches: verified_batches,
3735
operators_registered: operators_registered,
3836
latest_batches: latest_batches,
3937
page_title: "Welcome"

0 commit comments

Comments
 (0)