From 09839d26eba23088abea138833c684ddc2cf8893 Mon Sep 17 00:00:00 2001 From: Artem Vorotnikov Date: Sun, 26 Apr 2020 23:13:30 +0300 Subject: [PATCH] Remove ProgPoW and EtherCore --- README.md | 2 +- ethash/Cargo.toml | 7 +- ethash/benches/basic.rs | 30 +- ethash/benches/progpow.rs | 106 ---- ethash/src/cache.rs | 8 +- ethash/src/compute.rs | 80 +-- ethash/src/lib.rs | 58 +- ethash/src/progpow.rs | 615 ------------------- ethcore/engines/ethash/src/lib.rs | 8 - ethcore/res/ethereum/ethercore.json | 189 ------ ethcore/spec/src/chain.rs | 1 - ethcore/verification/benches/verification.rs | 1 - json/src/spec/ethash.rs | 4 - parity/cli/mod.rs | 2 +- parity/params.rs | 6 - 15 files changed, 63 insertions(+), 1054 deletions(-) delete mode 100644 ethash/benches/progpow.rs delete mode 100644 ethash/src/progpow.rs delete mode 100644 ethcore/res/ethereum/ethercore.json diff --git a/README.md b/README.md index 03f62ed4e67..2003c328b93 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ Replacing `` with one of the following from the details section below (i.e ```bash cli-signer parity-rpc-client ``` -* OpenEthereum Ethash & ProgPoW Implementations +* OpenEthereum Ethash Implementations ```bash ethash ``` diff --git a/ethash/Cargo.toml b/ethash/Cargo.toml index e31d54cde1c..37ce5a55432 100644 --- a/ethash/Cargo.toml +++ b/ethash/Cargo.toml @@ -1,5 +1,5 @@ [package] -description = "OpenEthereum Ethash & ProgPoW Implementations" +description = "OpenEthereum Ethash Implementation" name = "ethash" version = "1.12.0" authors = ["Parity Technologies "] @@ -30,8 +30,3 @@ bench = [] name = "basic" harness = false required-features = ['bench'] - -[[bench]] -name = "progpow" -harness = false -required-features = ['bench'] diff --git a/ethash/benches/basic.rs b/ethash/benches/basic.rs index 326924f1a9e..194fb26c389 100644 --- a/ethash/benches/basic.rs +++ b/ethash/benches/basic.rs @@ -67,28 +67,28 @@ fn bench_keccak_512_inplace(b: &mut Criterion) { fn bench_light_compute_memmap(b: &mut Criterion) { use std::env; - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Memory); let light = builder.light(&env::temp_dir(), 486382); - b.bench_function("bench_light_compute_memmap", move |b| b.iter(|| light.compute(&HASH, NONCE, u64::max_value()))); + b.bench_function("bench_light_compute_memmap", move |b| b.iter(|| light.compute(&HASH, NONCE))); } fn bench_light_compute_memory(b: &mut Criterion) { use std::env; - let builder = NodeCacheBuilder::new(OptimizeFor::Cpu, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Cpu); let light = builder.light(&env::temp_dir(), 486382); - b.bench_function("bench_light_compute_memory", move |b| b.iter(|| light.compute(&HASH, NONCE, u64::max_value()))); + b.bench_function("bench_light_compute_memory", move |b| b.iter(|| light.compute(&HASH, NONCE))); } fn bench_light_new_round_trip_memmap(b: &mut Criterion) { use std::env; b.bench_function("bench_light_new_round_trip_memmap", move |b| b.iter(|| { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Memory); let light = builder.light(&env::temp_dir(), 486382); - light.compute(&HASH, NONCE, u64::max_value()); + light.compute(&HASH, NONCE); })); } @@ -96,9 +96,9 @@ fn bench_light_new_round_trip_memory(b: &mut Criterion) { use std::env; b.bench_function("bench_light_new_round_trip_memory", move |b| b.iter(|| { - let builder = NodeCacheBuilder::new(OptimizeFor::Cpu, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Cpu); let light = builder.light(&env::temp_dir(), 486382); - light.compute(&HASH, NONCE, u64::max_value()); + light.compute(&HASH, NONCE); })); } @@ -108,15 +108,15 @@ fn bench_light_from_file_round_trip_memory(b: &mut Criterion) { let dir = env::temp_dir(); let height = 486382; { - let builder = NodeCacheBuilder::new(OptimizeFor::Cpu, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Cpu); let mut dummy = builder.light(&dir, height); dummy.to_file().unwrap(); } b.bench_function("bench_light_from_file_round_trip_memory", move |b| b.iter(|| { - let builder = NodeCacheBuilder::new(OptimizeFor::Cpu, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Cpu); let light = builder.light_from_file(&dir, 486382).unwrap(); - light.compute(&HASH, NONCE, u64::max_value()); + light.compute(&HASH, NONCE); })); } @@ -127,21 +127,21 @@ fn bench_light_from_file_round_trip_memmap(b: &mut Criterion) { let height = 486382; { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Memory); let mut dummy = builder.light(&dir, height); dummy.to_file().unwrap(); } b.bench_function("bench_light_from_file_round_trip_memmap", move |b| b.iter(|| { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); + let builder = NodeCacheBuilder::new(OptimizeFor::Memory); let light = builder.light_from_file(&dir, 486382).unwrap(); - light.compute(&HASH, NONCE, u64::max_value()); + light.compute(&HASH, NONCE); })); } fn bench_quick_get_difficulty(b: &mut Criterion) { b.bench_function("bench_quick_get_difficulty", move |b| b.iter(|| { - let d = ethash::quick_get_difficulty(&HASH, NONCE, &MIX_HASH, false); + let d = ethash::quick_get_difficulty(&HASH, NONCE, &MIX_HASH); let boundary_good = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3e, 0x9b, 0x6c, 0x69, 0xbc, 0x2c, 0xe2, 0xa2, 0x4a, 0x8e, 0x95, 0x69, 0xef, 0xc7, 0xd7, 0x1b, 0x33, 0x35, 0xdf, 0x36, 0x8c, 0x9a, diff --git a/ethash/benches/progpow.rs b/ethash/benches/progpow.rs deleted file mode 100644 index f972da90313..00000000000 --- a/ethash/benches/progpow.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015-2020 Parity Technologies (UK) Ltd. -// This file is part of Open Ethereum. - -// Open Ethereum is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Open Ethereum is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Open Ethereum. If not, see . - -#[macro_use] -extern crate criterion; - -#[macro_use] -extern crate hex_literal; - -extern crate common_types; -extern crate ethash; -extern crate tempfile; - -use criterion::Criterion; -use ethash::progpow; - -use tempfile::TempDir; -use ethash::NodeCacheBuilder; -use ethash::compute::light_compute; -use common_types::engines::OptimizeFor; - -fn bench_hashimoto_light(c: &mut Criterion) { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let light = builder.light(&tempdir.path(), 1); - let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f"); - let mut hash = [0; 32]; - hash.copy_from_slice(&h); - - c.bench_function("hashimoto_light", move |b| { - b.iter(|| light_compute(&light, &hash, 0)) - }); -} - -fn bench_progpow_light(c: &mut Criterion) { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let cache = builder.new_cache(tempdir.into_path(), 0); - - let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f"); - let mut hash = [0; 32]; - hash.copy_from_slice(&h); - - c.bench_function("progpow_light", move |b| { - b.iter(|| { - let c_dag = progpow::generate_cdag(cache.as_ref()); - progpow::progpow( - hash, - 0, - 0, - cache.as_ref(), - &c_dag, - ); - }) - }); -} - -fn bench_progpow_optimal_light(c: &mut Criterion) { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let cache = builder.new_cache(tempdir.into_path(), 0); - let c_dag = progpow::generate_cdag(cache.as_ref()); - - let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f"); - let mut hash = [0; 32]; - hash.copy_from_slice(&h); - - c.bench_function("progpow_optimal_light", move |b| { - b.iter(|| { - progpow::progpow( - hash, - 0, - 0, - cache.as_ref(), - &c_dag, - ); - }) - }); -} - -fn bench_keccak_f800_long(c: &mut Criterion) { - c.bench_function("keccak_f800_long(0, 0, 0)", |b| { - b.iter(|| progpow::keccak_f800_long([0; 32], 0, [0; 8])) - }); -} - -criterion_group!(benches, - bench_hashimoto_light, - bench_progpow_light, - bench_progpow_optimal_light, - bench_keccak_f800_long, -); -criterion_main!(benches); diff --git a/ethash/src/cache.rs b/ethash/src/cache.rs index 756d1a141e0..aa4eda4d61b 100644 --- a/ethash/src/cache.rs +++ b/ethash/src/cache.rs @@ -59,7 +59,6 @@ pub struct NodeCacheBuilder { // TODO: Remove this locking and just use an `Rc`? seedhash: Arc>, optimize_for: OptimizeFor, - progpow_transition: u64, } // TODO: Abstract the "optimize for" logic @@ -73,18 +72,17 @@ pub struct NodeCache { impl NodeCacheBuilder { pub fn light(&self, cache_dir: &Path, block_number: u64) -> Light { - Light::new_with_builder(self, cache_dir, block_number, self.progpow_transition) + Light::new_with_builder(self, cache_dir, block_number) } pub fn light_from_file(&self, cache_dir: &Path, block_number: u64) -> io::Result { - Light::from_file_with_builder(self, cache_dir, block_number, self.progpow_transition) + Light::from_file_with_builder(self, cache_dir, block_number) } - pub fn new>>(optimize_for: T, progpow_transition: u64) -> Self { + pub fn new>>(optimize_for: T) -> Self { NodeCacheBuilder { seedhash: Arc::new(Mutex::new(SeedHashCompute::default())), optimize_for: optimize_for.into().unwrap_or_default(), - progpow_transition } } diff --git a/ethash/src/compute.rs b/ethash/src/compute.rs index 71e4f0d807c..d1034217f1c 100644 --- a/ethash/src/compute.rs +++ b/ethash/src/compute.rs @@ -21,7 +21,6 @@ use keccak::{keccak_512, keccak_256, H256}; use cache::{NodeCache, NodeCacheBuilder}; -use progpow::{CDag, generate_cdag, progpow, keccak_f800_short, keccak_f800_long}; use seed_compute::SeedHashCompute; use shared::*; use std::io; @@ -41,15 +40,9 @@ pub struct ProofOfWork { pub mix_hash: H256, } -enum Algorithm { - Hashimoto, - Progpow(Box), -} - pub struct Light { block_number: u64, cache: NodeCache, - algorithm: Algorithm, } /// Light cache structure @@ -58,55 +51,27 @@ impl Light { builder: &NodeCacheBuilder, cache_dir: &Path, block_number: u64, - progpow_transition: u64, ) -> Self { let cache = builder.new_cache(cache_dir.to_path_buf(), block_number); - let algorithm = if block_number >= progpow_transition { - Algorithm::Progpow(Box::new(generate_cdag(cache.as_ref()))) - } else { - Algorithm::Hashimoto - }; - - Light { block_number, cache, algorithm } + Light { block_number, cache } } /// Calculate the light boundary data /// `header_hash` - The header hash to pack into the mix /// `nonce` - The nonce to pack into the mix - pub fn compute(&self, header_hash: &H256, nonce: u64, block_number: u64) -> ProofOfWork { - match self.algorithm { - Algorithm::Progpow(ref c_dag) => { - let (value, mix_hash) = progpow( - *header_hash, - nonce, - block_number, - self.cache.as_ref(), - c_dag, - ); - - ProofOfWork { value, mix_hash } - }, - Algorithm::Hashimoto => light_compute(self, header_hash, nonce), - } - + pub fn compute(&self, header_hash: &H256, nonce: u64) -> ProofOfWork { + light_compute(self, header_hash, nonce) } pub fn from_file_with_builder( builder: &NodeCacheBuilder, cache_dir: &Path, block_number: u64, - progpow_transition: u64, ) -> io::Result { let cache = builder.from_file(cache_dir.to_path_buf(), block_number)?; - let algorithm = if block_number >= progpow_transition { - Algorithm::Progpow(Box::new(generate_cdag(cache.as_ref()))) - } else { - Algorithm::Hashimoto - }; - - Ok(Light { block_number, cache, algorithm }) + Ok(Light { block_number, cache }) } pub fn to_file(&mut self) -> io::Result<&Path> { @@ -129,28 +94,21 @@ fn fnv_hash(x: u32, y: u32) -> u32 { /// `nonce` The block's nonce /// `mix_hash` The mix digest hash /// Boundary recovered from mix hash -pub fn quick_get_difficulty(header_hash: &H256, nonce: u64, mix_hash: &H256, progpow: bool) -> H256 { - unsafe { - if progpow { - let seed = keccak_f800_short(*header_hash, nonce, [0u32; 8]); - keccak_f800_long(*header_hash, seed, mem::transmute(*mix_hash)) - } else { - let mut buf = [0u8; 64 + 32]; +pub fn quick_get_difficulty(header_hash: &H256, nonce: u64, mix_hash: &H256) -> H256 { + let mut buf = [0u8; 64 + 32]; - let hash_len = header_hash.len(); - buf[..hash_len].copy_from_slice(header_hash); - let end = hash_len + mem::size_of::(); - buf[hash_len..end].copy_from_slice(&nonce.to_ne_bytes()); + let hash_len = header_hash.len(); + buf[..hash_len].copy_from_slice(header_hash); + let end = hash_len + mem::size_of::(); + buf[hash_len..end].copy_from_slice(&nonce.to_ne_bytes()); - keccak_512::inplace_range(&mut buf, 0..end); - buf[64..].copy_from_slice(mix_hash); + keccak_512::inplace_range(&mut buf, 0..end); + buf[64..].copy_from_slice(mix_hash); - let mut hash = [0u8; 32]; - keccak_256::write(&buf, &mut hash); + let mut hash = [0u8; 32]; + keccak_256::write(&buf, &mut hash); - hash - } - } + hash } /// Calculate the light client data @@ -370,13 +328,13 @@ mod test { 0x4a, 0x8e, 0x95, 0x69, 0xef, 0xc7, 0xd7, 0x1b, 0x33, 0x35, 0xdf, 0x36, 0x8c, 0x9a, 0xe9, 0x7e, 0x53, 0x84, ]; - assert_eq!(quick_get_difficulty(&hash, nonce, &mix_hash, false)[..], boundary_good[..]); + assert_eq!(quick_get_difficulty(&hash, nonce, &mix_hash)[..], boundary_good[..]); let boundary_bad = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3a, 0x9b, 0x6c, 0x69, 0xbc, 0x2c, 0xe2, 0xa2, 0x4a, 0x8e, 0x95, 0x69, 0xef, 0xc7, 0xd7, 0x1b, 0x33, 0x35, 0xdf, 0x36, 0x8c, 0x9a, 0xe9, 0x7e, 0x53, 0x84, ]; - assert!(quick_get_difficulty(&hash, nonce, &mix_hash, false)[..] != boundary_bad[..]); + assert!(quick_get_difficulty(&hash, nonce, &mix_hash)[..] != boundary_bad[..]); } #[test] @@ -400,7 +358,7 @@ mod test { let tempdir = TempDir::new().unwrap(); // difficulty = 0x085657254bd9u64; - let light = NodeCacheBuilder::new(None, u64::max_value()).light(tempdir.path(), 486382); + let light = NodeCacheBuilder::new(None).light(tempdir.path(), 486382); let result = light_compute(&light, &hash, nonce); assert_eq!(result.mix_hash[..], mix_hash[..]); assert_eq!(result.value[..], boundary[..]); @@ -409,7 +367,7 @@ mod test { #[test] fn test_drop_old_data() { let tempdir = TempDir::new().unwrap(); - let builder = NodeCacheBuilder::new(None, u64::max_value()); + let builder = NodeCacheBuilder::new(None); let first = builder.light(tempdir.path(), 0).to_file().unwrap().to_owned(); let second = builder.light(tempdir.path(), ETHASH_EPOCH_LENGTH).to_file().unwrap().to_owned(); diff --git a/ethash/src/lib.rs b/ethash/src/lib.rs index 953fa3b7ae6..196ac847b29 100644 --- a/ethash/src/lib.rs +++ b/ethash/src/lib.rs @@ -53,11 +53,6 @@ pub mod keccak; mod keccak; mod shared; -#[cfg(feature = "bench")] -pub mod progpow; -#[cfg(not(feature = "bench"))] -mod progpow; - pub use cache::NodeCacheBuilder; pub use compute::{ProofOfWork, quick_get_difficulty, slow_hash_block_number}; pub use seed_compute::SeedHashCompute; @@ -86,16 +81,14 @@ pub struct EthashManager { nodecache_builder: NodeCacheBuilder, cache: Mutex, cache_dir: PathBuf, - progpow_transition: u64, } impl EthashManager { /// Create a new new instance of ethash manager - pub fn new>>(cache_dir: &Path, optimize_for: T, progpow_transition: u64) -> EthashManager { + pub fn new>>(cache_dir: &Path, optimize_for: T) -> EthashManager { EthashManager { cache_dir: cache_dir.to_path_buf(), - nodecache_builder: NodeCacheBuilder::new(optimize_for.into().unwrap_or_default(), progpow_transition), - progpow_transition, + nodecache_builder: NodeCacheBuilder::new(optimize_for.into().unwrap_or_default()), cache: Mutex::new(LightCache { recent_epoch: None, recent: None, @@ -114,31 +107,26 @@ impl EthashManager { let epoch = block_number / ETHASH_EPOCH_LENGTH; let light = { let mut lights = self.cache.lock(); - let light = if block_number == self.progpow_transition { - // we need to regenerate the cache to trigger algorithm change to progpow inside `Light` - None - } else { - match lights.recent_epoch.clone() { - Some(ref e) if *e == epoch => lights.recent.clone(), - _ => match lights.prev_epoch.clone() { - Some(e) if e == epoch => { - // don't swap if recent is newer. - if lights.recent_epoch > lights.prev_epoch { - None - } else { - // swap - let t = lights.prev_epoch; - lights.prev_epoch = lights.recent_epoch; - lights.recent_epoch = t; - let t = lights.prev.clone(); - lights.prev = lights.recent.clone(); - lights.recent = t; - lights.recent.clone() - } + let light = match lights.recent_epoch.clone() { + Some(ref e) if *e == epoch => lights.recent.clone(), + _ => match lights.prev_epoch.clone() { + Some(e) if e == epoch => { + // don't swap if recent is newer. + if lights.recent_epoch > lights.prev_epoch { + None + } else { + // swap + let t = lights.prev_epoch; + lights.prev_epoch = lights.recent_epoch; + lights.recent_epoch = t; + let t = lights.prev.clone(); + lights.prev = lights.recent.clone(); + lights.recent = t; + lights.recent.clone() } - _ => None, - }, - } + } + _ => None, + }, }; match light { @@ -167,7 +155,7 @@ impl EthashManager { Some(light) => light, } }; - light.compute(header_hash, nonce, block_number) + light.compute(header_hash, nonce) } } @@ -199,7 +187,7 @@ fn test_lru() { use tempfile::TempDir; let tempdir = TempDir::new().unwrap(); - let ethash = EthashManager::new(tempdir.path(), None, u64::max_value()); + let ethash = EthashManager::new(tempdir.path(), None); let hash = [0u8; 32]; ethash.compute_light(1, &hash, 1); ethash.compute_light(50000, &hash, 1); diff --git a/ethash/src/progpow.rs b/ethash/src/progpow.rs deleted file mode 100644 index ca30cf8fe68..00000000000 --- a/ethash/src/progpow.rs +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright 2015-2020 Parity Technologies (UK) Ltd. -// This file is part of Open Ethereum. - -// Open Ethereum is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Open Ethereum is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Open Ethereum. If not, see . - -//! ProgPoW (Programmatic Proof-of-Work) is the Ethereum network's proposed new Application-Specific Integrated -//! Circuit (ASIC) resistant Proof-of-Work mining algorithm. -//! -//! ProgPoW's aim is to reduce the efficiencies of specialized mining devices known as ASIC chips -//! (and accelerated GPU-based setups), and to maximize the performance of General Purpose Hardware (GPUs) to enable -//! more users to compete for new cryptocurrency awarded by the protocol. -//! -//! ASIC chips are those that are tailored to efficiently mining cryptocurrency based on a specific hashing algorithm. -//! -//! GPU mining setups are less specialised are struggle to compete for mining rewards. -//! -//! It would be a change from Ethereum's current PoW mining algorithm known as Ethash. -//! -//! ProgPoW audits have been proposed to analyse the efficiency of a ProgPoW ASICs over -//! GPUs and analysis of the economic impact on the Ethereum protocol. -//! -//! We use ProgPoW 0.9.3 version as suggested on Specification -//! https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1057.md#specification - -use compute::{FNV_PRIME, calculate_dag_item}; -use keccak::H256; -use shared::{ETHASH_ACCESSES, ETHASH_MIX_BYTES, Node, get_data_size}; - -const PROGPOW_CACHE_BYTES: usize = 16 * 1024; -const PROGPOW_CACHE_WORDS: usize = PROGPOW_CACHE_BYTES / 4; -const PROGPOW_CNT_CACHE: usize = 11; -const PROGPOW_CNT_MATH: usize = 18; -const PROGPOW_CNT_DAG: usize = ETHASH_ACCESSES; -const PROGPOW_DAG_LOADS: usize = 4; -const PROGPOW_MIX_BYTES: usize = 2 * ETHASH_MIX_BYTES; -const PROGPOW_PERIOD_LENGTH: usize = 10; // blocks per progpow epoch (N) -const PROGPOW_LANES: usize = 16; -const PROGPOW_REGS: usize = 32; - -const FNV_HASH: u32 = 0x811c9dc5; - -const KECCAKF_RNDC: [u32; 24] = [ - 0x00000001, 0x00008082, 0x0000808a, 0x80008000, 0x0000808b, 0x80000001, - 0x80008081, 0x00008009, 0x0000008a, 0x00000088, 0x80008009, 0x8000000a, - 0x8000808b, 0x0000008b, 0x00008089, 0x00008003, 0x00008002, 0x00000080, - 0x0000800a, 0x8000000a, 0x80008081, 0x00008080, 0x80000001, 0x80008008 -]; - -const KECCAKF_ROTC: [u32; 24] = [ - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 -]; - -const KECCAKF_PILN: [usize; 24] = [ - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 -]; - -fn keccak_f800_round(st: &mut [u32; 25], r: usize) { - // Theta - let mut bc = [0u32; 5]; - for i in 0..bc.len() { - bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; - } - - for i in 0..bc.len() { - let t = bc[(i + 4) % 5] ^ bc[(i + 1) % 5].rotate_left(1); - for j in (0..st.len()).step_by(5) { - st[j + i] ^= t; - } - } - - // Rho Pi - let mut t = st[1]; - - debug_assert_eq!(KECCAKF_ROTC.len(), 24); - for i in 0..24 { - let j = KECCAKF_PILN[i]; - bc[0] = st[j]; - st[j] = t.rotate_left(KECCAKF_ROTC[i]); - t = bc[0]; - } - - // Chi - for j in (0..st.len()).step_by(5) { - for i in 0..bc.len() { - bc[i] = st[j + i]; - } - for i in 0..bc.len() { - st[j + i] ^= (!bc[(i + 1) % 5]) & bc[(i + 2) % 5]; - } - } - - // Iota - debug_assert!(r < KECCAKF_RNDC.len()); - st[0] ^= KECCAKF_RNDC[r]; -} - -fn keccak_f800(header_hash: H256, nonce: u64, result: [u32; 8], st: &mut [u32; 25]) { - for i in 0..8 { - st[i] = (header_hash[4 * i] as u32) + - ((header_hash[4 * i + 1] as u32) << 8) + - ((header_hash[4 * i + 2] as u32) << 16) + - ((header_hash[4 * i + 3] as u32) << 24); - } - - st[8] = nonce as u32; - st[9] = (nonce >> 32) as u32; - - for i in 0..8 { - st[10 + i] = result[i]; - } - - for r in 0..22 { - keccak_f800_round(st, r); - } -} - -pub fn keccak_f800_short(header_hash: H256, nonce: u64, result: [u32; 8]) -> u64 { - let mut st = [0u32; 25]; - keccak_f800(header_hash, nonce, result, &mut st); - (st[0].swap_bytes() as u64) << 32 | st[1].swap_bytes() as u64 -} - -pub fn keccak_f800_long(header_hash: H256, nonce: u64, result: [u32; 8]) -> H256 { - let mut st = [0u32; 25]; - keccak_f800(header_hash, nonce, result, &mut st); - - // NOTE: transmute from `[u32; 8]` to `[u8; 32]` - unsafe { - std::mem::transmute( - [st[0], st[1], st[2], st[3], st[4], st[5], st[6], st[7]] - ) - } -} - -#[inline] -fn fnv1a_hash(h: u32, d: u32) -> u32 { - (h ^ d).wrapping_mul(FNV_PRIME) -} - -#[derive(Clone)] -struct Kiss99 { - z: u32, - w: u32, - jsr: u32, - jcong: u32, -} - -impl Kiss99 { - fn new(z: u32, w: u32, jsr: u32, jcong: u32) -> Kiss99 { - Kiss99 { z, w, jsr, jcong } - } - - #[inline] - fn next_u32(&mut self) -> u32 { - self.z = 36969u32.wrapping_mul(self.z & 65535).wrapping_add(self.z >> 16); - self.w = 18000u32.wrapping_mul(self.w & 65535).wrapping_add(self.w >> 16); - let mwc = (self.z << 16).wrapping_add(self.w); - self.jsr ^= self.jsr << 17; - self.jsr ^= self.jsr >> 13; - self.jsr ^= self.jsr << 5; - self.jcong = 69069u32.wrapping_mul(self.jcong).wrapping_add(1234567); - - (mwc ^ self.jcong).wrapping_add(self.jsr) - } -} - -fn fill_mix(seed: u64, lane_id: u32) -> [u32; PROGPOW_REGS] { - // Use FNV to expand the per-warp seed to per-lane - // Use KISS to expand the per-lane seed to fill mix - let z = fnv1a_hash(FNV_HASH, seed as u32); - let w = fnv1a_hash(z, (seed >> 32) as u32); - let jsr = fnv1a_hash(w, lane_id); - let jcong = fnv1a_hash(jsr, lane_id); - - let mut rnd = Kiss99::new(z, w, jsr, jcong); - - let mut mix = [0; PROGPOW_REGS]; - - debug_assert_eq!(PROGPOW_REGS, 32); - for i in 0..32 { - mix[i] = rnd.next_u32(); - } - - mix -} - -// Merge new data from b into the value in a. Assuming A has high entropy only -// do ops that retain entropy even if B is low entropy (IE don't do A&B) -fn merge(a: u32, b: u32, r: u32) -> u32 { - match r % 4 { - 0 => a.wrapping_mul(33).wrapping_add(b), - 1 => (a ^ b).wrapping_mul(33), - 2 => a.rotate_left(((r >> 16) % 31) + 1) ^ b, - _ => a.rotate_right(((r >> 16) % 31) + 1) ^ b, - } -} - -fn math(a: u32, b: u32, r: u32) -> u32 { - match r % 11 { - 0 => a.wrapping_add(b), - 1 => a.wrapping_mul(b), - 2 => ((a as u64).wrapping_mul(b as u64) >> 32) as u32, - 3 => a.min(b), - 4 => a.rotate_left(b), - 5 => a.rotate_right(b), - 6 => a & b, - 7 => a | b, - 8 => a ^ b, - 9 => a.leading_zeros() + b.leading_zeros(), - _ => a.count_ones() + b.count_ones(), - } -} - -fn progpow_init(seed: u64) -> (Kiss99, [u32; PROGPOW_REGS], [u32; PROGPOW_REGS]) { - let z = fnv1a_hash(FNV_HASH, seed as u32); - let w = fnv1a_hash(z, (seed >> 32) as u32); - let jsr = fnv1a_hash(w, seed as u32); - let jcong = fnv1a_hash(jsr, (seed >> 32) as u32); - - let mut rnd = Kiss99::new(z, w, jsr, jcong); - - // Create a random sequence of mix destinations for merge() and mix sources - // for cache reads guarantees every destination merged once and guarantees - // no duplicate cache reads, which could be optimized away. Uses - // Fisher-Yates shuffle. - let mut mix_seq_dst = [0u32; PROGPOW_REGS]; - let mut mix_seq_cache = [0u32; PROGPOW_REGS]; - for i in 0..mix_seq_dst.len() { - mix_seq_dst[i] = i as u32; - mix_seq_cache[i] = i as u32; - } - - for i in (1..mix_seq_dst.len()).rev() { - let j = rnd.next_u32() as usize % (i + 1); - mix_seq_dst.swap(i, j); - - let j = rnd.next_u32() as usize % (i + 1); - mix_seq_cache.swap(i, j); - } - - (rnd, mix_seq_dst, mix_seq_cache) -} - -pub type CDag = [u32; PROGPOW_CACHE_WORDS]; - -fn progpow_loop( - seed: u64, - loop_: usize, - mix: &mut [[u32; PROGPOW_REGS]; PROGPOW_LANES], - cache: &[Node], - c_dag: &CDag, - data_size: usize, -) { - // All lanes share a base address for the global load. Global offset uses - // mix[0] to guarantee it depends on the load result. - let g_offset = mix[loop_ % PROGPOW_LANES][0] as usize % - (64 * data_size / (PROGPOW_LANES * PROGPOW_DAG_LOADS)); - - // 256 bytes of dag data - let mut dag_item = [0u32; 64]; - - // Fetch DAG nodes (64 bytes each) - for l in 0..PROGPOW_DAG_LOADS { - let index = g_offset * PROGPOW_LANES * PROGPOW_DAG_LOADS + l * 16; - let node = calculate_dag_item(index as u32 / 16, cache); - dag_item[l * 16..(l + 1) * 16].clone_from_slice(node.as_words()); - } - - let (rnd, mix_seq_dst, mix_seq_cache) = progpow_init(seed); - - // Lanes can execute in parallel and will be convergent - for l in 0..mix.len() { - let mut rnd = rnd.clone(); - - // Initialize the seed and mix destination sequence - let mut mix_seq_dst_cnt = 0; - let mut mix_seq_cache_cnt = 0; - - let mut mix_dst = || { - let res = mix_seq_dst[mix_seq_dst_cnt % PROGPOW_REGS] as usize; - mix_seq_dst_cnt += 1; - res - }; - let mut mix_cache = || { - let res = mix_seq_cache[mix_seq_cache_cnt % PROGPOW_REGS] as usize; - mix_seq_cache_cnt += 1; - res - }; - - for i in 0..PROGPOW_CNT_CACHE.max(PROGPOW_CNT_MATH) { - if i < PROGPOW_CNT_CACHE { - // Cached memory access, lanes access random 32-bit locations - // within the first portion of the DAG - let offset = mix[l][mix_cache()] as usize % PROGPOW_CACHE_WORDS; - let data = c_dag[offset]; - let dst = mix_dst(); - - mix[l][dst] = merge(mix[l][dst], data, rnd.next_u32()); - } - - if i < PROGPOW_CNT_MATH { - // Random math - // Generate 2 unique sources - let src_rnd = rnd.next_u32() % (PROGPOW_REGS * (PROGPOW_REGS - 1)) as u32; - let src1 = src_rnd % PROGPOW_REGS as u32; // 0 <= src1 < PROGPOW_REGS - let mut src2 = src_rnd / PROGPOW_REGS as u32; // 0 <= src2 < PROGPOW_REGS - 1 - if src2 >= src1 { - src2 += 1; // src2 is now any reg other than src1 - } - - let data = math(mix[l][src1 as usize], mix[l][src2 as usize], rnd.next_u32()); - let dst = mix_dst(); - - mix[l][dst] = merge(mix[l][dst], data, rnd.next_u32()); - } - } - - // Global load to sequential locations - let mut data_g = [0u32; PROGPOW_DAG_LOADS]; - let index = ((l ^ loop_) % PROGPOW_LANES) * PROGPOW_DAG_LOADS; - for i in 0..PROGPOW_DAG_LOADS { - data_g[i] = dag_item[index + i]; - } - - // Consume the global load data at the very end of the loop to allow - // full latency hiding. Always merge into `mix[0]` to feed the offset - // calculation. - mix[l][0] = merge(mix[l][0], data_g[0], rnd.next_u32()); - for i in 1..PROGPOW_DAG_LOADS { - let dst = mix_dst(); - mix[l][dst] = merge(mix[l][dst], data_g[i], rnd.next_u32()); - } - } -} - -pub fn progpow( - header_hash: H256, - nonce: u64, - block_number: u64, - cache: &[Node], - c_dag: &CDag, -) -> (H256, H256) { - let mut mix = [[0u32; PROGPOW_REGS]; PROGPOW_LANES]; - let mut lane_results = [0u32; PROGPOW_LANES]; - let mut result = [0u32; 8]; - - let data_size = get_data_size(block_number) / PROGPOW_MIX_BYTES; - - // NOTE: This assert is required to aid the optimizer elide the non-zero - // remainder check in `progpow_loop`. - assert!(data_size > 0); - - // Initialize mix for all lanes - let seed = keccak_f800_short(header_hash, nonce, result); - - for l in 0..mix.len() { - mix[l] = fill_mix(seed, l as u32); - } - - // Execute the randomly generated inner loop - let period = block_number / PROGPOW_PERIOD_LENGTH as u64; - for i in 0..PROGPOW_CNT_DAG { - progpow_loop( - period, - i, - &mut mix, - cache, - c_dag, - data_size, - ); - } - - // Reduce mix data to a single per-lane result - for l in 0..lane_results.len() { - lane_results[l] = FNV_HASH; - for i in 0..PROGPOW_REGS { - lane_results[l] = fnv1a_hash(lane_results[l], mix[l][i]); - } - } - - // Reduce all lanes to a single 128-bit result - result = [FNV_HASH; 8]; - for l in 0..PROGPOW_LANES { - result[l % 8] = fnv1a_hash(result[l % 8], lane_results[l]); - } - - let digest = keccak_f800_long(header_hash, seed, result); - - // NOTE: transmute from `[u32; 8]` to `[u8; 32]` - let result = unsafe { ::std::mem::transmute(result) }; - - (digest, result) -} - -pub fn generate_cdag(cache: &[Node]) -> CDag { - let mut c_dag = [0u32; PROGPOW_CACHE_WORDS]; - - for i in 0..PROGPOW_CACHE_WORDS / 16 { - let node = calculate_dag_item(i as u32, cache); - for j in 0..16 { - c_dag[i * 16 + j] = node.as_words()[j]; - } - } - - c_dag -} - -#[cfg(test)] -mod test { - use tempfile::TempDir; - - use common_types::engines::OptimizeFor; - use cache::NodeCacheBuilder; - use keccak::H256; - use rustc_hex::FromHex; - use serde_json::{self, Value}; - use std::collections::VecDeque; - use super::*; - - fn h256(hex: &str) -> H256 { - let bytes: Vec = FromHex::from_hex(hex).unwrap(); - let mut res = [0; 32]; - res.copy_from_slice(&bytes); - res - } - - #[test] - fn test_cdag() { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let cache = builder.new_cache(tempdir.into_path(), 0); - - let c_dag = generate_cdag(cache.as_ref()); - - let expected = vec![ - 690150178u32, 1181503948, 2248155602, 2118233073, 2193871115, - 1791778428, 1067701239, 724807309, 530799275, 3480325829, 3899029234, - 1998124059, 2541974622, 1100859971, 1297211151, 3268320000, 2217813733, - 2690422980, 3172863319, 2651064309 - ]; - - assert_eq!( - c_dag.iter().take(20).cloned().collect::>(), - expected, - ); - } - - #[test] - fn test_random_merge() { - let tests = [ - (1000000u32, 101u32, 33000101u32), - (2000000, 102, 66003366), - (3000000, 103, 6000103), - (4000000, 104, 2000104), - (1000000, 0, 33000000), - (2000000, 0, 66000000), - (3000000, 0, 6000000), - (4000000, 0, 2000000), - ]; - - for (i, &(a, b, expected)) in tests.iter().enumerate() { - assert_eq!( - merge(a, b, i as u32), - expected, - ); - } - } - - #[test] - fn test_random_math() { - let tests = [ - (20u32, 22u32, 42u32), - (70000, 80000, 1305032704), - (70000, 80000, 1), - (1, 2, 1), - (3, 10000, 196608), - (3, 0, 3), - (3, 6, 2), - (3, 6, 7), - (3, 6, 5), - (0, 0xffffffff, 32), - (3 << 13, 1 << 5, 3), - (22, 20, 42), - (80000, 70000, 1305032704), - (80000, 70000, 1), - (2, 1, 1), - (10000, 3, 80000), - (0, 3, 0), - (6, 3, 2), - (6, 3, 7), - (6, 3, 5), - (0, 0xffffffff, 32), - (3 << 13, 1 << 5, 3), - ]; - - for (i, &(a, b, expected)) in tests.iter().enumerate() { - assert_eq!( - math(a, b, i as u32), - expected, - ); - } - } - - #[test] - fn test_keccak_256() { - let expected = "5dd431e5fbc604f499bfa0232f45f8f142d0ff5178f539e5a7800bf0643697af"; - assert_eq!( - keccak_f800_long([0; 32], 0, [0; 8]), - h256(expected), - ); - } - - #[test] - fn test_keccak_64() { - let expected: u64 = 0x5dd431e5fbc604f4; - assert_eq!( - keccak_f800_short([0; 32], 0, [0; 8]), - expected, - ); - } - - #[test] - fn test_progpow_hash() { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let cache = builder.new_cache(tempdir.into_path(), 0); - let c_dag = generate_cdag(cache.as_ref()); - - let header_hash = [0; 32]; - - let (digest, result) = progpow( - header_hash, - 0, - 0, - cache.as_ref(), - &c_dag, - ); - - let expected_digest = hex!("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02"); - let expected_result = hex!("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743"); - - assert_eq!( - digest.to_vec(), - expected_digest, - ); - - assert_eq!( - result.to_vec(), - expected_result, - ); - } - - #[test] - fn test_progpow_testvectors() { - struct ProgpowTest { - block_number: u64, - header_hash: H256, - nonce: u64, - mix_hash: H256, - final_hash: H256, - } - - let tests: Vec> = - serde_json::from_slice(include_bytes!("../res/progpow_testvectors.json")).unwrap(); - - let tests: Vec = tests.into_iter().map(|mut test: VecDeque| { - assert!(test.len() == 5); - - let block_number: u64 = serde_json::from_value(test.pop_front().unwrap()).unwrap(); - let header_hash: String = serde_json::from_value(test.pop_front().unwrap()).unwrap(); - let nonce: String = serde_json::from_value(test.pop_front().unwrap()).unwrap(); - let mix_hash: String = serde_json::from_value(test.pop_front().unwrap()).unwrap(); - let final_hash: String = serde_json::from_value(test.pop_front().unwrap()).unwrap(); - - ProgpowTest { - block_number, - header_hash: h256(&header_hash), - nonce: u64::from_str_radix(&nonce, 16).unwrap(), - mix_hash: h256(&mix_hash), - final_hash: h256(&final_hash), - } - }).collect(); - - for test in tests { - let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value()); - let tempdir = TempDir::new().unwrap(); - let cache = builder.new_cache(tempdir.path().to_owned(), test.block_number); - let c_dag = generate_cdag(cache.as_ref()); - - let (digest, result) = progpow( - test.header_hash, - test.nonce, - test.block_number, - cache.as_ref(), - &c_dag, - ); - - assert_eq!(digest, test.final_hash); - assert_eq!(result, test.mix_hash); - } - } -} diff --git a/ethcore/engines/ethash/src/lib.rs b/ethcore/engines/ethash/src/lib.rs index 13404d35fac..c9f6fa49e32 100644 --- a/ethcore/engines/ethash/src/lib.rs +++ b/ethcore/engines/ethash/src/lib.rs @@ -89,8 +89,6 @@ pub struct EthashParams { pub block_reward_contract: Option, /// Difficulty bomb delays. pub difficulty_bomb_delays: BTreeMap, - /// Block to transition to progpow - pub progpow_transition: u64, } impl From for EthashParams { @@ -131,7 +129,6 @@ impl From for EthashParams { }), expip2_transition: p.expip2_transition.map_or(u64::max_value(), Into::into), expip2_duration_limit: p.expip2_duration_limit.map_or(30, Into::into), - progpow_transition: p.progpow_transition.map_or(u64::max_value(), Into::into), block_reward_contract_transition: p.block_reward_contract_transition.map_or(0, Into::into), block_reward_contract: match (p.block_reward_contract_code, p.block_reward_contract_address) { (Some(code), _) => Some(BlockRewardContract::new_from_code(Arc::new(code.into()))), @@ -161,15 +158,12 @@ impl Ethash { machine: Machine, optimize_for: T, ) -> Self { - let progpow_transition = ethash_params.progpow_transition; - Ethash { ethash_params, machine, pow: Arc::new(EthashManager::new( cache_dir.as_ref(), optimize_for.into(), - progpow_transition )), } } @@ -342,7 +336,6 @@ impl Engine for Ethash { &header.bare_hash().0, seal.nonce.to_low_u64_be(), &seal.mix_hash.0, - header.number() >= self.ethash_params.progpow_transition ))); if &difficulty < header.difficulty() { @@ -559,7 +552,6 @@ mod tests { block_reward_contract: None, block_reward_contract_transition: 0, difficulty_bomb_delays: BTreeMap::new(), - progpow_transition: u64::max_value(), } } diff --git a/ethcore/res/ethereum/ethercore.json b/ethcore/res/ethereum/ethercore.json deleted file mode 100644 index 16091ac3574..00000000000 --- a/ethcore/res/ethereum/ethercore.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "name": "EtherCore", - "dataDir": "ethercore", - "engine": { - "Ethash": { - "params": { - "minimumDifficulty": "0x20000", - "difficultyBoundDivisor": "0x800", - "durationLimit": "0xd", - "blockReward": "0xde0b6b3a7640000", - "homesteadTransition": "0x0", - "eip100bTransition": "0x0", - "bombDefuseTransition":"0x0", - "ecip1017EraRounds":"0x5f5e100", - "progpowTransition": "0x0" - } - } - }, - "params": { - "gasLimitBoundDivisor": "0x400", - "accountStartNonce": "0x0", - "maximumExtraDataSize": "0x20", - "minGasLimit": "0x1388", - "networkID": "0x1d2", - "eip150Transition": "0x0", - "eip160Transition": "0x0", - "eip161abcTransition": "0x0", - "eip161dTransition": "0x0", - "eip155Transition": "0x0", - "maxCodeSize":"0x6000", - "maxCodeSizeTransition":"0x0", - "eip140Transition": "0x0", - "eip211Transition": "0x0", - "eip214Transition": "0x0", - "eip658Transition": "0x0", - "eip145Transition": "0x0", - "eip1014Transition": "0x0", - "eip1052Transition": "0x0", - "eip1283Transition": "0x0", - "eip1344Transition": "0x0", - "eip1706Transition": "0x0", - "eip1884Transition": "0x0", - "eip2028Transition": "0x0" - }, - "genesis": { - "seal": { - "ethereum": { - "nonce": "0x0000000000000042", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - }, - "difficulty": "0x80000", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x5e0be100", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", - "gasLimit": "0x7a1200" - }, - "nodes": [ - "enode://dfcfd268e7d4631cec5a94d7eeb5981a2ed3f30235c774e1bf0a4e843672405e5a1c93502e1631edf108b6f1ea8701fb97e6d892eb5e3775c70dc53b2f773b9f@207.148.105.65:30303", - "enode://6c67afac3a018ee5641b0aba996f180fbb718aa7857174cad568b00440a43cccb1845124cd1cbe43c7ce1e95d597a3d20d175f0bf8494d875e83ec15e0f42cb4@207.148.105.65:30503" - ], - "accounts": { - "0x0000000000000000000000000000000000000001":{ - "builtin":{ - "name":"ecrecover", - "pricing":{ - "linear":{ - "base":3000, - "word":0 - } - } - } - }, - "0x0000000000000000000000000000000000000002":{ - "builtin":{ - "name":"sha256", - "pricing":{ - "linear":{ - "base":60, - "word":12 - } - } - } - }, - "0x0000000000000000000000000000000000000003":{ - "builtin":{ - "name":"ripemd160", - "pricing":{ - "linear":{ - "base":600, - "word":120 - } - } - } - }, - "0x0000000000000000000000000000000000000004":{ - "builtin":{ - "name":"identity", - "pricing":{ - "linear":{ - "base":15, - "word":3 - } - } - } - }, - "0x0000000000000000000000000000000000000005":{ - "builtin":{ - "name":"modexp", - "activate_at":"0x0", - "pricing":{ - "modexp":{ - "divisor":20 - } - } - } - }, - "0x0000000000000000000000000000000000000006":{ - "builtin":{ - "name":"alt_bn128_add", - "pricing":{ - "0x0":{ - "info":"EIP 1108 transition", - "price":{ - "alt_bn128_const_operations":{ - "price":150 - } - } - } - } - } - }, - "0x0000000000000000000000000000000000000007":{ - "builtin":{ - "name":"alt_bn128_mul", - "pricing":{ - "0x0":{ - "info":"EIP 1108 transition", - "price":{ - "alt_bn128_const_operations":{ - "price":6000 - } - } - } - } - } - }, - "0x0000000000000000000000000000000000000008":{ - "builtin":{ - "name":"alt_bn128_pairing", - "pricing":{ - "0x0":{ - "info":"EIP 1108 transition", - "price":{ - "alt_bn128_pairing":{ - "base":45000, - "pair":34000 - } - } - } - } - } - }, - "0x0000000000000000000000000000000000000009":{ - "builtin":{ - "name":"blake2_f", - "activate_at":"0x0", - "pricing":{ - "blake2_f":{ - "gas_per_round":1 - } - } - } - }, - "0xaf6F001FdB3CD98CD38A3f6C7306706D98689dF0":{ - "balance":"0x295be96e64066972000000" - }, - "0xf182a7D9e7789E82e362A98eBC5fCAcdC2904182":{ - "balance":"0x295be96e64066972000000" - }, - "0x5A23b7d2ee9dccbb7C33103d22852e1cC88548b2":{ - "balance":"0xf8277896582678ac000000" - }, - "0x22e0176a4aDD34A2a32B4423437B6cf23F7dc638":{ - "balance":"0x6342fd08f00f6378000000" - } - } -} diff --git a/ethcore/spec/src/chain.rs b/ethcore/spec/src/chain.rs index fe7ca8d5ad4..403e6d70fd6 100644 --- a/ethcore/spec/src/chain.rs +++ b/ethcore/spec/src/chain.rs @@ -77,7 +77,6 @@ bundle_release_spec! { "ethereum/classic" => new_classic, "ethereum/classic_no_phoenix" => new_classic_no_phoenix, "ethereum/ellaism" => new_ellaism, - "ethereum/ethercore" => new_ethercore, "ethereum/evancore" => new_evancore, "ethereum/evantestcore" => new_evantestcore, "ethereum/ewc" => new_ewc, diff --git a/ethcore/verification/benches/verification.rs b/ethcore/verification/benches/verification.rs index 3d07ef5bf9a..137f0c1b048 100644 --- a/ethcore/verification/benches/verification.rs +++ b/ethcore/verification/benches/verification.rs @@ -65,7 +65,6 @@ fn ethash_params() -> EthashParams { m.insert(7280000, 2000000); m }, - progpow_transition: u64::max_value() } } diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index 1c1dc870f70..08face59840 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -101,8 +101,6 @@ pub struct EthashParams { pub expip2_transition: Option, /// EXPIP-2 duration limit pub expip2_duration_limit: Option, - /// Block to transition to progpow - pub progpow_transition: Option, } /// Ethash engine deserialization. @@ -206,7 +204,6 @@ mod tests { ecip1017_era_rounds: None, expip2_transition: None, expip2_duration_limit: None, - progpow_transition: None, difficulty_bomb_delays: None, } }); @@ -246,7 +243,6 @@ mod tests { ecip1017_era_rounds: None, expip2_transition: None, expip2_duration_limit: None, - progpow_transition: None, difficulty_bomb_delays: None, } }); diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 0d61a12cf96..b4796f9e60a 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -300,7 +300,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, classic-no-phoenix, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, ethercore, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, evantestcore, evancore or dev.", + "Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, classic, classic-no-phoenix, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, mordor, ropsten, kovan, rinkeby, goerli, kotti, poasokol, testnet, evantestcore, evancore 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 8dfd0017cc3..6f8347ca961 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -44,7 +44,6 @@ pub enum SpecType { Ellaism, Mix, Callisto, - EtherCore, Mordor, Ropsten, Kovan, @@ -81,7 +80,6 @@ impl str::FromStr for SpecType { "ellaism" => SpecType::Ellaism, "mix" => SpecType::Mix, "callisto" => SpecType::Callisto, - "ethercore" => SpecType::EtherCore, "mordor" | "classic-testnet" => SpecType::Mordor, "ropsten" => SpecType::Ropsten, "kovan" => SpecType::Kovan, @@ -112,7 +110,6 @@ impl fmt::Display for SpecType { SpecType::Ellaism => "ellaism", SpecType::Mix => "mix", SpecType::Callisto => "callisto", - SpecType::EtherCore => "ethercore", SpecType::Mordor => "mordor", SpecType::Ropsten => "ropsten", SpecType::Kovan => "kovan", @@ -143,7 +140,6 @@ impl SpecType { SpecType::Ellaism => Ok(spec::new_ellaism(params)), SpecType::Mix => Ok(spec::new_mix(params)), SpecType::Callisto => Ok(spec::new_callisto(params)), - SpecType::EtherCore => Ok(spec::new_ethercore(params)), SpecType::Mordor => Ok(spec::new_mordor(params)), SpecType::Ropsten => Ok(spec::new_ropsten(params)), SpecType::Kovan => Ok(spec::new_kovan(params)), @@ -402,7 +398,6 @@ mod tests { assert_eq!(SpecType::Ellaism, "ellaism".parse().unwrap()); assert_eq!(SpecType::Mix, "mix".parse().unwrap()); assert_eq!(SpecType::Callisto, "callisto".parse().unwrap()); - assert_eq!(SpecType::EtherCore, "ethercore".parse().unwrap()); assert_eq!(SpecType::Mordor, "mordor".parse().unwrap()); assert_eq!(SpecType::Mordor, "classic-testnet".parse().unwrap()); assert_eq!(SpecType::Ropsten, "ropsten".parse().unwrap()); @@ -435,7 +430,6 @@ mod tests { assert_eq!(format!("{}", SpecType::Ellaism), "ellaism"); assert_eq!(format!("{}", SpecType::Mix), "mix"); assert_eq!(format!("{}", SpecType::Callisto), "callisto"); - assert_eq!(format!("{}", SpecType::EtherCore), "ethercore"); assert_eq!(format!("{}", SpecType::Mordor), "mordor"); assert_eq!(format!("{}", SpecType::Ropsten), "ropsten"); assert_eq!(format!("{}", SpecType::Kovan), "kovan");