Skip to content

Conversation

@0xNeshi
Copy link
Collaborator

@0xNeshi 0xNeshi commented Nov 21, 2025

Resolves #180

Towards #50 - added missing from/to block validation to latest mode

@0xNeshi 0xNeshi self-assigned this Nov 21, 2025
LeoPatOZ
LeoPatOZ previously approved these changes Nov 21, 2025
Copy link
Collaborator

@LeoPatOZ LeoPatOZ left a comment

Choose a reason for hiding this comment

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

looks good 👍

@0xNeshi 0xNeshi marked this pull request as draft November 21, 2025 12:20
@0xNeshi 0xNeshi marked this pull request as ready for review November 21, 2025 13:29
@0xNeshi 0xNeshi changed the title sync::from_latest and latest Modes Should Return ScannerStatus::StartBlock(BlockHash) Before Streaming Latest Events sync::from_latest and latest Modes Should Return Notification::NoPastLogsFound Instead Of Empty Vec Nov 21, 2025
Comment on lines +123 to +132
if collected.is_empty() {
info!("No logs found");
_ = sender.try_stream(Notification::NoPastLogsFound).await;
} else {
info!(count = collected.len(), "Logs found");
collected.reverse(); // restore chronological order
}

info!("Sending collected logs to consumer");
_ = sender.try_stream(collected).await;
info!("Sending collected logs to consumer");
_ = sender.try_stream(collected).await;
}
Copy link
Collaborator

@LeoPatOZ LeoPatOZ Nov 21, 2025

Choose a reason for hiding this comment

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

nit:

Suggested change
if collected.is_empty() {
info!("No logs found");
_ = sender.try_stream(Notification::NoPastLogsFound).await;
} else {
info!(count = collected.len(), "Logs found");
collected.reverse(); // restore chronological order
}
info!("Sending collected logs to consumer");
_ = sender.try_stream(collected).await;
info!("Sending collected logs to consumer");
_ = sender.try_stream(collected).await;
}
if collected.is_empty() {
info!("No logs found");
_ = sender.try_stream(Notification::NoPastLogsFound).await;
break;
}
info!(count = collected.len(), "Logs found");
collected.reverse(); // restore chronological order
info!("Sending collected logs to consumer");
_ = sender.try_stream(collected).await;
}

#[derive(Debug, Clone)]
/// Messages streamed by the scanner to subscribers.
///
/// Each message represents either data (logs), an error, or a notification about the scanner's
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

Suggested change
/// Each message represents either data (logs), an error, or a notification about the scanner's
/// Each message represents either data or a notification about the scanner's

No more error :D

Also not always logs?

Comment on lines +14 to +17
/// Data streamed to the subscriber.
Data(T),

/// Notification about scanner state changes or important events.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Also wonder how useful these are

Data is self explanatory and Notification comment is the same above the notification enum

Copy link
Collaborator

@LeoPatOZ LeoPatOZ left a comment

Choose a reason for hiding this comment

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

🚀

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.

sync::from_latest and latest Modes Should Return ScannerStatus::StartBlock(BlockHash) Before Streaming Latest Events

3 participants