Merge branch 'master' into bez/proto-client-init
This commit is contained in:
@@ -130,7 +130,7 @@ func (cgts ConsumeTxSizeGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
|
||||
PubKey: pubkey.Bytes(),
|
||||
}
|
||||
|
||||
sigBz := codec.Cdc.MustMarshalBinaryLengthPrefixed(simSig)
|
||||
sigBz := codec.Cdc.MustMarshalBinaryBare(simSig)
|
||||
cost := sdk.Gas(len(sigBz) + 6)
|
||||
|
||||
// If the pubkey is a multi-signature pubkey, then we estimate for the maximum
|
||||
|
||||
@@ -31,7 +31,7 @@ $ <appcli> tx broadcast ./mytxn.json
|
||||
return
|
||||
}
|
||||
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryLengthPrefixed(stdTx)
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryBare(stdTx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func runDecodeTxString(codec *amino.Codec) func(cmd *cobra.Command, args []strin
|
||||
}
|
||||
|
||||
var stdTx authtypes.StdTx
|
||||
err = cliCtx.Codec.UnmarshalBinaryLengthPrefixed(txBytes, &stdTx)
|
||||
err = cliCtx.Codec.UnmarshalBinaryBare(txBytes, &stdTx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea
|
||||
}
|
||||
|
||||
// re-encode it via the Amino wire protocol
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryLengthPrefixed(stdTx)
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryBare(stdTx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ func formatTxResult(cdc *codec.Codec, resTx *ctypes.ResultTx, resBlock *ctypes.R
|
||||
func parseTx(cdc *codec.Codec, txBytes []byte) (sdk.Tx, error) {
|
||||
var tx types.StdTx
|
||||
|
||||
err := cdc.UnmarshalBinaryLengthPrefixed(txBytes, &tx)
|
||||
err := cdc.UnmarshalBinaryBare(txBytes, &tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func BroadcastTxRequest(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryLengthPrefixed(req.Tx)
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryBare(req.Tx)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
||||
@@ -46,7 +46,7 @@ func DecodeTxRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
var stdTx authtypes.StdTx
|
||||
err = cliCtx.Codec.UnmarshalBinaryLengthPrefixed(txBytes, &stdTx)
|
||||
err = cliCtx.Codec.UnmarshalBinaryBare(txBytes, &stdTx)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
|
||||
@@ -35,7 +35,7 @@ func EncodeTxRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// re-encode it via the Amino wire protocol
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryLengthPrefixed(req)
|
||||
txBytes, err := cliCtx.Codec.MarshalBinaryBare(req)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ func adjustGasEstimate(estimate uint64, adjustment float64) uint64 {
|
||||
|
||||
func parseQueryResponse(cdc *codec.Codec, rawRes []byte) (uint64, error) {
|
||||
var gasUsed uint64
|
||||
if err := cdc.UnmarshalBinaryLengthPrefixed(rawRes, &gasUsed); err != nil {
|
||||
if err := cdc.UnmarshalBinaryBare(rawRes, &gasUsed); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ var (
|
||||
|
||||
func TestParseQueryResponse(t *testing.T) {
|
||||
cdc := makeCodec()
|
||||
sdkResBytes := cdc.MustMarshalBinaryLengthPrefixed(uint64(10))
|
||||
sdkResBytes := cdc.MustMarshalBinaryBare(uint64(10))
|
||||
gas, err := parseQueryResponse(cdc, sdkResBytes)
|
||||
assert.Equal(t, gas, uint64(10))
|
||||
assert.Nil(t, err)
|
||||
@@ -39,7 +39,7 @@ func TestCalculateGas(t *testing.T) {
|
||||
if wantErr {
|
||||
return nil, 0, errors.New("")
|
||||
}
|
||||
return cdc.MustMarshalBinaryLengthPrefixed(gasUsed), 0, nil
|
||||
return cdc.MustMarshalBinaryBare(gasUsed), 0, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ func (ak AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64 {
|
||||
} else {
|
||||
val := gogotypes.UInt64Value{}
|
||||
|
||||
err := ak.cdc.UnmarshalBinaryLengthPrefixed(bz, &val)
|
||||
err := ak.cdc.UnmarshalBinaryBare(bz, &val)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func (ak AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64 {
|
||||
accNumber = val.GetValue()
|
||||
}
|
||||
|
||||
bz = ak.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.UInt64Value{Value: accNumber + 1})
|
||||
bz = ak.cdc.MustMarshalBinaryBare(&gogotypes.UInt64Value{Value: accNumber + 1})
|
||||
store.Set(types.GlobalAccountNumberKey, bz)
|
||||
|
||||
return accNumber
|
||||
|
||||
@@ -22,8 +22,8 @@ func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
|
||||
|
||||
case bytes.Equal(kvA.Key, types.GlobalAccountNumberKey):
|
||||
var globalAccNumberA, globalAccNumberB uint64
|
||||
cdc.MustUnmarshalBinaryLengthPrefixed(kvA.Value, &globalAccNumberA)
|
||||
cdc.MustUnmarshalBinaryLengthPrefixed(kvB.Value, &globalAccNumberB)
|
||||
cdc.MustUnmarshalBinaryBare(kvA.Value, &globalAccNumberA)
|
||||
cdc.MustUnmarshalBinaryBare(kvB.Value, &globalAccNumberB)
|
||||
return fmt.Sprintf("GlobalAccNumberA: %d\nGlobalAccNumberB: %d", globalAccNumberA, globalAccNumberB)
|
||||
|
||||
default:
|
||||
|
||||
@@ -34,7 +34,7 @@ func TestDecodeStore(t *testing.T) {
|
||||
|
||||
kvPairs := tmkv.Pairs{
|
||||
tmkv.Pair{Key: types.AddressStoreKey(delAddr1), Value: cdc.MustMarshalBinaryBare(acc)},
|
||||
tmkv.Pair{Key: types.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(globalAccNumber)},
|
||||
tmkv.Pair{Key: types.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryBare(globalAccNumber)},
|
||||
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
|
||||
}
|
||||
tests := []struct {
|
||||
|
||||
@@ -326,7 +326,7 @@ func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder {
|
||||
|
||||
// StdTx.Msg is an interface. The concrete types
|
||||
// are registered by MakeTxCodec
|
||||
err := cdc.UnmarshalBinaryLengthPrefixed(txBytes, &tx)
|
||||
err := cdc.UnmarshalBinaryBare(txBytes, &tx)
|
||||
if err != nil {
|
||||
return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error())
|
||||
}
|
||||
@@ -338,6 +338,6 @@ func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder {
|
||||
// DefaultTxEncoder logic for standard transaction encoding
|
||||
func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder {
|
||||
return func(tx sdk.Tx) ([]byte, error) {
|
||||
return cdc.MarshalBinaryLengthPrefixed(tx)
|
||||
return cdc.MarshalBinaryBare(tx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestDefaultTxEncoder(t *testing.T) {
|
||||
|
||||
tx := NewStdTx(msgs, fee, sigs, "")
|
||||
|
||||
cdcBytes, err := cdc.MarshalBinaryLengthPrefixed(tx)
|
||||
cdcBytes, err := cdc.MarshalBinaryBare(tx)
|
||||
|
||||
require.NoError(t, err)
|
||||
encoderBytes, err := encoder(tx)
|
||||
|
||||
Reference in New Issue
Block a user