revert change to queryApp encoding

This commit is contained in:
Aditya Sripal 2018-07-19 11:35:31 -07:00
parent 7c41e8cbc0
commit 5015c46e06
2 changed files with 3 additions and 8 deletions

View File

@ -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,

View File

@ -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)