From bd6d5e7f7b9b95217981539701ab7cc6dd772082 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Thu, 6 May 2021 00:03:07 +0300 Subject: [PATCH] [#504] reputation/intermediate: Add reading `alpha` from global cfg Signed-off-by: Pavel Karpy --- cmd/neofs-node/reputation.go | 6 +----- cmd/neofs-node/reputation/intermediate/calculator.go | 10 ---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/cmd/neofs-node/reputation.go b/cmd/neofs-node/reputation.go index fe594720..880fc0d5 100644 --- a/cmd/neofs-node/reputation.go +++ b/cmd/neofs-node/reputation.go @@ -37,8 +37,6 @@ import ( "go.uber.org/zap" ) -const EigenTrustAlpha = 0.1 - func initReputationService(c *cfg) { staticClient, err := client.NewStatic( c.cfgMorph.client, @@ -149,9 +147,7 @@ func initReputationService(c *cfg) { eigenTrustCalculator := eigentrustcalc.New( eigentrustcalc.Prm{ - AlphaProvider: intermediate.AlphaProvider{ - Alpha: EigenTrustAlpha, - }, + AlphaProvider: c.cfgNetmap.wrapper, InitialTrustSource: intermediatereputation.InitialTrustSource{ NetMap: nmSrc, }, diff --git a/cmd/neofs-node/reputation/intermediate/calculator.go b/cmd/neofs-node/reputation/intermediate/calculator.go index a5929353..9b7d58a6 100644 --- a/cmd/neofs-node/reputation/intermediate/calculator.go +++ b/cmd/neofs-node/reputation/intermediate/calculator.go @@ -53,13 +53,3 @@ func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext c.Calculator.Calculate(calcPrm) } - -// AlphaProvider provides required alpha parameter of eigen trust algorithm. -// TODO: decide if `Alpha` should be dynamically read from global config. #497 -type AlphaProvider struct { - Alpha float64 -} - -func (ap AlphaProvider) EigenTrustAlpha() (float64, error) { - return ap.Alpha, nil -}