From b26f86d6ff29611e8742581467d16a8b1dbff53e Mon Sep 17 00:00:00 2001 From: Jonathan Brown Date: Thu, 1 Nov 2018 17:06:53 +0700 Subject: [PATCH] Support MIX. (#9767) * Support MIX. * Re-arrange mix.json so tests pass. * Add MIX hardfork. * Fix MIX chain specification. * Use original MIX datadir. * Fix MIX Newark enode. --- ethcore/res/ethereum/mix.json | 71 +++++++++++++++++++++++++++++++++++ ethcore/src/ethereum/mod.rs | 5 +++ parity/cli/mod.rs | 2 +- parity/params.rs | 6 +++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 ethcore/res/ethereum/mix.json diff --git a/ethcore/res/ethereum/mix.json b/ethcore/res/ethereum/mix.json new file mode 100644 index 000000000..fbe70f05e --- /dev/null +++ b/ethcore/res/ethereum/mix.json @@ -0,0 +1,71 @@ +{ + "name": "MIX", + "dataDir": "MIX", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x4563918244f40000", + "homesteadTransition": 0, + "eip100bTransition": 3000000, + "bombDefuseTransition": 3000000 + } + } + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x1391eaa92b871f91", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x100000", + "gasLimit": "0x2dc6c0", + "author": "0x0000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00", + "extraData": "0x77656c636f6d65746f7468656c696e6b6564776f726c64000000000000000000" + }, + "params": { + "networkID": "0x4c", + "chainID": "0x4c", + "maximumExtraDataSize": "0x20", + "gasLimitBoundDivisor": "0x0400", + "minGasLimit": "0x1388", + "accountStartNonce": "0x00", + "maxCodeSize": 24576, + "eip150Transition": 0, + "eip155Transition": 0, + "eip160Transition": 0, + "eip161abcTransition": 0, + "eip161dTransition": 0, + "eip140Transition": 3000000, + "eip211Transition": 3000000, + "eip214Transition": 3000000, + "eip658Transition": 3000000, + "eip98Transition": "0x7fffffffffffff" + }, + "nodes": [ + "enode://aeb6070deb50efeb41c5e4283a6a3b08ff701fef90e3522161c145f30df2852af3dfc51ba74591f7c9d96b11ca4c3c2b354bf58dd243f2d877f6eecc2373fd1d@139.162.15.124:30313", + "enode://e0c926dcdc5c1cf58b2ecba371c577c28c28c91f9b210093178a812389b65e5b53f0e478753b94fceb0b36645b779a915ca57c0c48507fe4d7f786508653656c@74.207.240.177:30313", + "enode://a2a2adb8c12b9b189306050013a44f28db30f92fb3670db9675a049b98b96eb18901d6ff7b961b6e96cfa3923ac29e8f647ef452f0a23ddfef3903ac1cf826af@173.255.195.214:30313", + "enode://5460fd1ad217941befd0f8d060e6729a0535a0738770aba56827d1313c09aeb68e3098d458aace59faba2c6780b8c9c30cb140b80cd8e30ca3a074ce6d3344d3@50.116.38.52:30313", + "enode://99fff4ed887d6a6a7b6e03a657c35c06d0eede1909ec289a362bad9d37dd4085886461bbce83aa484ce1327badb3c5958365caa851d71de49dc4530e075b64bc@45.79.128.151:30313", + "enode://fd80e04c75559cfdd9ed8c08ef2c39c5bc95021f7cbaf31acb601914bc7dac7c34b470b90a05e519bc8a8435a46e1ce51053ae07fac31a83567285c34a79c6bf@139.162.224.203:30313", + "enode://4742134a153c108855eb16563424887ed3aa5b6b74e4b713c8e93a10c376d954ff3041442716bdf9ee28fab2ea09f04d07e3366f834ea472c19820b7337eb27a@172.104.130.233:30313", + "enode://799d0a8836e17ef7fcc58b3d5ced5bb1fe474b31a09851f938d381f4556fa8954ca308f6a178d22ed56769a8b878ac8f9cc62c889f9cafab45a3bd4f6024bb29@172.104.68.7:30313" + ], + "accounts": { + "0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, + "0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, + "0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, + "0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, + "0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": 3000000, "pricing": { "modexp": { "divisor": 20 } } } }, + "0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": 3000000, "pricing": { "linear": { "base": 500, "word": 0 } } } }, + "0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": 3000000, "pricing": { "linear": { "base": 40000, "word": 0 } } } }, + "0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": 3000000, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } }, + "97c7f4f8f0bbf384578a9f5754ae73f37ff49ec2": { "balance": "55000000000000000000000000" } + } +} diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index b024d3420..467b978d2 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -89,6 +89,11 @@ pub fn new_social<'a, T: Into>>(params: T) -> Spec { load(params.into(), include_bytes!("../../res/ethereum/social.json")) } +/// Create a new MIX mainnet chain spec. +pub fn new_mix<'a, T: Into>>(params: T) -> Spec { + load(params.into(), include_bytes!("../../res/ethereum/mix.json")) +} + /// Create a new Morden testnet chain spec. pub fn new_morden<'a, T: Into>>(params: T) -> Spec { load(params.into(), include_bytes!("../../res/ethereum/morden.json")) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index d370628f1..fce9b571c 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -288,7 +288,7 @@ usage! { ARG arg_chain: (String) = "foundation", or |c: &Config| c.parity.as_ref()?.chain.clone(), "--chain=[CHAIN]", - "Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, poacore, tobalaba, expanse, musicoin, ellaism, easthub, social, callisto, morden, ropsten, kovan, poasokol, testnet, or dev.", + "Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, poacore, tobalaba, expanse, musicoin, ellaism, easthub, social, mix, callisto, morden, ropsten, kovan, poasokol, testnet, or dev.", ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| c.parity.as_ref()?.keys_path.clone(), "--keys-path=[PATH]", diff --git a/parity/params.rs b/parity/params.rs index 71a50a8ea..1d3846875 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -40,6 +40,7 @@ pub enum SpecType { Ellaism, Easthub, Social, + Mix, Callisto, Morden, Ropsten, @@ -69,6 +70,7 @@ impl str::FromStr for SpecType { "ellaism" => SpecType::Ellaism, "easthub" => SpecType::Easthub, "social" => SpecType::Social, + "mix" => SpecType::Mix, "callisto" => SpecType::Callisto, "morden" | "classic-testnet" => SpecType::Morden, "ropsten" => SpecType::Ropsten, @@ -93,6 +95,7 @@ impl fmt::Display for SpecType { SpecType::Ellaism => "ellaism", SpecType::Easthub => "easthub", SpecType::Social => "social", + SpecType::Mix => "mix", SpecType::Callisto => "callisto", SpecType::Morden => "morden", SpecType::Ropsten => "ropsten", @@ -117,6 +120,7 @@ impl SpecType { SpecType::Ellaism => Ok(ethereum::new_ellaism(params)), SpecType::Easthub => Ok(ethereum::new_easthub(params)), SpecType::Social => Ok(ethereum::new_social(params)), + SpecType::Mix => Ok(ethereum::new_mix(params)), SpecType::Callisto => Ok(ethereum::new_callisto(params)), SpecType::Morden => Ok(ethereum::new_morden(params)), SpecType::Ropsten => Ok(ethereum::new_ropsten(params)), @@ -370,6 +374,7 @@ mod tests { assert_eq!(SpecType::Ellaism, "ellaism".parse().unwrap()); assert_eq!(SpecType::Easthub, "easthub".parse().unwrap()); assert_eq!(SpecType::Social, "social".parse().unwrap()); + assert_eq!(SpecType::Mix, "mix".parse().unwrap()); assert_eq!(SpecType::Callisto, "callisto".parse().unwrap()); assert_eq!(SpecType::Morden, "morden".parse().unwrap()); assert_eq!(SpecType::Morden, "classic-testnet".parse().unwrap()); @@ -396,6 +401,7 @@ mod tests { assert_eq!(format!("{}", SpecType::Ellaism), "ellaism"); assert_eq!(format!("{}", SpecType::Easthub), "easthub"); assert_eq!(format!("{}", SpecType::Social), "social"); + assert_eq!(format!("{}", SpecType::Mix), "mix"); assert_eq!(format!("{}", SpecType::Callisto), "callisto"); assert_eq!(format!("{}", SpecType::Morden), "morden"); assert_eq!(format!("{}", SpecType::Ropsten), "ropsten");