Skip to content

Conversation

@HalosGhost
Copy link

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_MAX_LENGTH_ 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).

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_MAX_LENGTH_ 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).
@apoelstra
Copy link
Owner

ACK that this formula matches the one I implemented in BlockstreamResearch#123 (but apparently did not make it into BlockstreamResearch#108)

@apoelstra
Copy link
Owner

Cherry-picked onto BlockstreamResearch#108

@apoelstra apoelstra closed this Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants