revert change to queryApp encoding
This commit is contained in:
parent
7c41e8cbc0
commit
5015c46e06
|
@ -1,7 +1,6 @@
|
||||||
package baseapp
|
package baseapp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
@ -18,6 +17,7 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/store"
|
"github.com/cosmos/cosmos-sdk/store"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/version"
|
"github.com/cosmos/cosmos-sdk/version"
|
||||||
|
"github.com/cosmos/cosmos-sdk/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Key to store the header in the DB itself.
|
// 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
|
// Encode with json
|
||||||
value, err := json.Marshal(result)
|
value := wire.Cdc.MustMarshalBinary(result)
|
||||||
if err != nil {
|
|
||||||
return sdk.ErrInternal("Encoding result failed").QueryResult()
|
|
||||||
}
|
|
||||||
|
|
||||||
return abci.ResponseQuery{
|
return abci.ResponseQuery{
|
||||||
Code: uint32(sdk.ABCICodeOK),
|
Code: uint32(sdk.ABCICodeOK),
|
||||||
Value: value,
|
Value: value,
|
||||||
|
|
|
@ -3,7 +3,6 @@ package baseapp
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -630,7 +629,7 @@ func TestSimulateTx(t *testing.T) {
|
||||||
require.True(t, queryResult.IsOK(), queryResult.Log)
|
require.True(t, queryResult.IsOK(), queryResult.Log)
|
||||||
|
|
||||||
var res sdk.Result
|
var res sdk.Result
|
||||||
err = json.Unmarshal(queryResult.Value, &res)
|
wire.Cdc.MustUnmarshalBinary(queryResult.Value, &res)
|
||||||
require.Nil(t, err, "Result unmarshalling failed")
|
require.Nil(t, err, "Result unmarshalling failed")
|
||||||
require.True(t, res.IsOK(), res.Log)
|
require.True(t, res.IsOK(), res.Log)
|
||||||
require.Equal(t, gasConsumed, res.GasUsed, res.Log)
|
require.Equal(t, gasConsumed, res.GasUsed, res.Log)
|
||||||
|
|
Loading…
Reference in New Issue