Skip to content

Conversation

@0xNeshi
Copy link
Collaborator

@0xNeshi 0xNeshi commented Sep 11, 2025

The responsibility of the block scanner is to process blocks in the correct order and to gracefully handle reorgs.

It reads blocks and feeds them into a channel, with the calling code being able to "receive" the blocks as they come. The idea is for this to enable us to gracefully handle historic -> live transition when initiating the event scanning, as blocks would be "fed" to the channel as they're fetched from the chain.

Using this as the base type, we are able to create an event scanner wrapper that handles actual event processing.

@0xNeshi 0xNeshi requested a review from LeoPatOZ September 11, 2025 09:55
@0xNeshi 0xNeshi self-assigned this Sep 11, 2025
@0xNeshi 0xNeshi marked this pull request as draft September 11, 2025 10:15
blocks_read_per_epoch: u64,
start_height: BlockNumberOrTag,
end_height: BlockNumberOrTag,
current: Header,
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure if this makes a difference but to save memory we could just store the block number rather than the entire header?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we need the hash too for the reorg detection

@0xNeshi 0xNeshi changed the title Block Channel Design Proposal Block + Event Channel Design Proposal Sep 11, 2025
@0xNeshi 0xNeshi marked this pull request as ready for review September 11, 2025 10:41
@0xNeshi 0xNeshi requested a review from LeoPatOZ September 11, 2025 10:42
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.

Looking good i think this is a great starting point for the rest of the scanner

@0xNeshi
Copy link
Collaborator Author

0xNeshi commented Sep 12, 2025

Removed the reviewdog for clippy due to displaying duplicate errors:
image

Never noticed this before, but it's annoying.

@0xNeshi 0xNeshi merged commit e838723 into main Sep 12, 2025
6 checks passed
@0xNeshi 0xNeshi deleted the channels branch September 12, 2025 06:43
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