Skip to content

Feature Request: Cache repeated requests to /eth/v1/builder/header/{slot}/{parent_hash}/{pubkey} #418

@DiogoSantoss

Description

@DiogoSantoss

Feature

Add caching for repeated requests to /eth/v1/builder/header/{slot}/{parent_hash}/{pubkey} so that if an identical request was recently completed, the service can return the stored result instead of querying relays again. This would help avoid unnecessary relay calls and prevent late in slot, skipping relay requests errors if previous requests have been completed.

Explanation

Operators running distributed validators pointed at the same beacon node generate multiple identical requests for /eth/v1/builder/header/{slot}/{parent_hash}/{pubkey} when preparing a proposal. In the observed behavior, even when a previous request for the same slot, parent hash, and validator had already completed successfully, subsequent identical requests still triggered new relay queries rather than reusing the earlier result.

Example

These logs show three sequential requests for the same block header, where relays were queried each time instead of using the previously obtained header:

INFO: new request
  ua="Lighthouse/v8.0.1-ced49dd"
  ms_into_slot=383
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=d646beb3-30c3-40ce-af66-8c7f44984a66
  slot=1878889
  parent_hash=0x978323efde9f54e6cd47c74c1f6d871e6a27ba29e9fbdefc0593a33f7794bc2b
  validator=0x8bbc694b4d8144401e21193d3d797c860b6b7a1afad110e7e145c7779bf8f81628a103f03d481c044d8432762a1e55bb

INFO: received header
  value_eth="0.012320624823158088"
  block_hash=0xc2686f25ba020eea862963529915c6b5bd9b80ead7c3b16601c0a484df831861
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=d646beb3-30c3-40ce-af66-8c7f44984a66
  slot=1878889
  parent_hash=0x978323efde9f54e6cd47c74c1f6d871e6a27ba29e9fbdefc0593a33f7794bc2b
  validator=0x8bbc694b4d8144401e21193d3d797c860b6b7a1afad110e7e145c7779bf8f81628a103f03d481c044d8432762a1e55bb

INFO: responded with 200 OK
  duration_ms=488
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=d646beb3-30c3-40ce-af66-8c7f44984a66

INFO: new request
  ua="Lighthouse/v8.0.1-ced49dd"
  ms_into_slot=882
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=c31cc129-abf1-410d-87b3-03bd30086113
  slot=1878889
  parent_hash=0x978323efde9f54e6cd47c74c1f6d871e6a27ba29e9fbdefc0593a33f7794bc2b
  validator=0x8bbc694b4d8144401e21193d3d797c860b6b7a1afad110e7e145c7779bf8f81628a103f03d481c044d8432762a1e55bb

ERROR: relay error
  err="Timed Out"
  relay_id="bloxroute"
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=c31cc129-abf1-410d-87b3-03bd30086113

INFO: received header
  value_eth="0.012320624823158088"
  block_hash=0xc2686f25ba020eea862963529915c6b5bd9b80ead7c3b16601c0a484df831861
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=c31cc129-abf1-410d-87b3-03bd30086113

INFO: responded with 200 OK
  duration_ms=126
  req_id=c31cc129-abf1-410d-87b3-03bd30086113

INFO: new request
  ua="Lighthouse/v8.0.1-ced49dd"
  ms_into_slot=1191
  method=/eth/v1/builder/header/{slot}/{parent_hash}/{pubkey}
  req_id=9f907831-e91f-4b01-8447-256f4c345941
  slot=1878889
  parent_hash=0x978323efde9f54e6cd47c74c1f6d871e6a27ba29e9fbdefc0593a33f7794bc2b
  validator=0x8bbc694b4d8144401e21193d3d797c860b6b7a1afad110e7e145c7779bf8f81628a103f03d481c044d8432762a1e55bb

WARN: late in slot, skipping relay requests
  ms_into_slot=1196
  threshold=1000
  req_id=9f907831-e91f-4b01-8447-256f4c345941

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions