[beta] Backports (#5299)

* Fix FireFox overflows (#5000)

* Max width for container

* Set min-width

* Switching ValidatorSet (#4961)

* add multi validator set

* nicer comment

* validate in constructor

* reporting

* Avoid clogging up tmp when updater dir has bad permissions. (#5024)

* force earliest era set in snapshot restore (#5021)

* v1.6.5

* Fine grained snapshot chunking

* Ropsten revival
This commit is contained in:
Arkadiy Paronyan
2017-03-28 01:45:56 +02:00
committed by GitHub
parent c1da49bbc4
commit 797f23f30b
34 changed files with 478 additions and 152 deletions

View File

@@ -16,6 +16,8 @@
//! Validator set deserialization.
use std::collections::BTreeMap;
use uint::Uint;
use hash::Address;
/// Different ways of specifying validators.
@@ -30,6 +32,9 @@ pub enum ValidatorSet {
/// Address of a contract that indicates the list of authorities and enables reporting of theor misbehaviour using transactions.
#[serde(rename="contract")]
Contract(Address),
/// A map of starting blocks for each validator set.
#[serde(rename="multi")]
Multi(BTreeMap<Uint, ValidatorSet>),
}
#[cfg(test)]
@@ -40,11 +45,17 @@ mod tests {
#[test]
fn validator_set_deserialization() {
let s = r#"[{
"list" : ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
}, {
"safeContract" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
"safeContract": "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
}, {
"contract" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
"contract": "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
}, {
"multi": {
"0": { "list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"] },
"10": { "list": ["0xd6d9d2cd449a754c494264e1809c50e34d64562b"] },
"20": { "contract": "0xc6d9d2cd449a754c494264e1809c50e34d64562b" }
}
}]"#;
let _deserialized: Vec<ValidatorSet> = serde_json::from_str(s).unwrap();