Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Dev chain #3385

Merged
merged 13 commits into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions ethcore/res/instant_seal.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "TestInstantSeal",
"name": "DevelopmentChain",
"engine": {
"InstantSeal": null
},
Expand Down Expand Up @@ -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" }
}
}
6 changes: 3 additions & 3 deletions ethcore/src/engines/instant_seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand All @@ -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();
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 9 additions & 9 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions parity/cli/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Operating Options:
(default: {flag_mode_alarm}).
--chain CHAIN Specify the blockchain type. CHAIN may be either a
JSON chain specification file or olympic, frontier,
homestead, mainnet, morden, classic, expanse or
testnet (default: {flag_chain}).
homestead, mainnet, morden, classic, expanse,
testnet or dev (default: {flag_chain}).
-d --db-path PATH Specify the database & configuration directory path
(default: {flag_db_path}).
--keys-path PATH Specify the path for JSON key files to be found
Expand Down
3 changes: 3 additions & 0 deletions parity/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub enum SpecType {
Olympic,
Classic,
Expanse,
Dev,
Custom(String),
}

Expand All @@ -50,6 +51,7 @@ impl str::FromStr for SpecType {
"morden" | "testnet" => SpecType::Testnet,
"olympic" => SpecType::Olympic,
"expanse" => SpecType::Expanse,
"dev" => SpecType::Dev,
other => SpecType::Custom(other.into()),
};
Ok(spec)
Expand All @@ -64,6 +66,7 @@ impl SpecType {
SpecType::Olympic => Ok(ethereum::new_olympic()),
SpecType::Classic => Ok(ethereum::new_classic()),
SpecType::Expanse => Ok(ethereum::new_expanse()),
SpecType::Dev => Ok(Spec::new_instant()),
SpecType::Custom(ref filename) => {
let file = try!(fs::File::open(filename).map_err(|_| "Could not load specification file."));
Spec::load(file)
Expand Down