@@ -14,6 +14,7 @@ import (
1414 cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types"
1515
1616 rpctypes "github.com/cosmos/evm/rpc/types"
17+ "github.com/cosmos/evm/rpc/types/interfaces"
1718 evmtypes "github.com/cosmos/evm/x/vm/types"
1819
1920 sdk "github.com/cosmos/cosmos-sdk/types"
@@ -87,8 +88,8 @@ func (b *Backend) BlockNumberFromCometByHash(blockHash common.Hash) (*big.Int, e
8788func (b * Backend ) EthMsgsFromCometBlock (
8889 resBlock * cmtrpctypes.ResultBlock ,
8990 blockRes * cmtrpctypes.ResultBlockResults ,
90- ) []* evmtypes. MsgEthereumTx {
91- var result []* evmtypes. MsgEthereumTx
91+ ) []interfaces. IMsgEthereumTx {
92+ var result []interfaces. IMsgEthereumTx
9293 block := resBlock .Block
9394
9495 txResults := blockRes .TxsResults
@@ -110,7 +111,7 @@ func (b *Backend) EthMsgsFromCometBlock(
110111 }
111112
112113 for _ , msg := range tx .GetMsgs () {
113- ethMsg , ok := msg .(* evmtypes. MsgEthereumTx )
114+ ethMsg , ok := msg .(interfaces. IMsgEthereumTx )
114115 if ! ok {
115116 continue
116117 }
@@ -225,7 +226,7 @@ func (b *Backend) MinerFromCometBlock(
225226func (b * Backend ) ReceiptsFromCometBlock (
226227 resBlock * cmtrpctypes.ResultBlock ,
227228 blockRes * cmtrpctypes.ResultBlockResults ,
228- msgs []* evmtypes. MsgEthereumTx ,
229+ msgs []interfaces. IMsgEthereumTx ,
229230) ([]* ethtypes.Receipt , error ) {
230231 baseFee , err := b .BaseFee (blockRes )
231232 if err != nil {
@@ -237,18 +238,19 @@ func (b *Backend) ReceiptsFromCometBlock(
237238 receipts := make ([]* ethtypes.Receipt , len (msgs ))
238239 cumulatedGasUsed := uint64 (0 )
239240 for i , ethMsg := range msgs {
240- txResult , err := b .GetTxByEthHash (ethMsg .Hash ())
241+ tx := ethMsg .AsTransaction ()
242+ txResult , err := b .GetTxByEthHash (tx .Hash ())
241243 if err != nil {
242- return nil , fmt .Errorf ("tx not found: hash=%s, error=%s" , ethMsg .Hash (), err .Error ())
244+ return nil , fmt .Errorf ("tx not found: hash=%s, error=%s" , tx .Hash (). Hex (), err .Error ())
243245 }
244246
245247 cumulatedGasUsed += txResult .GasUsed
246248
247249 var effectiveGasPrice * big.Int
248250 if baseFee != nil {
249- effectiveGasPrice = rpctypes .EffectiveGasPrice (ethMsg . Raw . Transaction , baseFee )
251+ effectiveGasPrice = rpctypes .EffectiveGasPrice (tx , baseFee )
250252 } else {
251- effectiveGasPrice = ethMsg . Raw .GasFeeCap ()
253+ effectiveGasPrice = tx .GasFeeCap ()
252254 }
253255
254256 var status uint64
@@ -259,8 +261,8 @@ func (b *Backend) ReceiptsFromCometBlock(
259261 }
260262
261263 contractAddress := common.Address {}
262- if ethMsg . Raw .To () == nil {
263- contractAddress = crypto .CreateAddress (ethMsg .GetSender (), ethMsg . Raw .Nonce ())
264+ if tx .To () == nil {
265+ contractAddress = crypto .CreateAddress (common . Address ( ethMsg .GetFrom (). Bytes ()), tx .Nonce ())
264266 }
265267
266268 msgIndex := int (txResult .MsgIndex ) // #nosec G115 -- checked for int overflow already
@@ -277,15 +279,15 @@ func (b *Backend) ReceiptsFromCometBlock(
277279
278280 receipt := & ethtypes.Receipt {
279281 // Consensus fields: These fields are defined by the Yellow Paper
280- Type : ethMsg . Raw .Type (),
282+ Type : tx .Type (),
281283 PostState : nil ,
282284 Status : status , // convert to 1=success, 0=failure
283285 CumulativeGasUsed : cumulatedGasUsed ,
284286 Bloom : bloom ,
285287 Logs : logs ,
286288
287289 // Implementation fields: These fields are added by geth when processing a transaction.
288- TxHash : ethMsg .Hash (),
290+ TxHash : tx .Hash (),
289291 ContractAddress : contractAddress ,
290292 GasUsed : txResult .GasUsed ,
291293 EffectiveGasPrice : effectiveGasPrice ,
0 commit comments