mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Add support for compile time FIELD_ELEMENTS_PER_BLOB
This commit is contained in:
@@ -18,5 +18,9 @@ eth2_serde_utils = "0.1.1"
|
||||
hex = "0.4.2"
|
||||
eth2_hashing = "0.3.0"
|
||||
ethereum-types = "0.12.1"
|
||||
c-kzg = {git = "https://github.com/pawanjay176/c-kzg-4844", rev = "669a13800a8a0d094c5387db58e06936ef194a25" }
|
||||
c-kzg = {git = "https://github.com/pawanjay176/c-kzg-4844", rev = "48c048b12a7d29ae3e7bf09000e07870da4cb701" }
|
||||
|
||||
[features]
|
||||
default = ["mainnet-spec"]
|
||||
mainnet-spec = ["c-kzg/mainnet-spec"]
|
||||
minimal-spec = ["c-kzg/minimal-spec"]
|
||||
@@ -3,11 +3,12 @@ mod kzg_proof;
|
||||
|
||||
pub use crate::{kzg_commitment::KzgCommitment, kzg_proof::KzgProof};
|
||||
pub use c_kzg::bytes_to_g1;
|
||||
use c_kzg::{Error as CKzgError, KZGSettings, BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB};
|
||||
pub use c_kzg::{
|
||||
Error as CKzgError, KZGSettings, BYTES_PER_BLOB, BYTES_PER_FIELD_ELEMENT,
|
||||
FIELD_ELEMENTS_PER_BLOB,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
|
||||
const BYTES_PER_BLOB: usize = FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT;
|
||||
|
||||
/// The consensus type `Blob` is generic over EthSpec, so it cannot be imported
|
||||
/// in this crate without creating a cyclic dependency between the kzg and consensus/types crates.
|
||||
/// So need to use a Vec here unless we think of a smarter way of doing this
|
||||
@@ -32,7 +33,7 @@ pub struct Kzg {
|
||||
impl Kzg {
|
||||
pub fn new_from_file(file_path: PathBuf) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
trusted_setup: KZGSettings::load_trusted_setup(file_path)
|
||||
trusted_setup: KZGSettings::load_trusted_setup_file(file_path)
|
||||
.map_err(Error::InvalidTrustedSetup)?,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user