fix: reject non-positive block count requests#9
Open
tolga-tom-nook wants to merge 2 commits into
Open
Conversation
This was referenced Jun 3, 2026
|
Maintainer-facing review assist for the #81 / #39 bounty queue: This is a good bug-fix direction: both Acceptance checks I would use before merge:
No payment action or claim from me here; just a focused review pass to help maintainers evaluate the PR. |
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
GET /blocks/last/{n}requests whennis zero, negative, or non-numericGET /blocks/data/last/{n}Why
Before this change, invalid
nvalues were parsed directly withint(n). Non-numeric values fell through to the generic internal-error response, while zero/negative values could be sent to the model layer even though these endpoints are documented as last-N block queries.Validation
python3 -m py_compile api/views/blocks.py test/pytest/blocks_data/test_block_count_validation_unit.pypython3 -m pytest -q --confcutdir=test/pytest/blocks_data test/pytest/blocks_data/test_block_count_validation_unit.py→ 3 passed0,-1, andabcreturn HTTP 400 /PARAMETER_ERRORfor both affected handlers without calling model functions, and valid counts still call the model with the 2016 cap preservedBounty context: Bitgesell improvement program / PR bounty hunt (#39, #81).
Executor refresh (2026-06-18T03:18:49Z)
Revalidated payout readiness for the Bitgesell PR-bounty queue without changing code:
python3 -m py_compile api/views/blocks.py test/pytest/blocks_data/test_block_count_validation_unit.pypython3 -m pytest -q --confcutdir=test/pytest/blocks_data test/pytest/blocks_data/test_block_count_validation_unit.py→ 3 passedgit diff --check origin/master...HEADgit rev-list --left-right --count origin/master...HEAD→0 2No maintainer requested-changes review or failing local proof found in the recheck.