fix payload v5

This commit is contained in:
Eitan Seri-Levi
2026-05-01 10:31:07 +02:00
parent 313e2d946c
commit fa87ff23a9
3 changed files with 23 additions and 48 deletions

View File

@@ -1021,9 +1021,20 @@ impl<E: EthSpec> BeaconState<E> {
}
let committee_size = E::InclusionListCommitteeSize::to_usize();
let num_indices = indices.len();
// num_indices > 0 is guaranteed by the is_empty() check above
let il_committee: Vec<u64> = (0..committee_size)
.map(|i| indices[i % indices.len()] as u64)
.collect();
.map(|i| {
let idx = i
.safe_rem(num_indices)
.map_err(|_| BeaconStateError::InsufficientValidators)?;
indices
.get(idx)
.copied()
.map(|v| v as u64)
.ok_or(BeaconStateError::InsufficientValidators)
})
.collect::<Result<Vec<u64>, BeaconStateError>>()?;
Ok(InclusionListCommittee::<E>::from(il_committee.try_into()?))
}