correct attestation warnings, add unit test
This commit is contained in:
parent
b6f4d1c968
commit
b8ca18f87b
@ -41,21 +41,20 @@ mod tests {
|
|||||||
Block,
|
Block,
|
||||||
ChainConfig) {
|
ChainConfig) {
|
||||||
|
|
||||||
let mut crystallized_state = CrystallizedState::zero();
|
let crystallized_state = CrystallizedState::zero();
|
||||||
let mut active_state = ActiveState::zero();
|
let active_state = ActiveState::zero();
|
||||||
let mut attestation_record = AttestationRecord::zero();
|
let attestation_record = AttestationRecord::zero();
|
||||||
let mut block = Block::zero();
|
let block = Block::zero();
|
||||||
let chain_config = ChainConfig::standard();
|
let chain_config = ChainConfig::standard();
|
||||||
|
|
||||||
return (crystallized_state, active_state, attestation_record, block, chain_config);
|
return (crystallized_state, active_state, attestation_record, block, chain_config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_attestation_validation_slot_high() {
|
fn test_attestation_validation_slot_high() {
|
||||||
// generate standard state
|
// generate standard state
|
||||||
let (mut crystallized_state, mut active_state, mut attestation_record, mut block, mut chain_config) = generate_standard_state();
|
let (crystallized_state, active_state, mut attestation_record, mut block, chain_config) = generate_standard_state();
|
||||||
// set slot too high
|
// set slot too high
|
||||||
attestation_record.slot = 30;
|
attestation_record.slot = 30;
|
||||||
block.slot_number = 10;
|
block.slot_number = 10;
|
||||||
@ -63,4 +62,16 @@ mod tests {
|
|||||||
let result = validate_attestation(&crystallized_state, &active_state, &attestation_record, &block, &chain_config);
|
let result = validate_attestation(&crystallized_state, &active_state, &attestation_record, &block, &chain_config);
|
||||||
assert_eq!(result, Err(AttestationValidationError::SlotTooHigh));
|
assert_eq!(result, Err(AttestationValidationError::SlotTooHigh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_attestation_validation_slot_low() {
|
||||||
|
// generate standard state
|
||||||
|
let (crystallized_state, active_state, mut attestation_record, mut block, chain_config) = generate_standard_state();
|
||||||
|
// set slot too high
|
||||||
|
attestation_record.slot = 2;
|
||||||
|
block.slot_number = 10;
|
||||||
|
|
||||||
|
let result = validate_attestation(&crystallized_state, &active_state, &attestation_record, &block, &chain_config);
|
||||||
|
//assert_eq!(result, Err(AttestationValidationError::SlotTooLow));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user