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: correctly get signature from single attestation bytes #7266

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Nov 29, 2024

Motivation

Need to correctly handle extracting signature from single attestation

Description

Use getSignatureFromSingleAttestationSerialized to extract signature from bytes for post-electra single attestations

Closes #7259

@nflaig nflaig requested a review from a team as a code owner November 29, 2024 10:52
@nflaig nflaig marked this pull request as draft November 29, 2024 10:52
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

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

Project coverage is 48.43%. Comparing base (cfe6c89) to head (655cd74).
Report is 2 commits behind head on devnet-5.

Additional details and impacted files
@@             Coverage Diff              @@
##           devnet-5    #7266      +/-   ##
============================================
- Coverage     48.44%   48.43%   -0.01%     
============================================
  Files           602      602              
  Lines         40321    40323       +2     
  Branches       2057     2057              
============================================
  Hits          19532    19532              
- Misses        20751    20753       +2     
  Partials         38       38              

@nflaig nflaig marked this pull request as ready for review November 29, 2024 11:52
@nflaig nflaig linked an issue Nov 29, 2024 that may be closed by this pull request
@nflaig nflaig merged commit 17b15cd into devnet-5 Nov 29, 2024
18 checks passed
@nflaig nflaig deleted the nflaig/fix-get-signature branch November 29, 2024 13:15
@@ -470,7 +471,9 @@ async function validateAttestationNoSignatureCheck(
let attDataRootHex: RootHex;
const signature = attestationOrCache.attestation
? attestationOrCache.attestation.signature
: getSignatureFromAttestationSerialized(attestationOrCache.serializedData);
: !isForkPostElectra(fork)
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally would like to see the fork switching logic to be hidden in sszBytes.ts

Maybe a function named getSignatureFromBeaconAttestationSerialized in a similar fashion as getBlockRootFromBeaconAttestationSerialized.

Copy link
Member Author

Choose a reason for hiding this comment

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

was debating that as well but figured we only use those in network processor and this pattern was used before already so I went with explicit fork logic in validation itself

const committeeIndexForLookup = isForkPostElectra(fork)
? (getCommitteeIndexFromAttestationOrBytes(fork, attestationOrBytes) ?? 0)
: PRE_ELECTRA_SINGLE_ATTESTATION_COMMITTEE_INDEX;

Either one seems fine to me

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.26.0 🎉

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.

BlsMultiThreadWorkerPool error - Value is not a valid number: Infinity
4 participants