diff --git a/itests/kit/ensemble.go b/itests/kit/ensemble.go index afbc1b171ad..1f0df3da75d 100644 --- a/itests/kit/ensemble.go +++ b/itests/kit/ensemble.go @@ -52,7 +52,6 @@ import ( "github.com/filecoin-project/lotus/cmd/lotus-worker/sealworker" "github.com/filecoin-project/lotus/gateway" "github.com/filecoin-project/lotus/genesis" - "github.com/filecoin-project/lotus/lib/harmony/harmonydb" lotusminer "github.com/filecoin-project/lotus/miner" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/config" @@ -374,8 +373,6 @@ func (n *Ensemble) Start() *Ensemble { n.mn = mocknet.New() } - sharedITestID := harmonydb.ITestNewID() - // --------------------- // FULL NODES // --------------------- @@ -620,7 +617,6 @@ func (n *Ensemble) Start() *Ensemble { cfg.Subsystems.EnableMining = m.options.subsystems.Has(SMining) cfg.Subsystems.EnableSealing = m.options.subsystems.Has(SSealing) cfg.Subsystems.EnableSectorStorage = m.options.subsystems.Has(SSectorStorage) - cfg.Subsystems.EnableSectorIndexDB = m.options.subsystems.Has(SHarmony) if m.options.mainMiner != nil { token, err := m.options.mainMiner.FullNode.AuthNew(ctx, api.AllPermissions) @@ -737,17 +733,6 @@ func (n *Ensemble) Start() *Ensemble { // upgrades node.Override(new(stmgr.UpgradeSchedule), n.options.upgradeSchedule), - - node.Override(new(harmonydb.ITestID), sharedITestID), - node.Override(new(config.HarmonyDB), func() config.HarmonyDB { - return config.HarmonyDB{ - Hosts: []string{envElse("LOTUS_HARMONYDB_HOSTS", "127.0.0.1")}, - Database: "yugabyte", - Username: "yugabyte", - Password: "yugabyte", - Port: "5433", - } - }), } // append any node builder options. opts = append(opts, m.options.extraNodeOpts...) @@ -917,8 +902,6 @@ func (n *Ensemble) Start() *Ensemble { auth := http.Header(nil) - // FUTURE: Use m.MinerNode.(BaseAPI).(impl.StorageMinerAPI).HarmonyDB to setup. - remote := paths.NewRemote(localStore, m.MinerNode, auth, 20, &paths.DefaultPartialFileHandler{}) store := m.options.workerStorageOpt(remote) @@ -1156,10 +1139,3 @@ func importPreSealMeta(ctx context.Context, meta genesis.Miner, mds dtypes.Metad size := binary.PutUvarint(buf, uint64(maxSectorID)) return mds.Put(ctx, datastore.NewKey(pipeline.StorageCounterDSPrefix), buf[:size]) } - -func envElse(env, els string) string { - if v := os.Getenv(env); v != "" { - return v - } - return els -} diff --git a/itests/kit/node_miner.go b/itests/kit/node_miner.go index dda9d22427c..18b01bf8f20 100644 --- a/itests/kit/node_miner.go +++ b/itests/kit/node_miner.go @@ -36,9 +36,7 @@ const ( SSealing SSectorStorage - SHarmony - - MinerSubsystems = iota + MinerSubsystems = 0 ) func (ms MinerSubsystem) Add(single MinerSubsystem) MinerSubsystem { diff --git a/itests/kit/node_opts.go b/itests/kit/node_opts.go index 246240a2620..f00f0910825 100644 --- a/itests/kit/node_opts.go +++ b/itests/kit/node_opts.go @@ -92,13 +92,6 @@ func WithAllSubsystems() NodeOpt { } } -func WithSectorIndexDB() NodeOpt { - return func(opts *nodeOpts) error { - opts.subsystems = opts.subsystems.Add(SHarmony) - return nil - } -} - func WithSubsystems(systems ...MinerSubsystem) NodeOpt { return func(opts *nodeOpts) error { for _, s := range systems { diff --git a/lib/harmony/harmonydb/harmonydb.go b/lib/harmony/harmonydb/harmonydb.go index e0e73c8e617..fe31d8da78a 100644 --- a/lib/harmony/harmonydb/harmonydb.go +++ b/lib/harmony/harmonydb/harmonydb.go @@ -4,11 +4,9 @@ import ( "context" "embed" "fmt" - "math/rand" "net" "regexp" "sort" - "strconv" "strings" "sync" "sync/atomic" @@ -23,13 +21,6 @@ import ( "github.com/filecoin-project/lotus/node/config" ) -type ITestID string - -// ITestNewID see ITestWithID doc -func ITestNewID() ITestID { - return ITestID(strconv.Itoa(rand.Intn(99999))) -} - type DB struct { pgx *pgxpool.Pool cfg *pgxpool.Config @@ -52,28 +43,13 @@ func NewFromConfig(cfg config.HarmonyDB) (*DB, error) { cfg.Password, cfg.Database, cfg.Port, - "", ) } -func NewFromConfigWithITestID(cfg config.HarmonyDB) func(id ITestID) (*DB, error) { - return func(id ITestID) (*DB, error) { - return New( - cfg.Hosts, - cfg.Username, - cfg.Password, - cfg.Database, - cfg.Port, - id, - ) - } -} - // New is to be called once per binary to establish the pool. // log() is for errors. It returns an upgraded database's connection. // This entry point serves both production and integration tests, so it's more DI. -func New(hosts []string, username, password, database, port string, itestID ITestID) (*DB, error) { - itest := string(itestID) +func New(hosts []string, username, password, database, port string) (*DB, error) { connString := "" if len(hosts) > 0 { connString = "host=" + hosts[0] + " " @@ -85,9 +61,6 @@ func New(hosts []string, username, password, database, port string, itestID ITes } schema := "curio" - if itest != "" { - schema = "itest_" + itest - } if err := ensureSchemaExists(connString, schema); err != nil { return nil, err diff --git a/node/builder_miner.go b/node/builder_miner.go index c302e2f5feb..beb838311f3 100644 --- a/node/builder_miner.go +++ b/node/builder_miner.go @@ -107,8 +107,8 @@ func ConfigStorageMiner(c interface{}) Option { Override(new(paths.SectorIndex), From(new(*paths.DBIndex))), // sector index db is the only thing on lotus-miner that will use harmonydb - Override(new(*harmonydb.DB), func(cfg config.HarmonyDB, id harmonydb.ITestID) (*harmonydb.DB, error) { - return harmonydb.NewFromConfigWithITestID(cfg)(id) + Override(new(*harmonydb.DB), func(cfg config.HarmonyDB) (*harmonydb.DB, error) { + return harmonydb.NewFromConfig(cfg) }), ), If(!cfg.Subsystems.EnableSectorIndexDB, @@ -136,7 +136,6 @@ func ConfigStorageMiner(c interface{}) Option { Override(new(config.SealerConfig), cfg.Storage), Override(new(config.ProvingConfig), cfg.Proving), Override(new(config.HarmonyDB), cfg.HarmonyDB), - Override(new(harmonydb.ITestID), harmonydb.ITestID("")), Override(new(*ctladdr.AddressSelector), modules.AddressSelector(&cfg.Addresses)), If(build.IsF3Enabled(), Override(F3Participation, modules.F3Participation)), ) diff --git a/node/config/def_test.go b/node/config/def_test.go index 2edcce2b59f..0d7639f58fe 100644 --- a/node/config/def_test.go +++ b/node/config/def_test.go @@ -69,13 +69,5 @@ func TestDefaultMinerRoundtrip(t *testing.T) { c2, err := FromReader(strings.NewReader(s), DefaultStorageMiner()) require.NoError(t, err) - fmt.Println(s) - - // Differs between test envs - c.HarmonyDB = HarmonyDB{} - c2.(*StorageMiner).HarmonyDB = HarmonyDB{} - - fmt.Println(c) - fmt.Println(c2) require.True(t, reflect.DeepEqual(c, c2)) }