Commit Graph

34 Commits

Author SHA1 Message Date
Andronik Ordian
5a131175e8
[ethash] remove mem::uninitialized (#10861)
* [ethash] replace mem::uninitialized with MaybeUninit

* [ethash] replace another occurence of mem::uninitialized

* [ethash] remove last mem::uninitialized

* [ethash] clean up benches

* [ethash] update outdated comment

* [ethash] compile error on big endian targets

* [ethash] extract 32 into a constant

* [ethash] rename the constant to KECCAK_LEN

* [ethash] bench quick_get_difficulty

* [ethash] remove MaybeUninit completely

* [ethash] replace ptr::copy_nonoverlapping with copy_from_slice

* [ethash] s/header_len/hash_len

* [ethash] remove duplication in bench

* [ethash] add a config for basic benches

* [ethash] fix a typo in bench fn name

* [ethash] remove needless cast
2019-07-12 10:04:41 +02:00
André Silva
b457f46c81 ethash: implement Progpow (#9762)
* ethash: initial implementation of progpow

* progpow: use wrapping arithmetic

* progpow: cleanup comments

* progpow: fix keccak_f800

* progpow: reorder definitions

* progpow: general fixing

* progpow: add basic tests from geth

* progpow: generate c_dag and add test

* progpow: fix progpow_init and progpow_loop

* progpow: fix and add new test

* progpow: tabify

* progpow: add shared testvectors from geth and aleth

* progpow: add benchmarks

* progpow: don't read bytes from dag

* ethash: use criterion for progpow benchmarks

* progpow: dont borrow hash on fnv1a_hash

* progpow: don't borrow operand on progpow merge

* progpow: hardcode dag lookup function

we only support light verification anyway

* progpow: read double words directly from the dag

* progpow: inline some small functions

* progpow: remove some bounds checking from the main loop

* progpow: remove unreachable match cases

* progpow: remove bounds check in keccak_f800_round

* progpow: fix ptr::swap

* progpow: force loop unroll in keccak_f800_round

* progpow: remove unnecessary branching in progpow_loop

* progpow: force loop unroll in fill_mix

* progpow: silence unused warning

* progpow: dont run last keccak_f800_round out of the loop

rustc generates the same assembly, it unrolls the loop

* progpow: fix output of keccak_f800_short

* ethcore: support progpow in ethash engine

* ethash: fix typo

* ethcore, ethash: fix tests

* json: fix ethash spec tests

* ethash: update quick_get_difficulty for progpow

* ethash: drop light cache on progpow transition block

* ethash: fix quick_get_difficulty tests

* progpow: update to spec v0.9.0

* progpow: update to spec v0.9.1

* progpow: update to spec v0.9.2

* ethash: rename progpow benchmarks

* fix Cargo.lock bad merge

* ethash: only export modules for benchmarks

* ethash: progpow: remove unsafe unchecked indexing

* ethash: create enum for pow algorithm

* ethash: box the progpow cdag

* ethash: skip slow progpow test vectors on ci

* ethash: don't skip progpow test vectors

they don't take too long when running in release mode which is the case
for CI.

* ethash: progpow: update copyright date

Co-Authored-By: andresilva <andre.beat@gmail.com>

* ethcore: remove verification of ci-skip-tests on non-test builds
2019-02-20 10:05:11 +01:00
Afri Schoedon
7c335e8764
misc: bump license header to 2019 (#10135)
* misc: bump license header to 2019

* misc: remove_duplicate_empty_lines.sh

* misc: run license header script

* commit cargo lock
2019-01-07 11:33:07 +01:00
Niklas Adolfsson
0cd1de769b Eliminate some more transmute() (#8879)
* eliminate some more transmute()

* Address `review comments`

* Make unsafe block smaller
* Use different byte-order than `std`, read words as big endian instead
of little endian!

* Fix IpAddresses nits

* Use `from_be` to work both for big and little endian
* Ipv6 addresses were incorrectly `transmuted`

* remove needless lifetime annotation
2018-06-22 12:51:53 +01:00
Niklas Adolfsson
98b7c07171 Update license header and scripts (#8666)
* Update `add_license` script

* run script

* add `remove duplicate lines script` and run it

* Revert changes `English spaces`

* strip whitespaces

* Revert `GPL` in files with `apache/mit license`

* don't append `gpl license` in files with other lic

* Don't append `gpl header` in files with other lic.

* re-ran script

* include c and cpp files too

* remove duplicate header

* rebase nit
2018-06-04 10:19:50 +02:00
Niklas Adolfsson
1020560af6 Remove a couple of unnecessary transmute() (#8736) 2018-05-31 13:39:25 +02:00
Niklas Adolfsson
23fc5517b5 Replace std::env::temp_dir with tempdir in tests (#8103)
* std::env::temp_dir -> tempdir in test context

* fix lifetime issue so tempdir removes tmpfiles
2018-03-14 12:26:20 +01:00
Jef
5c08698fa0 Use memmap for dag cache (#6193)
* Rebase and fix compilation errors (tests not yet fixed)

* Use `debug_assert` over `assert`

* Fix tests

* Assert safety, clean up

* Fix up stale cache removal, move one assert to debug_assert

* Remove printlns

* Add licenses

* Fix benches

* Inline some no-ops in a hot loop that weren't being inlined

* Add spooky comment to make sure no-one removes the inlining annotations

* Minor cleanup

* Add option to switch between mmap and ram

* Flag ethash to use less memory when running light client

* Fix tests

* Remove todo comment (it's done)

* Replace assertion with error return

* Fix indentation

* Use union instead of `transmute`

* Fix benches

* Extract to constants

* Clean up and fix soundness holes

* Fix formatting

* Ignore missing-file errors

* Make incorrect cache size an error condition instead of a panic, remove dead code

* Fix compilation errors from rebase

* Fix compilation errors in tests

* Fix compilation errors in tests
2017-09-25 19:45:33 +02:00
debris
e9cc4c848b replace sha3 with keccak in few comments 2017-08-31 15:25:30 +02:00
debris
f0e8abb07b Hashable::sha3 -> fn keccak for ethcore 2017-08-30 19:18:28 +02:00
Jef
e84f308264 Fix unsoundness in ethash's unsafe code (#6140)
* Fix benchmarks

* Fix unsoundness in uses of unsafety

* Remove most uses of unsafe indexing and ptr::copy_nonoverlapping

This commit also includes a completely absurd optimisation that I
promise is an honest win. You can check the benchmarks, I barely
believe it myself.

* Add safety comment

* Add more safety comments
2017-07-28 14:26:22 +02:00
Robert Habermeier
079b24175c Merge pull request #6080 from Vurich/ethash
Unroll loops in light_compute
2017-07-24 13:09:31 +02:00
Vurich
7208b9b525 Small fixes 2017-07-19 18:14:10 +02:00
Vurich
ad1835e87c Unroll 1 more loop 2017-07-19 16:21:55 +02:00
Vurich
2cc1c92901 Unroll one more loop
I also tried unrolling the 256-iteration loop further below, but it actually caused a
slowdown (my guess is either branch prediction stopped kicking in or the instruction
cache was being maculated).
2017-07-19 12:07:34 +02:00
Vurich
d51958dbf5 Speed up light_compute by ~9% 2017-07-18 15:38:10 +02:00
Tomasz Drwięga
a24b6ad983 Use standard paths for Ethash cache (#5881)
* Use cache path to store ethash files.

* Fixing tests, more flexible API.

* Use AsRef<Path> everywhere.

* Fixing ethcore tests.

* Fix RPC tests.
2017-07-10 12:57:40 +02:00
Arkadiy Paronyan
da2f684f18 Memory usage optimization (#5526) 2017-05-02 11:40:03 +02:00
Gav Wood
8404edb656 Fix whitespace (#4299)
* Fix whitespace.

* Update copyright years/owner.

* Push release only for tags.
2017-01-25 18:51:41 +01:00
Robert Habermeier
8125b5690c Port try macro to new ? operator. (#3962)
* initial untry sweep

* restore try in ipc codegen, fix inference

* change a few missed try instances
2016-12-27 12:53:56 +01:00
Gav Wood
17cc2be4b5
Rename ethcore -> parity in license. 2016-12-11 19:30:54 +01:00
Gav Wood
bb96849620 Revert #2172, pretty much. (#2387)
* Revert #2172, pretty much.

* Tidy up whitespace.

[ci:skip]

* Force CI.
2016-09-28 23:31:59 +02:00
Robert Habermeier
f8f39c4369 check for existence of deprecated ethash file before attempting delete (#2103) 2016-09-16 08:57:38 +02:00
kristoffer
2ba4968cd5 Remove old cache data (#2081) 2016-09-14 12:02:52 +02:00
Arkadiy Paronyan
5ab18d1313 Performance optimizations (#1642)
* Optimize ethash verification

* disable WAL for puts

* Clear account cache after commit

* Commit only modified accounts

* Optimize existing block check

* Cache last hashes
2016-07-17 09:18:15 +02:00
Robert Habermeier
36d3d0d7d7 replace synchronization primitives with those from parking_lot (#1593)
* parking_lot in cargo.toml

* replace all lock invocations with parking_lot ones

* use parking_lot synchronization primitives
2016-07-13 19:59:59 +02:00
Tomasz Drwięga
3ce2374aeb Disable long lines formatting (#939) 2016-04-12 15:06:02 -07:00
Peter
9655ce8dbf Caching for computing seed hashes (#541)
Code review changes
2016-03-27 20:42:24 +01:00
Gav Wood
ffc5c2ea7b eth_getwork implemented. 2016-02-29 19:30:13 +01:00
Peter
ce81a24bfd Tests for issue #161
Implementations of get_cache_size and get_data_size in Rust (issue #161)
Removed sizes module, containing replaced data tables

Fixed whitespace issues after code review
2016-02-21 02:11:09 +00:00
debris
c90d64662a added license in every *.rs file 2016-02-05 13:40:41 +01:00
arkpar
ead16110bb Ethash disk cache 2016-01-30 23:02:55 +01:00
arkpar
77d2303b55 Use sha3 crate in ethash 2016-01-18 16:05:45 +01:00
arkpar
e39e7491b8 Use ethash for verification 2016-01-17 12:00:34 +01:00