From d8e47e60a7b5bc5991080995f377add8a3ff4111 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 3 Aug 2021 20:57:47 +0300 Subject: [PATCH] [#738] neofs-adm: Use constants and reduce code in dump-config Signed-off-by: Alex Vanin --- cmd/neofs-adm/internal/modules/morph/dump.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/dump.go b/cmd/neofs-adm/internal/modules/morph/dump.go index 986dbea33b..4b98ef27eb 100644 --- a/cmd/neofs-adm/internal/modules/morph/dump.go +++ b/cmd/neofs-adm/internal/modules/morph/dump.go @@ -133,10 +133,8 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { return fmt.Errorf("invalid response from NNS contract: %w", err) } - res, err = wCtx.Client.InvokeFunction(nmHash, "listConfig", []smartcontract.Parameter{}, []transaction.Signer{{ - Account: wCtx.CommitteeAcc.Contract.ScriptHash(), - Scopes: transaction.Global, - }}) + res, err = wCtx.Client.InvokeFunction(nmHash, "listConfig", + []smartcontract.Parameter{}, []transaction.Signer{{}}) 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") } @@ -166,13 +164,15 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { } switch string(k) { - case "AuditFee", "BasicIncomeRate", "ContainerFee", "EigenTrustIterations", - "EpochDuration", "InnerRingCandidateFee", "MaxObjectSize", "WithdrawFee": + case netmapAuditFeeKey, netmapBasicIncomeRateKey, + netmapContainerFeeKey, netmapEigenTrustIterationsKey, + netmapEpochKey, netmapInnerRingCandidateFeeKey, + netmapMaxObjectSizeKey, netmapWithdrawFeeKey: nbuf := make([]byte, 8) copy(nbuf[:], v) n := binary.LittleEndian.Uint64(nbuf) _, _ = 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))) default: _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (hex)\n", k, hex.EncodeToString(v))))