Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Disable local verification #64

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ config :ex_aws,
secret_access_key: System.get_env("AWS_SECRET_ACCESS_KEY"),
region: System.get_env("AWS_REGION")

config :starknet_explorer,
enable_block_verification: System.get_env("ENABLE_BLOCK_VERIFICATION") || false

if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
Expand Down Expand Up @@ -72,7 +75,7 @@ if config_env() == :prod do
check_origin: [
"https://madaraexplorer.com",
"https://www.madaraexplorer.com",
"https://madaraexplorer.lambdaclass.com",
"https://madaraexplorer.lambdaclass.com"
],
http: [
# Enable IPv6 and bind on all interfaces.
Expand Down
39 changes: 20 additions & 19 deletions lib/starknet_explorer_web/live/pages/block_detail.ex
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ defmodule StarknetExplorerWeb.BlockDetailLive do
assigns = [
block: block,
view: "overview",
verification: "Pending"
verification: "Pending",
enable_verification: Application.get_env(:starknet_explorer, :enable_block_verification)
]

{:ok, assign(socket, assigns)}
Expand All @@ -104,8 +105,6 @@ defmodule StarknetExplorerWeb.BlockDetailLive do

@impl true
def handle_event("block-verified", %{"result" => result}, socket) do
IO.inspect(result, label: "Block verification result")

verification =
case result do
true ->
Expand Down Expand Up @@ -186,25 +185,27 @@ defmodule StarknetExplorerWeb.BlockDetailLive do
# Do not hardcode:
# - Total Execeution Resources
# - Gas Price
def render_info(assigns = %{block: _block, view: "overview"}) do
def render_info(assigns = %{block: _block, view: "overview", enable_verification: _}) do
~H"""
<div class="grid-4 custom-list-item">
<div class="block-label">
Local Verification
</div>
<div class="col-span-3">
<div class="flex flex-col lg:flex-row items-start lg:items-center gap-2">
<span
id="block_verifier"
class={"#{if @verification == "Pending", do: "pink-label"} #{if @verification == "Verified", do: "green-label"} #{if @verification == "Failed", do: "violet-label"}"}
data-hash={@block["block_hash"]}
phx-hook="BlockVerifier"
>
<%= @verification %>
</span>
<%= if @enable_verification do %>
<div class="grid-4 custom-list-item">
<div class="block-label">
Local Verification
</div>
<div class="col-span-3">
<div class="flex flex-col lg:flex-row items-start lg:items-center gap-2">
<span
id="block_verifier"
class={"#{if @verification == "Pending", do: "pink-label"} #{if @verification == "Verified", do: "green-label"} #{if @verification == "Failed", do: "violet-label"}"}
data-hash={@block["block_hash"]}
phx-hook="BlockVerifier"
>
<%= @verification %>
</span>
</div>
</div>
</div>
</div>
<% end %>
<div class="grid-4 custom-list-item">
<div class="block-label">Block Hash</div>
<div
Expand Down
Loading