From 989bd1c0f1570cff86af090ac8535a394ba1d662 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 20 Sep 2022 13:47:34 -0400 Subject: [PATCH] Cerc refactor (#64) * cerc refactor waiting on unpublished dependencies * more cerc_refactor with published ipld-eth-db unstable * TearDownDB refactor * missed second publisher_test TearDownDB --- cmd/inplaceStateSnapshot.go | 2 +- cmd/root.go | 4 ++-- cmd/stateSnapshot.go | 2 +- docker-compose.yml | 2 +- fixture/in_place_snapshot.go | 2 +- fixture/service.go | 2 +- go.mod | 6 +++--- go.sum | 8 ++++---- main.go | 2 +- pkg/snapshot/file/publisher.go | 4 ++-- pkg/snapshot/file/publisher_test.go | 10 +++++----- pkg/snapshot/in_place_snapshot.go | 2 +- pkg/snapshot/in_place_snapshot_test.go | 8 ++++---- pkg/snapshot/pg/publisher.go | 4 ++-- pkg/snapshot/pg/publisher_test.go | 10 +++++----- pkg/snapshot/service.go | 6 +++--- pkg/snapshot/service_test.go | 8 ++++---- pkg/snapshot/tracker.go | 2 +- pkg/snapshot/util.go | 8 ++++---- 19 files changed, 46 insertions(+), 46 deletions(-) diff --git a/cmd/inplaceStateSnapshot.go b/cmd/inplaceStateSnapshot.go index 6caa972..8ea28ff 100644 --- a/cmd/inplaceStateSnapshot.go +++ b/cmd/inplaceStateSnapshot.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot" ) // inPlaceStateSnapshotCmd represents the inPlaceStateSnapshot command diff --git a/cmd/root.go b/cmd/root.go index b4bd74e..92bcd26 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -25,8 +25,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/prom" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot" ) var ( diff --git a/cmd/stateSnapshot.go b/cmd/stateSnapshot.go index 8765407..f9553ef 100644 --- a/cmd/stateSnapshot.go +++ b/cmd/stateSnapshot.go @@ -22,7 +22,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot" ) // stateSnapshotCmd represents the stateSnapshot command diff --git a/docker-compose.yml b/docker-compose.yml index daf0dfc..62cea4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: restart: on-failure depends_on: - ipld-eth-db - image: vulcanize/ipld-eth-db:v4.2.1-alpha + image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v4.2.1-alpha-unstable environment: DATABASE_USER: "vdbm" DATABASE_NAME: "vulcanize_testing" diff --git a/fixture/in_place_snapshot.go b/fixture/in_place_snapshot.go index 3da55ad..39c1af4 100644 --- a/fixture/in_place_snapshot.go +++ b/fixture/in_place_snapshot.go @@ -18,9 +18,9 @@ package fixture import ( "math/big" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" ) type Block struct { diff --git a/fixture/service.go b/fixture/service.go index b1d8ce8..dc91cd9 100644 --- a/fixture/service.go +++ b/fixture/service.go @@ -6,7 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) var Block1_Header = types.Header{ diff --git a/go.mod b/go.mod index 8a3e1d9..b94a785 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,9 @@ -module github.com/vulcanize/ipld-eth-state-snapshot +module github.com/cerc-io/ipld-eth-state-snapshot 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/golang/mock v1.6.0 github.com/ipfs/go-cid v0.2.0 @@ -14,7 +15,6 @@ require ( github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.5.0 github.com/spf13/viper v1.12.0 - github.com/vulcanize/go-eth-state-node-iterator v1.1.4 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c ) @@ -110,4 +110,4 @@ require ( lukechampine.com/blake3 v1.1.7 // 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 388721e..bb7ef6b 100644 --- a/go.sum +++ b/go.sum @@ -75,6 +75,10 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/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/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -679,10 +683,6 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= -github.com/vulcanize/go-eth-state-node-iterator v1.1.4 h1:2jIbgZ/yxrNZt5zmsXtvUPSxT0sP5k1PR5/O1GN/Ma0= -github.com/vulcanize/go-eth-state-node-iterator v1.1.4/go.mod h1:kFzlSi7rUB9mJWZf08xIEiiGuXnnUEn48It+WMHzxPc= -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/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= diff --git a/main.go b/main.go index 27277df..c792bf9 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ package main import ( "github.com/sirupsen/logrus" - "github.com/vulcanize/ipld-eth-state-snapshot/cmd" + "github.com/cerc-io/ipld-eth-state-snapshot/cmd" ) func main() { diff --git a/pkg/snapshot/file/publisher.go b/pkg/snapshot/file/publisher.go index c3bed46..63b9c54 100644 --- a/pkg/snapshot/file/publisher.go +++ b/pkg/snapshot/file/publisher.go @@ -32,11 +32,11 @@ import ( "github.com/multiformats/go-multihash" "github.com/sirupsen/logrus" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" nodeinfo "github.com/ethereum/go-ethereum/statediff/indexer/node" "github.com/ethereum/go-ethereum/statediff/indexer/shared" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/prom" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" ) var _ snapt.Publisher = (*publisher)(nil) diff --git a/pkg/snapshot/file/publisher_test.go b/pkg/snapshot/file/publisher_test.go index 426ac43..9713e46 100644 --- a/pkg/snapshot/file/publisher_test.go +++ b/pkg/snapshot/file/publisher_test.go @@ -9,13 +9,13 @@ import ( "path/filepath" "testing" - "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" + "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - fixt "github.com/vulcanize/ipld-eth-state-snapshot/fixture" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" - "github.com/vulcanize/ipld-eth-state-snapshot/test" + fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" + "github.com/cerc-io/ipld-eth-state-snapshot/test" ) var ( @@ -93,7 +93,7 @@ func TestPgCopy(t *testing.T) { test.NoError(t, err) db := postgres.NewPostgresDB(driver) - sql.TearDownDB(t, db) + test_helpers.TearDownDB(t, db) // copy from files pgCopyStatement := `COPY %s FROM '%s' CSV` diff --git a/pkg/snapshot/in_place_snapshot.go b/pkg/snapshot/in_place_snapshot.go index 149aabe..f05b52d 100644 --- a/pkg/snapshot/in_place_snapshot.go +++ b/pkg/snapshot/in_place_snapshot.go @@ -16,9 +16,9 @@ package snapshot import ( + . "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/jmoiron/sqlx" "github.com/sirupsen/logrus" - . "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" ) const ( diff --git a/pkg/snapshot/in_place_snapshot_test.go b/pkg/snapshot/in_place_snapshot_test.go index 508dd93..cd973db 100644 --- a/pkg/snapshot/in_place_snapshot_test.go +++ b/pkg/snapshot/in_place_snapshot_test.go @@ -27,10 +27,10 @@ import ( "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" "github.com/multiformats/go-multihash" - fixt "github.com/vulcanize/ipld-eth-state-snapshot/fixture" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot/pg" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" - "github.com/vulcanize/ipld-eth-state-snapshot/test" + fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/pg" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" + "github.com/cerc-io/ipld-eth-state-snapshot/test" ) var ( diff --git a/pkg/snapshot/pg/publisher.go b/pkg/snapshot/pg/publisher.go index d2100df..57ed773 100644 --- a/pkg/snapshot/pg/publisher.go +++ b/pkg/snapshot/pg/publisher.go @@ -31,12 +31,12 @@ import ( "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" "github.com/ethereum/go-ethereum/statediff/indexer/shared" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/prom" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" ) var _ snapt.Publisher = (*publisher)(nil) diff --git a/pkg/snapshot/pg/publisher_test.go b/pkg/snapshot/pg/publisher_test.go index 33c4cae..1996246 100644 --- a/pkg/snapshot/pg/publisher_test.go +++ b/pkg/snapshot/pg/publisher_test.go @@ -4,13 +4,13 @@ import ( "context" "testing" - "github.com/ethereum/go-ethereum/statediff/indexer/database/sql" + "github.com/ethereum/go-ethereum/statediff/indexer/test_helpers" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - fixt "github.com/vulcanize/ipld-eth-state-snapshot/fixture" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" - "github.com/vulcanize/ipld-eth-state-snapshot/test" + fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" + "github.com/cerc-io/ipld-eth-state-snapshot/test" ) var ( @@ -48,7 +48,7 @@ func TestBasic(t *testing.T) { test.NoError(t, err) db := postgres.NewPostgresDB(driver) - sql.TearDownDB(t, db) + test_helpers.TearDownDB(t, db) _ = writeData(t, db) diff --git a/pkg/snapshot/service.go b/pkg/snapshot/service.go index 1cc4ca3..3db370e 100644 --- a/pkg/snapshot/service.go +++ b/pkg/snapshot/service.go @@ -33,9 +33,9 @@ import ( log "github.com/sirupsen/logrus" "golang.org/x/sync/errgroup" - iter "github.com/vulcanize/go-eth-state-node-iterator" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/prom" - . "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" + iter "github.com/cerc-io/go-eth-state-node-iterator" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + . "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) var ( diff --git a/pkg/snapshot/service_test.go b/pkg/snapshot/service_test.go index 16ad2df..8cff6d2 100644 --- a/pkg/snapshot/service_test.go +++ b/pkg/snapshot/service_test.go @@ -15,10 +15,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" - fixt "github.com/vulcanize/ipld-eth-state-snapshot/fixture" - mock "github.com/vulcanize/ipld-eth-state-snapshot/mocks/snapshot" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" - "github.com/vulcanize/ipld-eth-state-snapshot/test" + fixt "github.com/cerc-io/ipld-eth-state-snapshot/fixture" + mock "github.com/cerc-io/ipld-eth-state-snapshot/mocks/snapshot" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" + "github.com/cerc-io/ipld-eth-state-snapshot/test" ) var ( diff --git a/pkg/snapshot/tracker.go b/pkg/snapshot/tracker.go index caa2239..286b85c 100644 --- a/pkg/snapshot/tracker.go +++ b/pkg/snapshot/tracker.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/trie" log "github.com/sirupsen/logrus" - iter "github.com/vulcanize/go-eth-state-node-iterator" + iter "github.com/cerc-io/go-eth-state-node-iterator" ) type trackedIter struct { diff --git a/pkg/snapshot/util.go b/pkg/snapshot/util.go index 1f2357c..8a9ff16 100644 --- a/pkg/snapshot/util.go +++ b/pkg/snapshot/util.go @@ -7,10 +7,10 @@ import ( "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" - "github.com/vulcanize/ipld-eth-state-snapshot/pkg/prom" - file "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot/file" - pg "github.com/vulcanize/ipld-eth-state-snapshot/pkg/snapshot/pg" - snapt "github.com/vulcanize/ipld-eth-state-snapshot/pkg/types" + "github.com/cerc-io/ipld-eth-state-snapshot/pkg/prom" + file "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/file" + pg "github.com/cerc-io/ipld-eth-state-snapshot/pkg/snapshot/pg" + snapt "github.com/cerc-io/ipld-eth-state-snapshot/pkg/types" ) func NewPublisher(mode SnapshotMode, config *Config) (snapt.Publisher, error) {