Skip to content

Commit

Permalink
Merge branch 'staging' into BEDS-151/Add_RP_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisei24 committed Oct 28, 2024
2 parents 764dd89 + 7192f4a commit fdec921
Show file tree
Hide file tree
Showing 229 changed files with 22,309 additions and 11,001 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# in order to work execute once:
# git config blame.ignoreRevsFile .git-blame-ignore-revs

#chore(eslint): add `natural sorting` for `json` files
f3da99c5c685eae1914aad8513d3b4b2f1cdcaa2
# style(eslint): add `typescript delimiter` rule
d6b42edb3f687cad3082a9044bcb71fc39a46176
# style(eslint): apply `max-len` rule
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/backend-converted-types-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Backend-Converted-Types-Check
on:
push:
paths:
- 'backend/pkg/api/types/**'
- 'frontend/types/api/**'
branches:
- main
- staging
pull_request:
paths:
- 'backend/pkg/api/types/**'
- 'frontend/types/api/**'
branches:
- '*'

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

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

jobs:
build:
name: converted-types-check
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: Check if all backend-types have been converted to frontend-types
working-directory: backend
run: |
currHash=$(find ../frontend/types/api -type f -print0 | sort -z | xargs -0 sha1sum | sha256sum | head -c 64)
make frontend-types
newHash=$(find ../frontend/types/api -type f -print0 | sort -z | xargs -0 sha1sum | sha256sum | head -c 64)
if [ "$currHash" != "$newHash" ]; then
echo "frontend-types have changed, please commit the changes"
exit 1
fi
4 changes: 3 additions & 1 deletion .github/workflows/backend-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
cache-dependency-path: 'backend/go.sum'
- name: Test with the Go CLI
working-directory: backend
run: go test -failfast ./pkg/api/... -config "${{ secrets.CI_CONFIG_PATH }}"
run:
go install github.com/swaggo/swag/cmd/swag@latest && swag init --ot json -o ./pkg/api/docs -d ./pkg/api/ -g ./handlers/public.go
go test -failfast ./pkg/api/... -config "${{ secrets.CI_CONFIG_PATH }}"



3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ local_deployment/config.yml
local_deployment/elconfig.json
local_deployment/.env
__gitignore
cmd/playground
cmd/playground
pkg/api/docs/swagger.json
2 changes: 1 addition & 1 deletion backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
all:
mkdir -p bin
go install github.com/swaggo/swag/cmd/swag@latest && swag init --ot json -o ./pkg/api/docs -d ./pkg/api/ -g ./handlers/public.go
CGO_CFLAGS=${CGO_CFLAGS} CGO_CFLAGS_ALLOW=${CGO_CFLAGS_ALLOW} go build --ldflags=${LDFLAGS} -o ./bin/bc ./cmd/main.go
clean:
rm -rf bin
Expand Down
9 changes: 6 additions & 3 deletions backend/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ func Run() {
if dummyApi {
dataAccessor = dataaccess.NewDummyService()
} else {
dataAccessor = dataaccess.NewDataAccessService(cfg)
dataAccessor.StartDataAccessServices()
service := dataaccess.NewDataAccessService(cfg)
service.StartDataAccessServices()
dataAccessor = service
}
defer dataAccessor.Close()

router := api.NewApiRouter(dataAccessor, cfg)
dummy := dataaccess.NewDummyService()

router := api.NewApiRouter(dataAccessor, dummy, cfg)
router.Use(api.GetCorsMiddleware(cfg.CorsAllowedHosts))

if utils.Config.Metrics.Enabled {
Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/blobindexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func Run() {
fs := flag.NewFlagSet("fs", flag.ExitOnError)

configFlag := fs.String("config", "config.yml", "path to config")
configFlag := fs.String("config", "", "path to config")
versionFlag := fs.Bool("version", false, "print version and exit")
_ = fs.Parse(os.Args[2:])
if *versionFlag {
Expand Down
25 changes: 17 additions & 8 deletions backend/cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func Run() {
}()
}

if *enableEnsUpdater {
go ImportEnsUpdatesLoop(bt, client, *ensBatchSize)
}

if *enableFullBalanceUpdater {
ProcessMetadataUpdates(bt, client, balanceUpdaterPrefix, *balanceUpdaterBatchSize, -1)
return
Expand Down Expand Up @@ -375,21 +379,26 @@ func Run() {
ProcessMetadataUpdates(bt, client, balanceUpdaterPrefix, *balanceUpdaterBatchSize, 10)
}

if *enableEnsUpdater {
err := bt.ImportEnsUpdates(client.GetNativeClient(), *ensBatchSize)
if err != nil {
log.Error(err, "error importing ens updates", 0, nil)
continue
}
}

log.Infof("index run completed")
services.ReportStatus("eth1indexer", "Running", nil)
}

// utils.WaitForCtrlC()
}

func ImportEnsUpdatesLoop(bt *db.Bigtable, client *rpc.ErigonClient, batchSize int64) {
time.Sleep(time.Second * 5)
for {
err := bt.ImportEnsUpdates(client.GetNativeClient(), batchSize)
if err != nil {
log.Error(err, "error importing ens updates", 0, nil)
} else {
services.ReportStatus("ensIndexer", "Running", nil)
}
time.Sleep(time.Second * 5)
}
}

func UpdateTokenPrices(bt *db.Bigtable, client *rpc.ErigonClient, tokenListPath string) error {
tokenListContent, err := os.ReadFile(tokenListPath)
if err != nil {
Expand Down
Loading

0 comments on commit fdec921

Please sign in to comment.