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

feat(builder-spec): Correctly reject SSZ Accept/Content-Types headers. #678

Merged
merged 9 commits into from
Feb 19, 2025

Conversation

ryanschneider
Copy link
Contributor

📝 Summary

As outlined in #677 this PR implements "Milestone 1" where we correctly reject SSZ Accept and Content-Type headers.

It adds two new helper functions, both of which depend on the new mimeheader dependency:

  • RequestAcceptsJSON returns true if the request either does not include an Accept header or the header allows JSON response types.
  • NegotiateRequestResponseType is not yet used, but shows how we can handle accept header parsing in Milestone 2.

⛱ Motivation and Context

Begins supporting ethereum/builder-specs#104 by implementing the first milestone in #677.

📚 References


✅ I have run these commands

  • make lint
  • make test-race
  • go mod tidy
  • I have seen and agree to CONTRIBUTING.md

@ryanschneider ryanschneider changed the title Ssz milestone 1 feat(builder-spec): Correctly reject SSZ Accept/Content-Types headers. Feb 10, 2025
@jtraglia
Copy link
Collaborator

Nice, this looks good. We should do this for registerValidators too. To preempt this:

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 62.50000% with 15 lines in your changes missing coverage. Please review.

Project coverage is 30.49%. Comparing base (13160be) to head (99062c7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
services/api/service.go 62.50% 14 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #678      +/-   ##
==========================================
- Coverage   32.57%   30.49%   -2.09%     
==========================================
  Files          42       42              
  Lines        6972     7015      +43     
==========================================
- Hits         2271     2139     -132     
- Misses       4412     4602     +190     
+ Partials      289      274      -15     
Flag Coverage Δ
unittests 30.49% <62.50%> (-2.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @ryanschneider!

@metachris metachris merged commit a89aea6 into main Feb 19, 2025
4 checks passed
@metachris metachris deleted the ssz-milestone-1 branch February 19, 2025 15:58
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.

4 participants