From 76459fc2269038960deff627c11cd7996b41426c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 24 May 2024 22:16:51 +0200 Subject: [PATCH] Remove Ensemble dep on Curio --- {itests => curiosrc/itests}/curio_test.go | 4 +- itests/kit/ensemble.go | 71 +++++------------------ itests/kit/ensemble_presets.go | 15 ----- itests/kit/node_full.go | 12 ---- 4 files changed, 16 insertions(+), 86 deletions(-) rename {itests => curiosrc/itests}/curio_test.go (98%) diff --git a/itests/curio_test.go b/curiosrc/itests/curio_test.go similarity index 98% rename from itests/curio_test.go rename to curiosrc/itests/curio_test.go index 6b6b3b8c7..4f92a37c3 100644 --- a/itests/curio_test.go +++ b/curiosrc/itests/curio_test.go @@ -30,8 +30,8 @@ import ( miner2 "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/cli/spcli" - "github.com/filecoin-project/lotus/cmd/curio/rpc" - "github.com/filecoin-project/lotus/cmd/curio/tasks" + "github.com/filecoin-project/lotus/curiosrc/cmd/curio/rpc" + "github.com/filecoin-project/lotus/curiosrc/cmd/curio/tasks" "github.com/filecoin-project/lotus/curiosrc/deps" "github.com/filecoin-project/lotus/curiosrc/ffiselect" "github.com/filecoin-project/lotus/curiosrc/market/lmrpc" diff --git a/itests/kit/ensemble.go b/itests/kit/ensemble.go index 522c055b0..95916fae5 100644 --- a/itests/kit/ensemble.go +++ b/itests/kit/ensemble.go @@ -13,15 +13,6 @@ import ( "testing" "time" - "github.com/google/uuid" - "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/namespace" - libp2pcrypto "github.com/libp2p/go-libp2p/core/crypto" - "github.com/libp2p/go-libp2p/core/peer" - mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" - "github.com/stretchr/testify/require" - "github.com/urfave/cli/v2" - "github.com/filecoin-project/go-address" cborutil "github.com/filecoin-project/go-cbor-util" "github.com/filecoin-project/go-state-types/abi" @@ -32,6 +23,13 @@ import ( "github.com/filecoin-project/go-statestore" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power" + "github.com/google/uuid" + "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore/namespace" + libp2pcrypto "github.com/libp2p/go-libp2p/core/crypto" + "github.com/libp2p/go-libp2p/core/peer" + mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" + "github.com/stretchr/testify/require" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api" @@ -46,11 +44,8 @@ import ( "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet/key" - "github.com/filecoin-project/lotus/cmd/curio/rpc" - "github.com/filecoin-project/lotus/cmd/curio/tasks" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed" "github.com/filecoin-project/lotus/cmd/lotus-worker/sealworker" - "github.com/filecoin-project/lotus/curiosrc/deps" "github.com/filecoin-project/lotus/gateway" "github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/lib/harmony/harmonydb" @@ -124,17 +119,15 @@ type Ensemble struct { options *ensembleOpts inactive struct { - fullnodes []*TestFullNode - providernodes []*TestCurioNode - miners []*TestMiner - workers []*TestWorker + fullnodes []*TestFullNode + miners []*TestMiner + workers []*TestWorker } active struct { - fullnodes []*TestFullNode - providernodes []*TestCurioNode - miners []*TestMiner - workers []*TestWorker - bms map[*TestMiner]*BlockMiner + fullnodes []*TestFullNode + miners []*TestMiner + workers []*TestWorker + bms map[*TestMiner]*BlockMiner } genesis struct { version network.Version @@ -227,20 +220,6 @@ func (n *Ensemble) FullNode(full *TestFullNode, opts ...NodeOpt) *Ensemble { return n } -// FullNode enrolls a new Curio node. -func (n *Ensemble) Curio(cu *TestCurioNode, opts ...NodeOpt) *Ensemble { - options := DefaultNodeOpts - for _, o := range opts { - err := o(&options) - require.NoError(n.t, err) - } - - *cu = TestCurioNode{t: n.t, options: options, Deps: &deps.Deps{}} - - n.inactive.providernodes = append(n.inactive.providernodes, cu) - return n -} - // Miner enrolls a new miner, using the provided full node for chain // interactions. func (n *Ensemble) MinerEnroll(minerNode *TestMiner, full *TestFullNode, opts ...NodeOpt) *Ensemble { @@ -902,28 +881,6 @@ func (n *Ensemble) Start() *Ensemble { // to active, so clear the slice. n.inactive.workers = n.inactive.workers[:0] - for _, p := range n.inactive.providernodes { - - // TODO setup config with options - err := p.Deps.PopulateRemainingDeps(context.Background(), &cli.Context{}, false) - require.NoError(n.t, err) - - shutdownChan := make(chan struct{}) - taskEngine, err := tasks.StartTasks(ctx, p.Deps) - if err != nil { - return nil - } - defer taskEngine.GracefullyTerminate() - - err = rpc.ListenAndServe(ctx, p.Deps, shutdownChan) // Monitor for shutdown. - require.NoError(n.t, err) - finishCh := node.MonitorShutdown(shutdownChan) //node.ShutdownHandler{Component: "rpc server", StopFunc: rpcStopper}, - //node.ShutdownHandler{Component: "provider", StopFunc: stop}, - - <-finishCh - - n.active.providernodes = append(n.active.providernodes, p) - } // --------------------- // MISC // --------------------- diff --git a/itests/kit/ensemble_presets.go b/itests/kit/ensemble_presets.go index 10a83be7d..3ec39cf90 100644 --- a/itests/kit/ensemble_presets.go +++ b/itests/kit/ensemble_presets.go @@ -101,21 +101,6 @@ func EnsembleOneTwo(t *testing.T, opts ...interface{}) (*TestFullNode, *TestMine return &full, &one, &two, ens } -// EnsembleProvider creates and starts an Ensemble with a single full node and a single Curio. -// It does not interconnect nodes nor does it begin mining. -func EnsembleProvider(t *testing.T, opts ...interface{}) (*TestFullNode, *TestCurioNode, *Ensemble) { - opts = append(opts, WithAllSubsystems()) - - eopts, nopts := siftOptions(t, opts) - - var ( - full TestFullNode - provider TestCurioNode - ) - ens := NewEnsemble(t, eopts...).FullNode(&full, nopts...).Curio(&provider, nopts...).Start() - return &full, &provider, ens -} - func siftOptions(t *testing.T, opts []interface{}) (eopts []EnsembleOpt, nopts []NodeOpt) { for _, v := range opts { switch o := v.(type) { diff --git a/itests/kit/node_full.go b/itests/kit/node_full.go index 62a92c06f..3e80ed688 100644 --- a/itests/kit/node_full.go +++ b/itests/kit/node_full.go @@ -22,7 +22,6 @@ import ( "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet/key" cliutil "github.com/filecoin-project/lotus/cli/util" - "github.com/filecoin-project/lotus/curiosrc/deps" "github.com/filecoin-project/lotus/gateway" "github.com/filecoin-project/lotus/node" ) @@ -55,17 +54,6 @@ type TestFullNode struct { options nodeOpts } -// TestCurioNode represents a Curio node enrolled in an Ensemble. -type TestCurioNode struct { - v1api.CurioStruct - - t *testing.T - - *deps.Deps - - options nodeOpts -} - func MergeFullNodes(fullNodes []*TestFullNode) *TestFullNode { var wrappedFullNode TestFullNode var fns api.FullNodeStruct