From c9a0227f8df573b699319bd69a00744919803b1e Mon Sep 17 00:00:00 2001 From: violog <51th.apprent1ce.f0rce@gmail.com> Date: Tue, 30 Apr 2024 16:06:56 +0300 Subject: [PATCH] Bump LDIF SDK, fix its function calls in CLI --- go.mod | 2 +- go.sum | 4 ++-- x/cscalist/client/cli/ldif.go | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index ed4044c0..418ef037 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 github.com/rarimo/go-merkle v0.0.0-20231004122345-36fa49031c66 - github.com/rarimo/ldif-sdk v0.4.3-0.20240418104626-798f3cb9706d + github.com/rarimo/ldif-sdk v0.4.5-rc.3 github.com/rs/cors v1.10.1 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 09534faf..4e18ef3f 100644 --- a/go.sum +++ b/go.sum @@ -1414,8 +1414,8 @@ github.com/rarimo/cosmos-sdk v0.46.7 h1:jU2PiWzc+19SF02cXM0O0puKPeH1C6Q6t2lzJ9s1 github.com/rarimo/cosmos-sdk v0.46.7/go.mod h1:fqKqz39U5IlEFb4nbQ72951myztsDzFKKDtffYJ63nk= github.com/rarimo/go-merkle v0.0.0-20231004122345-36fa49031c66 h1:1KAU4rfWWJwAJ/kencagL3k5BXN3HhP004QNkEUgvDE= github.com/rarimo/go-merkle v0.0.0-20231004122345-36fa49031c66/go.mod h1:5Pt9Lk8w7fWhyRO/NMb5x8DRhF2lESRVPT5uOlezInQ= -github.com/rarimo/ldif-sdk v0.4.3-0.20240418104626-798f3cb9706d h1:/WbhRQ86BNR9tVe3PwUB+cSVaDh/YXnmwqqDZJxY2jo= -github.com/rarimo/ldif-sdk v0.4.3-0.20240418104626-798f3cb9706d/go.mod h1:ONLsbueY7tnVHEt/v4jL1f0j0U4/jCfgxFyXI9k8yDo= +github.com/rarimo/ldif-sdk v0.4.5-rc.3 h1:KlS3PBmCG4uWM8jb8qhbw1jovtuJ6hyTY0oRftJYvwA= +github.com/rarimo/ldif-sdk v0.4.5-rc.3/go.mod h1:ONLsbueY7tnVHEt/v4jL1f0j0U4/jCfgxFyXI9k8yDo= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= diff --git a/x/cscalist/client/cli/ldif.go b/x/cscalist/client/cli/ldif.go index ee628d8c..f32dda05 100644 --- a/x/cscalist/client/cli/ldif.go +++ b/x/cscalist/client/cli/ldif.go @@ -99,7 +99,7 @@ automatically, see ldif-tree-diff)`, if err != nil { return fmt.Errorf("build tree: %w", err) } - if _, err = fmt.Fprintln(dst, tree.Root()); err != nil { + if _, err = fmt.Fprintln(dst, hexutil.Encode(tree.Root())); err != nil { return fmt.Errorf("write to destination: %w", err) } @@ -156,12 +156,13 @@ Use cases: return fmt.Errorf("get root node: %w", err) } - if tree.Root() != root.Hash { - fmt.Printf("Trees differ: built_root=%s stored_root=%s\n", tree.Root(), root.Hash) + treeRoot := hexutil.Encode(tree.Root()) + if treeRoot != root.Hash { + fmt.Printf("Trees differ: built_root=%s stored_root=%s\n", treeRoot, root.Hash) return nil } - fmt.Printf("Tree are same: root=%s", tree.Root()) + fmt.Printf("Tree are same: root=%s\n", treeRoot) return nil }, }