这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@phertyameen
Copy link
Contributor

@phertyameen phertyameen commented Oct 26, 2025

Motivation

Not resubscribing to beacon subnets (prepareBeaconCommitteeSubnet) as dependent root for current epoch changes. When this happens, previous subscriptions are no longer valid

validator duties changed (slot, committee index, etc.)
is_aggregator results are different

Description

Added subnet resubscription logic to handleAttesterDutiesReorg that fetches updated attester duties, rebuild beaconCommitteeSubscriptions and resubscribe validators to the correct beacon subnets by calling the prepareBeaconCommitteeSubnet api

Added test to handle:

  • resubscribe to beacon subnets when current epoch dependent root changes,
  • resubscribe when next epoch dependent root changes and
  • not resubscribe when dependent root unchanged

There was intentional use of claude AI in writing the test.

Closes #6034

Steps to test or reproduce

@phertyameen phertyameen changed the title resubscribe to beacon subnets on current epoch reorg fix: resubscribe to beacon subnets on current epoch reorg Oct 26, 2025
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.01%. Comparing base (5317389) to head (ea93c26).
⚠️ Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8570      +/-   ##
============================================
+ Coverage     51.92%   52.01%   +0.09%     
============================================
  Files           848      848              
  Lines         65806    65825      +19     
  Branches       4799     4807       +8     
============================================
+ Hits          34168    34240      +72     
+ Misses        31569    31517      -52     
+ Partials         69       68       -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@phertyameen phertyameen marked this pull request as ready for review October 27, 2025 16:04
@phertyameen phertyameen requested a review from a team as a code owner October 27, 2025 16:04
@phertyameen phertyameen reopened this Oct 29, 2025
@phertyameen
Copy link
Contributor Author

@nflaig Can you please review this?

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @phertyameen for taking a look at this, few remarks mostly regarding the tests as those do not follow the usual patterns we use, please take a look at existing tests and try to align test / mock data setup a bit more (see comments)

@phertyameen
Copy link
Contributor Author

Understood. Will make these corrections right away. Thanks for the detailed review.

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, few remarks on the unit tests, will push some minor updates then we are good to merge this

@nflaig
Copy link
Member

nflaig commented Nov 2, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue where validators were not resubscribing to beacon subnets after a reorg affecting their duties. The fix involves adding logic to handleAttesterDutiesReorg to rebuild and resubmit subnet subscriptions based on the updated duties. The introduction of a dedicated subscribeToBeaconCommitteeSubnets method is a good refactoring choice. The accompanying tests are thorough, covering reorg scenarios for both the current and next epochs, as well as the case where no change occurs, ensuring the new logic is well-validated. I have one suggestion to further improve maintainability by reducing some code duplication.

nflaig
nflaig previously approved these changes Nov 2, 2025
@phertyameen
Copy link
Contributor Author

Noted the corrections. Thank you again for the assistance. I have learned a lot from this 🙏

@nflaig nflaig merged commit e6d0f57 into ChainSafe:unstable Nov 3, 2025
24 of 26 checks passed
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.36.0 🎉

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.

Resubscribe to beacon subnets if current epoch dependent root changed

3 participants