Skip to content

Commit

Permalink
use go-ethereum Sender function to properly get the signer
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jul 15, 2024
1 parent fc241d6 commit 387ff14
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/evm/keeper/txutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func (u *TxUtils) ConvertEthereumTxToCosmosTx(ctx context.Context, ethTx *corety
ethChainID := types.ConvertCosmosChainIDToEthereumChainID(chainID)
signer := coretypes.LatestSignerForChainID(ethChainID)

// get tx sender
ethSender, err := coretypes.Sender(signer, ethTx)
if err != nil {
return nil, err
}

// sig bytes
v, r, s := ethTx.RawSignatureValues()

Expand Down Expand Up @@ -126,7 +132,7 @@ func (u *TxUtils) ConvertEthereumTxToCosmosTx(ctx context.Context, ethTx *corety
}

// convert sender to string
sender, err := u.ac.BytesToString(compressedPubKey.Address().Bytes())
sender, err := u.ac.BytesToString(ethSender.Bytes())
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 387ff14

Please sign in to comment.