This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ethash: implement Progpow #9762
Merged
Merged
Changes from 31 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
2522e67
ethash: initial implementation of progpow
andresilva 61f1922
progpow: use wrapping arithmetic
andresilva 7c64f93
progpow: cleanup comments
andresilva 4700ee8
progpow: fix keccak_f800
andresilva d252dd1
progpow: reorder definitions
andresilva fde1d2e
progpow: general fixing
andresilva 3a37dc4
progpow: add basic tests from geth
andresilva 2b14323
progpow: generate c_dag and add test
andresilva af1c0f6
progpow: fix progpow_init and progpow_loop
andresilva 526daa6
progpow: fix and add new test
andresilva a19aa8d
progpow: tabify
andresilva 7303491
progpow: add shared testvectors from geth and aleth
andresilva 7630b33
progpow: add benchmarks
andresilva afe53ff
progpow: don't read bytes from dag
andresilva 2fa0b3e
ethash: use criterion for progpow benchmarks
andresilva 54a32a3
progpow: dont borrow hash on fnv1a_hash
andresilva 025bc14
progpow: don't borrow operand on progpow merge
andresilva 408d35e
progpow: hardcode dag lookup function
andresilva ae2d37e
progpow: read double words directly from the dag
andresilva e881d1f
progpow: inline some small functions
andresilva 2f0c1a9
progpow: remove some bounds checking from the main loop
andresilva 6c95cc8
progpow: remove unreachable match cases
andresilva 2c28dc6
progpow: remove bounds check in keccak_f800_round
andresilva e22a9c3
progpow: fix ptr::swap
andresilva 0e53756
progpow: force loop unroll in keccak_f800_round
andresilva 7b77ab5
progpow: remove unnecessary branching in progpow_loop
andresilva 9a9c710
progpow: force loop unroll in fill_mix
andresilva 85c14cd
progpow: silence unused warning
andresilva a927d0b
progpow: dont run last keccak_f800_round out of the loop
andresilva 2fc39b7
progpow: fix output of keccak_f800_short
andresilva e5c7d16
ethcore: support progpow in ethash engine
andresilva ecf937a
ethash: fix typo
andresilva 04c5a8c
ethcore, ethash: fix tests
andresilva c5dc35a
json: fix ethash spec tests
andresilva a21993a
ethash: update quick_get_difficulty for progpow
andresilva 9514419
ethash: drop light cache on progpow transition block
andresilva 7c8873d
ethash: fix quick_get_difficulty tests
andresilva 46aa1d4
progpow: update to spec v0.9.0
andresilva 5f3c7be
progpow: update to spec v0.9.1
andresilva 42b5194
progpow: update to spec v0.9.2
andresilva c8d074f
Merge branch 'master' into andre/progpow
andresilva af81890
ethash: rename progpow benchmarks
andresilva 665e765
fix Cargo.lock bad merge
andresilva 7afd3dc
Merge branch 'master' into andre/progpow
andresilva c7467b3
Merge branch 'master' into andre/progpow
andresilva 4c00879
ethash: only export modules for benchmarks
andresilva 89308fe
ethash: progpow: remove unsafe unchecked indexing
andresilva 01bb1b5
ethash: create enum for pow algorithm
andresilva fea5b57
ethash: box the progpow cdag
andresilva 0ca3119
ethash: skip slow progpow test vectors on ci
andresilva da02f9b
ethash: don't skip progpow test vectors
andresilva e30bd98
ethash: progpow: update copyright date
niklasad1 06551ce
ethcore: remove verification of ci-skip-tests on non-test builds
andresilva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#[macro_use] | ||
extern crate criterion; | ||
extern crate ethash; | ||
extern crate rustc_hex; | ||
extern crate tempdir; | ||
|
||
use criterion::Criterion; | ||
use ethash::progpow; | ||
|
||
|
||
use tempdir::TempDir; | ||
use rustc_hex::FromHex; | ||
use ethash::{NodeCacheBuilder, OptimizeFor}; | ||
use ethash::compute::light_compute; | ||
|
||
fn bench_hashimoto_light(c: &mut Criterion) { | ||
let builder = NodeCacheBuilder::new(OptimizeFor::Memory); | ||
let tempdir = TempDir::new("").unwrap(); | ||
let light = builder.light(&tempdir.path(), 1); | ||
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); | ||
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); | ||
let tempdir = TempDir::new("").unwrap(); | ||
let cache = builder.new_cache(tempdir.into_path(), 0); | ||
|
||
let h = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); | ||
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); | ||
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 = FromHex::from_hex("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f").unwrap(); | ||
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); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using
hex!
fromhex_literal
.