a2969ba7de
## Issue Addressed NA ## Proposed Changes This PR sets out to improve the logging/metrics experience when interacting with the builder. Namely, it: - Adds/changes metrics (see "Metrics Changes" section). - Adds new logs which show the duration of requests to the builder/local EL. - Refactors existing logs for consistency and so that the `parent_hash` is include in all relevant logs (we can grep for this field when trying to trace the flow of block production). Additionally, when I was implementing this PR I noticed that we skip some verification of the builder payload in the scenario where the builder return `Ok` but the local EL returns with `Err`. Namely, we were skipping the bid signature and other values like parent hash and prev randao. In this PR I've changed it so we *always* check these values and reject the bid if they're incorrect. With these changes, we'll sometimes choose to skip a proposal rather than propose something invalid -- that's the only side-effect to the changes that I can see. ## Metrics Changes - Changed: `execution_layer_request_times`: - `method = "get_blinded_payload_local"`: time taken to get a payload from a local EE. - `method = "get_blinded_payload_builder"`: time taken to get a blinded payload from a builder. - `method = "post_blinded_payload_builder"`: time taken to get a builder to reveal a payload they've previously supplied us. - `execution_layer_get_payload_outcome` - `outcome = "success"`: we successfully produced a payload from a builder or local EE. - `outcome = "failure"`: we were unable to get a payload from a builder or local EE. - New: `execution_layer_builder_reveal_payload_outcome` - `outcome = "success"`: a builder revealed a payload from a signed, blinded block. - `outcome = "failure"`: the builder did not reveal the payload. - New: `execution_layer_get_payload_source` - `type = "builder"`: we used a payload from a builder to produce a block. - `type = "local"`: we used a payload from a local EE to produce a block. - New: `execution_layer_get_payload_builder_rejections` has a `reason` field to describe why we rejected a payload from a builder. - New: `execution_layer_payload_bids` tracks the bid (in gwei) from the builder or local EE (local EE not yet supported, waiting on EEs to expose the value). Can only record values that fit inside an i64 (roughly 9 million ETH). ## Additional Info NA
79 lines
3.8 KiB
Rust
79 lines
3.8 KiB
Rust
pub use lighthouse_metrics::*;
|
|
|
|
pub const HIT: &str = "hit";
|
|
pub const MISS: &str = "miss";
|
|
pub const GET_PAYLOAD: &str = "get_payload";
|
|
pub const GET_BLINDED_PAYLOAD: &str = "get_blinded_payload";
|
|
pub const GET_BLINDED_PAYLOAD_LOCAL: &str = "get_blinded_payload_local";
|
|
pub const GET_BLINDED_PAYLOAD_BUILDER: &str = "get_blinded_payload_builder";
|
|
pub const POST_BLINDED_PAYLOAD_BUILDER: &str = "post_blinded_payload_builder";
|
|
pub const NEW_PAYLOAD: &str = "new_payload";
|
|
pub const FORKCHOICE_UPDATED: &str = "forkchoice_updated";
|
|
pub const GET_TERMINAL_POW_BLOCK_HASH: &str = "get_terminal_pow_block_hash";
|
|
pub const IS_VALID_TERMINAL_POW_BLOCK_HASH: &str = "is_valid_terminal_pow_block_hash";
|
|
pub const LOCAL: &str = "local";
|
|
pub const BUILDER: &str = "builder";
|
|
pub const SUCCESS: &str = "success";
|
|
pub const FAILURE: &str = "failure";
|
|
|
|
lazy_static::lazy_static! {
|
|
pub static ref EXECUTION_LAYER_PROPOSER_INSERTED: Result<IntCounter> = try_create_int_counter(
|
|
"execution_layer_proposer_inserted",
|
|
"Count of times a new proposer is known",
|
|
);
|
|
pub static ref EXECUTION_LAYER_PROPOSER_DATA_UPDATED: Result<IntCounter> = try_create_int_counter(
|
|
"execution_layer_proposer_data_updated",
|
|
"Count of times new proposer data is supplied",
|
|
);
|
|
pub static ref EXECUTION_LAYER_REQUEST_TIMES: Result<HistogramVec> =
|
|
try_create_histogram_vec_with_buckets(
|
|
"execution_layer_request_times",
|
|
"Duration of calls to ELs",
|
|
decimal_buckets(-2, 1),
|
|
&["method"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_PAYLOAD_ATTRIBUTES_LOOKAHEAD: Result<Histogram> = try_create_histogram(
|
|
"execution_layer_payload_attributes_lookahead",
|
|
"Duration between an fcU call with PayloadAttributes and when the block should be produced",
|
|
);
|
|
pub static ref EXECUTION_LAYER_PRE_PREPARED_PAYLOAD_ID: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_pre_prepared_payload_id",
|
|
"Indicates hits or misses for already having prepared a payload id before payload production",
|
|
&["event"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_GET_PAYLOAD_BY_BLOCK_HASH: Result<Histogram> = try_create_histogram(
|
|
"execution_layer_get_payload_by_block_hash_time",
|
|
"Time to reconstruct a payload from the EE using eth_getBlockByHash"
|
|
);
|
|
pub static ref EXECUTION_LAYER_PAYLOAD_STATUS: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_payload_status",
|
|
"Indicates the payload status returned for a particular method",
|
|
&["method", "status"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_GET_PAYLOAD_OUTCOME: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_get_payload_outcome",
|
|
"The success/failure outcomes from calling get_payload",
|
|
&["outcome"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_BUILDER_REVEAL_PAYLOAD_OUTCOME: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_builder_reveal_payload_outcome",
|
|
"The success/failure outcomes from a builder un-blinding a payload",
|
|
&["outcome"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_GET_PAYLOAD_SOURCE: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_get_payload_source",
|
|
"The source of each payload returned from get_payload",
|
|
&["source"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_GET_PAYLOAD_BUILDER_REJECTIONS: Result<IntCounterVec> = try_create_int_counter_vec(
|
|
"execution_layer_get_payload_builder_rejections",
|
|
"The reasons why a payload from a builder was rejected",
|
|
&["reason"]
|
|
);
|
|
pub static ref EXECUTION_LAYER_PAYLOAD_BIDS: Result<IntGaugeVec> = try_create_int_gauge_vec(
|
|
"execution_layer_payload_bids",
|
|
"The gwei bid value of payloads received by local EEs or builders. Only shows values up to i64::max_value.",
|
|
&["source"]
|
|
);
|
|
}
|