Repository navigation
Read utreexo's _int value as a plain int (closes #3129) - #3131
Conversation
An int subclass whose own comparisons answer "in range" passed _int's range check, so Stump, Proof and UpdateData took -1 or 2**64 as a leaf count or position, and kept the subclass. _int now reads the value through _int_from_integer, as bytes_from_octets does (btclib-org#3110), and checks and returns that plain int. Signed-off-by: dodoshell <326978213+dodoshell@users.noreply.github.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Claimed: a maintainer's session is reviewing this pull request and may push signed fixes on top as fast-forward commits, after asking you first about anything that is yours to change. |
|
Head 1fe3420 passed a maintainer session's local review with no change requested, and every check on it passed or was skipped. The session ran the gates on that head offline, in a sandbox: lock sync, the hooks on both changed files, and the union of the bindings and no-bindings coverage at 100%. Both suite lanes stopped only on the integration tests that bind a loopback port, which the sandbox refuses, so the suite was not run locally and the checks of this head stand for it. Two local reviewers cleared the head: a Claude Code reviewer and a fresh Codex reviewer. Their inputs, run on this head and on the merge base, show that every caller of Two of the three reviews on GitHub are absent from this head. The Claude review bot skips a pull request from a fork. Codex's review failed on its usage limit. CodeRabbit read the head and left no finding. Thank you for the fix: it is waiting on a maintainer's approval. |
|
Released: the maintainer's session has finished its review of this head and pushed nothing to the branch. It now waits on a maintainer's approval. |
|
Landed as c0a95f5. Thank you, @dodoshell: utreexo's _int now reads its value as a plain int, through the helper main already had, and #3129 is closed by it. |
What this changes
btclib.utreexo._int, behind_u64and_leaf_count, checked0 <= value < ceilingwith the value's own comparisons, so anintsubclass that answers "in range" passed:
Stump,ProofandUpdateDatatook -1 or 2**64 as a leaf count or position, and kept thesubclass.
_intnow reads the value through_int_from_integer, asbytes_from_octetsdoes since #3110, and checks and returns that plainint.
Closes #3129
How it was verified
test_an_int_subclass_is_read_as_its_plain_int, for -1 and1 << 64,builds
Stump,ProofandUpdateData(prev_num_leaves,to_destroy,new_add) with a subclass whose__lt__and__ge__answer True, and expects
BTClibValueErrorfrom each; an accepted valuecomes back as a plain
int. On41961eb9without the fix the testfails for both values; with it, it passes.
Checks
uv run pre-commit run --all-filesis clean (ruff, mypy strict,markdownlint, the copyright notice,
uv.lock)uv run pytestpassesanswer a review of it without the model
Anything the reviewer should know
I ran everything on Windows with Python 3.13, since pyyaml does not
build under 3.15 here, in a checkout with LF line endings;
check-changelogran throughuv run python, as its#!/usr/bin/env python3line does not start here. The issue spells thefix as
int.__add__(value, 0)inline in_int; it calls_int_from_integerinstead, which does the same type check and the sameint.__add__, so the workaround lives in one place.