fix: cap block header count parameter#8
Open
tolga-tom-nook wants to merge 2 commits into
Open
Conversation
This was referenced Jun 1, 2026
|
Maintainers - this looks like a narrow, reviewer-friendly bounty slice for the Bitgesell improvement program. What seems concretely useful here:
Suggested acceptance checks:
If you want a different cap/default behavior than |
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.
Fixes an impossible block-header count guard in
api/views/headers.py.The previous condition used
count < 1 and count > 2000, which can never be true. As a result,/rest/block/headers/{block_pointer}/0, negative counts, and very large counts bypassed the intended default/cap behavior and were passed through to the model layer.This PR changes the guard to
count < 1 or count > 2000and now includes focused regression coverage for:count=0,count=-1, andcount=5000defaulting to the safe 2000-header bound;countreturning the existing parameter error without a model call;Bounty context / claim:
0x4a76c7E64C08cF29B59eFC640b4ada97A270d428Validation:
python3 -m py_compile api/views/headers.py test/pytest/blocks_data/test_block_headers_count_validation_unit.pypython3 -m pytest -q --confcutdir=test/pytest/blocks_data test/pytest/blocks_data/test_block_headers_count_validation_unit.py→ 3 passedgit diff --checkExecutor refresh — 2026-06-17T08:57:30Z
Revalidated payout-readiness for the Bitgesell #81/#39 direct-USDT candidate:
tolga-tom-nook,MERGEABLE/CLEAN; no maintainer requested-changes review found.python3 -m py_compile api/views/headers.py test/pytest/blocks_data/test_block_headers_count_validation_unit.pypassed.python3 -m pytest -q --confcutdir=test/pytest/blocks_data test/pytest/blocks_data/test_block_headers_count_validation_unit.pypassed (3 passed).git diff --check origin/master...HEADpassed.git rev-list --left-right --count origin/master...HEAD=0 2.Evidence:
/home/ubuntu/tom-agent/opportunity-os/evidence_bundle/bitgesell_bglapiserver_pr8_revalidation_20260617T085730Z/summary.md