Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit committed Oct 31, 2024
1 parent 6a2f79b commit 352221f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 7 additions & 3 deletions aggregator/src/aggregation/barycentric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub fn interpolate(z: Scalar, coefficients: &[Scalar; BLOB_WIDTH]) -> Scalar {
mod tests {
use super::*;
use crate::{
blob::{BatchData, KZG_TRUSTED_SETUP},
blob::BatchData,
eip4844::{get_blob_bytes, get_coefficients},
MAX_AGG_SNARKS,
};
Expand Down Expand Up @@ -423,8 +423,12 @@ mod tests {
.collect::<Vec<_>>(),
)
.unwrap();
let (_proof, y) =
KzgProof::compute_kzg_proof(&blob, &to_be_bytes(z).into(), &KZG_TRUSTED_SETUP).unwrap();
let (_proof, y) = KzgProof::compute_kzg_proof(
&blob,
&to_be_bytes(z).into(),
c_kzg::ethereum_kzg_settings(),
)
.unwrap();
from_canonical_be_bytes(*y)
}

Expand Down
16 changes: 6 additions & 10 deletions aggregator/src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,12 @@ pub const N_BLOB_BYTES: usize = BLOB_WIDTH * N_DATA_BYTES_PER_COEFFICIENT;
/// Allow up to 5x compression via zstd encoding of the batch data.
pub const N_BATCH_BYTES: usize = N_BLOB_BYTES * 5;

/// KZG trusted setup
pub static KZG_TRUSTED_SETUP: Lazy<Arc<c_kzg::KzgSettings>> = Lazy::new(|| {
Arc::new(
c_kzg::KzgSettings::load_trusted_setup(
&revm_primitives::kzg::G1_POINTS.0,
&revm_primitives::kzg::G2_POINTS.0,
)
.expect("failed to load trusted setup"),
)
});
// /// KZG trusted setup
// pub static KZG_TRUSTED_SETUP: Lazy<Arc<c_kzg::KzgSettings>> = Lazy::new(|| {
// Arc::new(
// c_kzg::ethereum_kzg_settings()
// )
// });

/// Helper struct to generate witness for the Batch Data Config.
#[derive(Clone, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions aggregator/src/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use eth_types::{ToBigEndian, H256, U256};
use ethers_core::k256::sha2::{Digest, Sha256};
use revm_primitives::VERSIONED_HASH_VERSION_KZG;

use crate::blob::{BLOB_WIDTH, KZG_TRUSTED_SETUP, N_BLOB_BYTES, N_BYTES_U256};
use crate::blob::{BLOB_WIDTH, N_BLOB_BYTES, N_BYTES_U256};

/// Get the BLOB_WIDTH number of scalar field elements, as 32-bytes unsigned integers.
pub(crate) fn get_coefficients(blob_bytes: &[u8]) -> [U256; BLOB_WIDTH] {
Expand Down Expand Up @@ -30,7 +30,7 @@ pub(crate) fn get_versioned_hash(coefficients: &[U256; BLOB_WIDTH]) -> H256 {
.collect::<Vec<_>>(),
)
.expect("blob-coefficients to 4844 blob should succeed");
let c = c_kzg::KzgCommitment::blob_to_kzg_commitment(&blob, &KZG_TRUSTED_SETUP)
let c = c_kzg::KzgCommitment::blob_to_kzg_commitment(&blob, c_kzg::ethereum_kzg_settings())
.expect("blob to kzg commitment should succeed");
kzg_to_versioned_hash(&c)
}
Expand Down

0 comments on commit 352221f

Please sign in to comment.