Docstrings #713

pull benma wants to merge 2 commits into bitcoin-core:master from benma:docstrings changing 2 files +9 −3
  1. benma commented at 3:52 PM on January 16, 2020: contributor

    No description provided.

  2. benma commented at 3:53 PM on January 16, 2020: contributor

    As a newcomer to the library it is a bit hard to understand what the field and scalar functions do in terms of modulo reductions. The docstrings added here would have helped me, provided they are correct :smile:

    CC @sipa as per the IRC discussion today.

  3. in src/scalar.h:38 in 305d46f921 outdated
      31 | @@ -32,7 +32,11 @@ static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigne
      32 |  /** Access bits from a scalar. Not constant time. */
      33 |  static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
      34 |  
      35 | -/** Set a scalar from a big endian byte array. */
      36 | +/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`.
      37 | + * In:      bin:   pointer to a 32-byte array.
      38 | + * Out:     r:     scalar to be loaded.
      39 | + *          overflow: non-zero if the scalar was larger than `n` before reduction, zero otherwise.
    


    elichai commented at 3:55 PM on January 16, 2020:

    Maybe change to "if not null is set to..."


    benma commented at 4:09 PM on January 16, 2020:

    fixed by adding "(can be NULL)" as seen in other docstrings.

  4. benma force-pushed on Jan 16, 2020
  5. elichai approved
  6. elichai commented at 3:56 PM on January 16, 2020: contributor

    I personally would really appreciate more docs in the small header files (as it doesn't even pollute code)

  7. benma force-pushed on Jan 16, 2020
  8. benma force-pushed on Jan 16, 2020
  9. in src/scalar.h:37 in 71f8c4064c outdated
      31 | @@ -32,7 +32,11 @@ static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigne
      32 |  /** Access bits from a scalar. Not constant time. */
      33 |  static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
      34 |  
      35 | -/** Set a scalar from a big endian byte array. */
      36 | +/** Set a scalar from a big endian byte array. The scalar will be reduced modulo group order `n`.
      37 | + * In:      bin:        pointer to a 32-byte array.
      38 | + * Out:     r:          scalar to be loaded.
    


    real-or-random commented at 9:52 PM on January 16, 2020:

    maybe s/loaded/set ?


    benma commented at 11:42 AM on January 17, 2020:

    :heavy_check_mark:

  10. scalar: extend docstring of secp256k1_scalar_set_b32 dc7d8fd9e2
  11. field: extend docstring of secp256k1_fe_normalize dabfea7e21
  12. benma force-pushed on Jan 17, 2020
  13. real-or-random commented at 1:15 PM on January 17, 2020: contributor

    ACK dabfea7e217b129d10f0f787722626f388dddb5a

  14. jonasnick approved
  15. jonasnick commented at 12:33 PM on January 24, 2020: contributor

    ACK dabfea7

  16. jonasnick referenced this in commit 1b4d256e2e on Jan 24, 2020
  17. jonasnick merged this on Jan 24, 2020
  18. jonasnick closed this on Jan 24, 2020

  19. sipa cross-referenced this on Jun 9, 2020 from issue Update libsecp256k1 subtree by sipa
  20. fanquake referenced this in commit 8c97780db8 on Jun 13, 2020
  21. sidhujag referenced this in commit 8a3a072968 on Jun 13, 2020
  22. ComputerCraftr referenced this in commit b98f1c6e6c on Jun 16, 2020
  23. UdjinM6 referenced this in commit 9d36ba6570 on Aug 10, 2021
  24. 5tefan referenced this in commit 8ded2caa74 on Aug 12, 2021
  25. gades referenced this in commit d855cc511d on May 8, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 19:15 UTC

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