From 1ea5f0fd36fac1deed23f0573320c241b9999890 Mon Sep 17 00:00:00 2001 From: Tuyen Nguyen Date: Fri, 6 Dec 2024 15:59:01 +0700 Subject: [PATCH] chore: refactor to committeeValidatorIndex --- packages/beacon-node/src/api/impl/beacon/pool/index.ts | 4 ++-- packages/beacon-node/src/chain/opPools/attestationPool.ts | 4 ++-- packages/beacon-node/src/chain/validation/attestation.ts | 4 ++-- packages/beacon-node/src/network/processor/gossipHandlers.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/beacon-node/src/api/impl/beacon/pool/index.ts b/packages/beacon-node/src/api/impl/beacon/pool/index.ts index 36f22badc0ad..e82432c81707 100644 --- a/packages/beacon-node/src/api/impl/beacon/pool/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/pool/index.ts @@ -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 ); diff --git a/packages/beacon-node/src/chain/opPools/attestationPool.ts b/packages/beacon-node/src/chain/opPools/attestationPool.ts index 3bf3a78a21c6..b52853195cea 100644 --- a/packages/beacon-node/src/chain/opPools/attestationPool.ts +++ b/packages/beacon-node/src/chain/opPools/attestationPool.ts @@ -107,7 +107,7 @@ export class AttestationPool { */ add( committeeIndex: CommitteeIndex, - participationIndex: number, + committeeValidatorIndex: number, attestation: Attestation, attDataRootHex: RootHex ): InsertOutcome { @@ -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)); diff --git a/packages/beacon-node/src/chain/validation/attestation.ts b/packages/beacon-node/src/chain/validation/attestation.ts index e1818b276af5..8fb51a13b6e4 100644 --- a/packages/beacon-node/src/chain/validation/attestation.ts +++ b/packages/beacon-node/src/chain/validation/attestation.ts @@ -61,7 +61,7 @@ export type AttestationValidationResult = { subnet: number; attDataRootHex: RootHex; committeeIndex: CommitteeIndex; - participationIndex: number; + committeeValidatorIndex: number; }; export type AttestationOrBytes = ApiAttestation | GossipAttestation; @@ -506,7 +506,7 @@ async function validateAttestationNoSignatureCheck( signatureSet, validatorIndex, committeeIndex, - participationIndex: bitIndex, + committeeValidatorIndex: bitIndex, }; } diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index 4063dcdcf135..6fce64866344 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -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); @@ -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 );