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

Move util into here #153

Merged
merged 545 commits into from
Jan 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
545 commits
Select commit Hold shift + click to select a range
4419924
decoder refactor applied
debris Dec 7, 2015
701aaf1
fixed rlp reexports
debris Dec 7, 2015
51eff23
rlpstream separated to its own submodule
debris Dec 8, 2015
4e79fc6
Merge branch 'master' of https://github.com/gavofyork/ethcore-util in…
debris Dec 8, 2015
db762c5
docs tests are passing
debris Dec 8, 2015
36c586e
final changes in rlp refactor
debris Dec 8, 2015
d5ab429
changed order of reexports
debris Dec 8, 2015
1c58ba4
.
debris Dec 8, 2015
b657a15
val_at rlp method
debris Dec 8, 2015
0bf6d03
Merge pull request #11 from gavofyork/rlp_refactor
arkpar Dec 8, 2015
0e343d0
rlp encodable and decodable for options
debris Dec 8, 2015
f10e72c
fixed rlp benchmarks, added triehash benchmarks
debris Dec 9, 2015
d2b1b92
removed unused macros.rs
debris Dec 9, 2015
6db1240
fixed uint multiplication
debris Dec 9, 2015
74b2269
Merge pull request #12 from gavofyork/fixed_multiplication
debris Dec 9, 2015
1a40416
Makefile for cross-compilation
debris Dec 10, 2015
4210b95
triedb db is borrowed instead of being owned
debris Dec 10, 2015
8c9fe2f
fixed benches
debris Dec 10, 2015
b487f8f
TrieDB root is borrowed
debris Dec 11, 2015
f19d044
renamed new_pre_existing to new_existing
debris Dec 11, 2015
45ee748
fixed trie benches
debris Dec 11, 2015
03a3ebf
Merge pull request #14 from gavofyork/borrowed_db
debris Dec 11, 2015
16cadf1
hash for uint
debris Dec 11, 2015
862702b
implemented rem, lenient from_str, from_dec_str for uint
debris Dec 12, 2015
38f813a
fast mul by 10
debris Dec 12, 2015
6bc56ad
added raw method to RlpStream. usefull for quicklookup
debris Dec 12, 2015
d94c551
Trie takes a reference to HashDB.
gavofyork Dec 13, 2015
dc4f3fe
Merge pull request #15 from gavofyork/ddtrie
debris Dec 13, 2015
83af940
h264
debris Dec 13, 2015
fed599f
Merge branch 'master' of https://github.com/gavofyork/ethcore-util in…
debris Dec 13, 2015
d88c4db
Merge pull request #16 from gavofyork/hash_changes
Dec 13, 2015
de4a227
decoding fixed sized arrays
debris Dec 14, 2015
9231bc6
read_list -> as_list
debris Dec 14, 2015
c7768e1
Merge pull request #17 from gavofyork/rlp_array
Dec 14, 2015
1e6694e
removed unused stuff
debris Dec 15, 2015
ca1a6bd
heapsize && squeeze
debris Dec 16, 2015
56de081
squeeze is pub
debris Dec 16, 2015
926efb6
docs, tests and bugfixes for squeeze
debris Dec 16, 2015
16bcb42
Merge pull request #18 from gavofyork/heapsize
Dec 16, 2015
a9bd050
Net service
arkpar Dec 17, 2015
ba4620b
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Dec 17, 2015
674c667
Rename Trie to TrieMut in preparation for immutable trie.
gavofyork Dec 17, 2015
2a5c666
Trie (immutable).
gavofyork Dec 17, 2015
6e4850d
updated for new RLP interface
arkpar Dec 17, 2015
f7ee943
more convinient creation of uint
debris Dec 18, 2015
80cdde2
Renamed RLP's generic submodules to prevent systematic name clashing.
gavofyork Dec 19, 2015
cc192b2
Merge remote-tracking branch 'origin/master' into triemut
gavofyork Dec 19, 2015
0addfc1
Add tests for triedb, optimise tests for triedbmut.
gavofyork Dec 19, 2015
58b68e0
Merge pull request #21 from gavofyork/triemut
arkpar Dec 19, 2015
900fc83
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Dec 19, 2015
72a24ad
SemanticVersion struct.
gavofyork Dec 20, 2015
a8586f6
Merge pull request #22 from gavofyork/gav
debris Dec 20, 2015
7ed49be
Merge pull request #20 from gavofyork/uint
Dec 20, 2015
33a3a96
Merge remote-tracking branch 'origin/master' into gav
gavofyork Dec 20, 2015
be2b041
fixed semantic version tests
debris Dec 21, 2015
9220e0c
missing Error case
debris Dec 21, 2015
f34b22c
cache item count in Rlp
arkpar Dec 22, 2015
3ad262e
more networking
arkpar Dec 22, 2015
416c2ec
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Dec 22, 2015
88debb2
address to and from h256
debris Dec 23, 2015
fa1b74f
minor fixes
arkpar Dec 26, 2015
634b6be
fixed warnings
arkpar Dec 26, 2015
267495c
User IO messages
arkpar Dec 28, 2015
9e0c8e3
Documentation
arkpar Dec 30, 2015
8be769d
fix rocksdb version
debris Dec 31, 2015
a36072f
Merge branch 'master' into to_from_address
debris Dec 31, 2015
cad1aed
Merge pull request #23 from gavofyork/to_from_address
arkpar Jan 3, 2016
2cdf4eb
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 3, 2016
32fcc6b
Removed fmt file
arkpar Jan 3, 2016
39f2dc9
Style
arkpar Jan 4, 2016
73405cc
Fixed timeout signature; Added usage example
arkpar Jan 4, 2016
0125125
Semantic version test fix.
gavofyork Jan 5, 2016
8bf03bb
Secure trie functions & structs.
gavofyork Jan 6, 2016
be7bfd5
Merge branch 'master' into gav
gavofyork Jan 6, 2016
398231f
Additional missing struct stuff.
gavofyork Jan 6, 2016
5423797
Build fix.
gavofyork Jan 6, 2016
954c026
Merge pull request #25 from gavofyork/gav
arkpar Jan 7, 2016
5fc87a3
Additional work & convenience functions on crypto, bytes & hash.
gavofyork Jan 7, 2016
51ccd5e
Comment TODO.
gavofyork Jan 7, 2016
9a4da23
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 7, 2016
d4cbad1
Merge pull request #26 from gavofyork/gav
debris Jan 7, 2016
806de37
Additional docs.
gavofyork Jan 8, 2016
20017b8
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 8, 2016
f0da76d
API cleanups.
gavofyork Jan 8, 2016
3018c4a
Additional Populatable API tweaks.
gavofyork Jan 8, 2016
f81fb2d
Fix and some tests for opaque types in populatable.
gavofyork Jan 8, 2016
e4ed646
Fixes and renaming fax->copy.
gavofyork Jan 8, 2016
288794f
Style
arkpar Jan 8, 2016
1ffd999
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 8, 2016
e6623c0
Removed wrong file
arkpar Jan 8, 2016
396a175
More style
arkpar Jan 8, 2016
469b0a1
More style
arkpar Jan 8, 2016
41cb813
Merge pull request #27 from gavofyork/gav
debris Jan 8, 2016
9286a03
Even more style
arkpar Jan 8, 2016
647ea28
Renamed RlpStream::raw to as_raw
arkpar Jan 8, 2016
d7fe922
Fix API,
gavofyork Jan 8, 2016
1124ad2
Merge pull request #28 from gavofyork/gav
arkpar Jan 8, 2016
49d97d7
is_zero for hash types
arkpar Jan 9, 2016
6183ba5
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 9, 2016
02c60ac
Fixed build after merge
arkpar Jan 9, 2016
24ba723
Do not expose sha3 from crypto
arkpar Jan 9, 2016
11c244a
Merge pull request #24 from gavofyork/network
Jan 9, 2016
2b90f7d
Introduce use-dependency amalgamation. We now have:
gavofyork Jan 9, 2016
6eac110
Merge branch 'master' into gav
gavofyork Jan 9, 2016
ebe554d
Merge pull request #29 from gavofyork/gav
arkpar Jan 9, 2016
88810a5
Merge branch 'master' into gav
gavofyork Jan 9, 2016
568d28e
Bitwise Or Assign and some additional convenience in Hash.
gavofyork Jan 9, 2016
c649c13
Merge pull request #30 from gavofyork/gav
debris Jan 9, 2016
ffc28bf
Additional bloom-related functionality.
gavofyork Jan 9, 2016
5862d58
Reworked network errors (now `NetworkError`) to be a subset of `UtilE…
gavofyork Jan 10, 2016
3277b23
Merge branch 'master' into gav
gavofyork Jan 10, 2016
8254b42
Merge pull request #31 from gavofyork/gav
arkpar Jan 10, 2016
b0cef96
Networking fixes
arkpar Jan 10, 2016
6410759
Remove unneeded error.
gavofyork Jan 10, 2016
dfd31f9
Merge branch 'master' into gav
gavofyork Jan 10, 2016
2f45d22
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 10, 2016
4ed6a00
Merge pull request #32 from gavofyork/gav
arkpar Jan 10, 2016
39fb29f
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 10, 2016
02b530f
Style
arkpar Jan 10, 2016
6f3c3fa
Documentation
arkpar Jan 10, 2016
e116bd3
Merge pull request #33 from gavofyork/network
Jan 10, 2016
c269cb5
Added sync to std uses
arkpar Jan 11, 2016
54fb66b
Merge branch 'network'
arkpar Jan 11, 2016
a197f3f
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 11, 2016
c104009
Additional standard.rs.
gavofyork Jan 11, 2016
a233320
Merge pull request #34 from gavofyork/gav
debris Jan 11, 2016
1c48e34
Additional mem use.
gavofyork Jan 11, 2016
e4dbba8
Merge pull request #35 from gavofyork/gav
debris Jan 11, 2016
d661116
Merge branch 'master' into gav
gavofyork Jan 11, 2016
65ab524
Avoid panic on invalid uint data.
gavofyork Jan 11, 2016
b6b65ea
Merge pull request #36 from gavofyork/gav
debris Jan 11, 2016
48fbf24
Avoid panicking on oversize u64.
gavofyork Jan 11, 2016
584bcda
Merge pull request #37 from gavofyork/gav
debris Jan 11, 2016
e2de777
Fix panic in crypto, avoid incorrect casting in bytes.
gavofyork Jan 11, 2016
eab9f01
Merge pull request #38 from gavofyork/gav
arkpar Jan 11, 2016
982063e
Started IO service refactoring
arkpar Jan 12, 2016
6b1eb94
Add U512 type and a few conversions.
gavofyork Jan 12, 2016
870dff9
Merge pull request #39 from gavofyork/gav
arkpar Jan 12, 2016
635bf28
Fix RLP on consensus.
gavofyork Jan 12, 2016
6447f9b
Additional helper function.
gavofyork Jan 13, 2016
c98f73c
Finished splitting IoService and NetworkService
arkpar Jan 13, 2016
4be539a
Stirct ordering for hashes.
gavofyork Jan 13, 2016
d5ed4a8
Fixed typos
tomusdrw Jan 13, 2016
95d97fc
Merge branch 'master' of github.com:gavofyork/ethcore-util
tomusdrw Jan 13, 2016
4650961
Merge pull request #40 from gavofyork/gav
debris Jan 13, 2016
28c4826
Fixed context lifetimes
arkpar Jan 13, 2016
a5bb7b7
Work around ICE
arkpar Jan 13, 2016
76dc2d6
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 13, 2016
df3e3ed
bytes_ref
debris Jan 13, 2016
dca7c65
Merge pull request #41 from gavofyork/bytes_ref
Jan 13, 2016
6c44f29
json aid changes
debris Jan 13, 2016
dd99ebd
From::from(u64) for hashes.
gavofyork Jan 13, 2016
9fa9ef4
Merge branch 'master' into gav
gavofyork Jan 13, 2016
5cc5e77
Tests and an additional From::from for hex string -> hash that defaul…
gavofyork Jan 13, 2016
3a1d829
Additional test.
gavofyork Jan 13, 2016
dee52bd
Merge pull request #43 from gavofyork/gav
arkpar Jan 13, 2016
dfc1be8
Merge branch 'master' of https://github.com/gavofyork/ethcore-util in…
debris Jan 13, 2016
90645e3
update pr to use From::from
debris Jan 13, 2016
b23ec6e
Nice macros.
gavofyork Jan 13, 2016
4d24379
Io channel
arkpar Jan 13, 2016
7e7d75c
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 13, 2016
f72f7d0
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 13, 2016
5fd5c46
u256_from_ hex -> str.
gavofyork Jan 13, 2016
8be95e5
Merge pull request #42 from gavofyork/json_aid_changes
Jan 13, 2016
e4ef044
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 13, 2016
8a78953
Merge pull request #44 from gavofyork/gav
debris Jan 13, 2016
1dae68c
Merge branch 'master' of github.com:gavofyork/ethcore-util
tomusdrw Jan 13, 2016
46810e9
Broken casting.
gavofyork Jan 14, 2016
787a119
Workaround.
gavofyork Jan 14, 2016
2ceffb4
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 14, 2016
1c89b97
Nicer display output for hash types.
gavofyork Jan 14, 2016
d63db85
Fix test, revert fn hex() behaviour.
gavofyork Jan 14, 2016
c1603b8
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 14, 2016
ca49c6b
Merge branch 'master' of github.com:gavofyork/ethcore-util
tomusdrw Jan 14, 2016
df1ff2a
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 14, 2016
a2f13e1
Minor fixes
arkpar Jan 14, 2016
d971abf
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 14, 2016
db25f7e
Minor fixes
arkpar Jan 14, 2016
df2e985
Host info
arkpar Jan 14, 2016
4f53db6
New JSON conversion traits.
gavofyork Jan 14, 2016
ccab2ea
Missing files for previous commit.
gavofyork Jan 14, 2016
5e6632c
Remove cruft
gavofyork Jan 14, 2016
b1e986c
Fixing multiplication in uints
tomusdrw Jan 14, 2016
d2cc3b9
Remove unnecessary unwraps in json_aid.
gavofyork Jan 14, 2016
ca3413b
Merge pull request #47 from gavofyork/gav
arkpar Jan 14, 2016
3b557cd
Merge branch 'master' of github.com:gavofyork/ethcore-util into io
arkpar Jan 14, 2016
b781fe6
from_existing works for an empty DB if passed empty RLP SHA3.
gavofyork Jan 14, 2016
3006b8a
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 14, 2016
6a7c823
Option types in JSON, more tests.
gavofyork Jan 14, 2016
1ebd14b
Merge pull request #48 from gavofyork/gav
debris Jan 14, 2016
ab399ba
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 14, 2016
2d36062
Slab bug workaround
arkpar Jan 14, 2016
736a9f8
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 14, 2016
825f373
Removed debug output
arkpar Jan 14, 2016
8dd4b36
Removed unused import
arkpar Jan 14, 2016
9b78a89
Overflow semantics changed
tomusdrw Jan 15, 2016
6252549
Merge branch 'master' into mul_fix
tomusdrw Jan 15, 2016
838eea6
updated to rocksdb wrapper version 0.3
debris Jan 15, 2016
905218a
Merge pull request #50 from gavofyork/rocksdb_0.3
arkpar Jan 15, 2016
9a3944d
Merge branch 'mul_fix' of https://github.com/gavofyork/ethcore-util
debris Jan 15, 2016
23fbe39
Fix for assumption that empty trie root RLP can always be looked up.
gavofyork Jan 15, 2016
844ae09
Merge pull request #51 from gavofyork/gav
arkpar Jan 15, 2016
162a1cd
Power for uint
tomusdrw Jan 15, 2016
223e946
Merge branch 'master' of github.com:gavofyork/ethcore-util into network
arkpar Jan 15, 2016
b8a2a16
Fixing tests
tomusdrw Jan 15, 2016
1136e65
Add flush function.
gavofyork Jan 15, 2016
92619bc
Merge branch 'gav' of https://github.com/gavofyork/ethcore-util
debris Jan 15, 2016
ec4ea71
Merge pull request #53 from gavofyork/gav
arkpar Jan 15, 2016
73f849d
Merge remote-tracking branch 'origin/master' into gav
gavofyork Jan 15, 2016
df151ab
Make clear when the panic occurs to a missing trie root.
gavofyork Jan 15, 2016
0ea9e13
Detecting overflows in shl
tomusdrw Jan 15, 2016
34b516b
Move flush back to common.
gavofyork Jan 15, 2016
e755f74
Merge pull request #54 from gavofyork/gav
debris Jan 15, 2016
5b3436d
Merge branch 'master' into pow
tomusdrw Jan 15, 2016
2319fd4
New list of bootnodes
arkpar Jan 15, 2016
6e67aea
Merge branch 'master' of https://github.com/gavofyork/ethcore-util
debris Jan 15, 2016
af65d53
Merge pull request #49 from gavofyork/network
Jan 15, 2016
96c7cf7
Merge branch 'master' into gav
gavofyork Jan 15, 2016
00a80da
Merge branch 'master' of https://github.com/gavofyork/ethcore-util
debris Jan 15, 2016
3ec294b
Missing files
arkpar Jan 15, 2016
c224808
Merge branch 'network'
arkpar Jan 15, 2016
5c945eb
Merge branch 'master' into gav
gavofyork Jan 15, 2016
e096d75
Merge branch 'master' of https://github.com/gavofyork/ethcore-util
debris Jan 15, 2016
3e1add7
flush macro
debris Jan 15, 2016
e3f1d70
display trait implemented for rlp
debris Jan 15, 2016
5520497
Fixed Uint output.
gavofyork Jan 15, 2016
d41ad82
uint fmt debug/display is changed to output decimal representation
debris Jan 15, 2016
2899790
test for rlp display
debris Jan 15, 2016
6ff8358
Merge branch 'master' into pow
tomusdrw Jan 16, 2016
69f1f31
Minor timers fix
arkpar Jan 16, 2016
cd0db09
Merge pull request #55 from gavofyork/flush_macro
Jan 16, 2016
32b8da2
Merge pull request #56 from gavofyork/rlp_display
Jan 16, 2016
1d06c05
Merge pull request #57 from gavofyork/uint_decimal_display
Jan 16, 2016
40947e2
Merge branch 'master' into pow
tomusdrw Jan 16, 2016
a79644d
Fast SHA3.
gavofyork Jan 16, 2016
8e9ea79
Cleanup and docs.
gavofyork Jan 16, 2016
2caff9d
Merge branch 'master' into gav
gavofyork Jan 16, 2016
666cbe7
Implementing pow, overflowing_pow only for uint. Adding missing docs.
tomusdrw Jan 16, 2016
60678a2
Put boot nodes back.
gavofyork Jan 16, 2016
2286f25
Merge pull request #58 from gavofyork/gav
debris Jan 16, 2016
d5a7c34
Merge pull request #52 from gavofyork/pow
Jan 16, 2016
512eee0
Assign-operators for Uint.
gavofyork Jan 16, 2016
da4f31b
Fixing tinykeccak to compile with c99 mode
tomusdrw Jan 16, 2016
0c2869d
Tesys for U256 assign ops.
gavofyork Jan 16, 2016
9d75452
Merge pull request #60 from gavofyork/tinykeccak_c99
Jan 16, 2016
a04d5c2
Merge pull request #59 from gavofyork/gav
arkpar Jan 16, 2016
8428915
Merge branch 'master' into gav
gavofyork Jan 17, 2016
d0db926
Move everything into ethcore subdit for merge.
gavofyork Jan 17, 2016
9b87bae
Merge remote-tracking branch 'util/master' into gav
gavofyork Jan 17, 2016
6ea8eaa
Move ethcore files back into root.
gavofyork Jan 17, 2016
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ Cargo.lock

# gdb files
.gdb_history

/json-tests/target/


2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["Ethcore <[email protected]>"]
[dependencies]
log = "0.3"
env_logger = "0.3"
ethcore-util = { path = "../ethcore-util" }
ethcore-util = { path = "util" }
rustc-serialize = "0.3"
flate2 = "0.2"
rocksdb = "0.3"
Expand Down
33 changes: 33 additions & 0 deletions util/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: rust

rust:
- beta

os:
#- linux
- osx

before_script:
# g++4.8 for C++11 which is required by rocksdb
#- if [ $TRAVIS_OS_NAME == "linux" ]; then
#sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
#sudo apt-get update -y -qq
#sudo apt-get install -qq --yes --force-yes g++-4.8
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50

#wget https://github.com/facebook/rocksdb/archive/rocksdb-3.13.tar.gz
#tar xvf rocksdb-3.13.tar.gz && cd rocksdb-rocksdb-3.13 && make shared_lib
#sudo make install
#cd ..
#else
- brew update
- brew install rocksdb
#fi

after_success:
#- if [ $TRAVIS_OS_NAME == "linux" ]; then
#sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev
#wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
#tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make && sudo make install && cd ../.. &&
#kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/ethcore_util-*
#fi
32 changes: 32 additions & 0 deletions util/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
description = "Ethcore utility library"
homepage = "http://ethcore.io"
license = "GPL-3.0"
name = "ethcore-util"
version = "0.1.0"
authors = ["Ethcore <[email protected]>"]
build = "build.rs"

[build-dependencies]
gcc = "0.3"

[dependencies]
log = "0.3"
env_logger = "0.3"
rustc-serialize = "0.3"
arrayvec = "0.3"
mio = "0.5.0"
rand = "0.3.12"
time = "0.1.34"
tiny-keccak = "1.0"
rocksdb = "0.3"
lazy_static = "0.1"
eth-secp256k1 = { git = "https://github.com/arkpar/rust-secp256k1.git" }
rust-crypto = "0.2.34"
elastic-array = "0.4"
heapsize = "0.2"
itertools = "0.4"
slab = { git = "https://github.com/arkpar/slab.git" }

[dev-dependencies]
json-tests = { path = "json-tests" }
675 changes: 675 additions & 0 deletions util/LICENSE

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions util/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Makefile for cross-compilation
IOS_ARCHS = i386-apple-ios x86_64-apple-ios armv7-apple-ios armv7s-apple-ios aarch64-apple-ios
IOS_LIB = libethcore_util.a

ios: $(IOS_LIB)

.PHONY: $(IOS_ARCHS)
$(IOS_ARCHS): %:
multirust run ios cargo build --target $@

$(IOS_LIB): $(IOS_ARCHS)
lipo -create -output $@ $(foreach arch,$(IOS_ARCHS),$(wildcard target/$(arch)/debug/$(IOS_LIB)))
1 change: 1 addition & 0 deletions util/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ethcore-util
96 changes: 96 additions & 0 deletions util/benches/rlp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//! benchmarking for rlp
//! should be started with:
//! ```bash
//! multirust run nightly cargo bench
//! ```

