Say which order the k of a silent payment output follows (#768) - #894
Merged
Conversation
The module docstring described BIP375's prose -- the codes sharing a scan key sorted lexicographically by spend key -- and named `_ordered_sp_outputs` as that sort. The function is output index order, and its own docstring says so and says why, so the file contradicted itself and the API docs carried the half that is not the code. The function's own account gains the correction the discrepancy needed: the two invalid vectors named after ordering are refused under either rule because each carries a k assignment no ascending rule produces, two values swapped in one and three permuted in the other, not because they match none at all. It also names bips PR 2207, which would settle the question the other way by correcting the vectors and the validator to the prose, and against which the test that pins index order is what fails. Issue #768
Contributor
There was a problem hiding this comment.
Sorry @fametrano, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Contributor
Reviewer's GuideClarifies and documents that the silent payments k-ordering implementation uses output index order (matching BIP375 test vectors and reference validator) rather than the prose-described lexicographic spend-key order, and updates comments/changelog to explain how invalid vectors are rejected and to reference the relevant BIPs PR. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
btclib/psbt/silent_payments.py's module docstring described BIP375'sprose -- the codes sharing a scan key sorted lexicographically by spend
key -- and named
_ordered_sp_outputsas that sort. The function isoutput index order, and its own docstring says so and says why, so the
file contradicted itself and the published API docs carried the half that
is not the code.
The function's own account gains the correction the discrepancy needed:
the two invalid vectors named after ordering are refused under either rule
because each carries a
kassignment no ascending rule produces (twovalues swapped in one, three permuted in the other), not because they
match none at all -- measured by deriving every candidate
kfor eachoutput with BIP375's own
compute_silent_payment_output_script. It alsonames bips PR 2207, which
would settle the question the other way by correcting the vectors and the
validator to the prose; against those vectors the test that pins index
order is what fails.
No behaviour change. Gates run locally:
uv run pytest(27808 passed),uv run pre-commit run --files ..., and the sphinx-Wbuild.Issue #768
Summary by Sourcery
Clarify documentation around silent payment output ordering to match the implemented index-order behavior and explicitly document the discrepancy with BIP375 prose and test vectors.
Enhancements:
_ordered_sp_outputsdocumentation to accurately describe why invalid BIP375 test vectors are rejected under any ascending rule and reference bips PR 2207 as the proposed resolution.Documentation:
psbt.silent_paymentsmodule and function docstrings to state thatkcounts outputs in index order per scan key and to explain the mismatch with BIP375 prose, reference vectors, and validator.