[#247] network_config: Drop reputation

Drop the code that was expected to work with global reputation network
parameters.

Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
Pavel Karpy 2023-04-14 14:51:13 +03:00
parent b453bb754c
commit beabed788c
6 changed files with 0 additions and 60 deletions

View file

@ -56,15 +56,12 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
switch k { switch k {
case netmap.AuditFeeConfig, netmap.BasicIncomeRateConfig, case netmap.AuditFeeConfig, netmap.BasicIncomeRateConfig,
netmap.ContainerFeeConfig, netmap.ContainerAliasFeeConfig, netmap.ContainerFeeConfig, netmap.ContainerAliasFeeConfig,
netmap.EtIterationsConfig,
netmap.EpochDurationConfig, netmap.IrCandidateFeeConfig, netmap.EpochDurationConfig, netmap.IrCandidateFeeConfig,
netmap.MaxObjectSizeConfig, netmap.WithdrawFeeConfig: netmap.MaxObjectSizeConfig, netmap.WithdrawFeeConfig:
nbuf := make([]byte, 8) nbuf := make([]byte, 8)
copy(nbuf[:], v) copy(nbuf[:], v)
n := binary.LittleEndian.Uint64(nbuf) n := binary.LittleEndian.Uint64(nbuf)
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%d (int)\n", k, n))) _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%d (int)\n", k, n)))
case netmap.EtAlphaConfig:
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (str)\n", k, v)))
case netmap.HomomorphicHashingDisabledKey, netmap.MaintenanceModeAllowedConfig: case netmap.HomomorphicHashingDisabledKey, netmap.MaintenanceModeAllowedConfig:
if len(v) == 0 || len(v) > 1 { if len(v) == 0 || len(v) > 1 {
return invalidConfigValueErr(k) return invalidConfigValueErr(k)
@ -139,22 +136,12 @@ func parseConfigPair(kvStr string, force bool) (key string, val any, err error)
switch key { switch key {
case netmap.AuditFeeConfig, netmap.BasicIncomeRateConfig, case netmap.AuditFeeConfig, netmap.BasicIncomeRateConfig,
netmap.ContainerFeeConfig, netmap.ContainerAliasFeeConfig, netmap.ContainerFeeConfig, netmap.ContainerAliasFeeConfig,
netmap.EtIterationsConfig,
netmap.EpochDurationConfig, netmap.IrCandidateFeeConfig, netmap.EpochDurationConfig, netmap.IrCandidateFeeConfig,
netmap.MaxObjectSizeConfig, netmap.WithdrawFeeConfig: netmap.MaxObjectSizeConfig, netmap.WithdrawFeeConfig:
val, err = strconv.ParseInt(valRaw, 10, 64) val, err = strconv.ParseInt(valRaw, 10, 64)
if err != nil { if err != nil {
err = fmt.Errorf("could not parse %s's value '%s' as int: %w", key, valRaw, err) err = fmt.Errorf("could not parse %s's value '%s' as int: %w", key, valRaw, err)
} }
case netmap.EtAlphaConfig:
// just check that it could
// be parsed correctly
_, err = strconv.ParseFloat(v, 64)
if err != nil {
err = fmt.Errorf("could not parse %s's value '%s' as float: %w", key, valRaw, err)
}
val = valRaw
case netmap.HomomorphicHashingDisabledKey, netmap.MaintenanceModeAllowedConfig: case netmap.HomomorphicHashingDisabledKey, netmap.MaintenanceModeAllowedConfig:
val, err = strconv.ParseBool(valRaw) val, err = strconv.ParseBool(valRaw)
if err != nil { if err != nil {

View file

@ -50,11 +50,6 @@ const (
subnetContract = "subnet" subnetContract = "subnet"
) )
const (
defaultEigenTrustIterations = 4
defaultEigenTrustAlpha = "0.1"
)
var ( var (
contractList = []string{ contractList = []string{
auditContract, auditContract,

View file

@ -15,8 +15,6 @@ func getDefaultNetmapContractConfigMap() map[string]any {
m[netmap.AuditFeeConfig] = viper.GetInt64(auditFeeInitFlag) m[netmap.AuditFeeConfig] = viper.GetInt64(auditFeeInitFlag)
m[netmap.ContainerFeeConfig] = viper.GetInt64(containerFeeInitFlag) m[netmap.ContainerFeeConfig] = viper.GetInt64(containerFeeInitFlag)
m[netmap.ContainerAliasFeeConfig] = viper.GetInt64(containerAliasFeeInitFlag) m[netmap.ContainerAliasFeeConfig] = viper.GetInt64(containerAliasFeeInitFlag)
m[netmap.EtIterationsConfig] = int64(defaultEigenTrustIterations)
m[netmap.EtAlphaConfig] = defaultEigenTrustAlpha
m[netmap.BasicIncomeRateConfig] = viper.GetInt64(incomeRateInitFlag) m[netmap.BasicIncomeRateConfig] = viper.GetInt64(incomeRateInitFlag)
m[netmap.IrCandidateFeeConfig] = viper.GetInt64(candidateFeeInitFlag) m[netmap.IrCandidateFeeConfig] = viper.GetInt64(candidateFeeInitFlag)
m[netmap.WithdrawFeeConfig] = viper.GetInt64(withdrawFeeInitFlag) m[netmap.WithdrawFeeConfig] = viper.GetInt64(withdrawFeeInitFlag)

View file

@ -41,8 +41,6 @@ var netInfoCmd = &cobra.Command{
cmd.Printf(format, "Audit fee", netInfo.AuditFee()) cmd.Printf(format, "Audit fee", netInfo.AuditFee())
cmd.Printf(format, "Storage price", netInfo.StoragePrice()) cmd.Printf(format, "Storage price", netInfo.StoragePrice())
cmd.Printf(format, "Container fee", netInfo.ContainerFee()) cmd.Printf(format, "Container fee", netInfo.ContainerFee())
cmd.Printf(format, "EigenTrust alpha", netInfo.EigenTrustAlpha())
cmd.Printf(format, "Number of EigenTrust iterations", netInfo.NumberOfEigenTrustIterations())
cmd.Printf(format, "Epoch duration", netInfo.EpochDuration()) cmd.Printf(format, "Epoch duration", netInfo.EpochDuration())
cmd.Printf(format, "Inner Ring candidate fee", netInfo.IRCandidateFee()) cmd.Printf(format, "Inner Ring candidate fee", netInfo.IRCandidateFee())
cmd.Printf(format, "Maximum object size", netInfo.MaxObjectSize()) cmd.Printf(format, "Maximum object size", netInfo.MaxObjectSize())

View file

@ -451,8 +451,6 @@ func (n *netInfo) Dump(ver version.Version) (*netmapSDK.NetworkInfo, error) {
ni.SetEpochDuration(netInfoMorph.EpochDuration) ni.SetEpochDuration(netInfoMorph.EpochDuration)
ni.SetContainerFee(netInfoMorph.ContainerFee) ni.SetContainerFee(netInfoMorph.ContainerFee)
ni.SetNamedContainerFee(netInfoMorph.ContainerAliasFee) ni.SetNamedContainerFee(netInfoMorph.ContainerAliasFee)
ni.SetNumberOfEigenTrustIterations(netInfoMorph.EigenTrustIterations)
ni.SetEigenTrustAlpha(netInfoMorph.EigenTrustAlpha)
ni.SetIRCandidateFee(netInfoMorph.IRCandidateFee) ni.SetIRCandidateFee(netInfoMorph.IRCandidateFee)
ni.SetWithdrawalFee(netInfoMorph.WithdrawalFee) ni.SetWithdrawalFee(netInfoMorph.WithdrawalFee)

View file

@ -3,7 +3,6 @@ package netmap
import ( import (
"errors" "errors"
"fmt" "fmt"
"strconv"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint" "github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
@ -17,8 +16,6 @@ const (
EpochDurationConfig = "EpochDuration" EpochDurationConfig = "EpochDuration"
ContainerFeeConfig = "ContainerFee" ContainerFeeConfig = "ContainerFee"
ContainerAliasFeeConfig = "ContainerAliasFee" ContainerAliasFeeConfig = "ContainerAliasFee"
EtIterationsConfig = "EigenTrustIterations"
EtAlphaConfig = "EigenTrustAlpha"
IrCandidateFeeConfig = "InnerRingCandidateFee" IrCandidateFeeConfig = "InnerRingCandidateFee"
WithdrawFeeConfig = "WithdrawFee" WithdrawFeeConfig = "WithdrawFee"
HomomorphicHashingDisabledKey = "HomomorphicHashingDisabled" HomomorphicHashingDisabledKey = "HomomorphicHashingDisabled"
@ -90,28 +87,6 @@ func (c *Client) ContainerAliasFee() (uint64, error) {
return fee, nil return fee, nil
} }
// EigenTrustIterations returns global configuration value of iteration cycles
// for EigenTrust algorithm per epoch.
func (c *Client) EigenTrustIterations() (uint64, error) {
iterations, err := c.readUInt64Config(EtIterationsConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get eigen trust iterations: %w", c, err)
}
return iterations, nil
}
// EigenTrustAlpha returns global configuration value of alpha parameter.
// It receives the alpha as a string and tries to convert it to float.
func (c *Client) EigenTrustAlpha() (float64, error) {
strAlpha, err := c.readStringConfig(EtAlphaConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get eigen trust alpha: %w", c, err)
}
return strconv.ParseFloat(strAlpha, 64)
}
// HomomorphicHashDisabled returns global configuration value of homomorphic hashing // HomomorphicHashDisabled returns global configuration value of homomorphic hashing
// settings. // settings.
// //
@ -246,10 +221,6 @@ type NetworkConfiguration struct {
ContainerAliasFee uint64 ContainerAliasFee uint64
EigenTrustIterations uint64
EigenTrustAlpha float64
IRCandidateFee uint64 IRCandidateFee uint64
WithdrawalFee uint64 WithdrawalFee uint64
@ -311,13 +282,6 @@ func (c *Client) ReadNetworkConfiguration() (NetworkConfiguration, error) {
res.ContainerFee = bytesToUint64(value) res.ContainerFee = bytesToUint64(value)
case ContainerAliasFeeConfig: case ContainerAliasFeeConfig:
res.ContainerAliasFee = bytesToUint64(value) res.ContainerAliasFee = bytesToUint64(value)
case EtIterationsConfig:
res.EigenTrustIterations = bytesToUint64(value)
case EtAlphaConfig:
res.EigenTrustAlpha, err = strconv.ParseFloat(string(value), 64)
if err != nil {
return fmt.Errorf("invalid prm %s: %v", EtAlphaConfig, err)
}
case IrCandidateFeeConfig: case IrCandidateFeeConfig:
res.IRCandidateFee = bytesToUint64(value) res.IRCandidateFee = bytesToUint64(value)
case WithdrawFeeConfig: case WithdrawFeeConfig: