Fix the first two test vectors of verify fail test #1591

pull siv2r wants to merge 1 commits into bitcoin:master from siv2r:bip327-fix-verify-fail-vector changing 2 files +6 −4
  1. siv2r commented at 1:14 pm on May 11, 2024: contributor

    Two vectors of the sign_verify test use different partial signatures even though their signer set, message, and nonces are the same. These are those two vectors:

    Vector 1 (in valid_test_ cases):

    0"key_indices": [0, 1, 2],
    1"nonce_indices": [0, 1, 2],
    2"aggnonce_index": 0,
    3"msg_index": 0,
    4"signer_index": 0,
    5"expected": "012ABBCB52B3016AC03AD82395A1A415C48B93DEF78718E62A7A90052FE224FB"
    

    Vector 2 (in verify_fail_test_cases):

    0"sig": "68537CC5234E505BD14061F8DA9E90C220A181855FD8BDB7F127BB12403B4D3B",
    1"key_indices": [0, 1, 2],
    2"nonce_indices": [0, 1, 2],
    3"msg_index": 0,
    4"signer_index": 1,
    5"comment": "Wrong signer"
    

    In Vector 2, if we change the signer_index to 0 (the correct index), partial_sig_verify will still fail. Therefore, it has the incorrect partial signature. As a result, creating another vector by negating this paritalsig is also incorrect.

    This PR fixes Vector 2 and the one created by negating Vector 2’s partial signature.

    cc @jonasnick @real-or-random

  2. jonasnick commented at 2:00 pm on May 11, 2024: contributor

    Concept ACK, thanks @siv2r

    Can confirm that the comments of vector 1 and 2 of “verify_fail_test_cases” are incorrect and that the suggested vector fixes this. Check existing and suggested vector 1 with this script:

    0def parse_hex(x):
    1    return int.from_bytes(bytes.fromhex(x), byteorder="big")
    2
    3wrong_s = parse_hex("68537CC5234E505BD14061F8DA9E90C220A181855FD8BDB7F127BB12403B4D3B")
    4assert((n - wrong_s) == parse_hex("97AC833ADCB1AFA42EBF9E0725616F3C9A0D5B614F6FE283CEAAA37A8FFAF406"))
    5
    6corr_s = parse_hex("012ABBCB52B3016AC03AD82395A1A415C48B93DEF78718E62A7A90052FE224FB")
    7assert((n - corr_s) == parse_hex("FED54434AD4CFE953FC527DC6A5E5BE8F6234907B7C187559557CE87A0541C46"))
    

    I doubt it’s worth incrementing the patch version of the spec but it would be nice if we could somehow reflect this in the change log, for example by adding a line to the top like

    0* 1.0.0 (2024-05-11):
    1    * Fix minor issue in two test vectors.
    
  3. siv2r force-pushed on May 11, 2024
  4. siv2r commented at 2:22 pm on May 11, 2024: contributor
    I updated the change log as suggested. Also, the verify_error_test used the same wrong sig, so I updated those too.
  5. jonatack added the label Pending acceptance on May 11, 2024
  6. jonatack requested review from jonasnick on May 11, 2024
  7. in bip-0327.mediawiki:788 in 921536b5ac outdated
    784@@ -785,6 +785,8 @@ An exception to this rule is <code>MAJOR</code> version zero (0.y.z) which is fo
    785 The <code>MINOR</code> version is incremented whenever the inputs or the output of an algorithm changes in a backward-compatible way or new backward-compatible functionality is added.
    786 The <code>PATCH</code> version is incremented for other changes that are noteworthy (bug fixes, test vectors, important clarifications, etc.).
    787 
    788+* '''1.0.0''' (2024-05-11):
    


    jonasnick commented at 12:48 pm on May 13, 2024:
    @real-or-random convinced me that it’s better to make this 1.0.1.
  8. in bip-0327.mediawiki:789 in 921536b5ac outdated
    784@@ -785,6 +785,8 @@ An exception to this rule is <code>MAJOR</code> version zero (0.y.z) which is fo
    785 The <code>MINOR</code> version is incremented whenever the inputs or the output of an algorithm changes in a backward-compatible way or new backward-compatible functionality is added.
    786 The <code>PATCH</code> version is incremented for other changes that are noteworthy (bug fixes, test vectors, important clarifications, etc.).
    787 
    788+* '''1.0.0''' (2024-05-11):
    789+** Fix minor issue in four test vectors.
    


    jonasnick commented at 12:55 pm on May 13, 2024:
    0** Fix minor issue in ''PartialSigVerify'' test vectors.
    
  9. siv2r force-pushed on May 13, 2024
  10. siv2r commented at 1:05 pm on May 13, 2024: contributor
    Addressed the change log comments
  11. in bip-0327.mediawiki:788 in 83f831bcbb outdated
    784@@ -785,6 +785,8 @@ An exception to this rule is <code>MAJOR</code> version zero (0.y.z) which is fo
    785 The <code>MINOR</code> version is incremented whenever the inputs or the output of an algorithm changes in a backward-compatible way or new backward-compatible functionality is added.
    786 The <code>PATCH</code> version is incremented for other changes that are noteworthy (bug fixes, test vectors, important clarifications, etc.).
    787 
    788+* '''1.0.1''' (2024-05-11):
    


    jonasnick commented at 1:19 pm on May 13, 2024:
    The date doesn’t match the date of the commit. Should be 2024-05-13.

    siv2r commented at 2:12 am on May 14, 2024:
    Fixed
  12. real-or-random approved
  13. real-or-random commented at 2:05 pm on May 13, 2024: contributor

    utACK 83f831bcbbdcf87b983b013eea248c19498a824f – mod the date change (Yeah, it’s better to set it to the commit date, but two days more or less don’t make that big of a difference in the end :D

    It took me a while to understand what’s going on, but it all makes sense now. Nice catch!

  14. jonatack added the label PR Author action required on May 13, 2024
  15. jonatack removed the label Pending acceptance on May 13, 2024
  16. Fix the four test vectors
    - first two vectors of verify_fail_test
    - first two vectors of verify_error_test
    508e3a6a40
  17. siv2r force-pushed on May 14, 2024
  18. real-or-random approved
  19. real-or-random commented at 7:37 am on May 14, 2024: contributor
    utACK 508e3a6a40a6e73c73cbfa8a33aa18a2bc7b9d91
  20. jonatack removed the label PR Author action required on May 14, 2024
  21. jonatack merged this on May 14, 2024
  22. jonatack closed this on May 14, 2024

  23. jonasnick commented at 8:19 am on May 15, 2024: contributor

    Yeah, it’s better to set it to the commit date, but two days more or less don’t make that big of a difference in the end

    I think the purpose of the date is to make it easier for people to look up the changes in the commit history. However, the date is wrong now anyway because github UI does not show the correct date of the commit :shrug:.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-30 17:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me