Skip to content

Commit

Permalink
Merge branch 'master' into BIDS-2428/fixEmailChange
Browse files Browse the repository at this point in the history
# Conflicts:
#	Makefile
  • Loading branch information
LuccaBitfly committed Nov 14, 2023
2 parents 0bb122d + 753518a commit 53d4a2d
Show file tree
Hide file tree
Showing 166 changed files with 11,849 additions and 5,461 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish-dencun-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Docker dencun images

on:
# Trigger the workflow on push or pull request,
# but only for the staging branch
push:
branches:
- dencun

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish to Dockerhub Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: gobitfly/eth2-beaconchain-explorer
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "dencun"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The dockerfile is currently still WIP and might be broken
FROM golang:1.20 AS build-env
FROM golang:1.20.8 AS build-env
COPY go.mod go.sum /src/
WORKDIR /src
RUN go mod download
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BUILDDATE=`date -u +"%Y-%m-%dT%H:%M:%S%:z"`
PACKAGE=eth2-exporter
LDFLAGS="-X ${PACKAGE}/version.Version=${VERSION} -X ${PACKAGE}/version.BuildDate=${BUILDDATE} -X ${PACKAGE}/version.GitCommit=${GITCOMMIT} -X ${PACKAGE}/version.GitDate=${GITDATE} -s -w"
all: explorer stats frontend-data-updater eth1indexer ethstore-exporter rewards-exporter node-jobs-processor signatures notification-sender notification-collector user-service misc
all: explorer stats frontend-data-updater eth1indexer blobindexer ethstore-exporter rewards-exporter node-jobs-processor signatures notification-sender notification-collector user-service misc
lint:
golint ./...
Expand Down Expand Up @@ -35,6 +35,9 @@ rewards-exporter:
eth1indexer:
go build --ldflags=${LDFLAGS} -o bin/eth1indexer cmd/eth1indexer/main.go
blobindexer:
go build --ldflags=${LDFLAGS} -o bin/blobindexer cmd/blobindexer/blobindexer.go
node-jobs-processor:
go build --ldflags=${LDFLAGS} -o bin/node-jobs-processor cmd/node-jobs-processor/main.go
Expand Down Expand Up @@ -62,4 +65,4 @@ playground:
go build --ldflags=${LDFLAGS} -o bin/fix_eth2_deposit_validity cmd/playground/fix_eth2_deposit_validity/main.go
addhooks:
git config core.hooksPath hooks
git config core.hooksPath hooks
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The explorer is built using golang and utilizes a PostgreSQL database for storin
### Ethereum Testnet Explorers

