Skip to content

Prysm VC more robust content-type header handling #14093

Closed
@nflaig

Description

Describe the bug

Was looking into ChainSafe/lodestar#6633 compatibility issue of Lodestar BN <> Prsym VC.

The error on the Prysm side

time="2024-06-08 20:13:34" level=info msg="Syncing with beacon node to align on chain genesis info" prefix=client
time="2024-06-08 20:13:34" level=warning msg="Could not determine if beacon chain started" error="could not receive ChainStart from stream: failed to get genesis data: genesis data is nil: could not connect" prefix=client

But the response from Lodestar looks correct

time="2024-06-08T20:13:44Z" level=info msg="REQUEST #2: GET /eth/v1/beacon/genesis" length=0 type=json
time="2024-06-08T20:13:44Z" level=info msg="RESPONSE #2: GET /eth/v1/beacon/genesis" length=169 status=200 type=json
{
  "data": {
    "genesis_fork_version": "0x10000038",
    "genesis_time": "1717877689",
    "genesis_validators_root": "0x70498f18a6f07107a2a05d0d36c7cbd93b3e439023cbef21a6681eebee194526"
  }
}

I believe the reason why the data is nil is due to the way the content-type header is checked

if httpResp.Header.Get("Content-Type") != api.JsonMediaType {

it compares the whole header against the media type but in reality, the conten type header can also include the charset and boundry (see Content-Type#directives).

Lodestar returns the following header

content-type: application/json; charset=utf-8

which is a valid content-type header format, on Prysm side you probably wanna apply something like

strings.SplitN(contentType, ";", 2)[0]

Has this worked before in a previous version?

No response

🔬 Minimal Reproduction

Kurtosis config

participants:
  - el_type: geth
    el_image: ethereum/client-go:stable
    cl_type: lodestar
    cl_image: chainsafe/lodestar:latest
    vc_type: prysm
    vc_image: gcr.io/prysmaticlabs/prysm/validator:latest
    count: 2
  - 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: chainsafe/lodestar:latest

Error

No response

Platform(s)

Linux (x86)

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

v5.0.3

Anything else relevant (validator index / public key)?

Related issue ChainSafe/lodestar#6633

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

APIApi related tasksBugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions