Skip to content

Commit 19efeeb

Browse files
committed
chore: remove Fixed postfix from types now that the slice variations are removed
1 parent c074b72 commit 19efeeb

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

eip7594/src/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ use verifier::VerifierContext;
55
// TODO: We can remove this once we hook up the consensus-specs fixed test vectors.
66
pub mod consensus_specs_fixed_test_vector;
77

8-
// TODO: The methods are currently not sanity checking the inputs. Example: we can pass &vec![4096] to compute_cells
9-
// TODO as a blob and it will panic later on in the program.
10-
118
pub mod constants;
129
pub mod prover;
1310
mod serialization;
1411
pub mod verifier;
1512

16-
pub type BlobRefFixed<'a> = &'a [u8; BYTES_PER_BLOB];
17-
pub type Bytes48RefFixed<'a> = &'a [u8; 48];
18-
19-
pub type CellRefFixed<'a> = &'a [u8; BYTES_PER_CELL];
13+
pub type BlobRef<'a> = &'a [u8; BYTES_PER_BLOB];
14+
pub type Bytes48Ref<'a> = &'a [u8; 48];
2015

2116
pub type Cell = Box<[u8; BYTES_PER_CELL]>;
17+
pub type CellRef<'a> = &'a [u8; BYTES_PER_CELL];
18+
2219
pub type KZGProof = [u8; BYTES_PER_COMMITMENT];
2320
pub type KZGCommitment = [u8; BYTES_PER_COMMITMENT];
2421
pub type CellID = u64;

eip7594/src/prover.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
},
1515
serialization::{self, serialize_g1_compressed, SerializationError},
1616
verifier::{VerifierContext, VerifierError},
17-
BlobRefFixed, Bytes48RefFixed, Cell, CellID, CellRefFixed, KZGCommitment, KZGProof,
17+
BlobRef, Bytes48Ref, Cell, CellID, CellRef, KZGCommitment, KZGProof,
1818
};
1919

2020
/// Errors that can occur while calling a method in the Prover API
@@ -82,7 +82,7 @@ impl ProverContext {
8282
}
8383

8484
/// Computes the KZG commitment to the polynomial represented by the blob.
85-
pub fn blob_to_kzg_commitment(&self, blob: BlobRefFixed) -> Result<KZGCommitment, ProverError> {
85+
pub fn blob_to_kzg_commitment(&self, blob: BlobRef) -> Result<KZGCommitment, ProverError> {
8686
// Deserialize the blob into scalars. The blob is in lagrange form.
8787
let mut scalars =
8888
serialization::deserialize_blob_to_scalars(blob).map_err(ProverError::Serialization)?;
@@ -101,7 +101,7 @@ impl ProverContext {
101101
/// Computes the cells and the KZG proofs for the given blob.
102102
pub fn compute_cells_and_kzg_proofs(
103103
&self,
104-
blob: BlobRefFixed,
104+
blob: BlobRef,
105105
) -> Result<([Cell; CELLS_PER_EXT_BLOB], [KZGProof; CELLS_PER_EXT_BLOB]), ProverError> {
106106
// Deserialize the blob into scalars. The blob is in lagrange form.
107107
let mut scalars =
@@ -137,10 +137,7 @@ impl ProverContext {
137137
}
138138

139139
#[deprecated(note = "This function is deprecated, use `compute_cells_and_kzg_proofs` instead")]
140-
pub fn compute_cells(
141-
&self,
142-
blob: BlobRefFixed,
143-
) -> Result<[Cell; CELLS_PER_EXT_BLOB], ProverError> {
140+
pub fn compute_cells(&self, blob: BlobRef) -> Result<[Cell; CELLS_PER_EXT_BLOB], ProverError> {
144141
// Deserialize the blob into scalars. The blob is in lagrange form.
145142
let mut scalars =
146143
serialization::deserialize_blob_to_scalars(blob).map_err(ProverError::Serialization)?;
@@ -166,8 +163,8 @@ impl ProverContext {
166163
pub fn recover_cells_and_proofs(
167164
&self,
168165
cell_ids: Vec<CellID>,
169-
cells: Vec<CellRefFixed>,
170-
_proofs: Vec<Bytes48RefFixed>,
166+
cells: Vec<CellRef>,
167+
_proofs: Vec<Bytes48Ref>,
171168
) -> Result<([Cell; CELLS_PER_EXT_BLOB], [KZGProof; CELLS_PER_EXT_BLOB]), ProverError> {
172169
// Use erasure decoding to recover the polynomial corresponding to the blob in monomial form
173170
let poly_coeff = self

eip7594/src/verifier.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
},
88
prover::evaluations_to_cells,
99
serialization::{deserialize_cell_to_scalars, deserialize_compressed_g1, SerializationError},
10-
Bytes48RefFixed, Cell, CellID, CellRefFixed, ColumnIndex, RowIndex,
10+
Bytes48Ref, Cell, CellID, CellRef, ColumnIndex, RowIndex,
1111
};
1212
use bls12_381::Scalar;
1313
use erasure_codes::{reed_solomon::Erasures, ReedSolomon};
@@ -93,10 +93,10 @@ impl VerifierContext {
9393
/// Verify that a cell is consistent with a commitment using a KZG proof.
9494
pub fn verify_cell_kzg_proof(
9595
&self,
96-
commitment_bytes: Bytes48RefFixed,
96+
commitment_bytes: Bytes48Ref,
9797
cell_id: CellID,
98-
cell: CellRefFixed,
99-
proof_bytes: Bytes48RefFixed,
98+
cell: CellRef,
99+
proof_bytes: Bytes48Ref,
100100
) -> Result<(), VerifierError> {
101101
sanity_check_cells_and_cell_ids(&[cell_id], &[cell])?;
102102

@@ -127,11 +127,11 @@ impl VerifierContext {
127127
// This is a deduplicated list of row commitments
128128
// It is not indicative of the total number of commitments in the batch.
129129
// This is what row_indices is used for.
130-
row_commitments_bytes: Vec<Bytes48RefFixed>,
130+
row_commitments_bytes: Vec<Bytes48Ref>,
131131
row_indices: Vec<RowIndex>,
132132
column_indices: Vec<ColumnIndex>,
133-
cells: Vec<CellRefFixed>,
134-
proofs_bytes: Vec<Bytes48RefFixed>,
133+
cells: Vec<CellRef>,
134+
proofs_bytes: Vec<Bytes48Ref>,
135135
) -> Result<(), VerifierError> {
136136
// TODO: This currently uses the naive method
137137
//
@@ -190,7 +190,7 @@ impl VerifierContext {
190190
pub fn recover_all_cells(
191191
&self,
192192
cell_ids: Vec<CellID>,
193-
cells: Vec<CellRefFixed>,
193+
cells: Vec<CellRef>,
194194
) -> Result<[Cell; CELLS_PER_EXT_BLOB], VerifierError> {
195195
let recovered_codeword = self.recover_extended_polynomial(cell_ids, cells)?;
196196
Ok(evaluations_to_cells(
@@ -201,7 +201,7 @@ impl VerifierContext {
201201
pub(crate) fn recover_polynomial_coeff(
202202
&self,
203203
cell_ids: Vec<CellID>,
204-
cells: Vec<CellRefFixed>,
204+
cells: Vec<CellRef>,
205205
) -> Result<Vec<Scalar>, VerifierError> {
206206
// TODO: We should check that code does not assume that the CellIDs are sorted.
207207

@@ -286,7 +286,7 @@ impl VerifierContext {
286286
pub(crate) fn recover_extended_polynomial(
287287
&self,
288288
cell_ids: Vec<CellID>,
289-
cells: Vec<CellRefFixed>,
289+
cells: Vec<CellRef>,
290290
) -> Result<Vec<Scalar>, VerifierError> {
291291
let poly_coeff = self.recover_polynomial_coeff(cell_ids, cells)?;
292292

@@ -308,7 +308,7 @@ fn is_cell_ids_unique(cell_ids: &[CellID]) -> bool {
308308

309309
fn sanity_check_cells_and_cell_ids(
310310
cell_ids: &[CellID],
311-
cells: &[CellRefFixed],
311+
cells: &[CellRef],
312312
) -> Result<(), VerifierError> {
313313
// Check that the number of cell IDs is equal to the number of cells
314314
if cell_ids.len() != cells.len() {

0 commit comments

Comments
 (0)