Skip to content

Conversation

NumberFour8
Copy link
Contributor

@NumberFour8 NumberFour8 commented Feb 5, 2025

This is to workaround a CBOR codec limitation for now.

This is to workaround a CBOR coded limitation for now.
@NumberFour8 NumberFour8 added this to the 2.2.2 milestone Feb 5, 2025
@NumberFour8 NumberFour8 requested a review from a team February 5, 2025 08:15
@NumberFour8 NumberFour8 self-assigned this Feb 5, 2025
@NumberFour8 NumberFour8 marked this pull request as ready for review February 5, 2025 08:15
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

📝 Walkthrough

Walkthrough

This pull request modifies the constant MAX_TICKETS_TO_AGGREGATE_BATCH in the file db/sql/src/tickets.rs, reducing its value from 10_000 to 500. The change adjusts the batching behavior for ticket aggregation without altering any additional logic or error handling.

Changes

File(s) Change Summary
db/sql/src/tickets.rs Updated the constant MAX_TICKETS_TO_AGGREGATE_BATCH from 10_000 to 500.

Possibly related PRs

Suggested labels

dependencies, crate:core-network, crate:core-protocol

Suggested reviewers

  • Teebor-Choka

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (3)
db/sql/src/tickets.rs (3)

863-865: Consider adding a comment explaining the batch size limit.

Adding a comment explaining why the batch size is limited to 500 would help future maintainers understand the CBOR coding limitation constraint.

 .filter(ticket::Column::State.ne(AcknowledgedTicketStatus::BeingAggregated as u8))
 .order_by_asc(ticket::Column::Index)// tickets must be sorted by indices in ascending order
+// Limited to 500 tickets per batch due to CBOR coding limitations
 .limit(MAX_TICKETS_TO_AGGREGATE_BATCH)

669-671: Consider implementing the TODO for persisting mechanism hint.

The TODO comment suggests implementing a hint for the persisting mechanism. This could help optimize the persistence of ticket indices.

Would you like me to help implement the persisting mechanism hint or create an issue to track this improvement?


1067-1070: Remove unused variable warning suppression.

The #[allow(unused_variables)] attribute can be removed since the variable is actually used in the code.

-#[allow(unused_variables)]
 let current_ticket_index_from_aggregated_ticket =
     U256::from(aggregated_ticket.verified_ticket().index).add(aggregated_ticket.verified_ticket().index_offset);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 567ba06 and 2b4ae58.

📒 Files selected for processing (1)
  • db/sql/src/tickets.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: hoprd / docker
  • GitHub Check: hopli / docker
  • GitHub Check: Docs / Rust docs
  • GitHub Check: tests-unit-nightly
  • GitHub Check: tests-unit
  • GitHub Check: tests-smoke-websocket
  • GitHub Check: tests-smart-contracts
  • GitHub Check: Linter
🔇 Additional comments (4)
db/sql/src/tickets.rs (4)

47-48: LGTM: Reducing batch size to work around CBOR coding limitation.

The reduction of MAX_TICKETS_TO_AGGREGATE_BATCH from 10,000 to 500 is a reasonable workaround for the CBOR coding limitation. The smaller batch size should help prevent any encoding/decoding issues while still maintaining efficient batch processing.


681-683: Consider implementing the TODO for persisting mechanism hint.

Similar TODO comment for persisting mechanism hint in another function.


693-694: Consider implementing the TODO for persisting mechanism hint.

Similar TODO comment for persisting mechanism hint in another function.


1-3363: Verify test coverage for the new batch size limit.

The test suite is comprehensive but should verify that the new 500 ticket batch size limit is properly enforced and doesn't cause any issues.

@NumberFour8 NumberFour8 merged commit f08cf80 into release/singapore Feb 5, 2025
40 of 46 checks passed
@NumberFour8 NumberFour8 deleted the hotfix/lower-ticket-batch-size branch February 5, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants