From e33230035862ee18e8634ca176d2ea7e087b70a8 Mon Sep 17 00:00:00 2001 From: Tuyen Nguyen Date: Mon, 24 Jul 2023 20:56:44 +0700 Subject: [PATCH] fix: set MAX_API_CLOCK_DISPARITY_SEC to 0.5s --- packages/beacon-node/src/api/impl/validator/index.ts | 3 ++- packages/validator/src/services/blockDuties.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index d988af66a691..99dd03763ab4 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -67,9 +67,10 @@ export function getValidatorApi({ /** * Validator clock may be advanced from beacon's clock. If the validator requests a resource in a * future slot, wait some time instead of rejecting the request because it's in the future. + * This value is the same to MAXIMUM_GOSSIP_CLOCK_DISPARITY_SEC. * For very fast networks, reduce clock disparity to half a slot. */ - const MAX_API_CLOCK_DISPARITY_SEC = Math.min(1, config.SECONDS_PER_SLOT / 2); + const MAX_API_CLOCK_DISPARITY_SEC = Math.min(0.5, config.SECONDS_PER_SLOT / 2); const MAX_API_CLOCK_DISPARITY_MS = MAX_API_CLOCK_DISPARITY_SEC * 1000; /** Compute and cache the genesis block root */ diff --git a/packages/validator/src/services/blockDuties.ts b/packages/validator/src/services/blockDuties.ts index a1a364712fdf..a6bf0de3088f 100644 --- a/packages/validator/src/services/blockDuties.ts +++ b/packages/validator/src/services/blockDuties.ts @@ -132,7 +132,7 @@ export class BlockDutiesService { const nextEpoch = computeEpochAtSlot(currentSlot) + 1; const isLastSlotEpoch = computeStartSlotAtEpoch(nextEpoch) === currentSlot + 1; if (isLastSlotEpoch) { - // do this at the end of the function would be too late + // no need to await for other steps, just poll proposers for next epoch void this.pollBeaconProposersNextEpoch(currentSlot, nextEpoch, signal); }