Support block-only selections and block.number set filters#1277
Merged
Conversation
…selections HyperSync only returns rows that match a selection, so a query like `envio data block.hash --chain=base` produced an empty response: no log/transaction/block selection meant nothing to return. Add an unfiltered selection for every entity the user requests fields for, and set include_all_blocks when block fields are wanted but no filter scopes the blocks. Bare queries now stream from block zero.
block.number now accepts the same forms as other fields: a scalar or `_eq` pins a single block, and an array or `_in` scans [min, max] then drops the leftover blocks client-side. Comparison operators keep their existing range semantics. The pagination hint folds a carried-forward set back into the number range so reruns keep filtering the same blocks.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes queries that select only block fields without log/transaction filters, and improves
block.numberfilter handling to support set membership (_in) with client-side filtering.Key Changes
Block-only selections: Added
include_all_blocks()to HyperSync queries when block fields are selected but no log/transaction/block filters scope the results. Previously these queries returned empty results because HyperSync only returns rows matching a selection.block.numberrefactoring: Replaced custom operator parsing with reuse of the generalparse_conditionsinfrastructure, enabling support for_inoperator alongside existing comparison operators.block.numberset handling: When_inis used with multiple values, the query scans[min, max]server-side and applies a client-side filter to drop unmatched blocks. Single-value sets skip the client filter (already exact). Empty sets are handled with a client filter that matches nothing.Pagination support: The
render_where_hintfunction now preservesblock.numbersets across pages by including_inalongside the updated_gte/_lterange, ensuring consistent filtering across paginated results.Helper methods: Added
narrow_from()andnarrow_to_excl()to centralize block range narrowing logic.Notable Implementation Details
block.numberdesugars tofrom_block/to_blockparameters rather than row filters, so it's handled separately from other field filters.wants_log_fields,wants_tx_fields, andwants_block_fieldsflags determine whether to request all rows of each kind when no explicit filter exists.block.numberfilters are excluded from the pagination hint since the set is already included in the_inoperator.https://claude.ai/code/session_01QfhyYZWhpDLkzgFUhT2GgT