Skip to content

Move payload validation metric recording to EngineValidator #18014

Description

@Rjected

Describe the feature

This no longer measures anything

self.metrics
.block_validation
.record_payload_validation(validation_start.elapsed().as_secs_f64());

This should be moved so that it records the part of the EngineValidator that does block validation:

let block = self.convert_to_block(input)?;
// A helper macro that returns the block in case there was an error
macro_rules! ensure_ok {
($expr:expr) => {
match $expr {
Ok(val) => val,
Err(e) => return Err(InsertBlockError::new(block.into_sealed_block(), e.into()).into()),
}
};
}
trace!(target: "engine::tree", block=?block_num_hash, "Validating block consensus");
// validate block consensus rules
ensure_ok!(self.validate_block_inner(&block));
// now validate against the parent
if let Err(e) =
self.consensus.validate_header_against_parent(block.sealed_header(), &parent_block)
{
warn!(target: "engine::tree", ?block, "Failed to validate header {} against parent: {e}", block.hash());
return Err(InsertBlockError::new(block.into_sealed_block(), e.into()).into())
}
if let Err(err) = self.consensus.validate_block_post_execution(&block, &output) {
// call post-block hook
self.on_invalid_block(&parent_block, &block, &output, None, ctx.state_mut());
return Err(InsertBlockError::new(block.into_sealed_block(), err.into()).into())
}
let hashed_state = self.provider.hashed_post_state(&output.state);
if let Err(err) =
self.validator.validate_block_post_execution_with_hashed_state(&hashed_state, &block)
{
// call post-block hook
self.on_invalid_block(&parent_block, &block, &output, None, ctx.state_mut());
return Err(InsertBlockError::new(block.into_sealed_block(), err.into()).into())
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions