Skip to content

Commit

Permalink
fix: remove duplicate validator registration calls
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Sep 29, 2023
1 parent 1397834 commit 71b9979
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/validator/src/services/prepareBeaconProposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@ export function pollPrepareBeaconProposer(
})
);
ApiError.assert(await api.validator.prepareBeaconProposer(proposers));
logger.debug("Registered proposers with beacon node", {epoch, count: proposers.length});
} catch (e) {
logger.error("Failed to register proposers with beacon", {epoch}, e as Error);
logger.error("Failed to register proposers with beacon node", {epoch}, e as Error);
}
}
}

clock.runEveryEpoch(prepareBeaconProposer);
// Since the registration of the validators to the BN as well as to builder (if enabled)
// is scheduled every epoch, there could be some time since the first scheduled run,
// so fire one registration right away as well
void prepareBeaconProposer(clock.getCurrentEpoch());
}

/**
Expand All @@ -81,7 +78,7 @@ export function pollBuilderValidatorRegistration(
// registerValidator is not as time sensitive as attesting.
// Poll indices first, then call api.validator.registerValidator once
await validatorStore.pollValidatorIndices().catch((e: Error) => {
logger.error("Error on pollValidatorIndices for prepareBeaconProposer", {epoch}, e);
logger.error("Error on pollValidatorIndices for registerValidator", {epoch}, e);
});
const pubkeyHexes = validatorStore
.getAllLocalIndices()
Expand Down Expand Up @@ -112,8 +109,4 @@ export function pollBuilderValidatorRegistration(
}

clock.runEveryEpoch(registerValidator);
// Since the registration of the validators to the BN as well as to builder (if enabled)
// is scheduled every epoch, there could be some time since the first scheduled run,
// so fire one registration right away as well
void registerValidator(clock.getCurrentEpoch());
}

0 comments on commit 71b9979

Please sign in to comment.