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

use header based selector with slot fallback #8522

Merged
merged 4 commits into from
Aug 22, 2024

Conversation

mehdi-aouadi
Copy link
Contributor

@mehdi-aouadi mehdi-aouadi commented Aug 21, 2024

PR Description

Use the Eth-Consensus-Version header when available to determine the request body type definition and fallback to the slot selector when the header is not required and not present:

PS: This only covers the json content type use case. For the ssz use case, we always fall back to the slot selector even when the header is required but not provided which is not ideal IMO. I thought we should maybe be more strict about that and make the request fail when the header is required but not provided for the ssz content type

Fixed Issue(s)

fixes #7720

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.

@mehdi-aouadi mehdi-aouadi self-assigned this Aug 21, 2024
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 implements support for the 'Eth-Consensus-Version' header in Teku's beacon node API, improving version-aware request handling and type definition selection.

  • Added headerBasedSelectorWithSlotFallback in MilestoneDependentTypesUtil.java for flexible header-based selection
  • Updated V2 API endpoints (PostBlindedBlockV2, PostBlockV2) to require the 'Eth-Consensus-Version' header
  • Modified V1 API endpoints (PostBlindedBlock, PostBlock) to use header-based selection with slot fallback
  • Enhanced error handling and messaging for missing or invalid 'Eth-Consensus-Version' headers
  • Improved test coverage in MilestoneDependentTypesUtilTest for different SpecMilestones and header scenarios

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

Comment on lines +122 to +123
// SignedBlockContents
.or(() -> getSlot(json, "signed_block", "message", "slot"));
Copy link
Contributor

Choose a reason for hiding this comment

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

is block contents still a thing? I thought that went away?

Copy link
Contributor Author

@mehdi-aouadi mehdi-aouadi Aug 22, 2024

Choose a reason for hiding this comment

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

Yep, we added them since Deneb to handle block and blobs. thought we could remove this use case but turned out necessary when we send Deneb block contents to the post block V1 apis, they might retrieve the slot in order to get the correct schema

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 just a question about block contents container

@mehdi-aouadi mehdi-aouadi enabled auto-merge (squash) August 22, 2024 12:56
@mehdi-aouadi mehdi-aouadi merged commit 35da85a into Consensys:master Aug 22, 2024
17 checks passed
@mehdi-aouadi mehdi-aouadi deleted the 7720-header-selector branch August 22, 2024 14:18
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.

Support eth-consensus-version header as parameter
2 participants