Skip to content

Commit

Permalink
Merge PR: amino encode for MsgEthereumTx is not supported after venus…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
  • Loading branch information
yann-sjtu and KamiD authored Jan 10, 2022
1 parent ad62817 commit cc5a5a4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/evm/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit cc5a5a4

Please sign in to comment.