mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
get tests passing (except one)
This commit is contained in:
@@ -95,7 +95,7 @@ pub fn generate_attestation(
|
||||
* and sign the aggregate sig.
|
||||
*/
|
||||
if let Some(sk) = secret_key {
|
||||
attester_bitfield.set_bit(i, true);
|
||||
attester_bitfield.set(i, true).unwrap();
|
||||
let sig = Signature::new(&attestation_message, sk);
|
||||
aggregate_sig.add(&sig);
|
||||
}
|
||||
|
||||
@@ -133,12 +133,8 @@ fn test_attestation_validation_invalid_bad_bitfield_length() {
|
||||
* of the bitfield.
|
||||
*/
|
||||
let one_byte_higher = rig.attester_count + 8;
|
||||
rig.attestation
|
||||
.attester_bitfield
|
||||
.set_bit(one_byte_higher, true);
|
||||
rig.attestation
|
||||
.attester_bitfield
|
||||
.set_bit(one_byte_higher, false);
|
||||
rig.attestation.attester_bitfield.set(one_byte_higher, true).unwrap();
|
||||
rig.attestation.attester_bitfield.set(one_byte_higher, false).unwrap();
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(result, Err(AttestationValidationError::BadBitfieldLength));
|
||||
@@ -149,9 +145,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_bit(one_bit_high, true);
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true).unwrap();
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(
|
||||
@@ -174,19 +168,11 @@ fn test_attestation_validation_invalid_invalid_bitfield_end_bit_with_irreguar_bi
|
||||
* bit in a bitfield and the byte length of that bitfield
|
||||
*/
|
||||
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_bit(one_bit_high, true);
|
||||
assert!(one_bit_high % 8 != 0, "the test is ineffective in this case.");
|
||||
rig.attestation.attester_bitfield.set(one_bit_high, true).unwrap();
|
||||
|
||||
let result = rig.context.validate_attestation(&rig.attestation);
|
||||
assert_eq!(
|
||||
result,
|
||||
Err(AttestationValidationError::InvalidBitfieldEndBits)
|
||||
);
|
||||
assert_eq!(result, Err(AttestationValidationError::InvalidBitfieldEndBits));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user