diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 9a6e68c..30433de 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -40,8 +40,6 @@ jobs: - name: Run Unit Tests id: unit run: | - make submodules && - make srs && make test gosec: diff --git a/Dockerfile b/Dockerfile index 122e8b0..0096991 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/Dockerfile.dockerignore b/Dockerfile.dockerignore index f7f3fc9..2c9b852 100644 --- a/Dockerfile.dockerignore +++ b/Dockerfile.dockerignore @@ -1,7 +1,2 @@ -* - -!/op-bindings -!/op-service -!/op-plasma !/go.mod !/go.sum diff --git a/Makefile b/Makefile index 9e593e2..200e6e8 100644 --- a/Makefile +++ b/Makefile @@ -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)" @@ -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 @@ -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; \ diff --git a/README.md b/README.md index 319618a..6c5ae25 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 @@ -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 diff --git a/verify/verify_test.go b/verify/verify_test.go index bdd033a..a6e0a8c 100644 --- a/verify/verify_test.go +++ b/verify/verify_test.go @@ -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{ @@ -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)),