Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
142f6ac
notify when an authority appears to have missed their block
rphmeier Aug 9, 2018
3f09f5c
Runtime API
gavofyork Aug 9, 2018
6095a6d
offline tracker
rphmeier Aug 9, 2018
21f40e5
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
rphmeier Aug 9, 2018
13a5e89
Move to consensus
gavofyork Aug 9, 2018
8c0fd55
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
gavofyork Aug 9, 2018
de23e91
generating reports of offline indices
rphmeier Aug 9, 2018
5433ef3
stubbed-out evaluation logic
rphmeier Aug 9, 2018
603e5a2
Slashing data pathwat
gavofyork Aug 9, 2018
08f598e
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
rphmeier Aug 9, 2018
4e2ceef
usize -> u32
rphmeier Aug 9, 2018
cff0577
Slash bad validators.
gavofyork Aug 9, 2018
825e1a4
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
gavofyork Aug 9, 2018
14b27cc
update to rhododendron 0.3
rphmeier Aug 9, 2018
00f23eb
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
rphmeier Aug 9, 2018
b827eec
fix compilation of polkadot-consensus
rphmeier Aug 9, 2018
6dd3524
Support offline noting in checked_block
gavofyork Aug 9, 2018
1cb58de
Merge branch 'rh-note-offline-validator' of github.com:paritytech/pol…
gavofyork Aug 9, 2018
241f28f
include offline reports in block authorship voting
rphmeier Aug 10, 2018
614b011
do not vote validators offline after some time
rphmeier Aug 10, 2018
b122ed4
add test for offline-tracker
rphmeier Aug 10, 2018
9724a69
fix test build
rphmeier Aug 10, 2018
60aadd3
bump spec version
rphmeier Aug 10, 2018
2fb0343
Merge remote-tracking branch 'upstream/master' into rh-note-offline-v…
rphmeier Aug 10, 2018
7602e59
update wasm
rphmeier Aug 10, 2018
922035d
Only allow validators that are possible to slash
gavofyork Aug 10, 2018
a6bea42
Fix grumble
tomusdrw Aug 3, 2018
a61396e
More idiomatic
gavofyork Aug 10, 2018
1d787e1
New Wasm.
gavofyork Aug 10, 2018
ab6957f
update rhododendron
rphmeier Aug 10, 2018
7696119
improve logging and reduce round time exponent
rphmeier Aug 10, 2018
2446ded
format offline validators in ss58
rphmeier Aug 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
generating reports of offline indices
  • Loading branch information
rphmeier committed Aug 9, 2018
commit de23e91261b14860e14304a1f4c70cf0e69c65bd
37 changes: 31 additions & 6 deletions polkadot/consensus/src/offline_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,38 @@ impl OfflineTracker {
.note_round_end(was_online);
}

/// Generate a vector of reports for the given account IDs.
/// The length of the vector will be the same as the length of the validator
/// list.
/// `None` is "not enough data", `true` is "online", and `false` is "offline".
pub fn reports(&self, validators: &[AccountId]) -> Vec<Option<bool>> {
/// Generate a vector of indices for offline account IDs.
pub fn reports(&self, validators: &[AccountId]) -> Vec<usize> {
validators.iter()
.map(|v| self.observed.get(v).map(Observed::is_active))
.enumerate()
.filter_map(|(i, v)| if self.is_online(v) {
None
} else {
Some(i)
})
.collect()
}

/// Whether reports on a validator set are consistent with our view of things.
pub fn check_consistency(&self, validators: &[AccountId], reports: &[usize]) -> bool {
reports.iter().all(|r| {
let v = match validators.get(r) {
Some(v) => v,
None => return false,
};

// we must think all validators reported externally are offline.
let thinks_online = self.is_online(v);
!thinks_online
})
}

fn is_online(&self, v: &AccountId) -> bool {
self.observed.get(v).map(Observed::is_active).unwrap_or(true)
}
}

#[cfg(test)]
mod tests {

}