Fix Rust 1.69 lints (#4222)

## Issue Addressed

N/A

## Proposed Changes

Fixes lints mostly `extra-unused-type-parameters` https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_type_paramete
This commit is contained in:
Pawan Dhananjay 2023-04-21 18:29:28 +00:00
parent ed7824869c
commit a78285db5e
6 changed files with 22 additions and 27 deletions

View File

@ -3619,7 +3619,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let (state, state_root_opt) = self let (state, state_root_opt) = self
.task_executor .task_executor
.spawn_blocking_handle( .spawn_blocking_handle(
move || chain.load_state_for_block_production::<Payload>(slot), move || chain.load_state_for_block_production(slot),
"produce_partial_beacon_block", "produce_partial_beacon_block",
) )
.ok_or(BlockProductionError::ShuttingDown)? .ok_or(BlockProductionError::ShuttingDown)?
@ -3642,7 +3642,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// Load a beacon state from the database for block production. This is a long-running process /// Load a beacon state from the database for block production. This is a long-running process
/// that should not be performed in an `async` context. /// that should not be performed in an `async` context.
fn load_state_for_block_production<Payload: ExecPayload<T::EthSpec>>( fn load_state_for_block_production(
self: &Arc<Self>, self: &Arc<Self>,
slot: Slot, slot: Slot,
) -> Result<(BeaconState<T::EthSpec>, Option<Hash256>), BlockProductionError> { ) -> Result<(BeaconState<T::EthSpec>, Option<Hash256>), BlockProductionError> {

View File

@ -88,7 +88,7 @@ fn get_sync_status<T: EthSpec>(
let period = T::SlotsPerEth1VotingPeriod::to_u64(); let period = T::SlotsPerEth1VotingPeriod::to_u64();
let voting_period_start_slot = (current_slot / period) * period; let voting_period_start_slot = (current_slot / period) * period;
let period_start = slot_start_seconds::<T>( let period_start = slot_start_seconds(
genesis_time, genesis_time,
spec.seconds_per_slot, spec.seconds_per_slot,
voting_period_start_slot, voting_period_start_slot,
@ -470,7 +470,7 @@ impl<T: EthSpec> Eth1ChainBackend<T> for CachingEth1Backend<T> {
fn eth1_data(&self, state: &BeaconState<T>, spec: &ChainSpec) -> Result<Eth1Data, Error> { fn eth1_data(&self, state: &BeaconState<T>, spec: &ChainSpec) -> Result<Eth1Data, Error> {
let period = T::SlotsPerEth1VotingPeriod::to_u64(); let period = T::SlotsPerEth1VotingPeriod::to_u64();
let voting_period_start_slot = (state.slot() / period) * period; let voting_period_start_slot = (state.slot() / period) * period;
let voting_period_start_seconds = slot_start_seconds::<T>( let voting_period_start_seconds = slot_start_seconds(
state.genesis_time(), state.genesis_time(),
spec.seconds_per_slot, spec.seconds_per_slot,
voting_period_start_slot, voting_period_start_slot,
@ -658,11 +658,7 @@ fn find_winning_vote(valid_votes: Eth1DataVoteCount) -> Option<Eth1Data> {
} }
/// Returns the unix-epoch seconds at the start of the given `slot`. /// Returns the unix-epoch seconds at the start of the given `slot`.
fn slot_start_seconds<T: EthSpec>( fn slot_start_seconds(genesis_unix_seconds: u64, seconds_per_slot: u64, slot: Slot) -> u64 {
genesis_unix_seconds: u64,
seconds_per_slot: u64,
slot: Slot,
) -> u64 {
genesis_unix_seconds + slot.as_u64() * seconds_per_slot genesis_unix_seconds + slot.as_u64() * seconds_per_slot
} }
@ -698,7 +694,7 @@ mod test {
fn get_voting_period_start_seconds(state: &BeaconState<E>, spec: &ChainSpec) -> u64 { fn get_voting_period_start_seconds(state: &BeaconState<E>, spec: &ChainSpec) -> u64 {
let period = <E as EthSpec>::SlotsPerEth1VotingPeriod::to_u64(); let period = <E as EthSpec>::SlotsPerEth1VotingPeriod::to_u64();
let voting_period_start_slot = (state.slot() / period) * period; let voting_period_start_slot = (state.slot() / period) * period;
slot_start_seconds::<E>( slot_start_seconds(
state.genesis_time(), state.genesis_time(),
spec.seconds_per_slot, spec.seconds_per_slot,
voting_period_start_slot, voting_period_start_slot,
@ -708,23 +704,23 @@ mod test {
#[test] #[test]
fn slot_start_time() { fn slot_start_time() {
let zero_sec = 0; let zero_sec = 0;
assert_eq!(slot_start_seconds::<E>(100, zero_sec, Slot::new(2)), 100); assert_eq!(slot_start_seconds(100, zero_sec, Slot::new(2)), 100);
let one_sec = 1; let one_sec = 1;
assert_eq!(slot_start_seconds::<E>(100, one_sec, Slot::new(0)), 100); assert_eq!(slot_start_seconds(100, one_sec, Slot::new(0)), 100);
assert_eq!(slot_start_seconds::<E>(100, one_sec, Slot::new(1)), 101); assert_eq!(slot_start_seconds(100, one_sec, Slot::new(1)), 101);
assert_eq!(slot_start_seconds::<E>(100, one_sec, Slot::new(2)), 102); assert_eq!(slot_start_seconds(100, one_sec, Slot::new(2)), 102);
let three_sec = 3; let three_sec = 3;
assert_eq!(slot_start_seconds::<E>(100, three_sec, Slot::new(0)), 100); assert_eq!(slot_start_seconds(100, three_sec, Slot::new(0)), 100);
assert_eq!(slot_start_seconds::<E>(100, three_sec, Slot::new(1)), 103); assert_eq!(slot_start_seconds(100, three_sec, Slot::new(1)), 103);
assert_eq!(slot_start_seconds::<E>(100, three_sec, Slot::new(2)), 106); assert_eq!(slot_start_seconds(100, three_sec, Slot::new(2)), 106);
let five_sec = 5; let five_sec = 5;
assert_eq!(slot_start_seconds::<E>(100, five_sec, Slot::new(0)), 100); assert_eq!(slot_start_seconds(100, five_sec, Slot::new(0)), 100);
assert_eq!(slot_start_seconds::<E>(100, five_sec, Slot::new(1)), 105); assert_eq!(slot_start_seconds(100, five_sec, Slot::new(1)), 105);
assert_eq!(slot_start_seconds::<E>(100, five_sec, Slot::new(2)), 110); assert_eq!(slot_start_seconds(100, five_sec, Slot::new(2)), 110);
assert_eq!(slot_start_seconds::<E>(100, five_sec, Slot::new(3)), 115); assert_eq!(slot_start_seconds(100, five_sec, Slot::new(3)), 115);
} }
fn get_eth1_block(timestamp: u64, number: u64) -> Eth1Block { fn get_eth1_block(timestamp: u64, number: u64) -> Eth1Block {

View File

@ -1187,7 +1187,7 @@ mod test {
transactions, transactions,
..<_>::default() ..<_>::default()
}); });
let json = serde_json::to_value(&ep)?; let json = serde_json::to_value(ep)?;
Ok(json.get("transactions").unwrap().clone()) Ok(json.get("transactions").unwrap().clone())
} }

View File

@ -403,7 +403,7 @@ impl ValidatorsListTreeHashCache {
validators.len(), validators.len(),
), ),
list_arena, list_arena,
values: ParallelValidatorTreeHash::new::<E>(validators), values: ParallelValidatorTreeHash::new(validators),
} }
} }
@ -468,7 +468,7 @@ impl ParallelValidatorTreeHash {
/// ///
/// Allocates the necessary memory to store all of the cached Merkle trees but does perform any /// Allocates the necessary memory to store all of the cached Merkle trees but does perform any
/// hashing. /// hashing.
fn new<E: EthSpec>(validators: &[Validator]) -> Self { fn new(validators: &[Validator]) -> Self {
let num_arenas = std::cmp::max( let num_arenas = std::cmp::max(
1, 1,
(validators.len() + VALIDATORS_PER_ARENA - 1) / VALIDATORS_PER_ARENA, (validators.len() + VALIDATORS_PER_ARENA - 1) / VALIDATORS_PER_ARENA,

View File

@ -2,9 +2,8 @@ use clap::ArgMatches;
use clap_utils::{parse_required, parse_ssz_required}; use clap_utils::{parse_required, parse_ssz_required};
use deposit_contract::{decode_eth1_tx_data, DEPOSIT_DATA_LEN}; use deposit_contract::{decode_eth1_tx_data, DEPOSIT_DATA_LEN};
use tree_hash::TreeHash; use tree_hash::TreeHash;
use types::EthSpec;
pub fn run<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> { pub fn run(matches: &ArgMatches) -> Result<(), String> {
let rlp_bytes = parse_ssz_required::<Vec<u8>>(matches, "deposit-data")?; let rlp_bytes = parse_ssz_required::<Vec<u8>>(matches, "deposit-data")?;
let amount = parse_required(matches, "deposit-amount")?; let amount = parse_required(matches, "deposit-amount")?;

View File

@ -847,7 +847,7 @@ fn run<T: EthSpec>(
} }
("new-testnet", Some(matches)) => new_testnet::run::<T>(testnet_dir, matches) ("new-testnet", Some(matches)) => new_testnet::run::<T>(testnet_dir, matches)
.map_err(|e| format!("Failed to run new_testnet command: {}", e)), .map_err(|e| format!("Failed to run new_testnet command: {}", e)),
("check-deposit-data", Some(matches)) => check_deposit_data::run::<T>(matches) ("check-deposit-data", Some(matches)) => check_deposit_data::run(matches)
.map_err(|e| format!("Failed to run check-deposit-data command: {}", e)), .map_err(|e| format!("Failed to run check-deposit-data command: {}", e)),
("generate-bootnode-enr", Some(matches)) => generate_bootnode_enr::run::<T>(matches) ("generate-bootnode-enr", Some(matches)) => generate_bootnode_enr::run::<T>(matches)
.map_err(|e| format!("Failed to run generate-bootnode-enr command: {}", e)), .map_err(|e| format!("Failed to run generate-bootnode-enr command: {}", e)),