Skip to content

Commit

Permalink
feat: Docker support, doc updates, & regression fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
epociask committed May 22, 2024
1 parent 3fb8d8e commit 02fa3d8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
- name: Run Unit Tests
id: unit
run: |
make submodules &&
make srs &&
make test
gosec:
Expand Down
35 changes: 29 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
ARG OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack-go:latest
FROM $OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go
# multi container builds ftw

FROM alpine:3.18
FROM golang:1.21.10-alpine3.19 as builder

COPY --from=builder /usr/local/bin/da-server /usr/local/bin/da-server
RUN apk add --no-cache make gcc musl-dev linux-headers jq bash git

CMD ["da-server"]
# Set the working directory inside the container
WORKDIR /app

# Copy go.mod and go.sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

# Copy the rest of the application code
COPY . .

# Build the application binary
RUN make da-server

# Use alpine to run app
FROM alpine:3.16

WORKDIR /app
COPY --from=builder /app/bin/da-server .

# API & metrics servers
EXPOSE 4242 7300

# Run app
CMD ["./da-server"]
5 changes: 0 additions & 5 deletions Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
*

!/op-bindings
!/op-service
!/op-plasma
!/go.mod
!/go.sum
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
APP_NAME = eigenda-sidecar
LINTER_VERSION = v1.52.1
LINTER_URL = https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
GET_LINT_CMD = "curl -sSfL $(LINTER_URL) | sh -s -- -b $(go env GOPATH)/bin $(LINTER_VERSION)"
Expand All @@ -11,9 +12,14 @@ LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

.PHONY: da-server
da-server:
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/da-server ./cmd/daserver

.PHONY: docker-build
docker-build:
@docker build -t $(APP_NAME) .

run-server:
./bin/da-server

Expand Down Expand Up @@ -45,7 +51,6 @@ gosec:
submodules:
git submodule update --init --recursive


srs:
if ! test -f /operator-setup/resources/g1.point; then \
cd operator-setup && ./srs_setup.sh; \
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# EigenDA Plasma DA Server
# EigenDA Sidecar Proxy

## Introduction
This simple DA server implementation supports ephemeral storage via EigenDA.
This simple DA server implementation is a side-car communication relay between different rollup frameworks and EigenDA. This allows us to keep existing protocol functions (i.e, batch submission, state derivation) lightweight in respect to modification since the server handles key security and data operations like:
* blob submission/retrieval to EigenDA
* data <--> blob encoding/decoding
* tamper resistance assurance (i.e, cryptographic verification of retrieved blobs)

This allows for deduplication of redundant logical flows into a single representation which can be used cross functionally across rollups.

## EigenDA Configuration
Additional cli args are provided for targeting an EigenDA network backend:
Expand All @@ -22,7 +27,10 @@ An env file can be provided to the binary for runtime process ingestion; e.g:
1. Create env: `cp .env.example .env`
2. Pass into binary: `ENV_PATH=.env ./bin/da-server`

### Commitment Schemas
## Running via Docker
Container can be built via running `make build-docker`.

## Commitment Schemas
An `EigenDACommitment` layer type has been added that supports verification against its respective pre-images. The commitment is encoded via the following byte array:
```
0 1 2 3 4 N
Expand Down Expand Up @@ -52,7 +60,7 @@ Some unit tests have been introduced to assert the correctness of:

Unit tests can be ran via `make test`.

Otherwise E2E tests (`test/e2e_test.go`) exists which asserts that a commitment can be generated when inserting some arbitrary data to the server and can be read using the commitment for a key lookup via the client. These can be ran via `make e2e-test`. Please **note** that this test uses the EigenDA Holesky network which is subject to rate-limiting and slow confirmation times *(i.e, >10 minutes per blob confirmation)*. Please advise EigenDA's [inabox](https://github.com/Layr-Labs/eigenda/tree/master/inabox#readme) if you'd like to spin-up a local DA network for quicker iteration testing.
Otherwise E2E tests (`test/e2e_test.go`) exists which asserts that a commitment can be generated when inserting some arbitrary data to the server and can be read using the commitment for a key lookup via the client. These can be ran via `make e2e-test`. Please **note** that this test uses the EigenDA Holesky network which is subject to rate-limiting and slow confirmation times *(i.e, >10 minutes per blob confirmation)*. Please advise EigenDA's [inabox](https://github.com/Layr-Labs/eigenda/tree/master/inabox#readme) if you'd like to spin-up a local DA network for faster iteration testing.


## Downloading Mainnet SRS
Expand Down
10 changes: 5 additions & 5 deletions verify/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ func TestVerification(t *testing.T) {

var data = []byte("inter-subjective and not objective!")

x, err := hex.DecodeString("0b187c5351919a9bf83271637be3bcb7b8bbb0abe0b80bb9d632ad8f6e8401e5")
x, err := hex.DecodeString("0184B47F64FBA17D6F49CDFED20434B1015A2A369AB203256EC4CD00C324E83B")
assert.NoError(t, err)

y, err := hex.DecodeString("0d41ee143f13cc2526d36189a22538f630ea31398e0af32b5877728c8fe5452e")
y, err := hex.DecodeString("122CD859CC5CDD048B482C50721821CB413C151BA7AF10285C1D2483F2A88085")
assert.NoError(t, err)

c := eigenda.Cert{
Expand All @@ -29,9 +29,9 @@ func TestVerification(t *testing.T) {
}

kzgConfig := &kzg.KzgConfig{
G1Path: "../operator-setup/resources/g1.point",
G2PowerOf2Path: "../operator-setup/resources/g2.point.powerOf2",
CacheDir: "../operator-setup/resources/SRSTables",
G1Path: "../test/resources/g1.point",
G2PowerOf2Path: "../test/resources/g2.point.powerOf2",
CacheDir: "../test/resources/SRSTables",
SRSOrder: 3000,
SRSNumberToLoad: 3000,
NumWorker: uint64(runtime.GOMAXPROCS(0)),
Expand Down

0 comments on commit 02fa3d8

Please sign in to comment.