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

Add a justified balance getter to forkchoice #11513

Merged
merged 10 commits into from
Sep 30, 2022
Merged

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Sep 29, 2022

This PR adds a handler to forkchoice to request justified balances only when the justified checkpoint has changed instead of receiving this information on every call to Head. At this moment this is a setter function that just sets this handler and an implementation in the stategen package.

epoch := time.CurrentEpoch(st)

balances := make([]uint64, st.NumValidators())
var balanceAccumulator = func(idx int, val state.ReadOnlyValidator) error {
Copy link
Member

Choose a reason for hiding this comment

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

why call this an accumulator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you tell me, you wrote that code

Copy link
Member

Choose a reason for hiding this comment

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

Oh well, let's fix it!

@potuz potuz changed the title init Add a justified balance getter to forkchoice Sep 29, 2022
@potuz potuz marked this pull request as ready for review September 29, 2022 19:04
@potuz potuz requested a review from a team as a code owner September 29, 2022 19:04
kasey
kasey previously approved these changes Sep 29, 2022
Copy link
Contributor

@kasey kasey left a comment

Choose a reason for hiding this comment

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

Seems like we're just creating the ability to set this and doing so in stategen, not using it yet. LGTM!

beacon-chain/forkchoice/interfaces.go Outdated Show resolved Hide resolved
@potuz potuz merged commit ad65c84 into develop Sep 30, 2022
@delete-merged-branch delete-merged-branch bot deleted the forkchoice-get-balances branch September 30, 2022 09:39
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.

3 participants