mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-18 22:49:34 +00:00
Kzg verify and check against block for gloas columns
This commit is contained in:
@@ -53,6 +53,7 @@ use crate::blob_verification::GossipBlobError;
|
||||
use crate::block_verification_types::{AsBlock, BlockImportData, LookupBlock, RangeSyncBlock};
|
||||
use crate::data_availability_checker::{
|
||||
AvailabilityCheckError, AvailableBlock, AvailableBlockData, MaybeAvailableBlock,
|
||||
verify_columns_against_block,
|
||||
};
|
||||
use crate::data_column_verification::GossipDataColumnError;
|
||||
use crate::execution_payload::{
|
||||
@@ -620,15 +621,17 @@ pub fn signature_verify_chain_segment<T: BeaconChainTypes>(
|
||||
)?;
|
||||
|
||||
let mut available_blocks = Vec::with_capacity(chain_segment.len());
|
||||
let mut envelopes = Vec::with_capacity(chain_segment.len());
|
||||
let mut signature_verified_blocks = Vec::with_capacity(chain_segment.len());
|
||||
|
||||
for (block_root, block) in chain_segment {
|
||||
let consensus_context =
|
||||
ConsensusContext::new(block.slot()).set_current_block_root(block_root);
|
||||
|
||||
let (available_block, _envelope) =
|
||||
let (available_block, envelope) =
|
||||
block.into_available_block(&chain.data_availability_checker, chain.spec.clone())?;
|
||||
available_blocks.push(available_block.clone());
|
||||
envelopes.push(envelope);
|
||||
signature_verified_blocks.push(SignatureVerifiedBlock {
|
||||
block: MaybeAvailableBlock::Available(available_block),
|
||||
block_root,
|
||||
@@ -636,12 +639,18 @@ pub fn signature_verify_chain_segment<T: BeaconChainTypes>(
|
||||
consensus_context,
|
||||
});
|
||||
}
|
||||
// TODO(gloas) When implementing range and backfill sync for gloas
|
||||
// we need a batch verify kzg function in the new da checker as well.
|
||||
|
||||
chain
|
||||
.data_availability_checker
|
||||
.batch_verify_kzg_for_available_blocks(&available_blocks)?;
|
||||
|
||||
// Verify KZG for Gloas envelope columns out-of-band (commitments live in block BID).
|
||||
for (available_block, maybe_envelope) in available_blocks.iter().zip(envelopes.iter()) {
|
||||
if let Some(envelope) = maybe_envelope {
|
||||
verify_columns_against_block(&chain.kzg, available_block.block(), &envelope.columns)?;
|
||||
}
|
||||
}
|
||||
|
||||
// verify signatures
|
||||
let pubkey_cache = get_validator_pubkey_cache(chain)?;
|
||||
let mut signature_verifier = get_signature_verifier(&state, &pubkey_cache, &chain.spec);
|
||||
|
||||
@@ -695,7 +695,7 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
|
||||
|
||||
/// Verify a batch of data columns belonging to a single block, picking the right commitment
|
||||
/// source for the block's fork (Fulu: inline on column; Gloas: from the embedded payload bid).
|
||||
fn verify_columns_against_block<E: EthSpec>(
|
||||
pub fn verify_columns_against_block<E: EthSpec>(
|
||||
kzg: &Kzg,
|
||||
block: &SignedBeaconBlock<E>,
|
||||
columns: &[Arc<DataColumnSidecar<E>>],
|
||||
|
||||
Reference in New Issue
Block a user