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

Add support for phase0 and electra in PostAttesterSlashingV2 #8487

Merged

Conversation

gfukushima
Copy link
Contributor

PR Description

This PR fixes the PostAttesterSlashingV2 API to present a spec complaint with the oficial API spec supporting oneOf AttesterSlashingPhase0 or AttesterSlashingElectra

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Signed-off-by: Gabriel Fukushima <[email protected]>
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR updates the PostAttesterSlashingV2 API to support both Phase0 and Electra milestones, ensuring compliance with the official API specifications.

  • data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttesterSlashingV2IntegrationTest.java: Updated to support Phase0 and Electra, using TestTemplate for parameterized tests and improved error handling.
  • data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v2_beacon_pool_attester_slashings.json: Modified JSON schema to include a 'oneOf' clause for AttesterSlashingPhase0 or AttesterSlashingElectra.
  • data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/beacon/MilestoneDependentTypesUtil.java: Added headerBasedSelector method for schema selection based on HEADER_CONSENSUS_VERSION.
  • data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttesterSlashingV2.java: Refactored to handle both Phase0 and Electra versions using SerializableOneOfTypeDefinition and headerBasedSelector.
  • data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttesterSlashingV2Test.java: Updated test cases to support new attester slashing types and consensus version headers.

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

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

LGTM

@gfukushima gfukushima enabled auto-merge (squash) August 19, 2024 00:25
@gfukushima gfukushima merged commit cde06e1 into Consensys:master Aug 19, 2024
16 checks passed
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.

2 participants