Skip to content

Commit 6d023bb

Browse files
committed
refactor: remove Hash() func for backward compatibility
1 parent 4c28932 commit 6d023bb

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

ante/evm/11_emit_event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func EmitTxHashEvent(ctx sdk.Context, msg *evmtypes.MsgEthereumTx, blockTxIndex
1818
ctx.EventManager().EmitEvent(
1919
sdk.NewEvent(
2020
evmtypes.EventTypeEthereumTx,
21-
sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxHash, msg.Hash().String()),
21+
sdk.NewAttribute(evmtypes.AttributeKeyEthereumTxHash, msg.AsTransaction().Hash().String()),
2222
sdk.NewAttribute(evmtypes.AttributeKeyTxIndex, strconv.FormatUint(blockTxIndex, 10)), // #nosec G115
2323
),
2424
)

ante/tx_listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (d TxListenerDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo
2727
if ctx.IsCheckTx() && !simulate && d.pendingTxListener != nil {
2828
for _, msg := range tx.GetMsgs() {
2929
if ethTx, ok := msg.(*evmtypes.MsgEthereumTx); ok {
30-
d.pendingTxListener(ethTx.Hash())
30+
d.pendingTxListener(ethTx.AsTransaction().Hash())
3131
}
3232
}
3333
}

indexer/kv_indexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (kv *KVIndexer) IndexBlock(block *cmttypes.Block, txResults []*abci.ExecTxR
8282
var cumulativeGasUsed uint64
8383
for msgIndex, msg := range tx.GetMsgs() {
8484
ethMsg := msg.(*evmtypes.MsgEthereumTx)
85-
txHash := ethMsg.Hash()
85+
txHash := ethMsg.AsTransaction().Hash()
8686

8787
txResult := servertypes.TxResult{
8888
Height: height,

mempool/mempool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (m *ExperimentalEVMMempool) Insert(goCtx context.Context, tx sdk.Tx) error
224224
ethMsg, err := m.getEVMMessage(tx)
225225
if err == nil {
226226
// Insert into EVM pool
227-
hash := ethMsg.Hash()
227+
hash := ethMsg.AsTransaction().Hash()
228228
m.logger.Debug("inserting EVM transaction", "tx_hash", hash)
229229
ethTxs := []*ethtypes.Transaction{ethMsg.AsTransaction()}
230230
errs := m.txPool.Add(ethTxs, true)
@@ -320,7 +320,7 @@ func (m *ExperimentalEVMMempool) Remove(tx sdk.Tx) error {
320320
// We should not do this with EVM transactions because removing them causes the subsequent ones to
321321
// be dequeued as temporarily invalid, only to be requeued a block later.
322322
// The EVM mempool handles removal based on account nonce automatically.
323-
hash := msg.Hash()
323+
hash := msg.AsTransaction().Hash()
324324
if m.shouldRemoveFromEVMPool(tx) {
325325
m.logger.Debug("manually removing EVM transaction", "tx_hash", hash)
326326
m.legacyTxPool.RemoveTx(hash, false, true)

x/vm/types/msg.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,6 @@ func (msg *MsgEthereumTx) UnmarshalBinary(b []byte, signer ethtypes.Signer) erro
300300
return msg.FromSignedEthereumTx(tx, signer)
301301
}
302302

303-
func (msg *MsgEthereumTx) Hash() common.Hash {
304-
return msg.AsTransaction().Hash()
305-
}
306-
307303
// BuildTx builds the canonical cosmos tx from ethereum msg
308304
func (msg *MsgEthereumTx) BuildTx(b client.TxBuilder, evmDenom string) (signing.Tx, error) {
309305
return msg.BuildTxWithEvmParams(b, Params{

0 commit comments

Comments
 (0)