forked from TrueCloudLab/frostfs-node
[#738] neofs-adm: Use constants and reduce code in dump-config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
ddbfb09560
commit
d8e47e60a7
1 changed files with 7 additions and 7 deletions
|
@ -133,10 +133,8 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
|
||||||
return fmt.Errorf("invalid response from NNS contract: %w", err)
|
return fmt.Errorf("invalid response from NNS contract: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err = wCtx.Client.InvokeFunction(nmHash, "listConfig", []smartcontract.Parameter{}, []transaction.Signer{{
|
res, err = wCtx.Client.InvokeFunction(nmHash, "listConfig",
|
||||||
Account: wCtx.CommitteeAcc.Contract.ScriptHash(),
|
[]smartcontract.Parameter{}, []transaction.Signer{{}})
|
||||||
Scopes: transaction.Global,
|
|
||||||
}})
|
|
||||||
if err != nil || res.State != vm.HaltState.String() || len(res.Stack) == 0 {
|
if err != nil || res.State != vm.HaltState.String() || len(res.Stack) == 0 {
|
||||||
return errors.New("can't fetch list of network config keys from the netmap contract")
|
return errors.New("can't fetch list of network config keys from the netmap contract")
|
||||||
}
|
}
|
||||||
|
@ -166,13 +164,15 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch string(k) {
|
switch string(k) {
|
||||||
case "AuditFee", "BasicIncomeRate", "ContainerFee", "EigenTrustIterations",
|
case netmapAuditFeeKey, netmapBasicIncomeRateKey,
|
||||||
"EpochDuration", "InnerRingCandidateFee", "MaxObjectSize", "WithdrawFee":
|
netmapContainerFeeKey, netmapEigenTrustIterationsKey,
|
||||||
|
netmapEpochKey, netmapInnerRingCandidateFeeKey,
|
||||||
|
netmapMaxObjectSizeKey, netmapWithdrawFeeKey:
|
||||||
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 "EigenTrustAlpha":
|
case netmapEigenTrustAlphaKey:
|
||||||
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (str)\n", k, v)))
|
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (str)\n", k, v)))
|
||||||
default:
|
default:
|
||||||
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (hex)\n", k, hex.EncodeToString(v))))
|
_, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (hex)\n", k, hex.EncodeToString(v))))
|
||||||
|
|
Loading…
Reference in a new issue