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.
fix(api): allow mixed date/block bounds on get_actions sort=asc #174
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
Uh oh!
There was an error while loading. Please reload this page.
fix(api): allow mixed date/block bounds on get_actions sort=asc #174
Changes from 1 commit
bab7b502247ffcFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
For the v1 endpoint, this new block-number branch is not reachable for normal requests because
src/api/routes/v1-history/get_actions/index.tsstill declares bothafterandbeforeastype: 'string', format: 'date-time'. With Fastify schema validation enabled on this route, a POST body such as{ "sort": "asc", "after": "437506277" }is rejected beforegetActionsruns, so the documented block-number workaround and the new v1block_numfiltering do not actually work through the API. The v1 schema needs to accept block-number strings/numbers as well as date-times.Useful? React with 👍 / 👎.
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.
The current classification logic relies on
after.includes('T')to identify dates andparseInt(after) > 0to identify block numbers. This is fragile and incorrect. For example, a valid date string like"2026-06-01"(which does not contain'T') will fail the first check, andparseInt("2026-06-01")will return2026, incorrectly classifying it as a block number.Instead, we should classify block numbers first by checking if the value is a valid positive integer using
Number.isInteger(Number(value)) && Number(value) > 0(consistent withisValidBoundused elsewhere in the codebase), and treat any other value as a date/timestamp.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.
The current classification logic relies on
query['after'].includes('T')to identify dates andparseInt(query['after']) > 0to identify block numbers. This is fragile and incorrect. For example, a valid date string like"2026-06-01"(which does not contain'T') will fail the first check, andparseInt("2026-06-01")will return2026, incorrectly classifying it as a block number.Instead, we should classify block numbers first by checking if the value is a valid positive integer using
Number.isInteger(Number(value)) && Number(value) > 0(consistent withisValidBoundused elsewhere in the codebase), and treat any other value as a date/timestamp.Uh oh!
There was an error while loading. Please reload this page.