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

fix: return correct type from attestation validation when using cache #7261

Merged
merged 7 commits into from
Nov 30, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Nov 28, 2024

Motivation

We use committeeIndex to determine if single attestation is from post-electra

return (singleAttestation as SingleAttestation<ForkPostElectra>).committeeIndex !== undefined;

This check itself is fine and should be sufficient based on the type but we return incorrect attestation type from validation when using the cache as it always contains the committeeIndex leading to the following error pre-electra

    at NetworkProcessor.processPendingGossipsubMessage (file:///usr/app/packages/beacon-node/src/network/processor/index.ts:438:9)
Nov-28 08:47:03.349[network]         error: Error adding unaggregated attestation to pool subnet=29 - Attestation should be type phase0.Attestation
Error: Attestation should be type phase0.Attestation
    at Object.true (file:///usr/app/packages/utils/src/assert.ts:7:13)
    at AttestationPool.add (file:///usr/app/packages/beacon-node/src/chain/opPools/attestationPool.ts:139:18)
    at Object.beacon_attestation (file:///usr/app/packages/beacon-node/src/network/processor/gossipHandlers.ts:649:57)
    at NetworkProcessor.gossipValidatorBatchFn (file:///usr/app/packages/beacon-node/src/network/processor/gossipValidatorFn.ts:36:23)
    at NetworkProcessor.processPendingGossipsubMessage (file:///usr/app/packages/beacon-node/src/network/processor/index.ts:438:9)

Description

Return correct type from attestation validation when using cache

@nflaig nflaig marked this pull request as ready for review November 28, 2024 17:01
@nflaig nflaig requested a review from a team as a code owner November 28, 2024 17:01
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 48.42%. Comparing base (957684f) to head (e0be1ea).
Report is 1 commits behind head on devnet-5.

Additional details and impacted files
@@             Coverage Diff              @@
##           devnet-5    #7261      +/-   ##
============================================
- Coverage     48.42%   48.42%   -0.01%     
============================================
  Files           602      602              
  Lines         40337    40334       -3     
  Branches       2061     2057       -4     
============================================
- Hits          19535    19532       -3     
  Misses        20764    20764              
  Partials         38       38              

@nflaig nflaig requested a review from twoeths November 29, 2024 10:17
@nflaig nflaig merged commit 5f55066 into devnet-5 Nov 30, 2024
17 checks passed
@nflaig nflaig deleted the nflaig/fix-attestation-format branch November 30, 2024 17:50
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