[Goerli](https://goerli.beaconcha.in)<br>
[Sepolia](https://sepolia.beaconcha.in)
[Sepolia](https://sepolia.beaconcha.in)<br>
[Holesky](https://holesky.beaconcha.in)

**Warning:** The explorer is still under heavy active development. More or less everything might change without prior notice and we cannot guarantee any backwards compatibility for now. Once the Ethereum ecosystem matures we will be able to provide stronger guarantees about the updatability of the explorer.

Expand Down
33 changes: 33 additions & 0 deletions cmd/blobindexer/blobindexer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"eth2-exporter/exporter"
"eth2-exporter/types"
"eth2-exporter/utils"
"eth2-exporter/version"
"flag"
"fmt"

"github.com/sirupsen/logrus"
)

func main() {
configFlag := flag.String("config", "config.yml", "path to config")
versionFlag := flag.Bool("version", false, "print version and exit")
flag.Parse()
if *versionFlag {
fmt.Println(version.Version)
return
}
utils.Config = &types.Config{}
err := utils.ReadConfig(utils.Config, *configFlag)
if err != nil {
logrus.Fatal(err)
}
blobIndexer, err := exporter.NewBlobIndexer()
if err != nil {
logrus.Fatal(err)
}
go blobIndexer.Start()
utils.WaitForCtrlC()
}
6 changes: 4 additions & 2 deletions cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func main() {

if *versionFlag {
fmt.Println(version.Version)
fmt.Println(version.GoVersion)
return
}

Expand All @@ -83,7 +84,7 @@ func main() {
logrus.Fatalf("error reading config file: %v", err)
}
utils.Config = cfg
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.Config.ConfigName).Printf("starting")
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.ClConfig.ConfigName).Printf("starting")

// enable pprof endpoint if requested
if utils.Config.Pprof.Enabled {
Expand Down Expand Up @@ -131,7 +132,7 @@ func main() {
utils.LogFatal(err, "erigon client creation error", 0)
}

chainId := strconv.FormatUint(utils.Config.Chain.Config.DepositChainID, 10)
chainId := strconv.FormatUint(utils.Config.Chain.ClConfig.DepositChainID, 10)

balanceUpdaterPrefix := chainId + ":B:"

Expand Down Expand Up @@ -207,6 +208,7 @@ func main() {
bt.TransformBlock,
bt.TransformTx,
bt.TransformItx,
bt.TransformBlobTx,
bt.TransformERC20,
bt.TransformERC721,
bt.TransformERC1155,
Expand Down
3 changes: 2 additions & 1 deletion cmd/ethstore-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func main() {

if *versionFlag {
fmt.Println(version.Version)
fmt.Println(version.GoVersion)
return
}

Expand All @@ -38,7 +39,7 @@ func main() {
logrus.Fatalf("error reading config file: %v", err)
}
utils.Config = cfg
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.Config.ConfigName).Printf("starting")
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.ClConfig.ConfigName).Printf("starting")

db.MustInitDB(&types.DatabaseConfig{
Username: cfg.WriterDatabase.Username,
Expand Down
44 changes: 11 additions & 33 deletions cmd/explorer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func main() {

if *versionFlag {
fmt.Println(version.Version)
fmt.Println(version.GoVersion)
return
}

Expand All @@ -74,9 +75,9 @@ func main() {
logrus.WithFields(logrus.Fields{
"config": *configPath,
"version": version.Version,
"chainName": utils.Config.Chain.Config.ConfigName}).Printf("starting")
"chainName": utils.Config.Chain.ClConfig.ConfigName}).Printf("starting")

if utils.Config.Chain.Config.SlotsPerEpoch == 0 || utils.Config.Chain.Config.SecondsPerSlot == 0 {
if utils.Config.Chain.ClConfig.SlotsPerEpoch == 0 || utils.Config.Chain.ClConfig.SecondsPerSlot == 0 {
utils.LogFatal(err, "invalid chain configuration specified, you must specify the slots per epoch, seconds per slot and genesis timestamp in the config file", 0)
}

Expand Down Expand Up @@ -159,15 +160,15 @@ func main() {
logrus.Fatalf("error retrieving geth chain id: %v", err)
}

if !(erigonChainId.String() == gethChainId.String() && erigonChainId.String() == fmt.Sprintf("%d", utils.Config.Chain.Config.DepositChainID)) {
logrus.Fatalf("chain id mismatch: erigon chain id %v, geth chain id %v, requested chain id %v", erigonChainId.String(), gethChainId.String(), fmt.Sprintf("%d", utils.Config.Chain.Config.DepositChainID))
if !(erigonChainId.String() == gethChainId.String() && erigonChainId.String() == fmt.Sprintf("%d", utils.Config.Chain.ClConfig.DepositChainID)) {
logrus.Fatalf("chain id mismatch: erigon chain id %v, geth chain id %v, requested chain id %v", erigonChainId.String(), gethChainId.String(), fmt.Sprintf("%d", utils.Config.Chain.ClConfig.DepositChainID))
}
}()

wg.Add(1)
go func() {
defer wg.Done()
bt, err := db.InitBigtable(utils.Config.Bigtable.Project, utils.Config.Bigtable.Instance, fmt.Sprintf("%d", utils.Config.Chain.Config.DepositChainID), utils.Config.RedisCacheEndpoint)
bt, err := db.InitBigtable(utils.Config.Bigtable.Project, utils.Config.Bigtable.Instance, fmt.Sprintf("%d", utils.Config.Chain.ClConfig.DepositChainID), utils.Config.RedisCacheEndpoint)
if err != nil {
logrus.Fatalf("error connecting to bigtable: %v", err)
}
Expand Down Expand Up @@ -222,7 +223,7 @@ func main() {
if utils.Config.Indexer.Enabled {
var rpcClient rpc.Client

chainID := new(big.Int).SetUint64(utils.Config.Chain.Config.DepositChainID)
chainID := new(big.Int).SetUint64(utils.Config.Chain.ClConfig.DepositChainID)
if utils.Config.Indexer.Node.Type == "lighthouse" {
rpcClient, err = rpc.NewLighthouseClient("http://"+cfg.Indexer.Node.Host+":"+cfg.Indexer.Node.Port, chainID)
if err != nil {
Expand All @@ -232,27 +233,6 @@ func main() {
logrus.Fatalf("invalid note type %v specified. supported node types are prysm and lighthouse", utils.Config.Indexer.Node.Type)
}

if utils.Config.Indexer.OneTimeExport.Enabled {
if len(utils.Config.Indexer.OneTimeExport.Epochs) > 0 {
logrus.Infof("onetimeexport epochs: %+v", utils.Config.Indexer.OneTimeExport.Epochs)
for _, epoch := range utils.Config.Indexer.OneTimeExport.Epochs {
err := exporter.ExportEpoch(epoch, rpcClient)
if err != nil {
utils.LogFatal(err, "exporting OneTimeExport epochs error", 0)
}
}
} else {
logrus.Infof("onetimeexport epochs: %v-%v", utils.Config.Indexer.OneTimeExport.StartEpoch, utils.Config.Indexer.OneTimeExport.EndEpoch)
for epoch := utils.Config.Indexer.OneTimeExport.StartEpoch; epoch <= utils.Config.Indexer.OneTimeExport.EndEpoch; epoch++ {
err := exporter.ExportEpoch(epoch, rpcClient)
if err != nil {
utils.LogFatal(err, "exporting OneTimeExport start to end epoch error", 0)
}
}
}
return
}

go services.StartHistoricPriceService()
go exporter.Start(rpcClient)
}
Expand Down Expand Up @@ -331,11 +311,7 @@ func main() {
apiV1Router.HandleFunc("/execution/{addressIndexOrPubkey}/produced", handlers.ApiETH1AccountProducedBlocks).Methods("GET", "OPTIONS")

apiV1Router.HandleFunc("/execution/address/{address}", handlers.ApiEth1Address).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/transactions", handlers.ApiEth1AddressTx).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/internalTx", handlers.ApiEth1AddressItx).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/blocks", handlers.ApiEth1AddressBlocks).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/uncles", handlers.ApiEth1AddressUncles).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/tokens", handlers.ApiEth1AddressTokens).Methods("GET", "OPTIONS")
apiV1Router.HandleFunc("/execution/address/{address}/erc20tokens", handlers.ApiEth1AddressERC20Tokens).Methods("GET", "OPTIONS")

apiV1Router.HandleFunc("/validator/{indexOrPubkey}/widget", handlers.GetMobileWidgetStatsGet).Methods("GET")
apiV1Router.HandleFunc("/dashboard/widget", handlers.GetMobileWidgetStatsPost).Methods("POST")
Expand Down Expand Up @@ -368,7 +344,8 @@ func main() {
router.HandleFunc("/api/healthz-loadbalancer", handlers.ApiHealthzLoadbalancer).Methods("GET", "HEAD")

logrus.Infof("initializing prices")
price.Init(utils.Config.Chain.Config.DepositChainID, utils.Config.Eth1ErigonEndpoint)
price.Init(utils.Config.Chain.ClConfig.DepositChainID, utils.Config.Eth1ErigonEndpoint, utils.Config.Frontend.ClCurrency, utils.Config.Frontend.ElCurrency)

logrus.Infof("prices initialized")
if !utils.Config.Frontend.Debug {
logrus.Infof("initializing ethclients")
Expand Down Expand Up @@ -421,6 +398,7 @@ func main() {
router.HandleFunc("/address/{address}/withdrawals", handlers.Eth1AddressWithdrawals).Methods("GET")
router.HandleFunc("/address/{address}/transactions", handlers.Eth1AddressTransactions).Methods("GET")
router.HandleFunc("/address/{address}/internalTxns", handlers.Eth1AddressInternalTransactions).Methods("GET")
router.HandleFunc("/address/{address}/blobTxns", handlers.Eth1AddressBlobTransactions).Methods("GET")
router.HandleFunc("/address/{address}/erc20", handlers.Eth1AddressErc20Transactions).Methods("GET")
router.HandleFunc("/address/{address}/erc721", handlers.Eth1AddressErc721Transactions).Methods("GET")
router.HandleFunc("/address/{address}/erc1155", handlers.Eth1AddressErc1155Transactions).Methods("GET")
Expand Down
13 changes: 9 additions & 4 deletions cmd/frontend-data-updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"eth2-exporter/cache"
"eth2-exporter/db"
"eth2-exporter/price"
"eth2-exporter/rpc"
"eth2-exporter/services"
"eth2-exporter/types"
Expand All @@ -21,11 +22,12 @@ import (

func main() {
configPath := flag.String("config", "", "Path to the config file, if empty string defaults will be used")
versionFlag := flag.Bool("version", false, "Show version and exit")
versionFlag := flag.Bool("version", false, "Print version and exit")
flag.Parse()

if *versionFlag {
fmt.Println(version.Version)
fmt.Println(version.GoVersion)
return
}

Expand All @@ -35,7 +37,7 @@ func main() {
logrus.Fatalf("error reading config file: %v", err)
}
utils.Config = cfg
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.Config.ConfigName).Printf("starting")
logrus.WithField("config", *configPath).WithField("version", version.Version).WithField("chainName", utils.Config.Chain.ClConfig.ConfigName).Printf("starting")

// enable pprof endpoint if requested
if utils.Config.Pprof.Enabled {
Expand All @@ -45,7 +47,7 @@ func main() {
}()
}

_, err = db.InitBigtable(cfg.Bigtable.Project, cfg.Bigtable.Instance, fmt.Sprintf("%d", utils.Config.Chain.Config.DepositChainID), utils.Config.RedisCacheEndpoint)
_, err = db.InitBigtable(cfg.Bigtable.Project, cfg.Bigtable.Instance, fmt.Sprintf("%d", utils.Config.Chain.ClConfig.DepositChainID), utils.Config.RedisCacheEndpoint)
if err != nil {
logrus.Fatalf("error initializing bigtable %v", err)
}
Expand Down Expand Up @@ -78,7 +80,10 @@ func main() {
logrus.Fatalf("No cache provider set. Please set TierdCacheProvider (example redis, bigtable)")
}

chainID := new(big.Int).SetUint64(utils.Config.Chain.Config.DepositChainID)
logrus.Infof("initializing prices")
price.Init(utils.Config.Chain.ClConfig.DepositChainID, utils.Config.Eth1ErigonEndpoint, utils.Config.Frontend.ClCurrency, utils.Config.Frontend.ElCurrency)

chainID := new(big.Int).SetUint64(utils.Config.Chain.ClConfig.DepositChainID)
rpcClient, err := rpc.NewLighthouseClient("http://"+cfg.Indexer.Node.Host+":"+cfg.Indexer.Node.Port, chainID)
if err != nil {
utils.LogFatal(err, "new explorer lighthouse client error", 0)
Expand Down
Loading

0 comments on commit 53d4a2d

Please sign in to comment.