Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Decode raw transaction via RLP #727

Merged
merged 3 commits into from Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### 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.
* (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.
Expand Down
13 changes: 7 additions & 6 deletions rpc/ethereum/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,18 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
e.logger.Debug("eth_sendRawTransaction", "length", len(data))

// RLP decode raw transaction bytes
tx, err := e.clientCtx.TxConfig.TxDecoder()(data)
tx := &ethtypes.Transaction{}
err := tx.UnmarshalBinary(data)
if err != nil {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
e.logger.Error("transaction decoding failed", "error", err.Error())

return common.Hash{}, err
}

ethereumTx, isEthTx := tx.(*evmtypes.MsgEthereumTx)
if !isEthTx {
e.logger.Debug("invalid transaction type", "type", fmt.Sprintf("%T", tx))
return common.Hash{}, fmt.Errorf("invalid transaction type %T", tx)
ethereumTx := &evmtypes.MsgEthereumTx{}
err = ethereumTx.FromEthereumTx(tx)
if err != nil {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
e.logger.Error("transaction converting failed", "error", err.Error())
return common.Hash{}, err
}

if err := ethereumTx.ValidateBasic(); err != nil {
Expand Down