Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 9, 2025

Description

Currently AfterDelegationModified hook will update co-staking tracker no matter val status

This PR introduces the changes to hooks when delegation modified:

  • ONLY update baby amt in co-staking tracker if validator was in active set - using staking.IterateLastValidatorPowers

Later on, AfterEpochEnds hook:

  • get newly active and inactive validators from:
    • cached staking.IterateLastValidatorPowers - is the prev-epoch validator set
    • staking.IterateLastValidatorPowers - returns the new epoch validators (updated before calling the hook)
  • if validator becomes inactive:
    • In case was add before - OK, will reduce the corresponding total amount
    • In case was reduced before - OK, will reduce the remaining (validator delegations already updated)
  • if validator becomes active:
    • update all delegators co-staking trackers

This is an automatic backport of pull request #1776 done by [Mergify](https://mergify.com).

# Description

Currently `AfterDelegationModified` hook will update co-staking tracker
no matter val status

This PR introduces the changes to hooks when delegation modified:
- ONLY update baby amt in co-staking tracker if validator was in active
set - using `staking.IterateLastValidatorPowers`

Later on, `AfterEpochEnds` hook:
- get newly active and inactive validators from:
- cached `staking.IterateLastValidatorPowers` - is the prev-epoch
validator set
- `staking.IterateLastValidatorPowers` - returns the new epoch
validators (updated before calling the hook)
- if validator becomes inactive:
- In case was add before - OK, will reduce the corresponding total
amount
- In case was reduced before - OK, will reduce the remaining (validator
delegations already updated)
 - if validator becomes active:
   - update all delegators co-staking trackers

---------

Co-authored-by: RafilxTenfen <rafaeltenfen.rt@gmail.com>
(cherry picked from commit c8277ad)
@GAtom22 GAtom22 merged commit d165579 into release/v4.x Oct 9, 2025
28 checks passed
@GAtom22 GAtom22 deleted the mergify/bp/release/v4.x/pr-1776 branch October 9, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants