Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove duplicate validator registration calls #5993

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 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 All @@ -103,17 +100,13 @@ export function pollBuilderValidatorRegistration(
})
);
ApiError.assert(await api.validator.registerValidator(registrations));
logger.info("Published validator registrations to builder network", {epoch, count: registrations.length});
logger.info("Published validator registrations to builder", {epoch, count: registrations.length});
} catch (e) {
logger.error("Failed to publish validator registrations to builder network", {epoch}, e as Error);
logger.error("Failed to publish validator registrations to builder", {epoch}, e as Error);
}
}
}
}

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());
}