Skip to content

feat(net): add BlockAccessListsClient trait and p2p BAL downloading (eth/71) #22593

@mattsse

Description

@mattsse

Summary

Add a BlockAccessListsClient trait (analogous to BodiesClient) for downloading block access lists from peers over the eth/71 protocol. The wire types GetBlockAccessLists and BlockAccessLists already exist, and the server-side handling is wired up, but there is no client-side trait or fetcher integration to request them.

Relates to #22591 (ReceiptsClient).

TODO

1. Define the BlockAccessListsClient trait

Create a new module under crates/net/p2p/src/ (e.g. block_access_lists/) with a trait modeled after BodiesClient:

#[auto_impl(&, Arc, Box)]
pub trait BlockAccessListsClient: DownloadClient {
    type Output: Future<Output = PeerRequestResult<BlockAccessLists>> + Send + Sync + Unpin;

    fn get_block_access_lists(&self, hashes: Vec<B256>) -> Self::Output;
    fn get_block_access_lists_with_priority(&self, hashes: Vec<B256>, priority: Priority) -> Self::Output;
}

2. Add a GetBlockAccessLists variant to DownloadRequest

Extend the DownloadRequest enum with a new variant:

GetBlockAccessLists {
    request: Vec<B256>,
    response: oneshot::Sender<PeerRequestResult<BlockAccessLists>>,
    priority: Priority,
}

3. Implement BlockAccessListsClient for FetchClient

Follow the pattern in FetchClient's BodiesClient impl — send a DownloadRequest::GetBlockAccessLists over the channel.

4. Handle the request in StateFetcher

Wire up the new download request in StateFetcher:

  • Add inflight_bal_requests tracking (similar to inflight_bodies_requests)
  • Add PeerState::GetBlockAccessLists variant
  • Handle dispatching in prepare_block_request / poll_action

5. Check peer version before dispatching — eth/71 only

Important: GetBlockAccessLists / BlockAccessLists are only available in eth/71 (message IDs 0x12 / 0x13). The Peer struct already stores capabilities. Before dispatching a BAL request to a peer, the fetcher must verify the peer has negotiated eth/71. Peers on eth/70 or earlier must be skipped in next_best_peer.

6. Handle BAL responses in the session layer

The session layer already decodes BAL responses (active.rs), but these need to be routed back through the StateFetcher to resolve the inflight request's oneshot::Sender.

Reference

@Soubhik-10 @Rimeeeeee

Metadata

Metadata

Assignees

Labels

A-devp2pRelated to the Ethereum P2P protocol

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions