mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
cargo fmt
This commit is contained in:
@@ -8,8 +8,7 @@ use crate::beacon_proposer_cache::compute_proposer_duties_from_head;
|
||||
use crate::beacon_proposer_cache::BeaconProposerCache;
|
||||
use crate::blob_cache::BlobCache;
|
||||
use crate::blob_verification::{
|
||||
AsBlock, AvailableBlock, BlobError, Blobs, BlockWrapper,
|
||||
IntoAvailableBlock,
|
||||
AsBlock, AvailableBlock, BlobError, Blobs, BlockWrapper, IntoAvailableBlock,
|
||||
};
|
||||
use crate::block_times_cache::BlockTimesCache;
|
||||
use crate::block_verification::{
|
||||
|
||||
@@ -12,9 +12,8 @@ use crate::BeaconChainError;
|
||||
use state_processing::per_block_processing::eip4844::eip4844::verify_kzg_commitments_against_transactions;
|
||||
use types::blob_sidecar::BlobSidecar;
|
||||
use types::{
|
||||
BeaconBlockRef, BeaconStateError, EthSpec, Hash256, KzgCommitment,
|
||||
SignedBeaconBlock, SignedBeaconBlockHeader,
|
||||
SignedBlobSidecar, Slot, Transactions,
|
||||
BeaconBlockRef, BeaconStateError, EthSpec, Hash256, KzgCommitment, SignedBeaconBlock,
|
||||
SignedBeaconBlockHeader, SignedBlobSidecar, Slot, Transactions,
|
||||
};
|
||||
use types::{Epoch, ExecPayload};
|
||||
|
||||
@@ -297,8 +296,12 @@ pub trait IntoAvailableBlock<T: BeaconChainTypes> {
|
||||
) -> Result<AvailableBlock<T::EthSpec>, BlobError>;
|
||||
}
|
||||
|
||||
impl <T: BeaconChainTypes> IntoAvailableBlock<T> for BlockWrapper<T::EthSpec> {
|
||||
fn into_available_block(self, block_root: Hash256, chain: &BeaconChain<T>) -> Result<AvailableBlock<T::EthSpec>, BlobError> {
|
||||
impl<T: BeaconChainTypes> IntoAvailableBlock<T> for BlockWrapper<T::EthSpec> {
|
||||
fn into_available_block(
|
||||
self,
|
||||
block_root: Hash256,
|
||||
chain: &BeaconChain<T>,
|
||||
) -> Result<AvailableBlock<T::EthSpec>, BlobError> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -318,12 +321,7 @@ impl<T: EthSpec> AvailableBlock<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn deconstruct(
|
||||
self,
|
||||
) -> (
|
||||
Arc<SignedBeaconBlock<T>>,
|
||||
Option<Arc<BlobsSidecar<T>>>,
|
||||
) {
|
||||
pub fn deconstruct(self) -> (Arc<SignedBeaconBlock<T>>, Option<Arc<BlobsSidecar<T>>>) {
|
||||
match self.blobs {
|
||||
Blobs::NotRequired | Blobs::None => (self.block, None),
|
||||
Blobs::Available(blob_sidecars) => (self.block, Some(blob_sidecars)),
|
||||
|
||||
@@ -49,8 +49,7 @@
|
||||
#![allow(clippy::result_large_err)]
|
||||
|
||||
use crate::blob_verification::{
|
||||
AsBlock, AvailableBlock, BlobError,
|
||||
BlockWrapper, IntoAvailableBlock, IntoBlockWrapper,
|
||||
AsBlock, AvailableBlock, BlobError, BlockWrapper, IntoAvailableBlock, IntoBlockWrapper,
|
||||
};
|
||||
use crate::eth1_finalization_cache::Eth1FinalizationData;
|
||||
use crate::execution_payload::{
|
||||
@@ -933,7 +932,7 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
|
||||
// Having checked the proposer index and the block root we can cache them.
|
||||
let consensus_context = ConsensusContext::new(available_block.slot())
|
||||
.set_current_block_root(block_root)
|
||||
.set_proposer_index(available_block.as_block().message().proposer_index())
|
||||
.set_proposer_index(block.as_block().message().proposer_index())
|
||||
.set_kzg_commitments_consistent(true);
|
||||
|
||||
Ok(Self {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::blob_verification::{AvailableBlock};
|
||||
use crate::blob_verification::AvailableBlock;
|
||||
use crate::{
|
||||
attester_cache::{CommitteeLengths, Error},
|
||||
metrics,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use crate::blob_verification::{verify_data_availability};
|
||||
use crate::blob_verification::verify_data_availability;
|
||||
use crate::block_verification::{ExecutedBlock, IntoExecutionPendingBlock};
|
||||
use crate::kzg_utils::validate_blob;
|
||||
use crate::{BeaconChainError, BeaconChainTypes, BlockError};
|
||||
use eth2::reqwest::header::Entry;
|
||||
use kzg::Error as KzgError;
|
||||
use kzg::{Kzg, KzgCommitment};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use ssz_types::VariableList;
|
||||
@@ -11,7 +12,6 @@ use std::future::Future;
|
||||
use std::sync::Arc;
|
||||
use types::blob_sidecar::{BlobIdentifier, BlobSidecar};
|
||||
use types::{EthSpec, Hash256};
|
||||
use kzg::Error as KzgError;
|
||||
|
||||
pub enum BlobCacheError {
|
||||
DuplicateBlob(Hash256),
|
||||
@@ -54,7 +54,8 @@ impl<T: BeaconChainTypes> GossipBlobCache<T> {
|
||||
blob.blob.clone(),
|
||||
blob.kzg_commitment.clone(),
|
||||
blob.kzg_proof,
|
||||
).map_err(|e|BlobCacheError::Kzg(e))?;
|
||||
)
|
||||
.map_err(|e| BlobCacheError::Kzg(e))?;
|
||||
|
||||
if verified {
|
||||
let mut blob_cache = self.gossip_blob_cache.lock();
|
||||
@@ -93,7 +94,11 @@ impl<T: BeaconChainTypes> GossipBlobCache<T> {
|
||||
.entry(executed_block.block_root)
|
||||
.and_modify(|cache| {
|
||||
if let Ok(block) = executed_block.block.message_eip4844() {
|
||||
let verified_commitments_vec: Vec<_> = cache.verified_blobs.iter().map(|blob|blob.kzg_commitment).collect();
|
||||
let verified_commitments_vec: Vec<_> = cache
|
||||
.verified_blobs
|
||||
.iter()
|
||||
.map(|blob| blob.kzg_commitment)
|
||||
.collect();
|
||||
let verified_commitments = VariableList::from(verified_commitments_vec);
|
||||
if verified_commitments == block.body.blob_kzg_commitments {
|
||||
// send to reprocessing queue ?
|
||||
|
||||
@@ -2,13 +2,13 @@ use super::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::EnumString;
|
||||
use superstruct::superstruct;
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::Blobs;
|
||||
use types::{
|
||||
EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella,
|
||||
ExecutionPayloadEip4844, ExecutionPayloadMerge, FixedVector, Transaction, Unsigned,
|
||||
VariableList, Withdrawal,
|
||||
};
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::Blobs;
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -41,6 +41,8 @@ use tokio::{
|
||||
};
|
||||
use tokio_stream::wrappers::WatchStream;
|
||||
use tree_hash::TreeHash;
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::Blobs;
|
||||
use types::consts::eip4844::BLOB_TX_TYPE;
|
||||
use types::transaction::{AccessTuple, BlobTransaction, EcdsaSignature, SignedBlobTransaction};
|
||||
use types::Withdrawals;
|
||||
@@ -53,8 +55,6 @@ use types::{
|
||||
ProposerPreparationData, PublicKeyBytes, Signature, SignedBeaconBlock, Slot, Transaction,
|
||||
Uint256,
|
||||
};
|
||||
use types::beacon_block_body::KzgCommitments;
|
||||
use types::blob_sidecar::Blobs;
|
||||
|
||||
mod block_hash;
|
||||
mod engine_api;
|
||||
|
||||
@@ -22,8 +22,8 @@ use tokio_util::{
|
||||
};
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockMerge,
|
||||
EmptyBlock, EthSpec, ForkContext, ForkName, Hash256, MainnetEthSpec, Signature,
|
||||
SignedBeaconBlock, BlobSidecar
|
||||
BlobSidecar, EmptyBlock, EthSpec, ForkContext, ForkName, Hash256, MainnetEthSpec, Signature,
|
||||
SignedBeaconBlock,
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::{DBColumn, Error, StoreItem};
|
||||
use ssz::{Decode, Encode};
|
||||
use types::{
|
||||
EthSpec, ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadEip4844,
|
||||
ExecutionPayloadMerge,BlobSidecarList
|
||||
BlobSidecarList, EthSpec, ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadEip4844,
|
||||
ExecutionPayloadMerge,
|
||||
};
|
||||
|
||||
macro_rules! impl_store_item {
|
||||
|
||||
Reference in New Issue
Block a user