From 6503e7ec4fda8842b6314f6c47f5572c55707c6d Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 29 Nov 2023 14:02:07 -0700 Subject: [PATCH 1/2] fix withdraw rewarards valset --- x/valset-pref/validator_set.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/valset-pref/validator_set.go b/x/valset-pref/validator_set.go index f99eb17b594..b6ff6c57c3d 100644 --- a/x/valset-pref/validator_set.go +++ b/x/valset-pref/validator_set.go @@ -467,14 +467,14 @@ func (k Keeper) getValTargetAndSource(ctx sdk.Context, valSource, valTarget stri return validatorSource, validatorTarget, nil } -// WithdrawDelegationRewards withdraws all the delegation rewards from the validator in the val-set. +// WithdrawDelegationRewards withdraws all the delegation rewards from all validators the user is delegated to, disregarding the val-set. // If the valset does not exist, it withdraws from existing staking position. // Delegation reward is collected by the validator and in doing so, they can charge commission to the delegators. // Rewards are calculated per period, and is updated each time validator delegation changes. For ex: when a delegator // receives new delgation the rewards can be calculated by taking (total rewards before new delegation - the total current rewards). func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delegatorAddr string) error { - // get the existingValSet if it exists, if not check existingStakingPosition and return it - existingSet, err := k.GetDelegationPreferences(ctx, delegatorAddr) + // Get all validators the user is delegated to, and create a set from it. + existingSet, err := k.GetValSetPreferencesWithDelegations(ctx, delegatorAddr) if err != nil { return types.NoValidatorSetOrExistingDelegationsError{DelegatorAddr: delegatorAddr} } From 9c408665f870cd76251b9657d0b1d3dd82bbd161 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 29 Nov 2023 14:10:36 -0700 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b820679dc03..f31d378d884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#6814](https://github.com/osmosis-labs/osmosis/pull/6814) Add EstimateTradeBasedOnPriceImpact to stargate whitelist * [#6859](https://github.com/osmosis-labs/osmosis/pull/6859) Add hooks to core CL operations (position creation/withdrawal and swaps) * [#6937](https://github.com/osmosis-labs/osmosis/pull/6937) Update wasmd to v0.45.0 and wasmvm to v1.5.0 +* [#6949](https://github.com/osmosis-labs/osmosis/pull/6949) Valset withdraw rewards now considers all validators user is delegated to instead of valset ### Misc Improvements