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

validator REST: attestation v2 #14633

Merged
merged 29 commits into from
Nov 20, 2024
Merged

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Nov 7, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

added the use of the following endpoints for validator rest mode to support the Electra hardfork

  • /eth/v2/beacon/pool/attestations POST
  • /eth/v2/validator/aggregate_and_proofs POST
  • /eth/v2/validator/aggregate_attestation GET
  • add v1 fall back for pre electra, with v2 as default

Tested via e2e : bazel test //testing/endtoend:go_minimal_scenario_test --test_output=streamed --test_timeout=10000 --test_filter=TestEndToEnd_MinimalConfig_ValidatorRESTApi --flaky_test_attempts=1

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

  • I have read CONTRIBUTING.md.
  • I have made an appropriate entry to CHANGELOG.md.
  • I have added a description to this PR with sufficient context for reviewers to understand this PR.

@james-prysm james-prysm added API Api related tasks Electra electra hardfork labels Nov 7, 2024
return nil, errors.Wrap(err, "failed to get attestation data")
}

signature, err := hexutil.Decode(jsonAttestation.Signature)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we be checking for lengths?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can add this in a future PR, but I would not do it here

@james-prysm james-prysm marked this pull request as ready for review November 8, 2024 21:47
@james-prysm james-prysm requested a review from a team as a code owner November 8, 2024 21:47
@james-prysm james-prysm marked this pull request as draft November 8, 2024 21:47
@james-prysm james-prysm marked this pull request as ready for review November 13, 2024 21:08
@james-prysm james-prysm marked this pull request as draft November 19, 2024 15:09

aggregatedAttestation, err := convertAttestationToProto(attData)
var aggregateAttestationResponse structs.AggregateAttestationResponse
err := c.jsonRestHandler.Get(ctx, endpoint, &aggregateAttestationResponse)
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 i need to add a header to this too for eth consensus version https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Validator/getAggregatedAttestationV2

@james-prysm james-prysm marked this pull request as ready for review November 19, 2024 18:14
Copy link
Contributor

@rkapka rkapka left a comment

Choose a reason for hiding this comment

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

Missing fallback for submitSignedAggregateSelectionProof

Comment on lines 106 to 112
attElectra, ok := attestation.(*ethpb.AttestationElectra)
if !ok {
return errors.New("attestation is not electra")
}
if len(attElectra.CommitteeBits) == 0 {
return errors.New("attestation committee bits can't be nil")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just call attestation.CommitteeBitsVal()

validator/client/beacon-api/propose_attestation.go Outdated Show resolved Hide resolved
@james-prysm james-prysm added this pull request to the merge queue Nov 20, 2024
Merged via the queue into develop with commit 9382ae7 Nov 20, 2024
17 of 18 checks passed
@james-prysm james-prysm deleted the validator-rest-electra-attestation branch November 20, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Electra electra hardfork
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants