From 5d0e16d9782090d591200afa50ffeea8bd40a01f Mon Sep 17 00:00:00 2001 From: cheatfate Date: Wed, 24 Aug 2022 17:34:57 +0300 Subject: [PATCH] Fix all the compilation issues. --- beacon_chain/validator_client/api.nim | 2 +- beacon_chain/validator_client/attestation_service.nim | 10 ++++++---- beacon_chain/validator_client/block_service.nim | 5 +++-- beacon_chain/validator_client/duties_service.nim | 6 ++++-- .../validator_client/sync_committee_service.nim | 8 +++++--- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/beacon_chain/validator_client/api.nim b/beacon_chain/validator_client/api.nim index 1c71c7fbc..ccfb75e65 100644 --- a/beacon_chain/validator_client/api.nim +++ b/beacon_chain/validator_client/api.nim @@ -1650,7 +1650,7 @@ proc publishBlock*( case strategy of ApiStrategyKind.First, ApiStrategyKind.Best: - let res = + let res = block: vc.firstSuccessParallel(RestPlainResponse, SlotDuration, {BeaconNodeRole.BlockProposalPublish}): case data.kind diff --git a/beacon_chain/validator_client/attestation_service.nim b/beacon_chain/validator_client/attestation_service.nim index 8e86d8a5a..b9e9a1bac 100644 --- a/beacon_chain/validator_client/attestation_service.nim +++ b/beacon_chain/validator_client/attestation_service.nim @@ -89,7 +89,7 @@ proc serveAttestation(service: AttestationServiceRef, adata: AttestationData, let res = try: - await vc.submitPoolAttestations(@[attestation]) + await vc.submitPoolAttestations(@[attestation], ApiStrategyKind.First) except ValidatorApiError: error "Unable to publish attestation", attestation = shortLog(attestation), @@ -175,7 +175,7 @@ proc serveAggregateAndProof*(service: AttestationServiceRef, let res = try: - await vc.publishAggregateAndProofs(@[signedProof]) + await vc.publishAggregateAndProofs(@[signedProof], ApiStrategyKind.First) except ValidatorApiError: error "Unable to publish aggregated attestation", attestation = shortLog(signedProof.message.aggregate), @@ -215,7 +215,8 @@ proc produceAndPublishAttestations*(service: AttestationServiceRef, # This call could raise ValidatorApiError, but it is handled in # publishAttestationsAndAggregates(). - let ad = await vc.produceAttestationData(slot, committee_index) + let ad = await vc.produceAttestationData(slot, committee_index, + ApiStrategyKind.Best) let pendingAttestations = block: @@ -298,7 +299,8 @@ proc produceAndPublishAggregates(service: AttestationServiceRef, if len(aggregateItems) > 0: let aggAttestation = try: - await vc.getAggregatedAttestation(slot, attestationRoot) + await vc.getAggregatedAttestation(slot, attestationRoot, + ApiStrategyKind.Best) except ValidatorApiError: error "Unable to get aggregated attestation data", slot = slot, attestation_root = shortLog(attestationRoot) diff --git a/beacon_chain/validator_client/block_service.nim b/beacon_chain/validator_client/block_service.nim index 26cc3c6e8..5986bbb37 100644 --- a/beacon_chain/validator_client/block_service.nim +++ b/beacon_chain/validator_client/block_service.nim @@ -55,7 +55,8 @@ proc publishBlock(vc: ValidatorClientRef, currentSlot, slot: Slot, let beaconBlock = try: - await vc.produceBlockV2(slot, randaoReveal, graffiti) + await vc.produceBlockV2(slot, randaoReveal, graffiti, + ApiStrategyKind.Best) except ValidatorApiError: error "Unable to retrieve block data", slot = slot, wall_slot = currentSlot, validator = shortLog(validator) @@ -103,7 +104,7 @@ proc publishBlock(vc: ValidatorClientRef, currentSlot, slot: Slot, try: let signedBlock = ForkedSignedBeaconBlock.init(beaconBlock, blockRoot, signature) - await vc.publishBlock(signedBlock) + await vc.publishBlock(signedBlock, ApiStrategyKind.First) except ValidatorApiError: error "Unable to publish block", blockRoot = shortLog(blockRoot), diff --git a/beacon_chain/validator_client/duties_service.nim b/beacon_chain/validator_client/duties_service.nim index 88bf48bb2..977bc6947 100644 --- a/beacon_chain/validator_client/duties_service.nim +++ b/beacon_chain/validator_client/duties_service.nim @@ -390,7 +390,8 @@ proc pollForAttesterDuties*(vc: ValidatorClientRef) {.async.} = res if len(subscriptions) > 0: - let res = await vc.prepareBeaconCommitteeSubnet(subscriptions) + let res = await vc.prepareBeaconCommitteeSubnet(subscriptions, + ApiStrategyKind.First) if not(res): error "Failed to subscribe validators" @@ -434,7 +435,8 @@ proc pollForSyncCommitteeDuties* (vc: ValidatorClientRef) {.async.} = res.add(sub) res if len(subscriptions) > 0: - let res = await vc.prepareSyncCommitteeSubnets(subscriptions) + let res = await vc.prepareSyncCommitteeSubnets(subscriptions, + ApiStrategyKind.First) if not(res): error "Failed to subscribe validators" diff --git a/beacon_chain/validator_client/sync_committee_service.nim b/beacon_chain/validator_client/sync_committee_service.nim index 05b11dac7..3bad3d05e 100644 --- a/beacon_chain/validator_client/sync_committee_service.nim +++ b/beacon_chain/validator_client/sync_committee_service.nim @@ -63,7 +63,7 @@ proc serveSyncCommitteeMessage*(service: SyncCommitteeServiceRef, let res = try: - await vc.submitPoolSyncCommitteeSignature(message) + await vc.submitPoolSyncCommitteeSignature(message, ApiStrategyKind.First) except ValidatorApiError: error "Unable to publish sync committee message", message = shortLog(message), @@ -177,7 +177,8 @@ proc serveContributionAndProof*(service: SyncCommitteeServiceRef, let res = try: - await vc.publishContributionAndProofs(@[restSignedProof]) + await vc.publishContributionAndProofs(@[restSignedProof], + ApiStrategyKind.First) except ValidatorApiError as err: error "Unable to publish sync contribution", contribution = shortLog(proof.contribution), @@ -240,7 +241,8 @@ proc produceAndPublishContributions(service: SyncCommitteeServiceRef, try: await vc.produceSyncCommitteeContribution(slot, item.subcommitteeIdx, - beaconBlockRoot) + beaconBlockRoot, + ApiStrategyKind.Best) except ValidatorApiError: error "Unable to get sync message contribution data", slot = slot, beaconBlockRoot = shortLog(beaconBlockRoot)