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

Check conten-type and return 415 if not supported by route #14054

Closed
nflaig opened this issue May 28, 2024 · 1 comment · Fixed by #14075
Closed

Check conten-type and return 415 if not supported by route #14054

nflaig opened this issue May 28, 2024 · 1 comment · Fixed by #14075
Assignees
Labels
API Api related tasks Bug Something isn't working

Comments

@nflaig
Copy link

nflaig commented May 28, 2024

Describe the bug

Noticed that Prysm BN does not check the content type of the request body and just tries to deserialize it, causing strange errors.

E.g. Error on Lodestar when trying to call getAttesterDuties with SSZ request body

[vc-09-geth-prysm-lodestar] May-28 22:38:48.648[]                error: Failed to download attester duties epoch=0 - getAttesterDuties failed with status 400: Could not decode request body: invalid character '>' looking for beginning of value
[vc-09-geth-prysm-lodestar] Error: getAttesterDuties failed with status 400: Could not decode request body: invalid character '>' looking for beginning of value

As per spec, this route does not require to support SSZ request bodies and by default Lodestar will be using JSON but it would still be nice if Prysm could return a 415 error as this would allow to gradually support SSZ for more routes as the client can retry the request with JSON body and cache for this route that SSZ is not supported, only sending JSON in subsequent requests.

Has this worked before in a previous version?

Likely not

🔬 Minimal Reproduction

I've been using Kurtosis to run the tests (with custom lodestar image)

participants:
  - el_type: geth
    el_image: ethereum/client-go:stable
    cl_type: lodestar
    cl_image: nflaig/lodestar:ssz-api
    vc_type: prysm
    vc_image: gcr.io/prysmaticlabs/prysm/validator:latest
    count: 1
  - el_type: geth
    el_image: ethereum/client-go:stable
    cl_type: prysm
    cl_image: gcr.io/prysmaticlabs/prysm/beacon-chain:latest
    vc_type: lodestar
    vc_image: nflaig/lodestar:ssz-api
    count: 1

Error

Error itself is not really relevant for this issue

Platform(s)

Linux (x86)

What version of Prysm are you running? (Which release)

gcr.io/prysmaticlabs/prysm/beacon-chain:latest (v5.0.3)

Anything else relevant (validator index / public key)?

No response

@nflaig nflaig added the Bug Something isn't working label May 28, 2024
@james-prysm james-prysm added the API Api related tasks label May 30, 2024
@james-prysm james-prysm self-assigned this May 30, 2024
@james-prysm
Copy link
Contributor

will add checks thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants