Skip to content

Commit

Permalink
chore: refactor to committeeValidatorIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Dec 6, 2024
1 parent 7d3d255 commit 1ea5f0f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/beacon-node/src/api/impl/beacon/pool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ export function getBeaconPoolApi({
// when a validator is configured with multiple beacon node urls, this attestation data may come from another beacon node
// and the block hasn't been in our forkchoice since we haven't seen / processing that block
// see https://github.com/ChainSafe/lodestar/issues/5098
const {indexedAttestation, subnet, attDataRootHex, committeeIndex, participationIndex} =
const {indexedAttestation, subnet, attDataRootHex, committeeIndex, committeeValidatorIndex} =
await validateGossipFnRetryUnknownRoot(validateFn, network, chain, slot, beaconBlockRoot);

if (network.shouldAggregate(subnet, slot)) {
const insertOutcome = chain.attestationPool.add(
committeeIndex,
participationIndex,
committeeValidatorIndex,
attestation,
attDataRootHex
);
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/chain/opPools/attestationPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class AttestationPool {
*/
add(
committeeIndex: CommitteeIndex,
participationIndex: number,
committeeValidatorIndex: number,
attestation: Attestation,
attDataRootHex: RootHex
): InsertOutcome {
Expand Down Expand Up @@ -149,7 +149,7 @@ export class AttestationPool {
const aggregate = aggregateByIndex.get(committeeIndex);
if (aggregate) {
// Aggregate mutating
return aggregateAttestationInto(aggregate, attestation, participationIndex);
return aggregateAttestationInto(aggregate, attestation, committeeValidatorIndex);
}
// Create new aggregate
aggregateByIndex.set(committeeIndex, attestationToAggregate(attestation));
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/chain/validation/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type AttestationValidationResult = {
subnet: number;
attDataRootHex: RootHex;
committeeIndex: CommitteeIndex;
participationIndex: number;
committeeValidatorIndex: number;
};

export type AttestationOrBytes = ApiAttestation | GossipAttestation;
Expand Down Expand Up @@ -506,7 +506,7 @@ async function validateAttestationNoSignatureCheck(
signatureSet,
validatorIndex,
committeeIndex,
participationIndex: bitIndex,
committeeValidatorIndex: bitIndex,
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/src/network/processor/gossipHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ function getBatchHandlers(modules: ValidatorFnsModules, options: GossipHandlerOp
results.push(null);

// Handler
const {indexedAttestation, attDataRootHex, attestation, committeeIndex, participationIndex} =
const {indexedAttestation, attDataRootHex, attestation, committeeIndex, committeeValidatorIndex} =
validationResult.result;
metrics?.registerGossipUnaggregatedAttestation(gossipHandlerParams[i].seenTimestampSec, indexedAttestation);

Expand All @@ -643,7 +643,7 @@ function getBatchHandlers(modules: ValidatorFnsModules, options: GossipHandlerOp
if (aggregatorTracker.shouldAggregate(subnet, indexedAttestation.data.slot)) {
const insertOutcome = chain.attestationPool.add(
committeeIndex,
participationIndex,
committeeValidatorIndex,
attestation,
attDataRootHex
);
Expand Down

0 comments on commit 1ea5f0f

Please sign in to comment.