Skip to content

Commit

Permalink
disallow "hook" at validate
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Sep 17, 2024
1 parent e9f4748 commit fb22529
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions x/opchild/types/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,8 @@ func (msg MsgFinalizeTokenDeposit) Validate(ac address.Codec) error {
return sdkerrors.ErrInvalidAddress.Wrap("from address cannot be empty")
}

// allow hook as a special address
if msg.To != "hook" {
if _, err := ac.StringToBytes(msg.To); err != nil {
return err
}
if _, err := ac.StringToBytes(msg.To); err != nil {
return err

Check warning on line 255 in x/opchild/types/tx.go

View check run for this annotation

Codecov / codecov/patch

x/opchild/types/tx.go#L255

Added line #L255 was not covered by tests
}

// allow zero amount
Expand Down
2 changes: 1 addition & 1 deletion x/ophost/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func Test_InitiateTokenDeposit(t *testing.T) {
input.Faucet.Fund(ctx, addrs[1], amount)
_, err = ms.InitiateTokenDeposit(
ctx,
types.NewMsgInitiateTokenDeposit(addrsStr[1], 1, "hook", amount, []byte("messages")),
types.NewMsgInitiateTokenDeposit(addrsStr[1], 1, "l2_addr", amount, []byte("messages")),
)
require.NoError(t, err)
require.True(t, input.BankKeeper.GetBalance(ctx, addrs[1], sdk.DefaultBondDenom).IsZero())
Expand Down

0 comments on commit fb22529

Please sign in to comment.