From cc5a5a4e9e4ebaf3d15bbf2005693030c4dadb28 Mon Sep 17 00:00:00 2001 From: YuanXingqiang Date: Mon, 10 Jan 2022 19:27:30 +0800 Subject: [PATCH] Merge PR: amino encode for MsgEthereumTx is not supported after venus height (#1410) * RLP encode is not allowed until venus height * add optional heights paramter in sdk.TxDecoder * update rpc * update HigherThanVenus * txpool is not allowed until venus height * update global height when restarting the node * forbid amino decode for MsgEthereumTx Co-authored-by: KamiD <44460798+KamiD@users.noreply.github.com> --- x/evm/types/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/evm/types/utils.go b/x/evm/types/utils.go index 127d3f16a8..55839fa157 100644 --- a/x/evm/types/utils.go +++ b/x/evm/types/utils.go @@ -564,9 +564,15 @@ func TxDecoder(cdc *codec.Codec) sdk.TxDecoder { // are registered by MakeTxCodec // TODO: switch to UnmarshalBinaryBare on SDK v0.40.0 if v, err := cdc.UnmarshalBinaryLengthPrefixedWithRegisteredUbmarshaller(txBytes, &tx); err == nil { + if _, ok := v.(MsgEthereumTx); ok && types.HigherThanVenus(height) { + return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "amino decode is not allowed for MsgEthereumTx") + } return v.(sdk.Tx), nil } if err = cdc.UnmarshalBinaryLengthPrefixed(txBytes, &tx); err == nil { + if _, ok := tx.(MsgEthereumTx); ok && types.HigherThanVenus(height) { + return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "amino decode is not allowed for MsgEthereumTx") + } return tx, nil } return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error())