ekzg_serialization/
types.rs

1use crate::constants::{
2    BYTES_PER_BLOB, BYTES_PER_CELL, BYTES_PER_COMMITMENT, BYTES_PER_FIELD_ELEMENT,
3};
4
5/// `BlobRef` denotes a references to an opaque Blob.
6///
7/// Note: This library never returns a Blob, which is why we
8/// do not have a Blob type.
9pub type BlobRef<'a> = &'a [u8; BYTES_PER_BLOB];
10
11/// `Bytes48Ref` denotes a reference to an untrusted cryptographic type
12/// that can be represented in 48 bytes. This will be either a
13/// purported `KZGProof` or a purported `KZGCommitment`.
14pub type Bytes48Ref<'a> = &'a [u8; 48];
15
16/// Cell contains a group of evaluations on a coset that one would like to
17/// make and verify opening proofs about.
18///
19/// Note: These are heap allocated.
20pub type Cell = Box<[u8; BYTES_PER_CELL]>;
21
22/// `CellRef` contains a reference to a Cell.
23///
24/// Note: Similar to Blob, the library takes in references
25/// to Cell and returns heap allocated instances as return types.
26pub type CellRef<'a> = &'a [u8; BYTES_PER_CELL];
27
28/// `KZGProof` denotes a 48 byte commitment to a polynomial that one can use to either:
29///   - Prove that a polynomial f(x) was correctly evaluated on a coset `H` and
30///     returned a set of points (7594)
31///   - Prove that a polynomial f(x) was correctly evaluated at some random
32///     point (4844)
33///
34/// Note: This is reusing the same type for two different proofs.
35pub type KZGProof = [u8; BYTES_PER_COMMITMENT];
36
37/// `KZGCommitment` denotes a 48 byte commitment to a polynomial f(x)
38/// that we would like to make and verify opening proofs about.
39pub type KZGCommitment = [u8; BYTES_PER_COMMITMENT];
40
41/// `SerializedScalar` denotes a 32 byte field element.
42pub type SerializedScalar = [u8; BYTES_PER_FIELD_ELEMENT];