Skip to content

Commit

Permalink
feat: update the director
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehao committed Dec 14, 2023
1 parent 2f7e329 commit 99cd99d
Show file tree
Hide file tree
Showing 17 changed files with 892 additions and 611 deletions.
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
.PHONY: fmt dev_docker build_test_docker run_test_docker clean
.PHONY: fmt dev_docker build_test_docker run_test_docker clean update

L2GETH_TAG=scroll-v5.1.6

help: ## Display this help message
@grep -h \
-E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
update:
go work sync
cd $(PWD)/bridge-history-api/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/common/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG}&& go mod tidy
cd $(PWD)/coordinator/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/database/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/prover/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG}&& go mod tidy
cd $(PWD)/rollup/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/tests/integration-test/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy

lint: ## The code's format and security checks.
make -C rollup lint
Expand All @@ -17,13 +26,13 @@ lint: ## The code's format and security checks.

fmt: ## format the code
go work sync
cd $(PWD)/bridge-history-api/ && go get -u github.com/ethereum/go-ethereum@latest && go mod tidy
cd $(PWD)/common/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/coordinator/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/database/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/prover/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/rollup/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/tests/integration-test/ && go get -u github.com/scroll-tech/go-ethereum@${L2GETH_TAG} && go mod tidy
cd $(PWD)/bridge-history-api/ && go mod tidy
cd $(PWD)/common/ && go mod tidy
cd $(PWD)/coordinator/ && go mod tidy
cd $(PWD)/database/ && go mod tidy
cd $(PWD)/prover/ && go mod tidy
cd $(PWD)/rollup/ && go mod tidy
cd $(PWD)/tests/integration-test/ && go mod tidy

goimports -local $(PWD)/bridge-history-api/ -w .
goimports -local $(PWD)/common/ -w .
Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ reset-env:
bridgehistoryapi-docker:
DOCKER_BUILDKIT=1 docker build -t scrolltech/bridgehistoryapi-fetcher:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/bridgehistoryapi-fetcher.Dockerfile
DOCKER_BUILDKIT=1 docker build -t scrolltech/bridgehistoryapi-api:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/bridgehistoryapi-api.Dockerfile
DOCKER_BUILDKIT=1 docker build -t scrolltech/bridgehistoryapi-db-cli:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/bridgehistoryapi-db-cli.Dockerfile
DOCKER_BUILDKIT=1 docker build -t scrolltech/bridgehistoryapi-db-cli:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/bridgehistoryapi-db-cli.Dockerfile
8 changes: 3 additions & 5 deletions bridge-history-api/cmd/api/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import (
"scroll-tech/bridge-history-api/internal/route"
)

var (
app *cli.App
)
var app *cli.App

func init() {
app = cli.NewApp()
Expand Down Expand Up @@ -54,12 +52,12 @@ func action(ctx *cli.Context) error {
log.Error("failed to close db", "err", err)
}
}()
redis := redis.NewClient(&redis.Options{
redisClient := redis.NewClient(&redis.Options{
Addr: cfg.Redis.Address,
Password: cfg.Redis.Password,
DB: cfg.Redis.DB,
})
api.InitController(db, redis)
api.InitController(db, redisClient)

router := gin.Default()
registry := prometheus.DefaultRegisterer
Expand Down
9 changes: 4 additions & 5 deletions bridge-history-api/cmd/db_cli/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import (
"scroll-tech/common/utils"
)

var (
// Set up database app info.
app *cli.App
)
// Set up database app info.
var app *cli.App

func init() {
app = cli.NewApp()
Expand Down Expand Up @@ -60,7 +58,8 @@ func init() {
Name: "version",
Usage: "Rollback to the specified version.",
Value: 0,
}},
},
},
},
}
}
Expand Down
7 changes: 4 additions & 3 deletions bridge-history-api/cmd/fetcher/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import (
"github.com/urfave/cli/v2"

"scroll-tech/common/database"
"scroll-tech/common/observability"
"scroll-tech/common/utils"

"scroll-tech/bridge-history-api/internal/config"
"scroll-tech/bridge-history-api/internal/controller/fetcher"
)

var (
app *cli.App
)
var app *cli.App

func init() {
app = cli.NewApp()
Expand Down Expand Up @@ -67,6 +66,8 @@ func action(ctx *cli.Context) error {
log.Crit("failed to connect to db", "config file", cfgFile, "error", err)
}

observability.Server(ctx, db)

// syncInfo is used to store the shared info between L1 fetcher and L2 fetcher, e.g., the sync height.
syncInfo := &fetcher.SyncInfo{}

Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
"password": "",
"db": 0
}
}
}
Loading

0 comments on commit 99cd99d

Please sign in to comment.