Merge remote-tracking branch 'origin/master' into spec-v0.12

This commit is contained in:
Michael Sproul
2020-06-26 12:08:46 +10:00
34 changed files with 196 additions and 227 deletions

View File

@@ -80,10 +80,9 @@ impl ForkChoiceTestDefinition {
finalized_epoch,
&justified_state_balances,
)
.expect(&format!(
"find_head op at index {} returned error",
op_index
));
.unwrap_or_else(|_| {
panic!("find_head op at index {} returned error", op_index)
});
assert_eq!(
head, expected_head,
@@ -129,10 +128,12 @@ impl ForkChoiceTestDefinition {
justified_epoch,
finalized_epoch,
};
fork_choice.process_block(block).expect(&format!(
"process_block op at index {} returned error",
op_index
));
fork_choice.process_block(block).unwrap_or_else(|e| {
panic!(
"process_block op at index {} returned error: {:?}",
op_index, e
)
});
check_bytes_round_trip(&fork_choice);
}
Operation::ProcessAttestation {
@@ -142,10 +143,12 @@ impl ForkChoiceTestDefinition {
} => {
fork_choice
.process_attestation(validator_index, block_root, target_epoch)
.expect(&format!(
"process_attestation op at index {} returned error",
op_index
));
.unwrap_or_else(|_| {
panic!(
"process_attestation op at index {} returned error",
op_index
)
});
check_bytes_round_trip(&fork_choice);
}
Operation::Prune {

View File

@@ -91,7 +91,7 @@ pub fn get_ffg_case_01_test_definition() -> ForkChoiceTestDefinition {
justified_epoch: Epoch::new(2),
justified_root: get_hash(3),
finalized_epoch: Epoch::new(1),
justified_state_balances: balances.clone(),
justified_state_balances: balances,
expected_head: get_hash(3),
});
@@ -421,7 +421,7 @@ pub fn get_ffg_case_02_test_definition() -> ForkChoiceTestDefinition {
justified_epoch: Epoch::new(3),
justified_root: get_hash(2),
finalized_epoch: Epoch::new(0),
justified_state_balances: balances.clone(),
justified_state_balances: balances,
});
// END OF TESTS

View File

@@ -212,7 +212,7 @@ pub fn get_no_votes_test_definition() -> ForkChoiceTestDefinition {
justified_epoch: Epoch::new(2),
justified_root: get_hash(5),
finalized_epoch: Epoch::new(1),
justified_state_balances: balances.clone(),
justified_state_balances: balances,
expected_head: get_hash(6),
},
];

View File

@@ -673,7 +673,7 @@ pub fn get_votes_test_definition() -> ForkChoiceTestDefinition {
justified_epoch: Epoch::new(2),
justified_root: get_hash(5),
finalized_epoch: Epoch::new(2),
justified_state_balances: balances.clone(),
justified_state_balances: balances,
expected_head: get_hash(11),
});