2022-03-09 00:42:05 +00:00
|
|
|
pub use lighthouse_metrics::*;
|
|
|
|
|
|
|
|
pub const HIT: &str = "hit";
|
|
|
|
pub const MISS: &str = "miss";
|
|
|
|
pub const GET_PAYLOAD: &str = "get_payload";
|
2022-07-01 01:15:19 +00:00
|
|
|
pub const GET_BLINDED_PAYLOAD: &str = "get_blinded_payload";
|
2022-03-09 00:42:05 +00:00
|
|
|
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";
|
|
|
|
|
|
|
|
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(
|
|
|
|
"execution_layer_request_times",
|
|
|
|
"Duration of calls to ELs",
|
|
|
|
&["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"]
|
|
|
|
);
|
Separate execution payloads in the DB (#3157)
## Proposed Changes
Reduce post-merge disk usage by not storing finalized execution payloads in Lighthouse's database.
:warning: **This is achieved in a backwards-incompatible way for networks that have already merged** :warning:. Kiln users and shadow fork enjoyers will be unable to downgrade after running the code from this PR. The upgrade migration may take several minutes to run, and can't be aborted after it begins.
The main changes are:
- New column in the database called `ExecPayload`, keyed by beacon block root.
- The `BeaconBlock` column now stores blinded blocks only.
- Lots of places that previously used full blocks now use blinded blocks, e.g. analytics APIs, block replay in the DB, etc.
- On finalization:
- `prune_abanonded_forks` deletes non-canonical payloads whilst deleting non-canonical blocks.
- `migrate_db` deletes finalized canonical payloads whilst deleting finalized states.
- Conversions between blinded and full blocks are implemented in a compositional way, duplicating some work from Sean's PR #3134.
- The execution layer has a new `get_payload_by_block_hash` method that reconstructs a payload using the EE's `eth_getBlockByHash` call.
- I've tested manually that it works on Kiln, using Geth and Nethermind.
- This isn't necessarily the most efficient method, and new engine APIs are being discussed to improve this: https://github.com/ethereum/execution-apis/pull/146.
- We're depending on the `ethers` master branch, due to lots of recent changes. We're also using a workaround for https://github.com/gakonst/ethers-rs/issues/1134.
- Payload reconstruction is used in the HTTP API via `BeaconChain::get_block`, which is now `async`. Due to the `async` fn, the `blocking_json` wrapper has been removed.
- Payload reconstruction is used in network RPC to serve blocks-by-{root,range} responses. Here the `async` adjustment is messier, although I think I've managed to come up with a reasonable compromise: the handlers take the `SendOnDrop` by value so that they can drop it on _task completion_ (after the `fn` returns). Still, this is introducing disk reads onto core executor threads, which may have a negative performance impact (thoughts appreciated).
## Additional Info
- [x] For performance it would be great to remove the cloning of full blocks when converting them to blinded blocks to write to disk. I'm going to experiment with a `put_block` API that takes the block by value, breaks it into a blinded block and a payload, stores the blinded block, and then re-assembles the full block for the caller.
- [x] We should measure the latency of blocks-by-root and blocks-by-range responses.
- [x] We should add integration tests that stress the payload reconstruction (basic tests done, issue for more extensive tests: https://github.com/sigp/lighthouse/issues/3159)
- [x] We should (manually) test the schema v9 migration from several prior versions, particularly as blocks have changed on disk and some migrations rely on being able to load blocks.
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2022-05-12 00:42:17 +00:00
|
|
|
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"
|
|
|
|
);
|
2022-08-19 04:27:23 +00:00
|
|
|
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"]
|
|
|
|
);
|
2022-03-09 00:42:05 +00:00
|
|
|
}
|