Fix warnings and clippy lints
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use super::Error;
|
||||
use log::error;
|
||||
use types::*;
|
||||
|
||||
macro_rules! ensure {
|
||||
@@ -27,17 +26,14 @@ pub fn verify_slashable_attestation(
|
||||
| slashable_attestation_1.is_surround_vote(slashable_attestation_2, spec),
|
||||
Error::BadAttesterSlashing
|
||||
);
|
||||
error!("this a");
|
||||
ensure!(
|
||||
state.verify_slashable_attestation(&slashable_attestation_1, spec),
|
||||
Error::BadAttesterSlashing
|
||||
);
|
||||
error!("this b");
|
||||
ensure!(
|
||||
state.verify_slashable_attestation(&slashable_attestation_2, spec),
|
||||
Error::BadAttesterSlashing
|
||||
);
|
||||
error!("this c");
|
||||
|
||||
let mut slashable_indices = vec![];
|
||||
for i in &slashable_attestation_1.validator_indices {
|
||||
@@ -53,7 +49,7 @@ pub fn verify_slashable_attestation(
|
||||
}
|
||||
}
|
||||
|
||||
ensure!(slashable_indices.len() >= 1, Error::BadAttesterSlashing);
|
||||
ensure!(!slashable_indices.is_empty(), Error::BadAttesterSlashing);
|
||||
|
||||
for i in slashable_indices {
|
||||
state.penalize_validator(*i as usize, spec)?;
|
||||
|
||||
@@ -16,8 +16,8 @@ impl AttesterSlashingBuilder {
|
||||
let shard = 0;
|
||||
let justified_epoch = Epoch::new(0);
|
||||
let epoch = Epoch::new(0);
|
||||
let hash_1 = Hash256::from("1".as_bytes());
|
||||
let hash_2 = Hash256::from("2".as_bytes());
|
||||
let hash_1 = Hash256::from(&[1][..]);
|
||||
let hash_2 = Hash256::from(&[2][..]);
|
||||
|
||||
let mut slashable_attestation_1 = SlashableAttestation {
|
||||
validator_indices: validator_indices.to_vec(),
|
||||
|
||||
@@ -419,8 +419,7 @@ impl BeaconState {
|
||||
committees_per_epoch
|
||||
);
|
||||
|
||||
let active_validator_indices: Vec<usize> =
|
||||
active_validator_indices.iter().cloned().collect();
|
||||
let active_validator_indices: Vec<usize> = active_validator_indices.to_vec();
|
||||
|
||||
let shuffled_active_validator_indices = shuffle_list(
|
||||
active_validator_indices,
|
||||
|
||||
@@ -14,13 +14,13 @@ impl ProposerSlashingBuilder {
|
||||
let proposal_data_1 = ProposalSignedData {
|
||||
slot,
|
||||
shard,
|
||||
block_root: Hash256::from("one".as_bytes()),
|
||||
block_root: Hash256::from(&[1][..]),
|
||||
};
|
||||
|
||||
let proposal_data_2 = ProposalSignedData {
|
||||
slot,
|
||||
shard,
|
||||
block_root: Hash256::from("two".as_bytes()),
|
||||
block_root: Hash256::from(&[2][..]),
|
||||
};
|
||||
|
||||
let proposal_signature_1 = {
|
||||
|
||||
@@ -5,7 +5,7 @@ use bls_aggregates::AggregatePublicKey as RawAggregatePublicKey;
|
||||
///
|
||||
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
|
||||
/// serialization).
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct AggregatePublicKey(RawAggregatePublicKey);
|
||||
|
||||
impl AggregatePublicKey {
|
||||
|
||||
Reference in New Issue
Block a user