#![feature(test)]

extern crate test;
extern crate ethcore_util;

use test::Bencher;
use std::str::FromStr;
use ethcore_util::rlp::*;
use ethcore_util::uint::U256;

#[bench]
fn bench_stream_u64_value(b: &mut Bencher) {
b.iter(|| {
// u64
let mut stream = RlpStream::new();
stream.append(&0x1023456789abcdefu64);
let _ = stream.out();
});
}

#[bench]
fn bench_decode_u64_value(b: &mut Bencher) {
b.iter(|| {
// u64
let data = vec![0x88, 0x10, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef];
let rlp = Rlp::new(&data);
let _: u64 = rlp.as_val();
});
}

#[bench]
fn bench_stream_u256_value(b: &mut Bencher) {
b.iter(|| {
// u256
let mut stream = RlpStream::new();
stream.append(&U256::from_str("8090a0b0c0d0e0f009102030405060770000000000000001000000000\
00012f0")
.unwrap());
let _ = stream.out();
});
}

#[bench]
fn bench_decode_u256_value(b: &mut Bencher) {
b.iter(|| {
// u256
let data = vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x09, 0x10, 0x20,
0x30, 0x40, 0x50, 0x60, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xf0];
let rlp = Rlp::new(&data);
let _ : U256 = rlp.as_val();
});
}

