Fix underflow in verify_indexed_attestation
This commit is contained in:
parent
67f890ae48
commit
55ef75a44e
@ -62,11 +62,13 @@ fn verify_indexed_attestation_parametric<T: EthSpec>(
|
|||||||
|
|
||||||
// Check that both vectors of indices are sorted
|
// Check that both vectors of indices are sorted
|
||||||
let check_sorted = |list: &Vec<u64>| {
|
let check_sorted = |list: &Vec<u64>| {
|
||||||
for i in 0..list.len() - 1 {
|
list.windows(2).enumerate().try_for_each(|(i, pair)| {
|
||||||
if list[i] >= list[i + 1] {
|
if pair[0] >= pair[1] {
|
||||||
invalid!(Invalid::BadValidatorIndicesOrdering(i));
|
invalid!(Invalid::BadValidatorIndicesOrdering(i));
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
})?;
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
check_sorted(custody_bit_0_indices)?;
|
check_sorted(custody_bit_0_indices)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user