From c8ededc50479f099d1161129a865f78aed88d874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Quang=20Vinh?= Date: Wed, 3 Sep 2025 00:00:03 +0700 Subject: [PATCH] fix: add delegator address to redelegate event (#25258) Co-authored-by: Alex | Interchain Labs Co-authored-by: Alex | Interchain Labs --- CHANGELOG.md | 1 + x/staking/keeper/msg_server.go | 1 + x/staking/keeper/msg_server_test.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc36fe3c23..be9d8730d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/epochs) [#24770](https://github.com/cosmos/cosmos-sdk/pull/24770) Fix register of epoch hooks in `InvokeSetHooks`. * (x/epochs) [#25087](https://github.com/cosmos/cosmos-sdk/pull/25087) Remove redundant error check in BeginBlocker. * [GHSA-p22h-3m2v-cmgh](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-p22h-3m2v-cmgh) Fix x/distribution can halt when historical rewards overflow. +* (x/staking) [#25258](https://github.com/cosmos/cosmos-sdk/pull/25258) Add delegator address to redelegate event. ### Deprecated diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 8ba7b9383b..5517174c9c 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -373,6 +373,7 @@ func (k msgServer) BeginRedelegate(ctx context.Context, msg *types.MsgBeginRedel types.EventTypeRedelegate, sdk.NewAttribute(types.AttributeKeySrcValidator, msg.ValidatorSrcAddress), sdk.NewAttribute(types.AttributeKeyDstValidator, msg.ValidatorDstAddress), + sdk.NewAttribute(types.AttributeKeyDelegator, msg.DelegatorAddress), sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()), sdk.NewAttribute(types.AttributeKeyCompletionTime, completionTime.Format(time.RFC3339)), ), diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go index 569538a33f..bd44fa3117 100644 --- a/x/staking/keeper/msg_server_test.go +++ b/x/staking/keeper/msg_server_test.go @@ -693,6 +693,10 @@ func (s *KeeperTestSuite) TestMsgBeginRedelegate() { require.Contains(err.Error(), tc.expErrMsg) } else { require.NoError(err) + events := ctx.EventManager().Events() + delegator, found := events.GetAttributes("delegator") + s.Require().Equal(delegator[0].Value, tc.input.DelegatorAddress) + s.Require().Equal(true, found) } }) }