Repository navigation
fix: preserve explicit zero tapleaf versions - #2355
Open
Harshil-1603 wants to merge 2 commits into
Open
Harshil-1603 wants to merge 2 commits into
Harshil-1603 wants to merge 2 commits into
Conversation
Armss6556
approved these changes
Oct 13, 2026
fametrano
reviewed
Oct 17, 2026
fametrano
left a comment
There was a problem hiding this comment.
ACK b70cda9, with one more line: tapTreeToList in bip371.ts still has tree.version || LEAF_VERSION_TAPSCRIPT, so tapTreeToList({ output, version: 0 }) returns leaf version 192. Changing it to ?? makes it consistent with this fix. On the committed esm build, tapleafHash for versions 0x00, 0xc0 and 0xc2 matches an independent BIP341 tagged-hash computation, and the tapTreeToList call above still gives 192.
|
I reviewed this on b70cda9, but its "Run Tests" run has been waiting for a workflow approval, so there is no CI result. Could a maintainer approve it? |
Preserve explicit leaf versions when converting Taproot trees to BIP371 lists. Cover zero, tapscript, custom versions, and mixed default/zero leaves. Regenerate CommonJS and ESM builds. Assisted-by: OpenAI Codex (GPT-6)
This branch has not been deployed
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.
tapleafHashused a truthiness fallback, so an explicit leaf version0x00was hashed as0xc0. Use nullish coalescing to preserve the caller's version and default only when it is absent.Add independently calculated BIP341 hash vectors for
OP_TRUEat versions0x00,0xc0, and0xc2, covering both direct hashing andtoHashTree, plus the omitted-version default. Include the regenerated CommonJS and ESM files.Fixes #2354.
Validation:
npm test: 2,664 tests passed; build, formatting, lint, and coverage thresholds passed.npm run lint:testsandnpm run gitdiff:cipassed.