Check that FIELD_ELEMENTS_PER_BLOB is defined. (#225)

This commit is contained in:
Gottfried Herold 2023-03-17 21:30:06 +01:00 committed by GitHub
parent 0b6791bbce
commit 6d75c674ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,19 @@ extern "C" {
// Macros // Macros
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#ifndef FIELD_ELEMENTS_PER_BLOB
#error FIELD_ELEMENTS_PER_BLOB is undefined. This value must be externally supplied.
#endif // FIELD_ELEMENTS_PER_BLOB
/**
* There are only 1<<32 2-adic roots of unity in the field, limiting the
* possible values of FIELD_ELEMENTS_PER_BLOB. The restriction to 1<<31 is a
* current implementation limitation. Notably, the size of the FFT setup would
* overflow uint32_t, which would casues issues.
*/
#if ((FIELD_ELEMENTS_PER_BLOB) <= 0) || ((FIELD_ELEMENTS_PER_BLOB) > (1 << 31))
#error Invalid value of FIELD_ELEMENTS_PER_BLOB
#endif // FIELD_ELEMENTS_PER_BLOB
#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