Add state-checks to test_harness YAML

Runs tests against a state at some slot
This commit is contained in:
Paul Hauner
2019-03-02 20:17:14 +11:00
parent f5614381e1
commit 4db2f082e1
6 changed files with 151 additions and 47 deletions

View File

@@ -55,8 +55,16 @@ pub struct Validator {
impl Validator {
/// This predicate indicates if the validator represented by this record is considered "active" at `slot`.
pub fn is_active_at(&self, slot: Epoch) -> bool {
self.activation_epoch <= slot && slot < self.exit_epoch
pub fn is_active_at(&self, epoch: Epoch) -> bool {
self.activation_epoch <= epoch && epoch < self.exit_epoch
}
pub fn is_exited_at(&self, epoch: Epoch) -> bool {
self.exit_epoch <= epoch
}
pub fn is_penalized_at(&self, epoch: Epoch) -> bool {
self.penalized_epoch <= epoch
}
}