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

Blocks - Implement subjects on core #91

Closed
13 tasks
pedronauck opened this issue Jul 24, 2024 · 0 comments · Fixed by #125
Closed
13 tasks

Blocks - Implement subjects on core #91

pedronauck opened this issue Jul 24, 2024 · 0 comments · Fixed by #125

Comments

@pedronauck
Copy link
Collaborator

pedronauck commented Jul 24, 2024

Description

Implement the Subject::Blocks variant and corresponding Filter methods in the SDK to allow users to subscribe to and filter block data streams. This will enable specific querying and filtering of block information. The implementation should translate filters into the correct NATS subject pattern: blocks.{producer}.{height}.

Tasks

  • Add a Blocks variant to the Subject enum if not already present
  • Implement a Filter<Subject::Blocks> specialization
  • Add the following methods to Filter<Subject::Blocks>:
    • with_producer(producer: String) -> Self
    • with_height(height: BlockHeight) -> Self
  • Create a method to convert Filter<Subject::Blocks> to NATS subject strings, following the pattern blocks.{producer}.{height}
  • Write unit tests for block filter implementations
  • Create integration tests demonstrating block filter usage with Subscription

Technical Details

Ensure each method can be called just once in the builder

  • Ensure type safety when creating filters specifically for block subjects
  • Implement the builder pattern for block filters to allow for a fluent API
  • Define BlockHeight type (likely as a type alias for u32 or similar)
  • Optimize the conversion from block filters to NATS subject strings
  • Ensure the conversion to NATS subjects correctly follows the blocks.{producer}.{height} pattern

Additional Notes

  • The implementation should support usage patterns like:
    Filter::<Subject::Blocks>::new().with_producer("0x1234...").with_height(1000)
  • Consider adding additional useful block filtering criteria beyond producer and height
  • Ensure consistency with other subject filter implementations in the SDK
  • The final NATS subject should correctly represent the filter, e.g., blocks.0x1234....1000

Definition of Done

  • Code implemented
  • Unit tests written and passing
  • Integration tests (if applicable) written and passing
  • Documentation updated
  • Code reviewed
@pedronauck pedronauck added this to the v1 - Internal MVP milestone Jul 24, 2024
@pedronauck pedronauck self-assigned this Aug 11, 2024
@pedronauck pedronauck changed the title Implement Subject and Filters for blocks in the SDK Blocks - Implement subjects on core Aug 15, 2024
@pedronauck pedronauck removed this from the v1 - Internal MVP milestone Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant