This commit is contained in:
realbigsean 2023-03-15 15:32:22 -04:00
parent 34cea6d1c3
commit b303d2fb7e
No known key found for this signature in database
GPG Key ID: BE1B3DB104F6C788
9 changed files with 23 additions and 24 deletions

View File

@ -4857,7 +4857,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
)), )),
)?; )?;
kzg_utils::compute_blob_kzg_proof::<T::EthSpec>(kzg, blob, kzg_commitment.clone()) kzg_utils::compute_blob_kzg_proof::<T::EthSpec>(kzg, blob, *kzg_commitment)
.map_err(BlockProductionError::KzgError) .map_err(BlockProductionError::KzgError)
}) })
.collect::<Result<Vec<KzgProof>, BlockProductionError>>() .collect::<Result<Vec<KzgProof>, BlockProductionError>>()

View File

@ -3,7 +3,7 @@ use slot_clock::SlotClock;
use std::sync::Arc; use std::sync::Arc;
use crate::beacon_chain::{BeaconChain, BeaconChainTypes, MAXIMUM_GOSSIP_CLOCK_DISPARITY}; use crate::beacon_chain::{BeaconChain, BeaconChainTypes, MAXIMUM_GOSSIP_CLOCK_DISPARITY};
use crate::{kzg_utils, BeaconChainError}; use crate::BeaconChainError;
use state_processing::per_block_processing::eip4844::eip4844::verify_kzg_commitments_against_transactions; use state_processing::per_block_processing::eip4844::eip4844::verify_kzg_commitments_against_transactions;
use types::signed_beacon_block::BlobReconstructionError; use types::signed_beacon_block::BlobReconstructionError;
use types::{ use types::{
@ -116,11 +116,11 @@ pub fn validate_blob_for_gossip<T: BeaconChainTypes>(
} }
fn verify_data_availability<T: BeaconChainTypes>( fn verify_data_availability<T: BeaconChainTypes>(
blob_sidecar: &BlobsSidecar<T::EthSpec>, _blob_sidecar: &BlobsSidecar<T::EthSpec>,
kzg_commitments: &[KzgCommitment], kzg_commitments: &[KzgCommitment],
transactions: &Transactions<T::EthSpec>, transactions: &Transactions<T::EthSpec>,
block_slot: Slot, _block_slot: Slot,
block_root: Hash256, _block_root: Hash256,
chain: &BeaconChain<T>, chain: &BeaconChain<T>,
) -> Result<(), BlobError> { ) -> Result<(), BlobError> {
if verify_kzg_commitments_against_transactions::<T::EthSpec>(transactions, kzg_commitments) if verify_kzg_commitments_against_transactions::<T::EthSpec>(transactions, kzg_commitments)
@ -130,7 +130,7 @@ fn verify_data_availability<T: BeaconChainTypes>(
} }
// Validatate that the kzg proof is valid against the commitments and blobs // Validatate that the kzg proof is valid against the commitments and blobs
let kzg = chain let _kzg = chain
.kzg .kzg
.as_ref() .as_ref()
.ok_or(BlobError::TrustedSetupNotInitialized)?; .ok_or(BlobError::TrustedSetupNotInitialized)?;

View File

@ -24,9 +24,9 @@ pub fn build_block_contents<T: BeaconChainTypes, Payload: AbstractExecPayload<T:
Ok(BlockContents::BlockAndBlobSidecars(block_and_blobs)) Ok(BlockContents::BlockAndBlobSidecars(block_and_blobs))
} else { } else {
return Err(warp_utils::reject::block_production_error( Err(warp_utils::reject::block_production_error(
BlockProductionError::NoBlobsCached, BlockProductionError::NoBlobsCached,
)); ))
} }
} }
} }

View File

