6e3ca48cb9
## Issue Addressed NA ## Proposed Changes This PR addresses two things: 1. Allows the `ValidatorMonitor` to work with Altair states. 1. Optimizes `altair::process_epoch` (see [code](https://github.com/paulhauner/lighthouse/blob/participation-cache/consensus/state_processing/src/per_epoch_processing/altair/participation_cache.rs) for description) ## Breaking Changes The breaking changes in this PR revolve around one premise: *After the Altair fork, it's not longer possible (given only a `BeaconState`) to identify if a validator had *any* attestation included during some epoch. The best we can do is see if that validator made the "timely" source/target/head flags.* Whilst this seems annoying, it's not actually too bad. Finalization is based upon "timely target" attestations, so that's really the most important thing. Although there's *some* value in knowing if a validator had *any* attestation included, it's far more important to know about "timely target" participation, since this is what affects finality and justification. For simplicity and consistency, I've also removed the ability to determine if *any* attestation was included from metrics and API endpoints. Now, all Altair and non-Altair states will simply report on the head/target attestations. The following section details where we've removed fields and provides replacement values. ### Breaking Changes: Prometheus Metrics Some participation metrics have been removed and replaced. Some were removed since they are no longer relevant to Altair (e.g., total attesting balance) and others replaced with gwei values instead of pre-computed values. This provides more flexibility at display-time (e.g., Grafana). The following metrics were added as replacements: - `beacon_participation_prev_epoch_head_attesting_gwei_total` - `beacon_participation_prev_epoch_target_attesting_gwei_total` - `beacon_participation_prev_epoch_source_attesting_gwei_total` - `beacon_participation_prev_epoch_active_gwei_total` The following metrics were removed: - `beacon_participation_prev_epoch_attester` - instead use `beacon_participation_prev_epoch_source_attesting_gwei_total / beacon_participation_prev_epoch_active_gwei_total`. - `beacon_participation_prev_epoch_target_attester` - instead use `beacon_participation_prev_epoch_target_attesting_gwei_total / beacon_participation_prev_epoch_active_gwei_total`. - `beacon_participation_prev_epoch_head_attester` - instead use `beacon_participation_prev_epoch_head_attesting_gwei_total / beacon_participation_prev_epoch_active_gwei_total`. The `beacon_participation_prev_epoch_attester` endpoint has been removed. Users should instead use the pre-existing `beacon_participation_prev_epoch_target_attester`. ### Breaking Changes: HTTP API The `/lighthouse/validator_inclusion/{epoch}/{validator_id}` endpoint loses the following fields: - `current_epoch_attesting_gwei` (use `current_epoch_target_attesting_gwei` instead) - `previous_epoch_attesting_gwei` (use `previous_epoch_target_attesting_gwei` instead) The `/lighthouse/validator_inclusion/{epoch}/{validator_id}` endpoint lose the following fields: - `is_current_epoch_attester` (use `is_current_epoch_target_attester` instead) - `is_previous_epoch_attester` (use `is_previous_epoch_target_attester` instead) - `is_active_in_current_epoch` becomes `is_active_unslashed_in_current_epoch`. - `is_active_in_previous_epoch` becomes `is_active_unslashed_in_previous_epoch`. ## Additional Info NA ## TODO - [x] Deal with total balances - [x] Update validator_inclusion API - [ ] Ensure `beacon_participation_prev_epoch_target_attester` and `beacon_participation_prev_epoch_head_attester` work before Altair Co-authored-by: realbigsean <seananderson33@gmail.com>
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
// Clippy lint set-up (disabled in tests)
|
|
#![cfg_attr(
|
|
not(test),
|
|
deny(
|
|
clippy::integer_arithmetic,
|
|
clippy::disallowed_method,
|
|
clippy::indexing_slicing,
|
|
clippy::unwrap_used,
|
|
clippy::expect_used,
|
|
clippy::panic,
|
|
clippy::let_underscore_must_use
|
|
)
|
|
)]
|
|
|
|
#[macro_use]
|
|
mod macros;
|
|
mod metrics;
|
|
|
|
pub mod common;
|
|
pub mod genesis;
|
|
pub mod per_block_processing;
|
|
pub mod per_epoch_processing;
|
|
pub mod per_slot_processing;
|
|
pub mod state_advance;
|
|
pub mod upgrade;
|
|
pub mod verify_operation;
|
|
|
|
pub use genesis::{
|
|
eth2_genesis_time, initialize_beacon_state_from_eth1, is_valid_genesis_state,
|
|
process_activations,
|
|
};
|
|
pub use per_block_processing::{
|
|
block_signature_verifier, errors::BlockProcessingError, per_block_processing, signature_sets,
|
|
BlockSignatureStrategy, BlockSignatureVerifier, VerifySignatures,
|
|
};
|
|
pub use per_epoch_processing::{
|
|
errors::EpochProcessingError, process_epoch as per_epoch_processing,
|
|
};
|
|
pub use per_slot_processing::{per_slot_processing, Error as SlotProcessingError};
|
|
pub use verify_operation::{SigVerifiedOp, VerifyOperation};
|