Skip to content

Commit

Permalink
overwrite sender with the actual sender at hook execution
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jul 30, 2024
1 parent 1d42cc1 commit 114c7be
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/hook/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"cosmossdk.io/core/address"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

evmkeeper "github.com/initia-labs/minievm/x/evm/keeper"
evmtypes "github.com/initia-labs/minievm/x/evm/types"
Expand All @@ -32,11 +31,10 @@ func (mbh EVMBridgeHook) Hook(ctx context.Context, sender sdk.AccAddress, msgByt
return err
}

senderAddr, err := mbh.ac.StringToBytes(msg.Sender)
// overwrite sender with the actual sender
msg.Sender, err = mbh.ac.BytesToString(sender)
if err != nil {
return err
} else if !sender.Equals(sdk.AccAddress(senderAddr)) {
return sdkerrors.ErrUnauthorized
}

ms := evmkeeper.NewMsgServerImpl(mbh.evmKeeper)
Expand Down

0 comments on commit 114c7be

Please sign in to comment.