diff --git a/x/rollup/keeper/deposits.go b/x/rollup/keeper/deposits.go index a6471a3a..57da5bb2 100644 --- a/x/rollup/keeper/deposits.go +++ b/x/rollup/keeper/deposits.go @@ -70,15 +70,23 @@ func (k *Keeper) processL1UserDepositTxs(ctx sdk.Context, txs [][]byte) (sdk.Eve return nil, types.WrapError(types.ErrInvalidL1Txs, "L1 tx must be a user deposit tx, type %d", tx.Type()) } ctx.Logger().Debug("User deposit tx", "index", i, "tx", string(lo.Must(tx.MarshalJSON()))) - to := tx.To() // if the receipient is nil, it means the tx is creating a contract which we don't support, so return an error. // see https://github.com/ethereum-optimism/op-geth/blob/v1.101301.0-rc.2/core/state_processor.go#L154 - if to == nil { + if tx.To() == nil { ctx.Logger().Error("Contract creation txs are not supported", "index", i) return nil, types.WrapError(types.ErrInvalidL1Txs, "Contract creation txs are not supported, index:%d", i) } - cosmAddr := utils.EvmToCosmosAddress(*to) - mintAmount := sdkmath.NewIntFromBigInt(tx.Value()) + + // Get the sender's address from the transaction + // We use NewLondonSigner because deposit transactions follow EIP-2718 and EIP-2930 + to, err := ethtypes.NewLondonSigner(tx.ChainId()).Sender(&tx) + if err != nil { + ctx.Logger().Error("Failed to get sender address", "evmAddress", to, "err", err) + return nil, types.WrapError(types.ErrInvalidL1Txs, "failed to get sender address: %v", err) + } + cosmAddr := utils.EvmToCosmosAddress(to) + mintAmount := sdkmath.NewIntFromBigInt(tx.Mint()) + mintEvent, err := k.mintETH(ctx, cosmAddr, mintAmount) if err != nil { ctx.Logger().Error("Failed to mint ETH", "evmAddress", to, "cosmosAddress", cosmAddr, "err", err)