From dbcb2c0cf7e33e729c2a8ef58e744f1473e7c676 Mon Sep 17 00:00:00 2001 From: Ian Norden Date: Wed, 2 Sep 2020 10:19:25 -0500 Subject: [PATCH] updat dep and serve cmd --- cmd/serve.go | 85 +++++++------- pkg/eth/api.go | 2 +- pkg/eth/api_test.go | 6 +- pkg/eth/backend.go | 4 +- pkg/eth/cid_retriever.go | 4 +- pkg/eth/cid_retriever_test.go | 210 +--------------------------------- pkg/eth/filterer.go | 6 +- pkg/eth/filterer_test.go | 4 +- pkg/eth/ipld_fetcher.go | 6 +- pkg/eth/ipld_fetcher_test.go | 6 +- pkg/eth/test_helpers.go | 4 +- pkg/serve/api.go | 8 -- pkg/serve/config.go | 9 +- pkg/serve/service.go | 10 +- pkg/shared/env.go | 2 +- pkg/shared/functions.go | 2 +- pkg/shared/test_helpers.go | 8 +- test_config/test_config.go | 2 +- 18 files changed, 82 insertions(+), 296 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index e0ab26e9..c3d6b4a1 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -18,22 +18,22 @@ package cmd import ( "os" "os/signal" - s "sync" + "sync" "github.com/ethereum/go-ethereum/rpc" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" - "github.com/vulcanize/ipld-eth-server/pkg/serve" + s "github.com/vulcanize/ipld-eth-server/pkg/serve" v "github.com/vulcanize/ipld-eth-server/version" ) -// watchCmd represents the watch command -var watchCmd = &cobra.Command{ - Use: "watch", +// serveCmd represents the serve command +var serveCmd = &cobra.Command{ + Use: "serve", Short: "serve chain data from PG-IPFS", Long: `This command configures a VulcanizeDB ipld-eth-server. @@ -41,82 +41,81 @@ var watchCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { subCommand = cmd.CalledAs() logWithCommand = *log.WithField("SubCommand", subCommand) - watch() + serve() }, } -func watch() { +func serve() { logWithCommand.Infof("running ipld-eth-server version: %s", v.VersionWithMeta) var forwardPayloadChan chan eth.ConvertedPayload - wg := new(s.WaitGroup) - logWithCommand.Debug("loading watcher configuration variables") - watcherConfig, err := serve.NewConfig() + wg := new(sync.WaitGroup) + logWithCommand.Debug("loading server configuration variables") + serverConfig, err := s.NewConfig() if err != nil { logWithCommand.Fatal(err) } - logWithCommand.Infof("watcher config: %+v", watcherConfig) - logWithCommand.Debug("initializing new watcher service") - s, err := serve.NewServer(watcherConfig) + logWithCommand.Infof("server config: %+v", serverConfig) + logWithCommand.Debug("initializing new server service") + server, err := s.NewServer(serverConfig) if err != nil { logWithCommand.Fatal(err) } - logWithCommand.Info("starting up watcher servers") - forwardPayloadChan = make(chan eth.ConvertedPayload, serve.PayloadChanBufferSize) - s.Serve(wg, forwardPayloadChan) - if err := startServers(s, watcherConfig); err != nil { + logWithCommand.Info("starting up server servers") + forwardPayloadChan = make(chan eth.ConvertedPayload, s.PayloadChanBufferSize) + server.Serve(wg, forwardPayloadChan) + if err := startServers(server, serverConfig); err != nil { logWithCommand.Fatal(err) } - shutdown := make(chan os.Signal) signal.Notify(shutdown, os.Interrupt) <-shutdown - s.Stop() + server.Stop() wg.Wait() } -func startServers(watcher serve.Server, settings *serve.Config) error { +func startServers(server s.Server, settings *s.Config) error { logWithCommand.Debug("starting up IPC server") - _, _, err := rpc.StartIPCEndpoint(settings.IPCEndpoint, watcher.APIs()) + _, _, err := rpc.StartIPCEndpoint(settings.IPCEndpoint, server.APIs()) if err != nil { return err } logWithCommand.Debug("starting up WS server") - _, _, err = rpc.StartWSEndpoint(settings.WSEndpoint, watcher.APIs(), []string{"vdb"}, nil, true) + _, _, err = rpc.StartWSEndpoint(settings.WSEndpoint, server.APIs(), []string{"vdb"}, nil, true) if err != nil { return err } logWithCommand.Debug("starting up HTTP server") - _, _, err = rpc.StartHTTPEndpoint(settings.HTTPEndpoint, watcher.APIs(), []string{"eth"}, nil, nil, rpc.HTTPTimeouts{}) + _, _, err = rpc.StartHTTPEndpoint(settings.HTTPEndpoint, server.APIs(), []string{"eth"}, nil, nil, rpc.HTTPTimeouts{}) return err } func init() { - rootCmd.AddCommand(watchCmd) + rootCmd.AddCommand(serveCmd) // flags for all config variables - watchCmd.PersistentFlags().String("watcher-ws-path", "", "vdb server ws path") - watchCmd.PersistentFlags().String("watcher-http-path", "", "vdb server http path") - watchCmd.PersistentFlags().String("watcher-ipc-path", "", "vdb server ipc path") + serveCmd.PersistentFlags().String("server-ws-path", "", "vdb server ws path") + serveCmd.PersistentFlags().String("server-http-path", "", "vdb server http path") + serveCmd.PersistentFlags().String("server-ipc-path", "", "vdb server ipc path") - watchCmd.PersistentFlags().String("eth-ws-path", "", "ws url for ethereum node") - watchCmd.PersistentFlags().String("eth-http-path", "", "http url for ethereum node") - watchCmd.PersistentFlags().String("eth-node-id", "", "eth node id") - watchCmd.PersistentFlags().String("eth-client-name", "", "eth client name") - watchCmd.PersistentFlags().String("eth-genesis-block", "", "eth genesis block hash") - watchCmd.PersistentFlags().String("eth-network-id", "", "eth network id") + serveCmd.PersistentFlags().String("eth-ws-path", "", "ws url for ethereum node") + serveCmd.PersistentFlags().String("eth-http-path", "", "http url for ethereum node") + serveCmd.PersistentFlags().String("eth-node-id", "", "eth node id") + serveCmd.PersistentFlags().String("eth-client-name", "", "eth client name") + serveCmd.PersistentFlags().String("eth-genesis-block", "", "eth genesis block hash") + serveCmd.PersistentFlags().String("eth-network-id", "", "eth network id") // and their bindings - viper.BindPFlag("watcher.wsPath", watchCmd.PersistentFlags().Lookup("watcher-ws-path")) - viper.BindPFlag("watcher.httpPath", watchCmd.PersistentFlags().Lookup("watcher-http-path")) - viper.BindPFlag("watcher.ipcPath", watchCmd.PersistentFlags().Lookup("watcher-ipc-path")) + viper.BindPFlag("server.wsPath", serveCmd.PersistentFlags().Lookup("server-ws-path")) + viper.BindPFlag("server.httpPath", serveCmd.PersistentFlags().Lookup("server-http-path")) + viper.BindPFlag("server.ipcPath", serveCmd.PersistentFlags().Lookup("server-ipc-path")) - viper.BindPFlag("ethereum.wsPath", watchCmd.PersistentFlags().Lookup("eth-ws-path")) - viper.BindPFlag("ethereum.httpPath", watchCmd.PersistentFlags().Lookup("eth-http-path")) - viper.BindPFlag("ethereum.nodeID", watchCmd.PersistentFlags().Lookup("eth-node-id")) - viper.BindPFlag("ethereum.clientName", watchCmd.PersistentFlags().Lookup("eth-client-name")) - viper.BindPFlag("ethereum.genesisBlock", watchCmd.PersistentFlags().Lookup("eth-genesis-block")) - viper.BindPFlag("ethereum.networkID", watchCmd.PersistentFlags().Lookup("eth-network-id")) + viper.BindPFlag("ethereum.wsPath", serveCmd.PersistentFlags().Lookup("eth-ws-path")) + viper.BindPFlag("ethereum.httpPath", serveCmd.PersistentFlags().Lookup("eth-http-path")) + viper.BindPFlag("ethereum.nodeID", serveCmd.PersistentFlags().Lookup("eth-node-id")) + viper.BindPFlag("ethereum.clientName", serveCmd.PersistentFlags().Lookup("eth-client-name")) + viper.BindPFlag("ethereum.genesisBlock", serveCmd.PersistentFlags().Lookup("eth-genesis-block")) + viper.BindPFlag("ethereum.networkID", serveCmd.PersistentFlags().Lookup("eth-network-id")) } diff --git a/pkg/eth/api.go b/pkg/eth/api.go index 491a13a3..a2b6b4ff 100644 --- a/pkg/eth/api.go +++ b/pkg/eth/api.go @@ -20,7 +20,7 @@ import ( "context" "math/big" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" "github.com/ethereum/go-ethereum" diff --git a/pkg/eth/api_test.go b/pkg/eth/api_test.go index e48fff48..fc4a67fc 100644 --- a/pkg/eth/api_test.go +++ b/pkg/eth/api_test.go @@ -29,9 +29,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - eth2 "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth/mocks" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" diff --git a/pkg/eth/backend.go b/pkg/eth/backend.go index cf972e15..6b3e9eb2 100644 --- a/pkg/eth/backend.go +++ b/pkg/eth/backend.go @@ -30,8 +30,8 @@ import ( "github.com/ethereum/go-ethereum/rpc" ipfsethdb "github.com/vulcanize/pg-ipfs-ethdb" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/shared" ) diff --git a/pkg/eth/cid_retriever.go b/pkg/eth/cid_retriever.go index 3d83f62e..7ae49a00 100644 --- a/pkg/eth/cid_retriever.go +++ b/pkg/eth/cid_retriever.go @@ -26,8 +26,8 @@ import ( "github.com/lib/pq" log "github.com/sirupsen/logrus" - eth2 "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/shared" ) diff --git a/pkg/eth/cid_retriever_test.go b/pkg/eth/cid_retriever_test.go index 24ef1e7f..555d7fec 100644 --- a/pkg/eth/cid_retriever_test.go +++ b/pkg/eth/cid_retriever_test.go @@ -24,9 +24,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - eth2 "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth/mocks" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" @@ -465,210 +465,6 @@ var _ = Describe("Retriever", func() { Expect(num).To(Equal(int64(1010101))) }) }) - - Describe("RetrieveGapsInData", func() { - It("Doesn't return gaps if there are none", func() { - payload0 := mocks.MockConvertedPayload - payload0.Block = newMockBlock(0) - payload1 := mocks.MockConvertedPayload - payload2 := payload1 - payload2.Block = newMockBlock(2) - payload3 := payload2 - payload3.Block = newMockBlock(3) - err := repo.Publish(payload0) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload1) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload2) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload3) - Expect(err).ToNot(HaveOccurred()) - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(0)) - }) - - It("Returns the gap from 0 to the earliest block", func() { - payload := mocks.MockConvertedPayload - payload.Block = newMockBlock(5) - err := repo.Publish(payload) - Expect(err).ToNot(HaveOccurred()) - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(1)) - Expect(gaps[0].Start).To(Equal(uint64(0))) - Expect(gaps[0].Stop).To(Equal(uint64(4))) - }) - - It("Can handle single block gaps", func() { - payload0 := mocks.MockConvertedPayload - payload0.Block = newMockBlock(0) - payload1 := mocks.MockConvertedPayload - payload3 := payload1 - payload3.Block = newMockBlock(3) - err := repo.Publish(payload0) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload1) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload3) - Expect(err).ToNot(HaveOccurred()) - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(1)) - Expect(gaps[0].Start).To(Equal(uint64(2))) - Expect(gaps[0].Stop).To(Equal(uint64(2))) - }) - - It("Finds gap between two entries", func() { - payload1 := mocks.MockConvertedPayload - payload1.Block = newMockBlock(1010101) - payload2 := payload1 - payload2.Block = newMockBlock(0) - err := repo.Publish(payload1) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload2) - Expect(err).ToNot(HaveOccurred()) - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(1)) - Expect(gaps[0].Start).To(Equal(uint64(1))) - Expect(gaps[0].Stop).To(Equal(uint64(1010100))) - }) - - It("Finds gaps between multiple entries", func() { - payload1 := mocks.MockConvertedPayload - payload1.Block = newMockBlock(1010101) - payload2 := mocks.MockConvertedPayload - payload2.Block = newMockBlock(1) - payload3 := mocks.MockConvertedPayload - payload3.Block = newMockBlock(5) - payload4 := mocks.MockConvertedPayload - payload4.Block = newMockBlock(100) - payload5 := mocks.MockConvertedPayload - payload5.Block = newMockBlock(101) - payload6 := mocks.MockConvertedPayload - payload6.Block = newMockBlock(102) - payload7 := mocks.MockConvertedPayload - payload7.Block = newMockBlock(103) - payload8 := mocks.MockConvertedPayload - payload8.Block = newMockBlock(104) - payload9 := mocks.MockConvertedPayload - payload9.Block = newMockBlock(105) - payload10 := mocks.MockConvertedPayload - payload10.Block = newMockBlock(106) - payload11 := mocks.MockConvertedPayload - payload11.Block = newMockBlock(1000) - - err := repo.Publish(payload1) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload2) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload3) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload4) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload5) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload6) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload7) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload8) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload9) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload10) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload11) - Expect(err).ToNot(HaveOccurred()) - - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(5)) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 0, Stop: 0})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 2, Stop: 4})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 6, Stop: 99})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 107, Stop: 999})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 1001, Stop: 1010100})).To(BeTrue()) - }) - - It("Finds validation level gaps", func() { - - payload1 := mocks.MockConvertedPayload - payload1.Block = newMockBlock(1010101) - payload2 := mocks.MockConvertedPayload - payload2.Block = newMockBlock(1) - payload3 := mocks.MockConvertedPayload - payload3.Block = newMockBlock(5) - payload4 := mocks.MockConvertedPayload - payload4.Block = newMockBlock(100) - payload5 := mocks.MockConvertedPayload - payload5.Block = newMockBlock(101) - payload6 := mocks.MockConvertedPayload - payload6.Block = newMockBlock(102) - payload7 := mocks.MockConvertedPayload - payload7.Block = newMockBlock(103) - payload8 := mocks.MockConvertedPayload - payload8.Block = newMockBlock(104) - payload9 := mocks.MockConvertedPayload - payload9.Block = newMockBlock(105) - payload10 := mocks.MockConvertedPayload - payload10.Block = newMockBlock(106) - payload11 := mocks.MockConvertedPayload - payload11.Block = newMockBlock(107) - payload12 := mocks.MockConvertedPayload - payload12.Block = newMockBlock(108) - payload13 := mocks.MockConvertedPayload - payload13.Block = newMockBlock(109) - payload14 := mocks.MockConvertedPayload - payload14.Block = newMockBlock(1000) - - err := repo.Publish(payload1) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload2) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload3) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload4) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload5) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload6) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload7) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload8) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload9) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload10) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload11) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload12) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload13) - Expect(err).ToNot(HaveOccurred()) - err = repo.Publish(payload14) - Expect(err).ToNot(HaveOccurred()) - - cleaner := eth2.NewDBCleaner(db) - err = cleaner.ResetValidation([][2]uint64{{101, 102}, {104, 104}, {106, 108}}) - Expect(err).ToNot(HaveOccurred()) - - gaps, err := retriever.RetrieveGapsInData(1) - Expect(err).ToNot(HaveOccurred()) - Expect(len(gaps)).To(Equal(8)) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 0, Stop: 0})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 2, Stop: 4})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 6, Stop: 99})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 101, Stop: 102})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 104, Stop: 104})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 106, Stop: 108})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 110, Stop: 999})).To(BeTrue()) - Expect(shared.ListContainsGap(gaps, eth2.DBGap{Start: 1001, Stop: 1010100})).To(BeTrue()) - }) - }) }) func newMockBlock(blockNumber uint64) *types.Block { diff --git a/pkg/eth/filterer.go b/pkg/eth/filterer.go index 8f41833c..eaea466c 100644 --- a/pkg/eth/filterer.go +++ b/pkg/eth/filterer.go @@ -26,9 +26,9 @@ import ( "github.com/ethereum/go-ethereum/statediff" "github.com/multiformats/go-multihash" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs/ipld" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs/ipld" ) // Filterer interface for substituing mocks in tests diff --git a/pkg/eth/filterer_test.go b/pkg/eth/filterer_test.go index 41cbcf93..9495a010 100644 --- a/pkg/eth/filterer_test.go +++ b/pkg/eth/filterer_test.go @@ -23,8 +23,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth/mocks" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs" "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" diff --git a/pkg/eth/ipld_fetcher.go b/pkg/eth/ipld_fetcher.go index 0ed3df6c..c5ca2f8b 100644 --- a/pkg/eth/ipld_fetcher.go +++ b/pkg/eth/ipld_fetcher.go @@ -25,9 +25,9 @@ import ( "github.com/jmoiron/sqlx" log "github.com/sirupsen/logrus" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/shared" ) diff --git a/pkg/eth/ipld_fetcher_test.go b/pkg/eth/ipld_fetcher_test.go index a370c774..04761289 100644 --- a/pkg/eth/ipld_fetcher_test.go +++ b/pkg/eth/ipld_fetcher_test.go @@ -20,9 +20,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - eth2 "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth/mocks" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth/mocks" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" diff --git a/pkg/eth/test_helpers.go b/pkg/eth/test_helpers.go index 48fd71a2..c39ec5c3 100644 --- a/pkg/eth/test_helpers.go +++ b/pkg/eth/test_helpers.go @@ -19,8 +19,8 @@ package eth import ( . "github.com/onsi/gomega" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" ) // TearDownDB is used to tear down the watcher dbs after tests diff --git a/pkg/serve/api.go b/pkg/serve/api.go index 0e2aaa4d..7b2e2382 100644 --- a/pkg/serve/api.go +++ b/pkg/serve/api.go @@ -23,8 +23,6 @@ import ( "github.com/ethereum/go-ethereum/rpc" log "github.com/sirupsen/logrus" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/node" - "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" v "github.com/vulcanize/ipld-eth-server/version" @@ -87,12 +85,6 @@ func (api *PublicServerAPI) Stream(ctx context.Context, params eth.SubscriptionS return rpcSub, nil } -// Node is a public rpc method to allow transformers to fetch the node info for the watcher -// NOTE: this is the node info for the node that the watcher is syncing from, not the node info for the watcher itself -func (api *PublicServerAPI) Node() *node.Info { - return api.w.Node() -} - // Chain returns the chain type that this watcher instance supports func (api *PublicServerAPI) Chain() shared.ChainType { return api.w.Chain() diff --git a/pkg/serve/config.go b/pkg/serve/config.go index 0a2a0197..382d533f 100644 --- a/pkg/serve/config.go +++ b/pkg/serve/config.go @@ -20,12 +20,13 @@ import ( "os" "path/filepath" + "github.com/vulcanize/ipld-eth-indexer/pkg/node" + "github.com/spf13/viper" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/node" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" - "github.com/vulcanize/ipld-eth-server/utils" + "github.com/vulcanize/ipld-eth-indexer/utils" ) // Env variables @@ -79,7 +80,7 @@ func NewConfig() (*Config, error) { } c.HTTPEndpoint = httpPath overrideDBConnConfig(&c.DBConfig) - serveDB := utils.LoadPostgres(c.DBConfig, postgres.Info{}) + serveDB := utils.LoadPostgres(c.DBConfig, node.Info{}) c.DB = &serveDB return c, nil diff --git a/pkg/serve/service.go b/pkg/serve/service.go index 3226d6e2..34b39f6d 100644 --- a/pkg/serve/service.go +++ b/pkg/serve/service.go @@ -28,9 +28,8 @@ import ( "github.com/ethereum/go-ethereum/rpc" log "github.com/sirupsen/logrus" - eth2 "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/node" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + eth2 "github.com/vulcanize/ipld-eth-indexer/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" "github.com/vulcanize/ipld-eth-server/pkg/eth" "github.com/vulcanize/ipld-eth-server/pkg/shared" @@ -88,7 +87,6 @@ func NewServer(settings *Config) (Server, error) { sn.QuitChan = make(chan bool) sn.Subscriptions = make(map[common.Hash]map[rpc.ID]Subscription) sn.SubscriptionTypes = make(map[common.Hash]eth.SubscriptionSettings) - sn.NodeInfo = &settings.NodeInfo return sn, nil } @@ -273,7 +271,7 @@ func (sap *Service) sendHistoricalData(sub Subscription, id rpc.ID, params eth.S for i := startingBlock; i <= endingBlock; i++ { select { case <-sap.QuitChan: - log.Infof("%s watcher historical data feed to subscription %s closed", id) + log.Infof("ethereum historical data feed to subscription %s closed", id) return default: } @@ -309,7 +307,7 @@ func (sap *Service) sendHistoricalData(sub Subscription, id rpc.ID, params eth.S case sub.PayloadChan <- SubscriptionPayload{Data: nil, Err: "", Flag: BackFillCompleteFlag}: log.Debugf("eth ipld server sending backFill completion notice to subscription %s", id) default: - log.Infof("eth ipld server unable to send backFill completion notice to %s subscription %s", id) + log.Infof("eth ipld server unable to send backFill completion notice to subscription %s", id) } }() return nil diff --git a/pkg/shared/env.go b/pkg/shared/env.go index c14774a4..41c467a0 100644 --- a/pkg/shared/env.go +++ b/pkg/shared/env.go @@ -18,7 +18,7 @@ package shared import ( "github.com/spf13/viper" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/node" + "github.com/vulcanize/ipld-eth-indexer/pkg/node" ) // Env variables diff --git a/pkg/shared/functions.go b/pkg/shared/functions.go index 9b364ec6..3a51e53a 100644 --- a/pkg/shared/functions.go +++ b/pkg/shared/functions.go @@ -24,7 +24,7 @@ import ( node "github.com/ipfs/go-ipld-format" "github.com/jmoiron/sqlx" "github.com/sirupsen/logrus" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs/ipld" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs/ipld" ) // HandleZeroAddrPointer will return an emtpy string for a nil address pointer diff --git a/pkg/shared/test_helpers.go b/pkg/shared/test_helpers.go index 38eead8e..9c2dcbb8 100644 --- a/pkg/shared/test_helpers.go +++ b/pkg/shared/test_helpers.go @@ -19,14 +19,14 @@ package shared import ( "bytes" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/eth" + "github.com/vulcanize/ipld-eth-indexer/pkg/eth" "github.com/ipfs/go-cid" "github.com/multiformats/go-multihash" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/ipfs" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/node" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/ipfs" + "github.com/vulcanize/ipld-eth-indexer/pkg/node" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" ) // SetupDB is use to setup a db for watcher tests diff --git a/test_config/test_config.go b/test_config/test_config.go index 88678dd9..a2bb2b3b 100644 --- a/test_config/test_config.go +++ b/test_config/test_config.go @@ -22,7 +22,7 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/viper" - "github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres" + "github.com/vulcanize/ipld-eth-indexer/pkg/postgres" ) var DBConfig postgres.Config