From fc86ac434aa432f18e9dc312762bbaabde72308e Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Tue, 20 Dec 2022 14:44:19 +0900 Subject: [PATCH 1/2] feat: add PathEscape to GetStoreData key --- panacea/query_client.go | 4 +++- panacea/tx.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/panacea/query_client.go b/panacea/query_client.go index 6ed5112..40debd9 100644 --- a/panacea/query_client.go +++ b/panacea/query_client.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "errors" "fmt" + "net/url" "os" "strings" "sync" @@ -297,7 +298,8 @@ func (q verifiedQueryClient) GetStoreData(ctx context.Context, storeKey string, sdkSpecs := []*ics23.ProofSpec{ics23.IavlSpec, ics23.TendermintSpec} merkleRootKey := types.NewMerkleRoot(nextTrustedBlock.AppHash.Bytes()) - merklePath := types.NewMerklePath(storeKey, string(key)) + ketPath := url.PathEscape(string(key)) + merklePath := types.NewMerklePath(storeKey, ketPath) err = merkleProof.VerifyMembership(sdkSpecs, merkleRootKey, merklePath, result.Response.Value) if err != nil { return nil, err diff --git a/panacea/tx.go b/panacea/tx.go index 59ad5f7..1ce39be 100644 --- a/panacea/tx.go +++ b/panacea/tx.go @@ -1,6 +1,8 @@ package panacea import ( + "fmt" + clienttx "github.com/cosmos/cosmos-sdk/client/tx" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -58,7 +60,7 @@ func (tb TxBuilder) GenerateSignedTxBytes( signerAccount, err := tb.client.GetAccount(signerAddress) if err != nil { - return nil, err + return nil, fmt.Errorf("can not get signer account from address(%s): %w", signerAddress, err) } sigV2 := signing.SignatureV2{ From cded942f30f02b24cca12783663ed33166bee300 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Tue, 20 Dec 2022 15:56:13 +0900 Subject: [PATCH 2/2] fix --- panacea/query_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panacea/query_client.go b/panacea/query_client.go index 40debd9..e66aa5e 100644 --- a/panacea/query_client.go +++ b/panacea/query_client.go @@ -298,8 +298,8 @@ func (q verifiedQueryClient) GetStoreData(ctx context.Context, storeKey string, sdkSpecs := []*ics23.ProofSpec{ics23.IavlSpec, ics23.TendermintSpec} merkleRootKey := types.NewMerkleRoot(nextTrustedBlock.AppHash.Bytes()) - ketPath := url.PathEscape(string(key)) - merklePath := types.NewMerklePath(storeKey, ketPath) + keyPath := url.PathEscape(string(key)) + merklePath := types.NewMerklePath(storeKey, keyPath) err = merkleProof.VerifyMembership(sdkSpecs, merkleRootKey, merklePath, result.Response.Value) if err != nil { return nil, err