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

chore: add beacon node info log when publishing block #6661

Merged
merged 2 commits into from
Apr 15, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function getBeaconBlockApi({
const bodyRoot = toHex(chain.config.getForkTypes(slot).BeaconBlockBody.hashTreeRoot(signedBlock.message.body));
const blockLocallyProduced =
chain.producedBlockRoot.has(blockRoot) || chain.producedBlindedBlockRoot.has(blockRoot);
const valLogMeta = {broadcastValidation, blockRoot, bodyRoot, blockLocallyProduced, slot};
const valLogMeta = {slot, blockRoot, bodyRoot, broadcastValidation, blockLocallyProduced};

switch (broadcastValidation) {
case routes.beacon.BroadcastValidation.gossip: {
Expand Down Expand Up @@ -183,6 +183,7 @@ export function getBeaconBlockApi({

// TODO: Validate block
metrics?.registerBeaconBlock(OpSource.api, seenTimestampSec, blockForImport.block.message);
chain.logger.info("Publishing block", valLogMeta);
const publishPromises = [
// Send the block, regardless of whether or not it is valid. The API
// specification is very clear that this is the desired behaviour.
Expand Down Expand Up @@ -226,26 +227,26 @@ export function getBeaconBlockApi({
const executionPayload = chain.producedBlockRoot.get(blockRoot);
if (executionPayload !== undefined) {
const source = ProducedBlockSource.engine;
chain.logger.debug("Reconstructing signedBlockOrContents", {blockRoot, slot, source});
chain.logger.debug("Reconstructing signedBlockOrContents", {slot, blockRoot, source});

const contents = executionPayload
? chain.producedContentsCache.get(toHex(executionPayload.blockHash)) ?? null
: null;
const signedBlockOrContents = reconstructFullBlockOrContents(signedBlindedBlock, {executionPayload, contents});

chain.logger.info("Publishing assembled block", {blockRoot, slot, source});
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
return publishBlock(signedBlockOrContents, opts);
} else {
const source = ProducedBlockSource.builder;
chain.logger.debug("Reconstructing signedBlockOrContents", {blockRoot, slot, source});
chain.logger.debug("Reconstructing signedBlockOrContents", {slot, blockRoot, source});

const signedBlockOrContents = await reconstructBuilderBlockOrContents(chain, signedBlindedBlock);

// the full block is published by relay and it's possible that the block is already known to us
// by gossip
//
// see: https://github.com/ChainSafe/lodestar/issues/5404
chain.logger.info("Publishing assembled block", {blockRoot, slot, source});
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
return publishBlock(signedBlockOrContents, {...opts, ignoreIfKnown: true});
}
};
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,9 @@ export function getValidatorApi({
}

const loggerContext = {
slot,
fork,
builderSelection,
slot,
isBuilderEnabled,
isEngineEnabled,
strictFeeRecipientCheck,
Expand Down