mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 08:52:54 +00:00
Implement tree states & hierarchical state DB
This commit is contained in:
@@ -360,20 +360,20 @@ pub enum ValidatorStatus {
|
||||
impl ValidatorStatus {
|
||||
pub fn from_validator(validator: &Validator, epoch: Epoch, far_future_epoch: Epoch) -> Self {
|
||||
if validator.is_withdrawable_at(epoch) {
|
||||
if validator.effective_balance == 0 {
|
||||
if validator.effective_balance() == 0 {
|
||||
ValidatorStatus::WithdrawalDone
|
||||
} else {
|
||||
ValidatorStatus::WithdrawalPossible
|
||||
}
|
||||
} else if validator.is_exited_at(epoch) && epoch < validator.withdrawable_epoch {
|
||||
if validator.slashed {
|
||||
} else if validator.is_exited_at(epoch) && epoch < validator.withdrawable_epoch() {
|
||||
if validator.slashed() {
|
||||
ValidatorStatus::ExitedSlashed
|
||||
} else {
|
||||
ValidatorStatus::ExitedUnslashed
|
||||
}
|
||||
} else if validator.is_active_at(epoch) {
|
||||
if validator.exit_epoch < far_future_epoch {
|
||||
if validator.slashed {
|
||||
if validator.exit_epoch() < far_future_epoch {
|
||||
if validator.slashed() {
|
||||
ValidatorStatus::ActiveSlashed
|
||||
} else {
|
||||
ValidatorStatus::ActiveExiting
|
||||
@@ -384,7 +384,7 @@ impl ValidatorStatus {
|
||||
// `pending` statuses are specified as validators where `validator.activation_epoch > current_epoch`.
|
||||
// If this code is reached, this criteria must have been met because `validator.is_active_at(epoch)`,
|
||||
// `validator.is_exited_at(epoch)`, and `validator.is_withdrawable_at(epoch)` all returned false.
|
||||
} else if validator.activation_eligibility_epoch == far_future_epoch {
|
||||
} else if validator.activation_eligibility_epoch() == far_future_epoch {
|
||||
ValidatorStatus::PendingInitialized
|
||||
} else {
|
||||
ValidatorStatus::PendingQueued
|
||||
@@ -912,6 +912,7 @@ pub struct SseLateHead {
|
||||
pub proposer_graffiti: String,
|
||||
pub block_delay: Duration,
|
||||
pub observed_delay: Option<Duration>,
|
||||
pub attestable_delay: Option<Duration>,
|
||||
pub imported_delay: Option<Duration>,
|
||||
pub set_as_head_delay: Option<Duration>,
|
||||
pub execution_optimistic: bool,
|
||||
|
||||
@@ -38,7 +38,7 @@ mod test {
|
||||
#[test]
|
||||
fn version_formatting() {
|
||||
let re =
|
||||
Regex::new(r"^Lighthouse/v[0-9]+\.[0-9]+\.[0-9]+(-rc.[0-9])?(-[[:xdigit:]]{7})?\+?$")
|
||||
Regex::new(r"^Lighthouse/v[0-9]+\.[0-9]+\.[0-9]+(-tree.[0-9])?(-[[:xdigit:]]{7})?\+?$")
|
||||
.unwrap();
|
||||
assert!(
|
||||
re.is_match(VERSION),
|
||||
|
||||
@@ -12,3 +12,4 @@ exit-future = "0.2.0"
|
||||
lazy_static = "1.4.0"
|
||||
lighthouse_metrics = { path = "../lighthouse_metrics" }
|
||||
sloggers = { version = "2.1.1", features = ["json"] }
|
||||
logging = { path = "../logging" }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::TaskExecutor;
|
||||
use logging::test_logger;
|
||||
use slog::Logger;
|
||||
use sloggers::{null::NullLoggerBuilder, Build};
|
||||
use std::sync::Arc;
|
||||
@@ -26,7 +27,7 @@ impl Default for TestRuntime {
|
||||
fn default() -> Self {
|
||||
let (runtime_shutdown, exit) = exit_future::signal();
|
||||
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
|
||||
let log = null_logger().unwrap();
|
||||
let log = test_logger();
|
||||
|
||||
let (runtime, handle) = if let Ok(handle) = runtime::Handle::try_current() {
|
||||
(None, handle)
|
||||
|
||||
Reference in New Issue
Block a user