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 #14984

Merged
merged 16 commits into from
Mar 4, 2025
Merged

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?

This PR 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

james-prysm and others added 10 commits February 25, 2025 10:16
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
rkapka
rkapka previously approved these changes Feb 26, 2025
@james-prysm james-prysm dismissed rkapka’s stale review February 27, 2025 20:48

will break out the fix and add unit test for it

log.WithError(err).Debug("Could not save unaggregated attestation")
return
}
}
s.setSeenCommitteeIndicesSlot(data.Slot, data.CommitteeIndex, att.GetAggregationBits())
s.setSeenCommitteeIndicesSlot(data.Slot, data.GetCommitteeIndex(), attForValidation.GetAggregationBits())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dang this is still wrong pr fixes this #14998

@james-prysm james-prysm removed the Bug Something isn't working label Feb 27, 2025
@james-prysm james-prysm changed the title single attestation cleanup & getCommitteeIndex bug fix single attestation cleanup Feb 27, 2025
@james-prysm james-prysm added this pull request to the merge queue Mar 4, 2025
Merged via the queue into develop with commit d7efccf Mar 4, 2025
16 checks passed
@james-prysm james-prysm deleted the attestation-cleanup-suggestions branch March 4, 2025 15:17
rkapka added a commit that referenced this pull request Mar 19, 2025
* some cleanup and minor bug fix

* adding some comments back in

* Update beacon-chain/sync/pending_attestations_queue.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/pending_attestations_queue.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/validate_beacon_attestation.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/validate_beacon_attestation.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/validate_beacon_attestation.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/validate_beacon_attestation.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/validate_beacon_attestation.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* Update beacon-chain/sync/pending_attestations_queue.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* adding comment back in

* linting

* fixing committeeIndiciesSLot

* fixing changelog

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electra electra hardfork optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants