rpc: decode raw transaction via RLP (#727)

* Decode raw transaction via RLP

* add changelog

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
NevermoreRandom 2021-11-08 16:22:31 +08:00 committed by GitHub
parent 882dd4e2e3
commit fd36873261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes ### Bug Fixes
* (rpc) [tharsis#727](https://github.com/tharsis/ethermint/pull/727) Decode raw transaction using RLP.
* (rpc) [tharsis#661](https://github.com/tharsis/ethermint/pull/661) Fix OOM bug when creating too many filters using JSON-RPC. * (rpc) [tharsis#661](https://github.com/tharsis/ethermint/pull/661) Fix OOM bug when creating too many filters using JSON-RPC.
* (evm) [tharsis#660](https://github.com/tharsis/ethermint/pull/660) Fix `nil` pointer panic in `ApplyNativeMessage`. * (evm) [tharsis#660](https://github.com/tharsis/ethermint/pull/660) Fix `nil` pointer panic in `ApplyNativeMessage`.
* (evm, test) [tharsis#649](https://github.com/tharsis/ethermint/pull/649) Test DynamicFeeTx. * (evm, test) [tharsis#649](https://github.com/tharsis/ethermint/pull/649) Test DynamicFeeTx.

View File

@ -432,17 +432,16 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
e.logger.Debug("eth_sendRawTransaction", "length", len(data)) e.logger.Debug("eth_sendRawTransaction", "length", len(data))
// RLP decode raw transaction bytes // RLP decode raw transaction bytes
tx, err := e.clientCtx.TxConfig.TxDecoder()(data) tx := &ethtypes.Transaction{}
if err != nil { if err := tx.UnmarshalBinary(data); err != nil {
e.logger.Error("transaction decoding failed", "error", err.Error()) e.logger.Error("transaction decoding failed", "error", err.Error())
return common.Hash{}, err return common.Hash{}, err
} }
ethereumTx, isEthTx := tx.(*evmtypes.MsgEthereumTx) ethereumTx := &evmtypes.MsgEthereumTx{}
if !isEthTx { if err := ethereumTx.FromEthereumTx(tx); err != nil {
e.logger.Debug("invalid transaction type", "type", fmt.Sprintf("%T", tx)) e.logger.Error("transaction converting failed", "error", err.Error())
return common.Hash{}, fmt.Errorf("invalid transaction type %T", tx) return common.Hash{}, err
} }
if err := ethereumTx.ValidateBasic(); err != nil { if err := ethereumTx.ValidateBasic(); err != nil {