diff --git a/cryptography/kzg_multi_open/src/fk20.rs b/cryptography/kzg_multi_open/src/fk20.rs index 97c3d988..25dd7b0a 100644 --- a/cryptography/kzg_multi_open/src/fk20.rs +++ b/cryptography/kzg_multi_open/src/fk20.rs @@ -13,4 +13,4 @@ mod verifier; pub use cosets::recover_evaluations_in_domain_order; pub use errors::VerifierError; pub use prover::{FK20Prover as Prover, Input as ProverInput}; -pub use verifier::FK20Verifier as Verifier; +pub use verifier::{CommitmentIndex, CosetIndex, FK20Verifier as Verifier}; diff --git a/cryptography/kzg_multi_open/src/fk20/verifier.rs b/cryptography/kzg_multi_open/src/fk20/verifier.rs index 9d8ead51..9207746c 100644 --- a/cryptography/kzg_multi_open/src/fk20/verifier.rs +++ b/cryptography/kzg_multi_open/src/fk20/verifier.rs @@ -12,6 +12,21 @@ use std::mem::size_of; use super::errors::VerifierError; +/// CosetIndex is a reference to a coset. +/// +/// Note: We are able to use CosetIndex instead of the coset because +/// the prover and verifier both know what the cosets are that +/// we will be making and verifying opening proofs for. +pub type CosetIndex = u64; + +/// CommitmentIndex is a reference to a commitment. +/// +/// In order to make verification cheaper, the verifier will +/// deduplicate the list of commitments that are needed in order to verify opening proofs. +/// They will then refer to a commitment via its position in an array of deduplicated commitments +/// with the CommitmentIndex. +pub type CommitmentIndex = u64; + /// FK20Verifier initializes all of the components needed to verify KZG multi point /// proofs that were created using the FK20Prover. /// @@ -103,9 +118,9 @@ impl FK20Verifier { &self, deduplicated_commitments: &[G1Point], - commitment_indices: &[u64], + commitment_indices: &[CommitmentIndex], - bit_reversed_coset_indices: &[u64], + bit_reversed_coset_indices: &[CosetIndex], bit_reversed_coset_evals: &[Vec], bit_reversed_proofs: &[G1Point], ) -> Result<(), VerifierError> { diff --git a/cryptography/kzg_multi_open/src/lib.rs b/cryptography/kzg_multi_open/src/lib.rs index 365123c3..6fac861d 100644 --- a/cryptography/kzg_multi_open/src/lib.rs +++ b/cryptography/kzg_multi_open/src/lib.rs @@ -2,7 +2,10 @@ pub mod commit_key; mod fk20; pub mod opening_key; -pub use fk20::{recover_evaluations_in_domain_order, Prover, ProverInput, Verifier, VerifierError}; +pub use fk20::{ + recover_evaluations_in_domain_order, CommitmentIndex, CosetIndex, Prover, ProverInput, + Verifier, VerifierError, +}; #[cfg(test)] mod naive; diff --git a/eip7594/src/lib.rs b/eip7594/src/lib.rs index 0af89cc1..3214f278 100644 --- a/eip7594/src/lib.rs +++ b/eip7594/src/lib.rs @@ -43,22 +43,13 @@ pub type KZGProof = [u8; BYTES_PER_COMMITMENT]; /// that we would like to make and verify opening proofs about. pub type KZGCommitment = [u8; BYTES_PER_COMMITMENT]; -/// CellIndex is reference to a Coset. +/// CellIndex is reference to the coset/set of points that were used to create that Cell, +/// on a particular polynomial, f(x). /// -/// We are able to use CellIndex instead of the coset because -/// the prover and verifier both know what the cosets are that -/// we will be making and verifying opening proofs for. -pub type CellIndex = u64; - -/// CommitmentIndex is a reference to a commitment. -/// -/// In order to make verification cheaper, the verifier will -/// deduplicate the list of commitments that they need to verify opening proofs for. -/// They will then refer to a commitment via its position in an array of deduplicated commitments -/// with the CommitmentIndex. -/// -/// Note: This is not exposed in the public API. -pub(crate) type CommitmentIndex = u64; +/// Note: Since the verifier and prover both know what cosets will be used +/// to evaluate the polynomials being used in opening proofs, the protocol +/// only requires an index to reference them. +pub type CellIndex = kzg_multi_open::CosetIndex; use constants::{BYTES_PER_BLOB, BYTES_PER_CELL, BYTES_PER_COMMITMENT}; use prover::ProverContext; diff --git a/eip7594/src/verifier.rs b/eip7594/src/verifier.rs index 64d54e46..e755c411 100644 --- a/eip7594/src/verifier.rs +++ b/eip7594/src/verifier.rs @@ -200,10 +200,12 @@ impl DASContext { mod validation { use std::collections::HashSet; + use kzg_multi_open::CommitmentIndex; + use crate::{ constants::{BYTES_PER_CELL, CELLS_PER_EXT_BLOB, EXTENSION_FACTOR}, verifier::VerifierError, - Bytes48Ref, CellIndex, CellRef, CommitmentIndex, + Bytes48Ref, CellIndex, CellRef, }; /// Validation logic for `verify_cell_kzg_proof_batch`