-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eventindexer): Event indexer (#13439)
Co-authored-by: David <david@taiko.xyz> Co-authored-by: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com>
- Loading branch information
1 parent
8ef5ce2
commit 08b26d2
Showing
43 changed files
with
4,694 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Eventindexer | ||
|
||
on: | ||
push: | ||
branches: [main, alpha-2] | ||
paths: | ||
- "packages/eventindexer/**" | ||
pull_request: | ||
paths: | ||
- "packages/eventindexer/**" | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest | ||
|
||
# Optional: working directory, useful for monorepos | ||
working-directory: ./packages/eventindexer | ||
args: --config=.golangci.yml | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: lint | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.11.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ">=1.19.0" | ||
|
||
- name: eventindexer - Unit Tests | ||
working-directory: ./packages/eventindexer | ||
run: go test `go list ./... | grep -v ./contracts | grep -v ./mock | grep -v ./cmd` -coverprofile=coverage.txt -covermode=atomic | ||
|
||
- name: eventindexer - Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./packages/eventindexer/coverage.txt | ||
flags: eventindexer | ||
|
||
push-docker-image: | ||
# only push docker image on PR merge to main | ||
if: ${{ github.event }} == 'push' | ||
name: Build and push docker image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: gcr.io | ||
username: _json_key | ||
password: ${{ secrets.GCR_JSON_KEY }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
gcr.io/evmchain/eventindexer | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=ref,event=tag | ||
type=sha | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
platforms: linux/amd64 | ||
push: true | ||
context: . | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
PACKAGE=eventindexer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM golang:1.19.3 as builder | ||
|
||
ARG PACKAGE=eventindexer | ||
|
||
RUN apt install git curl | ||
|
||
RUN mkdir /taiko-mono | ||
|
||
WORKDIR /taiko-mono | ||
|
||
COPY . . | ||
|
||
RUN go mod download | ||
|
||
WORKDIR /taiko-mono/packages/$PACKAGE | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o /taiko-mono/packages/$PACKAGE/bin/${PACKAGE} /taiko-mono/packages/$PACKAGE/cmd/main.go | ||
|
||
FROM alpine:latest | ||
|
||
ARG PACKAGE | ||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY --from=builder /taiko-mono/packages/$PACKAGE/bin/$PACKAGE /usr/local/bin/ | ||
|
||
ENTRYPOINT ["$PACKAGE"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
HTTP_PORT=4101 | ||
PROMETHEUS_HTTP_PORT=6061 | ||
MYSQL_USER=root | ||
MYSQL_PASSWORD=root | ||
MYSQL_DATABASE=eventindexer | ||
MYSQL_HOST=localhost:3306 | ||
MYSQL_MAX_IDLE_CONNS=50 | ||
MYSQL_MAX_OPEN_CONNS=3000 | ||
MYSQL_CONN_MAX_LIFETIME_IN_MS=100000 | ||
L1_TAIKO_ADDRESS=0x7B3AF414448ba906f02a1CA307C56c4ADFF27ce7 | ||
L1_RPC_URL=wss://l1ws.a2.taiko.xyz | ||
CORS_ORIGINS=* | ||
BLOCK_BATCH_SIZE=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.netrc | ||
.env | ||
.test.env | ||
main | ||
coverage.txt | ||
|
||
# Local .terraform directories | ||
.terraform | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sentitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
# | ||
*.tfvars | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
.idea | ||
|
||
Bridge.json | ||
TaikoL2.json | ||
IHeaderSync.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# See: https://golangci-lint.run/usage/configuration/ | ||
# | ||
# Note: for VSCode, you must have the following settings to use this configuration: | ||
# | ||
# "go.lintTool": "golangci-lint", | ||
# "go.lintFlags": [ | ||
# "--fast", | ||
# "--config=${workspaceFolder}/.golangci.yml" | ||
# ], | ||
|
||
output: | ||
format: colored-line-number | ||
|
||
linters: | ||
enable: | ||
- errcheck | ||
- funlen | ||
- gocognit | ||
- gocritic | ||
- gofmt | ||
- golint | ||
- gosec | ||
- gosimple | ||
- lll | ||
- unused | ||
- whitespace | ||
- wsl | ||
|
||
linters-settings: | ||
funlen: | ||
lines: 137 | ||
statements: 54 | ||
gocognit: | ||
min-complexity: 43 | ||
|
||
issues: | ||
exclude-rules: | ||
# Exclude some linters from running on tests files. | ||
- path: _test\.go | ||
linters: | ||
- funlen | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.