Skip to content

feat: stream worker batches#571

Draft
grantkee wants to merge 2 commits intomainfrom
stream-worker-batches
Draft

feat: stream worker batches#571
grantkee wants to merge 2 commits intomainfrom
stream-worker-batches

Conversation

@grantkee
Copy link
Contributor

WIP

@grantkee grantkee self-assigned this Feb 28, 2026
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this code to a separate mod for readability

/// 1. Sends a `RequestBatchesStream` request to negotiate
/// 2. If accepted, opens a stream with the request digest for correlation
/// 3. Reads and validates batches from the stream in real-time
async fn request_batches_from_peer(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new method

/// - Detects duplicate batches
///
/// SAFETY: this method times out if a batch fails to stream within time limit.
pub(crate) async fn read_and_validate_batches_with_timeout<S: AsyncRead + Unpin + Send>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

/// Helper method to digest missing batch request before initiating stream.
///
/// The digest is used to detect duplicate requests from peers.
pub(crate) fn generate_batch_request_id(&self, batch_digests: &HashSet<BlockHash>) -> B256 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new method

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant