Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Use THC for state.inactivity_scores #2504

Closed
wants to merge 5 commits into from

Conversation

paulhauner
Copy link
Member

@paulhauner paulhauner commented Aug 9, 2021

Issue Addressed

Proposed Changes

Adds tree-hash caching (THC 🍁) for state.inactivity_scores, as per #2502.

Since the inactivity_scores field is introduced during Altair, the cache must be optional (i.e., not present pre-Altair). The mechanism for optional caches was already implemented via the ParticipationTreeHashCache, albeit not quite generically enough to suit this use-case. To this end, I made the ParticipationTreeHashCache more generic and renamed it to OptionalTreeHashCache. This made the code a little more verbose around the previous/current epoch participation fields, but overall less verbose when the needs of inactivity_scores are considered.

All changes to ParticipationTreeHashCache should be non-substantial.

Additional Info

NA

@paulhauner paulhauner added ready-for-review The code is ready for review v1.5.0 For inclusion in v1.5.0 release labels Aug 9, 2021
@paulhauner paulhauner requested a review from realbigsean August 9, 2021 01:37
@paulhauner
Copy link
Member Author

@realbigsean I've requested your review since Michael is on leave and this is blocking a v1.5.0 release 🙏

Copy link
Member

@realbigsean realbigsean left a comment

Choose a reason for hiding this comment

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

LGTM! Seems like the OptionalTreeHashCache will be useful in the future too

@paulhauner
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Aug 9, 2021
## Issue Addressed

- Resolves #2502

## Proposed Changes

Adds tree-hash caching (THC 🍁) for `state.inactivity_scores`, as per #2502.

Since the `inactivity_scores` field is introduced during Altair, the cache must be optional (i.e., not present pre-Altair). The mechanism for optional caches was already implemented via the `ParticipationTreeHashCache`, albeit not quite generically enough. To this end, I made the `ParticipationTreeHashCache` more generic and renamed it to `OptionalTreeHashCache`. This made the code a little more verbose around the previous/current epoch participation fields, but overall less verbose when the needs of `inactivity_scores` are considered.

All changes to `ParticipationTreeHashCache` should be *non-substantial*.

## Additional Info

NA
@paulhauner paulhauner added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Aug 9, 2021
@bors bors bot changed the title Use THC for state.inactivity_scores [Merged by Bors] - Use THC for state.inactivity_scores Aug 9, 2021
@bors bors bot closed this Aug 9, 2021
pawanjay176 pushed a commit to pawanjay176/lighthouse that referenced this pull request Aug 27, 2021
## Issue Addressed

- Resolves sigp#2502

## Proposed Changes

Adds tree-hash caching (THC 🍁) for `state.inactivity_scores`, as per sigp#2502.

Since the `inactivity_scores` field is introduced during Altair, the cache must be optional (i.e., not present pre-Altair). The mechanism for optional caches was already implemented via the `ParticipationTreeHashCache`, albeit not quite generically enough. To this end, I made the `ParticipationTreeHashCache` more generic and renamed it to `OptionalTreeHashCache`. This made the code a little more verbose around the previous/current epoch participation fields, but overall less verbose when the needs of `inactivity_scores` are considered.

All changes to `ParticipationTreeHashCache` should be *non-substantial*.

## Additional Info

NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge. v1.5.0 For inclusion in v1.5.0 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants