From 5afe8d5a7145a9f0ffe2eee243c5a477265da721 Mon Sep 17 00:00:00 2001 From: Jian Xiao Date: Fri, 1 Mar 2024 02:49:10 +0000 Subject: [PATCH 1/3] Create an operators folder for churnern and ejector --- inabox/deploy/codegen/main.go | 6 +++--- node/cmd/Dockerfile | 4 ++-- node/operator.go | 2 +- node/plugin/cmd/Dockerfile | 2 +- {churner => operators/churner}/Makefile | 0 {churner => operators/churner}/churner.go | 0 {churner => operators/churner}/churner_test.go | 2 +- {churner => operators/churner}/cmd/Dockerfile | 6 +++--- {churner => operators/churner}/cmd/main.go | 4 ++-- {churner => operators/churner}/config.go | 2 +- {churner => operators/churner}/flags/flags.go | 0 {churner => operators/churner}/metrics.go | 0 {churner => operators/churner}/server.go | 0 {churner => operators/churner}/server_test.go | 2 +- {churner => operators/churner}/tests/churner_test.go | 4 ++-- 15 files changed, 17 insertions(+), 17 deletions(-) rename {churner => operators/churner}/Makefile (100%) rename {churner => operators/churner}/churner.go (100%) rename {churner => operators/churner}/churner_test.go (98%) rename {churner => operators/churner}/cmd/Dockerfile (78%) rename {churner => operators/churner}/cmd/main.go (96%) rename {churner => operators/churner}/config.go (95%) rename {churner => operators/churner}/flags/flags.go (100%) rename {churner => operators/churner}/metrics.go (100%) rename {churner => operators/churner}/server.go (100%) rename {churner => operators/churner}/server_test.go (99%) rename {churner => operators/churner}/tests/churner_test.go (98%) diff --git a/inabox/deploy/codegen/main.go b/inabox/deploy/codegen/main.go index 1781069d02..d08db2fe47 100644 --- a/inabox/deploy/codegen/main.go +++ b/inabox/deploy/codegen/main.go @@ -7,11 +7,11 @@ import ( "os" "text/template" - churner "github.com/Layr-Labs/eigenda/churner/flags" dis "github.com/Layr-Labs/eigenda/disperser/cmd/apiserver/flags" bat "github.com/Layr-Labs/eigenda/disperser/cmd/batcher/flags" enc "github.com/Layr-Labs/eigenda/disperser/cmd/encoder/flags" opr "github.com/Layr-Labs/eigenda/node/flags" + churner "github.com/Layr-Labs/eigenda/operators/churner/flags" retriever "github.com/Layr-Labs/eigenda/retriever/flags" "github.com/urfave/cli" @@ -20,7 +20,7 @@ import ( var myTemplate = ` type {{.Name}} struct{ {{range $var := .Fields}} - {{$var.EnvVar}} string + {{$var.EnvVar}} string {{end}} } func (vars {{.Name}}) getEnvMap() map[string]string { @@ -108,7 +108,7 @@ func genVars(name string, flags []cli.Flag) string { func main() { - configs := `package deploy + configs := `package deploy import "reflect" ` diff --git a/node/cmd/Dockerfile b/node/cmd/Dockerfile index 7f6be7e772..1ab94e01e3 100644 --- a/node/cmd/Dockerfile +++ b/node/cmd/Dockerfile @@ -4,7 +4,7 @@ RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash # build node with local monorepo go modules COPY ./node /app/node -COPY churner /app/churner +COPY operators/churner /app/churner COPY indexer /app/indexer COPY common /app/common COPY core /app/core @@ -22,4 +22,4 @@ FROM alpine:3.18 COPY --from=builder /app/node/bin/node /usr/local/bin -ENTRYPOINT ["node"] \ No newline at end of file +ENTRYPOINT ["node"] diff --git a/node/operator.go b/node/operator.go index eb8fd58a73..6e29ca86f3 100644 --- a/node/operator.go +++ b/node/operator.go @@ -10,9 +10,9 @@ import ( "time" grpcchurner "github.com/Layr-Labs/eigenda/api/grpc/churner" - "github.com/Layr-Labs/eigenda/churner" "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/core" + "github.com/Layr-Labs/eigenda/operators/churner" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "google.golang.org/grpc" diff --git a/node/plugin/cmd/Dockerfile b/node/plugin/cmd/Dockerfile index fc417c2418..5580c5e11e 100644 --- a/node/plugin/cmd/Dockerfile +++ b/node/plugin/cmd/Dockerfile @@ -4,7 +4,7 @@ RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash # build node with local monorepo go modules COPY ./node /app/node -COPY churner /app/churner +COPY operators/churner /app/churner COPY indexer /app/indexer COPY common /app/common COPY core /app/core diff --git a/churner/Makefile b/operators/churner/Makefile similarity index 100% rename from churner/Makefile rename to operators/churner/Makefile diff --git a/churner/churner.go b/operators/churner/churner.go similarity index 100% rename from churner/churner.go rename to operators/churner/churner.go diff --git a/churner/churner_test.go b/operators/churner/churner_test.go similarity index 98% rename from churner/churner_test.go rename to operators/churner/churner_test.go index 1a2c29bdcc..7407956628 100644 --- a/churner/churner_test.go +++ b/operators/churner/churner_test.go @@ -4,10 +4,10 @@ import ( "context" "testing" - "github.com/Layr-Labs/eigenda/churner" "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/common/logging" "github.com/Layr-Labs/eigenda/core" + "github.com/Layr-Labs/eigenda/operators/churner" "github.com/stretchr/testify/assert" dacore "github.com/Layr-Labs/eigenda/core" diff --git a/churner/cmd/Dockerfile b/operators/churner/cmd/Dockerfile similarity index 78% rename from churner/cmd/Dockerfile rename to operators/churner/cmd/Dockerfile index 9548183747..f3b3b1c875 100644 --- a/churner/cmd/Dockerfile +++ b/operators/churner/cmd/Dockerfile @@ -2,8 +2,8 @@ FROM golang:1.21.1-alpine3.18 as builder RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash -# build node with local monorepo go modules -COPY ./churner /app/churner +# build node with local monorepo go modules +COPY ./operators/churner /app/churner COPY common /app/common COPY core /app/core COPY api /app/api @@ -16,7 +16,7 @@ COPY go.sum /app WORKDIR /app/churner RUN --mount=type=cache,target=/go/pkg/mod \ - --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/.cache/go-build \ go build -o ./bin/churner ./cmd FROM alpine:3.18 diff --git a/churner/cmd/main.go b/operators/churner/cmd/main.go similarity index 96% rename from churner/cmd/main.go rename to operators/churner/cmd/main.go index 4c9dd763bc..27cb8c911c 100644 --- a/churner/cmd/main.go +++ b/operators/churner/cmd/main.go @@ -7,14 +7,14 @@ import ( "os" pb "github.com/Layr-Labs/eigenda/api/grpc/churner" - "github.com/Layr-Labs/eigenda/churner" - "github.com/Layr-Labs/eigenda/churner/flags" "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/common/healthcheck" "github.com/Layr-Labs/eigenda/common/logging" "github.com/Layr-Labs/eigenda/core/eth" coreeth "github.com/Layr-Labs/eigenda/core/eth" "github.com/Layr-Labs/eigenda/core/thegraph" + "github.com/Layr-Labs/eigenda/operators/churner" + "github.com/Layr-Labs/eigenda/operators/churner/flags" "github.com/shurcooL/graphql" "github.com/urfave/cli" "google.golang.org/grpc" diff --git a/churner/config.go b/operators/churner/config.go similarity index 95% rename from churner/config.go rename to operators/churner/config.go index a0f6fb4290..3295253fc2 100644 --- a/churner/config.go +++ b/operators/churner/config.go @@ -3,9 +3,9 @@ package churner import ( "time" - "github.com/Layr-Labs/eigenda/churner/flags" "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/common/logging" + "github.com/Layr-Labs/eigenda/operators/churner/flags" "github.com/urfave/cli" ) diff --git a/churner/flags/flags.go b/operators/churner/flags/flags.go similarity index 100% rename from churner/flags/flags.go rename to operators/churner/flags/flags.go diff --git a/churner/metrics.go b/operators/churner/metrics.go similarity index 100% rename from churner/metrics.go rename to operators/churner/metrics.go diff --git a/churner/server.go b/operators/churner/server.go similarity index 100% rename from churner/server.go rename to operators/churner/server.go diff --git a/churner/server_test.go b/operators/churner/server_test.go similarity index 99% rename from churner/server_test.go rename to operators/churner/server_test.go index 7ad037ba5a..d641f7d024 100644 --- a/churner/server_test.go +++ b/operators/churner/server_test.go @@ -7,7 +7,6 @@ import ( "math/big" "testing" - "github.com/Layr-Labs/eigenda/churner" "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/common/logging" commock "github.com/Layr-Labs/eigenda/common/mock" @@ -15,6 +14,7 @@ import ( dacore "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock" indexermock "github.com/Layr-Labs/eigenda/core/thegraph/mock" + "github.com/Layr-Labs/eigenda/operators/churner" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" diff --git a/churner/tests/churner_test.go b/operators/churner/tests/churner_test.go similarity index 98% rename from churner/tests/churner_test.go rename to operators/churner/tests/churner_test.go index a612f82edc..deeb614416 100644 --- a/churner/tests/churner_test.go +++ b/operators/churner/tests/churner_test.go @@ -12,7 +12,6 @@ import ( "time" pb "github.com/Layr-Labs/eigenda/api/grpc/churner" - "github.com/Layr-Labs/eigenda/churner" "github.com/Layr-Labs/eigenda/common" "github.com/Layr-Labs/eigenda/common/geth" "github.com/Layr-Labs/eigenda/common/logging" @@ -23,6 +22,7 @@ import ( indexermock "github.com/Layr-Labs/eigenda/core/thegraph/mock" "github.com/Layr-Labs/eigenda/inabox/deploy" "github.com/Layr-Labs/eigenda/node/plugin" + "github.com/Layr-Labs/eigenda/operators/churner" "github.com/Layr-Labs/eigensdk-go/crypto/bls" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" @@ -56,7 +56,7 @@ func TestMain(m *testing.M) { } func setup(m *testing.M) { - rootPath := "../../" + rootPath := "../../../" if testName == "" { var err error From 2d52a544d10e1fe30f8b0cd05c15609beafddb2c Mon Sep 17 00:00:00 2001 From: Jian Xiao Date: Fri, 1 Mar 2024 02:57:40 +0000 Subject: [PATCH 2/3] fix --- .github/workflows/integration-tests.yml | 12 ++++++------ Makefile | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f680024bf2..e859cde469 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -61,8 +61,8 @@ jobs: run: forge --version - name: Build contracts - run: | - cd contracts && forge build + run: | + cd contracts && forge build # TODO: add back DA contracts if we will need them in tests. # - name: Compile contracts @@ -70,13 +70,13 @@ jobs: # make compile-el # make compile-dl - - name: Churner - run: go test -v ./churner/tests + - name: Churner + run: go test -v ./operators/churner/tests - - name: Indexer + - name: Indexer run: go test -v ./core/indexer - - name: Node Plugin + - name: Node Plugin run: go test -v ./node/plugin/tests - name: Graph Indexer diff --git a/Makefile b/Makefile index 228b6e5f5c..0625ecb80c 100644 --- a/Makefile +++ b/Makefile @@ -37,14 +37,14 @@ lint: go tool fix ./.. golangci-lint run -build: - cd churner && make build +build: + cd operators/churner && make build cd disperser && make build cd node && make build cd retriever && make build cd tools/traffic && make build -dataapi-build: +dataapi-build: cd disperser && go build -o ./bin/dataapi ./cmd/dataapi unit-tests: @@ -60,7 +60,7 @@ integration-tests-node-plugin: go test -v ./node/plugin/tests integration-tests-inabox: - make build + make build cd inabox && make run-e2e integration-tests-inabox-nochurner: @@ -68,9 +68,9 @@ integration-tests-inabox-nochurner: cd inabox && make run-e2e-nochurner integration-tests-graph-indexer: - make build + make build go test -v ./core/thegraph integration-tests-dataapi: - make dataapi-build + make dataapi-build go test -v ./disperser/dataapi From f6cc9b07055d2e9138b8c14040a59919a1ee7f43 Mon Sep 17 00:00:00 2001 From: Jian Xiao Date: Fri, 1 Mar 2024 17:44:05 +0000 Subject: [PATCH 3/3] fix --- inabox/bin.sh | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/inabox/bin.sh b/inabox/bin.sh index 3bee0055d2..7f27cd79f4 100755 --- a/inabox/bin.sh +++ b/inabox/bin.sh @@ -15,12 +15,12 @@ function start_trap { set -a source $testpath/envs/churner.env set +a - ../churner/bin/server & + ../operators/churner/bin/server & pid="$!" pids="$pids $pid" - for FILE in $(ls $testpath/envs/dis*.env); do + for FILE in $(ls $testpath/envs/dis*.env); do set -a source $FILE set +a @@ -30,7 +30,7 @@ function start_trap { pids="$pids $pid" done - for FILE in $(ls $testpath/envs/enc*.env); do + for FILE in $(ls $testpath/envs/enc*.env); do set -a source $FILE set +a @@ -40,7 +40,7 @@ function start_trap { pids="$pids $pid" done - for FILE in $(ls $testpath/envs/batcher*.env); do + for FILE in $(ls $testpath/envs/batcher*.env); do set -a source $FILE set +a @@ -49,11 +49,11 @@ function start_trap { pid="$!" pids="$pids $pid" done - + files=($(ls $testpath/envs/opr*.env)) last_index=$(( ${#files[@]} - 1 )) - for i in "${!files[@]}"; do + for i in "${!files[@]}"; do if [ $i -eq $last_index ]; then sleep 5 # Sleep for 5 seconds before the last loop iteration fi @@ -61,15 +61,15 @@ function start_trap { set -a source $FILE set +a - ../node/bin/node & + ../node/bin/node & pid="$!" pids="$pids $pid" done - for pid in $pids; do + for pid in $pids; do wait $pid - done + done } function start_detached { @@ -88,7 +88,7 @@ function start_detached { set -a source $testpath/envs/churner.env set +a - ../churner/bin/server > $testpath/logs/churner.log 2>&1 & + ../operators/churner/bin/server > $testpath/logs/churner.log 2>&1 & pid="$!" pids="$pids $pid" @@ -96,12 +96,12 @@ function start_detached { ./wait-for 0.0.0.0:${CHURNER_GRPC_PORT} -- echo "Churner up" & waiters="$waiters $!" - for FILE in $(ls $testpath/envs/dis*.env); do + for FILE in $(ls $testpath/envs/dis*.env); do set -a source $FILE set +a id=$(basename $FILE | tr -d -c 0-9) - ../disperser/bin/server > $testpath/logs/dis${id}.log 2>&1 & + ../disperser/bin/server > $testpath/logs/dis${id}.log 2>&1 & pid="$!" pids="$pids $pid" @@ -110,7 +110,7 @@ function start_detached { waiters="$waiters $!" done - for FILE in $(ls $testpath/envs/enc*.env); do + for FILE in $(ls $testpath/envs/enc*.env); do set -a source $FILE set +a @@ -124,22 +124,22 @@ function start_detached { waiters="$waiters $!" done - for FILE in $(ls $testpath/envs/batcher*.env); do + for FILE in $(ls $testpath/envs/batcher*.env); do set -a source $FILE set +a id=$(basename $FILE | tr -d -c 0-9) - ../disperser/bin/batcher > $testpath/logs/batcher${id}.log 2>&1 & + ../disperser/bin/batcher > $testpath/logs/batcher${id}.log 2>&1 & pid="$!" pids="$pids $pid" done - for FILE in $(ls $testpath/envs/retriever*.env); do + for FILE in $(ls $testpath/envs/retriever*.env); do set -a source $FILE set +a - ../retriever/bin/server > $testpath/logs/retriever.log 2>&1 & + ../retriever/bin/server > $testpath/logs/retriever.log 2>&1 & pid="$!" pids="$pids $pid" @@ -148,7 +148,7 @@ function start_detached { files=($(ls $testpath/envs/opr*.env)) last_index=$(( ${#files[@]} - 1 )) - for i in "${!files[@]}"; do + for i in "${!files[@]}"; do if [ $i -eq $last_index ]; then sleep 5 # Sleep for 5 seconds before the last loop iteration fi @@ -168,14 +168,14 @@ function start_detached { echo $pids > $pid_file - for waiter in $waiters; do + for waiter in $waiters; do wait $waiter done } function stop_detached { - + pid_file="$testpath/pids" pids=$(cat $pid_file) @@ -187,8 +187,8 @@ function stop_detached { function start_anvil { echo "Starting anvil server ....." - anvil --host 0.0.0.0 > /dev/null & - anvil_pid=$! + anvil --host 0.0.0.0 > /dev/null & + anvil_pid=$! echo "Anvil server started ....." echo $anvil_pid > ./anvil.pid @@ -232,18 +232,18 @@ case "$1" in EOF ;; start) - start_trap ${@:2} ;; + start_trap ${@:2} ;; start-detached) - start_detached ${@:2} ;; + start_detached ${@:2} ;; stop) stop_detached ${@:2} ;; start-anvil) - start_anvil ${@:2} ;; + start_anvil ${@:2} ;; stop-anvil) - stop_anvil ${@:2} ;; + stop_anvil ${@:2} ;; start-graph) - start_graph ${@:2} ;; + start_graph ${@:2} ;; stop-graph) - stop_graph ${@:2} ;; + stop_graph ${@:2} ;; *) esac