Skip to content

Commit

Permalink
fix: set MAX_API_CLOCK_DISPARITY_SEC to 0.5s
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jul 24, 2023
1 parent 10c5c22 commit e332300
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion packages/validator/src/services/blockDuties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e332300

Please sign in to comment.