Closed HalosGhost closed 2 years ago
ACK that this formula matches the one I implemented in https://github.com/ElementsProject/secp256k1-zkp/pull/123 (but apparently did not make it into https://github.com/ElementsProject/secp256k1-zkp/pull/108)
Cherry-picked onto https://github.com/ElementsProject/secp256k1-zkp/pull/108
This PR adds a convenience macro enabling callers to allocate the necessary and sufficient space for an uncompressed rangeproof. In particular, this makes it tractible to avoid pessimistically over-allocating the maximum possible space an uncompressed rangeproof might ever occupy.
Also, SECP256K1_BULLETPROOFS_RANGEPROOF_UNCOMPRESSED_MAXLENGTH is redefined as a short-cut leveraging the new convenience macro. This both makes clear from where the maximum length is derived, and should avoid the two macros drifting apart should the expected size change (e.g., if compression is supported in the future).