From fb2252971d98976da2f2c74ff85033df577bc756 Mon Sep 17 00:00:00 2001 From: beer-1 Date: Tue, 17 Sep 2024 21:23:29 +0900 Subject: [PATCH] disallow "hook" at validate --- x/opchild/types/tx.go | 7 ++----- x/ophost/keeper/msg_server_test.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/x/opchild/types/tx.go b/x/opchild/types/tx.go index 2f16ad5..b95673c 100644 --- a/x/opchild/types/tx.go +++ b/x/opchild/types/tx.go @@ -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 } // allow zero amount diff --git a/x/ophost/keeper/msg_server_test.go b/x/ophost/keeper/msg_server_test.go index af684bb..44e064c 100644 --- a/x/ophost/keeper/msg_server_test.go +++ b/x/ophost/keeper/msg_server_test.go @@ -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())