Skip to content

Fix is_negative / is_positive misclassify#402

Open
trackoor wants to merge 1 commit intoBitVM:mainfrom
trackoor:fix/sign-head-assert-pick
Open

Fix is_negative / is_positive misclassify#402
trackoor wants to merge 1 commit intoBitVM:mainfrom
trackoor:fix/sign-head-assert-pick

Conversation

@trackoor
Copy link
Copy Markdown

Fix #401

@trackoor trackoor force-pushed the fix/sign-head-assert-pick branch from 8d811e1 to 171b558 Compare October 18, 2025 20:16
@Hakkush-07
Copy link
Copy Markdown
Collaborator

HEAD_OFFSET is never 1. For that to happen, HEAD must be 0. I guess you thought that might happen when N_BITS is divisible by LIMB_SIZE, but in that case, HEAD is just the most significant limb, having LIMB_SIZE bits.

@trackoor
Copy link
Copy Markdown
Author

HEAD_OFFSET is never 1. For that to happen, HEAD must be 0. I guess you thought that might happen when N_BITS is divisible by LIMB_SIZE, but in that case, HEAD is just the most significant limb, having LIMB_SIZE bits.

Agreed, under this repo’s current invariants, HEAD_OFFSET can’t be 1.

That said, the is_positive / is_negative helpers are easy to reuse out of context. Once someone reuses the code and slightly tweaks the library, as has happened in several other forks, since BitVM has become the largest open Bitcoin script collection, a case with HEAD_OFFSET == 1 can realistically occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

is_negative / is_positive misclassify when HEAD_OFFSET == 1

2 participants