mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 12:28:24 +00:00
Begin updating tests to reflect changes to bitfield
This commit is contained in:
@@ -129,12 +129,10 @@ fn test_attestation_validation_invalid_bad_bitfield_length() {
|
||||
/*
|
||||
* Extend the bitfield by one byte
|
||||
*
|
||||
* This is a little hacky and makes assumptions about the internals
|
||||
* of the bitfield.
|
||||
* We take advantage of the fact that setting a bit outside the current bounds will grow the bitvector.
|
||||
*/
|
||||
let one_byte_higher = rig.attester_count + 8;
|
||||
rig.attestation.attester_bitfield.set(one_byte_higher, true).unwrap();
|
||||
rig.attestation.attester_bitfield.set(one_byte_higher, false).unwrap();
|
||||
rig.attestation.attester_bitfield.set(one_byte_higher, false);
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(result, Err(AttestationValidationError::BadBitfieldLength));
|
||||
@@ -145,7 +143,7 @@ fn test_attestation_validation_invalid_invalid_bitfield_end_bit() {
|
||||
let mut rig = generic_rig();
|
||||
|
||||
let one_bit_high = rig.attester_count + 1;
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true).unwrap();
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true);
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(
|
||||
@@ -169,7 +167,7 @@ fn test_attestation_validation_invalid_invalid_bitfield_end_bit_with_irreguar_bi
|
||||
*/
|
||||
let one_bit_high = rig.attester_count + 1;
|
||||
assert!(one_bit_high % 8 != 0, "the test is ineffective in this case.");
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true).unwrap();
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true);
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(result, Err(AttestationValidationError::InvalidBitfieldEndBits));
|
||||
|
||||
Reference in New Issue
Block a user