From 83dd963ab7b0adcfa9d0beee2d5bb5322ce8364d Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 6 May 2022 23:33:50 +0300 Subject: [PATCH] [#1367] adm: Support homomorphic hashing config in `dump-config` Signed-off-by: Pavel Karpy --- cmd/neofs-adm/internal/modules/morph/dump.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-adm/internal/modules/morph/dump.go b/cmd/neofs-adm/internal/modules/morph/dump.go index 2f8a44037..db0cf5477 100644 --- a/cmd/neofs-adm/internal/modules/morph/dump.go +++ b/cmd/neofs-adm/internal/modules/morph/dump.go @@ -184,7 +184,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { v, err := tuple[1].TryBytes() if err != nil { - return errors.New("invalid config value from netmap contract") + return invalidConfigValueErr(k) } switch string(k) { @@ -199,6 +199,13 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%d (int)\n", k, n))) case netmapEigenTrustAlphaKey: _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (str)\n", k, v))) + case netmapHomomorphicHashDisabledKey: + vBool, err := tuple[1].TryBool() + if err != nil { + return invalidConfigValueErr(k) + } + + _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%t (bool)\n", k, vBool))) default: _, _ = tw.Write([]byte(fmt.Sprintf("%s:\t%s (hex)\n", k, hex.EncodeToString(v)))) } @@ -209,3 +216,7 @@ func dumpNetworkConfig(cmd *cobra.Command, _ []string) error { return nil } + +func invalidConfigValueErr(key []byte) error { + return fmt.Errorf("invalid %s config value from netmap contract", key) +}