Skip to content

Instantly share code, notes, and snippets.

View dtbuchholz's full-sized avatar

Dan Buchholz dtbuchholz

View GitHub Profile
@dtbuchholz
dtbuchholz / block_processing.rs
Last active June 3, 2022 22:41
Resolution for mutable/immutable borrow in `process_attestation`
fn process_attestation(...) {
...
// Update epoch participation flags
// @dev deviate from the order of the spec to avoid immutable borrow after mutable borrow
let attesting_indices =
get_attesting_indices(state, data, &attestation.aggregation_bits, context)?;
// @dev Create immutable reference to `{current_or_previous}_epoch_participation`
let epoch_participation = if is_current {
&state.current_epoch_participation