Skip to content

Commit

Permalink
Merge of #5913
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 9, 2024
2 parents c457a25 + 2c6dfac commit 82b4cd0
Show file tree
Hide file tree
Showing 6 changed files with 527 additions and 0 deletions.
13 changes: 13 additions & 0 deletions consensus/types/src/beacon_block_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockBodyRef<'a, E,
Ok(proof.into())
}

/// Produces the proof of inclusion for `self.blob_kzg_commitments`.
pub fn kzg_commitments_merkle_proof(
&self,
) -> Result<FixedVector<Hash256, E::KzgCommitmentsInclusionProofDepth>, Error> {
let body_leaves = self.body_merkle_leaves();
let beacon_block_body_depth = body_leaves.len().next_power_of_two().ilog2() as usize;
let tree = MerkleTree::create(&body_leaves, beacon_block_body_depth);
let (_, proof) = tree
.generate_proof(BLOB_KZG_COMMITMENTS_INDEX, beacon_block_body_depth)
.map_err(Error::MerkleTreeError)?;
Ok(proof.into())
}

/// Return `true` if this block body has a non-zero number of blobs.
pub fn has_blobs(self) -> bool {
self.blob_kzg_commitments()
Expand Down
9 changes: 9 additions & 0 deletions consensus/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ pub struct ChainSpec {
pub min_per_epoch_churn_limit_electra: u64,
pub max_per_epoch_activation_exit_churn_limit: u64,

/*
* DAS params
*/
pub number_of_columns: usize,

/*
* Networking
*/
Expand Down Expand Up @@ -772,6 +777,8 @@ impl ChainSpec {
})
.expect("calculation does not overflow"),

number_of_columns: 128,

/*
* Network specific
*/
Expand Down Expand Up @@ -1074,6 +1081,8 @@ impl ChainSpec {
})
.expect("calculation does not overflow"),

number_of_columns: 128,

/*
* Network specific
*/
Expand Down
Loading

0 comments on commit 82b4cd0

Please sign in to comment.