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