More logging for block build requests (#7264)

This commit is contained in:
Andrew Ashikhmin 2023-04-05 17:30:45 +02:00 committed by GitHub
parent 56bc16b7ab
commit 762b63eb14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View File

@ -152,13 +152,32 @@ func (e *EngineImpl) ForkchoiceUpdatedV2(ctx context.Context, forkChoiceState *F
return e.forkchoiceUpdated(2, ctx, forkChoiceState, payloadAttributes)
}
// Converts slice of pointers to slice of structs
func withdrawalValues(ptrs []*types.Withdrawal) []types.Withdrawal {
if ptrs == nil {
return nil
}
vals := make([]types.Withdrawal, 0, len(ptrs))
for _, w := range ptrs {
vals = append(vals, *w)
}
return vals
}
func (e *EngineImpl) forkchoiceUpdated(version uint32, ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
}
log.Debug("Received ForkchoiceUpdated", "version", version, "head", forkChoiceState.HeadHash, "safe", forkChoiceState.HeadHash, "finalized", forkChoiceState.FinalizedBlockHash,
"build", payloadAttributes != nil)
if payloadAttributes == nil {
log.Debug("Received ForkchoiceUpdated", "version", version,
"head", forkChoiceState.HeadHash, "safe", forkChoiceState.SafeBlockHash, "finalized", forkChoiceState.FinalizedBlockHash)
} else {
log.Info("Received ForkchoiceUpdated [build]", "version", version,
"head", forkChoiceState.HeadHash, "safe", forkChoiceState.SafeBlockHash, "finalized", forkChoiceState.FinalizedBlockHash,
"timestamp", payloadAttributes.Timestamp, "prevRandao", payloadAttributes.PrevRandao, "suggestedFeeRecipient", payloadAttributes.SuggestedFeeRecipient,
"withdrawals", withdrawalValues(payloadAttributes.Withdrawals))
}
var attributes *remote.EnginePayloadAttributes
if payloadAttributes != nil {

View File

@ -695,6 +695,7 @@ func (s *EthBackendServer) EngineForkChoiceUpdated(ctx context.Context, req *rem
// First check if we're already building a block with the requested parameters
if reflect.DeepEqual(s.lastParameters, &param) {
log.Info("[ForkChoiceUpdated] duplicate build request")
return &remote.EngineForkChoiceUpdatedResponse{
PayloadStatus: &remote.EnginePayloadStatus{
Status: remote.EngineStatus_VALID,
@ -712,7 +713,7 @@ func (s *EthBackendServer) EngineForkChoiceUpdated(ctx context.Context, req *rem
s.lastParameters = &param
s.builders[s.payloadId] = builder.NewBlockBuilder(s.builderFunc, &param)
log.Debug("BlockBuilder added", "payload", s.payloadId)
log.Info("[ForkChoiceUpdated] BlockBuilder added", "payload", s.payloadId)
return &remote.EngineForkChoiceUpdatedResponse{
PayloadStatus: &remote.EnginePayloadStatus{