Skip to content
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
113 changes: 113 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Publish Docker image

on:
workflow_dispatch:
inputs:
tags:
description: Image tags (metadata-action format)
required: false
type: string
build_args:
description: Build-time variables
required: false
type: string
platforms:
description: "Comma-separated platforms"
required: false
type: string
default: linux/amd64
private:
description: "Make image private"
required: false
type: boolean
default: true

workflow_call:
inputs:
tags:
type: string
required: false
build_args:
type: string
required: false
platforms:
type: string
required: false
default: linux/amd64
private:
type: boolean
required: false
default: true

permissions:
contents: read
packages: write

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Remove .NET
shell: bash
run: sudo rm -rf /usr/share/dotnet/

- name: Remove Android SDK
shell: bash
run: sudo rm -rf /usr/local/lib/android

- name: Remove Haskell
shell: bash
run: sudo rm -rf /opt/ghc /usr/local/.ghcup


- name: Check out repo
uses: actions/checkout@v4

- name: Select image name
id: img
run: |
if [ "${{ inputs.private }}" = "true" ]; then
echo "name=ghcr.io/${{ github.repository_owner }}/backend-private" >> $GITHUB_OUTPUT
else
echo "name=ghcr.io/${{ github.repository_owner }}/backend" >> $GITHUB_OUTPUT
fi

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.img.outputs.name }}
flavor: latest=false
tags: |
type=ref,event=tag
${{ inputs.tags }}

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add SHORT_SHA
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV

- name: Set up Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
cache-from: type=gha
tags: ${{ steps.meta.outputs.tags }}
platforms: ${{ inputs.platforms }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT_SHA=${{ env.SHORT_SHA }}
GIT_TAG=${{ github.ref_type == 'tag' && github.ref_name || '' }}
${{ inputs.build_args }}

Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,38 @@ defmodule BlockScoutWeb.API.V2.TransactionView do

decoded_input_data = decoded_input(decoded_input)

deposited_to =
case {transaction.type, transaction.input} do
# When depositing ETH, the L2 transaction data is `mintETH(address to)`
{126, %Explorer.Chain.Data{bytes: <<
0xb0, 0xf4, 0xd3, 0x95, # function selector
_::binary-size(12), # address padding
address::binary-size(20),
>>}} ->
Helper.address_with_info(
single_transaction? && conn,
Address.get(address),
address,
single_transaction?
)
# When depositing ERC20, the L2 transaction data is
# `function mintERC20(address tokenL1, address tokenL2, address destination, uint256 amount)`
{126, %Explorer.Chain.Data{bytes: <<
0x79, 0x20, 0x4f, 0xe0,
_::binary-size(76), # address tokenL1 + address tokenL2 + address padding
address::binary-size(20),
_::binary # amount
>>}} ->
Helper.address_with_info(
single_transaction? && conn,
Address.get(address),
address,
single_transaction?
)
_ ->
nil
end

result = %{
"hash" => transaction.hash,
"result" => status,
Expand Down Expand Up @@ -524,7 +556,8 @@ defmodule BlockScoutWeb.API.V2.TransactionView do
GetTransactionTags.get_transaction_tags(transaction.hash, current_user(single_transaction? && conn)),
"has_error_in_internal_transactions" => transaction.has_error_in_internal_transactions,
"authorization_list" => authorization_list(transaction.signed_authorizations),
"is_pending_update" => transaction.block && transaction.block.refetch_needed
"is_pending_update" => transaction.block && transaction.block.refetch_needed,
"deposited_to" => deposited_to
}

result
Expand Down
4 changes: 4 additions & 0 deletions apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/geth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ defmodule EthereumJSONRPC.Geth do
|> Enum.reduce(acc, &parse_call_tracer_calls(&1, &2, trace_address))
end

defp parse_call_tracer_calls({calls, _depth}, acc, trace_address, inner?) do
parse_call_tracer_calls(calls, acc, trace_address, inner?)
end

defp log_unknown_type(call) do
Logger.warning("Call from a callTracer with an unknown type: #{inspect(call)}")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ defmodule Explorer.Repo.Migrations.CreateTransactions do
add(:internal_transactions_indexed_at, :utc_datetime_usec, null: true)

add(:nonce, :integer, null: false)
add(:r, :numeric, precision: 100, null: false)
add(:s, :numeric, precision: 100, null: false)
add(:r, :numeric, precision: 100, null: true)
add(:s, :numeric, precision: 100, null: true)

# `null` when a pending transaction
add(:status, :integer, null: true)
Expand Down
23 changes: 6 additions & 17 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,13 @@ services:
context: ..
dockerfile: ./docker/Dockerfile
args:
RELEASE_VERSION: 9.0.2
RELEASE_VERSION: 9.2.2
links:
- db:database
environment:
ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:8545/
ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:8545/
ETHEREUM_JSONRPC_WS_URL: ws://host.docker.internal:8545/
CHAIN_ID: '1337'

nft_media_handler:
depends_on:
- backend
extends:
file: ./services/nft_media_handler.yml
service: nft_media_handler
build:
context: ..
dockerfile: ./docker/Dockerfile
args:
RELEASE_VERSION: 9.0.2
ETHEREUM_JSONRPC_HTTP_URL: http://host.docker.internal:1729/
ETHEREUM_JSONRPC_TRACE_URL: http://host.docker.internal:1729/
CHAIN_ID: '65536999'

visualizer:
extends:
Expand All @@ -62,6 +49,8 @@ services:
service: sig-provider

frontend:
image: blockscout/frontend
pull_policy: missing
depends_on:
- backend
extends:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose/envs/common-blockscout.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ETHEREUM_JSONRPC_VARIANT=geth
ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:8545/
ETHEREUM_JSONRPC_HTTP_URL=http://host.docker.internal:1729/
DISABLE_FILE_LOGGING=false
DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout

Expand All @@ -12,7 +12,7 @@ DATABASE_URL=postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout
ETHEREUM_JSONRPC_TRANSPORT=http
ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES=false
# ETHEREUM_JSONRPC_FALLBACK_HTTP_URL=
ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:8545/
ETHEREUM_JSONRPC_TRACE_URL=http://host.docker.internal:1729/
# ETHEREUM_JSONRPC_FALLBACK_TRACE_URL=
# ETHEREUM_JSONRPC_ETH_CALL_URL=
# ETHEREUM_JSONRPC_FALLBACK_ETH_CALL_URL=
Expand Down
14 changes: 9 additions & 5 deletions docker-compose/envs/common-frontend.env
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
NEXT_PUBLIC_API_HOST=localhost
NEXT_PUBLIC_API_HOST=localhost:8082
NEXT_PUBLIC_API_PROTOCOL=http
NEXT_PUBLIC_STATS_API_HOST=http://localhost:8080
NEXT_PUBLIC_NETWORK_NAME=Awesome chain
NEXT_PUBLIC_NETWORK_SHORT_NAME=Awesome chain
NEXT_PUBLIC_NETWORK_ID=5
NEXT_PUBLIC_NETWORK_NAME=Ethrex L2
NEXT_PUBLIC_NETWORK_SHORT_NAME=Ethrex L2
NEXT_PUBLIC_NETWORK_ID=65536999
NEXT_PUBLIC_NETWORK_CURRENCY_NAME=Ether
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=ETH
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
NEXT_PUBLIC_API_BASE_PATH=/
NEXT_PUBLIC_APP_HOST=localhost
NEXT_PUBLIC_APP_HOST=localhost:8082
NEXT_PUBLIC_APP_PROTOCOL=http
NEXT_PUBLIC_HOMEPAGE_CHARTS=['daily_txs']
NEXT_PUBLIC_VISUALIZE_API_HOST=http://localhost:8081
NEXT_PUBLIC_IS_TESTNET=true
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws
NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml
NEXT_PUBLIC_AD_BANNER_PROVIDER=none
NEXT_PUBLIC_AD_TEXT_PROVIDER=none
NEXT_PUBLIC_MARKETPLACE_ENABLED=false
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE=false
# Required to enable blockchain interaction
# NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=
4 changes: 3 additions & 1 deletion docker-compose/envs/common-stats.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
STATS__SERVER__HTTP__ENABLED=true
STATS__SERVER__HTTP__ADDR=0.0.0.0:8050
STATS__SERVER__HTTP__MAX_BODY_SIZE=2097152
STATS__SERVER__HTTP__CORS__ENABLED=true
STATS__SERVER__HTTP__CORS__ALLOWED_ORIGIN=http://localhost:8080

STATS__SERVER__GRPC__ENABLED=false
STATS__SERVER__GRPC__ADDR=0.0.0.0:8051
Expand All @@ -26,4 +28,4 @@ STATS__JAEGER__AGENT_ENDPOINT=localhost:6831
STATS__TRACING__ENABLED=true
STATS__TRACING__FORMAT=default

STATS__BLOCKSCOUT_API_URL=http://host.docker.internal
STATS__BLOCKSCOUT_API_URL=http://host.docker.internal:8082
12 changes: 6 additions & 6 deletions docker-compose/proxy/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ map $http_upgrade $connection_upgrade {

server {
listen 80;
server_name localhost;
server_name localhost:8082;
proxy_http_version 1.1;

location ~ ^/(api(?!-docs$)|socket|sitemap.xml|auth/auth0|auth/auth0/callback|auth/logout) {
Expand Down Expand Up @@ -34,11 +34,11 @@ server {
}
server {
listen 8080;
server_name localhost;
server_name localhost:8082;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' 'http://localhost' always;
add_header 'Access-Control-Allow-Origin' 'http://localhost:8082' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;

Expand All @@ -56,11 +56,11 @@ server {
}
server {
listen 8081;
server_name localhost;
server_name localhost:8082;
proxy_http_version 1.1;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Methods;
add_header 'Access-Control-Allow-Origin' 'http://localhost' always;
add_header 'Access-Control-Allow-Origin' 'http://localhost:8082' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'PUT, GET, POST, OPTIONS, DELETE, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,x-csrf-token' always;
Expand Down Expand Up @@ -90,4 +90,4 @@ server {
return 204;
}
}
}
}
6 changes: 3 additions & 3 deletions docker-compose/services/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: '3.9'

services:
backend:
image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest}
pull_policy: always
restart: always
# image: ghcr.io/blockscout/${DOCKER_REPO:-blockscout}:${DOCKER_TAG:-latest}
# pull_policy: always
# restart: always
stop_grace_period: 5m
container_name: 'backend'
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
Expand Down
6 changes: 3 additions & 3 deletions docker-compose/services/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: '3.9'

services:
frontend:
image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
image: blockscout/frontend
# pull_policy: always
# platform: linux/amd64
restart: always
container_name: 'frontend'
env_file:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/services/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
FRONT_PROXY_PASS: ${FRONT_PROXY_PASS:-http://frontend:3000}
ports:
- target: 80
published: 80
published: 8082
- target: 8080
published: 8080
- target: 8081
Expand Down
6 changes: 6 additions & 0 deletions docker-compose/services/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ services:
- STATS__BLOCKSCOUT_DB_URL=${STATS__BLOCKSCOUT_DB_URL:-postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@db:5432/blockscout}
- STATS__CREATE_DATABASE=${STATS__CREATE_DATABASE:-true}
- STATS__RUN_MIGRATIONS=${STATS__RUN_MIGRATIONS:-true}
- STATS__BLOCKSCOUT_API_URL=${STATS__BLOCKSCOUT_API_URL:-http://localhost:8082}
- STATS__SERVER__HTTP__CORS__ENABLED=${STATS__SERVER__HTTP__CORS__ENABLED:-false}
- STATS__SERVER__HTTP__CORS__ALLOWED_ORIGIN=${STATS__SERVER__HTTP__CORS__ALLOWED_ORIGIN}
- STATS__CONDITIONAL_START__USER_OPS_PAST_INDEXING_FINISHED__ENABLED=${STATS__CONDITIONAL_START__USER_OPS_PAST_INDEXING_FINISHED__ENABLED:-false}
ports:
- 8050:8050
Loading