-
Couldn't load subscription status.
- Fork 5
Allow defining "include" and "exclude" filters on selections in query #80
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
Conversation
WalkthroughRefactors selection/filter types by introducing a generic Selection and concrete *Filter structs, adds From conversions, updates client usage to construct selections via .from(...), bumps package versions, enhances CI linting, and adds backward-compatibility tests for deserialization and round-trip serialization. (47 words) Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant NetTypes
participant Server
rect rgb(240,248,255)
note left of Client: Build query using filters
Client->>NetTypes: Create TransactionFilter / LogFilter
Client->>NetTypes: TransactionSelection::from(TransactionFilter) \nLogSelection::from(LogFilter)
end
rect rgb(245,255,240)
note left of Client: Compose Query
Client->>NetTypes: Insert Selection(s) into Query
end
rect rgb(255,250,240)
note left of Client: Serialize & send
Client->>Server: POST /query (serialized Query JSON)
Server-->>Client: Query response
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
237777d to
b566eab
Compare
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: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/ci.yaml(1 hunks)hypersync-client/src/preset_query.rs(4 hunks)hypersync-client/tests/api_test.rs(2 hunks)hypersync-net-types/Cargo.toml(1 hunks)hypersync-net-types/src/lib.rs(5 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
hypersync-client/tests/api_test.rs (1)
hypersync-net-types/src/lib.rs (1)
from(27-32)
hypersync-client/src/preset_query.rs (1)
hypersync-net-types/src/lib.rs (1)
from(27-32)
🪛 actionlint (1.7.7)
.github/workflows/ci.yaml
22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
23-23: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
45-45: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
46-46: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
68-68: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
69-69: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (14)
.github/workflows/ci.yaml (2)
72-72: Good addition of explicit component dependencies.Explicitly declaring
rustfmtandclippyas required components ensures the lint job has the necessary tools. This is a best practice for CI reliability.
22-40: LGTM: Consistent formatting improvements.The indentation and structure changes improve readability and maintain consistency across all three jobs. The workflow logic remains unchanged aside from the beneficial addition of explicit components in the lint job.
Also applies to: 45-63, 68-87
hypersync-client/src/preset_query.rs (4)
6-8: LGTM! Import updates align with the new API.The imports correctly bring in the new
LogFilterandTransactionFiltertypes required for the refactored selection constructors.
86-89: LGTM! Correct usage of the new From-based construction.The
LogSelection::from(LogFilter { ... })pattern correctly leverages the new genericSelection<T>API, preserving the original filter semantics while adopting the new type structure.
121-125: LGTM! Consistent with the new filter construction pattern.The construction correctly uses
LogSelection::from(LogFilter { ... })with topics and address fields, maintaining the original query semantics.
175-178: LGTM! Transaction filter construction follows the established pattern.The
TransactionSelection::from(TransactionFilter { ... })correctly constructs the selection with thefromfield, consistent with the refactored API.hypersync-client/tests/api_test.rs (2)
8-8: LGTM! Import correctly updated for the new API.The addition of
TransactionFilterto the imports enables the test to use the new filter construction pattern.
461-464: LGTM! Test correctly updated to use the new From-based construction.The test properly constructs
TransactionSelectionviaTransactionSelection::from(TransactionFilter { ... }), using thefrom_filterfield with a bloom filter. This maintains the original test semantics while adopting the refactored API.hypersync-net-types/src/lib.rs (6)
26-33: LGTM! From implementation provides ergonomic construction.The
From<T>implementation allows users to constructSelection<T>from just a filter, defaultingexcludetoNone. This maintains backward compatibility for users who don't need negative filtering while enabling the new feature.
35-47: LGTM! BlockFilter correctly encapsulates block filtering logic.The
BlockSelectiontype alias andBlockFilterstruct cleanly separate the selection wrapper from the filter criteria. The hash and miner fields are well-documented with their empty-vector semantics.
49-63: LGTM! LogFilter properly encapsulates log filtering criteria.The
LogSelectionalias andLogFilterstruct correctly expose address, address_filter (bloom), and topics fields with clear documentation.
65-108: LGTM! TransactionFilter comprehensively covers transaction filtering.The
TransactionSelectionalias andTransactionFilterstruct provide extensive filtering capabilities including from/to addresses (with bloom filter support), sighash, status, type, contract address, hash, and authorization list. Field documentation is clear about AND/OR relationships.
120-145: LGTM! TraceFilter follows consistent design pattern.The
TraceSelectionalias andTraceFilterstruct maintain consistency with other filter types, providing from/to/address filtering (with bloom support), call_type, reward_type, kind, and sighash fields.
209-216: LGTM! Documentation added to JoinMode variants.The added documentation clarifies the behavior of each
JoinModevariant, improving API usability.
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.
Check the '/examples'
Checked, they all build and they were part of the workspace to begin with 👍🏼 |
ef46d51 to
35ca036
Compare
commit f91c16a Author: Jono Prest <65739024+JonoPrest@users.noreply.github.com> Date: Fri Oct 24 14:25:31 2025 +0200 Allow defining "include" and "exclude" filters on selections in query (#80) * Add exclude selections to query * Bump version * Use empty vecs instead of optionals for exclude selections * Change structure to allow and or semantics * Add fmt and clippy * Bump minor versions since the public api breaks * Add backwards compatability tests * Add serialization test for new queries * Add pretty assertions * Fix serialization compatability test and improve serialization efficiency * Use checksum addresses for passing tests * Add rc flag for release commit 14920fe Author: Jono Prest <65739024+JonoPrest@users.noreply.github.com> Date: Thu Oct 16 17:34:00 2025 +0200 Handle null effectiveGas for zeta receipts (#81) commit a1ec5d3 Author: Özgür Akkurt <oezgurmakkurt@gmail.com> Date: Wed Sep 10 20:57:05 2025 +0600 format: make quantity compatible with bincode (#77) * format: make quantity compatible with bincode * improve code path * fix serde expect string * version bump commit 13b5362 Merge: fd505a4 0f67fb5 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:55:11 2025 +0400 Merge pull request #76 from enviodev/dz/improve-get-events-join-logic Improve Get Event join logic commit 0f67fb5 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:49:57 2025 +0400 Update EventResponse type commit 5f6d2a3 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:44:00 2025 +0400 Fixes after review commit 8208307 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Wed Sep 3 20:19:58 2025 +0400 Fix clippy commit 001c2ef Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Wed Sep 3 20:05:20 2025 +0400 Improve Get Event join logic commit fd505a4 Author: Jason Smythe <jason@wildcards.world> Date: Thu Sep 4 13:17:47 2025 +0200 BlockNumber as integer rather than Hex for Sonic RPC (#72) * BlockNumber as integer rather than Hex for Sonic RPC Enhance Quantity deserialization to accept numeric values Updated the QuantityVisitor to handle both hex strings and numeric values (u64 and i64) for deserialization. Added tests to verify the correct handling of numeric JSON values. * bump hypersync format version * Improve deserializer for quantity * Bump versions again for release --------- Co-authored-by: Jono Prest <jjprest@gmail.com> Merge branch 'main' into jp/hack-efficient-queries
Summary by CodeRabbit
New Features
Tests
Chores