From 7cf0093012b9d581819aed252a18f1cc93b86447 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 31 May 2021 16:04:39 +0300 Subject: [PATCH] [#496] pkg/innerring: remove unused processor parameters Signed-off-by: Evgenii Stratonikov --- pkg/innerring/innerring.go | 7 ------- pkg/innerring/processors/audit/processor.go | 14 -------------- pkg/innerring/processors/container/processor.go | 12 ------------ pkg/innerring/processors/neofs/processor.go | 7 ------- pkg/innerring/processors/netmap/processor.go | 9 --------- 5 files changed, 49 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 78c955e72..150fb3ab2 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -460,10 +460,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, NetmapClient: server.netmapClient, ContainerClient: cnrClient, - AuditContract: server.contracts.audit, - MorphClient: server.morphClient, IRList: server, - FeeProvider: server.feeConfig, ClientCache: clientCache, Key: &server.key.PrivateKey, RPCSearchTimeout: cfg.GetDuration("audit.timeout.search"), @@ -573,7 +570,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error ), AlphabetSyncHandler: alphaSync, NodeValidator: locodeValidator, - FeeProvider: server.feeConfig, }) if err != nil { return nil, err @@ -589,9 +585,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error Log: log, PoolSize: cfg.GetInt("workers.container"), ContainerContract: server.contracts.container, - MorphClient: server.morphClient, AlphabetState: server, - FeeProvider: server.feeConfig, ContainerClient: cnrClient, NeoFSIDClient: neofsIDClient, NetworkState: server.netmapClient, @@ -637,7 +631,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error EpochState: server, AlphabetState: server, Converter: &server.precision, - FeeProvider: server.feeConfig, MintEmitCacheSize: cfg.GetInt("emit.mint.cache_size"), MintEmitThreshold: cfg.GetUint64("emit.mint.threshold"), MintEmitValue: fixedn.Fixed8(cfg.GetInt64("emit.mint.value")), diff --git a/pkg/innerring/processors/audit/processor.go b/pkg/innerring/processors/audit/processor.go index 04ff912d4..7244d74d2 100644 --- a/pkg/innerring/processors/audit/processor.go +++ b/pkg/innerring/processors/audit/processor.go @@ -7,10 +7,7 @@ import ( "fmt" "time" - "github.com/nspcc-dev/neo-go/pkg/util" SDKClient "github.com/nspcc-dev/neofs-api-go/pkg/client" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" wrapContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" wrapNetmap "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -44,8 +41,6 @@ type ( Processor struct { log *zap.Logger pool *ants.Pool - auditContract util.Uint160 - morphClient *client.Client irList Indexer clientCache NeoFSClientCache key *ecdsa.PrivateKey @@ -64,10 +59,7 @@ type ( Log *zap.Logger NetmapClient *wrapNetmap.Wrapper ContainerClient *wrapContainer.Wrapper - AuditContract util.Uint160 - MorphClient *client.Client IRList Indexer - FeeProvider *config.FeeConfig ClientCache NeoFSClientCache RPCSearchTimeout time.Duration TaskManager TaskManager @@ -92,12 +84,8 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/audit: logger is not set") - case p.MorphClient == nil: - return nil, errors.New("ir/audit: neo:morph client is not set") case p.IRList == nil: return nil, errors.New("ir/audit: global state is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/audit: fee provider is not set") case p.ClientCache == nil: return nil, errors.New("ir/audit: neofs RPC client cache is not set") case p.TaskManager == nil: @@ -117,8 +105,6 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, containerClient: p.ContainerClient, - auditContract: p.AuditContract, - morphClient: p.MorphClient, irList: p.IRList, clientCache: p.ClientCache, key: p.Key, diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index dcee3ae2e..c0bbf5399 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -5,8 +5,6 @@ import ( "fmt" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" - "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -26,9 +24,7 @@ type ( log *zap.Logger pool *ants.Pool containerContract util.Uint160 - morphClient *client.Client alphabetState AlphabetState - feeProvider *config.FeeConfig cnrClient *wrapper.Wrapper // notary must be enabled idClient *neofsid.ClientWrapper netState NetworkState @@ -39,9 +35,7 @@ type ( Log *zap.Logger PoolSize int ContainerContract util.Uint160 - MorphClient *client.Client AlphabetState AlphabetState - FeeProvider *config.FeeConfig ContainerClient *wrapper.Wrapper NeoFSIDClient *neofsid.ClientWrapper NetworkState NetworkState @@ -70,12 +64,8 @@ func New(p *Params) (*Processor, error) { switch { case p.Log == nil: return nil, errors.New("ir/container: logger is not set") - case p.MorphClient == nil: - return nil, errors.New("ir/container: neo:morph client is not set") case p.AlphabetState == nil: return nil, errors.New("ir/container: global state is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/container: fee provider is not set") case p.ContainerClient == nil: return nil, errors.New("ir/container: Container client is not set") case p.NeoFSIDClient == nil: @@ -95,9 +85,7 @@ func New(p *Params) (*Processor, error) { log: p.Log, pool: pool, containerContract: p.ContainerContract, - morphClient: p.MorphClient, alphabetState: p.AlphabetState, - feeProvider: p.FeeProvider, cnrClient: p.ContainerClient, idClient: p.NeoFSIDClient, netState: p.NetworkState, diff --git a/pkg/innerring/processors/neofs/processor.go b/pkg/innerring/processors/neofs/processor.go index 47aa84bf3..0b97e4f92 100644 --- a/pkg/innerring/processors/neofs/processor.go +++ b/pkg/innerring/processors/neofs/processor.go @@ -8,7 +8,6 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/util" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" @@ -40,14 +39,12 @@ type ( log *zap.Logger pool *ants.Pool neofsContract util.Uint160 - neofsIDContract util.Uint160 balanceClient *balanceWrapper.Wrapper netmapClient *nmWrapper.Wrapper morphClient *client.Client epochState EpochState alphabetState AlphabetState converter PrecisionConverter - feeProvider *config.FeeConfig mintEmitLock *sync.Mutex mintEmitCache *lru.Cache mintEmitThreshold uint64 @@ -69,7 +66,6 @@ type ( EpochState EpochState AlphabetState AlphabetState Converter PrecisionConverter - FeeProvider *config.FeeConfig MintEmitCacheSize int MintEmitThreshold uint64 // in epochs MintEmitValue fixedn.Fixed8 @@ -99,8 +95,6 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/neofs: global state is not set") case p.Converter == nil: return nil, errors.New("ir/neofs: balance precision converter is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/neofs: fee provider is not set") } p.Log.Debug("neofs worker pool", zap.Int("size", p.PoolSize)) @@ -125,7 +119,6 @@ func New(p *Params) (*Processor, error) { epochState: p.EpochState, alphabetState: p.AlphabetState, converter: p.Converter, - feeProvider: p.FeeProvider, mintEmitLock: new(sync.Mutex), mintEmitCache: lruCache, mintEmitThreshold: p.MintEmitThreshold, diff --git a/pkg/innerring/processors/netmap/processor.go b/pkg/innerring/processors/netmap/processor.go index 9e865d332..922433f1c 100644 --- a/pkg/innerring/processors/netmap/processor.go +++ b/pkg/innerring/processors/netmap/processor.go @@ -6,7 +6,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" - "github.com/nspcc-dev/neofs-node/pkg/innerring/config" container "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -67,8 +66,6 @@ type ( handleAlphabetSync event.Handler nodeValidator NodeValidator - - feeProvider *config.FeeConfig } // Params of the processor constructor. @@ -90,8 +87,6 @@ type ( AlphabetSyncHandler event.Handler NodeValidator NodeValidator - - FeeProvider *config.FeeConfig } ) @@ -122,8 +117,6 @@ func New(p *Params) (*Processor, error) { return nil, errors.New("ir/netmap: container contract wrapper is not set") case p.NodeValidator == nil: return nil, errors.New("ir/netmap: node validator is not set") - case p.FeeProvider == nil: - return nil, errors.New("ir/netmap: fee provider is not set") } p.Log.Debug("netmap worker pool", zap.Int("size", p.PoolSize)) @@ -150,8 +143,6 @@ func New(p *Params) (*Processor, error) { handleAlphabetSync: p.AlphabetSyncHandler, nodeValidator: p.NodeValidator, - - feeProvider: p.FeeProvider, }, nil }