-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validator health status #3207
base: albatross
Are you sure you want to change the base?
Validator health status #3207
Conversation
f08b8d3
to
8108a5b
Compare
Track the number of blocks that are succesfully produced when changing the validator health
6978477
to
124258f
Compare
@@ -113,7 +113,7 @@ where | |||
let (v, c) = build_validator( | |||
peer_ids[i], | |||
Address::from(&validator_keys[i]), | |||
false, | |||
true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make automatic_reactivate
a fn param for build_validators
so it doesn't influence other tests?
validator/src/validator.rs
Outdated
/// The current validator health | ||
pub health: ValidatorHealth, | ||
/// Number of blocks that we have produced in time(without being inactivated) | ||
pub blk_cnt: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub blk_cnt: u32, | |
pub block_counter: u32, |
validator/src/micro.rs
Outdated
@@ -181,6 +198,8 @@ impl<TValidatorNetwork: ValidatorNetwork + 'static> NextProduceMicroBlockEvent<T | |||
continue; | |||
} | |||
|
|||
self.health_state.write().blk_cnt += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.health_state.write().blk_cnt += 1; | |
self.health_state.write().blk_cnt.saturating_add(1); |
Prevent overflow
log::warn!(block = block.block_number(), "Not publishing block"); | ||
let event = ProduceMicroBlockEvent::MicroBlock; | ||
break Some(Some(event)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log::warn!(block = block.block_number(), "Not publishing block"); | |
let event = ProduceMicroBlockEvent::MicroBlock; | |
break Some(Some(event)); | |
log::warn!(block = block.block_number(), "Not publishing block"); | |
break Some(Some(ProduceMicroBlockEvent::MicroBlock)); |
pub health: ValidatorHealth, | ||
/// Number of blocks that we have produced in time(without being inactivated) | ||
pub blk_cnt: u32, | ||
/// For testing/debug purposes control wether produced blocks are published by the validator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// For testing/debug purposes control wether produced blocks are published by the validator | |
/// For testing/debug purposes control whether produced blocks are published by the validator |
validator/src/validator.rs
Outdated
pub struct HealthState { | ||
/// The current validator health | ||
pub health: ValidatorHealth, | ||
/// Number of blocks that we have produced in time(without being inactivated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Number of blocks that we have produced in time(without being inactivated) | |
/// Number of subsequent blocks that we have been produced without being inactivated |
validator/src/validator.rs
Outdated
good_blocks = %self.health_state.read().blk_cnt, | ||
"Current validator health is yellow", | ||
); | ||
if self.health_state.read().blk_cnt >= VALIDATOR_HEALTH_THRESHOLD { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic doesn't seem to match with the original description: If the validator is Yellow and is not deactivated in a quarter of an epoch, we change its status to Green.
validator/src/validator.rs
Outdated
inactivated = red_block_number, | ||
"Current validator health is red", | ||
); | ||
if self.health_state.read().blk_cnt >= VALIDATOR_HEALTH_THRESHOLD { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic doesn't seem to match with the original description: If the validator is Red and is not deactivated in one epoch, we change its status to Yellow.
validator/src/validator.rs
Outdated
let validator_health = self.health_state.read().health; | ||
match validator_health { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let validator_health = self.health_state.read().health; | |
match validator_health { | |
match self.health_state.read().health { |
validator/src/validator.rs
Outdated
} | ||
ValidatorHealth::Red(_) => { | ||
log::warn!( | ||
"The validator needs human intervention, no automatic reactivate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The validator needs human intervention, no automatic reactivate" | |
"The validator needs human intervention, no automatic reactivation" |
What's in this pull request?
...
This fixes #___.
Pull request checklist
clippy
andrustfmt
warnings.