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

single attestation cleanup & getCommitteeIndex bug fix #14984

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Feb 25, 2025

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

post electra when getting the committee index we should be using the GetCommitteeIndex() function instead of calling the field directly, this is beacuse the committee bits have been moved outside the attestation data so electra committee index field will always be 0.

This PR also does some minor cleanup to reduce cognitive load when reading what should be a single attestation vs regular attestation

kurtosis run with devnet 6 settings 3 nodes ( teku/nethermind, 2x prysm/geth)
image

attestation events still working
image

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

@james-prysm james-prysm added Bug Something isn't working Electra electra hardfork labels Feb 25, 2025
@james-prysm james-prysm requested a review from a team as a code owner February 25, 2025 15:44
// Verify the block being voted and the processed state is in beaconDB and the block has passed validation if it's in the beaconDB.
blockRoot := bytesutil.ToBytes32(data.BeaconBlockRoot)
if !s.hasBlockAndState(ctx, blockRoot) {
return s.saveToPendingAttPool(att)
}

if !s.cfg.chain.InForkchoice(bytesutil.ToBytes32(data.BeaconBlockRoot)) {
if !s.cfg.chain.InForkchoice(blockRoot) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can just use blockRoot here, because it's already calculated above

if validationRes != pubsub.ValidationAccept {
return validationRes, err
}

committee, err := helpers.BeaconCommitteeFromState(ctx, preState, att.GetData().Slot, committeeIndex)
committee, err := helpers.BeaconCommitteeFromState(ctx, preState, data.Slot, committeeIndex)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need to get data again, we already have data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Electra electra hardfork optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants