Address clippy lints in tree-states (#4414)

* Address some clippy lints

* Box errors to fix error size lint

* Add Default impl for Validator

* Address more clippy lints

* Re-implement `check_state_diff`

* Fix misc test compile errors
This commit is contained in:
Paul Hauner
2023-06-20 11:47:52 +10:00
committed by GitHub
parent 23db089a7a
commit d56cec83fc
26 changed files with 94 additions and 73 deletions

View File

@@ -328,7 +328,7 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
let mut result = T::run(&mut state, spec).map(|_| state);
check_state_diff(&pre_state, &expected)?;
check_state_diff(&pre_state, &expected, spec)?;
compare_beacon_state_results_without_caches(&mut result, &mut expected)
}
}

View File

@@ -458,7 +458,7 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
// NOTE: some of the withdrawals tests have 0 active validators, do not try
// to build the commitee cache in this case.
if O::handler_name() != "withdrawals" {
state.build_all_committee_caches(spec).unwrap();
pre_state.build_all_committee_caches(spec).unwrap();
}
let mut state = pre_state.clone();
@@ -475,7 +475,7 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
.apply_to(&mut state, spec, self)
.map(|()| state);
check_state_diff(&pre_state, &expected)?;
check_state_diff(&pre_state, &expected, spec)?;
compare_beacon_state_results_without_caches(&mut result, &mut expected)
}
}

View File

@@ -137,7 +137,7 @@ impl<E: EthSpec> Case for SanityBlocks<E> {
post.build_all_committee_caches(spec).unwrap();
post
});
check_state_diff(&pre, &post)?;
check_state_diff(&pre, &post, spec)?;
Ok(())
}
}

View File

@@ -76,6 +76,6 @@ impl<E: EthSpec> Case for SanitySlots<E> {
post.build_all_committee_caches(spec).unwrap();
post
});
check_state_diff(&pre, &post)
check_state_diff(&pre, &post, spec)
}
}