@ -652,12 +652,12 @@ impl<T: BeaconChainTypes> Worker<T> {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub async fn process_gossip_blob( pub async fn process_gossip_blob(
self, self,
message_id: MessageId, _message_id: MessageId,
peer_id: PeerId, peer_id: PeerId,
peer_client: Client, peer_client: Client,
blob_index: u64, blob_index: u64,
signed_blob: Arc<SignedBlobSidecar<T::EthSpec>>, signed_blob: Arc<SignedBlobSidecar<T::EthSpec>>,
seen_duration: Duration, _seen_duration: Duration,
) { ) {
// TODO: gossip verification // TODO: gossip verification
crit!(self.log, "UNIMPLEMENTED gossip blob verification"; crit!(self.log, "UNIMPLEMENTED gossip blob verification";

View File

@ -252,7 +252,7 @@ impl<T: BeaconChainTypes> Worker<T> {
block_parent_root: block.parent_root, block_parent_root: block.parent_root,
proposer_index: block.proposer_index, proposer_index: block.proposer_index,
blob, blob,
kzg_commitment: block.body.blob_kzg_commitments[known_index].clone(), // TODO: needs to be stored in a more logical way so that this won't panic. kzg_commitment: block.body.blob_kzg_commitments[known_index], // TODO: needs to be stored in a more logical way so that this won't panic.
kzg_proof: kzg_aggregated_proof // TODO: yeah kzg_proof: kzg_aggregated_proof // TODO: yeah
}; };
self.send_response( self.send_response(
@ -843,7 +843,7 @@ impl<T: BeaconChainTypes> Worker<T> {
beacon_block_root, beacon_block_root,
beacon_block_slot, beacon_block_slot,
blobs: blob_bundle, blobs: blob_bundle,
kzg_aggregated_proof, kzg_aggregated_proof: _,
}: types::BlobsSidecar<_> = blobs; }: types::BlobsSidecar<_> = blobs;
for (blob_index, blob) in blob_bundle.into_iter().enumerate() { for (blob_index, blob) in blob_bundle.into_iter().enumerate() {

View File

@ -32,7 +32,7 @@ impl<T: EthSpec> BlocksAndBlobsRequestInfo<T> {
pub fn into_responses(self) -> Result<Vec<TempBlockWrapper<T>>, &'static str> { pub fn into_responses(self) -> Result<Vec<TempBlockWrapper<T>>, &'static str> {
let BlocksAndBlobsRequestInfo { let BlocksAndBlobsRequestInfo {
accumulated_blocks, accumulated_blocks,
mut accumulated_sidecars, accumulated_sidecars,
.. ..
} = self; } = self;

View File

@ -875,8 +875,8 @@ impl<T: BeaconChainTypes> SyncManager<T> {
fn rpc_blobs_received( fn rpc_blobs_received(
&mut self, &mut self,
request_id: RequestId, request_id: RequestId,
peer_id: PeerId, _peer_id: PeerId,
maybe_blob: Option<Arc<BlobSidecar<<T>::EthSpec>>>, _maybe_blob: Option<Arc<BlobSidecar<<T>::EthSpec>>>,
_seen_timestamp: Duration, _seen_timestamp: Duration,
) { ) {
match request_id { match request_id {
@ -892,7 +892,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
RequestId::RangeBlocks { .. } => { RequestId::RangeBlocks { .. } => {
unreachable!("Only-blocks range requests don't receive sidecars") unreachable!("Only-blocks range requests don't receive sidecars")
} }
RequestId::RangeBlobs { id } => { RequestId::RangeBlobs { id: _ } => {
unimplemented!("Adjust range"); unimplemented!("Adjust range");
} }
} }

View File

@ -4,6 +4,11 @@ use derivative::Derivative;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use ssz_types::VariableList; use ssz_types::VariableList;
pub type BlockContentsTuple<T, Payload> = (
SignedBeaconBlock<T, Payload>,
Option<VariableList<SignedBlobSidecar<T>, <T as EthSpec>::MaxBlobsPerBlock>>,
);
/// A wrapper over a [`SignedBeaconBlock`] or a [`SignedBeaconBlockAndBlobSidecars`]. /// A wrapper over a [`SignedBeaconBlock`] or a [`SignedBeaconBlockAndBlobSidecars`].
#[derive(Clone, Debug, Derivative, Serialize, Deserialize)] #[derive(Clone, Debug, Derivative, Serialize, Deserialize)]
#[derivative(PartialEq, Hash(bound = "T: EthSpec"))] #[derivative(PartialEq, Hash(bound = "T: EthSpec"))]
@ -24,12 +29,7 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> SignedBlockContents<T, Payload
} }
} }
pub fn deconstruct( pub fn deconstruct(self) -> BlockContentsTuple<T, Payload> {
self,
) -> (
SignedBeaconBlock<T, Payload>,
Option<VariableList<SignedBlobSidecar<T>, <T as EthSpec>::MaxBlobsPerBlock>>,
) {
match self { match self {
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => ( SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => (
block_and_sidecars.signed_block, block_and_sidecars.signed_block,

View File

@ -388,7 +388,6 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockService<T, E> {
)) ))
})? })?
.data .data
.into()
} }
}; };
@ -455,7 +454,7 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockService<T, E> {
); );
beacon_node beacon_node
// TODO: need to be adjusted for blobs // TODO: need to be adjusted for blobs
.post_beacon_blinded_blocks(&signed_block_contents.signed_block()) .post_beacon_blinded_blocks(signed_block_contents.signed_block())
.await .await
.map_err(|e| { .map_err(|e| {
BlockError::Irrecoverable(format!( BlockError::Irrecoverable(format!(