-
Notifications
You must be signed in to change notification settings - Fork 307
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
use header based selector with slot fallback #8522
Conversation
There was a problem hiding this 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
inMilestoneDependentTypesUtil.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
// SignedBlockContents | ||
.or(() -> getSlot(json, "signed_block", "message", "slot")); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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
0dbd265
to
e8ea327
Compare
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:Eth-Consensus-Version
required: In that case we don't fallback to the slot selector since the request should fail when the consensus version header isn't provided or a bad value is used, we use theheaderBasedSelector
without fallback to the slot. This is the case for the V2 APIs: /eth/v2/beacon/pool/attestations, /eth/v2/beacon/pool/attester_slashings, /eth/v2/beacon/blinded_blocks and /eth/v2/beacon/blocksEth-Consensus-Version
optional: In taht case, we try to get the type definition using the header otherwise we fall back to the slot based selector if the header is not present, we use theheaderBasedSelectorWithSlotFallback
. This is the case for the V1 APIs: /eth/v1/beacon/blinded_blocks and /eth/v1/beacon/blocksPS: 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
doc-change-required
label to this PR if updates are required.Changelog