#[bench]
fn bench_stream_nested_empty_lists(b: &mut Bencher) {
b.iter(|| {
// [ [], [[]], [ [], [[]] ] ]
let mut stream = RlpStream::new_list(3);
stream.append_list(0);
stream.append_list(1).append_list(0);
stream.append_list(2).append_list(0).append_list(1).append_list(0);
let _ = stream.out();
});
}

#[bench]
fn bench_decode_nested_empty_lists(b: &mut Bencher) {
b.iter(|| {
// [ [], [[]], [ [], [[]] ] ]
let data = vec![0xc7, 0xc0, 0xc1, 0xc0, 0xc3, 0xc0, 0xc1, 0xc0];
let rlp = Rlp::new(&data);
let _v0: Vec<u16> = rlp.val_at(0);
let _v1: Vec<Vec<u16>> = rlp.val_at(1);
let nested_rlp = rlp.at(2);
let _v2a: Vec<u16> = nested_rlp.val_at(0);
let _v2b: Vec<Vec<u16>> = nested_rlp.val_at(1);
});
}

#[bench]
fn bench_stream_1000_empty_lists(b: &mut Bencher) {
b.iter(|| {
let mut stream = RlpStream::new_list(1000);
for _ in 0..1000 {
stream.append_list(0);
}
let _ = stream.out();
});
}
198 changes: 198 additions & 0 deletions util/benches/trie.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#![feature(test)]

