From 5015c46e0666da26069e93ef1f841fb128fc3022 Mon Sep 17 00:00:00 2001 From: Aditya Sripal Date: Thu, 19 Jul 2018 11:35:31 -0700 Subject: [PATCH] revert change to queryApp encoding --- baseapp/baseapp.go | 8 ++------ baseapp/baseapp_test.go | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index fa419be2a4..c3ab5e4dbc 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -1,7 +1,6 @@ package baseapp import ( - "encoding/json" "fmt" "io" "runtime/debug" @@ -18,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/wire" ) // Key to store the header in the DB itself. @@ -335,11 +335,7 @@ func handleQueryApp(app *BaseApp, path []string, req abci.RequestQuery) (res abc } // Encode with json - value, err := json.Marshal(result) - if err != nil { - return sdk.ErrInternal("Encoding result failed").QueryResult() - } - + value := wire.Cdc.MustMarshalBinary(result) return abci.ResponseQuery{ Code: uint32(sdk.ABCICodeOK), Value: value, diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index c34c6d2704..26e398b4ed 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -3,7 +3,6 @@ package baseapp import ( "bytes" "encoding/binary" - "encoding/json" "fmt" "os" "testing" @@ -630,7 +629,7 @@ func TestSimulateTx(t *testing.T) { require.True(t, queryResult.IsOK(), queryResult.Log) var res sdk.Result - err = json.Unmarshal(queryResult.Value, &res) + wire.Cdc.MustUnmarshalBinary(queryResult.Value, &res) require.Nil(t, err, "Result unmarshalling failed") require.True(t, res.IsOK(), res.Log) require.Equal(t, gasConsumed, res.GasUsed, res.Log)