Skip to content

Commit

Permalink
Remove un-used code
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed May 19, 2022
1 parent f864ac6 commit b253807
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions packages/lodestar/src/chain/opPools/aggregatedAttestationPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,59 +185,6 @@ export class AggregatedAttestationPool {
}
return attestations;
}

/**
* Get attestations to be included in a phase0 block.
* As we are close to altair, this is not really important, it's mainly for e2e.
* The performance is not great due to the different BeaconState data structure to altair.
*/
private getParticipationPhase0(state: CachedBeaconStateAllForks): GetParticipationFn {
// check for phase0 block already
const phase0State = state as CachedBeaconStatePhase0;
const stateEpoch = computeEpochAtSlot(state.slot);

const previousEpochParticipants = extractParticipation(
phase0State.previousEpochAttestations.getAllReadonly(),
state
);
const currentEpochParticipants = extractParticipation(phase0State.currentEpochAttestations.getAllReadonly(), state);

return (epoch: Epoch) => {
return epoch === stateEpoch
? currentEpochParticipants
: epoch === stateEpoch - 1
? previousEpochParticipants
: null;
};
}

/**
* Get attestations to be included in an altair block.
* Attestations are sorted by inclusion distance then number of attesters.
* Attestations should pass the validation when processing attestations in beacon-state-transition.
*/
private getParticipationAltair(state: CachedBeaconStateAllForks): GetParticipationFn {
// check for altair block already
const altairState = state as CachedBeaconStateAltair;
const stateEpoch = computeEpochAtSlot(state.slot);
const previousParticipation = altairState.previousEpochParticipation.getAll();
const currentParticipation = altairState.currentEpochParticipation.getAll();

return (epoch: Epoch, committee: number[]) => {
const participationStatus =
epoch === stateEpoch ? currentParticipation : epoch === stateEpoch - 1 ? previousParticipation : null;

if (participationStatus === null) return null;

const seenValidatorIndices = new Set<ValidatorIndex>();
for (const validatorIndex of committee) {
if (flagIsTimelySource(participationStatus[validatorIndex])) {
seenValidatorIndices.add(validatorIndex);
}
}
return seenValidatorIndices;
};
}
}

// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down Expand Up @@ -439,14 +386,6 @@ export function extractParticipation(
return allParticipants;
}

export function intersection(bigSet: Set<ValidatorIndex>, smallSet: Set<ValidatorIndex>): number {
let numIntersection = 0;
for (const validatorIndex of smallSet) {
if (bigSet.has(validatorIndex)) numIntersection++;
}
return numIntersection;
}

/**
* The state transition accepts incorrect target and head attestations.
* We only need to validate the source checkpoint.
Expand Down

0 comments on commit b253807

Please sign in to comment.