Skip to content

Commit

Permalink
Merge pull request #29 from notional-labs/notional-realio
Browse files Browse the repository at this point in the history
update BeginRedelegate
  • Loading branch information
jiujiteiro authored May 29, 2023
2 parents b5538a8 + 9db51da commit 2f2606b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions x/staking/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,15 @@ func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRed
return nil, types.ErrNoValidatorFound
}

if msg.Amount.Denom != validatorDst.BondDenom {
// lookup src val here to validate token early
validatorSrc, found := k.GetValidator(ctx, valSrcAddr)
if !found {
return nil, types.ErrNoValidatorFound
}

if msg.Amount.Denom != validatorDst.BondDenom || msg.Amount.Denom != validatorSrc.BondDenom {
return nil, sdkerrors.Wrapf(
sdkerrors.ErrInvalidRequest, "validator does not support redelegation with coin: got %s", msg.Amount.Denom,
sdkerrors.ErrInvalidRequest, "can't redelegate to validator with different bond denom",
)
}

Expand Down

0 comments on commit 2f2606b

Please sign in to comment.