From b303d2fb7eadf8fa471ad546f4b2fd45d09f6e2c Mon Sep 17 00:00:00 2001 From: realbigsean Date: Wed, 15 Mar 2023 15:32:22 -0400 Subject: [PATCH] lints --- beacon_node/beacon_chain/src/beacon_chain.rs | 2 +- beacon_node/beacon_chain/src/blob_verification.rs | 10 +++++----- beacon_node/http_api/src/build_block_contents.rs | 4 ++-- .../src/beacon_processor/worker/gossip_methods.rs | 4 ++-- .../src/beacon_processor/worker/rpc_methods.rs | 4 ++-- .../network/src/sync/block_sidecar_coupling.rs | 2 +- beacon_node/network/src/sync/manager.rs | 6 +++--- consensus/types/src/signed_block_contents.rs | 12 ++++++------ validator_client/src/block_service.rs | 3 +-- 9 files changed, 23 insertions(+), 24 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 8f39b3758..79a3e418e 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -4857,7 +4857,7 @@ impl BeaconChain { )), )?; - kzg_utils::compute_blob_kzg_proof::(kzg, blob, kzg_commitment.clone()) + kzg_utils::compute_blob_kzg_proof::(kzg, blob, *kzg_commitment) .map_err(BlockProductionError::KzgError) }) .collect::, BlockProductionError>>() diff --git a/beacon_node/beacon_chain/src/blob_verification.rs b/beacon_node/beacon_chain/src/blob_verification.rs index 7a4493c97..e2288dbb8 100644 --- a/beacon_node/beacon_chain/src/blob_verification.rs +++ b/beacon_node/beacon_chain/src/blob_verification.rs @@ -3,7 +3,7 @@ use slot_clock::SlotClock; use std::sync::Arc; 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 types::signed_beacon_block::BlobReconstructionError; use types::{ @@ -116,11 +116,11 @@ pub fn validate_blob_for_gossip( } fn verify_data_availability( - blob_sidecar: &BlobsSidecar, + _blob_sidecar: &BlobsSidecar, kzg_commitments: &[KzgCommitment], transactions: &Transactions, - block_slot: Slot, - block_root: Hash256, + _block_slot: Slot, + _block_root: Hash256, chain: &BeaconChain, ) -> Result<(), BlobError> { if verify_kzg_commitments_against_transactions::(transactions, kzg_commitments) @@ -130,7 +130,7 @@ fn verify_data_availability( } // Validatate that the kzg proof is valid against the commitments and blobs - let kzg = chain + let _kzg = chain .kzg .as_ref() .ok_or(BlobError::TrustedSetupNotInitialized)?; diff --git a/beacon_node/http_api/src/build_block_contents.rs b/beacon_node/http_api/src/build_block_contents.rs index 1908c03ea..9fbde0ce0 100644 --- a/beacon_node/http_api/src/build_block_contents.rs +++ b/beacon_node/http_api/src/build_block_contents.rs @@ -24,9 +24,9 @@ pub fn build_block_contents Worker { #[allow(clippy::too_many_arguments)] pub async fn process_gossip_blob( self, - message_id: MessageId, + _message_id: MessageId, peer_id: PeerId, peer_client: Client, blob_index: u64, signed_blob: Arc>, - seen_duration: Duration, + _seen_duration: Duration, ) { // TODO: gossip verification crit!(self.log, "UNIMPLEMENTED gossip blob verification"; diff --git a/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs b/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs index 4480f3713..78b9de303 100644 --- a/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/rpc_methods.rs @@ -252,7 +252,7 @@ impl Worker { block_parent_root: block.parent_root, proposer_index: block.proposer_index, 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 }; self.send_response( @@ -843,7 +843,7 @@ impl Worker { beacon_block_root, beacon_block_slot, blobs: blob_bundle, - kzg_aggregated_proof, + kzg_aggregated_proof: _, }: types::BlobsSidecar<_> = blobs; for (blob_index, blob) in blob_bundle.into_iter().enumerate() { diff --git a/beacon_node/network/src/sync/block_sidecar_coupling.rs b/beacon_node/network/src/sync/block_sidecar_coupling.rs index 438317d1c..67db9a7a3 100644 --- a/beacon_node/network/src/sync/block_sidecar_coupling.rs +++ b/beacon_node/network/src/sync/block_sidecar_coupling.rs @@ -32,7 +32,7 @@ impl BlocksAndBlobsRequestInfo { pub fn into_responses(self) -> Result>, &'static str> { let BlocksAndBlobsRequestInfo { accumulated_blocks, - mut accumulated_sidecars, + accumulated_sidecars, .. } = self; diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index 353d3e896..768b95273 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -875,8 +875,8 @@ impl SyncManager { fn rpc_blobs_received( &mut self, request_id: RequestId, - peer_id: PeerId, - maybe_blob: Option::EthSpec>>>, + _peer_id: PeerId, + _maybe_blob: Option::EthSpec>>>, _seen_timestamp: Duration, ) { match request_id { @@ -892,7 +892,7 @@ impl SyncManager { RequestId::RangeBlocks { .. } => { unreachable!("Only-blocks range requests don't receive sidecars") } - RequestId::RangeBlobs { id } => { + RequestId::RangeBlobs { id: _ } => { unimplemented!("Adjust range"); } } diff --git a/consensus/types/src/signed_block_contents.rs b/consensus/types/src/signed_block_contents.rs index bce623333..7f547c86f 100644 --- a/consensus/types/src/signed_block_contents.rs +++ b/consensus/types/src/signed_block_contents.rs @@ -4,6 +4,11 @@ use derivative::Derivative; use serde_derive::{Deserialize, Serialize}; use ssz_types::VariableList; +pub type BlockContentsTuple = ( + SignedBeaconBlock, + Option, ::MaxBlobsPerBlock>>, +); + /// A wrapper over a [`SignedBeaconBlock`] or a [`SignedBeaconBlockAndBlobSidecars`]. #[derive(Clone, Debug, Derivative, Serialize, Deserialize)] #[derivative(PartialEq, Hash(bound = "T: EthSpec"))] @@ -24,12 +29,7 @@ impl> SignedBlockContents ( - SignedBeaconBlock, - Option, ::MaxBlobsPerBlock>>, - ) { + pub fn deconstruct(self) -> BlockContentsTuple { match self { SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => ( block_and_sidecars.signed_block, diff --git a/validator_client/src/block_service.rs b/validator_client/src/block_service.rs index eb40dee9b..48d646016 100644 --- a/validator_client/src/block_service.rs +++ b/validator_client/src/block_service.rs @@ -388,7 +388,6 @@ impl BlockService { )) })? .data - .into() } }; @@ -455,7 +454,7 @@ impl BlockService { ); beacon_node // 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 .map_err(|e| { BlockError::Irrecoverable(format!(