fix: Web3 RPC handlers panic (#702)

* Problem: Some Web3 RPC Handlers could panic

Closes: #701

Solution:
- return error rather than panic when decoding invalid tx

* add validation rules

* changelog
This commit is contained in:
yihuang
2021-10-26 13:13:27 +02:00
committed by GitHub
parent 23a3362475
commit bc1d81c5e8
12 changed files with 196 additions and 27 deletions
+4 -1
View File
@@ -68,7 +68,10 @@ func (g txConfig) TxDecoder() sdk.TxDecoder {
err := tx.UnmarshalBinary(txBytes)
if err == nil {
msg := &evmtypes.MsgEthereumTx{}
msg.FromEthereumTx(tx)
err := msg.FromEthereumTx(tx)
if err != nil {
return nil, err
}
return msg, nil
}