Skip to content

Commit

Permalink
Merge pull request #1 from Layr-Labs/sm-poc
Browse files Browse the repository at this point in the history
Port indexing from blocklake
  • Loading branch information
seanmcgary authored Aug 19, 2024
2 parents 694bb17 + 8ffc7d2 commit 8beadfe
Show file tree
Hide file tree
Showing 98 changed files with 17,671 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: build-container

on: push

jobs:
# test:
# runs-on: ubuntu-24.04
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Go 1.22
# uses: actions/setup-go@v5
# with:
# go-version: 1.22
# - name: Run tests
# run: make ci-test
build:
# needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: "767397703211.dkr.ecr.us-east-1.amazonaws.com"
REPOSITORY: ${{ github.event.repository.name }}
IMAGE_TAG: ${{ github.sha }}
PLATFORMS: "linux/amd64"
run: |
if [[ $GITHUB_REF == refs/heads/master ]]; then
docker buildx build --platform $PLATFORMS -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -t $REGISTRY/$REPOSITORY:latest --push .
else
docker buildx build --platform $PLATFORMS -t $REGISTRY/$REPOSITORY:$IMAGE_TAG --push .
fi
build-mainnet:
# needs: test
if: github.ref == 'refs/heads/master'
environment: "mainnet"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: "471112646628.dkr.ecr.us-east-1.amazonaws.com"
REPOSITORY: ${{ github.event.repository.name }}
IMAGE_TAG: ${{ github.sha }}
PLATFORMS: "linux/amd64"
run: |
if [[ $GITHUB_REF == refs/heads/master ]]; then
docker buildx build --platform $PLATFORMS -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -t $REGISTRY/$REPOSITORY:latest --push .
else
docker buildx build --platform $PLATFORMS -t $REGISTRY/$REPOSITORY:$IMAGE_TAG --push .
fi
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea
*.sw*
*.terraform
*.terraform*
scripts/runLocal/runBackfillBlockIndexerWorker.sh
scripts/runBackfillTransactionLogIndexerWorker.sh
block-lake/preprod-values.yaml
/bin
./block-lake/preprod-values.yaml
/scripts/runLocal
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.22-bullseye as build

RUN apt-get update
RUN apt-get install -y make postgresql-client

RUN mkdir /build

COPY . /build

WORKDIR /build

RUN make deps-linux

RUN make build

# FROM golang:1.22-bullseye as run
#
# RUN apt-get update
# RUN apt-get install -y vim postgresql-client
#
# COPY --from=build /build/bin/cmd /bin
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

.PHONY: deps proto

deps/go:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go get \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
go mod tidy

deps-linux: deps/go
BIN="/usr/local/bin" VERSION="1.32.2" && \
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && \
chmod +x "${BIN}/buf"

deps: deps/go
brew install bufbuild/buf/buf

PROTO_OPTS=--proto_path=protos --go_out=paths=source_relative:protos

proto:
buf generate protos

.PHONY: clean
clean:
rm -rf bin || true

.PHONY: build/cmd/sidecar
build/cmd/sidecar:
go build -o bin/cmd/sidecar cmd/sidecar/main.go

.PHONY: build
build: build/cmd/sidecar

docker-buildx:
docker-buildx build --platform linux/amd64 --push -t 767397703211.dkr.ecr.us-east-1.amazonaws.com/blocklake:$(shell date +%s) -t 767397703211.dkr.ecr.us-east-1.amazonaws.com/blocklake:latest .

.PHONY: test
test:
./scripts/runTests.sh

.PHONY: ci-test
ci-test: deps test
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Sample backfill requests

*Contracts*

```bash
grpcurl -plaintext -d '{
"range": {"from": 1477020, "to": 1477020 }
}' localhost:9999 eigenlayer.blocklake.api.v1.Backfiller/IndexContracts
```
Loading

0 comments on commit 8beadfe

Please sign in to comment.