diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 27686809b53..011776616a7 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -11,7 +11,7 @@ use lru::LruCache; use payload_status::process_multiple_payload_statuses; use sensitive_url::SensitiveUrl; use serde::{Deserialize, Serialize}; -use slog::{crit, debug, error, info, trace, Logger, warn}; +use slog::{crit, debug, error, info, trace, warn, Logger}; use slot_clock::SlotClock; use std::collections::HashMap; use std::convert::TryInto; @@ -26,7 +26,7 @@ use tokio::{ time::{sleep, sleep_until, Instant}, }; use types::{ - BlindedPayload, BlockType, ChainSpec, Epoch, ExecPayload, ExecutionBlockHash, FullPayload, + BlindedPayload, BlockType, ChainSpec, Epoch, ExecPayload, ExecutionBlockHash, ProposerPreparationData, SignedBeaconBlock, Slot, }; @@ -806,7 +806,7 @@ impl ExecutionLayer { .get_payload_v1::(payload_id) .await .map(|full_payload| { - if let Some(evicted_payload) = f(self, &full_payload) { + if let Some(_evicted_payload) = f(self, &full_payload) { warn!(self.log(), "Evicted a payload from the cache, this might indicate redundant proposal attempts."); } full_payload.into() diff --git a/beacon_node/execution_layer/src/payload_cache.rs b/beacon_node/execution_layer/src/payload_cache.rs index 9536f5568c5..e875475f120 100644 --- a/beacon_node/execution_layer/src/payload_cache.rs +++ b/beacon_node/execution_layer/src/payload_cache.rs @@ -1,10 +1,7 @@ use lru::LruCache; use parking_lot::Mutex; -use std::sync::Arc; use tree_hash::TreeHash; -use types::{ - BeaconBlock, BlindedPayload, EthSpec, ExecutionPayload, FullPayload, Hash256, SignedBeaconBlock, -}; +use types::{EthSpec, ExecutionPayload, Hash256}; pub const DEFAULT_PAYLOAD_CACHE_SIZE: usize = 10; diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 679912319d9..a33da767950 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -20,19 +20,15 @@ mod validator_inclusion; mod version; use beacon_chain::{ - attestation_verification::VerifiedAttestation, - observed_operations::ObservationOutcome, - validator_monitor::{get_block_delay_ms, timestamp_now}, - AttestationError as AttnError, BeaconChain, BeaconChainError, BeaconChainTypes, - HeadSafetyStatus, ProduceBlockVerification, WhenSlotSkipped, + attestation_verification::VerifiedAttestation, observed_operations::ObservationOutcome, + validator_monitor::timestamp_now, AttestationError as AttnError, BeaconChain, BeaconChainError, + BeaconChainTypes, HeadSafetyStatus, ProduceBlockVerification, WhenSlotSkipped, }; use block_id::BlockId; use eth2::types::{self as api_types, EndpointVersion, ValidatorId}; use lighthouse_network::{types::SyncState, EnrExt, NetworkGlobals, PeerId, PubsubMessage}; use lighthouse_version::version_with_platform; use network::NetworkMessage; -use parking_lot::lock_api::RwLock; -use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use slog::{crit, debug, error, info, warn, Logger}; use slot_clock::SlotClock; @@ -41,7 +37,6 @@ use state_id::StateId; use std::borrow::Cow; use std::convert::TryInto; use std::future::Future; -use std::hash::Hash; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::path::PathBuf; use std::pin::Pin; @@ -49,11 +44,11 @@ use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; use tokio_stream::{wrappers::BroadcastStream, StreamExt}; use types::{ - Attestation, AttesterSlashing, BeaconBlockBodyMerge, BeaconBlockMerge, BeaconStateError, - BlindedPayload, CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ExecutionPayload, ForkName, - FullPayload, Hash256, ProposerPreparationData, ProposerSlashing, RelativeEpoch, Signature, - SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockMerge, SignedContributionAndProof, - SignedVoluntaryExit, Slot, SyncCommitteeMessage, SyncContributionData, + Attestation, AttesterSlashing, BeaconStateError, BlindedPayload, CommitteeCache, + ConfigAndPreset, Epoch, EthSpec, ForkName, FullPayload, ProposerPreparationData, + ProposerSlashing, RelativeEpoch, Signature, SignedAggregateAndProof, SignedBeaconBlock, + SignedContributionAndProof, SignedVoluntaryExit, Slot, SyncCommitteeMessage, + SyncContributionData, }; use version::{ add_consensus_version_header, fork_versioned_response, inconsistent_fork_rejection, diff --git a/beacon_node/http_api/src/publish_blocks.rs b/beacon_node/http_api/src/publish_blocks.rs index 95c73844a45..539468f7a59 100644 --- a/beacon_node/http_api/src/publish_blocks.rs +++ b/beacon_node/http_api/src/publish_blocks.rs @@ -8,14 +8,11 @@ use slot_clock::SlotClock; use std::marker::PhantomData; use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; -use types::BlockType::Full; use types::{ - map_fork_name, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBodyAltair, BeaconBlockBodyBase, - BeaconBlockBodyMerge, BeaconBlockMerge, BlindedPayload, EthSpec, ExecPayload, ExecutionPayload, - ExecutionPayloadHeader, ForkName, FullPayload, SignedBeaconBlock, SignedBeaconBlockAltair, - SignedBeaconBlockBase, SignedBeaconBlockMerge, + BeaconBlockAltair, BeaconBlockBase, BeaconBlockBodyAltair, BeaconBlockBodyBase, + BeaconBlockBodyMerge, BeaconBlockMerge, BlindedPayload, FullPayload, SignedBeaconBlock, + SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockMerge, }; -use warp::path::full; use warp::Rejection; pub fn publish_block( @@ -29,7 +26,7 @@ pub fn publish_block( // Send the block, regardless of whether or not it is valid. The API // specification is very clear that this is the desired behaviour. crate::publish_pubsub_message( - &network_tx, + network_tx, PubsubMessage::BeaconBlock(Box::new(block.clone())), )?; @@ -235,22 +232,19 @@ fn reconstruct_block( execution_payload, } = body; - let el = chain - .execution_layer - .as_ref().ok_or(warp_utils::reject::custom_server_error("Missing execution layer".to_string()))?; + let el = chain.execution_layer.as_ref().ok_or_else(|| { + warp_utils::reject::custom_server_error("Missing execution layer".to_string()) + })?; let full_payload = if let Some(cached_payload) = el.get_payload_by_tx_root( - &execution_payload - .execution_payload_header - .transactions_root){ + &execution_payload.execution_payload_header.transactions_root, + ) { cached_payload - }else { - el.block_on(|el| el.propose_blinded_beacon_block(&block_clone)).map_err(|e| { - warp_utils::reject::custom_server_error(format!( - "proposal failed: {:?}", - e - )) - })? + } else { + el.block_on(|el| el.propose_blinded_beacon_block(&block_clone)) + .map_err(|e| { + warp_utils::reject::custom_server_error(format!("proposal failed: {:?}", e)) + })? }; SignedBeaconBlock::Merge(SignedBeaconBlockMerge {