extern crate test;
extern crate rand;
extern crate ethcore_util;
#[macro_use]
extern crate log;

use test::Bencher;
use ethcore_util::hash::*;
use ethcore_util::bytes::*;
use ethcore_util::trie::*;
use ethcore_util::hashdb::*;
use ethcore_util::memorydb::*;
use ethcore_util::triehash::*;
use ethcore_util::sha3::*;


fn random_word(alphabet: &[u8], min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8> {
assert!(min_count + diff_count <= 32);
*seed = seed.sha3();
let r = min_count + (seed.bytes()[31] as usize % (diff_count + 1));
let mut ret: Vec<u8> = Vec::with_capacity(r);
for i in 0..r {
ret.push(alphabet[seed.bytes()[i] as usize % alphabet.len()]);
}
ret
}

fn random_bytes(min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8> {
assert!(min_count + diff_count <= 32);
*seed = seed.sha3();
let r = min_count + (seed.bytes()[31] as usize % (diff_count + 1));
seed.bytes()[0..r].to_vec()
}

fn random_value(seed: &mut H256) -> Bytes {
*seed = seed.sha3();
match seed.bytes()[0] % 2 {
1 => vec![seed.bytes()[31];1],
_ => seed.bytes().to_vec(),
}
}

#[bench]
fn trie_insertions_six_high(b: &mut Bencher) {
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_bytes(6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(||{
let mut memdb = MemoryDB::new();
let mut root = H256::new();
let mut t = TrieDBMut::new(&mut memdb, &mut root);
for i in d.iter() {
t.insert(&i.0, &i.1);
}
})
}

#[bench]
fn triehash_insertions_six_high(b: &mut Bencher) {
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_bytes(6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(&||{
trie_root(d.clone());
})
}

#[bench]
fn trie_insertions_six_mid(b: &mut Bencher) {
let alphabet = b"@QWERTYUIOPASDFGHJKLZXCVBNM[/]^_";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}
b.iter(||{
let mut memdb = MemoryDB::new();
let mut root = H256::new();
let mut t = TrieDBMut::new(&mut memdb, &mut root);
for i in d.iter() {
t.insert(&i.0, &i.1);
}
debug!("hash_count={:?}", t.hash_count);
})
}

#[bench]
fn triehash_insertions_six_mid(b: &mut Bencher) {
let alphabet = b"@QWERTYUIOPASDFGHJKLZXCVBNM[/]^_";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}
b.iter(||{
trie_root(d.clone());
})
}

#[bench]
fn trie_insertions_random_mid(b: &mut Bencher) {
let alphabet = b"@QWERTYUIOPASDFGHJKLZXCVBNM[/]^_";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 1, 5, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(||{
let mut memdb = MemoryDB::new();
let mut root = H256::new();
let mut t = TrieDBMut::new(&mut memdb, &mut root);
for i in d.iter() {
t.insert(&i.0, &i.1);
}
})
}

#[bench]
fn triehash_insertions_random_mid(b: &mut Bencher) {
let alphabet = b"@QWERTYUIOPASDFGHJKLZXCVBNM[/]^_";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 1, 5, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(||{
trie_root(d.clone());
})
}

#[bench]
fn trie_insertions_six_low(b: &mut Bencher) {
let alphabet = b"abcdef";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(||{
let mut memdb = MemoryDB::new();
let mut root = H256::new();
let mut t = TrieDBMut::new(&mut memdb, &mut root);
for i in d.iter() {
t.insert(&i.0, &i.1);
}
})
}

#[bench]
fn triehash_insertions_six_low(b: &mut Bencher) {
let alphabet = b"abcdef";
let mut d: Vec<(Bytes, Bytes)> = Vec::new();
let mut seed = H256::new();
for _ in 0..1000 {
let k = random_word(alphabet, 6, 0, &mut seed);
let v = random_value(&mut seed);
d.push((k, v))
}

b.iter(||{
trie_root(d.clone());
})
}

#[bench]
fn sha3x10000(b: &mut Bencher) {
b.iter(||{
let mut seed = H256::new();
for _ in 0..10000 {
seed = seed.sha3()
}
})
}
Loading