-
Notifications
You must be signed in to change notification settings - Fork 189
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
Update mod.rs #2666
Update mod.rs #2666
Conversation
add chunk size limit for starknet_getEvents method
WalkthroughOhayo, sensei! This pull request introduces a new constant Changes
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
crates/katana/rpc/rpc/src/starknet/mod.rs (2)
55-55
: LGTM! The chunk size limit is well-chosen.The constant value of 100 provides a good balance between performance and resource utilization.
This limit helps prevent potential DoS attacks by ensuring that clients can't request an excessive number of events in a single call.
504-531
: Ohayo! The implementation looks solid, but could use more documentation.The method correctly implements chunked event fetching with proper validation and pagination. Consider adding documentation to explain:
- The meaning of a zero or negative chunk_size
- The behavior when chunk_size exceeds MAX_CHUNK_SIZE
- The format and usage of the continuation token
Add rustdoc comments like this:
+/// Fetches events with pagination based on the provided chunk size. +/// +/// # Arguments +/// * `filter` - The event filter criteria +/// * `chunk_size` - The maximum number of events to return (must be between 1 and MAX_CHUNK_SIZE) +/// +/// # Returns +/// Returns an EventsPage containing the events and a continuation token if there are more events. +/// +/// # Errors +/// Returns InvalidChunkSize if chunk_size is 0 or exceeds MAX_CHUNK_SIZE async fn get_events_with_limit( &self, filter: EventFilterWithPage, chunk_size: usize, ) -> StarknetApiResult<EventsPage> {
Isn't this already tackled by #2644? |
Description
add chunk size limit for starknet_getEvents method
Summary by CodeRabbit
New Features
Improvements