Fix ups and Clippy

This commit is contained in:
Michael Sproul
2023-01-17 15:57:34 +11:00
parent 2b84597525
commit 5ce14c8dce
22 changed files with 92 additions and 79 deletions

View File

@@ -294,9 +294,9 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
let mut state = pre_state.clone();
let mut expected = self.post.clone();
expected.as_mut().map(|post_state| {
if let Some(post_state) = expected.as_mut() {
post_state.build_all_committee_caches(spec).unwrap();
});
}
let mut result = T::run(&mut state, spec).map(|_| state);

View File

@@ -386,9 +386,9 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
let mut state = pre_state.clone();
let mut expected = self.post.clone();
expected
.as_mut()
.map(|post_state| post_state.build_all_committee_caches(spec).unwrap());
if let Some(post_state) = expected.as_mut() {
post_state.build_all_committee_caches(spec).unwrap();
}
let mut result = self
.operation

View File

@@ -170,7 +170,7 @@ vectors_and_tests!(
invalid_exit_already_initiated,
ExitTest {
state_modifier: Box::new(|state| {
state.validators_mut().get_mut(0).unwrap().exit_epoch = STATE_EPOCH + 1;
*state.validators_mut().get_mut(0).unwrap().exit_epoch_mut() = STATE_EPOCH + 1;
}),
expected: Err(BlockProcessingError::ExitInvalid {
index: 0,
@@ -189,8 +189,11 @@ vectors_and_tests!(
invalid_not_active_before_activation_epoch,
ExitTest {
state_modifier: Box::new(|state| {
state.validators_mut().get_mut(0).unwrap().activation_epoch =
E::default_spec().far_future_epoch;
*state
.validators_mut()
.get_mut(0)
.unwrap()
.activation_epoch_mut() = E::default_spec().far_future_epoch;
}),
expected: Err(BlockProcessingError::ExitInvalid {
index: 0,
@@ -209,7 +212,7 @@ vectors_and_tests!(
invalid_not_active_after_exit_epoch,
ExitTest {
state_modifier: Box::new(|state| {
state.validators_mut().get_mut(0).unwrap().exit_epoch = STATE_EPOCH;
*state.validators_mut().get_mut(0).unwrap().exit_epoch_mut() = STATE_EPOCH;
}),
expected: Err(BlockProcessingError::ExitInvalid {
index: 0,