IntersectMBO / IntersectMBO/ouroboros-network

N2C: No way to fetch block contents by point (intersection)

Open
#5,358 0 comments 1 reaction 0 assignees View on GitHub
enhancement node-to-client
Dominant language
Haskell
Stars
296
Forks
104
Avg merge
2d 10h
Merged PRs (30d)
4

Description

## Problem

When a client has an intersection (a known block point: slot + hash), there is no way to fetch the block body for that specific block via the Node-to-Client (N2C) protocol. The same operation is possible via Node-to-Node (N2N).

The chain-sync mini protocol only allows advancing **forward** from an intersection — it gives you the *next* block after the intersection, not the block *at* the intersection. This creates a dead end:

- If the next block doesn't exist yet (i.e. the intersection is the chain tip), there is nothing to fetch.
- To fetch the block *at* the intersection, you'd need to roll back to its predecessor and request the next block — but the predecessor point is not always known to the client.

## Workaround (client-side)

Store the previous block's slot and hash alongside each indexed block. To fetch a block by point:
1. Find the stored predecessor point.
2. Call `FindIntersect` on the predecessor.
3. Call `RequestNext` to receive the target block.
4. Verify the returned block matches the expected slot and hash.

This is fragile and requires extra index storage purely to compensate for a protocol limitation.

## Proposed Solution

Expose a **block-fetch-by-point** capability as a mini protocol on N2C (analogous to how N2N allows fetching block ranges). A corresponding `cardano-cli` command would let users query a block by its point without needing to run a full chain-sync session.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.