Merge pull request #3385 from ethcore/dev-chain

Dev chain
This commit is contained in:
Gav Wood
2016-11-14 16:28:58 +01:00
committed by GitHub
6 changed files with 20 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
{
"name": "TestInstantSeal",
"name": "DevelopmentChain",
"engine": {
"InstantSeal": null
},
@@ -28,6 +28,6 @@
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
"0x00a329c0648769a73afac7f9381e08fb43dbea72": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
}
}

View File

@@ -55,7 +55,7 @@ impl Engine for InstantSeal {
}
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
Schedule::new_homestead()
Schedule::new_post_eip150(false, false, false)
}
fn is_sealer(&self, _author: &Address) -> Option<bool> { Some(true) }
@@ -79,7 +79,7 @@ mod tests {
let tap = AccountProvider::transient_provider();
let addr = tap.insert_account("".sha3(), "").unwrap();
let spec = Spec::new_test_instant();
let spec = Spec::new_instant();
let engine = &*spec.engine;
let genesis_header = spec.genesis_header();
let mut db_result = get_temp_state_db();
@@ -95,7 +95,7 @@ mod tests {
#[test]
fn instant_cant_verify() {
let engine = Spec::new_test_instant().engine;
let engine = Spec::new_instant().engine;
let mut header: Header = Header::default();
assert!(engine.verify_block_basic(&header, None).is_ok());

View File

@@ -1251,7 +1251,7 @@ mod tests {
#[test]
fn internal_seals_without_work() {
let miner = Miner::with_spec(&Spec::new_test_instant());
let miner = Miner::with_spec(&Spec::new_instant());
let c = generate_dummy_client(2);
let client = c.reference().as_ref();

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.
@@ -267,19 +273,13 @@ 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") }
}
#[cfg(test)]