Skip to content

Commit

Permalink
Merge pull request #833 from gobitfly/staging
Browse files Browse the repository at this point in the history
Merge staging->main
  • Loading branch information
guybrush authored Sep 5, 2024
2 parents 7f30112 + b8d5f4b commit 3bd2ea4
Show file tree
Hide file tree
Showing 71 changed files with 2,282 additions and 1,884 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/backend-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Backend-Integration-Test
on:
push:
paths:
- 'backend/**'
branches:
- main
- staging
pull_request:
paths:
- 'backend/**'
branches:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: read
checks: write

jobs:
build:
name: integration-test
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: 'backend/go.mod'
cache-dependency-path: 'backend/go.sum'
- name: Test with the Go CLI
working-directory: backend
run: go test ./pkg/api/... -config "${{ secrets.CI_CONFIG_PATH }}"



3 changes: 2 additions & 1 deletion backend/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Run() {
dataAccessor = dataaccess.NewDummyService()
} else {
dataAccessor = dataaccess.NewDataAccessService(cfg)
dataAccessor.StartDataAccessServices()
}
defer dataAccessor.Close()

Expand All @@ -70,7 +71,7 @@ func Run() {
router.Use(metrics.HttpMiddleware)
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
47 changes: 47 additions & 0 deletions backend/cmd/archiver/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package archiver

import (
"flag"
"os"

dataaccess "github.com/gobitfly/beaconchain/pkg/api/data_access"

"github.com/gobitfly/beaconchain/pkg/commons/log"
"github.com/gobitfly/beaconchain/pkg/commons/types"
"github.com/gobitfly/beaconchain/pkg/commons/utils"
"github.com/gobitfly/beaconchain/pkg/commons/version"

"github.com/gobitfly/beaconchain/pkg/archiver"
)

func Run() {
fs := flag.NewFlagSet("fs", flag.ExitOnError)
configPath := fs.String("config", "", "Path to the config file, if empty string defaults will be used")
versionFlag := fs.Bool("version", false, "Show version and exit")
_ = fs.Parse(os.Args[2:])

if *versionFlag {
log.Info(version.Version)
log.Info(version.GoVersion)
return
}

cfg := &types.Config{}
err := utils.ReadConfig(cfg, *configPath)
if err != nil {
log.Fatal(err, "error reading config file", 0)
}
utils.Config = cfg

log.InfoWithFields(log.Fields{"config": *configPath, "version": version.Version, "commit": version.GitCommit, "chainName": utils.Config.Chain.ClConfig.ConfigName}, "starting")

dataAccessor := dataaccess.NewDataAccessService(cfg)
defer dataAccessor.Close()

archiver, err := archiver.NewArchiver(dataAccessor)
if err != nil {
log.Fatal(err, "error initializing archiving service", 0)
}
go archiver.Start()
utils.WaitForCtrlC()
}
2 changes: 1 addition & 1 deletion backend/cmd/blobindexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/ethstore_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
3 changes: 3 additions & 0 deletions backend/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/gobitfly/beaconchain/cmd/api"
"github.com/gobitfly/beaconchain/cmd/archiver"
"github.com/gobitfly/beaconchain/cmd/blobindexer"
"github.com/gobitfly/beaconchain/cmd/eth1indexer"
"github.com/gobitfly/beaconchain/cmd/ethstore_exporter"
Expand Down Expand Up @@ -32,6 +33,8 @@ func main() {
switch target {
case "api":
api.Run()
case "archiver":
archiver.Run()
case "blobindexer":
blobindexer.Run()
case "eth1indexer":
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/node_jobs_processor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/notification_collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/notification_sender/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/rewards_exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/signatures/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/statistics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/user_service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Run() {
if utils.Config.Metrics.Enabled {
go func() {
log.Infof("serving metrics on %v", utils.Config.Metrics.Address)
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof); err != nil {
if err := metrics.Serve(utils.Config.Metrics.Address, utils.Config.Metrics.Pprof, utils.Config.Metrics.PprofExtra); err != nil {
log.Fatal(err, "error serving metrics", 0)
}
}()
Expand Down
4 changes: 4 additions & 0 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ require (
github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0
github.com/doug-martin/goqu/v9 v9.19.0
github.com/ethereum/go-ethereum v1.13.12
github.com/fergusstrange/embedded-postgres v1.29.0
github.com/go-faker/faker/v4 v4.3.0
github.com/go-redis/redis/v8 v8.11.5
github.com/gobitfly/eth-rewards v0.1.2-0.20230403064929-411ddc40a5f7
Expand Down Expand Up @@ -61,6 +62,7 @@ require (
github.com/rocket-pool/smartnode v1.13.6
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
github.com/wealdtech/go-ens/v3 v3.6.0
github.com/wealdtech/go-eth2-types/v2 v2.8.2
Expand Down Expand Up @@ -194,6 +196,7 @@ require (
github.com/paulmach/orb v0.10.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.47.0 // indirect
Expand All @@ -220,6 +223,7 @@ require (
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
Expand Down
11 changes: 8 additions & 3 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fergusstrange/embedded-postgres v1.29.0 h1:Uv8hdhoiaNMuH0w8UuGXDHr60VoAQPFdgx7Qf3bzXJM=
github.com/fergusstrange/embedded-postgres v1.29.0/go.mod h1:t/MLs0h9ukYM6FSt99R7InCHs1nW0ordoVCcnzmpTYw=
github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo=
github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
Expand Down Expand Up @@ -840,8 +842,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -852,8 +855,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
Expand Down Expand Up @@ -914,6 +917,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/ydb-platform/ydb-go-genproto v0.0.0-20240126124512-dbb0e1720dbf h1:ckwNHVo4bv2tqNkgx3W3HANh3ta1j6TR5qw08J1A7Tw=
Expand Down
Loading

0 comments on commit 3bd2ea4

Please sign in to comment.