Only support FIELD_ELEMENTS_PER_BLOB values that are a power of 2. (#249)
* Intentionally fail to compile with a FIELD_ELEMENTS_PER_BLOB value that is not a power of 2. We do not want to support or maintain this case, so let us be explicit about it. * Update src/c_kzg_4844.h Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com> * Update src/c_kzg_4844.h Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com> --------- Co-authored-by: George Kadianakis <desnacked@riseup.net> Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
This commit is contained in:
parent
f384175810
commit
8de0aa54ce
|
@ -49,6 +49,18 @@ extern "C" {
|
||||||
#error Invalid value of FIELD_ELEMENTS_PER_BLOB
|
#error Invalid value of FIELD_ELEMENTS_PER_BLOB
|
||||||
#endif // FIELD_ELEMENTS_PER_BLOB
|
#endif // FIELD_ELEMENTS_PER_BLOB
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If FIELD_ELEMENTS_PER_BLOB is not a power of 2, the size of the FFT domain
|
||||||
|
* should be chosen as the the next-largest power of two and polynomials
|
||||||
|
* represented by their evaluations at a subset of the 2^i'th roots of unity.
|
||||||
|
* While the code in this library tries to take this into account,
|
||||||
|
* we do not need the case where FIELD_ELEMENTS_PER_BLOB is not a power of 2.
|
||||||
|
* As this case is neither maintained nor tested, we prefer to not support it.
|
||||||
|
*/
|
||||||
|
#if ((FIELD_ELEMENTS_PER_BLOB) & (FIELD_ELEMENTS_PER_BLOB)-1) != 0
|
||||||
|
#error FIELD_ELEMENTS_PER_BLOB is not a power of two
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BYTES_PER_COMMITMENT 48
|
#define BYTES_PER_COMMITMENT 48
|
||||||
#define BYTES_PER_PROOF 48
|
#define BYTES_PER_PROOF 48
|
||||||
#define BYTES_PER_FIELD_ELEMENT 32
|
#define BYTES_PER_FIELD_ELEMENT 32
|
||||||
|
|
Loading…
Reference in New Issue