diff --git a/beacon_chain/gossip_processing/eth2_processor.nim b/beacon_chain/gossip_processing/eth2_processor.nim index bd8c57d74..e1a696ecb 100644 --- a/beacon_chain/gossip_processing/eth2_processor.nim +++ b/beacon_chain/gossip_processing/eth2_processor.nim @@ -188,11 +188,11 @@ proc checkForPotentialDoppelganger( proc attestationValidator*( self: ref Eth2Processor, attestation: Attestation, - committeeIndex: uint64, + attestation_subnet: uint64, checksExpensive: bool = true): Future[ValidationResult] {.async.} = logScope: attestation = shortLog(attestation) - committeeIndex + attestation_subnet let wallTime = self.getWallTime() @@ -211,7 +211,7 @@ proc attestationValidator*( # Now proceed to validation let v = await self.attestationPool.validateAttestation( self.batchCrypto, - attestation, wallTime, committeeIndex, checksExpensive) + attestation, wallTime, attestation_subnet, checksExpensive) if v.isErr(): debug "Dropping attestation", err = v.error() return v.error[0] diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index 33d2a3f05..564cdff74 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -134,16 +134,16 @@ func check_aggregation_count( func check_attestation_subnet( epochRef: EpochRef, attestation: Attestation, - topicCommitteeIndex: uint64): Result[void, (ValidationResult, cstring)] = + attestation_subnet: uint64): Result[void, (ValidationResult, cstring)] = let expectedSubnet = compute_subnet_for_attestation( get_committee_count_per_slot(epochRef), attestation.data.slot, attestation.data.index.CommitteeIndex) - if expectedSubnet != topicCommitteeIndex: + if expectedSubnet != attestation_subnet: return err((ValidationResult.Reject, cstring( - "Attestation's committee index not for the correct subnet"))) + "Attestation not on the correct subnet"))) ok() @@ -157,7 +157,7 @@ proc validateAttestation*( batchCrypto: ref BatchCrypto, attestation: Attestation, wallTime: BeaconTime, - topicCommitteeIndex: uint64, checksExpensive: bool): + attestation_subnet: uint64, checksExpensive: bool): Future[Result[tuple[attestingIndices: seq[ValidatorIndex], sig: CookedSig], (ValidationResult, cstring)]] {.async.} = # Some of the checks below have been reordered compared to the spec, to @@ -227,7 +227,7 @@ proc validateAttestation*( # attestation.data.target.epoch), which may be pre-computed along with the # committee information for the signature check. block: - let v = check_attestation_subnet(epochRef, attestation, topicCommitteeIndex) # [REJECT] + let v = check_attestation_subnet(epochRef, attestation, attestation_subnet) # [REJECT] if v.isErr(): return err(v.error) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 425e3d7c4..450a2836a 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1204,12 +1204,12 @@ proc installMessageValidators(node: BeaconNode) = # subnets are subscribed to during any given epoch. for it in 0'u64 ..< ATTESTATION_SUBNET_COUNT.uint64: closureScope: - let ci = it + let attestation_subnet = it node.network.addAsyncValidator( - getAttestationTopic(node.forkDigest, ci), + getAttestationTopic(node.forkDigest, attestation_subnet), # This proc needs to be within closureScope; don't lift out of loop. proc(attestation: Attestation): Future[ValidationResult] = - node.processor.attestationValidator(attestation, ci)) + node.processor.attestationValidator(attestation, attestation_subnet)) node.network.addAsyncValidator( getAggregateAndProofsTopic(node.forkDigest), diff --git a/beacon_chain/rpc/validator_api.nim b/beacon_chain/rpc/validator_api.nim index 6e1ae71d4..30508e8ae 100644 --- a/beacon_chain/rpc/validator_api.nim +++ b/beacon_chain/rpc/validator_api.nim @@ -122,7 +122,7 @@ proc installValidatorApiHandlers*(rpcServer: RpcServer, node: BeaconNode) {. validator_pubkey: ValidatorPubKey, slot_signature: ValidatorSig) -> bool: debug "post_v1_validator_beacon_committee_subscriptions", committee_index, slot - if committee_index.uint64 >= ATTESTATION_SUBNET_COUNT.uint64: + if committee_index.uint64 >= MAX_COMMITTEES_PER_SLOT.uint64: raise newException(CatchableError, "Invalid committee index") diff --git a/beacon_chain/rpc/validator_rest_api.nim b/beacon_chain/rpc/validator_rest_api.nim index 93a705b71..b2f795bd6 100644 --- a/beacon_chain/rpc/validator_rest_api.nim +++ b/beacon_chain/rpc/validator_rest_api.nim @@ -355,7 +355,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) = return RestApiResponse.jsonError(Http503, BeaconNodeInSyncError) for request in requests: - if uint64(request.committee_index) >= uint64(ATTESTATION_SUBNET_COUNT): + if uint64(request.committee_index) >= uint64(MAX_COMMITTEES_PER_SLOT): return RestApiResponse.jsonError(Http400, InvalidCommitteeIndexValueError) let validator_pubkey =