Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use impl From<RangeInclusive> for FilterBlockOption instead of Range #1199

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

joshieDo
Copy link
Contributor

Motivation

FilterBlockOption deals with inclusive ranges.

pub enum FilterBlockOption {
/// Represents a range of blocks with optional from and to blocks
///
/// Note: ranges are considered to be __inclusive__
Range {
/// The block number or tag this filter should start at.
from_block: Option<BlockNumberOrTag>,
/// The block number or that this filter should end at.
to_block: Option<BlockNumberOrTag>,

While passing an exclusive range (eg .select(start..end)), it was wrongly including the end range in the filter.

Solution

Only allow conversion from RangeInclusive instead of Range, since decrementing a block tag is not possible.

@mattsse mattsse merged commit 2242ac8 into alloy-rs:main Aug 26, 2024
26 checks passed
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