Skip to content

adding the duties stores for validator duties processing - #16479

Merged
james-prysm merged 22 commits into
developfrom
duties-store
Mar 9, 2026
Merged

adding the duties stores for validator duties processing#16479
james-prysm merged 22 commits into
developfrom
duties-store

Conversation

@james-prysm

@james-prysm james-prysm commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

Other

What does this PR do? Why is it needed?

This PR refactors the way we store different validator duties into a duties store for easier splitting of tasks and in a future pr processing duties for split endpoints. This PR will reduce the number of changes when we start calling the different endpoints introduced in #16416

pr is part of #16421

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have included a uniquely named changelog fragment file.
  • I have added a description with sufficient context for reviewers to understand this PR.
  • I have tested that my changes work as expected and I added a testing plan to the PR description (if applicable).

@james-prysm james-prysm added the cleanup PR improving code health label Mar 5, 2026
Comment thread validator/client/duties.go Outdated
@james-prysm
james-prysm marked this pull request as ready for review March 5, 2026 19:41
@james-prysm

Copy link
Copy Markdown
Contributor Author

tested on kurtosis

needsCurrDependentRootUpdate := v.duties == nil || !bytes.Equal(currDepedentRoot, v.duties.CurrDependentRoot)
v.dutiesLock.RUnlock()
if !needsCurrDependentRootUpdate {
needsCurrUpdate := storedCurr == nil || !bytes.Equal(currDependentRoot, storedCurr)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be read again within a lock? could it possibly be outdated? previously this was read within a lock.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok yeah good point will fix this one

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

was this addressed?

Comment on lines +51 to +56
func (ds *dutyStore) CurrentEpochDuties() map[pubkey]*ethpb.ValidatorDuty {
if !ds.IsInitialized() {
return nil
}
return ds.currentDuties
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it okay to return the actual map by reference in these getters? or should they return a copy? same for the other methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

maybe I should wrap it so it doesn't mutate? nothing mutates the map right now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i think it might be overkill, before it returned a slice which callers could mutate too. i'm less worried about this one unless you think there's some other concern

Comment thread validator/client/duties.go Fixed
Comment thread validator/client/duty_store.go Outdated
Comment on lines +99 to +101
// SetLegacy stores a legacy combined duties response by decomposing it into
// duty maps, proposer slots, and sync committee maps.
func (ds *dutyStore) SetLegacy(container *ethpb.ValidatorDutiesContainer) {

@prestonvanloon prestonvanloon Mar 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand your naming for this, but i don't agree with it. The naming of this method is not very idiomatic. Can you give it a proper name? If it's deprecated, then make it // DEPRECATED and provide a comment to offer the new API that folks should use.

@prestonvanloon prestonvanloon Mar 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i.e. something like this:

Suggested change
// SetLegacy stores a legacy combined duties response by decomposing it into
// duty maps, proposer slots, and sync committee maps.
func (ds *dutyStore) SetLegacy(container *ethpb.ValidatorDutiesContainer) {
// SetFromCombinedDutiesResponse stores a legacy combined duties response by decomposing it into
// duty maps, proposer slots, and sync committee maps.
// DEPRECATED: Use the ?? endpoint from gloas onwards.
func (ds *dutyStore) SetFromCombinedDutiesResponse(container *ethpb.ValidatorDutiesContainer) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added with the endpoint that is deprecating and what to use instead ( which isn't merged in yet)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is the related pr that introduces the new endpoints #16416

Comment thread validator/client/duties.go
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
@james-prysm
james-prysm enabled auto-merge March 9, 2026 21:12
@james-prysm
james-prysm added this pull request to the merge queue Mar 9, 2026
Merged via the queue into develop with commit 17ea45a Mar 9, 2026
19 checks passed
@james-prysm
james-prysm deleted the duties-store branch March 9, 2026 21:52
syjn99 pushed a commit to syjn99/prysm that referenced this pull request Mar 13, 2026
…s#16479)

**What type of PR is this?**

Other

**What does this PR do? Why is it needed?**

This PR refactors the way we store different validator duties into a
duties store for easier splitting of tasks and in a future pr processing
duties for split endpoints. This PR will reduce the number of changes
when we start calling the different endpoints introduced in
OffchainLabs#16416

pr is part of OffchainLabs#16421

**Which issues(s) does this PR fix?**

Fixes #

**Other notes for review**

**Acknowledgements**

- [x] I have read
[CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md).
- [x] I have included a uniquely named [changelog fragment
file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd).
- [x] I have added a description with sufficient context for reviewers
to understand this PR.
- [x] I have tested that my changes work as expected and I added a
testing plan to the PR description (if applicable).

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup PR improving code health validator-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants