From bcca82eaa3c73bd461b524df28b0ad9564c93c5c Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 20 Sep 2022 14:00:10 -0400 Subject: [PATCH] Cerc refactor (#104) * cerc refactor waiting on unpublished dependencies * updated go.mod for published dependencies in cerc-io refactoring --- .github/workflows/on-publish-pr.yml | 10 +++++----- Dockerfile | 14 +++++++------- README.md | 2 +- cmd/root.go | 2 +- cmd/serve.go | 4 ++-- cmd/util.go | 4 ++-- cmd/version.go | 2 +- go.mod | 10 +++++----- go.sum | 15 ++++++++------- main.go | 2 +- pkg/builder.go | 2 +- pkg/builder_test.go | 2 +- pkg/rpc/http.go | 2 +- pkg/rpc/ipc.go | 2 +- pkg/service.go | 2 +- 15 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.github/workflows/on-publish-pr.yml b/.github/workflows/on-publish-pr.yml index ff4cd8b..487abff 100644 --- a/.github/workflows/on-publish-pr.yml +++ b/.github/workflows/on-publish-pr.yml @@ -38,11 +38,11 @@ jobs: - name: Run docker build run: make docker-build - name: Tag docker image - run: docker tag vulcanize/eth-statediff-service docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} + run: docker tag cerc-io/eth-statediff-service docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} - name: Docker Login run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin - name: Docker Push - run: docker push docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} + run: docker push docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} push_to_registries: name: Push Docker image to Docker Hub runs-on: ubuntu-latest @@ -60,10 +60,10 @@ jobs: - name: Docker Login to Github Registry run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin - name: Docker Pull - run: docker pull docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} + run: docker pull docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} - name: Docker Login to Docker Registry run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u vulcanizejenkins --password-stdin - name: Tag docker image - run: docker tag docker.pkg.github.com/vulcanize/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} vulcanize/eth-statediff-service:${{steps.vars.outputs.tag}} + run: docker tag docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} cerc-io/eth-statediff-service:${{steps.vars.outputs.tag}} - name: Docker Push to Docker Hub - run: docker push vulcanize/eth-statediff-service:${{steps.vars.outputs.tag}} + run: docker push cerc-io/eth-statediff-service:${{steps.vars.outputs.tag}} diff --git a/Dockerfile b/Dockerfile index 7b48184..365efaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,10 @@ RUN apk --update --no-cache add make git g++ linux-headers RUN apk add busybox-extras # Get and build ipfs-blockchain-watcher -ADD . /go/src/github.com/vulcanize/eth-statediff-service -#RUN git clone https://github.com/vulcanize/eth-statediff-service.git /go/src/github.com/vulcanize/eth-statediff-service +ADD . /go/src/github.com/cerc-io/eth-statediff-service +#RUN git clone https://github.com/cerc-io/eth-statediff-service.git /go/src/github.com/vulcanize/eth-statediff-service -WORKDIR /go/src/github.com/vulcanize/eth-statediff-service +WORKDIR /go/src/github.com/cerc-io/eth-statediff-service RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service . # app container @@ -27,12 +27,12 @@ USER $USER # chown first so dir is writable # note: using $USER is merged, but not in the stable release yet -COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/eth-statediff-service/$CONFIG_FILE config.toml -COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/eth-statediff-service/startup_script.sh . -COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/eth-statediff-service/environments environments +COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/eth-statediff-service/$CONFIG_FILE config.toml +COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/eth-statediff-service/startup_script.sh . +COPY --chown=5000:5000 --from=builder /go/src/github.com/cerc-io/eth-statediff-service/environments environments # keep binaries immutable -COPY --from=builder /go/src/github.com/vulcanize/eth-statediff-service/eth-statediff-service eth-statediff-service +COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/eth-statediff-service eth-statediff-service EXPOSE $EXPOSE_PORT diff --git a/README.md b/README.md index 26088a3..7dd6ebb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Purpose: Stand up a statediffing service directly on top of a go-ethereum LevelDB instance. This service can serve historical state data over the same rpc interface as -[statediffing geth](https://github.com/vulcanize/go-ethereum) without needing to run a full node. +[statediffing geth](https://github.com/cerc-io/go-ethereum) without needing to run a full node. ## Setup diff --git a/cmd/root.go b/cmd/root.go index a5e628c..f204fd1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -34,7 +34,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/vulcanize/eth-statediff-service/pkg/prom" + "github.com/cerc-io/eth-statediff-service/pkg/prom" ) var ( diff --git a/cmd/serve.go b/cmd/serve.go index f5959be..fdc74e1 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -25,8 +25,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - sd "github.com/vulcanize/eth-statediff-service/pkg" - srpc "github.com/vulcanize/eth-statediff-service/pkg/rpc" + sd "github.com/cerc-io/eth-statediff-service/pkg" + srpc "github.com/cerc-io/eth-statediff-service/pkg/rpc" ) // serveCmd represents the serve command diff --git a/cmd/util.go b/cmd/util.go index bc4329f..078f803 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -11,8 +11,8 @@ import ( "github.com/ethereum/go-ethereum/trie" "github.com/spf13/viper" - sd "github.com/vulcanize/eth-statediff-service/pkg" - "github.com/vulcanize/eth-statediff-service/pkg/prom" + sd "github.com/cerc-io/eth-statediff-service/pkg" + "github.com/cerc-io/eth-statediff-service/pkg/prom" ) type blockRange [2]uint64 diff --git a/cmd/version.go b/cmd/version.go index 280bf7e..809407d 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -20,7 +20,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - v "github.com/vulcanize/eth-statediff-service/version" + v "github.com/cerc-io/eth-statediff-service/version" ) // versionCmd represents the version command diff --git a/go.mod b/go.mod index 99cb29b..586d719 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ -module github.com/vulcanize/eth-statediff-service +module github.com/cerc-io/eth-statediff-service go 1.18 require ( + github.com/cerc-io/go-eth-state-node-iterator v1.1.7 github.com/ethereum/go-ethereum v1.10.23 github.com/jmoiron/sqlx v1.2.0 // indirect github.com/prometheus/client_golang v1.4.0 - github.com/sirupsen/logrus v1.7.0 + github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.3.0 github.com/spf13/viper v1.10.1 - github.com/vulcanize/go-eth-state-node-iterator v1.1.5 github.com/vulcanize/leveldb-ethdb-rpc v0.1.7 ) @@ -124,7 +124,7 @@ require ( golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect google.golang.org/protobuf v1.27.1 // indirect @@ -135,4 +135,4 @@ require ( lukechampine.com/blake3 v1.1.6 // indirect ) -replace github.com/ethereum/go-ethereum v1.10.23 => github.com/vulcanize/go-ethereum v1.10.23-statediff-4.2.0-alpha +replace github.com/ethereum/go-ethereum v1.10.23 => github.com/cerc-io/go-ethereum v1.10.23-statediff-4.2.0-alpha diff --git a/go.sum b/go.sum index 479fd2e..848b51c 100644 --- a/go.sum +++ b/go.sum @@ -86,6 +86,10 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cerc-io/go-eth-state-node-iterator v1.1.7 h1:i4zCKkfowJ4aUVpqVyMpOZIbD5WVm/iijhMAPgcLJ44= +github.com/cerc-io/go-eth-state-node-iterator v1.1.7/go.mod h1:BBh4BetpBoHUbAiKAdatR3ij7IzDlgN9nPzZ7snn/lo= +github.com/cerc-io/go-ethereum v1.10.23-statediff-4.2.0-alpha h1:Na4mum/Qkw1mRHnq/TIRPIF5exZAEBznVs3G3/YSENo= +github.com/cerc-io/go-ethereum v1.10.23-statediff-4.2.0-alpha/go.mod h1:lKBVBWksSwBDR/5D9CAxaGQzDPIS3ueWb6idy7X1Shg= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -696,8 +700,8 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -754,10 +758,6 @@ github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhA github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vulcanize/go-eth-state-node-iterator v1.1.5 h1:7UEexXBFu2IWPMmNl7QXY/YD7Ag/bgYZNALUTTMPAwc= -github.com/vulcanize/go-eth-state-node-iterator v1.1.5/go.mod h1:R74aMGSa562x6IrbzoUdEX3cK3DrmuXfe0nZ1PSzizM= -github.com/vulcanize/go-ethereum v1.10.23-statediff-4.2.0-alpha h1:iy1uhdazPIlUJcCu6Kal+hFQiZblTDwSe2i644o167Y= -github.com/vulcanize/go-ethereum v1.10.23-statediff-4.2.0-alpha/go.mod h1:lKBVBWksSwBDR/5D9CAxaGQzDPIS3ueWb6idy7X1Shg= github.com/vulcanize/leveldb-ethdb-rpc v0.1.7 h1:iyaaNRNK2S6QNUwKlAzUbJFHEKyD7z9T74uCAgTHBI0= github.com/vulcanize/leveldb-ethdb-rpc v0.1.7/go.mod h1:gqXQ5dpFcb517/NYzIezqZIDOgLMBHYzP+A0Orqdblg= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= @@ -1028,8 +1028,9 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/main.go b/main.go index a281837..74da9c1 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ package main -import "github.com/vulcanize/eth-statediff-service/cmd" +import "github.com/cerc-io/eth-statediff-service/cmd" func main() { cmd.Execute() diff --git a/pkg/builder.go b/pkg/builder.go index d09ad60..3f2a60b 100644 --- a/pkg/builder.go +++ b/pkg/builder.go @@ -29,7 +29,7 @@ import ( sdtypes "github.com/ethereum/go-ethereum/statediff/types" "github.com/sirupsen/logrus" - iter "github.com/vulcanize/go-eth-state-node-iterator" + iter "github.com/cerc-io/go-eth-state-node-iterator" ) type builder struct { diff --git a/pkg/builder_test.go b/pkg/builder_test.go index 70c917a..b6843be 100644 --- a/pkg/builder_test.go +++ b/pkg/builder_test.go @@ -30,7 +30,7 @@ import ( "github.com/ethereum/go-ethereum/statediff/test_helpers" sdtypes "github.com/ethereum/go-ethereum/statediff/types" - pkg "github.com/vulcanize/eth-statediff-service/pkg" + pkg "github.com/cerc-io/eth-statediff-service/pkg" ) var ( diff --git a/pkg/rpc/http.go b/pkg/rpc/http.go index a8c71b1..f815010 100644 --- a/pkg/rpc/http.go +++ b/pkg/rpc/http.go @@ -24,7 +24,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" log "github.com/sirupsen/logrus" - "github.com/vulcanize/eth-statediff-service/pkg/prom" + "github.com/cerc-io/eth-statediff-service/pkg/prom" ) // StartHTTPEndpoint starts the HTTP RPC endpoint, configured with cors/vhosts/modules. diff --git a/pkg/rpc/ipc.go b/pkg/rpc/ipc.go index 62f26d4..57c29a5 100644 --- a/pkg/rpc/ipc.go +++ b/pkg/rpc/ipc.go @@ -26,7 +26,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" log "github.com/sirupsen/logrus" - "github.com/vulcanize/eth-statediff-service/pkg/prom" + "github.com/cerc-io/eth-statediff-service/pkg/prom" ) var ( diff --git a/pkg/service.go b/pkg/service.go index 875d52b..6903581 100644 --- a/pkg/service.go +++ b/pkg/service.go @@ -33,7 +33,7 @@ import ( sdtypes "github.com/ethereum/go-ethereum/statediff/types" "github.com/sirupsen/logrus" - "github.com/vulcanize/eth-statediff-service/pkg/prom" + "github.com/cerc-io/eth-statediff-service/pkg/prom" ) const defaultQueueSize = 1024