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

[Feature] Filter::from_block(u64) + Filter::to_block(u64) -> blocks(RangeBounds) #1947

Closed
kayabaNerve opened this issue Jan 24, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@kayabaNerve
Copy link
Contributor

Component

rpc

Describe the feature you would like

Currently, Filter applies specifying a from_block and to_block with dedicated setters for each. This follows the literal Ethereum JSON-RPC specification.

With regards to Rust, it's be more expressive to use RangeBounds. This would let the caller write filter.blocks(0 .. 32), filter.blocks(0 ..= 32), filter.blocks(.. 32), etc., ensuring clarity on the range and promoting greater expression. For reference, the current methods are inclusive yet not immediately obvious as inclusive (unlike how .. and ..= would be).

Additional context

No response

@kayabaNerve kayabaNerve added the enhancement New feature or request label Jan 24, 2025
@kayabaNerve
Copy link
Contributor Author

kayabaNerve commented Jan 24, 2025

I looked for this a few days ago and didn't see it. I just double-checked after opening the issue and noticed select covers this exact behavior. I'm sorry for the mistake there and the noise here, my bad.

I will note FilterBlockOption doesn't implement From<RangeBounds>, solely From inclusive/open-ended standard library implementers of RangeBounds (as documented), but I don't see that as worth an issue. I can still get the explicit inclusive bound I wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant