Merge branch 'master' into auth-round

This commit is contained in:
keorn
2016-11-14 18:04:44 +00:00
26 changed files with 266 additions and 206 deletions

View File

@@ -135,6 +135,12 @@ impl From<ethjson::spec::Spec> for Spec {
}
}
macro_rules! load_bundled {
($e:expr) => {
Spec::load(include_bytes!(concat!("../../res/", $e, ".json")) as &[u8]).expect(concat!("Chain spec ", $e, " is invalid."))
};
}
impl Spec {
/// Convert engine spec into a arc'd Engine of the right underlying type.
/// TODO avoid this hard-coded nastiness - use dynamic-linked plugin framework instead.
@@ -268,25 +274,17 @@ impl Spec {
}
/// Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus.
pub fn new_test() -> Self {
Spec::load(include_bytes!("../../res/null_morden.json") as &[u8]).expect("null_morden.json is invalid")
}
pub fn new_test() -> Spec { load_bundled!("null_morden") }
/// Create a new Spec which is a NullEngine consensus with a premine of address whose secret is sha3('').
pub fn new_null() -> Self {
Spec::load(include_bytes!("../../res/null.json") as &[u8]).expect("null.json is invalid")
}
pub fn new_null() -> Spec { load_bundled!("null") }
/// Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).
pub fn new_test_instant() -> Self {
Spec::load(include_bytes!("../../res/instant_seal.json") as &[u8]).expect("instant_seal.json is invalid")
}
pub fn new_instant() -> Spec { load_bundled!("instant_seal") }
/// Create a new Spec with AuthorityRound consensus which does internal sealing (not requiring work).
/// Accounts with secrets "1".sha3() and "2".sha3() are the authorities.
pub fn new_test_round() -> Self {
Spec::load(include_bytes!("../../res/authority_round.json") as &[u8]).expect("authority_round.json is invalid")
}
pub fn new_test_round() -> Self { load_bundled!("authority_round") }
}
#[cfg(test)]