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

feat: add logs for builder validator registrations #5986

Merged
merged 4 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ export function getValidatorApi({
},

async registerValidator(registrations) {
if (!chain.executionBuilder) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API will now throw an error if a validator client tries to register validators and the beacon node does not have --builder flag set. This is quite important in my opinion as current behavior is that this API just succeeds without actually registering validators with the builder. Without this check, the earliest we would detect a missing builder configuration on the beacon node would be when trying to produce a blinded block.

throw Error("Execution builder not enabled");
}

// should only send active or pending validator to builder
// Spec: https://ethereum.github.io/builder-specs/#/Builder/registerValidator
const headState = chain.getHeadState();
Expand All @@ -838,7 +842,12 @@ export function getValidatorApi({
);
});

return chain.executionBuilder?.registerValidator(filteredRegistrations);
await chain.executionBuilder.registerValidator(filteredRegistrations);

logger.debug("Forwarded validator registrations to connected builder", {
epoch: currentEpoch,
count: filteredRegistrations.length,
});
},
};
}
5 changes: 4 additions & 1 deletion packages/beacon-node/src/execution/builder/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export class ExecutionBuilderHttp implements IExecutionBuilder {
}

async registerValidator(registrations: bellatrix.SignedValidatorRegistrationV1[]): Promise<void> {
ApiError.assert(await this.api.registerValidator(registrations));
ApiError.assert(
await this.api.registerValidator(registrations),
"Failed to forward validator registrations to connected builder"
);
}

async getHeader(
Expand Down
3 changes: 2 additions & 1 deletion packages/validator/src/services/prepareBeaconProposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ export function pollBuilderValidatorRegistration(
})
);
ApiError.assert(await api.validator.registerValidator(registrations));
logger.info("Published validator registrations to builder network", {epoch, count: registrations.length});
} catch (e) {
logger.error("Failed to register validator registrations with builder", {epoch}, e as Error);
logger.error("Failed to publish validator registrations to builder network", {epoch}, e as Error);
}
}
}
Expand Down