Skip to content

Commit

Permalink
fix: add log for blockroot being signed for debugging proposal failur…
Browse files Browse the repository at this point in the history
…es (#6147)

* fix: add log for blockroot being signed for debugging proposal failures

* sligh improv

* add slot to log
  • Loading branch information
g11tech authored Dec 1, 2023
1 parent 5911739 commit 99a0caf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/beacon-node/src/api/impl/validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ export function getValidatorApi({
// winston logger doesn't like bigint
enginePayloadValue: `${enginePayloadValue}`,
builderPayloadValue: `${builderPayloadValue}`,
slot,
});
} else if (fullBlock && !blindedBlock) {
selectedSource = ProducedBlockSource.engine;
Expand Down
2 changes: 1 addition & 1 deletion packages/validator/src/services/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class BlockProposingService {
this.logger.debug("Produced block", {...debugLogCtx, ...blockContents.debugLogCtx});
this.metrics?.blocksProduced.inc();

const signedBlockPromise = this.validatorStore.signBlock(pubkey, blockContents.block, slot);
const signedBlockPromise = this.validatorStore.signBlock(pubkey, blockContents.block, slot, this.logger);
const signedBlobPromises =
blockContents.blobs !== null
? blockContents.blobs.map((blob) => this.validatorStore.signBlob(pubkey, blob, slot))
Expand Down
12 changes: 10 additions & 2 deletions packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {PubkeyHex} from "../types.js";
import {externalSignerPostSignature, SignableMessageType, SignableMessage} from "../util/externalSignerClient.js";
import {Metrics} from "../metrics.js";
import {isValidatePubkeyHex} from "../util/format.js";
import {LoggerVc} from "../util/logger.js";
import {IndicesService} from "./indices.js";
import {DoppelgangerService} from "./doppelgangerService.js";

Expand Down Expand Up @@ -351,7 +352,8 @@ export class ValidatorStore {
async signBlock(
pubkey: BLSPubkey,
blindedOrFull: allForks.FullOrBlindedBeaconBlock,
currentSlot: Slot
currentSlot: Slot,
logger?: LoggerVc
): Promise<allForks.FullOrBlindedSignedBeaconBlock> {
// Make sure the block slot is not higher than the current slot to avoid potential attacks.
if (blindedOrFull.slot > currentSlot) {
Expand All @@ -367,8 +369,14 @@ export class ValidatorStore {
// Don't use `computeSigningRoot()` here to compute the objectRoot in typesafe function blindedOrFullBlockHashTreeRoot()
const signingRoot = ssz.phase0.SigningData.hashTreeRoot({objectRoot: blockRoot, domain});

logger?.debug("Signing the block proposal", {
slot: signingSlot,
blockRoot: toHexString(blockRoot),
signingRoot: toHexString(signingRoot),
});

try {
await this.slashingProtection.checkAndInsertBlockProposal(pubkey, {slot: blindedOrFull.slot, signingRoot});
await this.slashingProtection.checkAndInsertBlockProposal(pubkey, {slot: signingSlot, signingRoot});
} catch (e) {
this.metrics?.slashingProtectionBlockError.inc();
throw e;
Expand Down

0 comments on commit 99a0caf

Please sign in to comment.