Skip to content

Conversation

@0xNeshi
Copy link
Collaborator

@0xNeshi 0xNeshi commented Sep 15, 2025

Closes #1

Instead of returning a stream of block ranges, it is much more straightforward to accept a channel from the caller to which to send block ranges.
This also allows the caller to control the pace at which they receive new block ranges (1 at a time, all at once etc.).

@0xNeshi 0xNeshi requested a review from LeoPatOZ September 15, 2025 12:07
@0xNeshi 0xNeshi self-assigned this Sep 15, 2025
@0xNeshi
Copy link
Collaborator Author

0xNeshi commented Sep 15, 2025

Ignore the failing clippy job, I will fix this when we're sure the design is ok

@0xNeshi 0xNeshi marked this pull request as ready for review September 16, 2025 10:35
@0xNeshi 0xNeshi changed the base branch from block-scanner to main September 16, 2025 10:40
@0xNeshi 0xNeshi changed the base branch from main to block-scanner September 16, 2025 10:41
@0xNeshi
Copy link
Collaborator Author

0xNeshi commented Sep 16, 2025

@0xNeshi 0xNeshi requested a review from LeoPatOZ September 16, 2025 11:58
Comment on lines 730 to 732
start_height: BlockNumberOrTag,
end_height: Option<BlockNumberOrTag>,
buffer_size: usize,
Copy link
Collaborator

@LeoPatOZ LeoPatOZ Sep 16, 2025

Choose a reason for hiding this comment

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

Maybe better to have like optional config?

struct Config {
start_height: Option<BlockNumberOrTag>,
end_height: Option<BlockNumberOrTag>
buffer_size: Option<size>
}

subscribe(
 &self,
config: Config,
)

Just so we have named parameters i think it makes a nicer API. We could also have sensible defaults for them.
Start Height --> Latest
End Height --> None
Buffer Size --> 1 (process one block at a time)

wdyt

Copy link
Collaborator Author

@0xNeshi 0xNeshi Sep 17, 2025

Choose a reason for hiding this comment

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

I removed buffer_size as it makes little sense (as we discussed yesterday).

This issue #26 avoids the default value logic completely and makes the Config redundant imo. The reason it avoids the issue is that it makes it clear what the client wants to do based on the command they issue, so these height parameters no longer appear for all commands and defaults are implicit.

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.

Had a quick look - i currently only made comments regarding the API i.e. how someone would interact with this library rather than the specifics of the internals.

Depends on how you want to handle it, either we just get this merged now with some API changes then deal with the internals later (shouldnt be any breaking changes) or we try to clean up things in this PR. Im more for the former but let me know what you think.

@0xNeshi 0xNeshi requested a review from LeoPatOZ September 17, 2025 11:18
@LeoPatOZ LeoPatOZ merged commit 8cd6f30 into block-scanner Sep 17, 2025
6 checks passed
@LeoPatOZ LeoPatOZ deleted the block-scanner-ref branch September 17, 2025 12:21
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.

3 participants