Skip to content

Commit

Permalink
Merge branch 'verkle-support' into verkle-support
Browse files Browse the repository at this point in the history
Signed-off-by: pk910 <[email protected]>
  • Loading branch information
pk910 authored Apr 8, 2024
2 parents 2890b58 + a8597e0 commit b71aec4
Show file tree
Hide file tree
Showing 67 changed files with 1,042 additions and 460 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/_shared-docker-clone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

name: Reusable docker clone workflow
on:
workflow_call:
inputs:
source_repository:
description: 'Source Docker Hub Repository'
default: ''
required: false
type: string
target_repository:
description: 'Target Docker Hub Repository'
default: ''
required: false
type: string
tags:
description: 'Docker Image Tags (JSON)'
default: ''
required: false
type: string
secrets:
DOCKERHUB_USERNAME:
description: 'Docker Hub Username'
required: false
DOCKERHUB_TOKEN:
description: 'Docker Hub Token'
required: false

# shared build jobs
jobs:
clone_docker_images:
name: Clone docker images to ${{ inputs.target_repository }}
if: ${{ inputs.tags }}
runs-on: ubuntu-latest
strategy:
matrix:
tag: ${{ fromJSON(inputs.tags) }}
steps:

# prepare docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get tag names
id: tags
run: |
tagstr="${{ matrix.tag }}"
tagparts=(${tagstr//:/ })
echo "source_tag=${tagparts[0]}" >> $GITHUB_OUTPUT
if [ -z "${tagparts[1]}" ]; then
echo "target_tag=${tagparts[0]}" >> $GITHUB_OUTPUT
else
echo "target_tag=${tagparts[1]}" >> $GITHUB_OUTPUT
fi
# build multiarch image
- name: "Copy docker image: ${{ steps.tags.outputs.target_tag }}"
run: |
docker buildx imagetools create -t ${{ inputs.target_repository }}:${{ steps.tags.outputs.target_tag }} \
${{ inputs.source_repository }}:${{ steps.tags.outputs.source_tag }}-amd64 \
${{ inputs.source_repository }}:${{ steps.tags.outputs.source_tag }}-arm64
10 changes: 3 additions & 7 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ jobs:
- name: "Load PR info"
id: loadinfo
run: |
run_builds="true"
has_docker_image_label="${{ contains(github.event.pull_request.labels.*.name, 'build-docker-image') }}"
run_builds="$has_docker_image_label"
echo "docker image label: $has_docker_image_label"
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
Expand All @@ -48,6 +47,7 @@ jobs:
if [[ ! -z "$manual_tag" ]]; then
has_docker_image_label="true"
branch_name="$manual_tag"
run_builds="true"
fi
if [[ "$branch_name" == "master" ]] || [[ "$branch_name" =~ ^v[0-9] ]]; then
Expand All @@ -60,13 +60,9 @@ jobs:
echo "build_docker=$has_docker_image_label" >> $GITHUB_OUTPUT
echo "docker_tag=$branch_name" >> $GITHUB_OUTPUT
check_source:
name: "Run code checks"
uses: ./.github/workflows/_shared-check.yaml

build_binaries:
name: "Build Dora"
needs: [prinfo, check_source]
needs: [prinfo]
if: ${{ needs.prinfo.outputs.run_builds == 'true' }}
uses: ./.github/workflows/_shared-build.yaml
with:
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:

check_source:
Expand All @@ -32,6 +35,18 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

clone_docker_images:
name: "Copy docker images"
needs: [build_binaries]
uses: ./.github/workflows/_shared-docker-clone.yaml
with:
source_repository: "ethpandaops/dora"
target_repository: "pk910/dora-the-explorer"
tags: "['master:unstable']"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_PK_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_PK_TOKEN }}

create_snapshot_release:
name: Create snapshot release
needs: [build_binaries]
Expand Down Expand Up @@ -101,16 +116,16 @@ jobs:
## Latest automatically built executables. (Unstable development snapshot)
Built from master branch (commit: ${{ github.sha }})
Please read the [wiki](https://github.com/pk910/dora/wiki) for setup / configuration instructions.
Please read the [wiki](https://github.com/ethpandaops/dora/wiki) for setup / configuration instructions.
### Release Artifacts
| Release File | Description |
| ------------- | ------------- |
| [dora_snapshot_windows_amd64.zip](https://github.com/pk910/dora/releases/download/snapshot/dora_snapshot_windows_amd64.zip) | dora executables for windows/amd64 |
| [dora_snapshot_linux_amd64.tar.gz](https://github.com/pk910/dora/releases/download/snapshot/dora_snapshot_linux_amd64.tar.gz) | dora executables for linux/amd64 |
| [dora_snapshot_linux_arm64.tar.gz](https://github.com/pk910/dora/releases/download/snapshot/dora_snapshot_linux_arm64.tar.gz) | dora executables for linux/arm64 |
| [dora_snapshot_darwin_amd64.tar.gz](https://github.com/pk910/dora/releases/download/snapshot/dora_snapshot_darwin_amd64.tar.gz) | dora executable for macos/amd64 |
| [dora_snapshot_darwin_arm64.tar.gz](https://github.com/pk910/dora/releases/download/snapshot/dora_snapshot_darwin_arm64.tar.gz) | dora executable for macos/arm64 |
| [dora_snapshot_windows_amd64.zip](https://github.com/ethpandaops/dora/releases/download/snapshot/dora_snapshot_windows_amd64.zip) | dora executables for windows/amd64 |
| [dora_snapshot_linux_amd64.tar.gz](https://github.com/ethpandaops/dora/releases/download/snapshot/dora_snapshot_linux_amd64.tar.gz) | dora executables for linux/amd64 |
| [dora_snapshot_linux_arm64.tar.gz](https://github.com/ethpandaops/dora/releases/download/snapshot/dora_snapshot_linux_arm64.tar.gz) | dora executables for linux/arm64 |
| [dora_snapshot_darwin_amd64.tar.gz](https://github.com/ethpandaops/dora/releases/download/snapshot/dora_snapshot_darwin_amd64.tar.gz) | dora executable for macos/amd64 |
| [dora_snapshot_darwin_arm64.tar.gz](https://github.com/ethpandaops/dora/releases/download/snapshot/dora_snapshot_darwin_arm64.tar.gz) | dora executable for macos/arm64 |
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
50 changes: 42 additions & 8 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
description: "Version Number ('0.x.y')"
required: true

permissions:
contents: write

jobs:
build_binaries:
name: "Build Dora"
Expand All @@ -22,12 +25,43 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

clone_docker_images:
name: "Copy docker images"
needs: [build_binaries]
uses: ./.github/workflows/_shared-docker-clone.yaml
with:
source_repository: "ethpandaops/dora"
target_repository: "pk910/dora-the-explorer"
tags: "['v${{ inputs.version }}','v${{ inputs.version }}:latest']"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_PK_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_PK_TOKEN }}

create_release:
name: Create Release
needs: [build_binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
ref: ${{ github.sha }}
- name: "Generate release changelog"
id: changelog
run: |
git fetch --tags
prev_tag=$(git tag --sort=-version:refname | grep -e "^v[0-9.]*$" | head -n 1)
echo "previous release: $prev_tag"
if [ "$prev_tag" ]; then
changelog=$(git log --oneline --no-decorate $prev_tag..HEAD)
else
changelog=$(git log --oneline --no-decorate)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo " - ${changelog//$'\n'/$'\n' - }" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# download build artifacts
- name: "Download build artifacts"
uses: actions/download-artifact@v3
Expand All @@ -42,18 +76,18 @@ jobs:
release_name: "v${{ inputs.version }}"
tag_name: "v${{ inputs.version }}"
body: |
### Major Changes
...
### Changes
${{ steps.changelog.outputs.changelog }}
### Release Artifacts
Please read through the [wiki](https://github.com/pk910/dora/wiki) for setup & configuration instructions.
Please read through the [wiki](https://github.com/ethpandaops/dora/wiki) for setup & configuration instructions.
| Release File | Description |
| ------------- | ------------- |
| [dora_${{ inputs.version }}_windows_amd64.zip](https://github.com/pk910/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_windows_amd64.zip) | dora executables for windows/amd64 |
| [dora_${{ inputs.version }}_linux_amd64.tar.gz](https://github.com/pk910/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_linux_amd64.tar.gz) | dora executables for linux/amd64 |
| [dora_${{ inputs.version }}_linux_arm64.tar.gz](https://github.com/pk910/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_linux_arm64.tar.gz) | dora executables for linux/arm64 |
| [dora_${{ inputs.version }}_darwin_amd64.tar.gz](https://github.com/pk910/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_darwin_amd64.tar.gz) | dora executable for macos/amd64 |
| [dora_${{ inputs.version }}_darwin_arm64.tar.gz](https://github.com/pk910/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_darwin_arm64.tar.gz) | dora executable for macos/arm64 |
| [dora_${{ inputs.version }}_windows_amd64.zip](https://github.com/ethpandaops/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_windows_amd64.zip) | dora executables for windows/amd64 |
| [dora_${{ inputs.version }}_linux_amd64.tar.gz](https://github.com/ethpandaops/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_linux_amd64.tar.gz) | dora executables for linux/amd64 |
| [dora_${{ inputs.version }}_linux_arm64.tar.gz](https://github.com/ethpandaops/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_linux_arm64.tar.gz) | dora executables for linux/arm64 |
| [dora_${{ inputs.version }}_darwin_amd64.tar.gz](https://github.com/ethpandaops/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_darwin_amd64.tar.gz) | dora executable for macos/amd64 |
| [dora_${{ inputs.version }}_darwin_arm64.tar.gz](https://github.com/ethpandaops/dora/releases/download/v${{ inputs.version }}/dora_${{ inputs.version }}_darwin_arm64.tar.gz) | dora executable for macos/arm64 |
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

name: Check PR

on:
pull_request:
branches: [ "master" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check_source:
name: "Run code checks"
uses: ./.github/workflows/_shared-check.yaml

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN make build RELEASE=$release GOOS=$TARGETOS GOARCH=$TARGETARCH
# final stage
FROM debian:stable-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
COPY --from=build-env /src/bin /app
EXPOSE 8080
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# final stage
FROM debian:stable-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
COPY bin/* /app
EXPOSE 8080
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
VERSION := $(shell git rev-parse --short HEAD)

GOLDFLAGS += -X 'github.com/pk910/dora/utils.BuildVersion="$(VERSION)"'
GOLDFLAGS += -X 'github.com/pk910/dora/utils.Buildtime="$(BUILDTIME)"'
GOLDFLAGS += -X 'github.com/pk910/dora/utils.BuildRelease="$(RELEASE)"'
GOLDFLAGS += -X 'github.com/ethpandaops/dora/utils.BuildVersion="$(VERSION)"'
GOLDFLAGS += -X 'github.com/ethpandaops/dora/utils.Buildtime="$(BUILDTIME)"'
GOLDFLAGS += -X 'github.com/ethpandaops/dora/utils.BuildRelease="$(RELEASE)"'

.PHONY: all test clean

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Dora the Beaconchain Explorer

[![Badge](https://github.com/pk910/dora/actions/workflows/build-master.yml/badge.svg)](https://github.com/pk910/dora/actions?query=workflow%3A%22Build+master%22)
[![Go Report Card](https://goreportcard.com/badge/github.com/pk910/dora)](https://goreportcard.com/report/github.com/pk910/dora)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/pk910/dora?label=Latest%20Release)](https://github.com/pk910/dora/releases/latest)
[![Badge](https://github.com/ethpandaops/dora/actions/workflows/build-master.yml/badge.svg)](https://github.com/ethpandaops/dora/actions?query=workflow%3A%22Build+master%22)
[![Go Report Card](https://goreportcard.com/badge/github.com/ethpandaops/dora)](https://goreportcard.com/report/github.com/ethpandaops/dora)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/ethpandaops/dora?label=Latest%20Release)](https://github.com/ethpandaops/dora/releases/latest)

## What is this?
This is a lightweight beaconchain explorer.
Expand All @@ -23,7 +23,7 @@ This "lightweight" explorer loads most of the information directly from an under
* https://beaconlight.ephemery.dev/

# Setup & Configuration
Read through the [wiki](https://github.com/pk910/dora/wiki) for setup & configuration instructions.
Read through the [wiki](https://github.com/ethpandaops/dora/wiki) for setup & configuration instructions.

## Dependencies

Expand Down
2 changes: 1 addition & 1 deletion cache/redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/go-redis/redis/v8"

"github.com/pk910/dora/utils"
"github.com/ethpandaops/dora/utils"
)

type RedisCache struct {
Expand Down
2 changes: 1 addition & 1 deletion cache/tiered_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/coocood/freecache"
"github.com/sirupsen/logrus"

"github.com/pk910/dora/utils"
"github.com/ethpandaops/dora/utils"
)

// Tiered cache is a cache implementation combining a local & remote cache
Expand Down
13 changes: 7 additions & 6 deletions cmd/dora-explorer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
logger "github.com/sirupsen/logrus"
"github.com/urfave/negroni"

"github.com/pk910/dora/db"
"github.com/pk910/dora/handlers"
"github.com/pk910/dora/services"
"github.com/pk910/dora/static"
"github.com/pk910/dora/types"
"github.com/pk910/dora/utils"
"github.com/ethpandaops/dora/db"
"github.com/ethpandaops/dora/handlers"
"github.com/ethpandaops/dora/services"
"github.com/ethpandaops/dora/static"
"github.com/ethpandaops/dora/types"
"github.com/ethpandaops/dora/utils"
)

func main() {
Expand Down Expand Up @@ -93,6 +93,7 @@ func startFrontend() {
router.HandleFunc("/search", handlers.Search).Methods("GET")
router.HandleFunc("/search/{type}", handlers.SearchAhead).Methods("GET")
router.HandleFunc("/validators", handlers.Validators).Methods("GET")
router.HandleFunc("/validators/activity", handlers.ValidatorsActivity).Methods("GET")
router.HandleFunc("/validator/{idxOrPubKey}", handlers.Validator).Methods("GET")
router.HandleFunc("/validator/{index}/slots", handlers.ValidatorSlots).Methods("GET")

Expand Down
4 changes: 4 additions & 0 deletions config/holesky.chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615
CAPELLA_FORK_VERSION: 0x04017000
CAPELLA_FORK_EPOCH: 256

# Deneb
DENEB_FORK_VERSION: 0x05017000
DENEB_FORK_EPOCH: 29696

# Time parameters
# ---------------------------------------------------------------
# 12 seconds
Expand Down
7 changes: 7 additions & 0 deletions config/holesky.names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@
1410000-1459999: "stakely"
1460031-1460353: "reth"
1460355-1461031: "reth"
1552771-1562771: "ef_devops"

"withdrawal:0x00000000001d2f94eB88124eEC6E1af72225c52F": "CryptoDevHub"
"withdrawal:0x428614Fb30e3007e5d628D09e8BDB0CE9720FAdB": "Huawei"
"withdrawal:0xF0179dEC45a37423EAD4FaD5fCb136197872EAd9": "Lido"
"withdrawal:0x55fbd2d6643de2e436409b193812bd1ed1c70765": "Obol Network"
"withdrawal:0x0efB35a6D6b14e7F5eEEbAD10A2145A68C99772D": "Frax Finance"
2 changes: 1 addition & 1 deletion config/mainnet.chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CAPELLA_FORK_VERSION: 0x03000000
CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC
# Deneb
DENEB_FORK_VERSION: 0x04000000
DENEB_FORK_EPOCH: 18446744073709551615
DENEB_FORK_EPOCH: 269568 # March 13, 2024, 01:55:35pm UTC
# EIP6110
EIP6110_FORK_VERSION: 0x05000000 # temporary stub
EIP6110_FORK_EPOCH: 18446744073709551615
Expand Down
2 changes: 1 addition & 1 deletion config/prater.chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CAPELLA_FORK_VERSION: 0x03001020
CAPELLA_FORK_EPOCH: 162304
# Sharding
DENEB_FORK_VERSION: 0x04001020
DENEB_FORK_EPOCH: 18446744073709551615
DENEB_FORK_EPOCH: 231680

# Time parameters
# ---------------------------------------------------------------
Expand Down
Loading

0 comments on commit b71aec4

Please sign in to comment.