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

Remove ProgPoW and EtherCore #11658

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Replacing `<spec>` 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
```
Expand Down
7 changes: 1 addition & 6 deletions ethash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
description = "OpenEthereum Ethash & ProgPoW Implementations"
description = "OpenEthereum Ethash Implementation"
name = "ethash"
version = "1.12.0"
authors = ["Parity Technologies <admin@parity.io>"]
Expand Down Expand Up @@ -30,8 +30,3 @@ bench = []
name = "basic"
harness = false
required-features = ['bench']

[[bench]]
name = "progpow"
harness = false
required-features = ['bench']
30 changes: 15 additions & 15 deletions ethash/benches/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,38 @@ 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);
}));
}

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);
}));
}

Expand All @@ -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);
}));
}

Expand All @@ -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,
Expand Down
106 changes: 0 additions & 106 deletions ethash/benches/progpow.rs

This file was deleted.

8 changes: 3 additions & 5 deletions ethash/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ pub struct NodeCacheBuilder {
// TODO: Remove this locking and just use an `Rc`?
seedhash: Arc<Mutex<SeedHashCompute>>,
optimize_for: OptimizeFor,
progpow_transition: u64,
}

// TODO: Abstract the "optimize for" logic
Expand All @@ -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> {
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<T: Into<Option<OptimizeFor>>>(optimize_for: T, progpow_transition: u64) -> Self {
pub fn new<T: Into<Option<OptimizeFor>>>(optimize_for: T) -> Self {
NodeCacheBuilder {
seedhash: Arc::new(Mutex::new(SeedHashCompute::default())),
optimize_for: optimize_for.into().unwrap_or_default(),
progpow_transition
}
}

Expand Down
Loading