Compare commits
3490 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cd3e0f1cd | ||
|
|
8d76dd3127 | ||
|
|
e09d99b94c | ||
|
|
0cb2c866b9 | ||
|
|
b1fdafea3f | ||
|
|
116e18d2c6 | ||
|
|
652bb6bd94 | ||
|
|
08a6ce9642 | ||
|
|
e4ab13b4fa | ||
|
|
18939f7f69 | ||
|
|
9442e6c26a | ||
|
|
c2803d3d45 | ||
|
|
45e0d28129 | ||
|
|
080ec8043f | ||
|
|
7972c27b61 | ||
|
|
17c133cd01 | ||
|
|
6a4408cebc | ||
|
|
78d3f5fce9 | ||
|
|
93327e8c73 | ||
|
|
54da6aef33 | ||
|
|
22dc6e9ee9 | ||
|
|
ee0f1250ac | ||
|
|
8c01766d90 | ||
|
|
eb15c82fff | ||
|
|
e9f4819640 | ||
|
|
5618fa7a09 | ||
|
|
2f2614e0eb | ||
|
|
91903ac9e7 | ||
|
|
3327dc9aef | ||
|
|
b80aa9c3e4 | ||
|
|
d5ecd8f20f | ||
|
|
e9987c448e | ||
|
|
aac7815712 | ||
|
|
b3097c8036 | ||
|
|
e5ae24dfb6 | ||
|
|
1b36a2cd87 | ||
|
|
b078d71293 | ||
|
|
1df84a8e28 | ||
|
|
e0778fc069 | ||
|
|
2ce43434f1 | ||
|
|
18062f11dc | ||
|
|
d66bd3c83a | ||
|
|
935e8dcf56 | ||
|
|
3c2c356f73 | ||
|
|
6b4d0cea6b | ||
|
|
13de1ebc8e | ||
|
|
1fdb033db4 | ||
|
|
c1f0ea2016 | ||
|
|
964f556284 | ||
|
|
8fba01a208 | ||
|
|
77b49623ff | ||
|
|
2a29d7a76f | ||
|
|
66f684548d | ||
|
|
ccebe473d0 | ||
|
|
9707e61525 | ||
|
|
039594de92 | ||
|
|
69441b1322 | ||
|
|
8492e3e61d | ||
|
|
4b7c97783b | ||
|
|
6d14c5458b | ||
|
|
9239a7cd9e | ||
|
|
d27ecb6527 | ||
|
|
5502340dea | ||
|
|
2313f9b4f1 | ||
|
|
324a5873d7 | ||
|
|
b45e7f1c41 | ||
|
|
64af073bd4 | ||
|
|
fe83046198 | ||
|
|
8031910892 | ||
|
|
73a3dac38c | ||
|
|
bbaf5ed4f5 | ||
|
|
9cf777510f | ||
|
|
9b398421ce | ||
|
|
a618dcaaf0 | ||
|
|
50021c7611 | ||
|
|
f62d2e6ea8 | ||
|
|
7da8e7926d | ||
|
|
5363e75f3a | ||
|
|
31d667a29a | ||
|
|
ca2bc92dda | ||
|
|
a0b71a9f52 | ||
|
|
300c0c120b | ||
|
|
b228dc7b54 | ||
|
|
df4d98001a | ||
|
|
2e4672ea13 | ||
|
|
7f7fe33bde | ||
|
|
3d313d592a | ||
|
|
abc6970d08 | ||
|
|
fa636d402d | ||
|
|
73d6666294 | ||
|
|
f16ccacd22 | ||
|
|
ba3de5d3b9 | ||
|
|
f16de5501a | ||
|
|
e298ab30e4 | ||
|
|
63d3a4dd59 | ||
|
|
0e55b6c6c9 | ||
|
|
4d115987cb | ||
|
|
2d623f14db | ||
|
|
1d1a3b9d02 | ||
|
|
1d69b0e124 | ||
|
|
3c59475be6 | ||
|
|
facab31551 | ||
|
|
c9cfcd2728 | ||
|
|
557dbb73b8 | ||
|
|
6f772a28e2 | ||
|
|
16f3119547 | ||
|
|
c3741640f7 | ||
|
|
decca7f698 | ||
|
|
fc53726c7f | ||
|
|
e2b81bc08d | ||
|
|
4d2d1eac1f | ||
|
|
5572e3dd1d | ||
|
|
0db1c0d336 | ||
|
|
905f04dc9d | ||
|
|
f560cf360c | ||
|
|
f5d48cbf2a | ||
|
|
d59e2ecbc6 | ||
|
|
a97ca5aaf4 | ||
|
|
df61b1b328 | ||
|
|
52a69d19e6 | ||
|
|
33084aaa07 | ||
|
|
2a82fa0a47 | ||
|
|
1ccc90108c | ||
|
|
e60c5b59a6 | ||
|
|
b199fbb6c6 | ||
|
|
d9d506db57 | ||
|
|
425e1ce04c | ||
|
|
8741d0d155 | ||
|
|
dfb2ddfdc2 | ||
|
|
52ac5a00f5 | ||
|
|
6336bdecf3 | ||
|
|
e72fc5398a | ||
|
|
2f52425387 | ||
|
|
46a988ddd4 | ||
|
|
76a7246369 | ||
|
|
725d32083a | ||
|
|
b6f827e3c8 | ||
|
|
05bfdc508e | ||
|
|
08f30fc1a8 | ||
|
|
b20833154e | ||
|
|
8702a29e6f | ||
|
|
aa59aa439d | ||
|
|
25aabe6e52 | ||
|
|
979f4e0617 | ||
|
|
03ba0cc498 | ||
|
|
ab079fd7bf | ||
|
|
dd60146c24 | ||
|
|
d1fc57d15c | ||
|
|
5da24e5dc3 | ||
|
|
8b3836a7d6 | ||
|
|
9bb9a84d40 | ||
|
|
7093651d70 | ||
|
|
52355855fc | ||
|
|
deceb5fd56 | ||
|
|
531bc79edc | ||
|
|
11b65ce53d | ||
|
|
40a304b177 | ||
|
|
8c88e2a8cc | ||
|
|
c5ffb5af79 | ||
|
|
6ba1e66d32 | ||
|
|
9fb5623569 | ||
|
|
087ebcf94e | ||
|
|
0c7ab34c32 | ||
|
|
9de579366a | ||
|
|
1b507e0147 | ||
|
|
b165059327 | ||
|
|
326a51a5c2 | ||
|
|
93b4b15c15 | ||
|
|
62df81f9fe | ||
|
|
21c65a99ea | ||
|
|
fbfcd48483 | ||
|
|
1809961f94 | ||
|
|
d8a3137ce8 | ||
|
|
86db5c08fc | ||
|
|
27d9964001 | ||
|
|
de531c9a1e | ||
|
|
d891e80ad7 | ||
|
|
b26f8c3f33 | ||
|
|
1732cc7a40 | ||
|
|
7b72463845 | ||
|
|
f7b7d317fe | ||
|
|
4e72608441 | ||
|
|
e99753d6e3 | ||
|
|
7dbf23829e | ||
|
|
f19b00b6ca | ||
|
|
beb6f651af | ||
|
|
7c015f023f | ||
|
|
034fa4d615 | ||
|
|
dbfc5cd31c | ||
|
|
b0b7a3aa39 | ||
|
|
489722b83f | ||
|
|
9e5e57fdcd | ||
|
|
bcf8cd6dc0 | ||
|
|
b29329c3c5 | ||
|
|
b672d51a74 | ||
|
|
53f1d7b6ff | ||
|
|
f56b89010d | ||
|
|
85c471b905 | ||
|
|
8c47240248 | ||
|
|
57faa37623 | ||
|
|
29e07755e9 | ||
|
|
5d4925d582 | ||
|
|
24c6561bc1 | ||
|
|
a44ef73b33 | ||
|
|
360ed1a1f1 | ||
|
|
b37086722a | ||
|
|
4304f4a2a4 | ||
|
|
e4f0c0b215 | ||
|
|
0934a283b2 | ||
|
|
297d25dd65 | ||
|
|
11cb544c24 | ||
|
|
b62a5c8f7d | ||
|
|
9746b944f1 | ||
|
|
f33cd60dc2 | ||
|
|
171244a471 | ||
|
|
80a7e4b964 | ||
|
|
3199576416 | ||
|
|
30ba10e10c | ||
|
|
6b1e722a6b | ||
|
|
eaa41ea568 | ||
|
|
b9a08c36aa | ||
|
|
ccb62d3b55 | ||
|
|
edda0b2380 | ||
|
|
02cf48681d | ||
|
|
4907c5028f | ||
|
|
c5ddacc3ee | ||
|
|
c65ee93542 | ||
|
|
4cb4344542 | ||
|
|
a9ae6e3b58 | ||
|
|
3f41186b2e | ||
|
|
01e33ffb61 | ||
|
|
7cf807d1b4 | ||
|
|
53a975d1dc | ||
|
|
6c15a47acc | ||
|
|
1cc6b2b976 | ||
|
|
22a87b1203 | ||
|
|
67a9a40243 | ||
|
|
f614a69929 | ||
|
|
856657e39a | ||
|
|
431ba5e260 | ||
|
|
d0e79be5c6 | ||
|
|
898f1410a5 | ||
|
|
b220e07feb | ||
|
|
226fe8e0bb | ||
|
|
435ba186f8 | ||
|
|
f048839a4b | ||
|
|
e734810293 | ||
|
|
8574bfd546 | ||
|
|
9cdd2d265a | ||
|
|
3f841cc578 | ||
|
|
a76981a61d | ||
|
|
1fbef3289b | ||
|
|
247495fba2 | ||
|
|
9a8fdeead9 | ||
|
|
aafb014d01 | ||
|
|
10bdfe6926 | ||
|
|
63dbb527cc | ||
|
|
ce00c13c7a | ||
|
|
1372f870d5 | ||
|
|
a1857bf139 | ||
|
|
77babe6226 | ||
|
|
8ab56ea3d1 | ||
|
|
7ae9e61d6c | ||
|
|
52b1bc5ff6 | ||
|
|
46b5801730 | ||
|
|
7dd29825c4 | ||
|
|
8a8cfb133f | ||
|
|
9c7395a6be | ||
|
|
b007770ba8 | ||
|
|
0cba70fba3 | ||
|
|
9c8b80f998 | ||
|
|
d67369a01c | ||
|
|
861c8d0701 | ||
|
|
3cc3dbef66 | ||
|
|
6e79a36ef6 | ||
|
|
615fca5dc5 | ||
|
|
f31e7d54af | ||
|
|
038862fa9d | ||
|
|
340f0b6f58 | ||
|
|
4e447ccc68 | ||
|
|
459dcbcef1 | ||
|
|
3ba3dd3805 | ||
|
|
18f16616fe | ||
|
|
028d6f6853 | ||
|
|
6a47fd176b | ||
|
|
3d00a912b5 | ||
|
|
3005b394f3 | ||
|
|
dd17c766b8 | ||
|
|
0d2f516ad7 | ||
|
|
34b7cf2e0a | ||
|
|
a2735308b9 | ||
|
|
a44e95b0ec | ||
|
|
5ab18d1313 | ||
|
|
5dba43178b | ||
|
|
9eed51ed20 | ||
|
|
c3ef5c10a3 | ||
|
|
77bbab009e | ||
|
|
d8472a8031 | ||
|
|
8e26977693 | ||
|
|
72a8f56e51 | ||
|
|
a74b72faa2 | ||
|
|
ac8db8f101 | ||
|
|
be25e930e5 | ||
|
|
fea05dc594 | ||
|
|
4cb1c906b0 | ||
|
|
64417594c7 | ||
|
|
98ddff1326 | ||
|
|
799c69c8d5 | ||
|
|
7b5d39e0a1 | ||
|
|
78007cf80b | ||
|
|
b1a67bf18f | ||
|
|
4a9d57d2ce | ||
|
|
507a4ea26c | ||
|
|
e74ab38e29 | ||
|
|
3d35529016 | ||
|
|
d14b6871a5 | ||
|
|
66f8038b6b | ||
|
|
d5d0cb0b47 | ||
|
|
517c705ab5 | ||
|
|
598833d1ea | ||
|
|
2b193f00d4 | ||
|
|
be7c771efd | ||
|
|
e0efe577b3 | ||
|
|
facbb93c62 | ||
|
|
06e8ae19e3 | ||
|
|
c60e02d151 | ||
|
|
f380340a9b | ||
|
|
2310ecb480 | ||
|
|
6c205067b1 | ||
|
|
44bc8a08fb | ||
|
|
80c734efe2 | ||
|
|
8d0e05adb7 | ||
|
|
50c43bd819 | ||
|
|
1053f3610c | ||
|
|
a7511b6b02 | ||
|
|
1b86f8368d | ||
|
|
36d3d0d7d7 | ||
|
|
9fd95e6694 | ||
|
|
4226c0f631 | ||
|
|
9a0a5b4c22 | ||
|
|
3ac33ceda0 | ||
|
|
0f83ef6a0b | ||
|
|
fc6e598b40 | ||
|
|
691e55227d | ||
|
|
6738fe8268 | ||
|
|
507a638762 | ||
|
|
80d59949ff | ||
|
|
29a5c1785c | ||
|
|
91ae781f05 | ||
|
|
e75274df66 | ||
|
|
e0f6709f05 | ||
|
|
02ecb6b37b | ||
|
|
29076da4b7 | ||
|
|
420f2ad6c4 | ||
|
|
3abe3e1fbc | ||
|
|
cc19f11c4d | ||
|
|
11cae70cdd | ||
|
|
b37ceccf02 | ||
|
|
ab44168e1c | ||
|
|
4cf8df87e5 | ||
|
|
a784240734 | ||
|
|
d956b7cea3 | ||
|
|
c3925a494d | ||
|
|
60302acb94 | ||
|
|
c26627d968 | ||
|
|
86df371a72 | ||
|
|
174e142ad9 | ||
|
|
61c405a014 | ||
|
|
fbc0e0039a | ||
|
|
636ecf306a | ||
|
|
2746c1c18c | ||
|
|
fd6d66fc86 | ||
|
|
c7a11418bb | ||
|
|
7200cfcbc9 | ||
|
|
92fd00f41e | ||
|
|
4269867ca4 | ||
|
|
29a2238299 | ||
|
|
7e13ce6185 | ||
|
|
cb2ace82db | ||
|
|
d9aeafa40e | ||
|
|
3159e20814 | ||
|
|
ab1c6cd655 | ||
|
|
d65a1d2b2a | ||
|
|
673cde6c7f | ||
|
|
248428657d | ||
|
|
9eeafecd76 | ||
|
|
c5ed363bba | ||
|
|
d3695d0b72 | ||
|
|
49ba117f13 | ||
|
|
3647628ae2 | ||
|
|
2d5d632d74 | ||
|
|
fbdde8f0e6 | ||
|
|
986c28efb7 | ||
|
|
2382d779ca | ||
|
|
24ec696062 | ||
|
|
cca4efb861 | ||
|
|
f1edd3d683 | ||
|
|
da9e9692dc | ||
|
|
da4b1c36cb | ||
|
|
edaf24a2ce | ||
|
|
b91d339bf2 | ||
|
|
c7af950992 | ||
|
|
3dd7ce5566 | ||
|
|
803682d9b8 | ||
|
|
002d808a8a | ||
|
|
bdf4446173 | ||
|
|
2ed09de38e | ||
|
|
c8b565805e | ||
|
|
e15f631ec7 | ||
|
|
d7caae2241 | ||
|
|
ae757afe15 | ||
|
|
895b027527 | ||
|
|
36dfa4743e | ||
|
|
ee253c7a3f | ||
|
|
32a4a060d6 | ||
|
|
716de21873 | ||
|
|
172553c81e | ||
|
|
2e24348c2d | ||
|
|
1f885254e1 | ||
|
|
9a70f717ad | ||
|
|
d4d63a5688 | ||
|
|
f48d030f0b | ||
|
|
b304ce5838 | ||
|
|
5fe14e172e | ||
|
|
9b1d1dc336 | ||
|
|
c648171f91 | ||
|
|
274e7767b4 | ||
|
|
ef0a41c7b3 | ||
|
|
9afbc9816d | ||
|
|
25e6b2b827 | ||
|
|
eef9586c57 | ||
|
|
3b0b1375f2 | ||
|
|
aaf9490c91 | ||
|
|
171e93752c | ||
|
|
fe027e872c | ||
|
|
a160adadaa | ||
|
|
598ad4d5da | ||
|
|
0467bfc9ed | ||
|
|
3e61d6f3f9 | ||
|
|
57c14eedfa | ||
|
|
43d931de12 | ||
|
|
f023d7a17f | ||
|
|
d7077c8ef7 | ||
|
|
b33cb32a11 | ||
|
|
3c046556b5 | ||
|
|
326ea59258 | ||
|
|
7af366c5b1 | ||
|
|
9f43526c88 | ||
|
|
8282c7dd50 | ||
|
|
3b662c285f | ||
|
|
1f1b420230 | ||
|
|
456ad9e21b | ||
|
|
f06cff48b9 | ||
|
|
b1ca41dea8 | ||
|
|
5dd5983568 | ||
|
|
2abf1df667 | ||
|
|
d7e225c0af | ||
|
|
1ac2987437 | ||
|
|
cd7b046d80 | ||
|
|
095e51c39c | ||
|
|
4a9b9dc305 | ||
|
|
baababea02 | ||
|
|
b25a37eb38 | ||
|
|
f8b56317b4 | ||
|
|
4b93773c4f | ||
|
|
aaad0e87ae | ||
|
|
a7103e2870 | ||
|
|
e151fbb071 | ||
|
|
e411399f13 | ||
|
|
0bbdcb13b3 | ||
|
|
9b28e97ca8 | ||
|
|
7df0aa2b60 | ||
|
|
b7d243368b | ||
|
|
21d5e105c1 | ||
|
|
908104e365 | ||
|
|
9783c93564 | ||
|
|
29de69e39d | ||
|
|
a8b26e2cb5 | ||
|
|
bcb63bce12 | ||
|
|
fa44532a1e | ||
|
|
a084969d55 | ||
|
|
cb1808d53d | ||
|
|
eb6617f9d4 | ||
|
|
fd62944efc | ||
|
|
488ff88562 | ||
|
|
b8b55be0be | ||
|
|
c26cfc1c5a | ||
|
|
d4c9c7cc23 | ||
|
|
1b759c1462 | ||
|
|
2ea7a8d666 | ||
|
|
747818a349 | ||
|
|
62b9c1b14f | ||
|
|
4c1b74a42e | ||
|
|
45d532368d | ||
|
|
fb0076d262 | ||
|
|
78e7101f85 | ||
|
|
8052824f3f | ||
|
|
c96686620a | ||
|
|
ce1a4c8952 | ||
|
|
a9a671dfc0 | ||
|
|
b58754cd26 | ||
|
|
b873d3befb | ||
|
|
bbf20c3637 | ||
|
|
a2b4997888 | ||
|
|
1ab2060afa | ||
|
|
a25eb4b046 | ||
|
|
d1e6e3d642 | ||
|
|
0242c66a1b | ||
|
|
548b4e164e | ||
|
|
24f09de60e | ||
|
|
39a46eee8f | ||
|
|
bb2a631885 | ||
|
|
cfcf061e41 | ||
|
|
465aae71e7 | ||
|
|
601ebcf3cc | ||
|
|
bb36a594c5 | ||
|
|
5c438cc58a | ||
|
|
1aee197d79 | ||
|
|
8f6e48e4c3 | ||
|
|
ff7fcd0992 | ||
|
|
8e98f06ce5 | ||
|
|
316fae2cc4 | ||
|
|
43027b36ea | ||
|
|
0f7b66f557 | ||
|
|
edb8663195 | ||
|
|
fa73ae17d9 | ||
|
|
46b0af6121 | ||
|
|
d91e8ccd34 | ||
|
|
789b903de6 | ||
|
|
8102fb9306 | ||
|
|
07521c17b4 | ||
|
|
d8a4cca817 | ||
|
|
0a513ad06e | ||
|
|
0907722fc8 | ||
|
|
d4ff3e51e9 | ||
|
|
b30e7c7ba4 | ||
|
|
d42ea6b69e | ||
|
|
654cd570b4 | ||
|
|
c71dff04c5 | ||
|
|
b53442953a | ||
|
|
7ad8599324 | ||
|
|
ef09902508 | ||
|
|
9f5abd01b5 | ||
|
|
7ae0eb8137 | ||
|
|
52f4034bdd | ||
|
|
5c2ca9a0cb | ||
|
|
1d780f456a | ||
|
|
29b6ba4a87 | ||
|
|
cf7830fa8f | ||
|
|
1dc56fc3e1 | ||
|
|
91efef8497 | ||
|
|
6962e1d211 | ||
|
|
dd62e2d43b | ||
|
|
038ef2b3c3 | ||
|
|
c8c7fbbf27 | ||
|
|
6bbd237711 | ||
|
|
6bdbc2cb93 | ||
|
|
f370e17a54 | ||
|
|
30f2e8f60c | ||
|
|
4a60407c2a | ||
|
|
5dd3c6196c | ||
|
|
a681566967 | ||
|
|
ff0d8ea868 | ||
|
|
489ddd1d6f | ||
|
|
d4f0f2c80e | ||
|
|
90a4475f52 | ||
|
|
bee2102424 | ||
|
|
bb70cd889e | ||
|
|
8134a89b87 | ||
|
|
d3cb79833b | ||
|
|
456619001a | ||
|
|
ba38cc0ccc | ||
|
|
cdd1c6dd90 | ||
|
|
bad02d65a1 | ||
|
|
97eb311cb0 | ||
|
|
080b50809a | ||
|
|
95538ac42c | ||
|
|
673c5afd4d | ||
|
|
ef8dd23254 | ||
|
|
6616b5e17d | ||
|
|
24e73f3aec | ||
|
|
6ae467252c | ||
|
|
08048a7377 | ||
|
|
eb56e74340 | ||
|
|
5c5f52c017 | ||
|
|
6e8df6a6ce | ||
|
|
6259a5a737 | ||
|
|
427d54f341 | ||
|
|
86c85bdd9e | ||
|
|
9c58ebf2d2 | ||
|
|
ff29c82c9e | ||
|
|
dff7d9603c | ||
|
|
9c07e5c355 | ||
|
|
5665083e20 | ||
|
|
30fad64621 | ||
|
|
51c6b85f80 | ||
|
|
af65945b58 | ||
|
|
5a794b21cf | ||
|
|
6ca2e6b29b | ||
|
|
93a89049ed | ||
|
|
92edf7f511 | ||
|
|
4a6206c514 | ||
|
|
60270083e5 | ||
|
|
946c1fd76a | ||
|
|
8fc03e2dc2 | ||
|
|
3c061857c4 | ||
|
|
2891b7b4ea | ||
|
|
86ba6f1912 | ||
|
|
ee01ad1324 | ||
|
|
d5be0fae54 | ||
|
|
f6ec1eae4a | ||
|
|
a14f2391ff | ||
|
|
f31ddec3a8 | ||
|
|
f24ba94fbd | ||
|
|
dc24448900 | ||
|
|
5337de8d42 | ||
|
|
b3f37f3cb4 | ||
|
|
e24f9c9936 | ||
|
|
19d83a9074 | ||
|
|
5958c87e56 | ||
|
|
562e591ed3 | ||
|
|
dec083a5ed | ||
|
|
3cca6c869e | ||
|
|
9aef8ba063 | ||
|
|
6ecd6eaa12 | ||
|
|
bfbcb8d551 | ||
|
|
83c967c082 | ||
|
|
aec4130dca | ||
|
|
98ae9cad6f | ||
|
|
5d1ff3d7ba | ||
|
|
580913fa7d | ||
|
|
6977d335e9 | ||
|
|
05927eba1f | ||
|
|
7c27f9dfed | ||
|
|
c096c087df | ||
|
|
49024a4f28 | ||
|
|
78ebc8b975 | ||
|
|
e3214c63c6 | ||
|
|
2138a53067 | ||
|
|
72771bd833 | ||
|
|
91aee536ca | ||
|
|
ebcbb19aef | ||
|
|
a3758161ac | ||
|
|
38870fb3e4 | ||
|
|
3ae8ccf8c6 | ||
|
|
477fdefb55 | ||
|
|
8dbf182618 | ||
|
|
2462193df8 | ||
|
|
0b86723e68 | ||
|
|
af891f65a7 | ||
|
|
39307b2bea | ||
|
|
4ecf23df9a | ||
|
|
4f56f8b27c | ||
|
|
6895a56099 | ||
|
|
599a6104b7 | ||
|
|
31de739122 | ||
|
|
af935df553 | ||
|
|
d0cec2434e | ||
|
|
c221f69ccd | ||
|
|
a3a68a20f4 | ||
|
|
993f707fbe | ||
|
|
f94f061f6a | ||
|
|
ff788e4199 | ||
|
|
5919c660e5 | ||
|
|
495e56034f | ||
|
|
ed153995f9 | ||
|
|
150d7c1c78 | ||
|
|
5d67a32cef | ||
|
|
10aa32b0f5 | ||
|
|
a83def78b3 | ||
|
|
60b70dada1 | ||
|
|
dc79e63db7 | ||
|
|
7b5eeb1dd7 | ||
|
|
a102015ecf | ||
|
|
2a51a30d41 | ||
|
|
9f4bfd9e7a | ||
|
|
1667808ecb | ||
|
|
6c1802e412 | ||
|
|
222404f801 | ||
|
|
044bf5511a | ||
|
|
1fdbfa14ad | ||
|
|
6859152c21 | ||
|
|
f9f25fd147 | ||
|
|
06cf2a3f41 | ||
|
|
7904464d24 | ||
|
|
2e5d5f12dd | ||
|
|
627b67db0a | ||
|
|
07098fd16f | ||
|
|
e4763e90bc | ||
|
|
6b51dffca0 | ||
|
|
36626f96a8 | ||
|
|
5ecbeaa82f | ||
|
|
c21550a663 | ||
|
|
4f1f33d1b8 | ||
|
|
b3398cec33 | ||
|
|
f3a6da7c1e | ||
|
|
1b4f67151f | ||
|
|
593d947fcd | ||
|
|
2bd0c5ebcb | ||
|
|
6bbaced3cd | ||
|
|
516b015325 | ||
|
|
2ef929dcbd | ||
|
|
2400001675 | ||
|
|
2574d000a3 | ||
|
|
a72d8ee0e7 | ||
|
|
482d910b15 | ||
|
|
b02d7a4311 | ||
|
|
ab0d280232 | ||
|
|
4fd0a95112 | ||
|
|
59d1a82814 | ||
|
|
83af81f443 | ||
|
|
6c40cdf5c6 | ||
|
|
a109a4a72b | ||
|
|
102626f2c2 | ||
|
|
8cc349bcb0 | ||
|
|
3c63244c00 | ||
|
|
a9b757a75c | ||
|
|
92bc21ba9c | ||
|
|
313d9048bf | ||
|
|
29e2ba91a7 | ||
|
|
bf11fb6633 | ||
|
|
3e7edb2665 | ||
|
|
60d259c9d5 | ||
|
|
568dc90769 | ||
|
|
b9649c0e78 | ||
|
|
4e0d6f735a | ||
|
|
44d6e1f443 | ||
|
|
031a91ebc6 | ||
|
|
4ece68349c | ||
|
|
653a368783 | ||
|
|
566bb030ec | ||
|
|
23732fa516 | ||
|
|
84ce5af2b0 | ||
|
|
e3e10335f9 | ||
|
|
54fc5a533b | ||
|
|
dc7c53d59a | ||
|
|
34c89e5841 | ||
|
|
e77cce66a1 | ||
|
|
6edb981bfa | ||
|
|
416781a8d4 | ||
|
|
27b18df3dd | ||
|
|
1d31cee524 | ||
|
|
19585947a5 | ||
|
|
bca9e1f31a | ||
|
|
41e0769e63 | ||
|
|
8fcec20398 | ||
|
|
082294fe81 | ||
|
|
f3486c48ea | ||
|
|
fb7ca8539e | ||
|
|
5bf906625b | ||
|
|
129ce97ad5 | ||
|
|
4f39fb2551 | ||
|
|
be8f922b3f | ||
|
|
a76e3a134f | ||
|
|
9ac30ad409 | ||
|
|
8a867262ad | ||
|
|
fc9ceb9131 | ||
|
|
1602906b56 | ||
|
|
230c6c889a | ||
|
|
9a1e1b7c89 | ||
|
|
e346cbc7f9 | ||
|
|
cb9b1e2ad5 | ||
|
|
d53306382d | ||
|
|
cc7038383a | ||
|
|
5302a7dd58 | ||
|
|
9547324b46 | ||
|
|
927ffa7e9c | ||
|
|
f947a9cb71 | ||
|
|
78cc5a6ed1 | ||
|
|
bc1f603e0c | ||
|
|
353b9e91e6 | ||
|
|
11314a660d | ||
|
|
e2de1987c7 | ||
|
|
e7d96484a1 | ||
|
|
7c94b1495e | ||
|
|
0e9ffff8ea | ||
|
|
1646a82ecc | ||
|
|
b82b44bc1a | ||
|
|
0ba9782bb2 | ||
|
|
bbe5cd001a | ||
|
|
6e4ddde005 | ||
|
|
613d4c95f6 | ||
|
|
fe09d8d291 | ||
|
|
de079ebe31 | ||
|
|
9132895d0e | ||
|
|
b2891fcdda | ||
|
|
bca4e23df6 | ||
|
|
3aaf938add | ||
|
|
94a0193047 | ||
|
|
a8bc86151e | ||
|
|
7136cd7057 | ||
|
|
be03a6acbd | ||
|
|
7cfb9a2b0b | ||
|
|
57e9ed3f08 | ||
|
|
840f961dc2 | ||
|
|
c5f6250668 | ||
|
|
951512f9c9 | ||
|
|
878298f061 | ||
|
|
e0b4eab819 | ||
|
|
a8a731ba11 | ||
|
|
70db48961a | ||
|
|
c2ffa90478 | ||
|
|
3de482a431 | ||
|
|
06ba7e258e | ||
|
|
d2057a3f72 | ||
|
|
b667378820 | ||
|
|
d42f8eac1e | ||
|
|
c912bb8c17 | ||
|
|
f58e211b11 | ||
|
|
7e424d2713 | ||
|
|
7aa73f300a | ||
|
|
1f599ac6f9 | ||
|
|
f4f842f48e | ||
|
|
d874555310 | ||
|
|
05583c2cd7 | ||
|
|
855ae91c4c | ||
|
|
5705ecf95f | ||
|
|
beedbd5126 | ||
|
|
72debeebcf | ||
|
|
69c29fce84 | ||
|
|
71bfda3534 | ||
|
|
09b8116cde | ||
|
|
8fa9a240cc | ||
|
|
0716eaa036 | ||
|
|
38b9264de6 | ||
|
|
5f7bdc028d | ||
|
|
8b845e56da | ||
|
|
1ffe0c185c | ||
|
|
7b9db37d84 | ||
|
|
75a38500f1 | ||
|
|
e9900be6ea | ||
|
|
da7b30628b | ||
|
|
71c49eaaa2 | ||
|
|
7a6fa97d98 | ||
|
|
b05c218338 | ||
|
|
3d3041d418 | ||
|
|
f5682737d3 | ||
|
|
a6713467a7 | ||
|
|
09253ef19c | ||
|
|
c6616431b0 | ||
|
|
deb20c6249 | ||
|
|
e97f62e33c | ||
|
|
a4b35180d1 | ||
|
|
8d61c0298c | ||
|
|
7e452ab2e0 | ||
|
|
06a3557e3e | ||
|
|
c348508b40 | ||
|
|
1bad0783fe | ||
|
|
edd43cd5c3 | ||
|
|
18c35a031b | ||
|
|
5e9c8db4c9 | ||
|
|
7393de94f7 | ||
|
|
1dd87a39f5 | ||
|
|
d0b2df07db | ||
|
|
3bf67486ae | ||
|
|
a2f24a0083 | ||
|
|
91acb22bd4 | ||
|
|
ca35f116a6 | ||
|
|
03cd1c0494 | ||
|
|
074311d95b | ||
|
|
6d435d038f | ||
|
|
4b3f23f0ac | ||
|
|
bf6308312e | ||
|
|
3ee3171b8c | ||
|
|
6b074e8fb2 | ||
|
|
ab4561b5bc | ||
|
|
2ea45134ab | ||
|
|
d8fca91a2f | ||
|
|
a4dacca262 | ||
|
|
08522eec37 | ||
|
|
5ceb1b084c | ||
|
|
2245baaaab | ||
|
|
8fad728e9b | ||
|
|
7430cf72e2 | ||
|
|
46d588dcae | ||
|
|
026bfd6741 | ||
|
|
bff1c5bdcb | ||
|
|
d915eae7f7 | ||
|
|
2582253f95 | ||
|
|
3617923d3c | ||
|
|
2b65011706 | ||
|
|
47cd9ff34c | ||
|
|
7208f9f95c | ||
|
|
81df97a737 | ||
|
|
c1c64bedc2 | ||
|
|
ec654feaf8 | ||
|
|
d416e5d9bc | ||
|
|
22e390f922 | ||
|
|
c9f8eff92d | ||
|
|
5e1e3ce857 | ||
|
|
91dc31fd70 | ||
|
|
e957565144 | ||
|
|
75a7cf2860 | ||
|
|
591fa9625d | ||
|
|
42478add64 | ||
|
|
76b413b5f7 | ||
|
|
b4aae6bd9c | ||
|
|
1baa150086 | ||
|
|
defe688797 | ||
|
|
2c9a5fc0a9 | ||
|
|
335bce85e8 | ||
|
|
6026dd3657 | ||
|
|
d6701065ea | ||
|
|
da058d0e86 | ||
|
|
232274546b | ||
|
|
55fec2dcc3 | ||
|
|
29e286572c | ||
|
|
3f77f7ce1f | ||
|
|
16412eb0c9 | ||
|
|
fc60ed92e6 | ||
|
|
c340d8a34f | ||
|
|
67ffac1df9 | ||
|
|
b38488dd07 | ||
|
|
3850ee64bb | ||
|
|
f3c1643090 | ||
|
|
e4867d7cb9 | ||
|
|
2a101baf1d | ||
|
|
f45254d485 | ||
|
|
ce87691a2e | ||
|
|
0e917b9fa3 | ||
|
|
07641b8f0a | ||
|
|
10bbe8c8a2 | ||
|
|
53db9921d6 | ||
|
|
88b03580ff | ||
|
|
1e9da1e0fa | ||
|
|
5a0d367e0b | ||
|
|
80e56cb8d7 | ||
|
|
9603597da7 | ||
|
|
77c3e10b6a | ||
|
|
7649037e51 | ||
|
|
87e9ca7517 | ||
|
|
5538527016 | ||
|
|
7ca5c115d8 | ||
|
|
b38f33531e | ||
|
|
7284df9bf5 | ||
|
|
25f1f22c86 | ||
|
|
6803375301 | ||
|
|
dcd64f73d4 | ||
|
|
0e3a15cadb | ||
|
|
d7498c1dd5 | ||
|
|
a2bb3f2832 | ||
|
|
549647b6f2 | ||
|
|
d26e038dc7 | ||
|
|
9badb310ae | ||
|
|
6b852a0635 | ||
|
|
2527130831 | ||
|
|
53b3a6f0a1 | ||
|
|
3d86d099bb | ||
|
|
0f1e2f5d2f | ||
|
|
818b87e311 | ||
|
|
79bd168267 | ||
|
|
be6c572449 | ||
|
|
44ed899fb3 | ||
|
|
dac387fac1 | ||
|
|
71131c41e5 | ||
|
|
b562480173 | ||
|
|
b89888eda1 | ||
|
|
efa8f661e5 | ||
|
|
f7536876d5 | ||
|
|
aeae4670f1 | ||
|
|
58948c53ff | ||
|
|
17a60920cb | ||
|
|
f5cc3db4da | ||
|
|
3290f393bd | ||
|
|
874bc808cb | ||
|
|
7b89d6a263 | ||
|
|
a26a4edc85 | ||
|
|
91bb6c5d43 | ||
|
|
37260d7cf5 | ||
|
|
8ced25b36c | ||
|
|
39e2f6c891 | ||
|
|
5920a7068f | ||
|
|
8ed2b9c7d9 | ||
|
|
7610d308e8 | ||
|
|
a03da30510 | ||
|
|
65d42d6a5a | ||
|
|
dfb603dd08 | ||
|
|
b3caeee758 | ||
|
|
9940432051 | ||
|
|
16e58958c9 | ||
|
|
75013003f7 | ||
|
|
dbddb6a566 | ||
|
|
9ed2122ae2 | ||
|
|
b88eef5374 | ||
|
|
5c019b74e4 | ||
|
|
0b8710a2a1 | ||
|
|
ca33f7c18d | ||
|
|
835b158069 | ||
|
|
1dac2e3b23 | ||
|
|
8c7bcdafdb | ||
|
|
925869d462 | ||
|
|
bee3669e9b | ||
|
|
5cc6a681c9 | ||
|
|
4c812169d1 | ||
|
|
5b6ea41d9d | ||
|
|
c36f47bbbf | ||
|
|
22a19819c6 | ||
|
|
f5efd444f5 | ||
|
|
6b12334136 | ||
|
|
4ef4819bf9 | ||
|
|
6ec282fe98 | ||
|
|
98c7677ce1 | ||
|
|
446d59426a | ||
|
|
a8831fe896 | ||
|
|
f478812441 | ||
|
|
4ded1cc3d4 | ||
|
|
12a76597d4 | ||
|
|
10c2302b55 | ||
|
|
f400da405a | ||
|
|
d9743f166f | ||
|
|
e5ca5e0926 | ||
|
|
d696a66d71 | ||
|
|
b33482ce74 | ||
|
|
b1849bd1ad | ||
|
|
7064624b6f | ||
|
|
7f9e8d0b48 | ||
|
|
070aae6562 | ||
|
|
fca22e92ce | ||
|
|
9260d44362 | ||
|
|
c2b226ec57 | ||
|
|
c9846b8f48 | ||
|
|
5c252f2a60 | ||
|
|
833dc16040 | ||
|
|
3b1cca5622 | ||
|
|
6d9baef12c | ||
|
|
89a77149bf | ||
|
|
e5e238746b | ||
|
|
036b324804 | ||
|
|
b047eb29a1 | ||
|
|
f689792481 | ||
|
|
3e7d8bf1a8 | ||
|
|
e633cd2f75 | ||
|
|
c6e83caddf | ||
|
|
f12add6958 | ||
|
|
997fd93016 | ||
|
|
5e0ba1c310 | ||
|
|
383b7a3cab | ||
|
|
2a92e10fcd | ||
|
|
d54d3a2c60 | ||
|
|
6e7828fa71 | ||
|
|
2e52c99042 | ||
|
|
c6369a4ae7 | ||
|
|
2e56fbad2c | ||
|
|
293d9f15d5 | ||
|
|
a72ee5c16a | ||
|
|
cfaa0389e1 | ||
|
|
becf1d7b28 | ||
|
|
b4b883b341 | ||
|
|
be435cde99 | ||
|
|
c5d8f5e136 | ||
|
|
446c9096f4 | ||
|
|
5397da0c93 | ||
|
|
13968aaa38 | ||
|
|
2abe8cc5dd | ||
|
|
fdc22db3f4 | ||
|
|
bf9173e673 | ||
|
|
f61ee1a5f1 | ||
|
|
e6d141e14f | ||
|
|
5168a1c851 | ||
|
|
db869fcdd1 | ||
|
|
e46c9f67ab | ||
|
|
482fe3b211 | ||
|
|
9ae93d6962 | ||
|
|
ef39eed12f | ||
|
|
62e37aef8f | ||
|
|
3db2328f52 | ||
|
|
4efd658577 | ||
|
|
0cb1affd48 | ||
|
|
e408b7ac99 | ||
|
|
b4899f4d47 | ||
|
|
79919bdc3c | ||
|
|
18ffd94674 | ||
|
|
1dae61f22f | ||
|
|
302126ebcf | ||
|
|
98d9752097 | ||
|
|
b93c83b8a0 | ||
|
|
54c20f6f9c | ||
|
|
a460813788 | ||
|
|
ba8c7bc959 | ||
|
|
a7de430193 | ||
|
|
67b9e08ff0 | ||
|
|
a063a63ac7 | ||
|
|
9572f6e5fc | ||
|
|
1fa8f108d9 | ||
|
|
64b74eae43 | ||
|
|
3dff5a9f3f | ||
|
|
e6921144dc | ||
|
|
f775606c37 | ||
|
|
bbd024d646 | ||
|
|
4675b7408f | ||
|
|
c8c47ebe32 | ||
|
|
ec61c7534c | ||
|
|
d39b9506d2 | ||
|
|
4153052148 | ||
|
|
d5048967e2 | ||
|
|
aa465fa2cd | ||
|
|
6f850ebdac | ||
|
|
4dc9aedfb5 | ||
|
|
bb1b8cc08a | ||
|
|
3905717d5d | ||
|
|
ae2deaaf72 | ||
|
|
1e10445f82 | ||
|
|
6c6229c963 | ||
|
|
d7b79c1274 | ||
|
|
3ba15f6c64 | ||
|
|
8752a60018 | ||
|
|
3e2479cf40 | ||
|
|
81d8dafd9e | ||
|
|
0318bb9fe9 | ||
|
|
18dac64abb | ||
|
|
f357274ced | ||
|
|
7dc05f1bcc | ||
|
|
35753f22f7 | ||
|
|
c3404c9b59 | ||
|
|
a132fefcc7 | ||
|
|
cce18cb4c5 | ||
|
|
79a60e157b | ||
|
|
ee3f608204 | ||
|
|
c202abe09d | ||
|
|
d40504caa5 | ||
|
|
77942c0b48 | ||
|
|
4c44994807 | ||
|
|
9a626c84bc | ||
|
|
29e18cfc4d | ||
|
|
401bdca153 | ||
|
|
b17581d7de | ||
|
|
b9ec87548d | ||
|
|
bc5c3da2af | ||
|
|
716c9bb43c | ||
|
|
e9bcce05a1 | ||
|
|
7ad9c73c75 | ||
|
|
8596a347ea | ||
|
|
d40a038f37 | ||
|
|
26da38a439 | ||
|
|
e170916563 | ||
|
|
5f68b81f68 | ||
|
|
89deaef809 | ||
|
|
626acda6a3 | ||
|
|
b7ada4dee0 | ||
|
|
5c63311268 | ||
|
|
555555e6f7 | ||
|
|
c370bcaded | ||
|
|
6676c6cf7e | ||
|
|
99e26b8480 | ||
|
|
a7a2b55362 | ||
|
|
d601e11d59 | ||
|
|
4742860b2e | ||
|
|
1fd9110829 | ||
|
|
b9b0ce8d65 | ||
|
|
1ef4db82e8 | ||
|
|
ae572cb8f5 | ||
|
|
ee77fc3bc3 | ||
|
|
985d412c48 | ||
|
|
c00b84e10b | ||
|
|
0c782bf34b | ||
|
|
f41466c8b5 | ||
|
|
db749dc564 | ||
|
|
e743972102 | ||
|
|
cee31f9e8d | ||
|
|
d45a676dc0 | ||
|
|
67421fc69e | ||
|
|
ae1bcd6a5b | ||
|
|
5fd4b9d7bd | ||
|
|
dad61bb7cf | ||
|
|
9957328607 | ||
|
|
c33b1caf21 | ||
|
|
bbb858b386 | ||
|
|
77cef76518 | ||
|
|
4146e1f02b | ||
|
|
2a08fb8fe3 | ||
|
|
495e7feb62 | ||
|
|
34edecd59d | ||
|
|
ec7af964ab | ||
|
|
10d914d6c6 | ||
|
|
f5ed31792f | ||
|
|
a845e08bc6 | ||
|
|
ed0d60bc16 | ||
|
|
4d29508b4c | ||
|
|
8e252d5f1b | ||
|
|
c81e4e24b3 | ||
|
|
4ccaabde40 | ||
|
|
4f732972bc | ||
|
|
da9d6bf8d5 | ||
|
|
c62bfcddef | ||
|
|
3abaeadcf3 | ||
|
|
3dd642abe9 | ||
|
|
ff7c755930 | ||
|
|
0cd8644292 | ||
|
|
3788b3a149 | ||
|
|
b729a381f8 | ||
|
|
5cb58c4269 | ||
|
|
266b4eedaa | ||
|
|
1465b0d34c | ||
|
|
a944638b5e | ||
|
|
1d5f407a29 | ||
|
|
134f48cdfb | ||
|
|
d0b32f8d42 | ||
|
|
2d604324b9 | ||
|
|
f9a0cc47a0 | ||
|
|
12547ecd37 | ||
|
|
1fdb1de218 | ||
|
|
649767b911 | ||
|
|
5766354c19 | ||
|
|
d49152c8b0 | ||
|
|
b036f1de98 | ||
|
|
6d25e7f8b4 | ||
|
|
8082fdb3ff | ||
|
|
70cecb49b0 | ||
|
|
fb5efa2ffc | ||
|
|
43348c1629 | ||
|
|
baa2f7c5bb | ||
|
|
b4bc395c6e | ||
|
|
84882922b4 | ||
|
|
ba296408d5 | ||
|
|
13e5c19be7 | ||
|
|
68e62030d5 | ||
|
|
79503e4f14 | ||
|
|
e037f32408 | ||
|
|
76bb0729ba | ||
|
|
16432129b5 | ||
|
|
ea26deaab1 | ||
|
|
11f4e8cb73 | ||
|
|
bbe6a287f8 | ||
|
|
89659606dd | ||
|
|
be1ec93271 | ||
|
|
7cea3eb5ed | ||
|
|
191bae5cd4 | ||
|
|
fb2ea765d5 | ||
|
|
af05939d74 | ||
|
|
1176f6acec | ||
|
|
7dfd7e883f | ||
|
|
a8cf0ddf50 | ||
|
|
22c4298bee | ||
|
|
c20eaf98ec | ||
|
|
a5808833b1 | ||
|
|
cd16828fef | ||
|
|
b9f7ed9185 | ||
|
|
7f3ba85a3f | ||
|
|
86fdcabd0e | ||
|
|
ea08dd76a5 | ||
|
|
1ba39538a7 | ||
|
|
f339b6a491 | ||
|
|
d74fc2c285 | ||
|
|
87d0f09a44 | ||
|
|
d4e66ba52f | ||
|
|
1607478405 | ||
|
|
50e5c88b7b | ||
|
|
30362bfebe | ||
|
|
a7dfa83da1 | ||
|
|
99f9747a3f | ||
|
|
d4a06b27ed | ||
|
|
8c3b56511a | ||
|
|
1e8bf8c89d | ||
|
|
0e905a06d9 | ||
|
|
d1fc5a5611 | ||
|
|
f85e409ff7 | ||
|
|
6d5ba59515 | ||
|
|
c1ed520de0 | ||
|
|
f794018e95 | ||
|
|
ffa113511b | ||
|
|
07399d377f | ||
|
|
42e4c2d51c | ||
|
|
129ad0bbcb | ||
|
|
468d761e5c | ||
|
|
098f9b6ebb | ||
|
|
5197ca87ee | ||
|
|
20846c11c9 | ||
|
|
f60097ddb6 | ||
|
|
6f93ecf1d2 | ||
|
|
325a257f7d | ||
|
|
c021ecd13b | ||
|
|
9d4cd7b73e | ||
|
|
e7791c220a | ||
|
|
7ee23240f0 | ||
|
|
4c55e4968e | ||
|
|
1de7ea090c | ||
|
|
f67486e31f | ||
|
|
688790f13f | ||
|
|
cf18c4bb0a | ||
|
|
d370a86b43 | ||
|
|
152bb6f21b | ||
|
|
56b020987e | ||
|
|
58039fb420 | ||
|
|
c4e2f65051 | ||
|
|
b28a8411a4 | ||
|
|
ba600ac06a | ||
|
|
194ca19720 | ||
|
|
c9efb56e19 | ||
|
|
db2efe8485 | ||
|
|
72031d6f95 | ||
|
|
a272f8570c | ||
|
|
3f89362630 | ||
|
|
30eee76767 | ||
|
|
c2a4ed6fc4 | ||
|
|
a3b1cdb175 | ||
|
|
5afa4621f9 | ||
|
|
3c7e4b8c6c | ||
|
|
86eab79d9d | ||
|
|
3405f3eab1 | ||
|
|
2b7fae8fa6 | ||
|
|
cf19e38663 | ||
|
|
d0ae713b29 | ||
|
|
e2db4972be | ||
|
|
b77fdcdd68 | ||
|
|
945ebcbf9b | ||
|
|
aa9e4af783 | ||
|
|
ca008fb541 | ||
|
|
637f4eeb12 | ||
|
|
8872558e0d | ||
|
|
1a1467169d | ||
|
|
e0e722784c | ||
|
|
946ee8f8c4 | ||
|
|
a7bf13f23f | ||
|
|
977ad428ae | ||
|
|
a61bf90c17 | ||
|
|
7370776af1 | ||
|
|
cc1a334ba7 | ||
|
|
33f187eeee | ||
|
|
28391d2f52 | ||
|
|
09d9697985 | ||
|
|
28545d706f | ||
|
|
3a5e7fc2ed | ||
|
|
94ec245187 | ||
|
|
6fd9780e60 | ||
|
|
049537e470 | ||
|
|
5b0c936fee | ||
|
|
f811fdc2cd | ||
|
|
32298cad6b | ||
|
|
e24ab5a4f1 | ||
|
|
fa6b35ec8d | ||
|
|
75d0606bc0 | ||
|
|
a0bc1f9dae | ||
|
|
1741597a20 | ||
|
|
ebd0cdbc7a | ||
|
|
fba5082b00 | ||
|
|
27380cdadb | ||
|
|
2969d015ed | ||
|
|
bf46531372 | ||
|
|
90a272c519 | ||
|
|
f484beb7e1 | ||
|
|
78d3dfbfa6 | ||
|
|
503a5aea19 | ||
|
|
31b6b59f20 | ||
|
|
1def165c0b | ||
|
|
11f1aeb36e | ||
|
|
6c64aec137 | ||
|
|
b1cfbc460e | ||
|
|
fb0be9e730 | ||
|
|
256557d3cc | ||
|
|
5579582a52 | ||
|
|
564a996620 | ||
|
|
49899d0dee | ||
|
|
6fb54f4c9d | ||
|
|
1251315b28 | ||
|
|
5d997ef099 | ||
|
|
f738f5e032 | ||
|
|
0c4cd00c1f | ||
|
|
c8d2237f0a | ||
|
|
b53d0050dd | ||
|
|
9f84326ca7 | ||
|
|
9706f78a09 | ||
|
|
e952d62950 | ||
|
|
33e7f5e390 | ||
|
|
f8553ef90a | ||
|
|
828bf7cb9e | ||
|
|
399dfc4c2e | ||
|
|
3cba91bdd5 | ||
|
|
a7d7cb9ecb | ||
|
|
b0452cf309 | ||
|
|
5e1229366d | ||
|
|
cf9b6e9e07 | ||
|
|
852155959d | ||
|
|
f383af093c | ||
|
|
ca6c91f591 | ||
|
|
5ec096d57e | ||
|
|
dfac17538f | ||
|
|
95365670e4 | ||
|
|
1946346711 | ||
|
|
f084399d4b | ||
|
|
bfdbff5ac7 | ||
|
|
506ca15a15 | ||
|
|
634679966e | ||
|
|
306315e3e5 | ||
|
|
0ac41975a4 | ||
|
|
7d873b2c81 | ||
|
|
bb56c5827b | ||
|
|
6c6bbe9c57 | ||
|
|
7f0d1173ba | ||
|
|
55ebab2392 | ||
|
|
6cff58055d | ||
|
|
46f3b5f913 | ||
|
|
8f6febae18 | ||
|
|
407f046b9c | ||
|
|
01db310cea | ||
|
|
ef38d9c769 | ||
|
|
44c29ece17 | ||
|
|
b9febdda34 | ||
|
|
57b0be2a0b | ||
|
|
14b6b389f2 | ||
|
|
361d36f7d6 | ||
|
|
53308b4deb | ||
|
|
dcc695dda5 | ||
|
|
f9604892ce | ||
|
|
28fc0aacc0 | ||
|
|
fa7944ce3d | ||
|
|
a950b81ee8 | ||
|
|
f7929ffdd4 | ||
|
|
9b9ea93ff7 | ||
|
|
00ae3cf218 | ||
|
|
d249918fe7 | ||
|
|
d424194bbf | ||
|
|
2ef6f756d0 | ||
|
|
6363b0f69f | ||
|
|
9d2823da89 | ||
|
|
f3f45a1dd9 | ||
|
|
caec38d533 | ||
|
|
8cc321fe24 | ||
|
|
7c28b1cef9 | ||
|
|
4e41cbca81 | ||
|
|
994d056922 | ||
|
|
71278def5e | ||
|
|
9301963d98 | ||
|
|
ab06c9209b | ||
|
|
b5e10a53af | ||
|
|
56c705968b | ||
|
|
2d18bc936f | ||
|
|
237bd37030 | ||
|
|
d94030294a | ||
|
|
f4d5c7b48e | ||
|
|
96e92f1c38 | ||
|
|
d67d1eb355 | ||
|
|
9e7968c92e | ||
|
|
326e1b3a42 | ||
|
|
483687b6bf | ||
|
|
2d992d0c29 | ||
|
|
52e22b8a51 | ||
|
|
05f00a946d | ||
|
|
3ea26fcb0a | ||
|
|
93aa6c613a | ||
|
|
33248528b9 | ||
|
|
354ac7d6e5 | ||
|
|
2b78e511c9 | ||
|
|
9b91444638 | ||
|
|
72b1b41748 | ||
|
|
96496d6349 | ||
|
|
7c19930efa | ||
|
|
9150538ac4 | ||
|
|
d5d5b0918c | ||
|
|
0a85df10e8 | ||
|
|
effa2cf96d | ||
|
|
4a8fe6c99d | ||
|
|
3fc7faf24c | ||
|
|
f62d058186 | ||
|
|
06aefb54bc | ||
|
|
a22f0a0d03 | ||
|
|
889642c3d4 | ||
|
|
89b1b25fde | ||
|
|
6c74bfb153 | ||
|
|
9836c79962 | ||
|
|
ab288268bc | ||
|
|
80e48f3672 | ||
|
|
16395a820f | ||
|
|
6d8749fbdd | ||
|
|
152afbcbf7 | ||
|
|
7f26b5cbba | ||
|
|
2a19f91e99 | ||
|
|
49cc40708d | ||
|
|
a4dcbceb10 | ||
|
|
c75348392c | ||
|
|
04f7322f06 | ||
|
|
f5e44e373e | ||
|
|
da6a8b98e2 | ||
|
|
5bf047825f | ||
|
|
2e76def295 | ||
|
|
79d6c84a43 | ||
|
|
e7c4e5273a | ||
|
|
f9c08df235 | ||
|
|
c622fc62d5 | ||
|
|
29531ae72f | ||
|
|
96a4eb5b9e | ||
|
|
8721f868a6 | ||
|
|
0d642f3109 | ||
|
|
d9acbbb027 | ||
|
|
c16a46dca7 | ||
|
|
2cb085db91 | ||
|
|
aa6db4e69d | ||
|
|
00ce4aaa26 | ||
|
|
14bcca54d2 | ||
|
|
e95f610195 | ||
|
|
25c88b7529 | ||
|
|
2a721b4eda | ||
|
|
a8affa6dee | ||
|
|
beb33672bd | ||
|
|
b6d1801e12 | ||
|
|
7e9779e334 | ||
|
|
271d3f3e57 | ||
|
|
7d27aceee4 | ||
|
|
23f1a8fd48 | ||
|
|
e74c333819 | ||
|
|
a51bc6cd36 | ||
|
|
75981ec0ab | ||
|
|
0bb5167fda | ||
|
|
b99825bcac | ||
|
|
0d507922ce | ||
|
|
5a1564a63b | ||
|
|
4dd63c81a6 | ||
|
|
ad00bd7bc8 | ||
|
|
0b1442faa2 | ||
|
|
4480cf512a | ||
|
|
b32e2f9549 | ||
|
|
c449bf5663 | ||
|
|
15a8860e8a | ||
|
|
0a49efd018 | ||
|
|
c3f33aefdd | ||
|
|
58fd0175bf | ||
|
|
ac73b2628a | ||
|
|
1583f7d434 | ||
|
|
8f56b21ca9 | ||
|
|
59ed67a3f7 | ||
|
|
b49e652ae7 | ||
|
|
9b13dd7216 | ||
|
|
1e117d1ee5 | ||
|
|
0595caf50c | ||
|
|
2ac438a82d | ||
|
|
008d009e3e | ||
|
|
c34e3535e0 | ||
|
|
e2465b1eab | ||
|
|
7c2adc4137 | ||
|
|
e22e4b9b8b | ||
|
|
fdd030d101 | ||
|
|
66477a9476 | ||
|
|
e942f86bd7 | ||
|
|
4fe99b7dea | ||
|
|
0ab9775561 | ||
|
|
f83a8f3ba1 | ||
|
|
8f7624f5cb | ||
|
|
ea669ac6b6 | ||
|
|
d238b5e578 | ||
|
|
a86c39f7fa | ||
|
|
0260e9322a | ||
|
|
5ef2605cbc | ||
|
|
d1f123967c | ||
|
|
6cd4724901 | ||
|
|
aed9c79237 | ||
|
|
6a544b7d8e | ||
|
|
7068901649 | ||
|
|
ea4346e945 | ||
|
|
c2787d80c8 | ||
|
|
bf62357731 | ||
|
|
b16fa5cc34 | ||
|
|
3865e4cdba | ||
|
|
45b908f6ba | ||
|
|
2f52699c9b | ||
|
|
940dda885b | ||
|
|
9ecbc160dc | ||
|
|
b9d956c69b | ||
|
|
36104edc63 | ||
|
|
5aaa8e439f | ||
|
|
922400f191 | ||
|
|
d4a0ad0a60 | ||
|
|
fe14f6f160 | ||
|
|
1e9b64a786 | ||
|
|
9a3e6a6135 | ||
|
|
7cacdba191 | ||
|
|
020b490a72 | ||
|
|
2d6f9af612 | ||
|
|
22e6e3f995 | ||
|
|
a73323e64c | ||
|
|
242b986196 | ||
|
|
0810de4415 | ||
|
|
80a28b9b72 | ||
|
|
b4fc75828e | ||
|
|
2947a91c3e | ||
|
|
0f4fbadd36 | ||
|
|
d5555de1b9 | ||
|
|
3417b27832 | ||
|
|
0b78a1ead9 | ||
|
|
4670fd43ed | ||
|
|
5d06b04e41 | ||
|
|
4709edefff | ||
|
|
53281a9454 | ||
|
|
fb82d185c7 | ||
|
|
8956d7e02b | ||
|
|
dcb7546d6d | ||
|
|
3c6669bd98 | ||
|
|
6b1db6a656 | ||
|
|
4c5425dbde | ||
|
|
c97cb5d665 | ||
|
|
8b84b4f128 | ||
|
|
11b0daf6cb | ||
|
|
04e704603f | ||
|
|
729f9c803d | ||
|
|
bb6d47d0cd | ||
|
|
08a0d42ed3 | ||
|
|
5fc944ae1d | ||
|
|
bacac7d0af | ||
|
|
0458a3378c | ||
|
|
5ccf653841 | ||
|
|
ef9b49f0b2 | ||
|
|
ffc5d726bd | ||
|
|
f5c2bea134 | ||
|
|
8381e79da6 | ||
|
|
3e280a3386 | ||
|
|
f5fcada5ba | ||
|
|
ee474b425b | ||
|
|
c47d08e308 | ||
|
|
69af2de3ba | ||
|
|
bad735a8e6 | ||
|
|
3e4adcb3b6 | ||
|
|
09b2d7b3a6 | ||
|
|
3c665f7640 | ||
|
|
f2a5630fdf | ||
|
|
26ed38ecc2 | ||
|
|
ffc10fec8b | ||
|
|
a61ab6d40f | ||
|
|
e3c20e1c64 | ||
|
|
8b1197b335 | ||
|
|
3908ddf609 | ||
|
|
59e18ad659 | ||
|
|
e0ae0724e2 | ||
|
|
e149402d81 | ||
|
|
e47af7f745 | ||
|
|
273e4d6f32 | ||
|
|
bffa1e1ec9 | ||
|
|
9ce9fd390d | ||
|
|
4b82fc1d1f | ||
|
|
c56a67a55a | ||
|
|
f2a08d57e4 | ||
|
|
225a5ee825 | ||
|
|
407ab30503 | ||
|
|
a21f2a0998 | ||
|
|
2f174a6441 | ||
|
|
314ced57c8 | ||
|
|
46c8324c52 | ||
|
|
b8eb3d07ba | ||
|
|
3c67ac636b | ||
|
|
10e2659600 | ||
|
|
98b3962412 | ||
|
|
5df817c8e0 | ||
|
|
cd044ec096 | ||
|
|
caf4d179a2 | ||
|
|
58c47069d8 | ||
|
|
60157e6f6c | ||
|
|
62455a4094 | ||
|
|
41153dd37c | ||
|
|
55051951f8 | ||
|
|
524a495ffd | ||
|
|
2812f8cae6 | ||
|
|
881678b613 | ||
|
|
5aa54e0c1a | ||
|
|
5b8ca74d65 | ||
|
|
d093c5755e | ||
|
|
3c1c3ac156 | ||
|
|
8389f771e9 | ||
|
|
3c88e70270 | ||
|
|
5086880093 | ||
|
|
bde0a5b811 | ||
|
|
3138584320 | ||
|
|
17f26ad588 | ||
|
|
bd2149406d | ||
|
|
5547b44e5a | ||
|
|
6826712861 | ||
|
|
0ffc222fba | ||
|
|
ef34b3d9aa | ||
|
|
3e2875f3d5 | ||
|
|
060e4bcd32 | ||
|
|
2812dee8d4 | ||
|
|
799f1b7b08 | ||
|
|
763d78af87 | ||
|
|
119ae94816 | ||
|
|
7516b737ee | ||
|
|
5c4086bf8e | ||
|
|
295efdba55 | ||
|
|
ca4ddfb963 | ||
|
|
13c25c5d49 | ||
|
|
29b0bb1184 | ||
|
|
59f98a2a20 | ||
|
|
38fa25edbe | ||
|
|
099e57c4e3 | ||
|
|
d5b6f42965 | ||
|
|
058ef59b13 | ||
|
|
d84f382ab8 | ||
|
|
e7d8cfb8e0 | ||
|
|
b441750cc9 | ||
|
|
00372cf747 | ||
|
|
0b589915b9 | ||
|
|
16ad086e7f | ||
|
|
264c9bfd3c | ||
|
|
77a535865b | ||
|
|
99b8e28051 | ||
|
|
c4c17aa1da | ||
|
|
222a1bd29b | ||
|
|
b7798d3869 | ||
|
|
9b2f545391 | ||
|
|
b7ab2c4da8 | ||
|
|
1708a0e3b4 | ||
|
|
d909bc05c4 | ||
|
|
dc7e105ef8 | ||
|
|
edb8f1fd7e | ||
|
|
6f4a98333e | ||
|
|
f81914351d | ||
|
|
7ac985dded | ||
|
|
1b2ef60bbe | ||
|
|
313e77fc3b | ||
|
|
4d527e152c | ||
|
|
4931a300f2 | ||
|
|
5b2d726a02 | ||
|
|
01e7d2d872 | ||
|
|
f5985bbffc | ||
|
|
32ca8066e9 | ||
|
|
405e3e2e7d | ||
|
|
30dc58ce49 | ||
|
|
cb4288b861 | ||
|
|
08874e8483 | ||
|
|
987b84c530 | ||
|
|
1e1e567435 | ||
|
|
f5f79ee0a9 | ||
|
|
293722a179 | ||
|
|
fd2d55934b | ||
|
|
158f75b65d | ||
|
|
3f5382d52c | ||
|
|
dca67a3c85 | ||
|
|
a9cceefaa4 | ||
|
|
3ce2374aeb | ||
|
|
fbc28ce493 | ||
|
|
f88498dad0 | ||
|
|
4b9aa76f1a | ||
|
|
9892e43c4e | ||
|
|
f858a38d3b | ||
|
|
a19629e2d2 | ||
|
|
6149423e47 | ||
|
|
3ce71171b6 | ||
|
|
fc4dbe8713 | ||
|
|
87c2d27a5a | ||
|
|
b191d3517d | ||
|
|
c7d6444ae0 | ||
|
|
bdb35cfaed | ||
|
|
5a5f13205e | ||
|
|
f1f81777cc | ||
|
|
dab16af018 | ||
|
|
7fbe3f4721 | ||
|
|
6b03a3218c | ||
|
|
99c7e1efed | ||
|
|
8af86aae84 | ||
|
|
b1330b9375 | ||
|
|
806f5b9064 | ||
|
|
cb1096d1e1 | ||
|
|
9a82607385 | ||
|
|
40e0d370c2 | ||
|
|
5609b555d2 | ||
|
|
0c42126b8f | ||
|
|
fa47f1c28b | ||
|
|
9adb79ed0e | ||
|
|
a6d140616b | ||
|
|
c5dc281934 | ||
|
|
f836e07fd3 | ||
|
|
c351bcd5a2 | ||
|
|
41f15929b9 | ||
|
|
14241c8d14 | ||
|
|
283ce13454 | ||
|
|
6af8e5f7e7 | ||
|
|
ef3e9489a8 | ||
|
|
a232aabda3 | ||
|
|
36515570b4 | ||
|
|
9b329296e4 | ||
|
|
593ccd2510 | ||
|
|
54300b136c | ||
|
|
98ab30d102 | ||
|
|
c0e7b859d7 | ||
|
|
93822bd2a2 | ||
|
|
60ea89ca1c | ||
|
|
a8bd7d07df | ||
|
|
edba351335 | ||
|
|
be7eb63d1c | ||
|
|
8ecbb53e99 | ||
|
|
fa95419c27 | ||
|
|
6e97496b27 | ||
|
|
3fe21f5931 | ||
|
|
c48374dbc6 | ||
|
|
1d09844950 | ||
|
|
edf4735542 | ||
|
|
2d9db0cf67 | ||
|
|
dfa8196543 | ||
|
|
2004f1b5e5 | ||
|
|
dc6ade4ae3 | ||
|
|
4bfbb56701 | ||
|
|
610251fdf7 | ||
|
|
66e63ee081 | ||
|
|
587862a370 | ||
|
|
6c35c5e604 | ||
|
|
fed853593b | ||
|
|
8340f135fc | ||
|
|
26e23da4c0 | ||
|
|
d3411a50a4 | ||
|
|
69add61174 | ||
|
|
032d29ec86 | ||
|
|
5f7cc437dd | ||
|
|
219e88a023 | ||
|
|
6ebd5009fc | ||
|
|
373284ca0a | ||
|
|
d823fd7685 | ||
|
|
a63be702e1 | ||
|
|
04d5b5cbe6 | ||
|
|
e839404bd2 | ||
|
|
1d5b29fb48 | ||
|
|
60875905ac | ||
|
|
0ef6de930f | ||
|
|
215973c7ab | ||
|
|
dab54cf2a7 | ||
|
|
8f16515d82 | ||
|
|
80d04ead33 | ||
|
|
fcf7f392f0 | ||
|
|
508daad011 | ||
|
|
f9f11b6f74 | ||
|
|
f129126a82 | ||
|
|
64294853cc | ||
|
|
c4727ac021 | ||
|
|
2560640b29 | ||
|
|
72acd67644 | ||
|
|
6395095659 | ||
|
|
1852f1b462 | ||
|
|
9bd41761fc | ||
|
|
b7c790d741 | ||
|
|
bf4ab6daa8 | ||
|
|
4569c25127 | ||
|
|
46a25b31ab | ||
|
|
08980dabd6 | ||
|
|
ed633bd0b7 | ||
|
|
8074fee28c | ||
|
|
8e64379ed4 | ||
|
|
6279237c86 | ||
|
|
db2354a252 | ||
|
|
2adeb9fe88 | ||
|
|
d1e3c633e5 | ||
|
|
123a0f0b40 | ||
|
|
1e0a787012 | ||
|
|
ccd417f713 | ||
|
|
91f1f4c174 | ||
|
|
1e9e0c32fa | ||
|
|
da05aa51fe | ||
|
|
ad37b7fd2a | ||
|
|
5d6ca1498e | ||
|
|
e3ce5d94e1 | ||
|
|
12d1dcddeb | ||
|
|
0668f91b0c | ||
|
|
d1d3d847ab | ||
|
|
730d60e5e4 | ||
|
|
f27d88f6ab | ||
|
|
d4f0902968 | ||
|
|
3438cda432 | ||
|
|
09beeaba8e | ||
|
|
fd03f58eae | ||
|
|
a52043d5b3 | ||
|
|
1f9eb97d0a | ||
|
|
dc91e57c2f | ||
|
|
5685fde606 | ||
|
|
a8eb34ddb8 | ||
|
|
b671cbd71f | ||
|
|
460d5bffd7 | ||
|
|
ca17644289 | ||
|
|
e6be5016f9 | ||
|
|
9b7c48110a | ||
|
|
8b3e84f7fe | ||
|
|
d14d590c2b | ||
|
|
d5f9cccf5e | ||
|
|
405a6bfc04 | ||
|
|
1105b74174 | ||
|
|
85da55a537 | ||
|
|
e8fa429438 | ||
|
|
aea185471a | ||
|
|
47cfab2bbf | ||
|
|
6d425bb5bb | ||
|
|
201d47a483 | ||
|
|
0d7e52ac6f | ||
|
|
4cde01d81a | ||
|
|
d01a79f58f | ||
|
|
963b82afe9 | ||
|
|
9d8feff28d | ||
|
|
952a834e43 | ||
|
|
d8179ceeb2 | ||
|
|
919c185021 | ||
|
|
18503eaa53 | ||
|
|
2a185963a9 | ||
|
|
072a8e0105 | ||
|
|
167f61bef0 | ||
|
|
35465debd6 | ||
|
|
fa63d9e34a | ||
|
|
675af841e8 | ||
|
|
1395d58d39 | ||
|
|
99d127bb34 | ||
|
|
5cd6a04082 | ||
|
|
326855dc3a | ||
|
|
b04d8196c7 | ||
|
|
ebd9eb1715 | ||
|
|
2f02b43352 | ||
|
|
0a60da622f | ||
|
|
8c447dcce2 | ||
|
|
2fd23dc18f | ||
|
|
da315845ff | ||
|
|
f29c59404f | ||
|
|
54d594c486 | ||
|
|
67d04c5952 | ||
|
|
4854f6923b | ||
|
|
a8772ed5c1 | ||
|
|
3468b9a8c0 | ||
|
|
123287d977 | ||
|
|
0f7e3cdfe2 | ||
|
|
12f4b5ea8a | ||
|
|
f23f35aa13 | ||
|
|
71dd9fb2df | ||
|
|
7f1a1b7b96 | ||
|
|
0681346201 | ||
|
|
239e2c82e6 | ||
|
|
d681b96a7b | ||
|
|
97fbc11a8f | ||
|
|
92feabf3e7 | ||
|
|
3bbfcefb0b | ||
|
|
ba30234397 | ||
|
|
054fa71b52 | ||
|
|
0291b9a1c3 | ||
|
|
71de6b8849 | ||
|
|
40d3301c68 | ||
|
|
3e09f99845 | ||
|
|
7097451323 | ||
|
|
be40553674 | ||
|
|
198613a854 | ||
|
|
fc3d424315 | ||
|
|
579d2b1f02 | ||
|
|
34f6c1f2f1 | ||
|
|
bd377e1f28 | ||
|
|
bf5023f4d4 | ||
|
|
94ec102d67 | ||
|
|
3d578bec76 | ||
|
|
3a2f5954d7 | ||
|
|
3de46a31d9 | ||
|
|
44ea98801b | ||
|
|
15ecbaf59c | ||
|
|
02b336ee29 | ||
|
|
40b97045f0 | ||
|
|
6399c0a2c7 | ||
|
|
5d626c7dd3 | ||
|
|
9592ccc0df | ||
|
|
b1cf44a88c | ||
|
|
6da9e19f73 | ||
|
|
cd6a09c0df | ||
|
|
6a7c25e2be | ||
|
|
c20ca0fa4e | ||
|
|
3ebfd0183a | ||
|
|
63a9fa172c | ||
|
|
d7c377dea6 | ||
|
|
75b23aac02 | ||
|
|
ad86feb667 | ||
|
|
2178f09eec | ||
|
|
b606fb68cf | ||
|
|
d150529730 | ||
|
|
9655ce8dbf | ||
|
|
7c5b171e3f | ||
|
|
6b8e7bdfb3 | ||
|
|
a8c725a891 | ||
|
|
6cac296366 | ||
|
|
8bb49f05d0 | ||
|
|
8b7e0a0dbe | ||
|
|
254ac6f253 | ||
|
|
43e1d89067 | ||
|
|
0d453e52ad | ||
|
|
f608db3a68 | ||
|
|
6db02134e9 | ||
|
|
bdd6674958 | ||
|
|
156a2336de | ||
|
|
cbe1e4599d | ||
|
|
32fd35843f | ||
|
|
a37647b3d1 | ||
|
|
edc527b3ab | ||
|
|
8805d04183 | ||
|
|
53c4ed09a3 | ||
|
|
fc211f0934 | ||
|
|
7d7b315511 | ||
|
|
c8ac1a2351 | ||
|
|
ff0e6eb0d5 | ||
|
|
993e16afbd | ||
|
|
785e9d1be6 | ||
|
|
f9c0e0c152 | ||
|
|
579d41b174 | ||
|
|
c2ffb6c255 | ||
|
|
64819981f2 | ||
|
|
00685f357f | ||
|
|
845fa97da1 | ||
|
|
aaf04e793d | ||
|
|
b34ff82987 | ||
|
|
af14c68acc | ||
|
|
2aa3183c16 | ||
|
|
8ea53b69eb | ||
|
|
44d9ccf2c5 | ||
|
|
c981d6431d | ||
|
|
52726088f3 | ||
|
|
079a39a5f1 | ||
|
|
dc4654fa4c | ||
|
|
3d94670f1f | ||
|
|
b30fc3a715 | ||
|
|
51d182eb5a | ||
|
|
3f04f4e5c6 | ||
|
|
f231440480 | ||
|
|
b45ed30936 | ||
|
|
8184e27cb8 | ||
|
|
c014d5d12e | ||
|
|
22d9edb138 | ||
|
|
cdcbc56255 | ||
|
|
100e6fa88f | ||
|
|
e1b841b526 | ||
|
|
2c2e8ef154 | ||
|
|
c99a486826 | ||
|
|
d50c9f9fac | ||
|
|
830ef7ddfc | ||
|
|
cb2e1e1572 | ||
|
|
1864c243fa | ||
|
|
19e05595c8 | ||
|
|
17a9bb81e8 | ||
|
|
28122a1e89 | ||
|
|
ee337471c2 | ||
|
|
aa7ecdbd65 | ||
|
|
01a39e4f4e | ||
|
|
b2665d0c5e | ||
|
|
3be2763929 | ||
|
|
416040f313 | ||
|
|
8dbd6f36b5 | ||
|
|
a7ce6fca9e | ||
|
|
ae5eece76f | ||
|
|
6c18a1f285 | ||
|
|
cbba403992 | ||
|
|
e6136eb075 | ||
|
|
e214489106 | ||
|
|
0ab57c48c3 | ||
|
|
bc03040b0f | ||
|
|
1700b6a087 | ||
|
|
1aa34e9dd4 | ||
|
|
3352b0e916 | ||
|
|
9a867ad277 | ||
|
|
4e013ba2fc | ||
|
|
a0db1d5416 | ||
|
|
97449afbb9 | ||
|
|
038b67cbd4 | ||
|
|
c2d2e41624 | ||
|
|
ebd7273071 | ||
|
|
0e026ed11f | ||
|
|
7624bcf49e | ||
|
|
d7fb464fa9 | ||
|
|
a0cbe7cd7e | ||
|
|
0cdac6de3c | ||
|
|
a134f939e9 | ||
|
|
0c8afa932a | ||
|
|
f2a0e24491 | ||
|
|
2ab9d02158 | ||
|
|
0e5395013a | ||
|
|
8906b78b07 | ||
|
|
205f062433 | ||
|
|
8ed8652296 | ||
|
|
068c0f3782 | ||
|
|
c4d45e0cf0 | ||
|
|
6701aff2a2 | ||
|
|
677193ca52 | ||
|
|
7051529880 | ||
|
|
74f7f3f016 | ||
|
|
72b604b8e8 | ||
|
|
52e9801721 | ||
|
|
8a5aa354f2 | ||
|
|
c2933e005a | ||
|
|
2a3e695f8a | ||
|
|
b4c2505eab | ||
|
|
dcb23de65c | ||
|
|
6ac350a996 | ||
|
|
6e9ea76aab | ||
|
|
f1f421af76 | ||
|
|
fbb166f3ce | ||
|
|
ef10c6f637 | ||
|
|
f4df3860b0 | ||
|
|
40fc3dc060 | ||
|
|
2ec40604d9 | ||
|
|
5afd32dd84 | ||
|
|
d2d5806e9b | ||
|
|
aa47d944e1 | ||
|
|
f75fb6a59f | ||
|
|
d15ce15751 | ||
|
|
d536d20643 | ||
|
|
05a9c16329 | ||
|
|
83d08ba399 | ||
|
|
7c6f0e472d | ||
|
|
6feb503c67 | ||
|
|
004cd00f13 | ||
|
|
865847f71d | ||
|
|
c611566a3e | ||
|
|
4396eaeebb | ||
|
|
fef8237701 | ||
|
|
46bfed6750 | ||
|
|
9fb19e6dd0 | ||
|
|
0cef2cfc46 | ||
|
|
c729f9d9ca | ||
|
|
387d0743e6 | ||
|
|
83b132ace2 | ||
|
|
b9623e6c5b | ||
|
|
2cb1937e1e | ||
|
|
cabccf9ef5 | ||
|
|
7bba745f8b | ||
|
|
bc6a892f2b | ||
|
|
9a227dce46 | ||
|
|
521f2a1433 | ||
|
|
718feeccbc | ||
|
|
a2fc006ee5 | ||
|
|
da027e93cf | ||
|
|
2d55e08b41 | ||
|
|
ab9b8c7bf3 | ||
|
|
40f20de7aa | ||
|
|
24cb15ef2e | ||
|
|
7d93fa2533 | ||
|
|
2face3f938 | ||
|
|
bd7cd68c32 | ||
|
|
bc5df9c908 | ||
|
|
c837c3164a | ||
|
|
152f132b7b | ||
|
|
66837452c2 | ||
|
|
203438fb42 | ||
|
|
693a3b0739 | ||
|
|
1bfcbca8af | ||
|
|
e5c6579a8c | ||
|
|
52dbcd8152 | ||
|
|
906e9b395e | ||
|
|
48d8d1c628 | ||
|
|
1d822132f0 | ||
|
|
d6f94c4ad7 | ||
|
|
a76aad2e12 | ||
|
|
d16558eb83 | ||
|
|
bd338a5741 | ||
|
|
ef297dbec7 | ||
|
|
79aa8570d0 | ||
|
|
48be70e4a8 | ||
|
|
e4ec80941c | ||
|
|
f8dd1a6354 | ||
|
|
839cecd2da | ||
|
|
62c32eb288 | ||
|
|
1c9cc6167d | ||
|
|
3b8c6a1ab2 | ||
|
|
79b8dd829d | ||
|
|
ae3e6d7fe8 | ||
|
|
757f0c9bc4 | ||
|
|
2309e19fd9 | ||
|
|
a1fb0619bb | ||
|
|
7d77324765 | ||
|
|
0dc1ddef9a | ||
|
|
58bb5e967a | ||
|
|
4e97a0b868 | ||
|
|
7fb365634a | ||
|
|
942d38fb13 | ||
|
|
e58ec31e20 | ||
|
|
338e5fadb9 | ||
|
|
cee45e1a8e | ||
|
|
a6bd15d333 | ||
|
|
48c72a168c | ||
|
|
3e6d0602ea | ||
|
|
0d77937caf | ||
|
|
4da8ede826 | ||
|
|
a61d1d8d51 | ||
|
|
b1793fcb16 | ||
|
|
2dc314f993 | ||
|
|
7ae60056b2 | ||
|
|
a3f6d36018 | ||
|
|
c695b83e52 | ||
|
|
3fb180973b | ||
|
|
fece330ca4 | ||
|
|
309af743e0 | ||
|
|
1f03ae54d6 | ||
|
|
85b08e6e7b | ||
|
|
7929af67c8 | ||
|
|
0f96ce9bd2 | ||
|
|
c4021a77ca | ||
|
|
0b35a36cb0 | ||
|
|
a285fbab6d | ||
|
|
0f889d4222 | ||
|
|
dec69651fd | ||
|
|
0621da8535 | ||
|
|
833c5fdd31 | ||
|
|
a76eb022d0 | ||
|
|
c88601a376 | ||
|
|
caedb64ade | ||
|
|
83f5cc6aa6 | ||
|
|
e1c3ab1846 | ||
|
|
b684bc9ba0 | ||
|
|
cd26ccba6b | ||
|
|
c382fa7eab | ||
|
|
5c4edbdd6b | ||
|
|
de484b2495 | ||
|
|
7247f9e27f | ||
|
|
03ca9d2c06 | ||
|
|
f92a0c8df2 | ||
|
|
bc04e0c713 | ||
|
|
b1557b547b | ||
|
|
0e7778a7b7 | ||
|
|
4050462ad4 | ||
|
|
22bc9f6458 | ||
|
|
884f2dd873 | ||
|
|
5e44769f82 | ||
|
|
95dda4aa68 | ||
|
|
81c36499ea | ||
|
|
10c309fccb | ||
|
|
c0da47db9c | ||
|
|
5cd3eaa111 | ||
|
|
ecfcc4f3b6 | ||
|
|
b9584b7ec9 | ||
|
|
0925968840 | ||
|
|
8741a85443 | ||
|
|
d54c95da9d | ||
|
|
fdba8de600 | ||
|
|
bd892026f6 | ||
|
|
be32e79a7a | ||
|
|
8427e99c73 | ||
|
|
974222aabd | ||
|
|
188e325b20 | ||
|
|
5a96f99a8c | ||
|
|
196c6e8ecc | ||
|
|
b4849d1c58 | ||
|
|
e538b417f0 | ||
|
|
d96858d38c | ||
|
|
99bae23996 | ||
|
|
ab4bfbac0d | ||
|
|
77bdca5b68 | ||
|
|
d57b0177a7 | ||
|
|
74245be4f5 | ||
|
|
eac73a4e54 | ||
|
|
c970d7f80e | ||
|
|
9dea31031c | ||
|
|
1eb0f1b991 | ||
|
|
6d939ddfce | ||
|
|
828d20629b | ||
|
|
b0f233a06c | ||
|
|
e5f54966af | ||
|
|
b64713e5ac | ||
|
|
e98cfd84a9 | ||
|
|
b9b0444662 | ||
|
|
ec4f7c4190 | ||
|
|
7045e9f2f7 | ||
|
|
2cecb1eada | ||
|
|
59d0d2df9a | ||
|
|
26dd67ebeb | ||
|
|
40ac01b730 | ||
|
|
85833d228a | ||
|
|
d5ec1775ef | ||
|
|
d6d0f8d4eb | ||
|
|
7ba396b8d3 | ||
|
|
7628df6fe6 | ||
|
|
ffbc6f51cb | ||
|
|
dfef09161c | ||
|
|
c476e7da31 | ||
|
|
97051cb949 | ||
|
|
81beaf1094 | ||
|
|
8cdb013f9f | ||
|
|
683c13db37 | ||
|
|
9b241faf01 | ||
|
|
d844de442a | ||
|
|
47ca84041b | ||
|
|
4e5ebc9457 | ||
|
|
f6e8c03ff6 | ||
|
|
0de73609d2 | ||
|
|
38de95cc3b | ||
|
|
c8b65c769b | ||
|
|
42499addc8 | ||
|
|
5503cd4646 | ||
|
|
44223f3658 | ||
|
|
8f4323f3bb | ||
|
|
7320ad077f | ||
|
|
3eb08b0d61 | ||
|
|
dc8b9c3205 | ||
|
|
829ed4d0a6 | ||
|
|
acd39843d4 | ||
|
|
a1fe1a6136 | ||
|
|
d5fa49376e | ||
|
|
d3c1b5455b | ||
|
|
8532f2dc2e | ||
|
|
b4ba070619 | ||
|
|
6827ff9319 | ||
|
|
7af0a1dc2c | ||
|
|
f6b7884a1d | ||
|
|
c53974f125 | ||
|
|
8ad66875e5 | ||
|
|
7bc3c0b026 | ||
|
|
2117d363e2 | ||
|
|
9e7ff2c00e | ||
|
|
e792998d0a | ||
|
|
fe722419e7 | ||
|
|
2d1a837a8b | ||
|
|
1957a14961 | ||
|
|
615e03542e | ||
|
|
45c3600d5a | ||
|
|
97fe4fcab4 | ||
|
|
3a019801d2 | ||
|
|
8fd8f687ee | ||
|
|
eb651b6462 | ||
|
|
5c964694b4 | ||
|
|
26f41b711c | ||
|
|
0ccb9df4f1 | ||
|
|
fd834084f9 | ||
|
|
90d135e018 | ||
|
|
420f473f90 | ||
|
|
1be92ea8ef | ||
|
|
13df958f4a | ||
|
|
4cf18c728d | ||
|
|
e2e067cdd0 | ||
|
|
54ff64c0e0 | ||
|
|
c5edf237b2 | ||
|
|
81291622eb | ||
|
|
48df41a30a | ||
|
|
706c56f56a | ||
|
|
5107fc5897 | ||
|
|
ac655af091 | ||
|
|
9e912c7c0d | ||
|
|
6cedb263aa | ||
|
|
b4f7f220f1 | ||
|
|
e9f673e08d | ||
|
|
809c239ff8 | ||
|
|
76696e3b49 | ||
|
|
08b9cc2c41 | ||
|
|
a4f03100e9 | ||
|
|
6ee13b0000 | ||
|
|
4a58e142bd | ||
|
|
02f43f2e8c | ||
|
|
29c85e16cd | ||
|
|
826928d2ba | ||
|
|
735aa8ca17 | ||
|
|
89dc6fa9cc | ||
|
|
00820c342a | ||
|
|
c2b3ba533b | ||
|
|
a4103e0830 | ||
|
|
f0862acffe | ||
|
|
4e8092b008 | ||
|
|
450ae4147f | ||
|
|
94932386e3 | ||
|
|
487ba9b08a | ||
|
|
1131618630 | ||
|
|
ead43eecd0 | ||
|
|
ff51d0fa67 | ||
|
|
0f21779ec4 | ||
|
|
0a6fea1b77 | ||
|
|
70624f816a | ||
|
|
1f8e0f86ac | ||
|
|
c9e54d8913 | ||
|
|
dac90992ad | ||
|
|
49dd666199 | ||
|
|
361280a9be | ||
|
|
e09de6ea3d | ||
|
|
e7574d4516 | ||
|
|
0684abd345 | ||
|
|
e85a2f3804 | ||
|
|
a9a1c80fac | ||
|
|
707f67c6b4 | ||
|
|
89986ec0e0 | ||
|
|
0b4355d549 | ||
|
|
bd9cfb4ee5 | ||
|
|
ade8b8356b | ||
|
|
1ca7c35c19 | ||
|
|
8ce073ed9a | ||
|
|
1e23a4c888 | ||
|
|
16618094f5 | ||
|
|
1fe575bf7b | ||
|
|
7ad7996144 | ||
|
|
bf84aee5f6 | ||
|
|
51275f79f8 | ||
|
|
451a5d78e3 | ||
|
|
19b6c74675 | ||
|
|
6c6d919eac | ||
|
|
98bae098be | ||
|
|
3250e36b4a | ||
|
|
b03679e1a6 | ||
|
|
82a8810057 | ||
|
|
d7039b72e2 | ||
|
|
e1c0177932 | ||
|
|
65dadcc2a2 | ||
|
|
c6dc6c0c41 | ||
|
|
d0f7555348 | ||
|
|
9424d53062 | ||
|
|
4fc8a8d5cd | ||
|
|
4b6e1dd4d2 | ||
|
|
3ea52c2324 | ||
|
|
c133a2fd35 | ||
|
|
e10457d235 | ||
|
|
88e23fcb9a | ||
|
|
874393ba06 | ||
|
|
e6a273f3a7 | ||
|
|
12e1abdfb7 | ||
|
|
aebc91d96f | ||
|
|
05ff8a0b94 | ||
|
|
7cfe1d258b | ||
|
|
fb51ac0d95 | ||
|
|
1031ce641d | ||
|
|
896ba57555 | ||
|
|
0c9c97fcb9 | ||
|
|
e6aba74726 | ||
|
|
9e23a0c240 | ||
|
|
19f23f8445 | ||
|
|
349584772b | ||
|
|
da6f6d57cd | ||
|
|
e970dd4530 | ||
|
|
b1327a045f | ||
|
|
90e20cbcad | ||
|
|
cd835e88fc | ||
|
|
fadbc61dff | ||
|
|
c3a79c1478 | ||
|
|
f724cab92d | ||
|
|
1e40997ff7 | ||
|
|
c9f5a9bc9a | ||
|
|
03a4f9e268 | ||
|
|
08b4488ef3 | ||
|
|
eaf22198e2 | ||
|
|
87fb0b31eb | ||
|
|
9f19d2993c | ||
|
|
c6ba378b6b | ||
|
|
5d3ead91e2 | ||
|
|
9b28e04b85 | ||
|
|
89dbc2ac25 | ||
|
|
179569f9f8 | ||
|
|
0dbe6684ad | ||
|
|
9c92d601b1 | ||
|
|
04af38bb0d | ||
|
|
fcc0432856 | ||
|
|
5499f4530c | ||
|
|
b458452f0e | ||
|
|
36ff65d050 | ||
|
|
197ea7f7d6 | ||
|
|
8d67316ece | ||
|
|
8ae103087d | ||
|
|
cfe3b07130 | ||
|
|
38d470f3bc | ||
|
|
03da6c991f | ||
|
|
7e8b6c3660 | ||
|
|
22d1def894 | ||
|
|
b25551be7b | ||
|
|
176b9a992d | ||
|
|
51cfd4b0ea | ||
|
|
ecd33a6093 | ||
|
|
4771fdf0fb | ||
|
|
2a856a13f0 | ||
|
|
d71c5d4c17 | ||
|
|
d3f83ad7be | ||
|
|
99c5794929 | ||
|
|
e461916f5a | ||
|
|
756f964130 | ||
|
|
70ee6aa942 | ||
|
|
ed0047725c | ||
|
|
1554d5adef | ||
|
|
d1fa292956 | ||
|
|
190630cc6b | ||
|
|
dd2fb4df67 | ||
|
|
62e94e1744 | ||
|
|
8f54c24e47 | ||
|
|
2fd036b073 | ||
|
|
68a13973a4 | ||
|
|
55a14b3aaf | ||
|
|
eb8e92c37f | ||
|
|
389d17974e | ||
|
|
ebd2a92267 | ||
|
|
d84e008e00 | ||
|
|
fd39975cf0 | ||
|
|
eb2171e287 | ||
|
|
7ea53d39e6 | ||
|
|
a8a21da9ba | ||
|
|
bfac5f9238 | ||
|
|
18939462c3 | ||
|
|
8d6ea3a0ef | ||
|
|
8709dd28f8 | ||
|
|
3a4a7ac822 | ||
|
|
5b204a5ff5 | ||
|
|
3479a9bf95 | ||
|
|
a6d268db16 | ||
|
|
8e52510dbb | ||
|
|
3bbdc03d0c | ||
|
|
34a120e127 | ||
|
|
d9c462a3d3 | ||
|
|
4c757997f6 | ||
|
|
29916edb91 | ||
|
|
87dd42f7bc | ||
|
|
06a3abd01e | ||
|
|
8785bd37e8 | ||
|
|
5f37f6edb4 | ||
|
|
c5c8851b50 | ||
|
|
a2dea3885b | ||
|
|
84a48142de | ||
|
|
a207b6a17e | ||
|
|
47aacbb819 | ||
|
|
2a24bb7cc6 | ||
|
|
a6b5aad8c9 | ||
|
|
25a63611f8 | ||
|
|
5571503c22 | ||
|
|
c951dee766 | ||
|
|
0eaf0a8db1 | ||
|
|
92022ac14d | ||
|
|
094ae4e9f9 | ||
|
|
3b21a5f54c | ||
|
|
c37370a8a7 | ||
|
|
8dd41bfe0c | ||
|
|
9741d48496 | ||
|
|
5764ec5ddc | ||
|
|
29ddf34d6d | ||
|
|
9ea3c0eba0 | ||
|
|
027f122aea | ||
|
|
9db4720162 | ||
|
|
0535fb30c6 | ||
|
|
4cfcaf8521 | ||
|
|
f708d36fad | ||
|
|
16e12b1ae5 | ||
|
|
1a28e9297c | ||
|
|
eb1fab9202 | ||
|
|
2e72173620 | ||
|
|
6681aaf76a | ||
|
|
d4e7eafede | ||
|
|
6d0578e19c | ||
|
|
0cf405527e | ||
|
|
99e577ad2f | ||
|
|
276768a826 | ||
|
|
cd37fa7cb5 | ||
|
|
90ae7500da | ||
|
|
249a89fc2d | ||
|
|
ff12b53ba6 | ||
|
|
a2046b429f | ||
|
|
190a2c3b35 | ||
|
|
0a7cda09ff | ||
|
|
02b7e7698a | ||
|
|
ca2cf8e591 | ||
|
|
cc47c80243 | ||
|
|
2f9b955210 | ||
|
|
9f77a85491 | ||
|
|
878e38c0cf | ||
|
|
c3803807a9 | ||
|
|
6864a08000 | ||
|
|
3c1888c26a | ||
|
|
4750d2f667 | ||
|
|
2ecad23fab | ||
|
|
204d31a056 | ||
|
|
50c8d7f633 | ||
|
|
ac42045155 | ||
|
|
ddc3440712 | ||
|
|
84a741d0f9 | ||
|
|
f397fb210f | ||
|
|
663eec8a76 | ||
|
|
d7e729a4ea | ||
|
|
0f056f3abb | ||
|
|
095a397d7c | ||
|
|
8b042ac875 | ||
|
|
abeb50bd08 | ||
|
|
accc1db43f | ||
|
|
8a83e27d6a | ||
|
|
c302fa9a4e | ||
|
|
423dd7e0a9 | ||
|
|
082a4d9078 | ||
|
|
02b23d3deb | ||
|
|
7ff4d14544 | ||
|
|
f49e32cc79 | ||
|
|
bcb9b0e457 | ||
|
|
3c0587b375 | ||
|
|
3d74e5bd47 | ||
|
|
493c61f09d | ||
|
|
363de973c9 | ||
|
|
6ad0ba8fe2 | ||
|
|
3655354980 | ||
|
|
9d664336b5 | ||
|
|
5db84c3233 | ||
|
|
79d2beb42a | ||
|
|
a1640dcf72 | ||
|
|
9c714688cd | ||
|
|
b3fc16ed9a | ||
|
|
f84d40734d | ||
|
|
e92ee1c0ea | ||
|
|
389779d86c | ||
|
|
a069e890ba | ||
|
|
d31aa05847 | ||
|
|
798c348d0e | ||
|
|
ca7d3b91d0 | ||
|
|
b2fc077f8c | ||
|
|
49f1834ffb | ||
|
|
9acb36af87 | ||
|
|
84444c697c | ||
|
|
99a6802b61 | ||
|
|
799d3bd2c8 | ||
|
|
655bb0ed5d | ||
|
|
c47209e9bf | ||
|
|
1184679d23 | ||
|
|
f973610b38 | ||
|
|
9ae2341ba9 | ||
|
|
17b2d2a2d7 | ||
|
|
9780897fc7 | ||
|
|
76865694ce | ||
|
|
c5840be1cb | ||
|
|
e7be3c5378 | ||
|
|
cc0adf5442 | ||
|
|
4717be07d6 | ||
|
|
0fd52176dc | ||
|
|
57485a73ec | ||
|
|
ab42ec8c81 | ||
|
|
b61c0397bc | ||
|
|
69db469d39 | ||
|
|
cbc2c0cf0c | ||
|
|
f601975701 | ||
|
|
ec3698066b | ||
|
|
e83f856104 | ||
|
|
3153d12bd9 | ||
|
|
58721475ff | ||
|
|
f9e93d594b | ||
|
|
92e18a79ea | ||
|
|
72016196cd | ||
|
|
bcae4f6e7b | ||
|
|
b0ac103900 | ||
|
|
318e7e9e04 | ||
|
|
0da2ec1c0a | ||
|
|
4d1effb008 | ||
|
|
73207c2355 | ||
|
|
fd87633db6 | ||
|
|
7e9f13750f | ||
|
|
744c4c7d8b | ||
|
|
0980c7130a | ||
|
|
4230fdfffe | ||
|
|
bc2fb14b5d | ||
|
|
bfd882c7e0 | ||
|
|
51c95d4d67 | ||
|
|
d77d9ad9d8 | ||
|
|
c49258e866 | ||
|
|
e91de78528 | ||
|
|
64b5e23ba5 | ||
|
|
aaf2e0c3fb | ||
|
|
003d1fd0cc | ||
|
|
ad81356683 | ||
|
|
e100ecbeac | ||
|
|
57e6e1e1b5 | ||
|
|
3f493ab118 | ||
|
|
4a53d62be4 | ||
|
|
18cbea394d | ||
|
|
c13afcf404 | ||
|
|
ae1c1b918f | ||
|
|
67f2bc40e6 | ||
|
|
8915974cf0 | ||
|
|
cc3839ae57 | ||
|
|
5ac7b9f812 | ||
|
|
0a7fc4af73 | ||
|
|
bb8a79f18c | ||
|
|
6afa1c85b7 | ||
|
|
765d7179f5 | ||
|
|
1aaae7b553 | ||
|
|
78a39d3ac9 | ||
|
|
068d776b17 | ||
|
|
0109e5e9d4 | ||
|
|
b14b4cfef8 | ||
|
|
d330f0b7b7 | ||
|
|
9e5bf94a5a | ||
|
|
5ac0da6bba | ||
|
|
cfbaa2d6e9 | ||
|
|
c4fe307b06 | ||
|
|
937a8e26a6 | ||
|
|
c4faa69049 | ||
|
|
0768d556a9 | ||
|
|
b9a6a70ced | ||
|
|
9e5f8d4434 | ||
|
|
1743e480e3 | ||
|
|
8a13e87cbe | ||
|
|
1d04a7b8f9 | ||
|
|
5ad5773014 | ||
|
|
a7e5113f2c | ||
|
|
504e74a9ad | ||
|
|
77d526fd0b | ||
|
|
a4640beb2c | ||
|
|
2d6738fcde | ||
|
|
8ed632eb96 | ||
|
|
87cd8ebd26 | ||
|
|
d7b49c9f15 | ||
|
|
e11b74e8d2 | ||
|
|
8f00056171 | ||
|
|
86c34c7d10 | ||
|
|
098a6ad2cc | ||
|
|
d63e535b3c | ||
|
|
96617533c8 | ||
|
|
559e01ea84 | ||
|
|
182aec2f94 | ||
|
|
f028ff1d40 | ||
|
|
bc018faedc | ||
|
|
bbbaffbc53 | ||
|
|
5d9a599b17 | ||
|
|
316e48e3b5 | ||
|
|
ba67b67ff3 | ||
|
|
d398326049 | ||
|
|
8ff49c06dd | ||
|
|
5fdc6be9bc | ||
|
|
31127425ba | ||
|
|
a4f4764e2a | ||
|
|
3fa1776ecf | ||
|
|
a8f8195418 | ||
|
|
af5ed8b5f7 | ||
|
|
c72c27b47e | ||
|
|
2e3fb103ab | ||
|
|
d59972a9ac | ||
|
|
d9f23470c4 | ||
|
|
bcaed67eaa | ||
|
|
bd7614f445 | ||
|
|
677c3996b9 | ||
|
|
b320ff4602 | ||
|
|
ae51d99fb8 | ||
|
|
4131a60b43 | ||
|
|
0d01099f44 | ||
|
|
9c1f3d5fff | ||
|
|
ee312cba1c | ||
|
|
4f62e80de7 | ||
|
|
da65761712 | ||
|
|
e17b2a4db8 | ||
|
|
6a57e83509 | ||
|
|
410bd263dd | ||
|
|
f7371daca3 | ||
|
|
706ce5dfb6 | ||
|
|
8542d651ae | ||
|
|
52dceff3ea | ||
|
|
00b5fcebe3 | ||
|
|
f8dc1f2e3a | ||
|
|
09e01fa0f8 | ||
|
|
f9533c5d16 | ||
|
|
806f962b7d | ||
|
|
dadc2a96ea | ||
|
|
df77f51bcc | ||
|
|
3daa4c6497 | ||
|
|
6933bb971b | ||
|
|
f4a71dc03c | ||
|
|
fc9999fb05 | ||
|
|
82866fcab5 | ||
|
|
039c0056bc | ||
|
|
1a7ef8cc85 | ||
|
|
877270c35f | ||
|
|
42df98450c | ||
|
|
671965d44f | ||
|
|
c75737bcf0 | ||
|
|
c4333461bb | ||
|
|
f1cd0299cc | ||
|
|
3c7814c8ac | ||
|
|
028434f93d | ||
|
|
02aad03f92 | ||
|
|
e66dbac11b | ||
|
|
b1a62575c9 | ||
|
|
190468e1f8 | ||
|
|
03ffcd0e64 | ||
|
|
f5de0187e7 | ||
|
|
1ae573bf21 | ||
|
|
47b4729332 | ||
|
|
4fd926bfd6 | ||
|
|
041cfda80b | ||
|
|
3b3399ccc3 | ||
|
|
13deb4f048 | ||
|
|
931c293426 | ||
|
|
162300a4a6 | ||
|
|
3309959139 | ||
|
|
bdf3b197ad | ||
|
|
28c5f6f9c3 | ||
|
|
c9bb7ea0f4 | ||
|
|
5a7dfa4df2 | ||
|
|
c46126806e | ||
|
|
771fbcbd27 | ||
|
|
5dfc3d2849 | ||
|
|
6b9fde5790 | ||
|
|
34b812696b | ||
|
|
a0acfd5113 | ||
|
|
feff1f9e6e | ||
|
|
4f891973aa | ||
|
|
cda48e3ce8 | ||
|
|
67a1f2065e | ||
|
|
32074cc420 | ||
|
|
05897ddbb0 | ||
|
|
5f97d51967 | ||
|
|
3b4d4a9b63 | ||
|
|
4571df9fc6 | ||
|
|
010659cf12 | ||
|
|
68ba016279 | ||
|
|
324e070581 | ||
|
|
15ecba57ec | ||
|
|
d55aa54412 | ||
|
|
0082d12ea9 | ||
|
|
3ac14a6d89 | ||
|
|
1ad1836bd3 | ||
|
|
173d383f9f | ||
|
|
30c6820437 | ||
|
|
929f44fe4f | ||
|
|
c889d9b3eb | ||
|
|
c6934431d1 | ||
|
|
7565625ce0 | ||
|
|
083747dc67 | ||
|
|
30e7ac8d6d | ||
|
|
725e894f9b | ||
|
|
8c9c701de5 | ||
|
|
aab274d3ef | ||
|
|
046b8e4704 | ||
|
|
a21fda23a6 | ||
|
|
628a53ccec | ||
|
|
140711dd8a | ||
|
|
7c3d7fc460 | ||
|
|
f2eae8bc50 | ||
|
|
61420d3c9c | ||
|
|
afc0605080 | ||
|
|
f705f6957a | ||
|
|
a5c65b2a3d | ||
|
|
48df869202 | ||
|
|
38d74bf78c | ||
|
|
3e2366b38b | ||
|
|
bbe2e8076b | ||
|
|
47688e49cd | ||
|
|
063020f507 | ||
|
|
ab9fddf6b2 | ||
|
|
be4cfa83b3 | ||
|
|
f9422ea687 | ||
|
|
c45d3560b8 | ||
|
|
1eca9acffb | ||
|
|
e366846ecf | ||
|
|
5ccb172e73 | ||
|
|
2266d74c2a | ||
|
|
816e549d4c | ||
|
|
2276445790 | ||
|
|
394e9c679b | ||
|
|
ed6a35f618 | ||
|
|
2f3b0c9d1c | ||
|
|
8c60eaa548 | ||
|
|
82a528961b | ||
|
|
212aac42bd | ||
|
|
f2fdb8b69b | ||
|
|
f528d8c50a | ||
|
|
16038d9555 | ||
|
|
d0125f3ff5 | ||
|
|
4bf77c03f5 | ||
|
|
d0129ff67b | ||
|
|
8920bea241 | ||
|
|
cb4d17825b | ||
|
|
ffc5c2ea7b | ||
|
|
5869dc8273 | ||
|
|
dff7f2e8e5 | ||
|
|
0ccbba9073 | ||
|
|
b30f066651 | ||
|
|
1a4e95a9dc | ||
|
|
2c32b0fc1c | ||
|
|
9c25bebb61 | ||
|
|
a1e1f4f87c | ||
|
|
eb0b0b890f | ||
|
|
71da65eb7b | ||
|
|
e20858a5dc | ||
|
|
72f4dfdd7a | ||
|
|
de645eb6a9 | ||
|
|
791b0d82aa | ||
|
|
83b8e7df5a | ||
|
|
06623333d9 | ||
|
|
6197b3ee60 | ||
|
|
e0c158c12f | ||
|
|
2e29e66b92 | ||
|
|
9b9e054dc3 | ||
|
|
47c074adb3 | ||
|
|
5357f58131 | ||
|
|
77bfe5ae00 | ||
|
|
90b41a81f5 | ||
|
|
f0c11fa0ec | ||
|
|
be4b0472c8 | ||
|
|
1481f3f477 | ||
|
|
1cc719d413 | ||
|
|
a01d5f5c4a | ||
|
|
1d19196299 | ||
|
|
b1fc9bb342 | ||
|
|
22a2de971b | ||
|
|
afbf41c48c | ||
|
|
6a0e9c5ed0 | ||
|
|
734adf0214 | ||
|
|
019638628c | ||
|
|
4bdd5267b0 | ||
|
|
dc604c21b5 | ||
|
|
e6bab014d1 | ||
|
|
fe13d28472 | ||
|
|
7ee2782a29 | ||
|
|
16bc7b57cb | ||
|
|
53b19e9f2d | ||
|
|
b60b84fe67 | ||
|
|
b3f09596b1 | ||
|
|
ec8c1cb5f9 | ||
|
|
f1538ebc76 | ||
|
|
faa6347896 | ||
|
|
213bfc4417 | ||
|
|
b2dd6ded1d | ||
|
|
11de5b4923 | ||
|
|
e3c8c99583 | ||
|
|
d01c1c0d32 | ||
|
|
db9774fb62 | ||
|
|
7b3613e1f0 | ||
|
|
01f69ca80c | ||
|
|
d57518d90c | ||
|
|
cd43e32e25 | ||
|
|
53e8d99075 | ||
|
|
07b9f9f6f3 | ||
|
|
bcc6ba3603 | ||
|
|
a211520d19 | ||
|
|
9b244022c7 | ||
|
|
5d5471f981 | ||
|
|
92625a5095 | ||
|
|
52faf8164d | ||
|
|
98a75d06d1 | ||
|
|
8bd585b2b9 | ||
|
|
9585138f20 | ||
|
|
e64293dbe7 | ||
|
|
f118e30b20 | ||
|
|
f55d111469 | ||
|
|
fd63fa6836 | ||
|
|
a51ba5ca33 | ||
|
|
2947a1415b | ||
|
|
3750a8964c | ||
|
|
d18e0cb21b | ||
|
|
5013c4d1f1 | ||
|
|
34bc02af1e | ||
|
|
023c623650 | ||
|
|
3858a2011f | ||
|
|
228e3fefe0 | ||
|
|
e95538f3ec | ||
|
|
10ef7123c4 | ||
|
|
2e66ba7b64 | ||
|
|
6e5ae636cc | ||
|
|
08d54f9b49 | ||
|
|
80d60cedf6 | ||
|
|
9920dcea17 | ||
|
|
7a706fa0d2 | ||
|
|
f29417eea9 | ||
|
|
9823e30c2e | ||
|
|
c66178e3f7 | ||
|
|
4af8657c21 | ||
|
|
5545cbc6bc | ||
|
|
c76fc14a5c | ||
|
|
4660612e08 | ||
|
|
4b0ec64299 | ||
|
|
e946e2ab18 | ||
|
|
937547f178 | ||
|
|
600859ed04 | ||
|
|
c139b6bcbb | ||
|
|
a0f930fa07 | ||
|
|
0344f2b4c9 | ||
|
|
bed89d0740 | ||
|
|
2ee4a0c8c6 | ||
|
|
5d22ad3fc8 | ||
|
|
864e754074 | ||
|
|
7525ff23cf | ||
|
|
fb5779a00e | ||
|
|
5467b06c4f | ||
|
|
21f62012d6 | ||
|
|
6b0be50dd0 | ||
|
|
85350f3c66 | ||
|
|
f17d893f53 | ||
|
|
1b9f428183 | ||
|
|
781f763f1f | ||
|
|
ba464bbac4 | ||
|
|
b6a6bc0f4e | ||
|
|
ae76a509dc | ||
|
|
da69ea51fe | ||
|
|
370d9015b4 | ||
|
|
53af2d7dfb | ||
|
|
0794049d18 | ||
|
|
ccaa194681 | ||
|
|
1a73d70334 | ||
|
|
5a9bba3fa5 | ||
|
|
cb3608c6d3 | ||
|
|
7821505139 | ||
|
|
476bb85d41 | ||
|
|
dd8652dbf4 | ||
|
|
08647282df | ||
|
|
0318907fb3 | ||
|
|
d4ad673d64 | ||
|
|
d51942e59d | ||
|
|
e519e162df | ||
|
|
365218590c | ||
|
|
d914a27bdf | ||
|
|
d3fe3f2691 | ||
|
|
932b31227f | ||
|
|
da936d2e94 | ||
|
|
4ce9aad749 | ||
|
|
ca251215cf | ||
|
|
394e57d3ce | ||
|
|
ad268d27d7 | ||
|
|
5bd355e0af | ||
|
|
769e776ee4 | ||
|
|
40f908a499 | ||
|
|
8beba717f8 | ||
|
|
35cabecad8 | ||
|
|
4084acd869 | ||
|
|
990c5c8faa | ||
|
|
6fe189cbd9 | ||
|
|
492bf7154e | ||
|
|
52ed69b619 | ||
|
|
a05e8d226f | ||
|
|
3734959f55 | ||
|
|
07e704c968 | ||
|
|
c2952b49b4 | ||
|
|
cffaa3b2ee | ||
|
|
bda778626c | ||
|
|
60a8b92e10 | ||
|
|
778fa92ebe | ||
|
|
c8076b2f9d | ||
|
|
000d2446b5 | ||
|
|
bceafe9094 | ||
|
|
94f9501702 | ||
|
|
4061799e90 | ||
|
|
e604c97a43 | ||
|
|
93f2ee66bc | ||
|
|
4e023a1bb8 | ||
|
|
72d0719223 | ||
|
|
a6c41514d4 | ||
|
|
61a3e687f5 | ||
|
|
753f52fc22 | ||
|
|
4b69b96f9b | ||
|
|
5fdc9c8adb | ||
|
|
5917290562 | ||
|
|
64d566ff52 | ||
|
|
764f6e9347 | ||
|
|
077c5662a8 | ||
|
|
61949d0ed4 | ||
|
|
90184658a7 | ||
|
|
5e27e1b9aa | ||
|
|
38ccc24577 | ||
|
|
2be4f2f737 | ||
|
|
8f4c2d98ba | ||
|
|
61e1720d07 | ||
|
|
4adb7ee969 | ||
|
|
e63aba73c5 | ||
|
|
155404bf92 | ||
|
|
8db8e5b5f8 | ||
|
|
aedc65dbbf | ||
|
|
fbee46d69d | ||
|
|
a8f4d24dad | ||
|
|
8bc0b7c77c | ||
|
|
0477d245bc | ||
|
|
5b05cbb128 | ||
|
|
0c832853b6 | ||
|
|
ea187253a2 | ||
|
|
22ff5bb7d7 | ||
|
|
6fa2284c68 | ||
|
|
63bbd0ccd8 | ||
|
|
75129613c5 | ||
|
|
67cd29f4e1 | ||
|
|
91276ad82e | ||
|
|
8b50fa658f | ||
|
|
8b692e6d9d | ||
|
|
fe84eb4ff6 | ||
|
|
bcc4ca48ab | ||
|
|
a6316b1e20 | ||
|
|
ce81a24bfd | ||
|
|
93d259e8cb | ||
|
|
6448d073a7 | ||
|
|
26ad918e03 | ||
|
|
7bc2853de9 | ||
|
|
8bd052b986 | ||
|
|
b1bfd00875 | ||
|
|
0b48507d39 | ||
|
|
69df91de68 | ||
|
|
00f2c6e3e4 | ||
|
|
b66f88181a | ||
|
|
548f77d6d3 | ||
|
|
e64d3daa06 | ||
|
|
dc3ceeb5bb | ||
|
|
5f164e1c98 | ||
|
|
6c82e405dd | ||
|
|
5572d1792d | ||
|
|
84e7ce2758 | ||
|
|
6518576a3f | ||
|
|
2a1d984bf1 | ||
|
|
ab233a941f | ||
|
|
9648081abe | ||
|
|
ab0fe65f3f | ||
|
|
3253d2a17b | ||
|
|
bd18b4930d | ||
|
|
fed90c126e | ||
|
|
2f62994f61 | ||
|
|
ec428c070b | ||
|
|
beab90c707 | ||
|
|
a760f5263f | ||
|
|
8113c689fc | ||
|
|
fd71e1395c | ||
|
|
f15275bb5b | ||
|
|
85c842b7fd | ||
|
|
1d60d82698 | ||
|
|
d9fec87143 | ||
|
|
1866174327 | ||
|
|
8747fe2dc9 | ||
|
|
d43b23d663 | ||
|
|
9dfa54a6b7 | ||
|
|
fe979f0d46 | ||
|
|
2cc690f31f | ||
|
|
63c5a2e58f | ||
|
|
ef8055f900 | ||
|
|
ecde760b42 | ||
|
|
b5d6359030 | ||
|
|
57ef5e2691 | ||
|
|
25bae2897b | ||
|
|
1cd76de8ba | ||
|
|
f50bf528e6 | ||
|
|
33b649bb01 | ||
|
|
4f6bff1c47 | ||
|
|
0e10efc727 | ||
|
|
a4846e4aad | ||
|
|
f307a0c705 | ||
|
|
ba4c2c94ec | ||
|
|
8831e73d98 | ||
|
|
2ad8f6bd74 | ||
|
|
bef6d5f2a1 | ||
|
|
e3e84020f4 | ||
|
|
f45b2f9a24 | ||
|
|
1486b7e6a0 | ||
|
|
89b84d4551 | ||
|
|
c0aca706d2 | ||
|
|
19a3daf533 | ||
|
|
8fa62130e3 | ||
|
|
d2349cdd8e | ||
|
|
df3d17789a | ||
|
|
3c599838dc | ||
|
|
af8ba06795 | ||
|
|
704d6bd069 | ||
|
|
cc5384fff5 | ||
|
|
e0623f57f9 | ||
|
|
68795ea031 | ||
|
|
99600ba370 | ||
|
|
8e93989eec | ||
|
|
ae2ef83f16 | ||
|
|
beb0da4ff4 | ||
|
|
f84ffdbfef | ||
|
|
031b15daab | ||
|
|
8b4278aeaa | ||
|
|
198119466b | ||
|
|
80f4f422fc | ||
|
|
ebe8e19cc0 | ||
|
|
7d75626e75 | ||
|
|
1447fb9d30 | ||
|
|
379876341e | ||
|
|
c6bcd464c2 | ||
|
|
7f2acedf9f | ||
|
|
870731cb9f | ||
|
|
ca353dd18e | ||
|
|
97f549cf5f | ||
|
|
e99f604133 | ||
|
|
68d606b5f0 | ||
|
|
fffd93607d | ||
|
|
95c74dbd30 | ||
|
|
aad49cb19f | ||
|
|
ed880b3b58 | ||
|
|
046984f7e8 | ||
|
|
49027c529a | ||
|
|
68d546ce02 | ||
|
|
c74c016ce2 | ||
|
|
0cfc4cbb34 | ||
|
|
c9f3f5e544 | ||
|
|
eef193e8bd | ||
|
|
5826a34ebb | ||
|
|
40f5ea4007 | ||
|
|
ca99679d1d | ||
|
|
14b02ff26f | ||
|
|
e4baf37bf8 | ||
|
|
a179722542 | ||
|
|
39a98cd555 | ||
|
|
0b916e0a51 | ||
|
|
d63f13245f | ||
|
|
4a028f5faf | ||
|
|
63f6ab4e6d | ||
|
|
b6ccbdb694 | ||
|
|
7e0dfb41d0 | ||
|
|
8802fb2fd8 | ||
|
|
fbe06d3f2f | ||
|
|
4f73d63f90 | ||
|
|
217cbec50e | ||
|
|
9895f00e5e | ||
|
|
b01652f3e7 | ||
|
|
f4fa747cd0 | ||
|
|
a4ea0737b2 | ||
|
|
d95e971030 | ||
|
|
a649d6f131 | ||
|
|
7e5e56de40 | ||
|
|
ac0ca94230 | ||
|
|
d000ad2441 | ||
|
|
50b6c6d4ad | ||
|
|
0699cdd5d0 | ||
|
|
feb9b96ce7 | ||
|
|
6bafb34586 | ||
|
|
b7c5b0a3c1 | ||
|
|
cdce3697e0 | ||
|
|
672518ba36 | ||
|
|
22e2458ce5 | ||
|
|
714f01fda7 | ||
|
|
771bcb5bda | ||
|
|
f0ef6ed016 | ||
|
|
425350aa65 | ||
|
|
0d80821841 | ||
|
|
26e992ad2e | ||
|
|
67058123ba | ||
|
|
33e8d749d2 | ||
|
|
fa316c21ae | ||
|
|
c5ca293d72 | ||
|
|
58fdfe77d3 | ||
|
|
f771306867 | ||
|
|
203947388b | ||
|
|
681350b03d | ||
|
|
dbf3691c22 | ||
|
|
fb0b5b2e5b | ||
|
|
dc6790915e | ||
|
|
6bbe551ce8 | ||
|
|
29980d3e96 | ||
|
|
453d880999 | ||
|
|
734652d913 | ||
|
|
0a3e8a0fdb | ||
|
|
64913d5009 | ||
|
|
9e760e9fb8 | ||
|
|
6d91852c55 | ||
|
|
0bef355494 | ||
|
|
a2c0508792 | ||
|
|
482292551b | ||
|
|
01a83e6031 | ||
|
|
4b9c7f7517 | ||
|
|
0e1e80477a | ||
|
|
a9e3875230 | ||
|
|
30968925ee | ||
|
|
017a1adb24 | ||
|
|
4d40991c1a | ||
|
|
552fe1fb4b | ||
|
|
fb4901cbcf | ||
|
|
0fab166fba | ||
|
|
31762095b7 | ||
|
|
cf45d5914a | ||
|
|
e1fe4a3871 | ||
|
|
75197f4586 | ||
|
|
9f03640a06 | ||
|
|
38a568e426 | ||
|
|
8b28f627ca | ||
|
|
f141e69671 | ||
|
|
fada9bb1ba | ||
|
|
b503fb5de8 | ||
|
|
e7864c301c | ||
|
|
ba95260113 | ||
|
|
186c7585d2 | ||
|
|
bae2682518 | ||
|
|
89bc3e9153 | ||
|
|
4c474d8d91 | ||
|
|
d62d78a0fc | ||
|
|
874dcdd840 | ||
|
|
2c4700f4c1 | ||
|
|
5b6e47c56f | ||
|
|
3c82e4865d | ||
|
|
986448ce7a | ||
|
|
d496523021 | ||
|
|
8b0ec51c0f | ||
|
|
76590d5a82 | ||
|
|
debf1ed934 | ||
|
|
38f4a06f1d | ||
|
|
61c52f15a3 | ||
|
|
304173f595 | ||
|
|
fc7483ab87 | ||
|
|
3389606c7b | ||
|
|
75383199d6 | ||
|
|
c50a687213 | ||
|
|
ae5ec6bad9 | ||
|
|
c1ab00d915 | ||
|
|
9e0cfa1fad | ||
|
|
0502951b1c | ||
|
|
3ffaed9857 | ||
|
|
ef059911dc | ||
|
|
f1b39ee1e5 | ||
|
|
4cfb7a2eb2 | ||
|
|
00992069c5 | ||
|
|
dee375bfac | ||
|
|
398a83971f | ||
|
|
b821412f72 | ||
|
|
48f657c031 | ||
|
|
7503d6695a | ||
|
|
718646f943 | ||
|
|
2748e770e4 | ||
|
|
e1cd5186c6 | ||
|
|
2d89708ea8 | ||
|
|
9768fddb19 | ||
|
|
76ea030b78 | ||
|
|
9ff3155a64 | ||
|
|
62b9f4b91d | ||
|
|
2205b80703 | ||
|
|
254b855963 | ||
|
|
3a09b2f226 | ||
|
|
3fcade9f6d | ||
|
|
84c752583a | ||
|
|
91c6b6e2c1 | ||
|
|
7fa0fd2440 | ||
|
|
19e1f63909 | ||
|
|
89c5d9f6f6 | ||
|
|
f198e53891 | ||
|
|
2af379d4b1 | ||
|
|
48924f490b | ||
|
|
fcd0dafbe4 | ||
|
|
34b465a125 | ||
|
|
c9e0071fde | ||
|
|
f74c5dc921 | ||
|
|
1c57214786 | ||
|
|
09b6503795 | ||
|
|
23d2899e54 | ||
|
|
b73d528365 | ||
|
|
160c52a14b | ||
|
|
3575e6bbc1 | ||
|
|
6cdc220406 | ||
|
|
01d9ffcd9b | ||
|
|
62ac80d53f | ||
|
|
84732d4b94 | ||
|
|
0a41dedc05 | ||
|
|
aed348ce8b | ||
|
|
f4d8070bda | ||
|
|
6c8f82d865 | ||
|
|
d9b6ab1128 | ||
|
|
02990290c6 | ||
|
|
2cf0f1b5f3 | ||
|
|
e61376565e | ||
|
|
64b15cdbc0 | ||
|
|
6281d18227 | ||
|
|
0d0441a186 | ||
|
|
413502e7f6 | ||
|
|
3bfe8bea45 | ||
|
|
7b47635879 | ||
|
|
439e99d32b | ||
|
|
25e2e382ea | ||
|
|
b0f2ae147b | ||
|
|
50a6e90e3d | ||
|
|
f0431218d6 | ||
|
|
83c4a05d31 | ||
|
|
7bb661e21c | ||
|
|
ebe3990d0d | ||
|
|
e19b89be2c | ||
|
|
5f742c9142 | ||
|
|
61c8f7b00b | ||
|
|
b4faad8469 | ||
|
|
7bfb832312 | ||
|
|
e577431051 | ||
|
|
4fe86a4419 | ||
|
|
93975be5e3 | ||
|
|
df0fa06e8a | ||
|
|
484a4d8bdd | ||
|
|
3e49c960a0 | ||
|
|
cb09768145 | ||
|
|
30f291e6ce | ||
|
|
25c3e49b4f | ||
|
|
9ac4f51601 | ||
|
|
428962df35 | ||
|
|
db35e21bcd | ||
|
|
0f665a6cbc | ||
|
|
1d60e38f14 | ||
|
|
0e679fbee5 | ||
|
|
2c360d6c9b | ||
|
|
e8aaf26ab4 | ||
|
|
637ca97dc6 | ||
|
|
a938ac67d1 | ||
|
|
39d5b68785 | ||
|
|
66a370af9b | ||
|
|
d7a36f4a9d | ||
|
|
5c73c298dc | ||
|
|
35374ac09c | ||
|
|
96dda7b73a | ||
|
|
373f0da56a | ||
|
|
9159d5812b | ||
|
|
e69cd0f8c3 | ||
|
|
7925642b1b | ||
|
|
5347d4fe43 | ||
|
|
dc8fa4ebfd | ||
|
|
0d121dd51a | ||
|
|
31bcc541d0 | ||
|
|
6b0cc0c8fa | ||
|
|
2a498fc3eb | ||
|
|
75b54cc277 | ||
|
|
8c43c989af | ||
|
|
7491815e27 | ||
|
|
626277ef9a | ||
|
|
b86ddbb923 | ||
|
|
bceae29fca | ||
|
|
9f8766c8da | ||
|
|
f0e26e3495 | ||
|
|
92a08c26ad | ||
|
|
4ab99a6bb3 | ||
|
|
4df096fed3 | ||
|
|
d0792dff31 | ||
|
|
dabce9ab45 | ||
|
|
2982c7973e | ||
|
|
2b6eb97f66 | ||
|
|
71786dd172 | ||
|
|
4ab845806d | ||
|
|
167c568d55 | ||
|
|
3b01ca93cd | ||
|
|
a691846cf8 | ||
|
|
27acdf38e2 | ||
|
|
75ccb22d26 | ||
|
|
1603b2bf64 | ||
|
|
3abe5e941f | ||
|
|
b12d0f690d | ||
|
|
1f69b60041 | ||
|
|
5767931df6 | ||
|
|
d8f8038f16 | ||
|
|
b42f5145a6 | ||
|
|
015aaad2c4 | ||
|
|
0757ac1493 | ||
|
|
abcfe9f9e8 | ||
|
|
7f607905ed | ||
|
|
8be5340385 | ||
|
|
e987a492dc | ||
|
|
cc4206f690 | ||
|
|
5d05c36791 | ||
|
|
1ae4da46b3 | ||
|
|
97789cbab7 | ||
|
|
ac2ee42804 | ||
|
|
c57a0a5f2e | ||
|
|
fd18be4317 | ||
|
|
095c60d440 | ||
|
|
c50eb78ca1 | ||
|
|
46d3fe3070 | ||
|
|
9358e9444c | ||
|
|
40068c1938 | ||
|
|
5938b65097 | ||
|
|
55a29bfa86 | ||
|
|
ffadbf1d10 | ||
|
|
a33fbbd991 | ||
|
|
b1110272a4 | ||
|
|
83fe91c88f | ||
|
|
9d9c56a054 | ||
|
|
e911e64704 | ||
|
|
bb3ffe5764 | ||
|
|
0fc5a5c91e | ||
|
|
1b89654d0c | ||
|
|
fc0153a5a4 | ||
|
|
3ef3f5ac31 | ||
|
|
22dd075692 | ||
|
|
1ae7db2e03 | ||
|
|
6e89f5ef22 | ||
|
|
b9d2b42050 | ||
|
|
3fed6a2f1c | ||
|
|
8fe5b4e2ba | ||
|
|
c60c702170 | ||
|
|
7bc340956f | ||
|
|
f5b218ba89 | ||
|
|
ac218dc502 | ||
|
|
e5e33826a7 | ||
|
|
2cf7734897 | ||
|
|
483ee1fbce | ||
|
|
bb9d5db969 | ||
|
|
76d51a3da6 | ||
|
|
666a1c3a57 | ||
|
|
3bd3f7967e | ||
|
|
9d495d5beb | ||
|
|
b411a3d55d | ||
|
|
4076c41de8 | ||
|
|
4c25269b1d | ||
|
|
db9a7f4c45 | ||
|
|
038f80437e | ||
|
|
a531229076 | ||
|
|
41e64bff4e | ||
|
|
3c6f61a058 | ||
|
|
35902cb205 | ||
|
|
b27a7e0387 | ||
|
|
7c8525ed09 | ||
|
|
69644d74c7 | ||
|
|
047731b11d | ||
|
|
986f08e0d8 | ||
|
|
66685b2296 | ||
|
|
f532d76928 | ||
|
|
d53893b346 | ||
|
|
11103b083a | ||
|
|
3dd220b62f | ||
|
|
deffb271bc | ||
|
|
a0451a3cb5 | ||
|
|
90f965cf53 | ||
|
|
b2c083ce56 | ||
|
|
3adfebdc20 | ||
|
|
70d59e4a52 | ||
|
|
871b7113ec | ||
|
|
b6f74bd143 | ||
|
|
69a4349ee2 | ||
|
|
e9af2dfd96 | ||
|
|
4b1d67ef49 | ||
|
|
3f17acca1d | ||
|
|
c3f23839e8 | ||
|
|
37cc69542c | ||
|
|
efef36b5e8 | ||
|
|
d40d4ef87c | ||
|
|
0e0f1fea69 | ||
|
|
67c5e376b8 | ||
|
|
4116bdd8fd | ||
|
|
3e84691cec | ||
|
|
74c97ea36d | ||
|
|
8cd55276c3 | ||
|
|
391ef7e664 | ||
|
|
9727f27854 | ||
|
|
62f3b8cae5 | ||
|
|
6b02b6eddb | ||
|
|
0905372f70 | ||
|
|
49e61b87a0 | ||
|
|
b606df451e | ||
|
|
b01f954b05 | ||
|
|
4af85b488b | ||
|
|
90e4722284 | ||
|
|
cc3f712fec | ||
|
|
9c3317620d | ||
|
|
432c0d59c4 |
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
root = true
|
||||||
|
[*]
|
||||||
|
indent_style=tab
|
||||||
|
indent_size=tab
|
||||||
|
tab_width=4
|
||||||
|
end_of_line=lf
|
||||||
|
charset=utf-8
|
||||||
|
trim_trailing_whitespace=true
|
||||||
|
max_line_length=120
|
||||||
|
insert_final_newline=true
|
||||||
|
|
||||||
|
[.travis.yml]
|
||||||
|
indent_style=space
|
||||||
|
indent_size=2
|
||||||
|
tab_width=8
|
||||||
|
end_of_line=lf
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -7,7 +7,8 @@
|
|||||||
# Executables
|
# Executables
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
Cargo.lock
|
# Cargo lock in subs
|
||||||
|
**/Cargo.lock
|
||||||
|
|
||||||
# Generated by Cargo
|
# Generated by Cargo
|
||||||
**/target/
|
**/target/
|
||||||
@@ -24,4 +25,10 @@ Cargo.lock
|
|||||||
/json-tests/target/
|
/json-tests/target/
|
||||||
|
|
||||||
# jetbrains ide stuff
|
# jetbrains ide stuff
|
||||||
.idea
|
.idea
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
out/
|
||||||
|
|
||||||
|
.vscode
|
||||||
|
|||||||
347
.gitlab-ci.yml
Normal file
347
.gitlab-ci.yml
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: "3"
|
||||||
|
SIMPLECOV: "true"
|
||||||
|
RUST_BACKTRACE: "1"
|
||||||
|
RUSTFLAGS: "-D warnings"
|
||||||
|
cache:
|
||||||
|
key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
|
||||||
|
untracked: true
|
||||||
|
linux-stable:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust:stable
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- strip target/release/parity
|
||||||
|
- md5sum target/release/parity >> parity.md5
|
||||||
|
- sh scripts/deb-build.sh amd64
|
||||||
|
- cp target/release/parity deb/usr/bin/parity
|
||||||
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
|
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
||||||
|
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb" --body "parity_"$VER"_amd64.deb"
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.deb.md5" --body "parity_"$VER"_amd64.deb.md5"
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-stable
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "stable-x86_64-unknown-linux-gnu_parity"
|
||||||
|
linux-stable-14.04:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-14.04:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- strip target/release/parity
|
||||||
|
- md5sum target/release/parity >> parity.md5
|
||||||
|
- sh scripts/deb-build.sh amd64
|
||||||
|
- cp target/release/parity deb/usr/bin/parity
|
||||||
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
|
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
||||||
|
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity --body target/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity.md5 --body parity.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/"parity_"$VER"_amd64.deb" --body "parity_"$VER"_amd64.deb"
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/"parity_"$VER"_amd64.deb.md5" --body "parity_"$VER"_amd64.deb.md5"
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-14.04
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "stable-x86_64-unknown-ubuntu_14_04-gnu_parity"
|
||||||
|
linux-beta:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust:beta
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- strip target/release/parity
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-beta
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "beta-x86_64-unknown-linux-gnu_parity"
|
||||||
|
allow_failure: true
|
||||||
|
linux-nightly:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust:nightly
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- strip target/release/parity
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-nightly
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "nigthly-x86_64-unknown-linux-gnu_parity"
|
||||||
|
allow_failure: true
|
||||||
|
linux-centos:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-centos:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- export CXX="g++"
|
||||||
|
- export CC="gcc"
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- strip target/release/parity
|
||||||
|
- md5sum target/release/parity >> parity.md5
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity.md5 --body parity.md5
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-centos
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "x86_64-unknown-centos-gnu_parity"
|
||||||
|
linux-armv7:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-armv7:latest
|
||||||
|
only:
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- rm -rf .cargo
|
||||||
|
- mkdir -p .cargo
|
||||||
|
- echo "[target.armv7-unknown-linux-gnueabihf]" >> .cargo/config
|
||||||
|
- echo "linker= \"arm-linux-gnueabihf-gcc\"" >> .cargo/config
|
||||||
|
- cat .cargo/config
|
||||||
|
- cargo build --target armv7-unknown-linux-gnueabihf --release --verbose
|
||||||
|
- arm-linux-gnueabihf-strip target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
|
- md5sum target/armv7-unknown-linux-gnueabihf/release/parity >> parity.md5
|
||||||
|
- sh scripts/deb-build.sh armhf
|
||||||
|
- cp target/armv7-unknown-linux-gnueabihf/release/parity deb/usr/bin/parity
|
||||||
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
|
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
||||||
|
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity --body target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-arm
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
|
name: "armv7_unknown_linux_gnueabihf_parity"
|
||||||
|
allow_failure: true
|
||||||
|
linux-arm:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-arm:latest
|
||||||
|
only:
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- rm -rf .cargo
|
||||||
|
- mkdir -p .cargo
|
||||||
|
- echo "[target.arm-unknown-linux-gnueabihf]" >> .cargo/config
|
||||||
|
- echo "linker= \"arm-linux-gnueabihf-gcc\"" >> .cargo/config
|
||||||
|
- cat .cargo/config
|
||||||
|
- cargo build --target arm-unknown-linux-gnueabihf --release --verbose
|
||||||
|
- arm-linux-gnueabihf-strip target/arm-unknown-linux-gnueabihf/release/parity
|
||||||
|
- md5sum target/arm-unknown-linux-gnueabihf/release/parity >> parity.md5
|
||||||
|
- sh scripts/deb-build.sh armhf
|
||||||
|
- cp target/arm-unknown-linux-gnueabihf/release/parity deb/usr/bin/parity
|
||||||
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
|
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
||||||
|
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb" --body "parity_"$VER"_armhf.deb"
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/"parity_"$VER"_armhf.deb.md5" --body "parity_"$VER"_armhf.deb.md5"
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-arm
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/arm-unknown-linux-gnueabihf/release/parity
|
||||||
|
name: "arm-unknown-linux-gnueabihf_parity"
|
||||||
|
allow_failure: true
|
||||||
|
linux-armv6:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-armv6:latest
|
||||||
|
only:
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- rm -rf .cargo
|
||||||
|
- mkdir -p .cargo
|
||||||
|
- echo "[target.arm-unknown-linux-gnueabi]" >> .cargo/config
|
||||||
|
- echo "linker= \"arm-linux-gnueabi-gcc\"" >> .cargo/config
|
||||||
|
- cat .cargo/config
|
||||||
|
- cargo build --target arm-unknown-linux-gnueabi --release --verbose
|
||||||
|
- arm-linux-gnueabi-strip target/arm-unknown-linux-gnueabi/release/parity
|
||||||
|
- md5sum target/arm-unknown-linux-gnueabi/release/parity >> parity.md5
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity.md5 --body parity.md5
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-arm
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/arm-unknown-linux-gnueabi/release/parity
|
||||||
|
name: "arm-unknown-linux-gnueabi_parity"
|
||||||
|
allow_failure: true
|
||||||
|
linux-aarch64:
|
||||||
|
stage: build
|
||||||
|
image: ethcore/rust-aarch64:latest
|
||||||
|
only:
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- rm -rf .cargo
|
||||||
|
- mkdir -p .cargo
|
||||||
|
- echo "[target.aarch64-unknown-linux-gnu]" >> .cargo/config
|
||||||
|
- echo "linker= \"aarch64-linux-gnu-gcc\"" >> .cargo/config
|
||||||
|
- cat .cargo/config
|
||||||
|
- cargo build --target aarch64-unknown-linux-gnu --release --verbose
|
||||||
|
- aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/parity
|
||||||
|
- md5sum target/aarch64-unknown-linux-gnu/release/parity >> parity.md5
|
||||||
|
- sh scripts/deb-build.sh arm64
|
||||||
|
- cp target/aarch64-unknown-linux-gnu/release/parity deb/usr/bin/parity
|
||||||
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
|
- dpkg-deb -b deb "parity_"$VER"_arm64.deb"
|
||||||
|
- md5sum "parity_"$VER"_arm64.deb" >> "parity_"$VER"_arm64.deb.md5"
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb" --body "parity_"$VER"_arm64.deb"
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/"parity_"$VER"_arm64.deb.md5" --body "parity_"$VER"_arm64.deb.md5"
|
||||||
|
tags:
|
||||||
|
- rust
|
||||||
|
- rust-arm
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/aarch64-unknown-linux-gnu/release/parity
|
||||||
|
name: "aarch64-unknown-linux-gnu_parity"
|
||||||
|
allow_failure: true
|
||||||
|
darwin:
|
||||||
|
stage: build
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- rm -rf parity.md5
|
||||||
|
- md5sum target/release/parity >> parity.md5
|
||||||
|
- aws configure set aws_access_key_id $s3_key
|
||||||
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity --body target/release/parity
|
||||||
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity.md5 --body parity.md5
|
||||||
|
tags:
|
||||||
|
- osx
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity
|
||||||
|
name: "x86_64-apple-darwin_parity"
|
||||||
|
windows:
|
||||||
|
stage: build
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
- tags
|
||||||
|
- stable
|
||||||
|
script:
|
||||||
|
- set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
|
||||||
|
- set LIB=C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64
|
||||||
|
- set RUST_BACKTRACE=1
|
||||||
|
- set RUSTFLAGS=%RUSTFLAGS% -D warnings
|
||||||
|
- rustup default stable-x86_64-pc-windows-msvc
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- curl -sL --url "https://github.com/ethcore/win-build/raw/master/SimpleFC.dll" -o nsis\SimpleFC.dll
|
||||||
|
- curl -sL --url "https://github.com/ethcore/win-build/raw/master/vc_redist.x64.exe" -o nsis\vc_redist.x64.exe
|
||||||
|
- signtool sign /f %keyfile% /p %certpass% target\release\parity.exe
|
||||||
|
- cd nsis
|
||||||
|
- makensis.exe installer.nsi
|
||||||
|
- copy installer.exe InstallParity.exe
|
||||||
|
- signtool sign /f %keyfile% /p %certpass% InstallParity.exe
|
||||||
|
- md5sums InstallParity.exe > InstallParity.exe.md5
|
||||||
|
- zip win-installer.zip InstallParity.exe InstallParity.exe.md5
|
||||||
|
- md5sums win-installer.zip > win-installer.zip.md5
|
||||||
|
- cd ..\target\release\
|
||||||
|
- md5sums parity.exe parity.pdb > parity.md5
|
||||||
|
- md5sums parity.exe > parity.exe.md5
|
||||||
|
- zip parity.zip parity.exe parity.pdb parity.md5
|
||||||
|
- md5sums parity.zip > parity.zip.md5
|
||||||
|
- cd ..\..
|
||||||
|
- aws configure set aws_access_key_id %s3_key%
|
||||||
|
- aws configure set aws_secret_access_key %s3_secret%
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe --body target\release\parity.exe
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe.md5 --body target\release\parity.exe.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip --body target\release\parity.zip
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.zip.md5 --body target\release\parity.zip.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe --body nsis\InstallParity.exe
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/InstallParity.exe.md5 --body nsis\InstallParity.exe.md5
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip --body nsis\win-installer.zip
|
||||||
|
- aws s3api put-object --bucket builds-parity --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/win-installer.zip.md5 --body nsis\win-installer.zip.md5
|
||||||
|
tags:
|
||||||
|
- rust-windows
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/release/parity.exe
|
||||||
|
- target/release/parity.pdb
|
||||||
|
- nsis/InstallParity.exe
|
||||||
|
name: "x86_64-pc-windows-msvc_parity"
|
||||||
|
test-linux:
|
||||||
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
script:
|
||||||
|
- export RUST_BACKTRACE=1
|
||||||
|
- ./test.sh --verbose
|
||||||
|
tags:
|
||||||
|
- rust-test
|
||||||
|
dependencies:
|
||||||
|
- linux-stable
|
||||||
100
.travis.yml
100
.travis.yml
@@ -1,75 +1,77 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
dist: trusty
|
dist: trusty
|
||||||
language: rust
|
language: rust
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- /^beta-.*$/
|
- /^beta-.*$/
|
||||||
- /^stable-.*$/
|
- /^stable-.*$/
|
||||||
|
- /^beta$/
|
||||||
|
- /^stable$/
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: 3
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
|
||||||
include:
|
include:
|
||||||
- rust: nightly
|
- rust: stable
|
||||||
env: FEATURES="--features ethcore/json-tests" KCOV_FEATURES="" TARGETS="-p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity" ARCHIVE_SUFFIX="-${TRAVIS_OS_NAME}-${TRAVIS_TAG}"
|
env: RUN_TESTS="true"
|
||||||
|
- rust: beta
|
||||||
|
env: RUN_COVERAGE="true"
|
||||||
|
- rust: stable
|
||||||
|
env: RUN_DOCS="true"
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- CXX="g++-4.8"
|
||||||
|
- CC="gcc-4.8"
|
||||||
|
- RUST_BACKTRACE="1"
|
||||||
|
- RUN_TESTS="false"
|
||||||
|
- RUN_COVERAGE="false"
|
||||||
|
- RUN_DOCS="false"
|
||||||
|
# GH_TOKEN for documentation
|
||||||
|
- secure: bumJASbZSU8bxJ0EyPUJmu16AiV9EXOpyOj86Jlq/Ty9CfwGqsSXt96uDyE+OUJf34RUFQMsw0nk37/zC4lcn6kqk2wpuH3N/o85Zo/cVZY/NusBWLQqtT5VbYWsV+u2Ua4Tmmsw8yVYQhYwU2ZOejNpflL+Cs9XGgORp1L+/gMRMC2y5Se6ZhwnKPQlRJ8LGsG1dzjQULxzADIt3/zuspNBS8a2urJwlHfGMkvHDoUWCviP/GXoSqw3TZR7FmKyxE19I8n9+iSvm9+oZZquvcgfUxMHn8Gq/b44UbPvjtFOg2yam4xdWXF/RyWCHdc/R9EHorSABeCbefIsm+zcUF3/YQxwpSxM4IZEeH2rTiC7dcrsKw3XsO16xFQz5YI5Bay+CT/wTdMmJd7DdYz7Dyf+pOvcM9WOf/zorxYWSBOMYy0uzbusU2iyIghQ82s7E/Ahg+WARtPgkuTLSB5aL1oCTBKHqQscMr7lo5Ti6RpWLxEdTQMBznc+bMr+6dEtkEcG9zqc6cE9XX+ox3wTU6+HVMfQ1ltCntJ4UKcw3A6INEbw9wgocQa812CIASQ2fE+SCAbz6JxBjIAlFUnD1lUB7S8PdMPwn9plfQgKQ2A5YZqg6FnBdf0rQXIJYxQWKHXj/rBHSUCT0tHACDlzTA+EwWggvkP5AGIxRxm8jhw=
|
||||||
|
- KCOV_CMD="./kcov-master/tmp/usr/local/bin/kcov"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
apt: true
|
apt: true
|
||||||
directories:
|
directories:
|
||||||
- target/debug/deps
|
- $TRAVIS_BUILD_DIR/target
|
||||||
- target/debug/build
|
- $TRAVIS_BUILD_DIR/kcov-master
|
||||||
- target/release/deps
|
- $HOME/.cargo
|
||||||
- target/release/build
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
- libcurl4-openssl-dev
|
- libcurl4-openssl-dev
|
||||||
- libelf-dev
|
- libelf-dev
|
||||||
- libdw-dev
|
- libdw-dev
|
||||||
before_script: |
|
- gcc-4.8
|
||||||
sudo add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" &&
|
- g++-4.8
|
||||||
sudo apt-get update &&
|
|
||||||
sudo apt-get install -y --force-yes librocksdb
|
install:
|
||||||
|
- ([ "$RUN_COVERAGE" = "false" ]) || (test -x $KCOV_CMD) || (
|
||||||
|
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
|
||||||
|
tar xzf master.tar.gz &&
|
||||||
|
mkdir -p kcov-master/build &&
|
||||||
|
cd kcov-master/build &&
|
||||||
|
cmake .. &&
|
||||||
|
make && make install DESTDIR=../tmp &&
|
||||||
|
cd
|
||||||
|
)
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cargo build --release --verbose ${FEATURES}
|
- if [ "$RUN_TESTS" = "true" ]; then ./test.sh --verbose; fi
|
||||||
- cargo test --release --verbose ${FEATURES} ${TARGETS}
|
- if [ "$RUN_COVERAGE" = "true" ]; then ./scripts/cov.sh "$KCOV_CMD"; fi
|
||||||
- cargo bench --no-run ${FEATURES} ${TARGETS}
|
|
||||||
- tar cvzf parity${ARCHIVE_SUFFIX}.tar.gz -C target/release parity
|
|
||||||
after_success: |
|
after_success: |
|
||||||
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 && make install DESTDIR=../tmp && cd ../.. &&
|
|
||||||
cargo test --no-run ${KCOV_FEATURES} ${TARGETS} &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_util-* &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethash-* &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore-* &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethsync-* &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/deps/ethcore_rpc-* &&
|
|
||||||
./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=${COVERALLS_TOKEN} --exclude-pattern /.cargo,/root/.multirust target/kcov target/debug/parity-* &&
|
|
||||||
[ $TRAVIS_BRANCH = master ] &&
|
[ $TRAVIS_BRANCH = master ] &&
|
||||||
[ $TRAVIS_PULL_REQUEST = false ] &&
|
[ $TRAVIS_PULL_REQUEST = false ] &&
|
||||||
[ $TRAVIS_RUST_VERSION = nightly ] &&
|
[ "$RUN_DOCS" = "true" ] &&
|
||||||
cargo doc --no-deps --verbose ${KCOV_FEATURES} ${TARGETS} &&
|
./scripts/doc.sh &&
|
||||||
echo '<meta http-equiv=refresh content=0;url=ethcore/index.html>' > target/doc/index.html &&
|
|
||||||
pip install --user ghp-import &&
|
pip install --user ghp-import &&
|
||||||
/home/travis/.local/bin/ghp-import -n target/doc &&
|
/home/travis/.local/bin/ghp-import -n target/doc &&
|
||||||
git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
|
git push -fq https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- secure: 3sUjNi9mhdL5h1GTm8LONnDN/SYvUHT+WSkMl93h3nYiLCQXk8eZaPS98AS7oOaTsfW4UvnwckVFCFl49ttInsv4cd/TkAxmrJHe6kPyS9/4NWUdmP8BjicbBvL/ioSdXMECMEYzPDLV+I3KhtC2LcB6ceDEl/XwMOJlzbGf7RbtcXGVQgMLqSYY1YKjQA4vbT5nFgIS/sZu3Z9yFgN0GafnihKcizqoHhdJjs/zxmX+qJepnC6o3V6KcFnS7QHhM1JOr85twE6S422UlvNaEb5ovwLPqmOl5+fA+6shbx4AxFTY6E9Iors+OVY/JliFhrqOdCt0i2P1FUHN4kbGZQkf0rphN/ZOI2uKNFTOyXiPvppfo/ZemKmcqkwkqP9+lf5QqYmtE6hsAYagxn49xJZILl8tAYbdqxF5gxa+TEVrfsBFtz/Sv3q8QhKQNPAmjEcKyMatyEreLUIFEpFTGIco8jN4eXeSoLRdJ+Z75ihttfQWhNfUDgNL30iQLy0AgFSsh/cyb5M8y9lxrGDzDTogvaiKGwr/V45sPkcXWCkmOgMdINqBB6ZtdL3bGHdyjmYj+y3btjf3aP11k++BL0fXIaKn25aS/p/9iyGb1FyGCM03o4ZRQ3YhTOvfMRfRGf6nWbaMx9upv8o5ShSdysewhrnh3082r7u896ny1Ho=
|
|
||||||
- secure: 0/FeVvFl3AhBW0TCPoujY9zOAYoUNMlAz3XjC04vlc4Ksfx0lGU3KFi97LlALxMWV0lfwQc7ixSe2vTgQVQuLVSU9XEW40fQgEjJlmLca2RcRx1kfzJDypuWSiCME7MWmLPH0ac4COdTDS1z5WGggv5YB7GQPCzFvcmOOaPYtF29ngCtkyB2HmNkY/W3omHFEk7Si6bsmOSHZiOAhivPl6ixnGpFyTEKPyraMMqPIj5rbEGkzgeLTiXf2ur143n/tnSr8tmP1MfQi9yS8/ONidMqnxUeuLkeNnb82zj9pVJhVXq0xF44WXJ8Za1jm0ByiTakgqpm8Juk822qjvtNulJ1XZW/fyZQZaN1dy3uq5Ud3W8wS9M7VIVl8CoXozzDpIsdPeUAtkAxeHBsZqL1vAH2yC1YJA7HPySMYzCjYqkJ2r62xYk0gXmNXphfU+F/X/rHzHsTMJPONJ54HQwu12m7zVlKIYBGHgEXg/HAM/g4ljUzl6WWR/nHH/tQM8ND/8FpHluJSZJWacq/1QNhVdTq2x6cqws2fs5A7nVpccR9+6RRgYgv6+YS2LxvFzByuZveGGoKif+uMECXN876j40araUqU528Yz9i8bHJlnM3coRBndaLNWByLcUyXCB9r9IUosUu41rr+L2mVzkSDm0GicuNCzqvzYQ9Q6QY4uQ=
|
|
||||||
- secure: DglvLR27MrBKQO/8s7ZfGqfimXk1Iq5MreCTc+ZkWMkZ0sDP76YBUPq5j25hcg0Z09z09O2Q5OUOyYkhVD4AnRjoRLUplHdpDE9CBSz2vUGpMpzhgAqzBc6SDsEmWU2JlAPBraIODXQdP/Qo6tYY4zn3vwd/VFKo27GTb5b60WAkTVvT/0YPWycEXFIa7sNMgjNI0EnT+Se5USDYwb6MM1T9JxJot0q3WtOnsVyroCHJp4QDicpS8eQIu3Tl+SLE4d0EoJ4YYLOI+jWOybipuO1xM1xlHq/gpWfjKqbJh24xtAds524dN7ujfjAhyO2zQbuTOfi7QVOj/Go0tGYxNxobR4pYG783Aiq3Quj0GzSrLEAatkk5tGOcuVJ98EYIg3WPJuC93waTTXcS0xDyy09XHxWxZ/5PiXorRZjpHvnZfRF0X4Mus6jUJ7hqDuOUiF5BI1RHomHvJQQHUrLdmh7OHyrer3YUpKRs65tww6H+VM+lKNa3MnMkB5+or/co14svs7I4pni9S+aZg//bwuxGVXchK6bjLCP1X99Ar4fA5EGsTVdjp3PRqutM/P3RqNGkwTczat/PNZ8fFAD9y7pDs2L6YkqpflTC9d6vKTSl6gORGw6ltLUJs23ON6xRNIBMw1cXp67wN57vF46TPt1i3ZlIQsYn0pAVNKavbZE=
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
provider: releases
|
|
||||||
api_key:
|
|
||||||
secure: "t+oGT/4lsy7IScw5s86Dpntl5Nyck4qG6nhHwMScc6FYzwLldgwgJaafL8Ej+HG+b7nFLriN+Snoa4YQ5o74X5ZlSWubVREOYQlL/fq7vcPB0DwAZ0Jufq1QW2R1M+3SwwF1eAwTv2W3G7A2K7dxjCVvENcy/gdxnZ36NeUPsqaCC9UcI2Yc7+4jyQwvx6ZfBvQeu+HbKENA0eUNs2ZQOID/1IPy0LJBvSyxAQYsysXdjTzGdNu4+Iba20E8uWYe4fAbgz+gwGarXg1L6D6gKyMlWkViqWjvXWBuDJJqMQZ3rw41AwZOoh3mKd2Lc0l6l4oZcEqPuob0yKTNjz1tuJy9xKTC2F2bDzsvUgk1IRfMK5ukXXXS09ZCZWuA9/GtnsqJ1xGTiwX+DhQzpVBHaBiseSNlYE1YN/3jNyGY+iSts1qut+1BwE7swmcTLsAPoAy8Ue+f7ErNoCg1lm71vq7VO2DLn7x2NqHyHUEuJ+7olDHSdE84G7d9otDRu/+TfMOw7GXwTaha6yJRInuNsnj4CFMLNVvYACzCC2idB7f7nUZoSFi9jf18S9fCMPVmazMrFj4g95HWrVHkjpV5zRTeUdTWw6DJl6pC9HFqORHdCvLv4Rc4dm5r3CmOcAQ0ZuiccV2oKzw4/Wic96daae8M5f5KSQ/WTr+h0wXZKp0="
|
|
||||||
skip_cleanup: true
|
|
||||||
file: parity${ARCHIVE_SUFFIX}.tar.gz
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
webhooks:
|
|
||||||
urls:
|
|
||||||
- https://hooks.slack.com/services/${SLACK_WEBHOOK}
|
|
||||||
on_success: always
|
|
||||||
on_failure: always
|
|
||||||
on_start: never
|
|
||||||
|
|||||||
1775
Cargo.lock
generated
Normal file
1775
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
65
Cargo.toml
65
Cargo.toml
@@ -1,28 +1,73 @@
|
|||||||
[package]
|
[package]
|
||||||
description = "Ethcore client."
|
description = "Ethcore client."
|
||||||
name = "parity"
|
name = "parity"
|
||||||
version = "0.9.0"
|
version = "1.3.12"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
rustc_version = "0.1"
|
||||||
|
syntex = "*"
|
||||||
|
ethcore-ipc-codegen = { path = "ipc/codegen" }
|
||||||
|
ethcore-ipc-tests = { path = "ipc/tests" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
docopt = "0.6"
|
docopt = "0.6"
|
||||||
docopt_macros = "0.6"
|
time = "0.1"
|
||||||
ctrlc = "1.0"
|
num_cpus = "0.2"
|
||||||
clippy = "0.0.37"
|
number_prefix = "0.2"
|
||||||
ethcore-util = { path = "util" }
|
rpassword = "0.2.1"
|
||||||
ethcore = { path = "ethcore" }
|
semver = "0.2"
|
||||||
ethsync = { path = "sync" }
|
ansi_term = "0.7"
|
||||||
ethcore-rpc = { path = "rpc", optional = true }
|
lazy_static = "0.2"
|
||||||
|
regex = "0.1"
|
||||||
|
isatty = "0.1"
|
||||||
|
ctrlc = { git = "https://github.com/ethcore/rust-ctrlc.git" }
|
||||||
fdlimit = { path = "util/fdlimit" }
|
fdlimit = { path = "util/fdlimit" }
|
||||||
|
ethcore = { path = "ethcore" }
|
||||||
|
ethcore-util = { path = "util" }
|
||||||
|
ethsync = { path = "sync" }
|
||||||
|
ethcore-io = { path = "util/io" }
|
||||||
|
ethcore-devtools = { path = "devtools" }
|
||||||
|
ethcore-rpc = { path = "rpc" }
|
||||||
|
ethcore-signer = { path = "signer" }
|
||||||
|
ethcore-ipc-nano = { path = "ipc/nano" }
|
||||||
|
ethcore-ipc = { path = "ipc/rpc" }
|
||||||
|
ethcore-ipc-hypervisor = { path = "ipc/hypervisor" }
|
||||||
|
ethcore-logger = { path = "logger" }
|
||||||
|
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git", branch = "beta" }
|
||||||
|
ethcore-dapps = { path = "dapps", optional = true }
|
||||||
|
clippy = { version = "0.0.80", optional = true}
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies]
|
||||||
|
winapi = "0.2"
|
||||||
|
|
||||||
|
[target.'cfg(not(windows))'.dependencies]
|
||||||
|
daemonize = "0.2"
|
||||||
|
|
||||||
|
[dependencies.hyper]
|
||||||
|
version = "0.8"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rpc"]
|
default = ["ui", "use-precompiled-js"]
|
||||||
rpc = ["ethcore-rpc"]
|
ui = ["dapps", "ethcore-signer/ui"]
|
||||||
|
use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"]
|
||||||
|
dapps = ["ethcore-dapps"]
|
||||||
|
ipc = ["ethcore/ipc"]
|
||||||
|
jit = ["ethcore/jit"]
|
||||||
|
dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethcore-dapps/dev", "ethcore-signer/dev"]
|
||||||
|
json-tests = ["ethcore/json-tests"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "parity/main.rs"
|
path = "parity/main.rs"
|
||||||
name = "parity"
|
name = "parity"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
debug = false
|
||||||
|
lto = false
|
||||||
|
|
||||||
|
|||||||
126
README.md
126
README.md
@@ -1,76 +1,92 @@
|
|||||||
# ethcore
|
# [Parity](https://ethcore.io/parity.html)
|
||||||
|
### Fast, light, and robust Ethereum implementation
|
||||||
|
|
||||||
[![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Join the chat at https://gitter.im/trogdoro/xiki][gitter-image]][gitter-url]
|
[![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Join the chat at https://gitter.im/ethcore/parity][gitter-image]][gitter-url] [![GPLv3][license-image]][license-url]
|
||||||
|
|
||||||
|
[Internal Documentation][doc-url]
|
||||||
|
|
||||||
|
Be sure to check out [our wiki][wiki-url] for more information.
|
||||||
|
|
||||||
[travis-image]: https://travis-ci.org/ethcore/parity.svg?branch=master
|
[travis-image]: https://travis-ci.org/ethcore/parity.svg?branch=master
|
||||||
[travis-url]: https://travis-ci.org/ethcore/parity
|
[travis-url]: https://travis-ci.org/ethcore/parity
|
||||||
[coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master&t=Fk0OuQ
|
[coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master
|
||||||
[coveralls-url]: https://coveralls.io/r/ethcore/parity?branch=master
|
[coveralls-url]: https://coveralls.io/github/ethcore/parity?branch=master
|
||||||
[gitter-image]: https://badges.gitter.im/Join%20Chat.svg
|
[gitter-image]: https://badges.gitter.im/Join%20Chat.svg
|
||||||
[gitter-url]: https://gitter.im/ethcore/parity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
[gitter-url]: https://gitter.im/ethcore/parity?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||||
|
[license-image]: https://img.shields.io/badge/license-GPL%20v3-green.svg
|
||||||
|
[license-url]: http://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
[doc-url]: http://ethcore.github.io/parity/ethcore/index.html
|
||||||
|
[wiki-url]: https://github.com/ethcore/parity/wiki
|
||||||
|
|
||||||
[Documentation](http://ethcore.github.io/parity/ethcore/index.html)
|
----
|
||||||
|
|
||||||
### Building from source
|
## About Parity
|
||||||
|
|
||||||
##### Ubuntu 14.04, 15.04, 15.10
|
Parity's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity using the sophisticated and
|
||||||
|
cutting-edge Rust programming language. Parity is licensed under the GPLv3, and can be used for all your Ethereum needs.
|
||||||
|
|
||||||
|
By default, Parity will run a JSONRPC server on `127.0.0.1:8545`. This is fully configurable and supports a number
|
||||||
|
of RPC APIs.
|
||||||
|
|
||||||
|
Parity also runs a server for running decentralized apps, or "Dapps", on `http://127.0.0.1:8080`.
|
||||||
|
This includes a few useful Dapps, including Ethereum Wallet, Maker OTC, and a node status page.
|
||||||
|
In a near-future release, it will be easy to install Dapps and use them through this web interface.
|
||||||
|
|
||||||
|
If you run into an issue while using parity, feel free to file one in this repository
|
||||||
|
or hop on our [gitter chat room][gitter-url] to ask a question. We are glad to help!
|
||||||
|
|
||||||
|
Parity's current release is 1.2. You can download it at https://ethcore.io/parity.html or follow the instructions
|
||||||
|
below to build from source.
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Build dependencies
|
||||||
|
|
||||||
|
Parity is fully compatible with Stable Rust.
|
||||||
|
|
||||||
|
We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have rustup, you can install it like this:
|
||||||
|
|
||||||
|
- Linux and OSX:
|
||||||
|
```bash
|
||||||
|
$ curl https://sh.rustup.rs -sSf | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
- Windows
|
||||||
|
|
||||||
|
Make sure you have Visual Studio 2015 with C++ support installed. Next, download and run the rustup installer from
|
||||||
|
https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe, start "VS2015 x64 Native Tools Command Prompt", and use the following command to install and set up the msvc toolchain:
|
||||||
|
```
|
||||||
|
$ rustup default stable-x86_64-pc-windows-msvc
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you have rustup, install parity or download and build from source
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
## Quick install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# install rocksdb
|
cargo install --git https://github.com/ethcore/parity.git parity
|
||||||
add-apt-repository ppa:ethcore/ethcore
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y --force-yes librocksdb
|
|
||||||
|
|
||||||
# install multirust
|
|
||||||
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
|
|
||||||
|
|
||||||
# install nightly and make it default
|
|
||||||
multirust update nightly
|
|
||||||
multirust default nightly
|
|
||||||
|
|
||||||
# download and build parity
|
|
||||||
git clone https://github.com/ethcore/parity
|
|
||||||
cd parity
|
|
||||||
cargo build --release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Other Linux
|
----
|
||||||
|
|
||||||
|
## Build from source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# install rocksdb
|
# download Parity code
|
||||||
git clone --tag v4.1 --depth=1 https://github.com/facebook/rocksdb.git
|
$ git clone https://github.com/ethcore/parity
|
||||||
cd rocksdb
|
$ cd parity
|
||||||
make shared_lib
|
|
||||||
sudo cp -a librocksdb.so* /usr/lib
|
|
||||||
sudo ldconfig
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# install rust nightly
|
# build in release mode
|
||||||
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes
|
$ cargo build --release
|
||||||
|
|
||||||
# install nightly and make it default
|
|
||||||
sudo multirust update nightly
|
|
||||||
sudo multirust default nightly
|
|
||||||
|
|
||||||
# download and build parity
|
|
||||||
git clone https://github.com/ethcore/parity
|
|
||||||
cd parity
|
|
||||||
cargo build --release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
##### OSX with Homebrew
|
This will produce an executable in the `./target/release` subdirectory.
|
||||||
|
|
||||||
|
To get started, just run
|
||||||
```bash
|
```bash
|
||||||
# install rocksdb && multirust
|
$ ./target/release/parity
|
||||||
brew update
|
|
||||||
brew install rocksdb
|
|
||||||
brew install multirust
|
|
||||||
|
|
||||||
# install nightly and make it default
|
|
||||||
multirust update nightly && multirust default nightly
|
|
||||||
|
|
||||||
# download and build parity
|
|
||||||
git clone https://github.com/ethcore/parity
|
|
||||||
cd parity
|
|
||||||
cargo build --release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
and parity will begin syncing the Ethereum blockchain.
|
||||||
|
|||||||
50
appveyor.yml
Normal file
50
appveyor.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- TARGET: x86_64-pc-windows-msvc
|
||||||
|
cert:
|
||||||
|
secure: ESPpYVVAMG1fbJx6kq4ct/g9SQTXac4Hs6xXr6Oh4Zrk2dwYglNjxmzErdPnvu7gs/gekzrJ6KEQHYRc+5+4dKg6rRADQ681NLVx9vOggBs=
|
||||||
|
certpass:
|
||||||
|
secure: 0BgXJqxq9Ei34/hZ7121FQ==
|
||||||
|
keyfile: C:\users\appveyor\Certificates.p12
|
||||||
|
RUSTFLAGS: -Zorbit=off
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- /^beta-.*$/
|
||||||
|
- /^stable-.*$/
|
||||||
|
- /^beta$/
|
||||||
|
- /^stable$/
|
||||||
|
|
||||||
|
install:
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
- ps: Install-Product node 6
|
||||||
|
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-1.12.0-x86_64-pc-windows-msvc.exe"
|
||||||
|
- ps: Start-FileDownload "https://github.com/ethcore/win-build/raw/master/SimpleFC.dll" -FileName nsis\SimpleFC.dll
|
||||||
|
- ps: Start-FileDownload "https://github.com/ethcore/win-build/raw/master/vc_redist.x64.exe" -FileName nsis\vc_redist.x64.exe
|
||||||
|
- rust-1.12.0-x86_64-pc-windows-msvc.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
|
||||||
|
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin;C:\Program Files (x86)\NSIS;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin
|
||||||
|
- rustc -V
|
||||||
|
- cargo -V
|
||||||
|
- node -v
|
||||||
|
- npm -v
|
||||||
|
|
||||||
|
build: off
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- cargo test --verbose --release
|
||||||
|
|
||||||
|
after_test:
|
||||||
|
- cargo build --verbose --release
|
||||||
|
- ps: if($env:cert) { Start-FileDownload $env:cert -FileName $env:keyfile }
|
||||||
|
- ps: if($env:cert) { signtool sign /f $env:keyfile /p $env:certpass target\release\parity.exe }
|
||||||
|
- makensis.exe nsis\installer.nsi
|
||||||
|
- ps: if($env:cert) { signtool sign /f $env:keyfile /p $env:certpass nsis\installer.exe }
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: nsis\installer.exe
|
||||||
|
name: Windows Installer (x86_64)
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- target
|
||||||
|
- C:\users\appveyor\.cargo -> appveyor.yml
|
||||||
25
build.rs
Normal file
25
build.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
extern crate rustc_version;
|
||||||
|
|
||||||
|
use rustc_version::{version_meta, Channel};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
if let Channel::Nightly = version_meta().channel {
|
||||||
|
println!("cargo:rustc-cfg=nightly");
|
||||||
|
}
|
||||||
|
}
|
||||||
21
cov.sh
21
cov.sh
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Installing KCOV under ubuntu
|
|
||||||
# https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650#
|
|
||||||
### Install deps
|
|
||||||
# $ sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev
|
|
||||||
#
|
|
||||||
### Compile kcov
|
|
||||||
# $ wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && tar xf master.tar.gz
|
|
||||||
# $ cd kcov-master && mkdir build && cd build
|
|
||||||
# $ cmake .. && make && sudo make install
|
|
||||||
|
|
||||||
### Running coverage
|
|
||||||
if ! type kcov > /dev/null; then
|
|
||||||
echo "Install kcov first (details inside this file). Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cargo test --features ethcore/json-tests -p ethcore --no-run || exit $?
|
|
||||||
mkdir -p target/coverage
|
|
||||||
kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/deps/ethcore*
|
|
||||||
xdg-open target/coverage/index.html
|
|
||||||
46
dapps/Cargo.toml
Normal file
46
dapps/Cargo.toml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
[package]
|
||||||
|
description = "Parity Dapps crate"
|
||||||
|
name = "ethcore-dapps"
|
||||||
|
version = "1.3.0"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
authors = ["Ethcore <admin@ethcore.io"]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
log = "0.3"
|
||||||
|
jsonrpc-core = "2.1"
|
||||||
|
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git", branch = "beta" }
|
||||||
|
hyper = { default-features = false, git = "https://github.com/ethcore/hyper" }
|
||||||
|
unicase = "1.3"
|
||||||
|
url = "1.0"
|
||||||
|
rustc-serialize = "0.3"
|
||||||
|
serde = "0.7.0"
|
||||||
|
serde_json = "0.7.0"
|
||||||
|
serde_macros = { version = "0.7.0", optional = true }
|
||||||
|
ethcore-rpc = { path = "../rpc" }
|
||||||
|
ethcore-util = { path = "../util" }
|
||||||
|
parity-dapps = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" }
|
||||||
|
# List of apps
|
||||||
|
parity-dapps-status = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" }
|
||||||
|
parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" }
|
||||||
|
parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true }
|
||||||
|
mime_guess = { version = "1.6.1" }
|
||||||
|
clippy = { version = "0.0.80", optional = true}
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
serde_codegen = { version = "0.7.0", optional = true }
|
||||||
|
syntex = "*"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["serde_codegen", "extra-dapps"]
|
||||||
|
extra-dapps = ["parity-dapps-wallet"]
|
||||||
|
nightly = ["serde_macros"]
|
||||||
|
dev = ["clippy", "ethcore-rpc/dev", "ethcore-util/dev"]
|
||||||
|
|
||||||
|
use-precompiled-js = [
|
||||||
|
"parity-dapps-status/use-precompiled-js",
|
||||||
|
"parity-dapps-home/use-precompiled-js",
|
||||||
|
"parity-dapps-wallet/use-precompiled-js"
|
||||||
|
]
|
||||||
45
dapps/build.rs
Normal file
45
dapps/build.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#[cfg(not(feature = "serde_macros"))]
|
||||||
|
mod inner {
|
||||||
|
extern crate syntex;
|
||||||
|
extern crate serde_codegen;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
|
||||||
|
let src = Path::new("./src/api/types.rs.in");
|
||||||
|
let dst = Path::new(&out_dir).join("types.rs");
|
||||||
|
|
||||||
|
let mut registry = syntex::Registry::new();
|
||||||
|
|
||||||
|
serde_codegen::register(&mut registry);
|
||||||
|
registry.expand("", &src, &dst).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "serde_macros")]
|
||||||
|
mod inner {
|
||||||
|
pub fn main() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
inner::main();
|
||||||
|
}
|
||||||
101
dapps/src/api/api.rs
Normal file
101
dapps/src/api/api.rs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
use hyper::{server, net, Decoder, Encoder, Next};
|
||||||
|
use api::types::{App, ApiError};
|
||||||
|
use api::response::{as_json, as_json_error, ping_response};
|
||||||
|
use handlers::extract_url;
|
||||||
|
use endpoint::{Endpoint, Endpoints, Handler, EndpointPath};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct RestApi {
|
||||||
|
local_domain: String,
|
||||||
|
endpoints: Arc<Endpoints>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RestApi {
|
||||||
|
pub fn new(local_domain: String, endpoints: Arc<Endpoints>) -> Box<Endpoint> {
|
||||||
|
Box::new(RestApi {
|
||||||
|
local_domain: local_domain,
|
||||||
|
endpoints: endpoints,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn list_apps(&self) -> Vec<App> {
|
||||||
|
self.endpoints.iter().filter_map(|(ref k, ref e)| {
|
||||||
|
e.info().map(|ref info| App::from_info(k, info))
|
||||||
|
}).collect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Endpoint for RestApi {
|
||||||
|
fn to_handler(&self, _path: EndpointPath) -> Box<Handler> {
|
||||||
|
Box::new(RestApiRouter {
|
||||||
|
api: self.clone(),
|
||||||
|
handler: as_json_error(&ApiError {
|
||||||
|
code: "404".into(),
|
||||||
|
title: "Not Found".into(),
|
||||||
|
detail: "Resource you requested has not been found.".into(),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct RestApiRouter {
|
||||||
|
api: RestApi,
|
||||||
|
handler: Box<Handler>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl server::Handler<net::HttpStream> for RestApiRouter {
|
||||||
|
|
||||||
|
fn on_request(&mut self, request: server::Request<net::HttpStream>) -> Next {
|
||||||
|
let url = extract_url(&request);
|
||||||
|
if url.is_none() {
|
||||||
|
// Just return 404 if we can't parse URL
|
||||||
|
return Next::write();
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = url.expect("Check for None is above; qed");
|
||||||
|
let endpoint = url.path.get(1).map(|v| v.as_str());
|
||||||
|
|
||||||
|
let handler = endpoint.and_then(|v| match v {
|
||||||
|
"apps" => Some(as_json(&self.api.list_apps())),
|
||||||
|
"ping" => Some(ping_response(&self.api.local_domain)),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Overwrite default
|
||||||
|
if let Some(h) = handler {
|
||||||
|
self.handler = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.handler.on_request(request)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, decoder: &mut Decoder<net::HttpStream>) -> Next {
|
||||||
|
self.handler.on_request_readable(decoder)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
self.handler.on_response(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response_writable(&mut self, encoder: &mut Encoder<net::HttpStream>) -> Next {
|
||||||
|
self.handler.on_response_writable(encoder)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
27
dapps/src/api/mod.rs
Normal file
27
dapps/src/api/mod.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! REST API
|
||||||
|
|
||||||
|
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))]
|
||||||
|
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))]
|
||||||
|
|
||||||
|
mod api;
|
||||||
|
mod response;
|
||||||
|
mod types;
|
||||||
|
|
||||||
|
pub use self::api::RestApi;
|
||||||
|
pub use self::types::App;
|
||||||
36
dapps/src/api/response.rs
Normal file
36
dapps/src/api/response.rs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
|
use serde_json;
|
||||||
|
use endpoint::Handler;
|
||||||
|
use handlers::{ContentHandler, EchoHandler};
|
||||||
|
|
||||||
|
pub fn as_json<T : Serialize>(val: &T) -> Box<Handler> {
|
||||||
|
Box::new(ContentHandler::ok(serde_json::to_string(val).unwrap(), "application/json".to_owned()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_json_error<T : Serialize>(val: &T) -> Box<Handler> {
|
||||||
|
Box::new(ContentHandler::not_found(serde_json::to_string(val).unwrap(), "application/json".to_owned()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ping_response(local_domain: &str) -> Box<Handler> {
|
||||||
|
Box::new(EchoHandler::cors(vec![
|
||||||
|
format!("http://{}", local_domain),
|
||||||
|
// Allow CORS calls also for localhost
|
||||||
|
format!("http://{}", local_domain.replace("127.0.0.1", "localhost")),
|
||||||
|
]))
|
||||||
|
}
|
||||||
21
dapps/src/api/types.rs
Normal file
21
dapps/src/api/types.rs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#[cfg(feature = "serde_macros")]
|
||||||
|
include!("types.rs.in");
|
||||||
|
|
||||||
|
#[cfg(not(feature = "serde_macros"))]
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/types.rs"));
|
||||||
50
dapps/src/api/types.rs.in
Normal file
50
dapps/src/api/types.rs.in
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use endpoint::EndpointInfo;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct App {
|
||||||
|
pub id: String,
|
||||||
|
pub name: String,
|
||||||
|
pub description: String,
|
||||||
|
pub version: String,
|
||||||
|
pub author: String,
|
||||||
|
#[serde(rename="iconUrl")]
|
||||||
|
pub icon_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl App {
|
||||||
|
/// Creates `App` instance from `EndpointInfo` and `id`.
|
||||||
|
pub fn from_info(id: &str, info: &EndpointInfo) -> Self {
|
||||||
|
App {
|
||||||
|
id: id.to_owned(),
|
||||||
|
name: info.name.to_owned(),
|
||||||
|
description: info.description.to_owned(),
|
||||||
|
version: info.version.to_owned(),
|
||||||
|
author: info.author.to_owned(),
|
||||||
|
icon_url: info.icon_url.to_owned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct ApiError {
|
||||||
|
pub code: String,
|
||||||
|
pub title: String,
|
||||||
|
pub detail: String,
|
||||||
|
}
|
||||||
|
|
||||||
116
dapps/src/apps/fs.rs
Normal file
116
dapps/src/apps/fs.rs
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use serde_json;
|
||||||
|
use std::io;
|
||||||
|
use std::io::Read;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use page::LocalPageEndpoint;
|
||||||
|
use endpoint::{Endpoints, EndpointInfo};
|
||||||
|
use api::App;
|
||||||
|
|
||||||
|
struct LocalDapp {
|
||||||
|
id: String,
|
||||||
|
path: PathBuf,
|
||||||
|
info: EndpointInfo,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn local_dapps(dapps_path: String) -> Vec<LocalDapp> {
|
||||||
|
let files = fs::read_dir(dapps_path.as_str());
|
||||||
|
if let Err(e) = files {
|
||||||
|
warn!(target: "dapps", "Unable to load local dapps from: {}. Reason: {:?}", dapps_path, e);
|
||||||
|
return vec![];
|
||||||
|
}
|
||||||
|
|
||||||
|
let files = files.expect("Check is done earlier");
|
||||||
|
files.map(|dir| {
|
||||||
|
let entry = try!(dir);
|
||||||
|
let file_type = try!(entry.file_type());
|
||||||
|
|
||||||
|
// skip files
|
||||||
|
if file_type.is_file() {
|
||||||
|
return Err(io::Error::new(io::ErrorKind::NotFound, "Not a file"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// take directory name and path
|
||||||
|
entry.file_name().into_string()
|
||||||
|
.map(|name| (name, entry.path()))
|
||||||
|
.map_err(|e| {
|
||||||
|
info!(target: "dapps", "Unable to load dapp: {:?}. Reason: {:?}", entry.path(), e);
|
||||||
|
io::Error::new(io::ErrorKind::NotFound, "Invalid name")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.filter_map(|m| {
|
||||||
|
if let Err(ref e) = m {
|
||||||
|
debug!(target: "dapps", "Ignoring local dapp: {:?}", e);
|
||||||
|
}
|
||||||
|
m.ok()
|
||||||
|
})
|
||||||
|
.map(|(name, path)| {
|
||||||
|
// try to get manifest file
|
||||||
|
let info = read_manifest(&name, path.clone());
|
||||||
|
LocalDapp {
|
||||||
|
id: name,
|
||||||
|
path: path,
|
||||||
|
info: info,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_manifest(name: &str, mut path: PathBuf) -> EndpointInfo {
|
||||||
|
path.push("manifest.json");
|
||||||
|
|
||||||
|
fs::File::open(path.clone())
|
||||||
|
.map_err(|e| format!("{:?}", e))
|
||||||
|
.and_then(|mut f| {
|
||||||
|
// Reat file
|
||||||
|
let mut s = String::new();
|
||||||
|
try!(f.read_to_string(&mut s).map_err(|e| format!("{:?}", e)));
|
||||||
|
// Try to deserialize manifest
|
||||||
|
serde_json::from_str::<App>(&s).map_err(|e| format!("{:?}", e))
|
||||||
|
})
|
||||||
|
.map(|app| EndpointInfo {
|
||||||
|
name: app.name,
|
||||||
|
description: app.description,
|
||||||
|
version: app.version,
|
||||||
|
author: app.author,
|
||||||
|
icon_url: app.icon_url,
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|e| {
|
||||||
|
warn!(target: "dapps", "Cannot read manifest file at: {:?}. Error: {:?}", path, e);
|
||||||
|
|
||||||
|
EndpointInfo {
|
||||||
|
name: name.into(),
|
||||||
|
description: name.into(),
|
||||||
|
version: "0.0.0".into(),
|
||||||
|
author: "?".into(),
|
||||||
|
icon_url: "icon.png".into(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn local_endpoints(dapps_path: String) -> Endpoints {
|
||||||
|
let mut pages = Endpoints::new();
|
||||||
|
for dapp in local_dapps(dapps_path) {
|
||||||
|
pages.insert(
|
||||||
|
dapp.id,
|
||||||
|
Box::new(LocalPageEndpoint::new(dapp.path, dapp.info))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
pages
|
||||||
|
}
|
||||||
69
dapps/src/apps/mod.rs
Normal file
69
dapps/src/apps/mod.rs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use endpoint::{Endpoints, Endpoint};
|
||||||
|
use page::PageEndpoint;
|
||||||
|
use proxypac::ProxyPac;
|
||||||
|
use parity_dapps::WebApp;
|
||||||
|
|
||||||
|
mod fs;
|
||||||
|
|
||||||
|
extern crate parity_dapps_status;
|
||||||
|
extern crate parity_dapps_home;
|
||||||
|
|
||||||
|
pub const DAPPS_DOMAIN : &'static str = ".parity";
|
||||||
|
pub const RPC_PATH : &'static str = "rpc";
|
||||||
|
pub const API_PATH : &'static str = "api";
|
||||||
|
pub const UTILS_PATH : &'static str = "parity-utils";
|
||||||
|
|
||||||
|
pub fn main_page() -> &'static str {
|
||||||
|
"/home/"
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn utils() -> Box<Endpoint> {
|
||||||
|
Box::new(PageEndpoint::with_prefix(parity_dapps_home::App::default(), UTILS_PATH.to_owned()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn all_endpoints(dapps_path: String) -> Endpoints {
|
||||||
|
// fetch fs dapps at first to avoid overwriting builtins
|
||||||
|
let mut pages = fs::local_endpoints(dapps_path);
|
||||||
|
// Home page needs to be safe embed
|
||||||
|
// because we use Cross-Origin LocalStorage.
|
||||||
|
// TODO [ToDr] Account naming should be moved to parity.
|
||||||
|
pages.insert("home".into(), Box::new(
|
||||||
|
PageEndpoint::new_safe_to_embed(parity_dapps_home::App::default())
|
||||||
|
));
|
||||||
|
pages.insert("proxy".into(), ProxyPac::boxed());
|
||||||
|
insert::<parity_dapps_status::App>(&mut pages, "parity");
|
||||||
|
insert::<parity_dapps_status::App>(&mut pages, "status");
|
||||||
|
|
||||||
|
// Optional dapps
|
||||||
|
wallet_page(&mut pages);
|
||||||
|
|
||||||
|
pages
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "parity-dapps-wallet")]
|
||||||
|
fn wallet_page(pages: &mut Endpoints) {
|
||||||
|
extern crate parity_dapps_wallet;
|
||||||
|
insert::<parity_dapps_wallet::App>(pages, "wallet");
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "parity-dapps-wallet"))]
|
||||||
|
fn wallet_page(_pages: &mut Endpoints) {}
|
||||||
|
|
||||||
|
fn insert<T : WebApp + Default + 'static>(pages: &mut Endpoints, id: &str) {
|
||||||
|
pages.insert(id.to_owned(), Box::new(PageEndpoint::new(T::default())));
|
||||||
|
}
|
||||||
45
dapps/src/endpoint.rs
Normal file
45
dapps/src/endpoint.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! URL Endpoint traits
|
||||||
|
|
||||||
|
use hyper::{server, net};
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Default, Clone)]
|
||||||
|
pub struct EndpointPath {
|
||||||
|
pub app_id: String,
|
||||||
|
pub host: String,
|
||||||
|
pub port: u16,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
|
pub struct EndpointInfo {
|
||||||
|
pub name: String,
|
||||||
|
pub description: String,
|
||||||
|
pub version: String,
|
||||||
|
pub author: String,
|
||||||
|
pub icon_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Endpoint : Send + Sync {
|
||||||
|
fn info(&self) -> Option<&EndpointInfo> { None }
|
||||||
|
|
||||||
|
fn to_handler(&self, path: EndpointPath) -> Box<server::Handler<net::HttpStream> + Send>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Endpoints = BTreeMap<String, Box<Endpoint>>;
|
||||||
|
pub type Handler = server::Handler<net::HttpStream> + Send;
|
||||||
44
dapps/src/handlers/auth.rs
Normal file
44
dapps/src/handlers/auth.rs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Authorization Handlers
|
||||||
|
|
||||||
|
use hyper::{server, Decoder, Encoder, Next};
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use hyper::status::StatusCode;
|
||||||
|
|
||||||
|
pub struct AuthRequiredHandler;
|
||||||
|
|
||||||
|
impl server::Handler<HttpStream> for AuthRequiredHandler {
|
||||||
|
fn on_request(&mut self, _request: server::Request<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, _decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
res.set_status(StatusCode::Unauthorized);
|
||||||
|
res.headers_mut().set_raw("WWW-Authenticate", vec![b"Basic realm=\"Parity\"".to_vec()]);
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response_writable(&mut self, _encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
Next::end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
101
dapps/src/handlers/content.rs
Normal file
101
dapps/src/handlers/content.rs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Simple Content Handler
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
|
use hyper::{header, server, Decoder, Encoder, Next};
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use hyper::status::StatusCode;
|
||||||
|
|
||||||
|
pub struct ContentHandler {
|
||||||
|
code: StatusCode,
|
||||||
|
content: String,
|
||||||
|
mimetype: String,
|
||||||
|
write_pos: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ContentHandler {
|
||||||
|
pub fn ok(content: String, mimetype: String) -> Self {
|
||||||
|
ContentHandler {
|
||||||
|
code: StatusCode::Ok,
|
||||||
|
content: content,
|
||||||
|
mimetype: mimetype,
|
||||||
|
write_pos: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn forbidden(content: String, mimetype: String) -> Self {
|
||||||
|
ContentHandler {
|
||||||
|
code: StatusCode::Forbidden,
|
||||||
|
content: content,
|
||||||
|
mimetype: mimetype,
|
||||||
|
write_pos: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn not_found(content: String, mimetype: String) -> Self {
|
||||||
|
ContentHandler {
|
||||||
|
code: StatusCode::NotFound,
|
||||||
|
content: content,
|
||||||
|
mimetype: mimetype,
|
||||||
|
write_pos: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new(code: StatusCode, content: String, mimetype: String) -> Self {
|
||||||
|
ContentHandler {
|
||||||
|
code: code,
|
||||||
|
content: content,
|
||||||
|
mimetype: mimetype,
|
||||||
|
write_pos: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl server::Handler<HttpStream> for ContentHandler {
|
||||||
|
fn on_request(&mut self, _request: server::Request<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, _decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
res.set_status(self.code);
|
||||||
|
res.headers_mut().set(header::ContentType(self.mimetype.parse().unwrap()));
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response_writable(&mut self, encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
let bytes = self.content.as_bytes();
|
||||||
|
if self.write_pos == bytes.len() {
|
||||||
|
return Next::end();
|
||||||
|
}
|
||||||
|
|
||||||
|
match encoder.write(&bytes[self.write_pos..]) {
|
||||||
|
Ok(bytes) => {
|
||||||
|
self.write_pos += bytes;
|
||||||
|
Next::write()
|
||||||
|
},
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
::std::io::ErrorKind::WouldBlock => Next::write(),
|
||||||
|
_ => Next::end()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
148
dapps/src/handlers/echo.rs
Normal file
148
dapps/src/handlers/echo.rs
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Echo Handler
|
||||||
|
|
||||||
|
use std::io::Read;
|
||||||
|
use hyper::{header, server, Decoder, Encoder, Next};
|
||||||
|
use hyper::method::Method;
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use unicase::UniCase;
|
||||||
|
use super::ContentHandler;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
/// Type of Cross-Origin request
|
||||||
|
enum Cors {
|
||||||
|
/// Not a Cross-Origin request - no headers needed
|
||||||
|
No,
|
||||||
|
/// Cross-Origin request with valid Origin
|
||||||
|
Allowed(String),
|
||||||
|
/// Cross-Origin request with invalid Origin
|
||||||
|
Forbidden,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct EchoHandler {
|
||||||
|
safe_origins: Vec<String>,
|
||||||
|
content: String,
|
||||||
|
cors: Cors,
|
||||||
|
handler: Option<ContentHandler>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EchoHandler {
|
||||||
|
|
||||||
|
pub fn cors(safe_origins: Vec<String>) -> Self {
|
||||||
|
EchoHandler {
|
||||||
|
safe_origins: safe_origins,
|
||||||
|
content: String::new(),
|
||||||
|
cors: Cors::Forbidden,
|
||||||
|
handler: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cors_header(&self, origin: Option<String>) -> Cors {
|
||||||
|
fn origin_is_allowed(origin: &str, safe_origins: &[String]) -> bool {
|
||||||
|
for safe in safe_origins {
|
||||||
|
if origin.starts_with(safe) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
match origin {
|
||||||
|
Some(ref origin) if origin_is_allowed(origin, &self.safe_origins) => {
|
||||||
|
Cors::Allowed(origin.clone())
|
||||||
|
},
|
||||||
|
None => Cors::No,
|
||||||
|
_ => Cors::Forbidden,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl server::Handler<HttpStream> for EchoHandler {
|
||||||
|
fn on_request(&mut self, request: server::Request<HttpStream>) -> Next {
|
||||||
|
let origin = request.headers().get_raw("origin")
|
||||||
|
.and_then(|list| list.get(0))
|
||||||
|
.and_then(|origin| String::from_utf8(origin.clone()).ok());
|
||||||
|
|
||||||
|
self.cors = self.cors_header(origin);
|
||||||
|
|
||||||
|
// Don't even read the payload if origin is forbidden!
|
||||||
|
if let Cors::Forbidden = self.cors {
|
||||||
|
self.handler = Some(ContentHandler::ok(String::new(), "text/plain".into()));
|
||||||
|
Next::write()
|
||||||
|
} else {
|
||||||
|
Next::read()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
match decoder.read_to_string(&mut self.content) {
|
||||||
|
Ok(0) => {
|
||||||
|
self.handler = Some(ContentHandler::ok(self.content.clone(), "application/json".into()));
|
||||||
|
Next::write()
|
||||||
|
},
|
||||||
|
Ok(_) => Next::read(),
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
::std::io::ErrorKind::WouldBlock => Next::read(),
|
||||||
|
_ => Next::end(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
if let Cors::Allowed(ref domain) = self.cors {
|
||||||
|
let mut headers = res.headers_mut();
|
||||||
|
headers.set(header::Allow(vec![Method::Options, Method::Post, Method::Get]));
|
||||||
|
headers.set(header::AccessControlAllowHeaders(vec![
|
||||||
|
UniCase("origin".to_owned()),
|
||||||
|
UniCase("content-type".to_owned()),
|
||||||
|
UniCase("accept".to_owned()),
|
||||||
|
]));
|
||||||
|
headers.set(header::AccessControlAllowOrigin::Value(domain.clone()));
|
||||||
|
}
|
||||||
|
self.handler.as_mut().unwrap().on_response(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response_writable(&mut self, encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
self.handler.as_mut().unwrap().on_response_writable(encoder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_return_correct_cors_value() {
|
||||||
|
// given
|
||||||
|
let safe_origins = vec!["chrome-extension://".to_owned(), "http://localhost:8080".to_owned()];
|
||||||
|
let cut = EchoHandler {
|
||||||
|
safe_origins: safe_origins,
|
||||||
|
content: String::new(),
|
||||||
|
cors: Cors::No,
|
||||||
|
handler: None,
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
let res1 = cut.cors_header(Some("http://ethcore.io".into()));
|
||||||
|
let res2 = cut.cors_header(Some("http://localhost:8080".into()));
|
||||||
|
let res3 = cut.cors_header(Some("chrome-extension://deadbeefcafe".into()));
|
||||||
|
let res4 = cut.cors_header(None);
|
||||||
|
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert_eq!(res1, Cors::Forbidden);
|
||||||
|
assert_eq!(res2, Cors::Allowed("http://localhost:8080".into()));
|
||||||
|
assert_eq!(res3, Cors::Allowed("chrome-extension://deadbeefcafe".into()));
|
||||||
|
assert_eq!(res4, Cors::No);
|
||||||
|
}
|
||||||
57
dapps/src/handlers/mod.rs
Normal file
57
dapps/src/handlers/mod.rs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Hyper handlers implementations.
|
||||||
|
|
||||||
|
mod auth;
|
||||||
|
mod echo;
|
||||||
|
mod content;
|
||||||
|
mod redirect;
|
||||||
|
|
||||||
|
pub use self::auth::AuthRequiredHandler;
|
||||||
|
pub use self::echo::EchoHandler;
|
||||||
|
pub use self::content::ContentHandler;
|
||||||
|
pub use self::redirect::Redirection;
|
||||||
|
|
||||||
|
use url::Url;
|
||||||
|
use hyper::{server, header, net, uri};
|
||||||
|
|
||||||
|
pub fn extract_url(req: &server::Request<net::HttpStream>) -> Option<Url> {
|
||||||
|
match *req.uri() {
|
||||||
|
uri::RequestUri::AbsoluteUri(ref url) => {
|
||||||
|
match Url::from_generic_url(url.clone()) {
|
||||||
|
Ok(url) => Some(url),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uri::RequestUri::AbsolutePath(ref path) => {
|
||||||
|
// Attempt to prepend the Host header (mandatory in HTTP/1.1)
|
||||||
|
let url_string = match req.headers().get::<header::Host>() {
|
||||||
|
Some(ref host) => {
|
||||||
|
format!("http://{}:{}{}", host.hostname, host.port.unwrap_or(80), path)
|
||||||
|
},
|
||||||
|
None => return None,
|
||||||
|
};
|
||||||
|
|
||||||
|
match Url::parse(&url_string) {
|
||||||
|
Ok(url) => Some(url),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
55
dapps/src/handlers/redirect.rs
Normal file
55
dapps/src/handlers/redirect.rs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! HTTP Redirection hyper handler
|
||||||
|
|
||||||
|
use hyper::{header, server, Decoder, Encoder, Next};
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use hyper::status::StatusCode;
|
||||||
|
|
||||||
|
pub struct Redirection {
|
||||||
|
to_url: &'static str
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Redirection {
|
||||||
|
pub fn new(url: &'static str) -> Box<Self> {
|
||||||
|
Box::new(Redirection {
|
||||||
|
to_url: url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl server::Handler<HttpStream> for Redirection {
|
||||||
|
fn on_request(&mut self, _request: server::Request<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, _decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
res.set_status(StatusCode::MovedPermanently);
|
||||||
|
res.headers_mut().set(header::Location(self.to_url.to_owned()));
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
fn on_response_writable(&mut self, _encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
Next::end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
238
dapps/src/lib.rs
Normal file
238
dapps/src/lib.rs
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Ethcore Webapplications for Parity
|
||||||
|
//! ```
|
||||||
|
//! extern crate jsonrpc_core;
|
||||||
|
//! extern crate ethcore_dapps;
|
||||||
|
//!
|
||||||
|
//! use std::sync::Arc;
|
||||||
|
//! use jsonrpc_core::IoHandler;
|
||||||
|
//! use ethcore_dapps::*;
|
||||||
|
//!
|
||||||
|
//! struct SayHello;
|
||||||
|
//! impl MethodCommand for SayHello {
|
||||||
|
//! fn execute(&self, _params: Params) -> Result<Value, Error> {
|
||||||
|
//! Ok(Value::String("hello".to_string()))
|
||||||
|
//! }
|
||||||
|
//! }
|
||||||
|
//!
|
||||||
|
//! fn main() {
|
||||||
|
//! let io = IoHandler::new();
|
||||||
|
//! io.add_method("say_hello", SayHello);
|
||||||
|
//! let _server = Server::start_unsecure_http(
|
||||||
|
//! &"127.0.0.1:3030".parse().unwrap(),
|
||||||
|
//! Arc::new(io)
|
||||||
|
//! );
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
#![warn(missing_docs)]
|
||||||
|
#![cfg_attr(feature="nightly", plugin(clippy))]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
extern crate url as url_lib;
|
||||||
|
extern crate hyper;
|
||||||
|
extern crate unicase;
|
||||||
|
extern crate serde;
|
||||||
|
extern crate serde_json;
|
||||||
|
extern crate jsonrpc_core;
|
||||||
|
extern crate jsonrpc_http_server;
|
||||||
|
extern crate parity_dapps;
|
||||||
|
extern crate ethcore_rpc;
|
||||||
|
extern crate ethcore_util;
|
||||||
|
extern crate mime_guess;
|
||||||
|
|
||||||
|
mod endpoint;
|
||||||
|
mod apps;
|
||||||
|
mod page;
|
||||||
|
mod router;
|
||||||
|
mod handlers;
|
||||||
|
mod rpc;
|
||||||
|
mod api;
|
||||||
|
mod proxypac;
|
||||||
|
mod url;
|
||||||
|
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use jsonrpc_core::{IoHandler, IoDelegate};
|
||||||
|
use router::auth::{Authorization, NoAuth, HttpBasicAuth};
|
||||||
|
use ethcore_rpc::Extendable;
|
||||||
|
|
||||||
|
static DAPPS_DOMAIN : &'static str = ".parity";
|
||||||
|
|
||||||
|
/// Webapps HTTP+RPC server build.
|
||||||
|
pub struct ServerBuilder {
|
||||||
|
dapps_path: String,
|
||||||
|
handler: Arc<IoHandler>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Extendable for ServerBuilder {
|
||||||
|
fn add_delegate<D: Send + Sync + 'static>(&self, delegate: IoDelegate<D>) {
|
||||||
|
self.handler.add_delegate(delegate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ServerBuilder {
|
||||||
|
/// Construct new dapps server
|
||||||
|
pub fn new(dapps_path: String) -> Self {
|
||||||
|
ServerBuilder {
|
||||||
|
dapps_path: dapps_path,
|
||||||
|
handler: Arc::new(IoHandler::new())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asynchronously start server with no authentication,
|
||||||
|
/// returns result with `Server` handle on success or an error.
|
||||||
|
pub fn start_unsecured_http(&self, addr: &SocketAddr, hosts: Option<Vec<String>>) -> Result<Server, ServerError> {
|
||||||
|
Server::start_http(
|
||||||
|
addr,
|
||||||
|
hosts,
|
||||||
|
NoAuth,
|
||||||
|
self.handler.clone(),
|
||||||
|
self.dapps_path.clone(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Asynchronously start server with `HTTP Basic Authentication`,
|
||||||
|
/// return result with `Server` handle on success or an error.
|
||||||
|
pub fn start_basic_auth_http(&self, addr: &SocketAddr, hosts: Option<Vec<String>>, username: &str, password: &str) -> Result<Server, ServerError> {
|
||||||
|
Server::start_http(
|
||||||
|
addr,
|
||||||
|
hosts,
|
||||||
|
HttpBasicAuth::single_user(username, password),
|
||||||
|
self.handler.clone(),
|
||||||
|
self.dapps_path.clone(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Webapps HTTP server.
|
||||||
|
pub struct Server {
|
||||||
|
server: Option<hyper::server::Listening>,
|
||||||
|
panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Server {
|
||||||
|
/// Returns a list of allowed hosts or `None` if all hosts are allowed.
|
||||||
|
fn allowed_hosts(hosts: Option<Vec<String>>, bind_address: String) -> Option<Vec<String>> {
|
||||||
|
let mut allowed = Vec::new();
|
||||||
|
|
||||||
|
match hosts {
|
||||||
|
Some(hosts) => allowed.extend_from_slice(&hosts),
|
||||||
|
None => return None,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add localhost domain as valid too if listening on loopback interface.
|
||||||
|
allowed.push(bind_address.replace("127.0.0.1", "localhost").into());
|
||||||
|
allowed.push(bind_address.into());
|
||||||
|
Some(allowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn start_http<A: Authorization + 'static>(
|
||||||
|
addr: &SocketAddr,
|
||||||
|
hosts: Option<Vec<String>>,
|
||||||
|
authorization: A,
|
||||||
|
handler: Arc<IoHandler>,
|
||||||
|
dapps_path: String,
|
||||||
|
) -> Result<Server, ServerError> {
|
||||||
|
let panic_handler = Arc::new(Mutex::new(None));
|
||||||
|
let authorization = Arc::new(authorization);
|
||||||
|
let endpoints = Arc::new(apps::all_endpoints(dapps_path));
|
||||||
|
let special = Arc::new({
|
||||||
|
let mut special = HashMap::new();
|
||||||
|
special.insert(router::SpecialEndpoint::Rpc, rpc::rpc(handler, panic_handler.clone()));
|
||||||
|
special.insert(router::SpecialEndpoint::Api, api::RestApi::new(format!("{}", addr), endpoints.clone()));
|
||||||
|
special.insert(router::SpecialEndpoint::Utils, apps::utils());
|
||||||
|
special
|
||||||
|
});
|
||||||
|
let hosts = Self::allowed_hosts(hosts, format!("{}", addr));
|
||||||
|
|
||||||
|
try!(hyper::Server::http(addr))
|
||||||
|
.handle(move |_| router::Router::new(
|
||||||
|
apps::main_page(),
|
||||||
|
endpoints.clone(),
|
||||||
|
special.clone(),
|
||||||
|
authorization.clone(),
|
||||||
|
hosts.clone(),
|
||||||
|
))
|
||||||
|
.map(|(l, srv)| {
|
||||||
|
|
||||||
|
::std::thread::spawn(move || {
|
||||||
|
srv.run();
|
||||||
|
});
|
||||||
|
|
||||||
|
Server {
|
||||||
|
server: Some(l),
|
||||||
|
panic_handler: panic_handler,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map_err(ServerError::from)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set callback for panics.
|
||||||
|
pub fn set_panic_handler<F>(&self, handler: F) where F : Fn() -> () + Send + 'static {
|
||||||
|
*self.panic_handler.lock().unwrap() = Some(Box::new(handler));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for Server {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.server.take().unwrap().close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Webapp Server startup error
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum ServerError {
|
||||||
|
/// Wrapped `std::io::Error`
|
||||||
|
IoError(std::io::Error),
|
||||||
|
/// Other `hyper` error
|
||||||
|
Other(hyper::error::Error),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<hyper::error::Error> for ServerError {
|
||||||
|
fn from(err: hyper::error::Error) -> Self {
|
||||||
|
match err {
|
||||||
|
hyper::error::Error::Io(e) => ServerError::IoError(e),
|
||||||
|
e => ServerError::Other(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::Server;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_return_allowed_hosts() {
|
||||||
|
// given
|
||||||
|
let bind_address = "127.0.0.1".to_owned();
|
||||||
|
|
||||||
|
// when
|
||||||
|
let all = Server::allowed_hosts(None, bind_address.clone());
|
||||||
|
let address = Server::allowed_hosts(Some(Vec::new()), bind_address.clone());
|
||||||
|
let some = Server::allowed_hosts(Some(vec!["ethcore.io".into()]), bind_address.clone());
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert_eq!(all, None);
|
||||||
|
assert_eq!(address, Some(vec!["localhost".into(), "127.0.0.1".into()]));
|
||||||
|
assert_eq!(some, Some(vec!["ethcore.io".into(), "localhost".into(), "127.0.0.1".into()]));
|
||||||
|
}
|
||||||
|
}
|
||||||
154
dapps/src/page/builtin.rs
Normal file
154
dapps/src/page/builtin.rs
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use page::handler;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use endpoint::{Endpoint, EndpointInfo, EndpointPath, Handler};
|
||||||
|
use parity_dapps::{WebApp, File, Info};
|
||||||
|
|
||||||
|
pub struct PageEndpoint<T : WebApp + 'static> {
|
||||||
|
/// Content of the files
|
||||||
|
pub app: Arc<T>,
|
||||||
|
/// Prefix to strip from the path (when `None` deducted from `app_id`)
|
||||||
|
pub prefix: Option<String>,
|
||||||
|
/// Safe to be loaded in frame by other origin. (use wisely!)
|
||||||
|
safe_to_embed: bool,
|
||||||
|
info: EndpointInfo,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp + 'static> PageEndpoint<T> {
|
||||||
|
/// Creates new `PageEndpoint` for builtin (compile time) Dapp.
|
||||||
|
pub fn new(app: T) -> Self {
|
||||||
|
let info = app.info();
|
||||||
|
PageEndpoint {
|
||||||
|
app: Arc::new(app),
|
||||||
|
prefix: None,
|
||||||
|
safe_to_embed: false,
|
||||||
|
info: EndpointInfo::from(info),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create new `PageEndpoint` and specify prefix that should be removed before looking for a file.
|
||||||
|
/// It's used only for special endpoints (i.e. `/parity-utils/`)
|
||||||
|
/// So `/parity-utils/inject.js` will be resolved to `/inject.js` is prefix is set.
|
||||||
|
pub fn with_prefix(app: T, prefix: String) -> Self {
|
||||||
|
let info = app.info();
|
||||||
|
PageEndpoint {
|
||||||
|
app: Arc::new(app),
|
||||||
|
prefix: Some(prefix),
|
||||||
|
safe_to_embed: false,
|
||||||
|
info: EndpointInfo::from(info),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates new `PageEndpoint` which can be safely used in iframe
|
||||||
|
/// even from different origin. It might be dangerous (clickjacking).
|
||||||
|
/// Use wisely!
|
||||||
|
pub fn new_safe_to_embed(app: T) -> Self {
|
||||||
|
let info = app.info();
|
||||||
|
PageEndpoint {
|
||||||
|
app: Arc::new(app),
|
||||||
|
prefix: None,
|
||||||
|
safe_to_embed: true,
|
||||||
|
info: EndpointInfo::from(info),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp> Endpoint for PageEndpoint<T> {
|
||||||
|
|
||||||
|
fn info(&self) -> Option<&EndpointInfo> {
|
||||||
|
Some(&self.info)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_handler(&self, path: EndpointPath) -> Box<Handler> {
|
||||||
|
Box::new(handler::PageHandler {
|
||||||
|
app: BuiltinDapp::new(self.app.clone()),
|
||||||
|
prefix: self.prefix.clone(),
|
||||||
|
path: path,
|
||||||
|
file: None,
|
||||||
|
safe_to_embed: self.safe_to_embed,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Info> for EndpointInfo {
|
||||||
|
fn from(info: Info) -> Self {
|
||||||
|
EndpointInfo {
|
||||||
|
name: info.name.into(),
|
||||||
|
description: info.description.into(),
|
||||||
|
author: info.author.into(),
|
||||||
|
icon_url: info.icon_url.into(),
|
||||||
|
version: info.version.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BuiltinDapp<T: WebApp + 'static> {
|
||||||
|
app: Arc<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp + 'static> BuiltinDapp<T> {
|
||||||
|
fn new(app: Arc<T>) -> Self {
|
||||||
|
BuiltinDapp {
|
||||||
|
app: app,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp + 'static> handler::Dapp for BuiltinDapp<T> {
|
||||||
|
type DappFile = BuiltinDappFile<T>;
|
||||||
|
|
||||||
|
fn file(&self, path: &str) -> Option<Self::DappFile> {
|
||||||
|
self.app.file(path).map(|_| {
|
||||||
|
BuiltinDappFile {
|
||||||
|
app: self.app.clone(),
|
||||||
|
path: path.into(),
|
||||||
|
write_pos: 0,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct BuiltinDappFile<T: WebApp + 'static> {
|
||||||
|
app: Arc<T>,
|
||||||
|
path: String,
|
||||||
|
write_pos: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp + 'static> BuiltinDappFile<T> {
|
||||||
|
fn file(&self) -> &File {
|
||||||
|
self.app.file(&self.path).expect("Check is done when structure is created.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: WebApp + 'static> handler::DappFile for BuiltinDappFile<T> {
|
||||||
|
fn content_type(&self) -> &str {
|
||||||
|
self.file().content_type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_drained(&self) -> bool {
|
||||||
|
self.write_pos == self.file().content.len()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn next_chunk(&mut self) -> &[u8] {
|
||||||
|
&self.file().content[self.write_pos..]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bytes_written(&mut self, bytes: usize) {
|
||||||
|
self.write_pos += bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
207
dapps/src/page/handler.rs
Normal file
207
dapps/src/page/handler.rs
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
|
use hyper::header;
|
||||||
|
use hyper::server;
|
||||||
|
use hyper::uri::RequestUri;
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use hyper::status::StatusCode;
|
||||||
|
use hyper::{Decoder, Encoder, Next};
|
||||||
|
use endpoint::EndpointPath;
|
||||||
|
|
||||||
|
/// Represents a file that can be sent to client.
|
||||||
|
/// Implementation should keep track of bytes already sent internally.
|
||||||
|
pub trait DappFile: Send {
|
||||||
|
/// Returns a content-type of this file.
|
||||||
|
fn content_type(&self) -> &str;
|
||||||
|
|
||||||
|
/// Checks if all bytes from that file were written.
|
||||||
|
fn is_drained(&self) -> bool;
|
||||||
|
|
||||||
|
/// Fetch next chunk to write to the client.
|
||||||
|
fn next_chunk(&mut self) -> &[u8];
|
||||||
|
|
||||||
|
/// How many files have been written to the client.
|
||||||
|
fn bytes_written(&mut self, bytes: usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Dapp as a (dynamic) set of files.
|
||||||
|
pub trait Dapp: Send + 'static {
|
||||||
|
/// File type
|
||||||
|
type DappFile: DappFile;
|
||||||
|
|
||||||
|
/// Returns file under given path.
|
||||||
|
fn file(&self, path: &str) -> Option<Self::DappFile>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A handler for a single webapp.
|
||||||
|
/// Resolves correct paths and serves as a plumbing code between
|
||||||
|
/// hyper server and dapp.
|
||||||
|
pub struct PageHandler<T: Dapp> {
|
||||||
|
/// A Dapp.
|
||||||
|
pub app: T,
|
||||||
|
/// File currently being served (or `None` if file does not exist).
|
||||||
|
pub file: Option<T::DappFile>,
|
||||||
|
/// Optional prefix to strip from path.
|
||||||
|
pub prefix: Option<String>,
|
||||||
|
/// Requested path.
|
||||||
|
pub path: EndpointPath,
|
||||||
|
/// Flag indicating if the file can be safely embeded (put in iframe).
|
||||||
|
pub safe_to_embed: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Dapp> PageHandler<T> {
|
||||||
|
fn extract_path(&self, path: &str) -> String {
|
||||||
|
let app_id = &self.path.app_id;
|
||||||
|
let prefix = "/".to_owned() + self.prefix.as_ref().unwrap_or(app_id);
|
||||||
|
let prefix_with_slash = prefix.clone() + "/";
|
||||||
|
let query_pos = path.find('?').unwrap_or_else(|| path.len());
|
||||||
|
|
||||||
|
// Index file support
|
||||||
|
match path == "/" || path == &prefix || path == &prefix_with_slash {
|
||||||
|
true => "index.html".to_owned(),
|
||||||
|
false => if path.starts_with(&prefix_with_slash) {
|
||||||
|
path[prefix_with_slash.len()..query_pos].to_owned()
|
||||||
|
} else if path.starts_with("/") {
|
||||||
|
path[1..query_pos].to_owned()
|
||||||
|
} else {
|
||||||
|
path[0..query_pos].to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Dapp> server::Handler<HttpStream> for PageHandler<T> {
|
||||||
|
fn on_request(&mut self, req: server::Request<HttpStream>) -> Next {
|
||||||
|
self.file = match *req.uri() {
|
||||||
|
RequestUri::AbsolutePath(ref path) => {
|
||||||
|
self.app.file(&self.extract_path(path))
|
||||||
|
},
|
||||||
|
RequestUri::AbsoluteUri(ref url) => {
|
||||||
|
self.app.file(&self.extract_path(url.path()))
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_request_readable(&mut self, _decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response(&mut self, res: &mut server::Response) -> Next {
|
||||||
|
if let Some(ref f) = self.file {
|
||||||
|
res.set_status(StatusCode::Ok);
|
||||||
|
res.headers_mut().set(header::ContentType(f.content_type().parse().unwrap()));
|
||||||
|
if !self.safe_to_embed {
|
||||||
|
res.headers_mut().set_raw("X-Frame-Options", vec![b"SAMEORIGIN".to_vec()]);
|
||||||
|
}
|
||||||
|
Next::write()
|
||||||
|
} else {
|
||||||
|
res.set_status(StatusCode::NotFound);
|
||||||
|
Next::write()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_response_writable(&mut self, encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
match self.file {
|
||||||
|
None => Next::end(),
|
||||||
|
Some(ref f) if f.is_drained() => Next::end(),
|
||||||
|
Some(ref mut f) => match encoder.write(f.next_chunk()) {
|
||||||
|
Ok(bytes) => {
|
||||||
|
f.bytes_written(bytes);
|
||||||
|
Next::write()
|
||||||
|
},
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
::std::io::ErrorKind::WouldBlock => Next::write(),
|
||||||
|
_ => Next::end(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub struct TestWebAppFile;
|
||||||
|
|
||||||
|
impl DappFile for TestWebAppFile {
|
||||||
|
fn content_type(&self) -> &str {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_drained(&self) -> bool {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn next_chunk(&mut self) -> &[u8] {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bytes_written(&mut self, _bytes: usize) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct TestWebapp;
|
||||||
|
|
||||||
|
impl Dapp for TestWebapp {
|
||||||
|
type DappFile = TestWebAppFile;
|
||||||
|
|
||||||
|
fn file(&self, _path: &str) -> Option<Self::DappFile> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_extract_path_with_appid() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
let path1 = "/";
|
||||||
|
let path2= "/test.css";
|
||||||
|
let path3 = "/app/myfile.txt";
|
||||||
|
let path4 = "/app/myfile.txt?query=123";
|
||||||
|
let page_handler = PageHandler {
|
||||||
|
app: test::TestWebapp,
|
||||||
|
prefix: None,
|
||||||
|
path: EndpointPath {
|
||||||
|
app_id: "app".to_owned(),
|
||||||
|
host: "".to_owned(),
|
||||||
|
port: 8080
|
||||||
|
},
|
||||||
|
file: None,
|
||||||
|
safe_to_embed: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
let res1 = page_handler.extract_path(path1);
|
||||||
|
let res2 = page_handler.extract_path(path2);
|
||||||
|
let res3 = page_handler.extract_path(path3);
|
||||||
|
let res4 = page_handler.extract_path(path4);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert_eq!(&res1, "index.html");
|
||||||
|
assert_eq!(&res2, "test.css");
|
||||||
|
assert_eq!(&res3, "myfile.txt");
|
||||||
|
assert_eq!(&res4, "myfile.txt");
|
||||||
|
}
|
||||||
118
dapps/src/page/local.rs
Normal file
118
dapps/src/page/local.rs
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use mime_guess;
|
||||||
|
use std::io::{Seek, Read, SeekFrom};
|
||||||
|
use std::fs;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use page::handler;
|
||||||
|
use endpoint::{Endpoint, EndpointInfo, EndpointPath, Handler};
|
||||||
|
|
||||||
|
pub struct LocalPageEndpoint {
|
||||||
|
path: PathBuf,
|
||||||
|
info: EndpointInfo,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LocalPageEndpoint {
|
||||||
|
pub fn new(path: PathBuf, info: EndpointInfo) -> Self {
|
||||||
|
LocalPageEndpoint {
|
||||||
|
path: path,
|
||||||
|
info: info,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Endpoint for LocalPageEndpoint {
|
||||||
|
fn info(&self) -> Option<&EndpointInfo> {
|
||||||
|
Some(&self.info)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_handler(&self, path: EndpointPath) -> Box<Handler> {
|
||||||
|
Box::new(handler::PageHandler {
|
||||||
|
app: LocalDapp::new(self.path.clone()),
|
||||||
|
prefix: None,
|
||||||
|
path: path,
|
||||||
|
file: None,
|
||||||
|
safe_to_embed: false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LocalDapp {
|
||||||
|
path: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LocalDapp {
|
||||||
|
fn new(path: PathBuf) -> Self {
|
||||||
|
LocalDapp {
|
||||||
|
path: path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl handler::Dapp for LocalDapp {
|
||||||
|
type DappFile = LocalFile;
|
||||||
|
|
||||||
|
fn file(&self, file_path: &str) -> Option<Self::DappFile> {
|
||||||
|
let mut path = self.path.clone();
|
||||||
|
for part in file_path.split('/') {
|
||||||
|
path.push(part);
|
||||||
|
}
|
||||||
|
// Check if file exists
|
||||||
|
fs::File::open(path.clone()).ok().map(|file| {
|
||||||
|
let content_type = mime_guess::guess_mime_type(path);
|
||||||
|
let len = file.metadata().ok().map_or(0, |meta| meta.len());
|
||||||
|
LocalFile {
|
||||||
|
content_type: content_type.to_string(),
|
||||||
|
buffer: [0; 4096],
|
||||||
|
file: file,
|
||||||
|
pos: 0,
|
||||||
|
len: len,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LocalFile {
|
||||||
|
content_type: String,
|
||||||
|
buffer: [u8; 4096],
|
||||||
|
file: fs::File,
|
||||||
|
len: u64,
|
||||||
|
pos: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl handler::DappFile for LocalFile {
|
||||||
|
fn content_type(&self) -> &str {
|
||||||
|
&self.content_type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_drained(&self) -> bool {
|
||||||
|
self.pos == self.len
|
||||||
|
}
|
||||||
|
|
||||||
|
fn next_chunk(&mut self) -> &[u8] {
|
||||||
|
let _ = self.file.seek(SeekFrom::Start(self.pos));
|
||||||
|
if let Ok(n) = self.file.read(&mut self.buffer) {
|
||||||
|
&self.buffer[0..n]
|
||||||
|
} else {
|
||||||
|
&self.buffer[0..0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bytes_written(&mut self, bytes: usize) {
|
||||||
|
self.pos += bytes as u64;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
dapps/src/page/mod.rs
Normal file
24
dapps/src/page/mod.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
mod builtin;
|
||||||
|
mod local;
|
||||||
|
mod handler;
|
||||||
|
|
||||||
|
pub use self::local::LocalPageEndpoint;
|
||||||
|
pub use self::builtin::PageEndpoint;
|
||||||
|
|
||||||
49
dapps/src/proxypac.rs
Normal file
49
dapps/src/proxypac.rs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Serving ProxyPac file
|
||||||
|
|
||||||
|
use endpoint::{Endpoint, Handler, EndpointPath};
|
||||||
|
use handlers::ContentHandler;
|
||||||
|
use apps::DAPPS_DOMAIN;
|
||||||
|
|
||||||
|
pub struct ProxyPac;
|
||||||
|
|
||||||
|
impl ProxyPac {
|
||||||
|
pub fn boxed() -> Box<Endpoint> {
|
||||||
|
Box::new(ProxyPac)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Endpoint for ProxyPac {
|
||||||
|
fn to_handler(&self, path: EndpointPath) -> Box<Handler> {
|
||||||
|
let content = format!(
|
||||||
|
r#"
|
||||||
|
function FindProxyForURL(url, host) {{
|
||||||
|
if (shExpMatch(host, "*{0}"))
|
||||||
|
{{
|
||||||
|
return "PROXY {1}:{2}";
|
||||||
|
}}
|
||||||
|
|
||||||
|
return "DIRECT";
|
||||||
|
}}
|
||||||
|
"#,
|
||||||
|
DAPPS_DOMAIN, path.host, path.port);
|
||||||
|
Box::new(ContentHandler::ok(content, "application/javascript".to_owned()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
104
dapps/src/router/auth.rs
Normal file
104
dapps/src/router/auth.rs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! HTTP Authorization implementations
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use hyper::{server, net, header, status};
|
||||||
|
use endpoint::Handler;
|
||||||
|
use handlers::{AuthRequiredHandler, ContentHandler};
|
||||||
|
|
||||||
|
/// Authorization result
|
||||||
|
pub enum Authorized {
|
||||||
|
/// Authorization was successful.
|
||||||
|
Yes,
|
||||||
|
/// Unsuccessful authorization. Handler for further work is returned.
|
||||||
|
No(Box<Handler>),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Authorization interface
|
||||||
|
pub trait Authorization : Send + Sync {
|
||||||
|
/// Checks if authorization is valid.
|
||||||
|
fn is_authorized(&self, req: &server::Request<net::HttpStream>)-> Authorized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// HTTP Basic Authorization handler
|
||||||
|
pub struct HttpBasicAuth {
|
||||||
|
users: HashMap<String, String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// No-authorization implementation (authorization disabled)
|
||||||
|
pub struct NoAuth;
|
||||||
|
|
||||||
|
impl Authorization for NoAuth {
|
||||||
|
fn is_authorized(&self, _req: &server::Request<net::HttpStream>)-> Authorized {
|
||||||
|
Authorized::Yes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Authorization for HttpBasicAuth {
|
||||||
|
fn is_authorized(&self, req: &server::Request<net::HttpStream>) -> Authorized {
|
||||||
|
let auth = self.check_auth(&req);
|
||||||
|
|
||||||
|
match auth {
|
||||||
|
Access::Denied => {
|
||||||
|
Authorized::No(Box::new(ContentHandler::new(
|
||||||
|
status::StatusCode::Unauthorized,
|
||||||
|
"<h1>Unauthorized</h1>".into(),
|
||||||
|
"text/html".into(),
|
||||||
|
)))
|
||||||
|
},
|
||||||
|
Access::AuthRequired => {
|
||||||
|
Authorized::No(Box::new(AuthRequiredHandler))
|
||||||
|
},
|
||||||
|
Access::Granted => {
|
||||||
|
Authorized::Yes
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
enum Access {
|
||||||
|
Granted,
|
||||||
|
Denied,
|
||||||
|
AuthRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HttpBasicAuth {
|
||||||
|
/// Creates `HttpBasicAuth` instance with only one user.
|
||||||
|
pub fn single_user(username: &str, password: &str) -> Self {
|
||||||
|
let mut users = HashMap::new();
|
||||||
|
users.insert(username.to_owned(), password.to_owned());
|
||||||
|
HttpBasicAuth {
|
||||||
|
users: users
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_authorized(&self, username: &str, password: &str) -> bool {
|
||||||
|
self.users.get(&username.to_owned()).map_or(false, |pass| pass == password)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_auth(&self, req: &server::Request<net::HttpStream>) -> Access {
|
||||||
|
match req.headers().get::<header::Authorization<header::Basic>>() {
|
||||||
|
Some(&header::Authorization(
|
||||||
|
header::Basic { ref username, password: Some(ref password) }
|
||||||
|
)) if self.is_authorized(username, password) => Access::Granted,
|
||||||
|
Some(_) => Access::Denied,
|
||||||
|
None => Access::AuthRequired,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
dapps/src/router/host_validation.rs
Normal file
42
dapps/src/router/host_validation.rs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
use DAPPS_DOMAIN;
|
||||||
|
use hyper::server;
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
|
||||||
|
use jsonrpc_http_server::{is_host_header_valid};
|
||||||
|
use handlers::ContentHandler;
|
||||||
|
|
||||||
|
pub fn is_valid(request: &server::Request<HttpStream>, allowed_hosts: &[String], endpoints: Vec<String>) -> bool {
|
||||||
|
let mut endpoints = endpoints.iter()
|
||||||
|
.map(|endpoint| format!("{}{}", endpoint, DAPPS_DOMAIN))
|
||||||
|
.collect::<Vec<String>>();
|
||||||
|
endpoints.extend_from_slice(allowed_hosts);
|
||||||
|
|
||||||
|
is_host_header_valid(request, &endpoints)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn host_invalid_response() -> Box<server::Handler<HttpStream> + Send> {
|
||||||
|
Box::new(ContentHandler::forbidden(
|
||||||
|
r#"
|
||||||
|
<h1>Request with disallowed <code>Host</code> header has been blocked.</h1>
|
||||||
|
<p>Check the URL in your browser address bar.</p>
|
||||||
|
"#.into(),
|
||||||
|
"text/html".into()
|
||||||
|
))
|
||||||
|
}
|
||||||
236
dapps/src/router/mod.rs
Normal file
236
dapps/src/router/mod.rs
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Router implementation
|
||||||
|
//! Processes request handling authorization and dispatching it to proper application.
|
||||||
|
|
||||||
|
pub mod auth;
|
||||||
|
mod host_validation;
|
||||||
|
|
||||||
|
use DAPPS_DOMAIN;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use url::{Url, Host};
|
||||||
|
use hyper::{self, server, Next, Encoder, Decoder};
|
||||||
|
use hyper::net::HttpStream;
|
||||||
|
use apps;
|
||||||
|
use endpoint::{Endpoint, Endpoints, EndpointPath};
|
||||||
|
use handlers::{Redirection, extract_url};
|
||||||
|
use self::auth::{Authorization, Authorized};
|
||||||
|
|
||||||
|
/// Special endpoints are accessible on every domain (every dapp)
|
||||||
|
#[derive(Debug, PartialEq, Hash, Eq)]
|
||||||
|
pub enum SpecialEndpoint {
|
||||||
|
Rpc,
|
||||||
|
Api,
|
||||||
|
Utils,
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Router<A: Authorization + 'static> {
|
||||||
|
main_page: &'static str,
|
||||||
|
endpoints: Arc<Endpoints>,
|
||||||
|
special: Arc<HashMap<SpecialEndpoint, Box<Endpoint>>>,
|
||||||
|
authorization: Arc<A>,
|
||||||
|
allowed_hosts: Option<Vec<String>>,
|
||||||
|
handler: Box<server::Handler<HttpStream> + Send>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<A: Authorization + 'static> server::Handler<HttpStream> for Router<A> {
|
||||||
|
|
||||||
|
fn on_request(&mut self, req: server::Request<HttpStream>) -> Next {
|
||||||
|
// Validate Host header
|
||||||
|
if let Some(ref hosts) = self.allowed_hosts {
|
||||||
|
if !host_validation::is_valid(&req, hosts, self.endpoints.keys().cloned().collect()) {
|
||||||
|
self.handler = host_validation::host_invalid_response();
|
||||||
|
return self.handler.on_request(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check authorization
|
||||||
|
let auth = self.authorization.is_authorized(&req);
|
||||||
|
if let Authorized::No(handler) = auth {
|
||||||
|
self.handler = handler;
|
||||||
|
return self.handler.on_request(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Choose proper handler depending on path / domain
|
||||||
|
let url = extract_url(&req);
|
||||||
|
let endpoint = extract_endpoint(&url);
|
||||||
|
|
||||||
|
self.handler = match endpoint {
|
||||||
|
// First check special endpoints
|
||||||
|
(ref path, ref endpoint) if self.special.contains_key(endpoint) => {
|
||||||
|
self.special.get(endpoint).unwrap().to_handler(path.clone().unwrap_or_default())
|
||||||
|
},
|
||||||
|
// Then delegate to dapp
|
||||||
|
(Some(ref path), _) if self.endpoints.contains_key(&path.app_id) => {
|
||||||
|
self.endpoints.get(&path.app_id).unwrap().to_handler(path.clone())
|
||||||
|
},
|
||||||
|
// Redirection to main page
|
||||||
|
_ if *req.method() == hyper::method::Method::Get => {
|
||||||
|
Redirection::new(self.main_page)
|
||||||
|
},
|
||||||
|
// RPC by default
|
||||||
|
_ => {
|
||||||
|
self.special.get(&SpecialEndpoint::Rpc).unwrap().to_handler(EndpointPath::default())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Delegate on_request to proper handler
|
||||||
|
self.handler.on_request(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This event occurs each time the `Request` is ready to be read from.
|
||||||
|
fn on_request_readable(&mut self, decoder: &mut Decoder<HttpStream>) -> Next {
|
||||||
|
self.handler.on_request_readable(decoder)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This event occurs after the first time this handled signals `Next::write()`.
|
||||||
|
fn on_response(&mut self, response: &mut server::Response) -> Next {
|
||||||
|
self.handler.on_response(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This event occurs each time the `Response` is ready to be written to.
|
||||||
|
fn on_response_writable(&mut self, encoder: &mut Encoder<HttpStream>) -> Next {
|
||||||
|
self.handler.on_response_writable(encoder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<A: Authorization> Router<A> {
|
||||||
|
pub fn new(
|
||||||
|
main_page: &'static str,
|
||||||
|
endpoints: Arc<Endpoints>,
|
||||||
|
special: Arc<HashMap<SpecialEndpoint, Box<Endpoint>>>,
|
||||||
|
authorization: Arc<A>,
|
||||||
|
allowed_hosts: Option<Vec<String>>,
|
||||||
|
) -> Self {
|
||||||
|
|
||||||
|
let handler = special.get(&SpecialEndpoint::Rpc).unwrap().to_handler(EndpointPath::default());
|
||||||
|
Router {
|
||||||
|
main_page: main_page,
|
||||||
|
endpoints: endpoints,
|
||||||
|
special: special,
|
||||||
|
authorization: authorization,
|
||||||
|
allowed_hosts: allowed_hosts,
|
||||||
|
handler: handler,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extract_endpoint(url: &Option<Url>) -> (Option<EndpointPath>, SpecialEndpoint) {
|
||||||
|
fn special_endpoint(url: &Url) -> SpecialEndpoint {
|
||||||
|
if url.path.len() <= 1 {
|
||||||
|
return SpecialEndpoint::None;
|
||||||
|
}
|
||||||
|
|
||||||
|
match url.path[0].as_ref() {
|
||||||
|
apps::RPC_PATH => SpecialEndpoint::Rpc,
|
||||||
|
apps::API_PATH => SpecialEndpoint::Api,
|
||||||
|
apps::UTILS_PATH => SpecialEndpoint::Utils,
|
||||||
|
_ => SpecialEndpoint::None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match *url {
|
||||||
|
Some(ref url) => match url.host {
|
||||||
|
Host::Domain(ref domain) if domain.ends_with(DAPPS_DOMAIN) => {
|
||||||
|
let len = domain.len() - DAPPS_DOMAIN.len();
|
||||||
|
let id = domain[0..len].to_owned();
|
||||||
|
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: id,
|
||||||
|
host: domain.clone(),
|
||||||
|
port: url.port,
|
||||||
|
}), special_endpoint(url))
|
||||||
|
},
|
||||||
|
_ if url.path.len() > 1 => {
|
||||||
|
let id = url.path[0].clone();
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: id.clone(),
|
||||||
|
host: format!("{}", url.host),
|
||||||
|
port: url.port,
|
||||||
|
}), special_endpoint(url))
|
||||||
|
},
|
||||||
|
_ => (None, special_endpoint(url)),
|
||||||
|
},
|
||||||
|
_ => (None, SpecialEndpoint::None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_extract_endpoint() {
|
||||||
|
assert_eq!(extract_endpoint(&None), (None, SpecialEndpoint::None));
|
||||||
|
|
||||||
|
// With path prefix
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://localhost:8080/status/index.html").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "status".to_owned(),
|
||||||
|
host: "localhost".to_owned(),
|
||||||
|
port: 8080,
|
||||||
|
}), SpecialEndpoint::None)
|
||||||
|
);
|
||||||
|
|
||||||
|
// With path prefix
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://localhost:8080/rpc/").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "rpc".to_owned(),
|
||||||
|
host: "localhost".to_owned(),
|
||||||
|
port: 8080,
|
||||||
|
}), SpecialEndpoint::Rpc)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://my.status.parity/parity-utils/inject.js").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "my.status".to_owned(),
|
||||||
|
host: "my.status.parity".to_owned(),
|
||||||
|
port: 80,
|
||||||
|
}), SpecialEndpoint::Utils)
|
||||||
|
);
|
||||||
|
|
||||||
|
// By Subdomain
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://my.status.parity/test.html").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "my.status".to_owned(),
|
||||||
|
host: "my.status.parity".to_owned(),
|
||||||
|
port: 80,
|
||||||
|
}), SpecialEndpoint::None)
|
||||||
|
);
|
||||||
|
|
||||||
|
// RPC by subdomain
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://my.status.parity/rpc/").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "my.status".to_owned(),
|
||||||
|
host: "my.status.parity".to_owned(),
|
||||||
|
port: 80,
|
||||||
|
}), SpecialEndpoint::Rpc)
|
||||||
|
);
|
||||||
|
|
||||||
|
// API by subdomain
|
||||||
|
assert_eq!(
|
||||||
|
extract_endpoint(&Url::parse("http://my.status.parity/api/").ok()),
|
||||||
|
(Some(EndpointPath {
|
||||||
|
app_id: "my.status".to_owned(),
|
||||||
|
host: "my.status.parity".to_owned(),
|
||||||
|
port: 80,
|
||||||
|
}), SpecialEndpoint::Api)
|
||||||
|
);
|
||||||
|
}
|
||||||
44
dapps/src/rpc.rs
Normal file
44
dapps/src/rpc.rs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
use jsonrpc_core::IoHandler;
|
||||||
|
use jsonrpc_http_server::{ServerHandler, PanicHandler, AccessControlAllowOrigin};
|
||||||
|
use endpoint::{Endpoint, EndpointPath, Handler};
|
||||||
|
|
||||||
|
pub fn rpc(handler: Arc<IoHandler>, panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>) -> Box<Endpoint> {
|
||||||
|
Box::new(RpcEndpoint {
|
||||||
|
handler: handler,
|
||||||
|
panic_handler: panic_handler,
|
||||||
|
cors_domain: Some(vec![AccessControlAllowOrigin::Null]),
|
||||||
|
// NOTE [ToDr] We don't need to do any hosts validation here. It's already done in router.
|
||||||
|
allowed_hosts: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
struct RpcEndpoint {
|
||||||
|
handler: Arc<IoHandler>,
|
||||||
|
panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>,
|
||||||
|
cors_domain: Option<Vec<AccessControlAllowOrigin>>,
|
||||||
|
allowed_hosts: Option<Vec<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Endpoint for RpcEndpoint {
|
||||||
|
fn to_handler(&self, _path: EndpointPath) -> Box<Handler> {
|
||||||
|
let panic_handler = PanicHandler { handler: self.panic_handler.clone() };
|
||||||
|
Box::new(ServerHandler::new(self.handler.clone(), self.cors_domain.clone(), self.allowed_hosts.clone(), panic_handler))
|
||||||
|
}
|
||||||
|
}
|
||||||
145
dapps/src/url.rs
Normal file
145
dapps/src/url.rs
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! HTTP/HTTPS URL type. Based on URL type from Iron library.
|
||||||
|
|
||||||
|
use url_lib::{self};
|
||||||
|
pub use url_lib::Host;
|
||||||
|
|
||||||
|
/// HTTP/HTTPS URL type for Iron.
|
||||||
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
|
pub struct Url {
|
||||||
|
/// Raw url of url
|
||||||
|
pub raw: url_lib::Url,
|
||||||
|
|
||||||
|
/// The host field of the URL, probably a domain.
|
||||||
|
pub host: Host,
|
||||||
|
|
||||||
|
/// The connection port.
|
||||||
|
pub port: u16,
|
||||||
|
|
||||||
|
/// The URL path, the resource to be accessed.
|
||||||
|
///
|
||||||
|
/// A *non-empty* vector encoding the parts of the URL path.
|
||||||
|
/// Empty entries of `""` correspond to trailing slashes.
|
||||||
|
pub path: Vec<String>,
|
||||||
|
|
||||||
|
/// The URL username field, from the userinfo section of the URL.
|
||||||
|
///
|
||||||
|
/// `None` if the `@` character was not part of the input OR
|
||||||
|
/// if a blank username was provided.
|
||||||
|
/// Otherwise, a non-empty string.
|
||||||
|
pub username: Option<String>,
|
||||||
|
|
||||||
|
/// The URL password field, from the userinfo section of the URL.
|
||||||
|
///
|
||||||
|
/// `None` if the `@` character was not part of the input OR
|
||||||
|
/// if a blank password was provided.
|
||||||
|
/// Otherwise, a non-empty string.
|
||||||
|
pub password: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Url {
|
||||||
|
/// Create a URL from a string.
|
||||||
|
///
|
||||||
|
/// The input must be a valid URL with a special scheme for this to succeed.
|
||||||
|
///
|
||||||
|
/// HTTP and HTTPS are special schemes.
|
||||||
|
///
|
||||||
|
/// See: http://url.spec.whatwg.org/#special-scheme
|
||||||
|
pub fn parse(input: &str) -> Result<Url, String> {
|
||||||
|
// Parse the string using rust-url, then convert.
|
||||||
|
match url_lib::Url::parse(input) {
|
||||||
|
Ok(raw_url) => Url::from_generic_url(raw_url),
|
||||||
|
Err(e) => Err(format!("{}", e))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a `Url` from a `rust-url` `Url`.
|
||||||
|
pub fn from_generic_url(raw_url: url_lib::Url) -> Result<Url, String> {
|
||||||
|
// Map empty usernames to None.
|
||||||
|
let username = match raw_url.username() {
|
||||||
|
"" => None,
|
||||||
|
username => Some(username.to_owned())
|
||||||
|
};
|
||||||
|
|
||||||
|
// Map empty passwords to None.
|
||||||
|
let password = match raw_url.password() {
|
||||||
|
Some(password) if !password.is_empty() => Some(password.to_owned()),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let port = try!(raw_url.port_or_known_default().ok_or_else(|| format!("Unknown port for scheme: `{}`", raw_url.scheme())));
|
||||||
|
let host = try!(raw_url.host().ok_or_else(|| "Valid host, because only data:, mailto: protocols does not have host.".to_owned())).to_owned();
|
||||||
|
let path = try!(raw_url.path_segments().ok_or_else(|| "Valid path segments. In HTTP we won't get cannot-be-a-base URLs".to_owned()))
|
||||||
|
.map(|part| part.to_owned()).collect();
|
||||||
|
|
||||||
|
Ok(Url {
|
||||||
|
port: port,
|
||||||
|
host: host,
|
||||||
|
path: path,
|
||||||
|
raw: raw_url,
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::Url;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_default_port() {
|
||||||
|
assert_eq!(Url::parse("http://example.com/wow").unwrap().port, 80u16);
|
||||||
|
assert_eq!(Url::parse("https://example.com/wow").unwrap().port, 443u16);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_explicit_port() {
|
||||||
|
assert_eq!(Url::parse("http://localhost:3097").unwrap().port, 3097u16);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty_username() {
|
||||||
|
assert!(Url::parse("http://@example.com").unwrap().username.is_none());
|
||||||
|
assert!(Url::parse("http://:password@example.com").unwrap().username.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_not_empty_username() {
|
||||||
|
let user = Url::parse("http://john:pass@example.com").unwrap().username;
|
||||||
|
assert_eq!(user.unwrap(), "john");
|
||||||
|
|
||||||
|
let user = Url::parse("http://john:@example.com").unwrap().username;
|
||||||
|
assert_eq!(user.unwrap(), "john");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_empty_password() {
|
||||||
|
assert!(Url::parse("http://michael@example.com").unwrap().password.is_none());
|
||||||
|
assert!(Url::parse("http://:@example.com").unwrap().password.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_not_empty_password() {
|
||||||
|
let pass = Url::parse("http://michael:pass@example.com").unwrap().password;
|
||||||
|
assert_eq!(pass.unwrap(), "pass");
|
||||||
|
|
||||||
|
let pass = Url::parse("http://:pass@example.com").unwrap().password;
|
||||||
|
assert_eq!(pass.unwrap(), "pass");
|
||||||
|
}
|
||||||
|
}
|
||||||
26
db/Cargo.toml
Normal file
26
db/Cargo.toml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[package]
|
||||||
|
description = "Ethcore Database"
|
||||||
|
homepage = "http://ethcore.io"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
name = "ethcore-db"
|
||||||
|
version = "1.3.0"
|
||||||
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
syntex = "*"
|
||||||
|
ethcore-ipc-codegen = { path = "../ipc/codegen" }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clippy = { version = "0.0.80", optional = true}
|
||||||
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
ethcore-ipc = { path = "../ipc/rpc" }
|
||||||
|
rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" }
|
||||||
|
semver = "0.2"
|
||||||
|
ethcore-ipc-nano = { path = "../ipc/nano" }
|
||||||
|
nanomsg = { git = "https://github.com/ethcore/nanomsg.rs.git" }
|
||||||
|
crossbeam = "0.2"
|
||||||
|
ethcore-util = { path = "../util" }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
dev = ["clippy"]
|
||||||
43
db/build.rs
Normal file
43
db/build.rs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
extern crate syntex;
|
||||||
|
extern crate ethcore_ipc_codegen as codegen;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
|
|
||||||
|
// ipc pass
|
||||||
|
{
|
||||||
|
let src = Path::new("src/lib.rs.in");
|
||||||
|
let dst = Path::new(&out_dir).join("lib.intermediate.rs.in");
|
||||||
|
let mut registry = syntex::Registry::new();
|
||||||
|
codegen::register(&mut registry);
|
||||||
|
registry.expand("", &src, &dst).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// binary serialization pass
|
||||||
|
{
|
||||||
|
let src = Path::new(&out_dir).join("lib.intermediate.rs.in");
|
||||||
|
let dst = Path::new(&out_dir).join("lib.rs");
|
||||||
|
let mut registry = syntex::Registry::new();
|
||||||
|
codegen::register(&mut registry);
|
||||||
|
registry.expand("", &src, &dst).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
566
db/src/database.rs
Normal file
566
db/src/database.rs
Normal file
@@ -0,0 +1,566 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Ethcore rocksdb ipc service
|
||||||
|
|
||||||
|
use traits::*;
|
||||||
|
use rocksdb::{DB, Writable, WriteBatch, IteratorMode, DBIterator, IndexType, Options, DBCompactionStyle, BlockBasedOptions, Direction};
|
||||||
|
use std::sync::{RwLock, Arc};
|
||||||
|
use std::convert::From;
|
||||||
|
use ipc::IpcConfig;
|
||||||
|
use std::mem;
|
||||||
|
use ipc::binary::BinaryConvertError;
|
||||||
|
use std::collections::{VecDeque, HashMap, BTreeMap};
|
||||||
|
|
||||||
|
enum WriteCacheEntry {
|
||||||
|
Remove,
|
||||||
|
Write(Vec<u8>),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct WriteCache {
|
||||||
|
entries: HashMap<Vec<u8>, WriteCacheEntry>,
|
||||||
|
preferred_len: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
const FLUSH_BATCH_SIZE: usize = 4096;
|
||||||
|
|
||||||
|
impl WriteCache {
|
||||||
|
fn new(cache_len: usize) -> WriteCache {
|
||||||
|
WriteCache {
|
||||||
|
entries: HashMap::new(),
|
||||||
|
preferred_len: cache_len,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, key: Vec<u8>, val: Vec<u8>) {
|
||||||
|
self.entries.insert(key, WriteCacheEntry::Write(val));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove(&mut self, key: Vec<u8>) {
|
||||||
|
self.entries.insert(key, WriteCacheEntry::Remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get(&self, key: &[u8]) -> Option<Vec<u8>> {
|
||||||
|
self.entries.get(key).and_then(
|
||||||
|
|vec_ref| match vec_ref {
|
||||||
|
&WriteCacheEntry::Write(ref val) => Some(val.clone()),
|
||||||
|
&WriteCacheEntry::Remove => None
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// WriteCache should be locked for this
|
||||||
|
fn flush(&mut self, db: &DB, amount: usize) -> Result<(), Error> {
|
||||||
|
let batch = WriteBatch::new();
|
||||||
|
let mut removed_so_far = 0;
|
||||||
|
while removed_so_far < amount {
|
||||||
|
if self.entries.len() == 0 { break; }
|
||||||
|
let removed_key = {
|
||||||
|
let (key, cache_entry) = self.entries.iter().nth(0)
|
||||||
|
.expect("if entries.len == 0, we should have break in the loop, still we got here somehow");
|
||||||
|
|
||||||
|
match *cache_entry {
|
||||||
|
WriteCacheEntry::Write(ref val) => {
|
||||||
|
try!(batch.put(&key, val));
|
||||||
|
},
|
||||||
|
WriteCacheEntry::Remove => {
|
||||||
|
try!(batch.delete(&key));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
key.clone()
|
||||||
|
};
|
||||||
|
|
||||||
|
self.entries.remove(&removed_key);
|
||||||
|
|
||||||
|
removed_so_far = removed_so_far + 1;
|
||||||
|
}
|
||||||
|
if removed_so_far > 0 {
|
||||||
|
try!(db.write(batch));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// flushes until cache is empty
|
||||||
|
fn flush_all(&mut self, db: &DB) -> Result<(), Error> {
|
||||||
|
while !self.is_empty() { try!(self.flush(db, FLUSH_BATCH_SIZE)); }
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_empty(&self) -> bool {
|
||||||
|
self.entries.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn try_shrink(&mut self, db: &DB) -> Result<(), Error> {
|
||||||
|
if self.entries.len() > self.preferred_len {
|
||||||
|
try!(self.flush(db, FLUSH_BATCH_SIZE));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Database {
|
||||||
|
db: RwLock<Option<DB>>,
|
||||||
|
/// Iterators - dont't use between threads!
|
||||||
|
iterators: RwLock<BTreeMap<IteratorHandle, DBIterator>>,
|
||||||
|
write_cache: RwLock<WriteCache>,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for Database {}
|
||||||
|
unsafe impl Sync for Database {}
|
||||||
|
|
||||||
|
impl Database {
|
||||||
|
pub fn new() -> Database {
|
||||||
|
Database {
|
||||||
|
db: RwLock::new(None),
|
||||||
|
iterators: RwLock::new(BTreeMap::new()),
|
||||||
|
write_cache: RwLock::new(WriteCache::new(DEFAULT_CACHE_LEN)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn flush(&self) -> Result<(), Error> {
|
||||||
|
let mut cache_lock = self.write_cache.write();
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
if db_lock.is_none() { return Ok(()); }
|
||||||
|
let db = db_lock.as_ref().unwrap();
|
||||||
|
|
||||||
|
try!(cache_lock.try_shrink(&db));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn flush_all(&self) -> Result<(), Error> {
|
||||||
|
let mut cache_lock = self.write_cache.write();
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
if db_lock.is_none() { return Ok(()); }
|
||||||
|
let db = db_lock.as_ref().expect("we should have exited with Ok(()) on the previous step");
|
||||||
|
|
||||||
|
try!(cache_lock.flush_all(&db));
|
||||||
|
Ok(())
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for Database {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.flush().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Ipc)]
|
||||||
|
impl DatabaseService for Database {
|
||||||
|
fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error> {
|
||||||
|
let mut db = self.db.write();
|
||||||
|
if db.is_some() { return Err(Error::AlreadyOpen); }
|
||||||
|
|
||||||
|
let mut opts = Options::new();
|
||||||
|
opts.set_max_open_files(256);
|
||||||
|
opts.create_if_missing(true);
|
||||||
|
opts.set_use_fsync(false);
|
||||||
|
opts.set_compaction_style(DBCompactionStyle::DBUniversalCompaction);
|
||||||
|
if let Some(size) = config.prefix_size {
|
||||||
|
let mut block_opts = BlockBasedOptions::new();
|
||||||
|
block_opts.set_index_type(IndexType::HashSearch);
|
||||||
|
opts.set_block_based_table_factory(&block_opts);
|
||||||
|
opts.set_prefix_extractor_fixed_size(size);
|
||||||
|
}
|
||||||
|
*db = Some(try!(DB::open(&opts, &path)));
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Opens database in the specified path with the default config
|
||||||
|
fn open_default(&self, path: String) -> Result<(), Error> {
|
||||||
|
self.open(DatabaseConfig::default(), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn close(&self) -> Result<(), Error> {
|
||||||
|
try!(self.flush_all());
|
||||||
|
|
||||||
|
let mut db = self.db.write();
|
||||||
|
if db.is_none() { return Err(Error::IsClosed); }
|
||||||
|
|
||||||
|
*db = None;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error> {
|
||||||
|
let mut cache_lock = self.write_cache.write();
|
||||||
|
cache_lock.write(key.to_vec(), value.to_vec());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn delete(&self, key: &[u8]) -> Result<(), Error> {
|
||||||
|
let mut cache_lock = self.write_cache.write();
|
||||||
|
cache_lock.remove(key.to_vec());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, transaction: DBTransaction) -> Result<(), Error> {
|
||||||
|
let mut cache_lock = self.write_cache.write();
|
||||||
|
|
||||||
|
let mut writes = transaction.writes.borrow_mut();
|
||||||
|
for kv in writes.drain(..) {
|
||||||
|
cache_lock.write(kv.key, kv.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut removes = transaction.removes.borrow_mut();
|
||||||
|
for k in removes.drain(..) {
|
||||||
|
cache_lock.remove(k);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error> {
|
||||||
|
{
|
||||||
|
let key_vec = key.to_vec();
|
||||||
|
let cache_hit = self.write_cache.read().get(&key_vec);
|
||||||
|
|
||||||
|
if cache_hit.is_some() {
|
||||||
|
return Ok(Some(cache_hit.expect("cache_hit.is_some() = true, still there is none somehow here")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
let db = try!(db_lock.as_ref().ok_or(Error::IsClosed));
|
||||||
|
|
||||||
|
match try!(db.get(key)) {
|
||||||
|
Some(db_vec) => {
|
||||||
|
Ok(Some(db_vec.to_vec()))
|
||||||
|
},
|
||||||
|
None => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_by_prefix(&self, prefix: &[u8]) -> Result<Option<Vec<u8>>, Error> {
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
let db = try!(db_lock.as_ref().ok_or(Error::IsClosed));
|
||||||
|
|
||||||
|
let mut iter = db.iterator(IteratorMode::From(prefix, Direction::Forward));
|
||||||
|
match iter.next() {
|
||||||
|
// TODO: use prefix_same_as_start read option (not availabele in C API currently)
|
||||||
|
Some((k, v)) => if k[0 .. prefix.len()] == prefix[..] { Ok(Some(v.to_vec())) } else { Ok(None) },
|
||||||
|
_ => Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_empty(&self) -> Result<bool, Error> {
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
let db = try!(db_lock.as_ref().ok_or(Error::IsClosed));
|
||||||
|
|
||||||
|
Ok(db.iterator(IteratorMode::Start).next().is_none())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn iter(&self) -> Result<IteratorHandle, Error> {
|
||||||
|
let db_lock = self.db.read();
|
||||||
|
let db = try!(db_lock.as_ref().ok_or(Error::IsClosed));
|
||||||
|
|
||||||
|
let mut iterators = self.iterators.write();
|
||||||
|
let next_iterator = iterators.keys().last().unwrap_or(&0) + 1;
|
||||||
|
iterators.insert(next_iterator, db.iterator(IteratorMode::Start));
|
||||||
|
Ok(next_iterator)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn iter_next(&self, handle: IteratorHandle) -> Option<KeyValue>
|
||||||
|
{
|
||||||
|
let mut iterators = self.iterators.write();
|
||||||
|
let mut iterator = match iterators.get_mut(&handle) {
|
||||||
|
Some(some_iterator) => some_iterator,
|
||||||
|
None => { return None; },
|
||||||
|
};
|
||||||
|
|
||||||
|
iterator.next().and_then(|(some_key, some_val)| {
|
||||||
|
Some(KeyValue {
|
||||||
|
key: some_key.to_vec(),
|
||||||
|
value: some_val.to_vec(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dispose_iter(&self, handle: IteratorHandle) -> Result<(), Error> {
|
||||||
|
let mut iterators = self.iterators.write();
|
||||||
|
iterators.remove(&handle);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : put proper at compile-time
|
||||||
|
impl IpcConfig for Database {}
|
||||||
|
|
||||||
|
/// Database iterator
|
||||||
|
pub struct DatabaseIterator {
|
||||||
|
client: Arc<DatabaseClient<::nanomsg::Socket>>,
|
||||||
|
handle: IteratorHandle,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Iterator for DatabaseIterator {
|
||||||
|
type Item = (Vec<u8>, Vec<u8>);
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
self.client.iter_next(self.handle).and_then(|kv| Some((kv.key, kv.value)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for DatabaseIterator {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.client.dispose_iter(self.handle).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
use super::Database;
|
||||||
|
use traits::*;
|
||||||
|
use devtools::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_be_created() {
|
||||||
|
let db = Database::new();
|
||||||
|
assert!(db.is_empty().is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_be_open_empty() {
|
||||||
|
let db = Database::new();
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
db.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
|
||||||
|
assert!(db.is_empty().is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_store_key() {
|
||||||
|
let db = Database::new();
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
db.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
|
||||||
|
db.put("xxx".as_bytes(), "1".as_bytes()).unwrap();
|
||||||
|
db.flush_all().unwrap();
|
||||||
|
assert!(!db.is_empty().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_retrieve() {
|
||||||
|
let db = Database::new();
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
db.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
db.put("xxx".as_bytes(), "1".as_bytes()).unwrap();
|
||||||
|
db.close().unwrap();
|
||||||
|
|
||||||
|
db.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
assert_eq!(db.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod write_cache_tests {
|
||||||
|
use super::Database;
|
||||||
|
use traits::*;
|
||||||
|
use devtools::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cache_write_flush() {
|
||||||
|
let db = Database::new();
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
db.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
db.put("100500".as_bytes(), "1".as_bytes()).unwrap();
|
||||||
|
db.delete("100500".as_bytes()).unwrap();
|
||||||
|
db.flush_all().unwrap();
|
||||||
|
|
||||||
|
let val = db.get("100500".as_bytes()).unwrap();
|
||||||
|
assert!(val.is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod client_tests {
|
||||||
|
use super::{DatabaseClient, Database};
|
||||||
|
use traits::*;
|
||||||
|
use devtools::*;
|
||||||
|
use nanoipc;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::sync::atomic::{Ordering, AtomicBool};
|
||||||
|
use crossbeam;
|
||||||
|
use run_worker;
|
||||||
|
|
||||||
|
fn init_worker(addr: &str) -> nanoipc::Worker<Database> {
|
||||||
|
let mut worker = nanoipc::Worker::<Database>::new(&Arc::new(Database::new()));
|
||||||
|
worker.add_duplex(addr).unwrap();
|
||||||
|
worker
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_call_handshake() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-10.ipc";
|
||||||
|
let worker_should_exit = Arc::new(AtomicBool::new(false));
|
||||||
|
let worker_is_ready = Arc::new(AtomicBool::new(false));
|
||||||
|
let c_worker_should_exit = worker_should_exit.clone();
|
||||||
|
let c_worker_is_ready = worker_is_ready.clone();
|
||||||
|
|
||||||
|
::std::thread::spawn(move || {
|
||||||
|
let mut worker = init_worker(url);
|
||||||
|
while !c_worker_should_exit.load(Ordering::Relaxed) {
|
||||||
|
worker.poll();
|
||||||
|
c_worker_is_ready.store(true, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
while !worker_is_ready.load(Ordering::Relaxed) { }
|
||||||
|
let client = nanoipc::init_duplex_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
|
||||||
|
let hs = client.handshake();
|
||||||
|
|
||||||
|
worker_should_exit.store(true, Ordering::Relaxed);
|
||||||
|
assert!(hs.is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_open_db() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-20.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
let worker_should_exit = Arc::new(AtomicBool::new(false));
|
||||||
|
let worker_is_ready = Arc::new(AtomicBool::new(false));
|
||||||
|
let c_worker_should_exit = worker_should_exit.clone();
|
||||||
|
let c_worker_is_ready = worker_is_ready.clone();
|
||||||
|
|
||||||
|
::std::thread::spawn(move || {
|
||||||
|
let mut worker = init_worker(url);
|
||||||
|
while !c_worker_should_exit.load(Ordering::Relaxed) {
|
||||||
|
worker.poll();
|
||||||
|
c_worker_is_ready.store(true, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
while !worker_is_ready.load(Ordering::Relaxed) { }
|
||||||
|
let client = nanoipc::init_duplex_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
assert!(client.is_empty().unwrap());
|
||||||
|
worker_should_exit.store(true, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_put() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-30.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
crossbeam::scope(move |scope| {
|
||||||
|
let stop = Arc::new(AtomicBool::new(false));
|
||||||
|
run_worker(scope, stop.clone(), url);
|
||||||
|
let client = nanoipc::init_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
client.put("xxx".as_bytes(), "1".as_bytes()).unwrap();
|
||||||
|
client.close().unwrap();
|
||||||
|
|
||||||
|
stop.store(true, Ordering::Relaxed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_put_and_read() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-40.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
crossbeam::scope(move |scope| {
|
||||||
|
let stop = Arc::new(AtomicBool::new(false));
|
||||||
|
run_worker(scope, stop.clone(), url);
|
||||||
|
let client = nanoipc::init_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
client.put("xxx".as_bytes(), "1".as_bytes()).unwrap();
|
||||||
|
client.close().unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
assert_eq!(client.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec());
|
||||||
|
|
||||||
|
stop.store(true, Ordering::Relaxed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_read_empty() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-45.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
crossbeam::scope(move |scope| {
|
||||||
|
let stop = Arc::new(AtomicBool::new(false));
|
||||||
|
run_worker(scope, stop.clone(), url);
|
||||||
|
let client = nanoipc::init_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
assert!(client.get("xxx".as_bytes()).unwrap().is_none());
|
||||||
|
|
||||||
|
stop.store(true, Ordering::Relaxed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_commit_client_transaction() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-60.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
crossbeam::scope(move |scope| {
|
||||||
|
let stop = Arc::new(AtomicBool::new(false));
|
||||||
|
run_worker(scope, stop.clone(), url);
|
||||||
|
let client = nanoipc::init_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
|
||||||
|
let transaction = DBTransaction::new();
|
||||||
|
transaction.put("xxx".as_bytes(), "1".as_bytes());
|
||||||
|
client.write(transaction).unwrap();
|
||||||
|
|
||||||
|
client.close().unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
assert_eq!(client.get("xxx".as_bytes()).unwrap().unwrap(), "1".as_bytes().to_vec());
|
||||||
|
|
||||||
|
stop.store(true, Ordering::Relaxed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn key_write_read_ipc() {
|
||||||
|
let url = "ipc:///tmp/parity-db-ipc-test-70.ipc";
|
||||||
|
let path = RandomTempPath::create_dir();
|
||||||
|
|
||||||
|
crossbeam::scope(|scope| {
|
||||||
|
let stop = StopGuard::new();
|
||||||
|
run_worker(&scope, stop.share(), url);
|
||||||
|
|
||||||
|
let client = nanoipc::init_client::<DatabaseClient<_>>(url).unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
let mut batch = Vec::new();
|
||||||
|
for _ in 0..100 {
|
||||||
|
batch.push((random_str(256).as_bytes().to_vec(), random_str(256).as_bytes().to_vec()));
|
||||||
|
batch.push((random_str(256).as_bytes().to_vec(), random_str(2048).as_bytes().to_vec()));
|
||||||
|
batch.push((random_str(2048).as_bytes().to_vec(), random_str(2048).as_bytes().to_vec()));
|
||||||
|
batch.push((random_str(2048).as_bytes().to_vec(), random_str(256).as_bytes().to_vec()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for &(ref k, ref v) in batch.iter() {
|
||||||
|
client.put(k, v).unwrap();
|
||||||
|
}
|
||||||
|
client.close().unwrap();
|
||||||
|
|
||||||
|
client.open_default(path.as_str().to_owned()).unwrap();
|
||||||
|
for &(ref k, ref v) in batch.iter() {
|
||||||
|
assert_eq!(v, &client.get(k).unwrap().unwrap());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
20
db/src/lib.rs
Normal file
20
db/src/lib.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Database ipc service
|
||||||
|
|
||||||
|
#![allow(dead_code, unused_assignments, unused_variables)] // codegen issues
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/lib.rs"));
|
||||||
89
db/src/lib.rs.in
Normal file
89
db/src/lib.rs.in
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
extern crate ethcore_ipc as ipc;
|
||||||
|
extern crate rocksdb;
|
||||||
|
extern crate ethcore_devtools as devtools;
|
||||||
|
extern crate semver;
|
||||||
|
extern crate ethcore_ipc_nano as nanoipc;
|
||||||
|
extern crate nanomsg;
|
||||||
|
extern crate crossbeam;
|
||||||
|
extern crate ethcore_util as util;
|
||||||
|
|
||||||
|
pub mod database;
|
||||||
|
pub mod traits;
|
||||||
|
|
||||||
|
pub use traits::{DatabaseService, DBTransaction, Error};
|
||||||
|
pub use database::{Database, DatabaseClient, DatabaseIterator};
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::sync::atomic::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub type DatabaseNanoClient = DatabaseClient<::nanomsg::Socket>;
|
||||||
|
pub type DatabaseConnection = nanoipc::GuardedSocket<DatabaseNanoClient>;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum ServiceError {
|
||||||
|
Io(std::io::Error),
|
||||||
|
Socket(nanoipc::SocketError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::convert::From<std::io::Error> for ServiceError {
|
||||||
|
fn from(io_error: std::io::Error) -> ServiceError { ServiceError::Io(io_error) }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::convert::From<nanoipc::SocketError> for ServiceError {
|
||||||
|
fn from(socket_error: nanoipc::SocketError) -> ServiceError { ServiceError::Socket(socket_error) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn blocks_service_url(db_path: &str) -> Result<String, std::io::Error> {
|
||||||
|
let mut path = PathBuf::from(db_path);
|
||||||
|
try!(::std::fs::create_dir_all(db_path));
|
||||||
|
path.push("blocks.ipc");
|
||||||
|
Ok(format!("ipc://{}", path.to_str().unwrap()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn extras_service_url(db_path: &str) -> Result<String, ::std::io::Error> {
|
||||||
|
let mut path = PathBuf::from(db_path);
|
||||||
|
try!(::std::fs::create_dir_all(db_path));
|
||||||
|
path.push("extras.ipc");
|
||||||
|
Ok(format!("ipc://{}", path.to_str().unwrap()))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn blocks_client(db_path: &str) -> Result<DatabaseConnection, ServiceError> {
|
||||||
|
let url = try!(blocks_service_url(db_path));
|
||||||
|
let client = try!(nanoipc::init_client::<DatabaseClient<_>>(&url));
|
||||||
|
Ok(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn extras_client(db_path: &str) -> Result<DatabaseConnection, ServiceError> {
|
||||||
|
let url = try!(extras_service_url(db_path));
|
||||||
|
let client = try!(nanoipc::init_client::<DatabaseClient<_>>(&url));
|
||||||
|
Ok(client)
|
||||||
|
}
|
||||||
|
|
||||||
|
// for tests
|
||||||
|
pub fn run_worker(scope: &crossbeam::Scope, stop: Arc<AtomicBool>, socket_path: &str) {
|
||||||
|
let socket_path = socket_path.to_owned();
|
||||||
|
scope.spawn(move || {
|
||||||
|
let mut worker = nanoipc::Worker::new(&Arc::new(Database::new()));
|
||||||
|
worker.add_reqrep(&socket_path).unwrap();
|
||||||
|
while !stop.load(Ordering::Relaxed) {
|
||||||
|
worker.poll();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
138
db/src/traits.rs
Normal file
138
db/src/traits.rs
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Ethcore database trait
|
||||||
|
|
||||||
|
use std::mem;
|
||||||
|
use ipc::binary::BinaryConvertError;
|
||||||
|
use std::collections::VecDeque;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
pub type IteratorHandle = u32;
|
||||||
|
|
||||||
|
pub const DEFAULT_CACHE_LEN: usize = 12288;
|
||||||
|
|
||||||
|
#[derive(Binary)]
|
||||||
|
pub struct KeyValue {
|
||||||
|
pub key: Vec<u8>,
|
||||||
|
pub value: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Binary)]
|
||||||
|
pub enum Error {
|
||||||
|
AlreadyOpen,
|
||||||
|
IsClosed,
|
||||||
|
RocksDb(String),
|
||||||
|
TransactionUnknown,
|
||||||
|
IteratorUnknown,
|
||||||
|
UncommitedTransactions,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<String> for Error {
|
||||||
|
fn from(s: String) -> Error {
|
||||||
|
Error::RocksDb(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Database configuration
|
||||||
|
#[derive(Binary)]
|
||||||
|
pub struct DatabaseConfig {
|
||||||
|
/// Optional prefix size in bytes. Allows lookup by partial key.
|
||||||
|
pub prefix_size: Option<usize>,
|
||||||
|
/// write cache length
|
||||||
|
pub cache: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for DatabaseConfig {
|
||||||
|
fn default() -> DatabaseConfig {
|
||||||
|
DatabaseConfig {
|
||||||
|
prefix_size: None,
|
||||||
|
cache: DEFAULT_CACHE_LEN,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DatabaseConfig {
|
||||||
|
fn with_prefix(prefix: usize) -> DatabaseConfig {
|
||||||
|
DatabaseConfig {
|
||||||
|
prefix_size: Some(prefix),
|
||||||
|
cache: DEFAULT_CACHE_LEN,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait DatabaseService : Sized {
|
||||||
|
/// Opens database in the specified path
|
||||||
|
fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Opens database in the specified path with the default config
|
||||||
|
fn open_default(&self, path: String) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Closes database
|
||||||
|
fn close(&self) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Insert a key-value pair in the transaction. Any existing value value will be overwritten.
|
||||||
|
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Delete value by key.
|
||||||
|
fn delete(&self, key: &[u8]) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Get value by key.
|
||||||
|
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>;
|
||||||
|
|
||||||
|
/// Get value by partial key. Prefix size should match configured prefix size.
|
||||||
|
fn get_by_prefix(&self, prefix: &[u8]) -> Result<Option<Vec<u8>>, Error>;
|
||||||
|
|
||||||
|
/// Check if there is anything in the database.
|
||||||
|
fn is_empty(&self) -> Result<bool, Error>;
|
||||||
|
|
||||||
|
/// Get handle to iterate through keys
|
||||||
|
fn iter(&self) -> Result<IteratorHandle, Error>;
|
||||||
|
|
||||||
|
/// Next key-value for the the given iterator
|
||||||
|
fn iter_next(&self, iterator: IteratorHandle) -> Option<KeyValue>;
|
||||||
|
|
||||||
|
/// Dispose iteration that is no longer needed
|
||||||
|
fn dispose_iter(&self, handle: IteratorHandle) -> Result<(), Error>;
|
||||||
|
|
||||||
|
/// Write client transaction
|
||||||
|
fn write(&self, transaction: DBTransaction) -> Result<(), Error>;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Binary)]
|
||||||
|
pub struct DBTransaction {
|
||||||
|
pub writes: RefCell<Vec<KeyValue>>,
|
||||||
|
pub removes: RefCell<Vec<Vec<u8>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DBTransaction {
|
||||||
|
pub fn new() -> DBTransaction {
|
||||||
|
DBTransaction {
|
||||||
|
writes: RefCell::new(Vec::new()),
|
||||||
|
removes: RefCell::new(Vec::new()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn put(&self, key: &[u8], value: &[u8]) {
|
||||||
|
let mut brw = self.writes.borrow_mut();
|
||||||
|
brw.push(KeyValue { key: key.to_vec(), value: value.to_vec() });
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn delete(&self, key: &[u8]) {
|
||||||
|
let mut brw = self.removes.borrow_mut();
|
||||||
|
brw.push(key.to_vec());
|
||||||
|
}
|
||||||
|
}
|
||||||
16
devtools/Cargo.toml
Normal file
16
devtools/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
description = "Ethcore development/test/build tools"
|
||||||
|
homepage = "http://ethcore.io"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
name = "ethcore-devtools"
|
||||||
|
version = "1.3.0"
|
||||||
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rand = "0.3"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/lib.rs"
|
||||||
|
test = true
|
||||||
28
devtools/src/lib.rs
Normal file
28
devtools/src/lib.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! dev-tools
|
||||||
|
|
||||||
|
|
||||||
|
extern crate rand;
|
||||||
|
|
||||||
|
mod random_path;
|
||||||
|
mod test_socket;
|
||||||
|
mod stop_guard;
|
||||||
|
|
||||||
|
pub use random_path::*;
|
||||||
|
pub use test_socket::*;
|
||||||
|
pub use stop_guard::*;
|
||||||
129
devtools/src/random_path.rs
Normal file
129
devtools/src/random_path.rs
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Random path
|
||||||
|
|
||||||
|
use std::path::*;
|
||||||
|
use std::fs;
|
||||||
|
use std::env;
|
||||||
|
use std::ops::{Deref, DerefMut};
|
||||||
|
use rand::random;
|
||||||
|
|
||||||
|
pub struct RandomTempPath {
|
||||||
|
path: PathBuf
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn random_filename() -> String {
|
||||||
|
random_str(8)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn random_str(len: usize) -> String {
|
||||||
|
(0..len).map(|_| ((random::<f32>() * 26.0) as u8 + 97) as char).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RandomTempPath {
|
||||||
|
pub fn new() -> RandomTempPath {
|
||||||
|
let mut dir = env::temp_dir();
|
||||||
|
dir.push(random_filename());
|
||||||
|
RandomTempPath {
|
||||||
|
path: dir.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn create_dir() -> RandomTempPath {
|
||||||
|
let mut dir = env::temp_dir();
|
||||||
|
dir.push(random_filename());
|
||||||
|
fs::create_dir_all(dir.as_path()).unwrap();
|
||||||
|
RandomTempPath {
|
||||||
|
path: dir.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_path(&self) -> &PathBuf {
|
||||||
|
&self.path
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_str(&self) -> &str {
|
||||||
|
self.path.to_str().unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_in(&self, name: &str) -> String {
|
||||||
|
let mut path = self.path.clone();
|
||||||
|
path.push(name);
|
||||||
|
path.to_str().unwrap().to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for RandomTempPath {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Err(e) = fs::remove_dir_all(self.as_path()) {
|
||||||
|
panic!("Failed to remove temp directory. Here's what prevented this from happening: ({})", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct GuardedTempResult<T> {
|
||||||
|
pub result: Option<T>,
|
||||||
|
pub _temp: RandomTempPath
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> GuardedTempResult<T> {
|
||||||
|
pub fn reference(&self) -> &T {
|
||||||
|
self.result.as_ref().unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reference_mut(&mut self) -> &mut T {
|
||||||
|
self.result.as_mut().unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn take(&mut self) -> T {
|
||||||
|
self.result.take().unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Deref for GuardedTempResult<T> {
|
||||||
|
type Target = T;
|
||||||
|
|
||||||
|
fn deref(&self) -> &T { self.result.as_ref().unwrap() }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> DerefMut for GuardedTempResult<T> {
|
||||||
|
fn deref_mut(&mut self) -> &mut T { self.result.as_mut().unwrap() }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn creates_dir() {
|
||||||
|
let temp = RandomTempPath::create_dir();
|
||||||
|
assert!(fs::metadata(temp.as_path()).unwrap().is_dir());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn destroys_dir() {
|
||||||
|
let path_buf = {
|
||||||
|
let temp = RandomTempPath::create_dir();
|
||||||
|
assert!(fs::metadata(temp.as_path()).unwrap().is_dir());
|
||||||
|
let path_buf = temp.as_path().to_path_buf();
|
||||||
|
path_buf
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(fs::metadata(&path_buf).is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn provides_random() {
|
||||||
|
let temp = RandomTempPath::create_dir();
|
||||||
|
assert!(temp.as_path().to_str().is_some());
|
||||||
|
}
|
||||||
45
devtools/src/stop_guard.rs
Normal file
45
devtools/src/stop_guard.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Stop guard mod
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
use std::sync::atomic::*;
|
||||||
|
|
||||||
|
/// Stop guard that will set a stop flag on drop
|
||||||
|
pub struct StopGuard {
|
||||||
|
flag: Arc<AtomicBool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StopGuard {
|
||||||
|
/// Create a stop guard
|
||||||
|
pub fn new() -> StopGuard {
|
||||||
|
StopGuard {
|
||||||
|
flag: Arc::new(AtomicBool::new(false))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Share stop guard between the threads
|
||||||
|
pub fn share(&self) -> Arc<AtomicBool> {
|
||||||
|
self.flag.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for StopGuard {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.flag.store(true, Ordering::Relaxed)
|
||||||
|
}
|
||||||
|
}
|
||||||
95
devtools/src/test_socket.rs
Normal file
95
devtools/src/test_socket.rs
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use std::io::*;
|
||||||
|
use std::cmp;
|
||||||
|
|
||||||
|
pub struct TestSocket {
|
||||||
|
pub read_buffer: Vec<u8>,
|
||||||
|
pub write_buffer: Vec<u8>,
|
||||||
|
pub cursor: usize,
|
||||||
|
pub buf_size: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for TestSocket {
|
||||||
|
fn default() -> Self {
|
||||||
|
TestSocket::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TestSocket {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
TestSocket {
|
||||||
|
read_buffer: vec![],
|
||||||
|
write_buffer: vec![],
|
||||||
|
cursor: 0,
|
||||||
|
buf_size: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_buf(buf_size: usize) -> TestSocket {
|
||||||
|
TestSocket {
|
||||||
|
read_buffer: vec![],
|
||||||
|
write_buffer: vec![],
|
||||||
|
cursor: 0,
|
||||||
|
buf_size: buf_size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_ready(data: Vec<u8>) -> TestSocket {
|
||||||
|
TestSocket {
|
||||||
|
read_buffer: data,
|
||||||
|
write_buffer: vec![],
|
||||||
|
cursor: 0,
|
||||||
|
buf_size: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Read for TestSocket {
|
||||||
|
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
||||||
|
let end_position = cmp::min(self.read_buffer.len(), self.cursor+buf.len());
|
||||||
|
if self.cursor > end_position { return Ok(0) }
|
||||||
|
let len = cmp::max(end_position - self.cursor, 0);
|
||||||
|
match len {
|
||||||
|
0 => Ok(0),
|
||||||
|
_ => {
|
||||||
|
for i in self.cursor..end_position {
|
||||||
|
buf[i-self.cursor] = self.read_buffer[i];
|
||||||
|
}
|
||||||
|
self.cursor = end_position;
|
||||||
|
Ok(len)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Write for TestSocket {
|
||||||
|
fn write(&mut self, buf: &[u8]) -> Result<usize> {
|
||||||
|
if self.buf_size == 0 || buf.len() < self.buf_size {
|
||||||
|
self.write_buffer.extend(buf.iter().cloned());
|
||||||
|
Ok(buf.len())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.write_buffer.extend(buf.iter().take(self.buf_size).cloned());
|
||||||
|
Ok(self.buf_size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> Result<()> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
}
|
||||||
4
doc.sh
4
doc.sh
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# generate documentation only for partiy and ethcore libraries
|
|
||||||
|
|
||||||
cargo doc --no-deps --verbose -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity
|
|
||||||
29
docker/centos/Dockerfile
Normal file
29
docker/centos/Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
FROM centos:latest
|
||||||
|
WORKDIR /build
|
||||||
|
# install tools and dependencies
|
||||||
|
RUN yum -y update&& \
|
||||||
|
yum install -y git make gcc-c++ gcc file binutils
|
||||||
|
# install rustup
|
||||||
|
RUN curl -sSf https://static.rust-lang.org/rustup.sh -o rustup.sh &&\
|
||||||
|
ls&&\
|
||||||
|
sh rustup.sh -s -- --disable-sudo
|
||||||
|
# show backtraces
|
||||||
|
ENV RUST_BACKTRACE 1
|
||||||
|
# set compiler
|
||||||
|
ENV CXX g++
|
||||||
|
ENV CC gcc
|
||||||
|
# show tools
|
||||||
|
RUN rustc -vV && \
|
||||||
|
cargo -V && \
|
||||||
|
gcc -v &&\
|
||||||
|
g++ -v
|
||||||
|
# build parity
|
||||||
|
RUN git clone https://github.com/ethcore/parity && \
|
||||||
|
cd parity&&\
|
||||||
|
git checkout beta && \
|
||||||
|
git pull && \
|
||||||
|
ls -a&&\
|
||||||
|
cargo build --release --verbose && \
|
||||||
|
ls /build/parity/target/release/parity && \
|
||||||
|
strip /build/parity/target/release/parity
|
||||||
|
RUN file /build/parity/target/release/parity
|
||||||
43
docker/ubuntu-aarch64/Dockerfile
Normal file
43
docker/ubuntu-aarch64/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
FROM ubuntu:14.04
|
||||||
|
WORKDIR /build
|
||||||
|
# install tools and dependencies
|
||||||
|
RUN apt-get -y update && \
|
||||||
|
apt-get install -y --force-yes --no-install-recommends \
|
||||||
|
curl git make g++ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
|
||||||
|
libc6-arm64-cross libc6-dev-arm64-cross wget file ca-certificates \
|
||||||
|
binutils-aarch64-linux-gnu \
|
||||||
|
&& \
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
|
# install rustup
|
||||||
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
|
|
||||||
|
# rustup directory
|
||||||
|
ENV PATH /root/.cargo/bin:$PATH
|
||||||
|
|
||||||
|
ENV RUST_TARGETS="aarch64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
# multirust add arm--linux-gnuabhf toolchain
|
||||||
|
RUN rustup target add aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
|
# show backtraces
|
||||||
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
# show tools
|
||||||
|
RUN rustc -vV && \
|
||||||
|
cargo -V
|
||||||
|
|
||||||
|
# build parity
|
||||||
|
RUN git clone https://github.com/ethcore/parity && \
|
||||||
|
cd parity && \
|
||||||
|
git checkout beta && \
|
||||||
|
git pull && \
|
||||||
|
mkdir -p .cargo && \
|
||||||
|
echo '[target.aarch64-unknown-linux-gnu]\n\
|
||||||
|
linker = "aarch64-linux-gnu-gcc"\n'\
|
||||||
|
>>.cargo/config && \
|
||||||
|
cat .cargo/config && \
|
||||||
|
cargo build --target aarch64-unknown-linux-gnu --release --verbose && \
|
||||||
|
ls /build/parity/target/aarch64-unknown-linux-gnu/release/parity && \
|
||||||
|
/usr/bin/aarch64-linux-gnu-strip /build/parity/target/aarch64-unknown-linux-gnu/release/parity
|
||||||
|
RUN file /build/parity/target/aarch64-unknown-linux-gnu/release/parity
|
||||||
43
docker/ubuntu-arm/Dockerfile
Normal file
43
docker/ubuntu-arm/Dockerfile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
FROM ubuntu:14.04
|
||||||
|
WORKDIR /build
|
||||||
|
# install tools and dependencies
|
||||||
|
RUN apt-get -y update && \
|
||||||
|
apt-get install -y --force-yes --no-install-recommends \
|
||||||
|
curl git make g++ gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
|
||||||
|
libc6-dev-armhf-cross wget file ca-certificates \
|
||||||
|
binutils-arm-linux-gnueabihf \
|
||||||
|
&& \
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
|
# install rustup
|
||||||
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
|
|
||||||
|
# rustup directory
|
||||||
|
ENV PATH /root/.cargo/bin:$PATH
|
||||||
|
|
||||||
|
ENV RUST_TARGETS="arm-unknown-linux-gnueabihf"
|
||||||
|
|
||||||
|
# multirust add arm--linux-gnuabhf toolchain
|
||||||
|
RUN rustup target add armv7-unknown-linux-gnueabihf
|
||||||
|
|
||||||
|
# show backtraces
|
||||||
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
# show tools
|
||||||
|
RUN rustc -vV && \
|
||||||
|
cargo -V
|
||||||
|
|
||||||
|
# build parity
|
||||||
|
RUN git clone https://github.com/ethcore/parity && \
|
||||||
|
cd parity && \
|
||||||
|
git checkout beta && \
|
||||||
|
git pull && \
|
||||||
|
mkdir -p .cargo && \
|
||||||
|
echo '[target.armv7-unknown-linux-gnueabihf]\n\
|
||||||
|
linker = "arm-linux-gnueabihf-gcc"\n'\
|
||||||
|
>>.cargo/config && \
|
||||||
|
cat .cargo/config && \
|
||||||
|
cargo build --target armv7-unknown-linux-gnueabihf --release --verbose && \
|
||||||
|
ls /build/parity/target/armv7-unknown-linux-gnueabihf/release/parity && \
|
||||||
|
/usr/bin/arm-linux-gnueabihf-strip /build/parity/target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
|
RUN file /build/parity/target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
@@ -8,7 +8,8 @@ RUN apt-get update && \
|
|||||||
# add-apt-repository
|
# add-apt-repository
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
g++ \
|
||||||
|
wget \
|
||||||
git \
|
git \
|
||||||
# evmjit dependencies
|
# evmjit dependencies
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
@@ -17,9 +18,8 @@ RUN apt-get update && \
|
|||||||
# cmake, llvm and rocksdb ppas. then update ppas
|
# cmake, llvm and rocksdb ppas. then update ppas
|
||||||
RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
|
RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
|
||||||
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
|
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
|
||||||
add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \
|
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y --force-yes cmake llvm-3.7-dev librocksdb
|
apt-get install -y --force-yes cmake llvm-3.7-dev
|
||||||
|
|
||||||
# install evmjit
|
# install evmjit
|
||||||
RUN git clone https://github.com/debris/evmjit && \
|
RUN git clone https://github.com/debris/evmjit && \
|
||||||
@@ -27,14 +27,11 @@ RUN git clone https://github.com/debris/evmjit && \
|
|||||||
mkdir build && cd build && \
|
mkdir build && cd build && \
|
||||||
cmake .. && make && make install && cd
|
cmake .. && make && make install && cd
|
||||||
|
|
||||||
# install multirust
|
# install rustup
|
||||||
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
|
|
||||||
# install nightly and make it default
|
# rustup directory
|
||||||
RUN multirust update nightly && multirust default nightly
|
ENV PATH /root/.cargo/bin:$PATH
|
||||||
|
|
||||||
# export rust LIBRARY_PATH
|
|
||||||
ENV LIBRARY_PATH /usr/local/lib
|
|
||||||
|
|
||||||
# show backtraces
|
# show backtraces
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
|
|||||||
@@ -1,46 +1,55 @@
|
|||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
|
WORKDIR /build
|
||||||
# install tools and dependencies
|
# install tools and dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
# make
|
# make
|
||||||
build-essential \
|
build-essential \
|
||||||
# add-apt-repository
|
# add-apt-repository
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
git \
|
git \
|
||||||
# evmjit dependencies
|
g++ \
|
||||||
zlib1g-dev \
|
binutils \
|
||||||
libedit-dev
|
file \
|
||||||
|
# evmjit dependencies
|
||||||
|
zlib1g-dev \
|
||||||
|
libedit-dev
|
||||||
|
|
||||||
# cmake, llvm and rocksdb ppas. then update ppas
|
# cmake and llvm ppas. then update ppas
|
||||||
RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
|
RUN add-apt-repository -y "ppa:george-edison55/cmake-3.x" && \
|
||||||
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
|
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
|
||||||
add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \
|
apt-get update && \
|
||||||
apt-get update && \
|
apt-get install -y --force-yes cmake llvm-3.7-dev
|
||||||
apt-get install -y --force-yes cmake llvm-3.7-dev librocksdb
|
|
||||||
|
|
||||||
# install evmjit
|
# install evmjit
|
||||||
RUN git clone https://github.com/debris/evmjit && \
|
RUN git clone https://github.com/debris/evmjit && \
|
||||||
cd evmjit && \
|
cd evmjit && \
|
||||||
mkdir build && cd build && \
|
mkdir build && cd build && \
|
||||||
cmake .. && make && make install && cd
|
cmake .. && make && make install && cd
|
||||||
|
|
||||||
# install multirust
|
# install rustup
|
||||||
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
|
|
||||||
# install nightly and make it default
|
# rustup directory
|
||||||
RUN multirust update nightly && multirust default nightly
|
ENV PATH /root/.cargo/bin:$PATH
|
||||||
|
|
||||||
# export rust LIBRARY_PATH
|
|
||||||
ENV LIBRARY_PATH /usr/local/lib
|
|
||||||
|
|
||||||
# show backtraces
|
# show backtraces
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
# show tools
|
||||||
|
RUN rustc -vV && \
|
||||||
|
cargo -V && \
|
||||||
|
gcc -v &&\
|
||||||
|
g++ -v
|
||||||
|
|
||||||
# build parity
|
# build parity
|
||||||
# TODO: add jit feature
|
|
||||||
RUN git clone https://github.com/ethcore/parity && \
|
RUN git clone https://github.com/ethcore/parity && \
|
||||||
cd parity && \
|
cd parity && \
|
||||||
cargo install --features rpc
|
git checkout beta && \
|
||||||
|
git pull && \
|
||||||
|
cargo build --release --features ethcore/jit --verbose && \
|
||||||
|
ls /build/parity/target/release/parity && \
|
||||||
|
strip /build/parity/target/release/parity
|
||||||
|
RUN file /build/parity/target/release/parity
|
||||||
|
|||||||
@@ -1,31 +1,36 @@
|
|||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
|
WORKDIR /build
|
||||||
# install tools and dependencies
|
# install tools and dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
curl \
|
g++ \
|
||||||
git \
|
curl \
|
||||||
# add-apt-repository
|
git \
|
||||||
software-properties-common
|
file \
|
||||||
|
binutils
|
||||||
|
|
||||||
# rocksdb ppas. then update ppas
|
# install rustup
|
||||||
RUN add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y --force-yes librocksdb
|
|
||||||
|
|
||||||
# install multirust
|
# rustup directory
|
||||||
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
|
ENV PATH /root/.cargo/bin:$PATH
|
||||||
|
|
||||||
# install nightly and make it default
|
|
||||||
RUN multirust update nightly && multirust default nightly
|
|
||||||
|
|
||||||
# export rust LIBRARY_PATH
|
|
||||||
ENV LIBRARY_PATH /usr/local/lib
|
|
||||||
|
|
||||||
# show backtraces
|
# show backtraces
|
||||||
ENV RUST_BACKTRACE 1
|
ENV RUST_BACKTRACE 1
|
||||||
|
|
||||||
|
# show tools
|
||||||
|
RUN rustc -vV && \
|
||||||
|
cargo -V && \
|
||||||
|
gcc -v &&\
|
||||||
|
g++ -v
|
||||||
|
|
||||||
# build parity
|
# build parity
|
||||||
RUN git clone https://github.com/ethcore/parity && \
|
RUN git clone https://github.com/ethcore/parity && \
|
||||||
cd parity && \
|
cd parity && \
|
||||||
cargo install --features rpc
|
git checkout beta && \
|
||||||
|
git pull && \
|
||||||
|
cargo build --release --verbose && \
|
||||||
|
ls /build/parity/target/release/parity && \
|
||||||
|
strip /build/parity/target/release/parity
|
||||||
|
|
||||||
|
ENTRYPOINT ["/build/parity/target/release/parity"]
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ethash"
|
name = "ethash"
|
||||||
version = "0.1.0"
|
version = "1.3.0"
|
||||||
authors = ["arkpar <arkadiy@ethcore.io"]
|
authors = ["arkpar <arkadiy@ethcore.io"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
lru-cache = "0.0"
|
|
||||||
sha3 = { path = "../util/sha3" }
|
sha3 = { path = "../util/sha3" }
|
||||||
|
primal = "0.2.3"
|
||||||
|
parking_lot = "0.2.6"
|
||||||
@@ -19,33 +19,40 @@
|
|||||||
|
|
||||||
// TODO: fix endianess for big endian
|
// TODO: fix endianess for big endian
|
||||||
|
|
||||||
|
use primal::is_prime;
|
||||||
|
use std::cell::Cell;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use sizes::{CACHE_SIZES, DAG_SIZES};
|
|
||||||
use sha3;
|
use sha3;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::io::{Read, Write, self};
|
use std::io::{self, Read, Write};
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
|
|
||||||
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
pub const ETHASH_EPOCH_LENGTH: u64 = 30000;
|
pub const ETHASH_EPOCH_LENGTH: u64 = 30000;
|
||||||
pub const ETHASH_CACHE_ROUNDS: usize = 3;
|
pub const ETHASH_CACHE_ROUNDS: usize = 3;
|
||||||
pub const ETHASH_MIX_BYTES: usize = 128;
|
pub const ETHASH_MIX_BYTES: usize = 128;
|
||||||
pub const ETHASH_ACCESSES:usize = 64;
|
pub const ETHASH_ACCESSES: usize = 64;
|
||||||
pub const ETHASH_DATASET_PARENTS:u32 = 256;
|
pub const ETHASH_DATASET_PARENTS: u32 = 256;
|
||||||
|
|
||||||
|
const DATASET_BYTES_INIT: u64 = 1 << 30;
|
||||||
|
const DATASET_BYTES_GROWTH: u64 = 1 << 23;
|
||||||
|
const CACHE_BYTES_INIT: u64 = 1 << 24;
|
||||||
|
const CACHE_BYTES_GROWTH: u64 = 1 << 17;
|
||||||
const NODE_WORDS: usize = 64 / 4;
|
const NODE_WORDS: usize = 64 / 4;
|
||||||
const NODE_BYTES: usize = 64;
|
const NODE_BYTES: usize = 64;
|
||||||
const MIX_WORDS: usize = ETHASH_MIX_BYTES / 4;
|
const MIX_WORDS: usize = ETHASH_MIX_BYTES / 4;
|
||||||
const MIX_NODES: usize = MIX_WORDS / NODE_WORDS;
|
const MIX_NODES: usize = MIX_WORDS / NODE_WORDS;
|
||||||
const FNV_PRIME: u32 = 0x01000193;
|
const FNV_PRIME: u32 = 0x01000193;
|
||||||
|
|
||||||
/// Computation result
|
/// Computation result
|
||||||
pub struct ProofOfWork {
|
pub struct ProofOfWork {
|
||||||
/// Difficulty boundary
|
/// Difficulty boundary
|
||||||
pub value: H256,
|
pub value: H256,
|
||||||
/// Mix
|
/// Mix
|
||||||
pub mix_hash: H256
|
pub mix_hash: H256,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Node {
|
struct Node {
|
||||||
@@ -53,7 +60,7 @@ struct Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Node {
|
impl Default for Node {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Node { bytes: [0u8; NODE_BYTES] }
|
Node { bytes: [0u8; NODE_BYTES] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +88,7 @@ pub type H256 = [u8; 32];
|
|||||||
pub struct Light {
|
pub struct Light {
|
||||||
block_number: u64,
|
block_number: u64,
|
||||||
cache: Vec<Node>,
|
cache: Vec<Node>,
|
||||||
|
seed_compute: Mutex<SeedHashCompute>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Light cache structur
|
/// Light cache structur
|
||||||
@@ -97,19 +105,19 @@ impl Light {
|
|||||||
light_compute(self, header_hash, nonce)
|
light_compute(self, header_hash, nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn file_path(block_number: u64) -> PathBuf {
|
pub fn file_path(seed_hash: H256) -> PathBuf {
|
||||||
let mut home = ::std::env::home_dir().unwrap();
|
let mut home = ::std::env::home_dir().unwrap();
|
||||||
home.push(".ethash");
|
home.push(".ethash");
|
||||||
home.push("light");
|
home.push("light");
|
||||||
let seed_hash = get_seedhash(block_number);
|
|
||||||
home.push(to_hex(&seed_hash));
|
home.push(to_hex(&seed_hash));
|
||||||
home
|
home
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_file(block_number: u64) -> io::Result<Light> {
|
pub fn from_file(block_number: u64) -> io::Result<Light> {
|
||||||
let path = Light::file_path(block_number);
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
let path = Light::file_path(seed_compute.get_seedhash(block_number));
|
||||||
let mut file = try!(File::open(path));
|
let mut file = try!(File::open(path));
|
||||||
|
|
||||||
let cache_size = get_cache_size(block_number);
|
let cache_size = get_cache_size(block_number);
|
||||||
if try!(file.metadata()).len() != cache_size as u64 {
|
if try!(file.metadata()).len() != cache_size as u64 {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Cache file size mismatch"));
|
return Err(io::Error::new(io::ErrorKind::Other, "Cache file size mismatch"));
|
||||||
@@ -122,21 +130,68 @@ impl Light {
|
|||||||
Ok(Light {
|
Ok(Light {
|
||||||
cache: nodes,
|
cache: nodes,
|
||||||
block_number: block_number,
|
block_number: block_number,
|
||||||
|
seed_compute: Mutex::new(seed_compute),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_file(&self) -> io::Result<()> {
|
pub fn to_file(&self) -> io::Result<()> {
|
||||||
let path = Light::file_path(self.block_number);
|
let seed_compute = self.seed_compute.lock();
|
||||||
|
let path = Light::file_path(seed_compute.get_seedhash(self.block_number));
|
||||||
try!(fs::create_dir_all(path.parent().unwrap()));
|
try!(fs::create_dir_all(path.parent().unwrap()));
|
||||||
let mut file = try!(File::create(path));
|
let mut file = try!(File::create(path));
|
||||||
|
|
||||||
let cache_size = self.cache.len() * NODE_BYTES;
|
let cache_size = self.cache.len() * NODE_BYTES;
|
||||||
let buf = unsafe { slice::from_raw_parts(self.cache.as_ptr() as *const u8, cache_size) };
|
let buf = unsafe { slice::from_raw_parts(self.cache.as_ptr() as *const u8, cache_size) };
|
||||||
try!(file.write(buf));
|
try!(file.write(buf));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct SeedHashCompute {
|
||||||
|
prev_epoch: Cell<u64>,
|
||||||
|
prev_seedhash: Cell<H256>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SeedHashCompute {
|
||||||
|
#[inline]
|
||||||
|
pub fn new() -> SeedHashCompute {
|
||||||
|
SeedHashCompute {
|
||||||
|
prev_epoch: Cell::new(0),
|
||||||
|
prev_seedhash: Cell::new([0u8; 32]),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn reset_cache(&self) {
|
||||||
|
self.prev_epoch.set(0);
|
||||||
|
self.prev_seedhash.set([0u8; 32]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_seedhash(&self, block_number: u64) -> H256 {
|
||||||
|
let epoch = block_number / ETHASH_EPOCH_LENGTH;
|
||||||
|
if epoch < self.prev_epoch.get() {
|
||||||
|
// can't build on previous hash if requesting an older block
|
||||||
|
self.reset_cache();
|
||||||
|
}
|
||||||
|
if epoch > self.prev_epoch.get() {
|
||||||
|
let seed_hash = SeedHashCompute::resume_compute_seedhash(self.prev_seedhash.get(), self.prev_epoch.get(), epoch);
|
||||||
|
self.prev_seedhash.set(seed_hash);
|
||||||
|
self.prev_epoch.set(epoch);
|
||||||
|
}
|
||||||
|
self.prev_seedhash.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn resume_compute_seedhash(mut hash: H256, start_epoch: u64, end_epoch: u64) -> H256 {
|
||||||
|
for _ in start_epoch..end_epoch {
|
||||||
|
unsafe { sha3::sha3_256(hash[..].as_mut_ptr(), 32, hash[..].as_ptr(), 32) };
|
||||||
|
}
|
||||||
|
hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fnv_hash(x: u32, y: u32) -> u32 {
|
fn fnv_hash(x: u32, y: u32) -> u32 {
|
||||||
return x.wrapping_mul(FNV_PRIME) ^ y;
|
return x.wrapping_mul(FNV_PRIME) ^ y;
|
||||||
@@ -149,25 +204,24 @@ fn sha3_512(input: &[u8], output: &mut [u8]) {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_cache_size(block_number: u64) -> usize {
|
fn get_cache_size(block_number: u64) -> usize {
|
||||||
assert!(block_number / ETHASH_EPOCH_LENGTH < 2048);
|
let mut sz: u64 = CACHE_BYTES_INIT + CACHE_BYTES_GROWTH * (block_number / ETHASH_EPOCH_LENGTH);
|
||||||
return CACHE_SIZES[(block_number / ETHASH_EPOCH_LENGTH) as usize] as usize;
|
sz = sz - NODE_BYTES as u64;
|
||||||
|
while !is_prime(sz / NODE_BYTES as u64) {
|
||||||
|
sz = sz - 2 * NODE_BYTES as u64;
|
||||||
|
}
|
||||||
|
sz as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_data_size(block_number: u64) -> usize {
|
fn get_data_size(block_number: u64) -> usize {
|
||||||
assert!(block_number / ETHASH_EPOCH_LENGTH < 2048);
|
let mut sz: u64 = DATASET_BYTES_INIT + DATASET_BYTES_GROWTH * (block_number / ETHASH_EPOCH_LENGTH);
|
||||||
return DAG_SIZES[(block_number / ETHASH_EPOCH_LENGTH) as usize] as usize;
|
sz = sz - ETHASH_MIX_BYTES as u64;
|
||||||
|
while !is_prime(sz / ETHASH_MIX_BYTES as u64) {
|
||||||
|
sz = sz - 2 * ETHASH_MIX_BYTES as u64;
|
||||||
|
}
|
||||||
|
sz as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn get_seedhash(block_number: u64) -> H256 {
|
|
||||||
let epochs = block_number / ETHASH_EPOCH_LENGTH;
|
|
||||||
let mut ret: H256 = [0u8; 32];
|
|
||||||
for _ in 0..epochs {
|
|
||||||
unsafe { sha3::sha3_256(ret[..].as_mut_ptr(), 32, ret[..].as_ptr(), 32) };
|
|
||||||
}
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Difficulty quick check for POW preverification
|
/// Difficulty quick check for POW preverification
|
||||||
///
|
///
|
||||||
@@ -198,12 +252,12 @@ pub fn light_compute(light: &Light, header_hash: &H256, nonce: u64) -> ProofOfWo
|
|||||||
hash_compute(light, full_size, header_hash, nonce)
|
hash_compute(light, full_size, header_hash, nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash_compute(light: &Light, full_size: usize, header_hash: &H256, nonce: u64) -> ProofOfWork {
|
fn hash_compute(light: &Light, full_size: usize, header_hash: &H256, nonce: u64) -> ProofOfWork {
|
||||||
if full_size % MIX_WORDS != 0 {
|
if full_size % MIX_WORDS != 0 {
|
||||||
panic!("Unaligned full size");
|
panic!("Unaligned full size");
|
||||||
}
|
}
|
||||||
// pack hash and nonce together into first 40 bytes of s_mix
|
// pack hash and nonce together into first 40 bytes of s_mix
|
||||||
let mut s_mix: [Node; MIX_NODES + 1] = [ Node::default(), Node::default(), Node::default() ];
|
let mut s_mix: [Node; MIX_NODES + 1] = [Node::default(), Node::default(), Node::default()];
|
||||||
unsafe { ptr::copy_nonoverlapping(header_hash.as_ptr(), s_mix.get_unchecked_mut(0).bytes.as_mut_ptr(), 32) };
|
unsafe { ptr::copy_nonoverlapping(header_hash.as_ptr(), s_mix.get_unchecked_mut(0).bytes.as_mut_ptr(), 32) };
|
||||||
unsafe { ptr::copy_nonoverlapping(mem::transmute(&nonce), s_mix.get_unchecked_mut(0).bytes[32..].as_mut_ptr(), 8) };
|
unsafe { ptr::copy_nonoverlapping(mem::transmute(&nonce), s_mix.get_unchecked_mut(0).bytes[32..].as_mut_ptr(), 8) };
|
||||||
|
|
||||||
@@ -217,11 +271,12 @@ fn hash_compute(light: &Light, full_size: usize, header_hash: &H256, nonce: u64
|
|||||||
|
|
||||||
let page_size = 4 * MIX_WORDS;
|
let page_size = 4 * MIX_WORDS;
|
||||||
let num_full_pages = (full_size / page_size) as u32;
|
let num_full_pages = (full_size / page_size) as u32;
|
||||||
|
let cache: &[Node] = &light.cache; // deref once for better performance
|
||||||
|
|
||||||
for i in 0..(ETHASH_ACCESSES as u32) {
|
for i in 0..(ETHASH_ACCESSES as u32) {
|
||||||
let index = fnv_hash(f_mix.get_unchecked(0).as_words().get_unchecked(0) ^ i, *mix.get_unchecked(0).as_words().get_unchecked((i as usize) % MIX_WORDS)) % num_full_pages;
|
let index = fnv_hash(f_mix.get_unchecked(0).as_words().get_unchecked(0) ^ i, *mix.get_unchecked(0).as_words().get_unchecked((i as usize) % MIX_WORDS)) % num_full_pages;
|
||||||
for n in 0..MIX_NODES {
|
for n in 0..MIX_NODES {
|
||||||
let tmp_node = calculate_dag_item(index * MIX_NODES as u32 + n as u32, light);
|
let tmp_node = calculate_dag_item(index * MIX_NODES as u32 + n as u32, cache);
|
||||||
for w in 0..NODE_WORDS {
|
for w in 0..NODE_WORDS {
|
||||||
*mix.get_unchecked_mut(n).as_words_mut().get_unchecked_mut(w) = fnv_hash(*mix.get_unchecked(n).as_words().get_unchecked(w), *tmp_node.as_words().get_unchecked(w));
|
*mix.get_unchecked_mut(n).as_words_mut().get_unchecked_mut(w) = fnv_hash(*mix.get_unchecked(n).as_words().get_unchecked(w), *tmp_node.as_words().get_unchecked(w));
|
||||||
}
|
}
|
||||||
@@ -244,7 +299,7 @@ fn hash_compute(light: &Light, full_size: usize, header_hash: &H256, nonce: u64
|
|||||||
ptr::copy_nonoverlapping(mix.get_unchecked_mut(0).bytes.as_ptr(), buf[64..].as_mut_ptr(), 32);
|
ptr::copy_nonoverlapping(mix.get_unchecked_mut(0).bytes.as_ptr(), buf[64..].as_mut_ptr(), 32);
|
||||||
ptr::copy_nonoverlapping(mix.get_unchecked_mut(0).bytes.as_ptr(), mix_hash.as_mut_ptr(), 32);
|
ptr::copy_nonoverlapping(mix.get_unchecked_mut(0).bytes.as_ptr(), mix_hash.as_mut_ptr(), 32);
|
||||||
let mut value: H256 = [0u8; 32];
|
let mut value: H256 = [0u8; 32];
|
||||||
sha3::sha3_256(value.as_mut_ptr(), value.len(), buf.as_ptr(), buf.len());
|
sha3::sha3_256(value.as_mut_ptr(), value.len(), buf.as_ptr(), buf.len());
|
||||||
ProofOfWork {
|
ProofOfWork {
|
||||||
mix_hash: mix_hash,
|
mix_hash: mix_hash,
|
||||||
value: value,
|
value: value,
|
||||||
@@ -252,18 +307,17 @@ fn hash_compute(light: &Light, full_size: usize, header_hash: &H256, nonce: u64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn calculate_dag_item(node_index: u32, light: &Light) -> Node {
|
fn calculate_dag_item(node_index: u32, cache: &[Node]) -> Node {
|
||||||
unsafe {
|
unsafe {
|
||||||
let num_parent_nodes = light.cache.len();
|
let num_parent_nodes = cache.len();
|
||||||
let cache_nodes = &light.cache;
|
let init = cache.get_unchecked(node_index as usize % num_parent_nodes);
|
||||||
let init = cache_nodes.get_unchecked(node_index as usize % num_parent_nodes);
|
|
||||||
let mut ret = init.clone();
|
let mut ret = init.clone();
|
||||||
*ret.as_words_mut().get_unchecked_mut(0) ^= node_index;
|
*ret.as_words_mut().get_unchecked_mut(0) ^= node_index;
|
||||||
sha3::sha3_512(ret.bytes.as_mut_ptr(), ret.bytes.len(), ret.bytes.as_ptr(), ret.bytes.len());
|
sha3::sha3_512(ret.bytes.as_mut_ptr(), ret.bytes.len(), ret.bytes.as_ptr(), ret.bytes.len());
|
||||||
|
|
||||||
for i in 0..ETHASH_DATASET_PARENTS {
|
for i in 0..ETHASH_DATASET_PARENTS {
|
||||||
let parent_index = fnv_hash(node_index ^ i, *ret.as_words().get_unchecked(i as usize % NODE_WORDS)) % num_parent_nodes as u32;
|
let parent_index = fnv_hash(node_index ^ i, *ret.as_words().get_unchecked(i as usize % NODE_WORDS)) % num_parent_nodes as u32;
|
||||||
let parent = cache_nodes.get_unchecked(parent_index as usize);
|
let parent = cache.get_unchecked(parent_index as usize);
|
||||||
for w in 0..NODE_WORDS {
|
for w in 0..NODE_WORDS {
|
||||||
*ret.as_words_mut().get_unchecked_mut(w) = fnv_hash(*ret.as_words().get_unchecked(w), *parent.as_words().get_unchecked(w));
|
*ret.as_words_mut().get_unchecked_mut(w) = fnv_hash(*ret.as_words().get_unchecked(w), *parent.as_words().get_unchecked(w));
|
||||||
}
|
}
|
||||||
@@ -274,7 +328,9 @@ fn calculate_dag_item(node_index: u32, light: &Light) -> Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn light_new(block_number: u64) -> Light {
|
fn light_new(block_number: u64) -> Light {
|
||||||
let seedhash = get_seedhash(block_number);
|
|
||||||
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
let seedhash = seed_compute.get_seedhash(block_number);
|
||||||
let cache_size = get_cache_size(block_number);
|
let cache_size = get_cache_size(block_number);
|
||||||
|
|
||||||
if cache_size % NODE_BYTES != 0 {
|
if cache_size % NODE_BYTES != 0 {
|
||||||
@@ -289,13 +345,13 @@ fn light_new(block_number: u64) -> Light {
|
|||||||
for i in 1..num_nodes {
|
for i in 1..num_nodes {
|
||||||
sha3::sha3_512(nodes.get_unchecked_mut(i).bytes.as_mut_ptr(), NODE_BYTES, nodes.get_unchecked(i - 1).bytes.as_ptr(), NODE_BYTES);
|
sha3::sha3_512(nodes.get_unchecked_mut(i).bytes.as_mut_ptr(), NODE_BYTES, nodes.get_unchecked(i - 1).bytes.as_ptr(), NODE_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
for _ in 0..ETHASH_CACHE_ROUNDS {
|
for _ in 0..ETHASH_CACHE_ROUNDS {
|
||||||
for i in 0..num_nodes {
|
for i in 0..num_nodes {
|
||||||
let idx = *nodes.get_unchecked_mut(i).as_words().get_unchecked(0) as usize % num_nodes;
|
let idx = *nodes.get_unchecked_mut(i).as_words().get_unchecked(0) as usize % num_nodes;
|
||||||
let mut data = nodes.get_unchecked((num_nodes - 1 + i) % num_nodes).clone();
|
let mut data = nodes.get_unchecked((num_nodes - 1 + i) % num_nodes).clone();
|
||||||
for w in 0..NODE_WORDS {
|
for w in 0..NODE_WORDS {
|
||||||
*data.as_words_mut().get_unchecked_mut(w) ^= *nodes.get_unchecked(idx).as_words().get_unchecked(w) ;
|
*data.as_words_mut().get_unchecked_mut(w) ^= *nodes.get_unchecked(idx).as_words().get_unchecked(w);
|
||||||
}
|
}
|
||||||
sha3_512(&data.bytes, &mut nodes.get_unchecked_mut(i).bytes);
|
sha3_512(&data.bytes, &mut nodes.get_unchecked_mut(i).bytes);
|
||||||
}
|
}
|
||||||
@@ -305,10 +361,11 @@ fn light_new(block_number: u64) -> Light {
|
|||||||
Light {
|
Light {
|
||||||
cache: nodes,
|
cache: nodes,
|
||||||
block_number: block_number,
|
block_number: block_number,
|
||||||
|
seed_compute: Mutex::new(seed_compute),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CHARS: &'static[u8] = b"0123456789abcdef";
|
static CHARS: &'static [u8] = b"0123456789abcdef";
|
||||||
fn to_hex(bytes: &[u8]) -> String {
|
fn to_hex(bytes: &[u8]) -> String {
|
||||||
let mut v = Vec::with_capacity(bytes.len() * 2);
|
let mut v = Vec::with_capacity(bytes.len() * 2);
|
||||||
for &byte in bytes.iter() {
|
for &byte in bytes.iter() {
|
||||||
@@ -316,15 +373,38 @@ fn to_hex(bytes: &[u8]) -> String {
|
|||||||
v.push(CHARS[(byte & 0xf) as usize]);
|
v.push(CHARS[(byte & 0xf) as usize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe { String::from_utf8_unchecked(v) }
|
||||||
String::from_utf8_unchecked(v)
|
}
|
||||||
}
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_cache_size() {
|
||||||
|
// https://github.com/ethereum/wiki/wiki/Ethash/ef6b93f9596746a088ea95d01ca2778be43ae68f#data-sizes
|
||||||
|
assert_eq!(16776896usize, get_cache_size(0));
|
||||||
|
assert_eq!(16776896usize, get_cache_size(1));
|
||||||
|
assert_eq!(16776896usize, get_cache_size(ETHASH_EPOCH_LENGTH - 1));
|
||||||
|
assert_eq!(16907456usize, get_cache_size(ETHASH_EPOCH_LENGTH));
|
||||||
|
assert_eq!(16907456usize, get_cache_size(ETHASH_EPOCH_LENGTH + 1));
|
||||||
|
assert_eq!(284950208usize, get_cache_size(2046 * ETHASH_EPOCH_LENGTH));
|
||||||
|
assert_eq!(285081536usize, get_cache_size(2047 * ETHASH_EPOCH_LENGTH));
|
||||||
|
assert_eq!(285081536usize, get_cache_size(2048 * ETHASH_EPOCH_LENGTH - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_data_size() {
|
||||||
|
// https://github.com/ethereum/wiki/wiki/Ethash/ef6b93f9596746a088ea95d01ca2778be43ae68f#data-sizes
|
||||||
|
assert_eq!(1073739904usize, get_data_size(0));
|
||||||
|
assert_eq!(1073739904usize, get_data_size(1));
|
||||||
|
assert_eq!(1073739904usize, get_data_size(ETHASH_EPOCH_LENGTH - 1));
|
||||||
|
assert_eq!(1082130304usize, get_data_size(ETHASH_EPOCH_LENGTH));
|
||||||
|
assert_eq!(1082130304usize, get_data_size(ETHASH_EPOCH_LENGTH + 1));
|
||||||
|
assert_eq!(18236833408usize, get_data_size(2046 * ETHASH_EPOCH_LENGTH));
|
||||||
|
assert_eq!(18245220736usize, get_data_size(2047 * ETHASH_EPOCH_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_difficulty_test() {
|
fn test_difficulty_test() {
|
||||||
let hash = [0xf5, 0x7e, 0x6f, 0x3a, 0xcf, 0xc0, 0xdd, 0x4b, 0x5b, 0xf2, 0xbe, 0xe4, 0x0a, 0xb3, 0x35, 0x8a, 0xa6, 0x87, 0x73, 0xa8, 0xd0, 0x9f, 0x5e, 0x59, 0x5e, 0xab, 0x55, 0x94, 0x05, 0x52, 0x7d, 0x72];
|
let hash = [0xf5, 0x7e, 0x6f, 0x3a, 0xcf, 0xc0, 0xdd, 0x4b, 0x5b, 0xf2, 0xbe, 0xe4, 0x0a, 0xb3, 0x35, 0x8a, 0xa6, 0x87, 0x73, 0xa8, 0xd0, 0x9f, 0x5e, 0x59, 0x5e, 0xab, 0x55, 0x94, 0x05, 0x52, 0x7d, 0x72];
|
||||||
let mix_hash = [0x1f, 0xff, 0x04, 0xce, 0xc9, 0x41, 0x73, 0xfd, 0x59, 0x1e, 0x3d, 0x89, 0x60, 0xce, 0x6b, 0xdf, 0x8b, 0x19, 0x71, 0x04, 0x8c, 0x71, 0xff, 0x93, 0x7b, 0xb2, 0xd3, 0x2a, 0x64, 0x31, 0xab, 0x6d ];
|
let mix_hash = [0x1f, 0xff, 0x04, 0xce, 0xc9, 0x41, 0x73, 0xfd, 0x59, 0x1e, 0x3d, 0x89, 0x60, 0xce, 0x6b, 0xdf, 0x8b, 0x19, 0x71, 0x04, 0x8c, 0x71, 0xff, 0x93, 0x7b, 0xb2, 0xd3, 0x2a, 0x64, 0x31, 0xab, 0x6d];
|
||||||
let nonce = 0xd7b3ac70a301a249;
|
let nonce = 0xd7b3ac70a301a249;
|
||||||
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, 0xe9, 0x7e, 0x53, 0x84];
|
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, 0xe9, 0x7e, 0x53, 0x84];
|
||||||
assert_eq!(quick_get_difficulty(&hash, nonce, &mix_hash)[..], boundary_good[..]);
|
assert_eq!(quick_get_difficulty(&hash, nonce, &mix_hash)[..], boundary_good[..]);
|
||||||
@@ -334,8 +414,8 @@ fn test_difficulty_test() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_light_compute() {
|
fn test_light_compute() {
|
||||||
let hash = [0xf5, 0x7e, 0x6f, 0x3a, 0xcf, 0xc0, 0xdd, 0x4b, 0x5b, 0xf2, 0xbe, 0xe4, 0x0a, 0xb3, 0x35, 0x8a, 0xa6, 0x87, 0x73, 0xa8, 0xd0, 0x9f, 0x5e, 0x59, 0x5e, 0xab, 0x55, 0x94, 0x05, 0x52, 0x7d, 0x72];
|
let hash = [0xf5, 0x7e, 0x6f, 0x3a, 0xcf, 0xc0, 0xdd, 0x4b, 0x5b, 0xf2, 0xbe, 0xe4, 0x0a, 0xb3, 0x35, 0x8a, 0xa6, 0x87, 0x73, 0xa8, 0xd0, 0x9f, 0x5e, 0x59, 0x5e, 0xab, 0x55, 0x94, 0x05, 0x52, 0x7d, 0x72];
|
||||||
let mix_hash = [0x1f, 0xff, 0x04, 0xce, 0xc9, 0x41, 0x73, 0xfd, 0x59, 0x1e, 0x3d, 0x89, 0x60, 0xce, 0x6b, 0xdf, 0x8b, 0x19, 0x71, 0x04, 0x8c, 0x71, 0xff, 0x93, 0x7b, 0xb2, 0xd3, 0x2a, 0x64, 0x31, 0xab, 0x6d ];
|
let mix_hash = [0x1f, 0xff, 0x04, 0xce, 0xc9, 0x41, 0x73, 0xfd, 0x59, 0x1e, 0x3d, 0x89, 0x60, 0xce, 0x6b, 0xdf, 0x8b, 0x19, 0x71, 0x04, 0x8c, 0x71, 0xff, 0x93, 0x7b, 0xb2, 0xd3, 0x2a, 0x64, 0x31, 0xab, 0x6d];
|
||||||
let boundary = [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, 0xe9, 0x7e, 0x53, 0x84];
|
let boundary = [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, 0xe9, 0x7e, 0x53, 0x84];
|
||||||
let nonce = 0xd7b3ac70a301a249;
|
let nonce = 0xd7b3ac70a301a249;
|
||||||
// difficulty = 0x085657254bd9u64;
|
// difficulty = 0x085657254bd9u64;
|
||||||
@@ -344,3 +424,34 @@ fn test_light_compute() {
|
|||||||
assert_eq!(result.mix_hash[..], mix_hash[..]);
|
assert_eq!(result.mix_hash[..], mix_hash[..]);
|
||||||
assert_eq!(result.value[..], boundary[..]);
|
assert_eq!(result.value[..], boundary[..]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_seed_compute_once() {
|
||||||
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
let hash = [241, 175, 44, 134, 39, 121, 245, 239, 228, 236, 43, 160, 195, 152, 46, 7, 199, 5, 253, 147, 241, 206, 98, 43, 3, 104, 17, 40, 192, 79, 106, 162];
|
||||||
|
assert_eq!(seed_compute.get_seedhash(486382), hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_seed_compute_zero() {
|
||||||
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
assert_eq!(seed_compute.get_seedhash(0), [0u8; 32]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_seed_compute_after_older() {
|
||||||
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
// calculating an older value first shouldn't affect the result
|
||||||
|
let _ = seed_compute.get_seedhash(50000);
|
||||||
|
let hash = [241, 175, 44, 134, 39, 121, 245, 239, 228, 236, 43, 160, 195, 152, 46, 7, 199, 5, 253, 147, 241, 206, 98, 43, 3, 104, 17, 40, 192, 79, 106, 162];
|
||||||
|
assert_eq!(seed_compute.get_seedhash(486382), hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_seed_compute_after_newer() {
|
||||||
|
let seed_compute = SeedHashCompute::new();
|
||||||
|
// calculating an newer value first shouldn't affect the result
|
||||||
|
let _ = seed_compute.get_seedhash(972764);
|
||||||
|
let hash = [241, 175, 44, 134, 39, 121, 245, 239, 228, 236, 43, 160, 195, 152, 46, 7, 199, 5, 253, 147, 241, 206, 98, 43, 3, 104, 17, 40, 192, 79, 106, 162];
|
||||||
|
assert_eq!(seed_compute.get_seedhash(486382), hash);
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,29 +16,43 @@
|
|||||||
|
|
||||||
//! Ethash implementation
|
//! Ethash implementation
|
||||||
//! See https://github.com/ethereum/wiki/wiki/Ethash
|
//! See https://github.com/ethereum/wiki/wiki/Ethash
|
||||||
|
extern crate primal;
|
||||||
extern crate sha3;
|
extern crate sha3;
|
||||||
extern crate lru_cache;
|
extern crate parking_lot;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
mod sizes;
|
|
||||||
mod compute;
|
mod compute;
|
||||||
|
|
||||||
use lru_cache::LruCache;
|
use std::mem;
|
||||||
use compute::Light;
|
use compute::Light;
|
||||||
pub use compute::{quick_get_difficulty, H256, ProofOfWork, ETHASH_EPOCH_LENGTH};
|
pub use compute::{ETHASH_EPOCH_LENGTH, H256, ProofOfWork, SeedHashCompute, quick_get_difficulty};
|
||||||
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::Arc;
|
||||||
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
/// Lighy/Full cache manager
|
struct LightCache {
|
||||||
|
recent_epoch: Option<u64>,
|
||||||
|
recent: Option<Arc<Light>>,
|
||||||
|
prev_epoch: Option<u64>,
|
||||||
|
prev: Option<Arc<Light>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Light/Full cache manager.
|
||||||
pub struct EthashManager {
|
pub struct EthashManager {
|
||||||
lights: Mutex<LruCache<u64, Arc<Light>>>
|
cache: Mutex<LightCache>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EthashManager {
|
impl EthashManager {
|
||||||
/// Create a new new instance of ethash manager
|
/// Create a new new instance of ethash manager
|
||||||
pub fn new() -> EthashManager {
|
pub fn new() -> EthashManager {
|
||||||
EthashManager {
|
EthashManager {
|
||||||
lights: Mutex::new(LruCache::new(2))
|
cache: Mutex::new(LightCache {
|
||||||
|
recent_epoch: None,
|
||||||
|
recent: None,
|
||||||
|
prev_epoch: None,
|
||||||
|
prev: None,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +64,28 @@ impl EthashManager {
|
|||||||
pub fn compute_light(&self, block_number: u64, header_hash: &H256, nonce: u64) -> ProofOfWork {
|
pub fn compute_light(&self, block_number: u64, header_hash: &H256, nonce: u64) -> ProofOfWork {
|
||||||
let epoch = block_number / ETHASH_EPOCH_LENGTH;
|
let epoch = block_number / ETHASH_EPOCH_LENGTH;
|
||||||
let light = {
|
let light = {
|
||||||
let mut lights = self.lights.lock().unwrap();
|
let mut lights = self.cache.lock();
|
||||||
match lights.get_mut(&epoch).map(|l| l.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 => {
|
||||||
|
// 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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
match light {
|
||||||
None => {
|
None => {
|
||||||
let light = match Light::from_file(block_number) {
|
let light = match Light::from_file(block_number) {
|
||||||
Ok(light) => Arc::new(light),
|
Ok(light) => Arc::new(light),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Light cache file not found for {}:{}", block_number, e);
|
debug!("Light cache file not found for {}:{}", block_number, e);
|
||||||
let light = Light::new(block_number);
|
let light = Light::new(block_number);
|
||||||
if let Err(e) = light.to_file() {
|
if let Err(e) = light.to_file() {
|
||||||
@@ -64,12 +94,29 @@ impl EthashManager {
|
|||||||
Arc::new(light)
|
Arc::new(light)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
lights.insert(epoch, light.clone());
|
lights.prev_epoch = mem::replace(&mut lights.recent_epoch, Some(epoch));
|
||||||
|
lights.prev = mem::replace(&mut lights.recent, Some(light.clone()));
|
||||||
light
|
light
|
||||||
}
|
}
|
||||||
Some(light) => light
|
Some(light) => light,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
light.compute(header_hash, nonce)
|
light.compute(header_hash, nonce)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_lru() {
|
||||||
|
let ethash = EthashManager::new();
|
||||||
|
let hash = [0u8; 32];
|
||||||
|
ethash.compute_light(1, &hash, 1);
|
||||||
|
ethash.compute_light(50000, &hash, 1);
|
||||||
|
assert_eq!(ethash.cache.lock().recent_epoch.unwrap(), 1);
|
||||||
|
assert_eq!(ethash.cache.lock().prev_epoch.unwrap(), 0);
|
||||||
|
ethash.compute_light(1, &hash, 1);
|
||||||
|
assert_eq!(ethash.cache.lock().recent_epoch.unwrap(), 0);
|
||||||
|
assert_eq!(ethash.cache.lock().prev_epoch.unwrap(), 1);
|
||||||
|
ethash.compute_light(70000, &hash, 1);
|
||||||
|
assert_eq!(ethash.cache.lock().recent_epoch.unwrap(), 2);
|
||||||
|
assert_eq!(ethash.cache.lock().prev_epoch.unwrap(), 0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,788 +0,0 @@
|
|||||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
|
||||||
// This file is part of Parity.
|
|
||||||
|
|
||||||
// Parity 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.
|
|
||||||
|
|
||||||
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
// 2048 Epochs (~20 years) worth of tabulated DAG sizes
|
|
||||||
|
|
||||||
// Generated with the following Mathematica Code:
|
|
||||||
|
|
||||||
// GetCacheSizes[n_] := Module[{
|
|
||||||
// CacheSizeBytesInit = 2^24,
|
|
||||||
// CacheGrowth = 2^17,
|
|
||||||
// HashBytes = 64,
|
|
||||||
// j = 0},
|
|
||||||
// Reap[
|
|
||||||
// While[j < n,
|
|
||||||
// Module[{i =
|
|
||||||
// Floor[(CacheSizeBytesInit + CacheGrowth * j) / HashBytes]},
|
|
||||||
// While[! PrimeQ[i], i--];
|
|
||||||
// Sow[i*HashBytes]; j++]]]][[2]][[1]]
|
|
||||||
pub const DAG_SIZES: [u64; 2048] = [
|
|
||||||
1073739904u64, 1082130304u64, 1090514816u64, 1098906752u64, 1107293056u64,
|
|
||||||
1115684224u64, 1124070016u64, 1132461952u64, 1140849536u64, 1149232768u64,
|
|
||||||
1157627776u64, 1166013824u64, 1174404736u64, 1182786944u64, 1191180416u64,
|
|
||||||
1199568512u64, 1207958912u64, 1216345216u64, 1224732032u64, 1233124736u64,
|
|
||||||
1241513344u64, 1249902464u64, 1258290304u64, 1266673792u64, 1275067264u64,
|
|
||||||
1283453312u64, 1291844992u64, 1300234112u64, 1308619904u64, 1317010048u64,
|
|
||||||
1325397376u64, 1333787776u64, 1342176128u64, 1350561664u64, 1358954368u64,
|
|
||||||
1367339392u64, 1375731584u64, 1384118144u64, 1392507008u64, 1400897408u64,
|
|
||||||
1409284736u64, 1417673344u64, 1426062464u64, 1434451072u64, 1442839168u64,
|
|
||||||
1451229056u64, 1459615616u64, 1468006016u64, 1476394112u64, 1484782976u64,
|
|
||||||
1493171584u64, 1501559168u64, 1509948032u64, 1518337664u64, 1526726528u64,
|
|
||||||
1535114624u64, 1543503488u64, 1551892096u64, 1560278656u64, 1568669056u64,
|
|
||||||
1577056384u64, 1585446272u64, 1593831296u64, 1602219392u64, 1610610304u64,
|
|
||||||
1619000192u64, 1627386752u64, 1635773824u64, 1644164224u64, 1652555648u64,
|
|
||||||
1660943488u64, 1669332608u64, 1677721216u64, 1686109312u64, 1694497664u64,
|
|
||||||
1702886272u64, 1711274624u64, 1719661184u64, 1728047744u64, 1736434816u64,
|
|
||||||
1744829056u64, 1753218944u64, 1761606272u64, 1769995904u64, 1778382464u64,
|
|
||||||
1786772864u64, 1795157888u64, 1803550592u64, 1811937664u64, 1820327552u64,
|
|
||||||
1828711552u64, 1837102976u64, 1845488768u64, 1853879936u64, 1862269312u64,
|
|
||||||
1870656896u64, 1879048064u64, 1887431552u64, 1895825024u64, 1904212096u64,
|
|
||||||
1912601216u64, 1920988544u64, 1929379456u64, 1937765504u64, 1946156672u64,
|
|
||||||
1954543232u64, 1962932096u64, 1971321728u64, 1979707264u64, 1988093056u64,
|
|
||||||
1996487552u64, 2004874624u64, 2013262208u64, 2021653888u64, 2030039936u64,
|
|
||||||
2038430848u64, 2046819968u64, 2055208576u64, 2063596672u64, 2071981952u64,
|
|
||||||
2080373632u64, 2088762752u64, 2097149056u64, 2105539712u64, 2113928576u64,
|
|
||||||
2122315136u64, 2130700672u64, 2139092608u64, 2147483264u64, 2155872128u64,
|
|
||||||
2164257664u64, 2172642176u64, 2181035392u64, 2189426048u64, 2197814912u64,
|
|
||||||
2206203008u64, 2214587264u64, 2222979712u64, 2231367808u64, 2239758208u64,
|
|
||||||
2248145024u64, 2256527744u64, 2264922752u64, 2273312128u64, 2281701248u64,
|
|
||||||
2290086272u64, 2298476672u64, 2306867072u64, 2315251072u64, 2323639168u64,
|
|
||||||
2332032128u64, 2340420224u64, 2348808064u64, 2357196416u64, 2365580416u64,
|
|
||||||
2373966976u64, 2382363008u64, 2390748544u64, 2399139968u64, 2407530368u64,
|
|
||||||
2415918976u64, 2424307328u64, 2432695424u64, 2441084288u64, 2449472384u64,
|
|
||||||
2457861248u64, 2466247808u64, 2474637184u64, 2483026816u64, 2491414144u64,
|
|
||||||
2499803776u64, 2508191872u64, 2516582272u64, 2524970368u64, 2533359232u64,
|
|
||||||
2541743488u64, 2550134144u64, 2558525056u64, 2566913408u64, 2575301504u64,
|
|
||||||
2583686528u64, 2592073856u64, 2600467328u64, 2608856192u64, 2617240448u64,
|
|
||||||
2625631616u64, 2634022016u64, 2642407552u64, 2650796416u64, 2659188352u64,
|
|
||||||
2667574912u64, 2675965312u64, 2684352896u64, 2692738688u64, 2701130624u64,
|
|
||||||
2709518464u64, 2717907328u64, 2726293376u64, 2734685056u64, 2743073152u64,
|
|
||||||
2751462016u64, 2759851648u64, 2768232832u64, 2776625536u64, 2785017728u64,
|
|
||||||
2793401984u64, 2801794432u64, 2810182016u64, 2818571648u64, 2826959488u64,
|
|
||||||
2835349376u64, 2843734144u64, 2852121472u64, 2860514432u64, 2868900992u64,
|
|
||||||
2877286784u64, 2885676928u64, 2894069632u64, 2902451584u64, 2910843008u64,
|
|
||||||
2919234688u64, 2927622784u64, 2936011648u64, 2944400768u64, 2952789376u64,
|
|
||||||
2961177728u64, 2969565568u64, 2977951616u64, 2986338944u64, 2994731392u64,
|
|
||||||
3003120256u64, 3011508352u64, 3019895936u64, 3028287104u64, 3036675968u64,
|
|
||||||
3045063808u64, 3053452928u64, 3061837696u64, 3070228352u64, 3078615424u64,
|
|
||||||
3087003776u64, 3095394944u64, 3103782272u64, 3112173184u64, 3120562048u64,
|
|
||||||
3128944768u64, 3137339264u64, 3145725056u64, 3154109312u64, 3162505088u64,
|
|
||||||
3170893184u64, 3179280256u64, 3187669376u64, 3196056704u64, 3204445568u64,
|
|
||||||
3212836736u64, 3221224064u64, 3229612928u64, 3238002304u64, 3246391168u64,
|
|
||||||
3254778496u64, 3263165824u64, 3271556224u64, 3279944576u64, 3288332416u64,
|
|
||||||
3296719232u64, 3305110912u64, 3313500032u64, 3321887104u64, 3330273152u64,
|
|
||||||
3338658944u64, 3347053184u64, 3355440512u64, 3363827072u64, 3372220288u64,
|
|
||||||
3380608384u64, 3388997504u64, 3397384576u64, 3405774208u64, 3414163072u64,
|
|
||||||
3422551936u64, 3430937984u64, 3439328384u64, 3447714176u64, 3456104576u64,
|
|
||||||
3464493952u64, 3472883584u64, 3481268864u64, 3489655168u64, 3498048896u64,
|
|
||||||
3506434432u64, 3514826368u64, 3523213952u64, 3531603584u64, 3539987072u64,
|
|
||||||
3548380288u64, 3556763264u64, 3565157248u64, 3573545344u64, 3581934464u64,
|
|
||||||
3590324096u64, 3598712704u64, 3607098752u64, 3615488384u64, 3623877248u64,
|
|
||||||
3632265856u64, 3640646528u64, 3649043584u64, 3657430144u64, 3665821568u64,
|
|
||||||
3674207872u64, 3682597504u64, 3690984832u64, 3699367808u64, 3707764352u64,
|
|
||||||
3716152448u64, 3724541056u64, 3732925568u64, 3741318016u64, 3749706368u64,
|
|
||||||
3758091136u64, 3766481536u64, 3774872704u64, 3783260032u64, 3791650432u64,
|
|
||||||
3800036224u64, 3808427648u64, 3816815488u64, 3825204608u64, 3833592704u64,
|
|
||||||
3841981568u64, 3850370432u64, 3858755968u64, 3867147904u64, 3875536256u64,
|
|
||||||
3883920512u64, 3892313728u64, 3900702592u64, 3909087872u64, 3917478784u64,
|
|
||||||
3925868416u64, 3934256512u64, 3942645376u64, 3951032192u64, 3959422336u64,
|
|
||||||
3967809152u64, 3976200064u64, 3984588416u64, 3992974976u64, 4001363584u64,
|
|
||||||
4009751168u64, 4018141312u64, 4026530432u64, 4034911616u64, 4043308928u64,
|
|
||||||
4051695488u64, 4060084352u64, 4068472448u64, 4076862848u64, 4085249408u64,
|
|
||||||
4093640576u64, 4102028416u64, 4110413696u64, 4118805632u64, 4127194496u64,
|
|
||||||
4135583104u64, 4143971968u64, 4152360832u64, 4160746112u64, 4169135744u64,
|
|
||||||
4177525888u64, 4185912704u64, 4194303616u64, 4202691968u64, 4211076736u64,
|
|
||||||
4219463552u64, 4227855488u64, 4236246656u64, 4244633728u64, 4253022848u64,
|
|
||||||
4261412224u64, 4269799808u64, 4278184832u64, 4286578048u64, 4294962304u64,
|
|
||||||
4303349632u64, 4311743104u64, 4320130432u64, 4328521088u64, 4336909184u64,
|
|
||||||
4345295488u64, 4353687424u64, 4362073472u64, 4370458496u64, 4378852736u64,
|
|
||||||
4387238528u64, 4395630208u64, 4404019072u64, 4412407424u64, 4420790656u64,
|
|
||||||
4429182848u64, 4437571456u64, 4445962112u64, 4454344064u64, 4462738048u64,
|
|
||||||
4471119232u64, 4479516544u64, 4487904128u64, 4496289664u64, 4504682368u64,
|
|
||||||
4513068416u64, 4521459584u64, 4529846144u64, 4538232704u64, 4546619776u64,
|
|
||||||
4555010176u64, 4563402112u64, 4571790208u64, 4580174464u64, 4588567936u64,
|
|
||||||
4596957056u64, 4605344896u64, 4613734016u64, 4622119808u64, 4630511488u64,
|
|
||||||
4638898816u64, 4647287936u64, 4655675264u64, 4664065664u64, 4672451968u64,
|
|
||||||
4680842624u64, 4689231488u64, 4697620352u64, 4706007424u64, 4714397056u64,
|
|
||||||
4722786176u64, 4731173248u64, 4739562368u64, 4747951744u64, 4756340608u64,
|
|
||||||
4764727936u64, 4773114496u64, 4781504384u64, 4789894784u64, 4798283648u64,
|
|
||||||
4806667648u64, 4815059584u64, 4823449472u64, 4831835776u64, 4840226176u64,
|
|
||||||
4848612224u64, 4857003392u64, 4865391488u64, 4873780096u64, 4882169728u64,
|
|
||||||
4890557312u64, 4898946944u64, 4907333248u64, 4915722368u64, 4924110976u64,
|
|
||||||
4932499328u64, 4940889728u64, 4949276032u64, 4957666432u64, 4966054784u64,
|
|
||||||
4974438016u64, 4982831488u64, 4991221376u64, 4999607168u64, 5007998848u64,
|
|
||||||
5016386432u64, 5024763776u64, 5033164672u64, 5041544576u64, 5049941888u64,
|
|
||||||
5058329728u64, 5066717056u64, 5075107456u64, 5083494272u64, 5091883904u64,
|
|
||||||
5100273536u64, 5108662144u64, 5117048192u64, 5125436032u64, 5133827456u64,
|
|
||||||
5142215296u64, 5150605184u64, 5158993024u64, 5167382144u64, 5175769472u64,
|
|
||||||
5184157568u64, 5192543872u64, 5200936064u64, 5209324928u64, 5217711232u64,
|
|
||||||
5226102656u64, 5234490496u64, 5242877312u64, 5251263872u64, 5259654016u64,
|
|
||||||
5268040832u64, 5276434304u64, 5284819328u64, 5293209728u64, 5301598592u64,
|
|
||||||
5309986688u64, 5318374784u64, 5326764416u64, 5335151488u64, 5343542144u64,
|
|
||||||
5351929472u64, 5360319872u64, 5368706944u64, 5377096576u64, 5385484928u64,
|
|
||||||
5393871232u64, 5402263424u64, 5410650496u64, 5419040384u64, 5427426944u64,
|
|
||||||
5435816576u64, 5444205952u64, 5452594816u64, 5460981376u64, 5469367936u64,
|
|
||||||
5477760896u64, 5486148736u64, 5494536832u64, 5502925952u64, 5511315328u64,
|
|
||||||
5519703424u64, 5528089984u64, 5536481152u64, 5544869504u64, 5553256064u64,
|
|
||||||
5561645696u64, 5570032768u64, 5578423936u64, 5586811264u64, 5595193216u64,
|
|
||||||
5603585408u64, 5611972736u64, 5620366208u64, 5628750464u64, 5637143936u64,
|
|
||||||
5645528192u64, 5653921408u64, 5662310272u64, 5670694784u64, 5679082624u64,
|
|
||||||
5687474048u64, 5695864448u64, 5704251008u64, 5712641408u64, 5721030272u64,
|
|
||||||
5729416832u64, 5737806208u64, 5746194304u64, 5754583936u64, 5762969984u64,
|
|
||||||
5771358592u64, 5779748224u64, 5788137856u64, 5796527488u64, 5804911232u64,
|
|
||||||
5813300608u64, 5821692544u64, 5830082176u64, 5838468992u64, 5846855552u64,
|
|
||||||
5855247488u64, 5863636096u64, 5872024448u64, 5880411008u64, 5888799872u64,
|
|
||||||
5897186432u64, 5905576832u64, 5913966976u64, 5922352768u64, 5930744704u64,
|
|
||||||
5939132288u64, 5947522432u64, 5955911296u64, 5964299392u64, 5972688256u64,
|
|
||||||
5981074304u64, 5989465472u64, 5997851008u64, 6006241408u64, 6014627968u64,
|
|
||||||
6023015552u64, 6031408256u64, 6039796096u64, 6048185216u64, 6056574848u64,
|
|
||||||
6064963456u64, 6073351808u64, 6081736064u64, 6090128768u64, 6098517632u64,
|
|
||||||
6106906496u64, 6115289216u64, 6123680896u64, 6132070016u64, 6140459648u64,
|
|
||||||
6148849024u64, 6157237376u64, 6165624704u64, 6174009728u64, 6182403712u64,
|
|
||||||
6190792064u64, 6199176064u64, 6207569792u64, 6215952256u64, 6224345216u64,
|
|
||||||
6232732544u64, 6241124224u64, 6249510272u64, 6257899136u64, 6266287744u64,
|
|
||||||
6274676864u64, 6283065728u64, 6291454336u64, 6299843456u64, 6308232064u64,
|
|
||||||
6316620928u64, 6325006208u64, 6333395584u64, 6341784704u64, 6350174848u64,
|
|
||||||
6358562176u64, 6366951296u64, 6375337856u64, 6383729536u64, 6392119168u64,
|
|
||||||
6400504192u64, 6408895616u64, 6417283456u64, 6425673344u64, 6434059136u64,
|
|
||||||
6442444672u64, 6450837376u64, 6459223424u64, 6467613056u64, 6476004224u64,
|
|
||||||
6484393088u64, 6492781952u64, 6501170048u64, 6509555072u64, 6517947008u64,
|
|
||||||
6526336384u64, 6534725504u64, 6543112832u64, 6551500672u64, 6559888768u64,
|
|
||||||
6568278656u64, 6576662912u64, 6585055616u64, 6593443456u64, 6601834112u64,
|
|
||||||
6610219648u64, 6618610304u64, 6626999168u64, 6635385472u64, 6643777408u64,
|
|
||||||
6652164224u64, 6660552832u64, 6668941952u64, 6677330048u64, 6685719424u64,
|
|
||||||
6694107776u64, 6702493568u64, 6710882176u64, 6719274112u64, 6727662976u64,
|
|
||||||
6736052096u64, 6744437632u64, 6752825984u64, 6761213824u64, 6769604224u64,
|
|
||||||
6777993856u64, 6786383488u64, 6794770816u64, 6803158144u64, 6811549312u64,
|
|
||||||
6819937664u64, 6828326528u64, 6836706176u64, 6845101696u64, 6853491328u64,
|
|
||||||
6861880448u64, 6870269312u64, 6878655104u64, 6887046272u64, 6895433344u64,
|
|
||||||
6903822208u64, 6912212864u64, 6920596864u64, 6928988288u64, 6937377152u64,
|
|
||||||
6945764992u64, 6954149248u64, 6962544256u64, 6970928768u64, 6979317376u64,
|
|
||||||
6987709312u64, 6996093824u64, 7004487296u64, 7012875392u64, 7021258624u64,
|
|
||||||
7029652352u64, 7038038912u64, 7046427776u64, 7054818944u64, 7063207808u64,
|
|
||||||
7071595136u64, 7079980928u64, 7088372608u64, 7096759424u64, 7105149824u64,
|
|
||||||
7113536896u64, 7121928064u64, 7130315392u64, 7138699648u64, 7147092352u64,
|
|
||||||
7155479168u64, 7163865728u64, 7172249984u64, 7180648064u64, 7189036672u64,
|
|
||||||
7197424768u64, 7205810816u64, 7214196608u64, 7222589824u64, 7230975104u64,
|
|
||||||
7239367552u64, 7247755904u64, 7256145536u64, 7264533376u64, 7272921472u64,
|
|
||||||
7281308032u64, 7289694848u64, 7298088832u64, 7306471808u64, 7314864512u64,
|
|
||||||
7323253888u64, 7331643008u64, 7340029568u64, 7348419712u64, 7356808832u64,
|
|
||||||
7365196672u64, 7373585792u64, 7381973888u64, 7390362752u64, 7398750592u64,
|
|
||||||
7407138944u64, 7415528576u64, 7423915648u64, 7432302208u64, 7440690304u64,
|
|
||||||
7449080192u64, 7457472128u64, 7465860992u64, 7474249088u64, 7482635648u64,
|
|
||||||
7491023744u64, 7499412608u64, 7507803008u64, 7516192384u64, 7524579968u64,
|
|
||||||
7532967296u64, 7541358464u64, 7549745792u64, 7558134656u64, 7566524032u64,
|
|
||||||
7574912896u64, 7583300992u64, 7591690112u64, 7600075136u64, 7608466816u64,
|
|
||||||
7616854912u64, 7625244544u64, 7633629824u64, 7642020992u64, 7650410368u64,
|
|
||||||
7658794112u64, 7667187328u64, 7675574912u64, 7683961984u64, 7692349568u64,
|
|
||||||
7700739712u64, 7709130368u64, 7717519232u64, 7725905536u64, 7734295424u64,
|
|
||||||
7742683264u64, 7751069056u64, 7759457408u64, 7767849088u64, 7776238208u64,
|
|
||||||
7784626816u64, 7793014912u64, 7801405312u64, 7809792128u64, 7818179968u64,
|
|
||||||
7826571136u64, 7834957184u64, 7843347328u64, 7851732352u64, 7860124544u64,
|
|
||||||
7868512384u64, 7876902016u64, 7885287808u64, 7893679744u64, 7902067072u64,
|
|
||||||
7910455936u64, 7918844288u64, 7927230848u64, 7935622784u64, 7944009344u64,
|
|
||||||
7952400256u64, 7960786048u64, 7969176704u64, 7977565312u64, 7985953408u64,
|
|
||||||
7994339968u64, 8002730368u64, 8011119488u64, 8019508096u64, 8027896192u64,
|
|
||||||
8036285056u64, 8044674688u64, 8053062272u64, 8061448832u64, 8069838464u64,
|
|
||||||
8078227328u64, 8086616704u64, 8095006592u64, 8103393664u64, 8111783552u64,
|
|
||||||
8120171392u64, 8128560256u64, 8136949376u64, 8145336704u64, 8153726848u64,
|
|
||||||
8162114944u64, 8170503296u64, 8178891904u64, 8187280768u64, 8195669632u64,
|
|
||||||
8204058496u64, 8212444544u64, 8220834176u64, 8229222272u64, 8237612672u64,
|
|
||||||
8246000768u64, 8254389376u64, 8262775168u64, 8271167104u64, 8279553664u64,
|
|
||||||
8287944064u64, 8296333184u64, 8304715136u64, 8313108352u64, 8321497984u64,
|
|
||||||
8329885568u64, 8338274432u64, 8346663296u64, 8355052928u64, 8363441536u64,
|
|
||||||
8371828352u64, 8380217984u64, 8388606592u64, 8396996224u64, 8405384576u64,
|
|
||||||
8413772672u64, 8422161536u64, 8430549376u64, 8438939008u64, 8447326592u64,
|
|
||||||
8455715456u64, 8464104832u64, 8472492928u64, 8480882048u64, 8489270656u64,
|
|
||||||
8497659776u64, 8506045312u64, 8514434944u64, 8522823808u64, 8531208832u64,
|
|
||||||
8539602304u64, 8547990656u64, 8556378752u64, 8564768384u64, 8573154176u64,
|
|
||||||
8581542784u64, 8589933952u64, 8598322816u64, 8606705024u64, 8615099264u64,
|
|
||||||
8623487872u64, 8631876992u64, 8640264064u64, 8648653952u64, 8657040256u64,
|
|
||||||
8665430656u64, 8673820544u64, 8682209152u64, 8690592128u64, 8698977152u64,
|
|
||||||
8707374464u64, 8715763328u64, 8724151424u64, 8732540032u64, 8740928384u64,
|
|
||||||
8749315712u64, 8757704576u64, 8766089344u64, 8774480768u64, 8782871936u64,
|
|
||||||
8791260032u64, 8799645824u64, 8808034432u64, 8816426368u64, 8824812928u64,
|
|
||||||
8833199488u64, 8841591424u64, 8849976448u64, 8858366336u64, 8866757248u64,
|
|
||||||
8875147136u64, 8883532928u64, 8891923328u64, 8900306816u64, 8908700288u64,
|
|
||||||
8917088384u64, 8925478784u64, 8933867392u64, 8942250368u64, 8950644608u64,
|
|
||||||
8959032704u64, 8967420544u64, 8975809664u64, 8984197504u64, 8992584064u64,
|
|
||||||
9000976256u64, 9009362048u64, 9017752448u64, 9026141312u64, 9034530688u64,
|
|
||||||
9042917504u64, 9051307904u64, 9059694208u64, 9068084864u64, 9076471424u64,
|
|
||||||
9084861824u64, 9093250688u64, 9101638528u64, 9110027648u64, 9118416512u64,
|
|
||||||
9126803584u64, 9135188096u64, 9143581312u64, 9151969664u64, 9160356224u64,
|
|
||||||
9168747136u64, 9177134464u64, 9185525632u64, 9193910144u64, 9202302848u64,
|
|
||||||
9210690688u64, 9219079552u64, 9227465344u64, 9235854464u64, 9244244864u64,
|
|
||||||
9252633472u64, 9261021824u64, 9269411456u64, 9277799296u64, 9286188928u64,
|
|
||||||
9294574208u64, 9302965888u64, 9311351936u64, 9319740032u64, 9328131968u64,
|
|
||||||
9336516736u64, 9344907392u64, 9353296768u64, 9361685888u64, 9370074752u64,
|
|
||||||
9378463616u64, 9386849408u64, 9395239808u64, 9403629184u64, 9412016512u64,
|
|
||||||
9420405376u64, 9428795008u64, 9437181568u64, 9445570688u64, 9453960832u64,
|
|
||||||
9462346624u64, 9470738048u64, 9479121536u64, 9487515008u64, 9495903616u64,
|
|
||||||
9504289664u64, 9512678528u64, 9521067904u64, 9529456256u64, 9537843584u64,
|
|
||||||
9546233728u64, 9554621312u64, 9563011456u64, 9571398784u64, 9579788672u64,
|
|
||||||
9588178304u64, 9596567168u64, 9604954496u64, 9613343104u64, 9621732992u64,
|
|
||||||
9630121856u64, 9638508416u64, 9646898816u64, 9655283584u64, 9663675776u64,
|
|
||||||
9672061312u64, 9680449664u64, 9688840064u64, 9697230464u64, 9705617536u64,
|
|
||||||
9714003584u64, 9722393984u64, 9730772608u64, 9739172224u64, 9747561088u64,
|
|
||||||
9755945344u64, 9764338816u64, 9772726144u64, 9781116544u64, 9789503872u64,
|
|
||||||
9797892992u64, 9806282624u64, 9814670464u64, 9823056512u64, 9831439232u64,
|
|
||||||
9839833984u64, 9848224384u64, 9856613504u64, 9865000576u64, 9873391232u64,
|
|
||||||
9881772416u64, 9890162816u64, 9898556288u64, 9906940544u64, 9915333248u64,
|
|
||||||
9923721088u64, 9932108672u64, 9940496512u64, 9948888448u64, 9957276544u64,
|
|
||||||
9965666176u64, 9974048384u64, 9982441088u64, 9990830464u64, 9999219584u64,
|
|
||||||
10007602816u64, 10015996544u64, 10024385152u64, 10032774016u64, 10041163648u64,
|
|
||||||
10049548928u64, 10057940096u64, 10066329472u64, 10074717824u64, 10083105152u64,
|
|
||||||
10091495296u64, 10099878784u64, 10108272256u64, 10116660608u64, 10125049216u64,
|
|
||||||
10133437312u64, 10141825664u64, 10150213504u64, 10158601088u64, 10166991232u64,
|
|
||||||
10175378816u64, 10183766144u64, 10192157312u64, 10200545408u64, 10208935552u64,
|
|
||||||
10217322112u64, 10225712768u64, 10234099328u64, 10242489472u64, 10250876032u64,
|
|
||||||
10259264896u64, 10267656064u64, 10276042624u64, 10284429184u64, 10292820352u64,
|
|
||||||
10301209472u64, 10309598848u64, 10317987712u64, 10326375296u64, 10334763392u64,
|
|
||||||
10343153536u64, 10351541632u64, 10359930752u64, 10368318592u64, 10376707456u64,
|
|
||||||
10385096576u64, 10393484672u64, 10401867136u64, 10410262144u64, 10418647424u64,
|
|
||||||
10427039104u64, 10435425664u64, 10443810176u64, 10452203648u64, 10460589952u64,
|
|
||||||
10468982144u64, 10477369472u64, 10485759104u64, 10494147712u64, 10502533504u64,
|
|
||||||
10510923392u64, 10519313536u64, 10527702656u64, 10536091264u64, 10544478592u64,
|
|
||||||
10552867712u64, 10561255808u64, 10569642368u64, 10578032768u64, 10586423168u64,
|
|
||||||
10594805632u64, 10603200128u64, 10611588992u64, 10619976064u64, 10628361344u64,
|
|
||||||
10636754048u64, 10645143424u64, 10653531776u64, 10661920384u64, 10670307968u64,
|
|
||||||
10678696832u64, 10687086464u64, 10695475072u64, 10703863168u64, 10712246144u64,
|
|
||||||
10720639616u64, 10729026688u64, 10737414784u64, 10745806208u64, 10754190976u64,
|
|
||||||
10762581376u64, 10770971264u64, 10779356288u64, 10787747456u64, 10796135552u64,
|
|
||||||
10804525184u64, 10812915584u64, 10821301888u64, 10829692288u64, 10838078336u64,
|
|
||||||
10846469248u64, 10854858368u64, 10863247232u64, 10871631488u64, 10880023424u64,
|
|
||||||
10888412032u64, 10896799616u64, 10905188992u64, 10913574016u64, 10921964672u64,
|
|
||||||
10930352768u64, 10938742912u64, 10947132544u64, 10955518592u64, 10963909504u64,
|
|
||||||
10972298368u64, 10980687488u64, 10989074816u64, 10997462912u64, 11005851776u64,
|
|
||||||
11014241152u64, 11022627712u64, 11031017344u64, 11039403904u64, 11047793024u64,
|
|
||||||
11056184704u64, 11064570752u64, 11072960896u64, 11081343872u64, 11089737856u64,
|
|
||||||
11098128256u64, 11106514816u64, 11114904448u64, 11123293568u64, 11131680128u64,
|
|
||||||
11140065152u64, 11148458368u64, 11156845696u64, 11165236864u64, 11173624192u64,
|
|
||||||
11182013824u64, 11190402688u64, 11198790784u64, 11207179136u64, 11215568768u64,
|
|
||||||
11223957376u64, 11232345728u64, 11240734592u64, 11249122688u64, 11257511296u64,
|
|
||||||
11265899648u64, 11274285952u64, 11282675584u64, 11291065472u64, 11299452544u64,
|
|
||||||
11307842432u64, 11316231296u64, 11324616832u64, 11333009024u64, 11341395584u64,
|
|
||||||
11349782656u64, 11358172288u64, 11366560384u64, 11374950016u64, 11383339648u64,
|
|
||||||
11391721856u64, 11400117376u64, 11408504192u64, 11416893568u64, 11425283456u64,
|
|
||||||
11433671552u64, 11442061184u64, 11450444672u64, 11458837888u64, 11467226752u64,
|
|
||||||
11475611776u64, 11484003968u64, 11492392064u64, 11500780672u64, 11509169024u64,
|
|
||||||
11517550976u64, 11525944448u64, 11534335616u64, 11542724224u64, 11551111808u64,
|
|
||||||
11559500672u64, 11567890304u64, 11576277376u64, 11584667008u64, 11593056128u64,
|
|
||||||
11601443456u64, 11609830016u64, 11618221952u64, 11626607488u64, 11634995072u64,
|
|
||||||
11643387776u64, 11651775104u64, 11660161664u64, 11668552576u64, 11676940928u64,
|
|
||||||
11685330304u64, 11693718656u64, 11702106496u64, 11710496128u64, 11718882688u64,
|
|
||||||
11727273088u64, 11735660416u64, 11744050048u64, 11752437376u64, 11760824704u64,
|
|
||||||
11769216128u64, 11777604736u64, 11785991296u64, 11794381952u64, 11802770048u64,
|
|
||||||
11811157888u64, 11819548544u64, 11827932544u64, 11836324736u64, 11844713344u64,
|
|
||||||
11853100928u64, 11861486464u64, 11869879936u64, 11878268032u64, 11886656896u64,
|
|
||||||
11895044992u64, 11903433088u64, 11911822976u64, 11920210816u64, 11928600448u64,
|
|
||||||
11936987264u64, 11945375872u64, 11953761152u64, 11962151296u64, 11970543488u64,
|
|
||||||
11978928512u64, 11987320448u64, 11995708288u64, 12004095104u64, 12012486272u64,
|
|
||||||
12020875136u64, 12029255552u64, 12037652096u64, 12046039168u64, 12054429568u64,
|
|
||||||
12062813824u64, 12071206528u64, 12079594624u64, 12087983744u64, 12096371072u64,
|
|
||||||
12104759936u64, 12113147264u64, 12121534592u64, 12129924992u64, 12138314624u64,
|
|
||||||
12146703232u64, 12155091584u64, 12163481216u64, 12171864704u64, 12180255872u64,
|
|
||||||
12188643968u64, 12197034112u64, 12205424512u64, 12213811328u64, 12222199424u64,
|
|
||||||
12230590336u64, 12238977664u64, 12247365248u64, 12255755392u64, 12264143488u64,
|
|
||||||
12272531584u64, 12280920448u64, 12289309568u64, 12297694592u64, 12306086528u64,
|
|
||||||
12314475392u64, 12322865024u64, 12331253632u64, 12339640448u64, 12348029312u64,
|
|
||||||
12356418944u64, 12364805248u64, 12373196672u64, 12381580928u64, 12389969024u64,
|
|
||||||
12398357632u64, 12406750592u64, 12415138432u64, 12423527552u64, 12431916416u64,
|
|
||||||
12440304512u64, 12448692352u64, 12457081216u64, 12465467776u64, 12473859968u64,
|
|
||||||
12482245504u64, 12490636672u64, 12499025536u64, 12507411584u64, 12515801728u64,
|
|
||||||
12524190592u64, 12532577152u64, 12540966272u64, 12549354368u64, 12557743232u64,
|
|
||||||
12566129536u64, 12574523264u64, 12582911872u64, 12591299456u64, 12599688064u64,
|
|
||||||
12608074624u64, 12616463488u64, 12624845696u64, 12633239936u64, 12641631616u64,
|
|
||||||
12650019968u64, 12658407296u64, 12666795136u64, 12675183232u64, 12683574656u64,
|
|
||||||
12691960192u64, 12700350592u64, 12708740224u64, 12717128576u64, 12725515904u64,
|
|
||||||
12733906816u64, 12742295168u64, 12750680192u64, 12759071872u64, 12767460736u64,
|
|
||||||
12775848832u64, 12784236928u64, 12792626816u64, 12801014656u64, 12809404288u64,
|
|
||||||
12817789312u64, 12826181504u64, 12834568832u64, 12842954624u64, 12851345792u64,
|
|
||||||
12859732352u64, 12868122496u64, 12876512128u64, 12884901248u64, 12893289088u64,
|
|
||||||
12901672832u64, 12910067584u64, 12918455168u64, 12926842496u64, 12935232896u64,
|
|
||||||
12943620736u64, 12952009856u64, 12960396928u64, 12968786816u64, 12977176192u64,
|
|
||||||
12985563776u64, 12993951104u64, 13002341504u64, 13010730368u64, 13019115392u64,
|
|
||||||
13027506304u64, 13035895168u64, 13044272512u64, 13052673152u64, 13061062528u64,
|
|
||||||
13069446272u64, 13077838976u64, 13086227072u64, 13094613632u64, 13103000192u64,
|
|
||||||
13111393664u64, 13119782528u64, 13128157568u64, 13136559232u64, 13144945024u64,
|
|
||||||
13153329536u64, 13161724288u64, 13170111872u64, 13178502784u64, 13186884736u64,
|
|
||||||
13195279744u64, 13203667072u64, 13212057472u64, 13220445824u64, 13228832128u64,
|
|
||||||
13237221248u64, 13245610624u64, 13254000512u64, 13262388352u64, 13270777472u64,
|
|
||||||
13279166336u64, 13287553408u64, 13295943296u64, 13304331904u64, 13312719488u64,
|
|
||||||
13321108096u64, 13329494656u64, 13337885824u64, 13346274944u64, 13354663808u64,
|
|
||||||
13363051136u64, 13371439232u64, 13379825024u64, 13388210816u64, 13396605056u64,
|
|
||||||
13404995456u64, 13413380224u64, 13421771392u64, 13430159744u64, 13438546048u64,
|
|
||||||
13446937216u64, 13455326848u64, 13463708288u64, 13472103808u64, 13480492672u64,
|
|
||||||
13488875648u64, 13497269888u64, 13505657728u64, 13514045312u64, 13522435712u64,
|
|
||||||
13530824576u64, 13539210112u64, 13547599232u64, 13555989376u64, 13564379008u64,
|
|
||||||
13572766336u64, 13581154432u64, 13589544832u64, 13597932928u64, 13606320512u64,
|
|
||||||
13614710656u64, 13623097472u64, 13631477632u64, 13639874944u64, 13648264064u64,
|
|
||||||
13656652928u64, 13665041792u64, 13673430656u64, 13681818496u64, 13690207616u64,
|
|
||||||
13698595712u64, 13706982272u64, 13715373184u64, 13723762048u64, 13732150144u64,
|
|
||||||
13740536704u64, 13748926592u64, 13757316224u64, 13765700992u64, 13774090112u64,
|
|
||||||
13782477952u64, 13790869376u64, 13799259008u64, 13807647872u64, 13816036736u64,
|
|
||||||
13824425344u64, 13832814208u64, 13841202304u64, 13849591424u64, 13857978752u64,
|
|
||||||
13866368896u64, 13874754688u64, 13883145344u64, 13891533184u64, 13899919232u64,
|
|
||||||
13908311168u64, 13916692096u64, 13925085056u64, 13933473152u64, 13941866368u64,
|
|
||||||
13950253696u64, 13958643584u64, 13967032192u64, 13975417216u64, 13983807616u64,
|
|
||||||
13992197504u64, 14000582272u64, 14008973696u64, 14017363072u64, 14025752192u64,
|
|
||||||
14034137984u64, 14042528384u64, 14050918016u64, 14059301504u64, 14067691648u64,
|
|
||||||
14076083584u64, 14084470144u64, 14092852352u64, 14101249664u64, 14109635968u64,
|
|
||||||
14118024832u64, 14126407552u64, 14134804352u64, 14143188608u64, 14151577984u64,
|
|
||||||
14159968384u64, 14168357248u64, 14176741504u64, 14185127296u64, 14193521024u64,
|
|
||||||
14201911424u64, 14210301824u64, 14218685056u64, 14227067264u64, 14235467392u64,
|
|
||||||
14243855488u64, 14252243072u64, 14260630144u64, 14269021568u64, 14277409408u64,
|
|
||||||
14285799296u64, 14294187904u64, 14302571392u64, 14310961792u64, 14319353728u64,
|
|
||||||
14327738752u64, 14336130944u64, 14344518784u64, 14352906368u64, 14361296512u64,
|
|
||||||
14369685376u64, 14378071424u64, 14386462592u64, 14394848128u64, 14403230848u64,
|
|
||||||
14411627392u64, 14420013952u64, 14428402304u64, 14436793472u64, 14445181568u64,
|
|
||||||
14453569664u64, 14461959808u64, 14470347904u64, 14478737024u64, 14487122816u64,
|
|
||||||
14495511424u64, 14503901824u64, 14512291712u64, 14520677504u64, 14529064832u64,
|
|
||||||
14537456768u64, 14545845632u64, 14554234496u64, 14562618496u64, 14571011456u64,
|
|
||||||
14579398784u64, 14587789184u64, 14596172672u64, 14604564608u64, 14612953984u64,
|
|
||||||
14621341312u64, 14629724288u64, 14638120832u64, 14646503296u64, 14654897536u64,
|
|
||||||
14663284864u64, 14671675264u64, 14680061056u64, 14688447616u64, 14696835968u64,
|
|
||||||
14705228416u64, 14713616768u64, 14722003328u64, 14730392192u64, 14738784128u64,
|
|
||||||
14747172736u64, 14755561088u64, 14763947648u64, 14772336512u64, 14780725376u64,
|
|
||||||
14789110144u64, 14797499776u64, 14805892736u64, 14814276992u64, 14822670208u64,
|
|
||||||
14831056256u64, 14839444352u64, 14847836032u64, 14856222848u64, 14864612992u64,
|
|
||||||
14872997504u64, 14881388672u64, 14889775744u64, 14898165376u64, 14906553472u64,
|
|
||||||
14914944896u64, 14923329664u64, 14931721856u64, 14940109696u64, 14948497024u64,
|
|
||||||
14956887424u64, 14965276544u64, 14973663616u64, 14982053248u64, 14990439808u64,
|
|
||||||
14998830976u64, 15007216768u64, 15015605888u64, 15023995264u64, 15032385152u64,
|
|
||||||
15040768384u64, 15049154944u64, 15057549184u64, 15065939072u64, 15074328448u64,
|
|
||||||
15082715008u64, 15091104128u64, 15099493504u64, 15107879296u64, 15116269184u64,
|
|
||||||
15124659584u64, 15133042304u64, 15141431936u64, 15149824384u64, 15158214272u64,
|
|
||||||
15166602368u64, 15174991232u64, 15183378304u64, 15191760512u64, 15200154496u64,
|
|
||||||
15208542592u64, 15216931712u64, 15225323392u64, 15233708416u64, 15242098048u64,
|
|
||||||
15250489216u64, 15258875264u64, 15267265408u64, 15275654528u64, 15284043136u64,
|
|
||||||
15292431488u64, 15300819584u64, 15309208192u64, 15317596544u64, 15325986176u64,
|
|
||||||
15334374784u64, 15342763648u64, 15351151744u64, 15359540608u64, 15367929728u64,
|
|
||||||
15376318336u64, 15384706432u64, 15393092992u64, 15401481856u64, 15409869952u64,
|
|
||||||
15418258816u64, 15426649984u64, 15435037568u64, 15443425664u64, 15451815296u64,
|
|
||||||
15460203392u64, 15468589184u64, 15476979328u64, 15485369216u64, 15493755776u64,
|
|
||||||
15502146944u64, 15510534272u64, 15518924416u64, 15527311232u64, 15535699072u64,
|
|
||||||
15544089472u64, 15552478336u64, 15560866688u64, 15569254528u64, 15577642624u64,
|
|
||||||
15586031488u64, 15594419072u64, 15602809472u64, 15611199104u64, 15619586432u64,
|
|
||||||
15627975296u64, 15636364928u64, 15644753792u64, 15653141888u64, 15661529216u64,
|
|
||||||
15669918848u64, 15678305152u64, 15686696576u64, 15695083136u64, 15703474048u64,
|
|
||||||
15711861632u64, 15720251264u64, 15728636288u64, 15737027456u64, 15745417088u64,
|
|
||||||
15753804928u64, 15762194048u64, 15770582656u64, 15778971008u64, 15787358336u64,
|
|
||||||
15795747712u64, 15804132224u64, 15812523392u64, 15820909696u64, 15829300096u64,
|
|
||||||
15837691264u64, 15846071936u64, 15854466944u64, 15862855808u64, 15871244672u64,
|
|
||||||
15879634816u64, 15888020608u64, 15896409728u64, 15904799104u64, 15913185152u64,
|
|
||||||
15921577088u64, 15929966464u64, 15938354816u64, 15946743424u64, 15955129472u64,
|
|
||||||
15963519872u64, 15971907968u64, 15980296064u64, 15988684928u64, 15997073024u64,
|
|
||||||
16005460864u64, 16013851264u64, 16022241152u64, 16030629248u64, 16039012736u64,
|
|
||||||
16047406976u64, 16055794816u64, 16064181376u64, 16072571264u64, 16080957824u64,
|
|
||||||
16089346688u64, 16097737856u64, 16106125184u64, 16114514816u64, 16122904192u64,
|
|
||||||
16131292544u64, 16139678848u64, 16148066944u64, 16156453504u64, 16164839552u64,
|
|
||||||
16173236096u64, 16181623424u64, 16190012032u64, 16198401152u64, 16206790528u64,
|
|
||||||
16215177344u64, 16223567744u64, 16231956352u64, 16240344704u64, 16248731008u64,
|
|
||||||
16257117824u64, 16265504384u64, 16273898624u64, 16282281856u64, 16290668672u64,
|
|
||||||
16299064192u64, 16307449216u64, 16315842176u64, 16324230016u64, 16332613504u64,
|
|
||||||
16341006464u64, 16349394304u64, 16357783168u64, 16366172288u64, 16374561664u64,
|
|
||||||
16382951296u64, 16391337856u64, 16399726208u64, 16408116352u64, 16416505472u64,
|
|
||||||
16424892032u64, 16433282176u64, 16441668224u64, 16450058624u64, 16458448768u64,
|
|
||||||
16466836864u64, 16475224448u64, 16483613056u64, 16492001408u64, 16500391808u64,
|
|
||||||
16508779648u64, 16517166976u64, 16525555328u64, 16533944192u64, 16542330752u64,
|
|
||||||
16550719616u64, 16559110528u64, 16567497088u64, 16575888512u64, 16584274816u64,
|
|
||||||
16592665472u64, 16601051008u64, 16609442944u64, 16617832064u64, 16626218624u64,
|
|
||||||
16634607488u64, 16642996096u64, 16651385728u64, 16659773824u64, 16668163712u64,
|
|
||||||
16676552576u64, 16684938112u64, 16693328768u64, 16701718144u64, 16710095488u64,
|
|
||||||
16718492288u64, 16726883968u64, 16735272832u64, 16743661184u64, 16752049792u64,
|
|
||||||
16760436608u64, 16768827008u64, 16777214336u64, 16785599104u64, 16793992832u64,
|
|
||||||
16802381696u64, 16810768768u64, 16819151744u64, 16827542656u64, 16835934848u64,
|
|
||||||
16844323712u64, 16852711552u64, 16861101952u64, 16869489536u64, 16877876864u64,
|
|
||||||
16886265728u64, 16894653056u64, 16903044736u64, 16911431296u64, 16919821696u64,
|
|
||||||
16928207488u64, 16936592768u64, 16944987776u64, 16953375616u64, 16961763968u64,
|
|
||||||
16970152832u64, 16978540928u64, 16986929536u64, 16995319168u64, 17003704448u64,
|
|
||||||
17012096896u64, 17020481152u64, 17028870784u64, 17037262208u64, 17045649536u64,
|
|
||||||
17054039936u64, 17062426496u64, 17070814336u64, 17079205504u64, 17087592064u64,
|
|
||||||
17095978112u64, 17104369024u64, 17112759424u64, 17121147776u64, 17129536384u64,
|
|
||||||
17137926016u64, 17146314368u64, 17154700928u64, 17163089792u64, 17171480192u64,
|
|
||||||
17179864192u64, 17188256896u64, 17196644992u64, 17205033856u64, 17213423488u64,
|
|
||||||
17221811072u64, 17230198912u64, 17238588032u64, 17246976896u64, 17255360384u64,
|
|
||||||
17263754624u64, 17272143232u64, 17280530048u64, 17288918912u64, 17297309312u64,
|
|
||||||
17305696384u64, 17314085504u64, 17322475136u64, 17330863744u64, 17339252096u64,
|
|
||||||
17347640192u64, 17356026496u64, 17364413824u64, 17372796544u64, 17381190016u64,
|
|
||||||
17389583488u64, 17397972608u64, 17406360704u64, 17414748544u64, 17423135872u64,
|
|
||||||
17431527296u64, 17439915904u64, 17448303232u64, 17456691584u64, 17465081728u64,
|
|
||||||
17473468288u64, 17481857408u64, 17490247552u64, 17498635904u64, 17507022464u64,
|
|
||||||
17515409024u64, 17523801728u64, 17532189824u64, 17540577664u64, 17548966016u64,
|
|
||||||
17557353344u64, 17565741184u64, 17574131584u64, 17582519168u64, 17590907008u64,
|
|
||||||
17599296128u64, 17607687808u64, 17616076672u64, 17624455808u64, 17632852352u64,
|
|
||||||
17641238656u64, 17649630848u64, 17658018944u64, 17666403968u64, 17674794112u64,
|
|
||||||
17683178368u64, 17691573376u64, 17699962496u64, 17708350592u64, 17716739968u64,
|
|
||||||
17725126528u64, 17733517184u64, 17741898112u64, 17750293888u64, 17758673024u64,
|
|
||||||
17767070336u64, 17775458432u64, 17783848832u64, 17792236928u64, 17800625536u64,
|
|
||||||
17809012352u64, 17817402752u64, 17825785984u64, 17834178944u64, 17842563968u64,
|
|
||||||
17850955648u64, 17859344512u64, 17867732864u64, 17876119424u64, 17884511872u64,
|
|
||||||
17892900224u64, 17901287296u64, 17909677696u64, 17918058112u64, 17926451072u64,
|
|
||||||
17934843776u64, 17943230848u64, 17951609216u64, 17960008576u64, 17968397696u64,
|
|
||||||
17976784256u64, 17985175424u64, 17993564032u64, 18001952128u64, 18010339712u64,
|
|
||||||
18018728576u64, 18027116672u64, 18035503232u64, 18043894144u64, 18052283264u64,
|
|
||||||
18060672128u64, 18069056384u64, 18077449856u64, 18085837184u64, 18094225792u64,
|
|
||||||
18102613376u64, 18111004544u64, 18119388544u64, 18127781248u64, 18136170368u64,
|
|
||||||
18144558976u64, 18152947328u64, 18161336192u64, 18169724288u64, 18178108544u64,
|
|
||||||
18186498944u64, 18194886784u64, 18203275648u64, 18211666048u64, 18220048768u64,
|
|
||||||
18228444544u64, 18236833408u64, 18245220736u64
|
|
||||||
];
|
|
||||||
|
|
||||||
// Generated with the following Mathematica Code:
|
|
||||||
|
|
||||||
// GetCacheSizes[n_] := Module[{
|
|
||||||
// DataSetSizeBytesInit = 2^30,
|
|
||||||
// MixBytes = 128,
|
|
||||||
// DataSetGrowth = 2^23,
|
|
||||||
// HashBytes = 64,
|
|
||||||
// CacheMultiplier = 1024,
|
|
||||||
// j = 0},
|
|
||||||
// Reap[
|
|
||||||
// While[j < n,
|
|
||||||
// Module[{i = Floor[(DataSetSizeBytesInit + DataSetGrowth * j) / (CacheMultiplier * HashBytes)]},
|
|
||||||
// While[! PrimeQ[i], i--];
|
|
||||||
// Sow[i*HashBytes]; j++]]]][[2]][[1]]
|
|
||||||
pub const CACHE_SIZES: [u64; 2048] = [
|
|
||||||
16776896u64, 16907456u64, 17039296u64, 17170112u64, 17301056u64, 17432512u64, 17563072u64,
|
|
||||||
17693888u64, 17824192u64, 17955904u64, 18087488u64, 18218176u64, 18349504u64, 18481088u64,
|
|
||||||
18611392u64, 18742336u64, 18874304u64, 19004224u64, 19135936u64, 19267264u64, 19398208u64,
|
|
||||||
19529408u64, 19660096u64, 19791424u64, 19922752u64, 20053952u64, 20184896u64, 20315968u64,
|
|
||||||
20446912u64, 20576576u64, 20709184u64, 20840384u64, 20971072u64, 21102272u64, 21233216u64,
|
|
||||||
21364544u64, 21494848u64, 21626816u64, 21757376u64, 21887552u64, 22019392u64, 22151104u64,
|
|
||||||
22281536u64, 22412224u64, 22543936u64, 22675264u64, 22806464u64, 22935872u64, 23068096u64,
|
|
||||||
23198272u64, 23330752u64, 23459008u64, 23592512u64, 23723968u64, 23854912u64, 23986112u64,
|
|
||||||
24116672u64, 24247616u64, 24378688u64, 24509504u64, 24640832u64, 24772544u64, 24903488u64,
|
|
||||||
25034432u64, 25165376u64, 25296704u64, 25427392u64, 25558592u64, 25690048u64, 25820096u64,
|
|
||||||
25951936u64, 26081728u64, 26214208u64, 26345024u64, 26476096u64, 26606656u64, 26737472u64,
|
|
||||||
26869184u64, 26998208u64, 27131584u64, 27262528u64, 27393728u64, 27523904u64, 27655744u64,
|
|
||||||
27786688u64, 27917888u64, 28049344u64, 28179904u64, 28311488u64, 28441792u64, 28573504u64,
|
|
||||||
28700864u64, 28835648u64, 28966208u64, 29096768u64, 29228608u64, 29359808u64, 29490752u64,
|
|
||||||
29621824u64, 29752256u64, 29882816u64, 30014912u64, 30144448u64, 30273728u64, 30406976u64,
|
|
||||||
30538432u64, 30670784u64, 30799936u64, 30932672u64, 31063744u64, 31195072u64, 31325248u64,
|
|
||||||
31456192u64, 31588288u64, 31719232u64, 31850432u64, 31981504u64, 32110784u64, 32243392u64,
|
|
||||||
32372672u64, 32505664u64, 32636608u64, 32767808u64, 32897344u64, 33029824u64, 33160768u64,
|
|
||||||
33289664u64, 33423296u64, 33554368u64, 33683648u64, 33816512u64, 33947456u64, 34076992u64,
|
|
||||||
34208704u64, 34340032u64, 34471744u64, 34600256u64, 34734016u64, 34864576u64, 34993984u64,
|
|
||||||
35127104u64, 35258176u64, 35386688u64, 35518528u64, 35650624u64, 35782336u64, 35910976u64,
|
|
||||||
36044608u64, 36175808u64, 36305728u64, 36436672u64, 36568384u64, 36699968u64, 36830656u64,
|
|
||||||
36961984u64, 37093312u64, 37223488u64, 37355072u64, 37486528u64, 37617472u64, 37747904u64,
|
|
||||||
37879232u64, 38009792u64, 38141888u64, 38272448u64, 38403392u64, 38535104u64, 38660672u64,
|
|
||||||
38795584u64, 38925632u64, 39059264u64, 39190336u64, 39320768u64, 39452096u64, 39581632u64,
|
|
||||||
39713984u64, 39844928u64, 39974848u64, 40107968u64, 40238144u64, 40367168u64, 40500032u64,
|
|
||||||
40631744u64, 40762816u64, 40894144u64, 41023552u64, 41155904u64, 41286208u64, 41418304u64,
|
|
||||||
41547712u64, 41680448u64, 41811904u64, 41942848u64, 42073792u64, 42204992u64, 42334912u64,
|
|
||||||
42467008u64, 42597824u64, 42729152u64, 42860096u64, 42991552u64, 43122368u64, 43253696u64,
|
|
||||||
43382848u64, 43515712u64, 43646912u64, 43777088u64, 43907648u64, 44039104u64, 44170432u64,
|
|
||||||
44302144u64, 44433344u64, 44564288u64, 44694976u64, 44825152u64, 44956864u64, 45088448u64,
|
|
||||||
45219008u64, 45350464u64, 45481024u64, 45612608u64, 45744064u64, 45874496u64, 46006208u64,
|
|
||||||
46136768u64, 46267712u64, 46399424u64, 46529344u64, 46660672u64, 46791488u64, 46923328u64,
|
|
||||||
47053504u64, 47185856u64, 47316928u64, 47447872u64, 47579072u64, 47710144u64, 47839936u64,
|
|
||||||
47971648u64, 48103232u64, 48234176u64, 48365248u64, 48496192u64, 48627136u64, 48757312u64,
|
|
||||||
48889664u64, 49020736u64, 49149248u64, 49283008u64, 49413824u64, 49545152u64, 49675712u64,
|
|
||||||
49807168u64, 49938368u64, 50069056u64, 50200256u64, 50331584u64, 50462656u64, 50593472u64,
|
|
||||||
50724032u64, 50853952u64, 50986048u64, 51117632u64, 51248576u64, 51379904u64, 51510848u64,
|
|
||||||
51641792u64, 51773248u64, 51903296u64, 52035136u64, 52164032u64, 52297664u64, 52427968u64,
|
|
||||||
52557376u64, 52690112u64, 52821952u64, 52952896u64, 53081536u64, 53213504u64, 53344576u64,
|
|
||||||
53475776u64, 53608384u64, 53738816u64, 53870528u64, 54000832u64, 54131776u64, 54263744u64,
|
|
||||||
54394688u64, 54525248u64, 54655936u64, 54787904u64, 54918592u64, 55049152u64, 55181248u64,
|
|
||||||
55312064u64, 55442752u64, 55574336u64, 55705024u64, 55836224u64, 55967168u64, 56097856u64,
|
|
||||||
56228672u64, 56358592u64, 56490176u64, 56621888u64, 56753728u64, 56884928u64, 57015488u64,
|
|
||||||
57146816u64, 57278272u64, 57409216u64, 57540416u64, 57671104u64, 57802432u64, 57933632u64,
|
|
||||||
58064576u64, 58195264u64, 58326976u64, 58457408u64, 58588864u64, 58720192u64, 58849984u64,
|
|
||||||
58981696u64, 59113024u64, 59243456u64, 59375552u64, 59506624u64, 59637568u64, 59768512u64,
|
|
||||||
59897792u64, 60030016u64, 60161984u64, 60293056u64, 60423872u64, 60554432u64, 60683968u64,
|
|
||||||
60817216u64, 60948032u64, 61079488u64, 61209664u64, 61341376u64, 61471936u64, 61602752u64,
|
|
||||||
61733696u64, 61865792u64, 61996736u64, 62127808u64, 62259136u64, 62389568u64, 62520512u64,
|
|
||||||
62651584u64, 62781632u64, 62910784u64, 63045056u64, 63176128u64, 63307072u64, 63438656u64,
|
|
||||||
63569216u64, 63700928u64, 63831616u64, 63960896u64, 64093888u64, 64225088u64, 64355392u64,
|
|
||||||
64486976u64, 64617664u64, 64748608u64, 64879424u64, 65009216u64, 65142464u64, 65273792u64,
|
|
||||||
65402816u64, 65535424u64, 65666752u64, 65797696u64, 65927744u64, 66060224u64, 66191296u64,
|
|
||||||
66321344u64, 66453056u64, 66584384u64, 66715328u64, 66846656u64, 66977728u64, 67108672u64,
|
|
||||||
67239104u64, 67370432u64, 67501888u64, 67631296u64, 67763776u64, 67895104u64, 68026304u64,
|
|
||||||
68157248u64, 68287936u64, 68419264u64, 68548288u64, 68681408u64, 68811968u64, 68942912u64,
|
|
||||||
69074624u64, 69205568u64, 69337024u64, 69467584u64, 69599168u64, 69729472u64, 69861184u64,
|
|
||||||
69989824u64, 70122944u64, 70253888u64, 70385344u64, 70515904u64, 70647232u64, 70778816u64,
|
|
||||||
70907968u64, 71040832u64, 71171648u64, 71303104u64, 71432512u64, 71564992u64, 71695168u64,
|
|
||||||
71826368u64, 71958464u64, 72089536u64, 72219712u64, 72350144u64, 72482624u64, 72613568u64,
|
|
||||||
72744512u64, 72875584u64, 73006144u64, 73138112u64, 73268672u64, 73400128u64, 73530944u64,
|
|
||||||
73662272u64, 73793344u64, 73924544u64, 74055104u64, 74185792u64, 74316992u64, 74448832u64,
|
|
||||||
74579392u64, 74710976u64, 74841664u64, 74972864u64, 75102784u64, 75233344u64, 75364544u64,
|
|
||||||
75497024u64, 75627584u64, 75759296u64, 75890624u64, 76021696u64, 76152256u64, 76283072u64,
|
|
||||||
76414144u64, 76545856u64, 76676672u64, 76806976u64, 76937792u64, 77070016u64, 77200832u64,
|
|
||||||
77331392u64, 77462464u64, 77593664u64, 77725376u64, 77856448u64, 77987776u64, 78118336u64,
|
|
||||||
78249664u64, 78380992u64, 78511424u64, 78642496u64, 78773056u64, 78905152u64, 79033664u64,
|
|
||||||
79166656u64, 79297472u64, 79429568u64, 79560512u64, 79690816u64, 79822784u64, 79953472u64,
|
|
||||||
80084672u64, 80214208u64, 80346944u64, 80477632u64, 80608576u64, 80740288u64, 80870848u64,
|
|
||||||
81002048u64, 81133504u64, 81264448u64, 81395648u64, 81525952u64, 81657536u64, 81786304u64,
|
|
||||||
81919808u64, 82050112u64, 82181312u64, 82311616u64, 82443968u64, 82573376u64, 82705984u64,
|
|
||||||
82835776u64, 82967744u64, 83096768u64, 83230528u64, 83359552u64, 83491264u64, 83622464u64,
|
|
||||||
83753536u64, 83886016u64, 84015296u64, 84147776u64, 84277184u64, 84409792u64, 84540608u64,
|
|
||||||
84672064u64, 84803008u64, 84934336u64, 85065152u64, 85193792u64, 85326784u64, 85458496u64,
|
|
||||||
85589312u64, 85721024u64, 85851968u64, 85982656u64, 86112448u64, 86244416u64, 86370112u64,
|
|
||||||
86506688u64, 86637632u64, 86769344u64, 86900672u64, 87031744u64, 87162304u64, 87293632u64,
|
|
||||||
87424576u64, 87555392u64, 87687104u64, 87816896u64, 87947968u64, 88079168u64, 88211264u64,
|
|
||||||
88341824u64, 88473152u64, 88603712u64, 88735424u64, 88862912u64, 88996672u64, 89128384u64,
|
|
||||||
89259712u64, 89390272u64, 89521984u64, 89652544u64, 89783872u64, 89914816u64, 90045376u64,
|
|
||||||
90177088u64, 90307904u64, 90438848u64, 90569152u64, 90700096u64, 90832832u64, 90963776u64,
|
|
||||||
91093696u64, 91223744u64, 91356992u64, 91486784u64, 91618496u64, 91749824u64, 91880384u64,
|
|
||||||
92012224u64, 92143552u64, 92273344u64, 92405696u64, 92536768u64, 92666432u64, 92798912u64,
|
|
||||||
92926016u64, 93060544u64, 93192128u64, 93322816u64, 93453632u64, 93583936u64, 93715136u64,
|
|
||||||
93845056u64, 93977792u64, 94109504u64, 94240448u64, 94371776u64, 94501184u64, 94632896u64,
|
|
||||||
94764224u64, 94895552u64, 95023424u64, 95158208u64, 95287744u64, 95420224u64, 95550016u64,
|
|
||||||
95681216u64, 95811904u64, 95943872u64, 96075328u64, 96203584u64, 96337856u64, 96468544u64,
|
|
||||||
96599744u64, 96731072u64, 96860992u64, 96992576u64, 97124288u64, 97254848u64, 97385536u64,
|
|
||||||
97517248u64, 97647808u64, 97779392u64, 97910464u64, 98041408u64, 98172608u64, 98303168u64,
|
|
||||||
98434496u64, 98565568u64, 98696768u64, 98827328u64, 98958784u64, 99089728u64, 99220928u64,
|
|
||||||
99352384u64, 99482816u64, 99614272u64, 99745472u64, 99876416u64, 100007104u64,
|
|
||||||
100138048u64, 100267072u64, 100401088u64, 100529984u64, 100662592u64, 100791872u64,
|
|
||||||
100925248u64, 101056064u64, 101187392u64, 101317952u64, 101449408u64, 101580608u64,
|
|
||||||
101711296u64, 101841728u64, 101973824u64, 102104896u64, 102235712u64, 102366016u64,
|
|
||||||
102498112u64, 102628672u64, 102760384u64, 102890432u64, 103021888u64, 103153472u64,
|
|
||||||
103284032u64, 103415744u64, 103545152u64, 103677248u64, 103808576u64, 103939648u64,
|
|
||||||
104070976u64, 104201792u64, 104332736u64, 104462528u64, 104594752u64, 104725952u64,
|
|
||||||
104854592u64, 104988608u64, 105118912u64, 105247808u64, 105381184u64, 105511232u64,
|
|
||||||
105643072u64, 105774784u64, 105903296u64, 106037056u64, 106167872u64, 106298944u64,
|
|
||||||
106429504u64, 106561472u64, 106691392u64, 106822592u64, 106954304u64, 107085376u64,
|
|
||||||
107216576u64, 107346368u64, 107478464u64, 107609792u64, 107739712u64, 107872192u64,
|
|
||||||
108003136u64, 108131392u64, 108265408u64, 108396224u64, 108527168u64, 108657344u64,
|
|
||||||
108789568u64, 108920384u64, 109049792u64, 109182272u64, 109312576u64, 109444928u64,
|
|
||||||
109572928u64, 109706944u64, 109837888u64, 109969088u64, 110099648u64, 110230976u64,
|
|
||||||
110362432u64, 110492992u64, 110624704u64, 110755264u64, 110886208u64, 111017408u64,
|
|
||||||
111148864u64, 111279296u64, 111410752u64, 111541952u64, 111673024u64, 111803456u64,
|
|
||||||
111933632u64, 112066496u64, 112196416u64, 112328512u64, 112457792u64, 112590784u64,
|
|
||||||
112715968u64, 112852672u64, 112983616u64, 113114944u64, 113244224u64, 113376448u64,
|
|
||||||
113505472u64, 113639104u64, 113770304u64, 113901376u64, 114031552u64, 114163264u64,
|
|
||||||
114294592u64, 114425536u64, 114556864u64, 114687424u64, 114818624u64, 114948544u64,
|
|
||||||
115080512u64, 115212224u64, 115343296u64, 115473472u64, 115605184u64, 115736128u64,
|
|
||||||
115867072u64, 115997248u64, 116128576u64, 116260288u64, 116391488u64, 116522944u64,
|
|
||||||
116652992u64, 116784704u64, 116915648u64, 117046208u64, 117178304u64, 117308608u64,
|
|
||||||
117440192u64, 117569728u64, 117701824u64, 117833024u64, 117964096u64, 118094656u64,
|
|
||||||
118225984u64, 118357312u64, 118489024u64, 118617536u64, 118749632u64, 118882112u64,
|
|
||||||
119012416u64, 119144384u64, 119275328u64, 119406016u64, 119537344u64, 119668672u64,
|
|
||||||
119798464u64, 119928896u64, 120061376u64, 120192832u64, 120321728u64, 120454336u64,
|
|
||||||
120584512u64, 120716608u64, 120848192u64, 120979136u64, 121109056u64, 121241408u64,
|
|
||||||
121372352u64, 121502912u64, 121634752u64, 121764416u64, 121895744u64, 122027072u64,
|
|
||||||
122157632u64, 122289088u64, 122421184u64, 122550592u64, 122682944u64, 122813888u64,
|
|
||||||
122945344u64, 123075776u64, 123207488u64, 123338048u64, 123468736u64, 123600704u64,
|
|
||||||
123731264u64, 123861952u64, 123993664u64, 124124608u64, 124256192u64, 124386368u64,
|
|
||||||
124518208u64, 124649024u64, 124778048u64, 124911296u64, 125041088u64, 125173696u64,
|
|
||||||
125303744u64, 125432896u64, 125566912u64, 125696576u64, 125829056u64, 125958592u64,
|
|
||||||
126090304u64, 126221248u64, 126352832u64, 126483776u64, 126615232u64, 126746432u64,
|
|
||||||
126876608u64, 127008704u64, 127139392u64, 127270336u64, 127401152u64, 127532224u64,
|
|
||||||
127663552u64, 127794752u64, 127925696u64, 128055232u64, 128188096u64, 128319424u64,
|
|
||||||
128449856u64, 128581312u64, 128712256u64, 128843584u64, 128973632u64, 129103808u64,
|
|
||||||
129236288u64, 129365696u64, 129498944u64, 129629888u64, 129760832u64, 129892288u64,
|
|
||||||
130023104u64, 130154048u64, 130283968u64, 130416448u64, 130547008u64, 130678336u64,
|
|
||||||
130807616u64, 130939456u64, 131071552u64, 131202112u64, 131331776u64, 131464384u64,
|
|
||||||
131594048u64, 131727296u64, 131858368u64, 131987392u64, 132120256u64, 132250816u64,
|
|
||||||
132382528u64, 132513728u64, 132644672u64, 132774976u64, 132905792u64, 133038016u64,
|
|
||||||
133168832u64, 133299392u64, 133429312u64, 133562048u64, 133692992u64, 133823296u64,
|
|
||||||
133954624u64, 134086336u64, 134217152u64, 134348608u64, 134479808u64, 134607296u64,
|
|
||||||
134741056u64, 134872384u64, 135002944u64, 135134144u64, 135265472u64, 135396544u64,
|
|
||||||
135527872u64, 135659072u64, 135787712u64, 135921472u64, 136052416u64, 136182848u64,
|
|
||||||
136313792u64, 136444864u64, 136576448u64, 136707904u64, 136837952u64, 136970048u64,
|
|
||||||
137099584u64, 137232064u64, 137363392u64, 137494208u64, 137625536u64, 137755712u64,
|
|
||||||
137887424u64, 138018368u64, 138149824u64, 138280256u64, 138411584u64, 138539584u64,
|
|
||||||
138672832u64, 138804928u64, 138936128u64, 139066688u64, 139196864u64, 139328704u64,
|
|
||||||
139460032u64, 139590208u64, 139721024u64, 139852864u64, 139984576u64, 140115776u64,
|
|
||||||
140245696u64, 140376512u64, 140508352u64, 140640064u64, 140769856u64, 140902336u64,
|
|
||||||
141032768u64, 141162688u64, 141294016u64, 141426496u64, 141556544u64, 141687488u64,
|
|
||||||
141819584u64, 141949888u64, 142080448u64, 142212544u64, 142342336u64, 142474432u64,
|
|
||||||
142606144u64, 142736192u64, 142868288u64, 142997824u64, 143129408u64, 143258944u64,
|
|
||||||
143392448u64, 143523136u64, 143653696u64, 143785024u64, 143916992u64, 144045632u64,
|
|
||||||
144177856u64, 144309184u64, 144440768u64, 144570688u64, 144701888u64, 144832448u64,
|
|
||||||
144965056u64, 145096384u64, 145227584u64, 145358656u64, 145489856u64, 145620928u64,
|
|
||||||
145751488u64, 145883072u64, 146011456u64, 146144704u64, 146275264u64, 146407232u64,
|
|
||||||
146538176u64, 146668736u64, 146800448u64, 146931392u64, 147062336u64, 147193664u64,
|
|
||||||
147324224u64, 147455936u64, 147586624u64, 147717056u64, 147848768u64, 147979456u64,
|
|
||||||
148110784u64, 148242368u64, 148373312u64, 148503232u64, 148635584u64, 148766144u64,
|
|
||||||
148897088u64, 149028416u64, 149159488u64, 149290688u64, 149420224u64, 149551552u64,
|
|
||||||
149683136u64, 149814976u64, 149943616u64, 150076352u64, 150208064u64, 150338624u64,
|
|
||||||
150470464u64, 150600256u64, 150732224u64, 150862784u64, 150993088u64, 151125952u64,
|
|
||||||
151254976u64, 151388096u64, 151519168u64, 151649728u64, 151778752u64, 151911104u64,
|
|
||||||
152042944u64, 152174144u64, 152304704u64, 152435648u64, 152567488u64, 152698816u64,
|
|
||||||
152828992u64, 152960576u64, 153091648u64, 153222976u64, 153353792u64, 153484096u64,
|
|
||||||
153616192u64, 153747008u64, 153878336u64, 154008256u64, 154139968u64, 154270912u64,
|
|
||||||
154402624u64, 154533824u64, 154663616u64, 154795712u64, 154926272u64, 155057984u64,
|
|
||||||
155188928u64, 155319872u64, 155450816u64, 155580608u64, 155712064u64, 155843392u64,
|
|
||||||
155971136u64, 156106688u64, 156237376u64, 156367424u64, 156499264u64, 156630976u64,
|
|
||||||
156761536u64, 156892352u64, 157024064u64, 157155008u64, 157284416u64, 157415872u64,
|
|
||||||
157545536u64, 157677248u64, 157810496u64, 157938112u64, 158071744u64, 158203328u64,
|
|
||||||
158334656u64, 158464832u64, 158596288u64, 158727616u64, 158858048u64, 158988992u64,
|
|
||||||
159121216u64, 159252416u64, 159381568u64, 159513152u64, 159645632u64, 159776192u64,
|
|
||||||
159906496u64, 160038464u64, 160169536u64, 160300352u64, 160430656u64, 160563008u64,
|
|
||||||
160693952u64, 160822208u64, 160956352u64, 161086784u64, 161217344u64, 161349184u64,
|
|
||||||
161480512u64, 161611456u64, 161742272u64, 161873216u64, 162002752u64, 162135872u64,
|
|
||||||
162266432u64, 162397888u64, 162529216u64, 162660032u64, 162790976u64, 162922048u64,
|
|
||||||
163052096u64, 163184576u64, 163314752u64, 163446592u64, 163577408u64, 163707968u64,
|
|
||||||
163839296u64, 163969984u64, 164100928u64, 164233024u64, 164364224u64, 164494912u64,
|
|
||||||
164625856u64, 164756672u64, 164887616u64, 165019072u64, 165150016u64, 165280064u64,
|
|
||||||
165412672u64, 165543104u64, 165674944u64, 165805888u64, 165936832u64, 166067648u64,
|
|
||||||
166198336u64, 166330048u64, 166461248u64, 166591552u64, 166722496u64, 166854208u64,
|
|
||||||
166985408u64, 167116736u64, 167246656u64, 167378368u64, 167508416u64, 167641024u64,
|
|
||||||
167771584u64, 167903168u64, 168034112u64, 168164032u64, 168295744u64, 168427456u64,
|
|
||||||
168557632u64, 168688448u64, 168819136u64, 168951616u64, 169082176u64, 169213504u64,
|
|
||||||
169344832u64, 169475648u64, 169605952u64, 169738048u64, 169866304u64, 169999552u64,
|
|
||||||
170131264u64, 170262464u64, 170393536u64, 170524352u64, 170655424u64, 170782016u64,
|
|
||||||
170917696u64, 171048896u64, 171179072u64, 171310784u64, 171439936u64, 171573184u64,
|
|
||||||
171702976u64, 171835072u64, 171966272u64, 172097216u64, 172228288u64, 172359232u64,
|
|
||||||
172489664u64, 172621376u64, 172747712u64, 172883264u64, 173014208u64, 173144512u64,
|
|
||||||
173275072u64, 173407424u64, 173539136u64, 173669696u64, 173800768u64, 173931712u64,
|
|
||||||
174063424u64, 174193472u64, 174325696u64, 174455744u64, 174586816u64, 174718912u64,
|
|
||||||
174849728u64, 174977728u64, 175109696u64, 175242688u64, 175374272u64, 175504832u64,
|
|
||||||
175636288u64, 175765696u64, 175898432u64, 176028992u64, 176159936u64, 176291264u64,
|
|
||||||
176422592u64, 176552512u64, 176684864u64, 176815424u64, 176946496u64, 177076544u64,
|
|
||||||
177209152u64, 177340096u64, 177470528u64, 177600704u64, 177731648u64, 177864256u64,
|
|
||||||
177994816u64, 178126528u64, 178257472u64, 178387648u64, 178518464u64, 178650176u64,
|
|
||||||
178781888u64, 178912064u64, 179044288u64, 179174848u64, 179305024u64, 179436736u64,
|
|
||||||
179568448u64, 179698496u64, 179830208u64, 179960512u64, 180092608u64, 180223808u64,
|
|
||||||
180354752u64, 180485696u64, 180617152u64, 180748096u64, 180877504u64, 181009984u64,
|
|
||||||
181139264u64, 181272512u64, 181402688u64, 181532608u64, 181663168u64, 181795136u64,
|
|
||||||
181926592u64, 182057536u64, 182190016u64, 182320192u64, 182451904u64, 182582336u64,
|
|
||||||
182713792u64, 182843072u64, 182976064u64, 183107264u64, 183237056u64, 183368384u64,
|
|
||||||
183494848u64, 183631424u64, 183762752u64, 183893824u64, 184024768u64, 184154816u64,
|
|
||||||
184286656u64, 184417984u64, 184548928u64, 184680128u64, 184810816u64, 184941248u64,
|
|
||||||
185072704u64, 185203904u64, 185335616u64, 185465408u64, 185596352u64, 185727296u64,
|
|
||||||
185859904u64, 185989696u64, 186121664u64, 186252992u64, 186383552u64, 186514112u64,
|
|
||||||
186645952u64, 186777152u64, 186907328u64, 187037504u64, 187170112u64, 187301824u64,
|
|
||||||
187429184u64, 187562048u64, 187693504u64, 187825472u64, 187957184u64, 188087104u64,
|
|
||||||
188218304u64, 188349376u64, 188481344u64, 188609728u64, 188743616u64, 188874304u64,
|
|
||||||
189005248u64, 189136448u64, 189265088u64, 189396544u64, 189528128u64, 189660992u64,
|
|
||||||
189791936u64, 189923264u64, 190054208u64, 190182848u64, 190315072u64, 190447424u64,
|
|
||||||
190577984u64, 190709312u64, 190840768u64, 190971328u64, 191102656u64, 191233472u64,
|
|
||||||
191364032u64, 191495872u64, 191626816u64, 191758016u64, 191888192u64, 192020288u64,
|
|
||||||
192148928u64, 192282176u64, 192413504u64, 192542528u64, 192674752u64, 192805952u64,
|
|
||||||
192937792u64, 193068608u64, 193198912u64, 193330496u64, 193462208u64, 193592384u64,
|
|
||||||
193723456u64, 193854272u64, 193985984u64, 194116672u64, 194247232u64, 194379712u64,
|
|
||||||
194508352u64, 194641856u64, 194772544u64, 194900672u64, 195035072u64, 195166016u64,
|
|
||||||
195296704u64, 195428032u64, 195558592u64, 195690304u64, 195818176u64, 195952576u64,
|
|
||||||
196083392u64, 196214336u64, 196345792u64, 196476736u64, 196607552u64, 196739008u64,
|
|
||||||
196869952u64, 197000768u64, 197130688u64, 197262784u64, 197394368u64, 197523904u64,
|
|
||||||
197656384u64, 197787584u64, 197916608u64, 198049472u64, 198180544u64, 198310208u64,
|
|
||||||
198442432u64, 198573632u64, 198705088u64, 198834368u64, 198967232u64, 199097792u64,
|
|
||||||
199228352u64, 199360192u64, 199491392u64, 199621696u64, 199751744u64, 199883968u64,
|
|
||||||
200014016u64, 200146624u64, 200276672u64, 200408128u64, 200540096u64, 200671168u64,
|
|
||||||
200801984u64, 200933312u64, 201062464u64, 201194944u64, 201326144u64, 201457472u64,
|
|
||||||
201588544u64, 201719744u64, 201850816u64, 201981632u64, 202111552u64, 202244032u64,
|
|
||||||
202374464u64, 202505152u64, 202636352u64, 202767808u64, 202898368u64, 203030336u64,
|
|
||||||
203159872u64, 203292608u64, 203423296u64, 203553472u64, 203685824u64, 203816896u64,
|
|
||||||
203947712u64, 204078272u64, 204208192u64, 204341056u64, 204472256u64, 204603328u64,
|
|
||||||
204733888u64, 204864448u64, 204996544u64, 205125568u64, 205258304u64, 205388864u64,
|
|
||||||
205517632u64, 205650112u64, 205782208u64, 205913536u64, 206044736u64, 206176192u64,
|
|
||||||
206307008u64, 206434496u64, 206569024u64, 206700224u64, 206831168u64, 206961856u64,
|
|
||||||
207093056u64, 207223616u64, 207355328u64, 207486784u64, 207616832u64, 207749056u64,
|
|
||||||
207879104u64, 208010048u64, 208141888u64, 208273216u64, 208404032u64, 208534336u64,
|
|
||||||
208666048u64, 208796864u64, 208927424u64, 209059264u64, 209189824u64, 209321792u64,
|
|
||||||
209451584u64, 209582656u64, 209715136u64, 209845568u64, 209976896u64, 210106432u64,
|
|
||||||
210239296u64, 210370112u64, 210501568u64, 210630976u64, 210763712u64, 210894272u64,
|
|
||||||
211024832u64, 211156672u64, 211287616u64, 211418176u64, 211549376u64, 211679296u64,
|
|
||||||
211812032u64, 211942592u64, 212074432u64, 212204864u64, 212334016u64, 212467648u64,
|
|
||||||
212597824u64, 212727616u64, 212860352u64, 212991424u64, 213120832u64, 213253952u64,
|
|
||||||
213385024u64, 213515584u64, 213645632u64, 213777728u64, 213909184u64, 214040128u64,
|
|
||||||
214170688u64, 214302656u64, 214433728u64, 214564544u64, 214695232u64, 214826048u64,
|
|
||||||
214956992u64, 215089088u64, 215219776u64, 215350592u64, 215482304u64, 215613248u64,
|
|
||||||
215743552u64, 215874752u64, 216005312u64, 216137024u64, 216267328u64, 216399296u64,
|
|
||||||
216530752u64, 216661696u64, 216790592u64, 216923968u64, 217054528u64, 217183168u64,
|
|
||||||
217316672u64, 217448128u64, 217579072u64, 217709504u64, 217838912u64, 217972672u64,
|
|
||||||
218102848u64, 218233024u64, 218364736u64, 218496832u64, 218627776u64, 218759104u64,
|
|
||||||
218888896u64, 219021248u64, 219151936u64, 219281728u64, 219413056u64, 219545024u64,
|
|
||||||
219675968u64, 219807296u64, 219938624u64, 220069312u64, 220200128u64, 220331456u64,
|
|
||||||
220461632u64, 220592704u64, 220725184u64, 220855744u64, 220987072u64, 221117888u64,
|
|
||||||
221249216u64, 221378368u64, 221510336u64, 221642048u64, 221772736u64, 221904832u64,
|
|
||||||
222031808u64, 222166976u64, 222297536u64, 222428992u64, 222559936u64, 222690368u64,
|
|
||||||
222820672u64, 222953152u64, 223083968u64, 223213376u64, 223345984u64, 223476928u64,
|
|
||||||
223608512u64, 223738688u64, 223869376u64, 224001472u64, 224132672u64, 224262848u64,
|
|
||||||
224394944u64, 224524864u64, 224657344u64, 224788288u64, 224919488u64, 225050432u64,
|
|
||||||
225181504u64, 225312704u64, 225443776u64, 225574592u64, 225704768u64, 225834176u64,
|
|
||||||
225966784u64, 226097216u64, 226229824u64, 226360384u64, 226491712u64, 226623424u64,
|
|
||||||
226754368u64, 226885312u64, 227015104u64, 227147456u64, 227278528u64, 227409472u64,
|
|
||||||
227539904u64, 227669696u64, 227802944u64, 227932352u64, 228065216u64, 228196288u64,
|
|
||||||
228326464u64, 228457792u64, 228588736u64, 228720064u64, 228850112u64, 228981056u64,
|
|
||||||
229113152u64, 229243328u64, 229375936u64, 229505344u64, 229636928u64, 229769152u64,
|
|
||||||
229894976u64, 230030272u64, 230162368u64, 230292416u64, 230424512u64, 230553152u64,
|
|
||||||
230684864u64, 230816704u64, 230948416u64, 231079616u64, 231210944u64, 231342016u64,
|
|
||||||
231472448u64, 231603776u64, 231733952u64, 231866176u64, 231996736u64, 232127296u64,
|
|
||||||
232259392u64, 232388672u64, 232521664u64, 232652608u64, 232782272u64, 232914496u64,
|
|
||||||
233043904u64, 233175616u64, 233306816u64, 233438528u64, 233569984u64, 233699776u64,
|
|
||||||
233830592u64, 233962688u64, 234092224u64, 234221888u64, 234353984u64, 234485312u64,
|
|
||||||
234618304u64, 234749888u64, 234880832u64, 235011776u64, 235142464u64, 235274048u64,
|
|
||||||
235403456u64, 235535936u64, 235667392u64, 235797568u64, 235928768u64, 236057152u64,
|
|
||||||
236190272u64, 236322752u64, 236453312u64, 236583616u64, 236715712u64, 236846528u64,
|
|
||||||
236976448u64, 237108544u64, 237239104u64, 237371072u64, 237501632u64, 237630784u64,
|
|
||||||
237764416u64, 237895232u64, 238026688u64, 238157632u64, 238286912u64, 238419392u64,
|
|
||||||
238548032u64, 238681024u64, 238812608u64, 238941632u64, 239075008u64, 239206336u64,
|
|
||||||
239335232u64, 239466944u64, 239599168u64, 239730496u64, 239861312u64, 239992384u64,
|
|
||||||
240122816u64, 240254656u64, 240385856u64, 240516928u64, 240647872u64, 240779072u64,
|
|
||||||
240909632u64, 241040704u64, 241171904u64, 241302848u64, 241433408u64, 241565248u64,
|
|
||||||
241696192u64, 241825984u64, 241958848u64, 242088256u64, 242220224u64, 242352064u64,
|
|
||||||
242481856u64, 242611648u64, 242744896u64, 242876224u64, 243005632u64, 243138496u64,
|
|
||||||
243268672u64, 243400384u64, 243531712u64, 243662656u64, 243793856u64, 243924544u64,
|
|
||||||
244054592u64, 244187072u64, 244316608u64, 244448704u64, 244580032u64, 244710976u64,
|
|
||||||
244841536u64, 244972864u64, 245104448u64, 245233984u64, 245365312u64, 245497792u64,
|
|
||||||
245628736u64, 245759936u64, 245889856u64, 246021056u64, 246152512u64, 246284224u64,
|
|
||||||
246415168u64, 246545344u64, 246675904u64, 246808384u64, 246939584u64, 247070144u64,
|
|
||||||
247199552u64, 247331648u64, 247463872u64, 247593536u64, 247726016u64, 247857088u64,
|
|
||||||
247987648u64, 248116928u64, 248249536u64, 248380736u64, 248512064u64, 248643008u64,
|
|
||||||
248773312u64, 248901056u64, 249036608u64, 249167552u64, 249298624u64, 249429184u64,
|
|
||||||
249560512u64, 249692096u64, 249822784u64, 249954112u64, 250085312u64, 250215488u64,
|
|
||||||
250345792u64, 250478528u64, 250608704u64, 250739264u64, 250870976u64, 251002816u64,
|
|
||||||
251133632u64, 251263552u64, 251395136u64, 251523904u64, 251657792u64, 251789248u64,
|
|
||||||
251919424u64, 252051392u64, 252182464u64, 252313408u64, 252444224u64, 252575552u64,
|
|
||||||
252706624u64, 252836032u64, 252968512u64, 253099712u64, 253227584u64, 253361728u64,
|
|
||||||
253493056u64, 253623488u64, 253754432u64, 253885504u64, 254017216u64, 254148032u64,
|
|
||||||
254279488u64, 254410432u64, 254541376u64, 254672576u64, 254803264u64, 254933824u64,
|
|
||||||
255065792u64, 255196736u64, 255326528u64, 255458752u64, 255589952u64, 255721408u64,
|
|
||||||
255851072u64, 255983296u64, 256114624u64, 256244416u64, 256374208u64, 256507712u64,
|
|
||||||
256636096u64, 256768832u64, 256900544u64, 257031616u64, 257162176u64, 257294272u64,
|
|
||||||
257424448u64, 257555776u64, 257686976u64, 257818432u64, 257949632u64, 258079552u64,
|
|
||||||
258211136u64, 258342464u64, 258473408u64, 258603712u64, 258734656u64, 258867008u64,
|
|
||||||
258996544u64, 259127744u64, 259260224u64, 259391296u64, 259522112u64, 259651904u64,
|
|
||||||
259784384u64, 259915328u64, 260045888u64, 260175424u64, 260308544u64, 260438336u64,
|
|
||||||
260570944u64, 260700992u64, 260832448u64, 260963776u64, 261092672u64, 261226304u64,
|
|
||||||
261356864u64, 261487936u64, 261619648u64, 261750592u64, 261879872u64, 262011968u64,
|
|
||||||
262143424u64, 262274752u64, 262404416u64, 262537024u64, 262667968u64, 262799296u64,
|
|
||||||
262928704u64, 263061184u64, 263191744u64, 263322944u64, 263454656u64, 263585216u64,
|
|
||||||
263716672u64, 263847872u64, 263978944u64, 264108608u64, 264241088u64, 264371648u64,
|
|
||||||
264501184u64, 264632768u64, 264764096u64, 264895936u64, 265024576u64, 265158464u64,
|
|
||||||
265287488u64, 265418432u64, 265550528u64, 265681216u64, 265813312u64, 265943488u64,
|
|
||||||
266075968u64, 266206144u64, 266337728u64, 266468032u64, 266600384u64, 266731072u64,
|
|
||||||
266862272u64, 266993344u64, 267124288u64, 267255616u64, 267386432u64, 267516992u64,
|
|
||||||
267648704u64, 267777728u64, 267910592u64, 268040512u64, 268172096u64, 268302784u64,
|
|
||||||
268435264u64, 268566208u64, 268696256u64, 268828096u64, 268959296u64, 269090368u64,
|
|
||||||
269221312u64, 269352256u64, 269482688u64, 269614784u64, 269745856u64, 269876416u64,
|
|
||||||
270007616u64, 270139328u64, 270270272u64, 270401216u64, 270531904u64, 270663616u64,
|
|
||||||
270791744u64, 270924736u64, 271056832u64, 271186112u64, 271317184u64, 271449536u64,
|
|
||||||
271580992u64, 271711936u64, 271843136u64, 271973056u64, 272105408u64, 272236352u64,
|
|
||||||
272367296u64, 272498368u64, 272629568u64, 272759488u64, 272891456u64, 273022784u64,
|
|
||||||
273153856u64, 273284672u64, 273415616u64, 273547072u64, 273677632u64, 273808448u64,
|
|
||||||
273937088u64, 274071488u64, 274200896u64, 274332992u64, 274463296u64, 274595392u64,
|
|
||||||
274726208u64, 274857536u64, 274988992u64, 275118656u64, 275250496u64, 275382208u64,
|
|
||||||
275513024u64, 275643968u64, 275775296u64, 275906368u64, 276037184u64, 276167872u64,
|
|
||||||
276297664u64, 276429376u64, 276560576u64, 276692672u64, 276822976u64, 276955072u64,
|
|
||||||
277085632u64, 277216832u64, 277347008u64, 277478848u64, 277609664u64, 277740992u64,
|
|
||||||
277868608u64, 278002624u64, 278134336u64, 278265536u64, 278395328u64, 278526784u64,
|
|
||||||
278657728u64, 278789824u64, 278921152u64, 279052096u64, 279182912u64, 279313088u64,
|
|
||||||
279443776u64, 279576256u64, 279706048u64, 279838528u64, 279969728u64, 280099648u64,
|
|
||||||
280230976u64, 280361408u64, 280493632u64, 280622528u64, 280755392u64, 280887104u64,
|
|
||||||
281018176u64, 281147968u64, 281278912u64, 281411392u64, 281542592u64, 281673152u64,
|
|
||||||
281803712u64, 281935552u64, 282066496u64, 282197312u64, 282329024u64, 282458816u64,
|
|
||||||
282590272u64, 282720832u64, 282853184u64, 282983744u64, 283115072u64, 283246144u64,
|
|
||||||
283377344u64, 283508416u64, 283639744u64, 283770304u64, 283901504u64, 284032576u64,
|
|
||||||
284163136u64, 284294848u64, 284426176u64, 284556992u64, 284687296u64, 284819264u64,
|
|
||||||
284950208u64, 285081536u64
|
|
||||||
];
|
|
||||||
|
|
||||||
@@ -3,27 +3,52 @@ description = "Ethcore library"
|
|||||||
homepage = "http://ethcore.io"
|
homepage = "http://ethcore.io"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
name = "ethcore"
|
name = "ethcore"
|
||||||
version = "0.9.0"
|
version = "1.3.0"
|
||||||
authors = ["Ethcore <admin@ethcore.io>"]
|
authors = ["Ethcore <admin@ethcore.io>"]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
"ethcore-ipc-codegen" = { path = "../ipc/codegen" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
rocksdb = "0.3"
|
heapsize = "0.3"
|
||||||
heapsize = "0.2.0"
|
|
||||||
rust-crypto = "0.2.34"
|
rust-crypto = "0.2.34"
|
||||||
time = "0.1"
|
|
||||||
ethcore-util = { path = "../util" }
|
|
||||||
evmjit = { path = "../evmjit", optional = true }
|
|
||||||
ethash = { path = "../ethash" }
|
|
||||||
num_cpus = "0.2"
|
num_cpus = "0.2"
|
||||||
clippy = "0.0.37"
|
crossbeam = "0.2.9"
|
||||||
crossbeam = "0.1.5"
|
lazy_static = "0.2"
|
||||||
lazy_static = "0.1"
|
bloomchain = "0.1"
|
||||||
|
rayon = "0.4"
|
||||||
|
semver = "0.2"
|
||||||
|
bit-set = "0.4"
|
||||||
|
time = "0.1"
|
||||||
|
evmjit = { path = "../evmjit", optional = true }
|
||||||
|
clippy = { version = "0.0.80", optional = true}
|
||||||
|
ethash = { path = "../ethash" }
|
||||||
|
ethcore-util = { path = "../util" }
|
||||||
|
ethcore-io = { path = "../util/io" }
|
||||||
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
ethjson = { path = "../json" }
|
||||||
|
ethcore-ipc = { path = "../ipc/rpc" }
|
||||||
|
ethstore = { path = "../ethstore" }
|
||||||
|
ethcore-ipc-nano = { path = "../ipc/nano" }
|
||||||
|
rand = "0.3"
|
||||||
|
lru-cache = "0.0.7"
|
||||||
|
bloomfilter = { git = "https://github.com/ethcore/rust-bloom-filter" }
|
||||||
|
byteorder = "0.5"
|
||||||
|
|
||||||
|
[dependencies.hyper]
|
||||||
|
git = "https://github.com/ethcore/hyper"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
jit = ["evmjit"]
|
jit = ["evmjit"]
|
||||||
evm-debug = []
|
evm-debug = []
|
||||||
json-tests = []
|
json-tests = []
|
||||||
test-heavy = []
|
test-heavy = []
|
||||||
|
dev = ["clippy"]
|
||||||
|
default = []
|
||||||
|
benches = []
|
||||||
|
ipc = []
|
||||||
|
|||||||
23
ethcore/build.rs
Normal file
23
ethcore/build.rs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
extern crate ethcore_ipc_codegen;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
ethcore_ipc_codegen::derive_binary("src/types/mod.rs.in").unwrap();
|
||||||
|
ethcore_ipc_codegen::derive_ipc_cond("src/client/traits.rs", cfg!(feature="ipc")).unwrap();
|
||||||
|
ethcore_ipc_codegen::derive_ipc_cond("src/client/chain_notify.rs", cfg!(feature="ipc")).unwrap();
|
||||||
|
}
|
||||||
26736
ethcore/res/ethereum/classic.json
Normal file
26736
ethcore/res/ethereum/classic.json
Normal file
File diff suppressed because it is too large
Load Diff
47
ethcore/res/ethereum/eip150_test.json
Normal file
47
ethcore/res/ethereum/eip150_test.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "Homestead (Test)",
|
||||||
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x0",
|
||||||
|
"eip150Transition": "0x0",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x00",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x1"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x400000000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
|
||||||
|
"gasLimit": "0x1388"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
|
}
|
||||||
|
}
|
||||||
47
ethcore/res/ethereum/eip161_test.json
Normal file
47
ethcore/res/ethereum/eip161_test.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "Homestead (Test)",
|
||||||
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x0",
|
||||||
|
"eip150Transition": "0x0",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x0",
|
||||||
|
"eip161abcTransition": "0x0",
|
||||||
|
"eip161dTransition": "0x0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x00",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x1"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x400000000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
|
||||||
|
"gasLimit": "0x1388"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
|
}
|
||||||
|
}
|
||||||
74
ethcore/res/ethereum/expanse.json
Normal file
74
ethcore/res/ethereum/expanse.json
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"name": "Expanse",
|
||||||
|
"forkName": "expanse",
|
||||||
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"difficultyIncrementDivisor": "60",
|
||||||
|
"durationLimit": "0x3C",
|
||||||
|
"blockReward": "0x6f05b59d3b200000",
|
||||||
|
"registrar" : "0x6c221ca53705f3497ec90ca7b84c59ae7382fc21",
|
||||||
|
"homesteadTransition": "0x30d40",
|
||||||
|
"difficultyHardforkTransition": "0x59d9",
|
||||||
|
"difficultyHardforkBoundDivisor": "0x0200",
|
||||||
|
"bombDefuseTransition": "0x30d40",
|
||||||
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x00",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID": "0x1",
|
||||||
|
"subprotocolName": "exp"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x214652414e4b4f21",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x40000000",
|
||||||
|
"author": "0x93decab0cd745598860f782ac1e8f046cb99e898",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x4672616e6b6f497346726565646f6d",
|
||||||
|
"gasLimit": "0x1388"
|
||||||
|
},
|
||||||
|
"nodes": [
|
||||||
|
"enode://7f335a047654f3e70d6f91312a7cf89c39704011f1a584e2698250db3d63817e74b88e26b7854111e16b2c9d0c7173c05419aeee2d0321850227b126d8b1be3f@46.101.156.249:42786",
|
||||||
|
"enode://df872f81e25f72356152b44cab662caf1f2e57c3a156ecd20e9ac9246272af68a2031b4239a0bc831f2c6ab34733a041464d46b3ea36dce88d6c11714446e06b@178.62.208.109:42786",
|
||||||
|
"enode://96d3919b903e7f5ad59ac2f73c43be9172d9d27e2771355db03fd194732b795829a31fe2ea6de109d0804786c39a807e155f065b4b94c6fce167becd0ac02383@45.55.22.34:42786",
|
||||||
|
"enode://5f6c625bf287e3c08aad568de42d868781e961cbda805c8397cfb7be97e229419bef9a5a25a75f97632787106bba8a7caf9060fab3887ad2cfbeb182ab0f433f@46.101.182.53:42786",
|
||||||
|
"enode://d33a8d4c2c38a08971ed975b750f21d54c927c0bf7415931e214465a8d01651ecffe4401e1db913f398383381413c78105656d665d83f385244ab302d6138414@128.199.183.48:42786",
|
||||||
|
"enode://df872f81e25f72356152b44cab662caf1f2e57c3a156ecd20e9ac9246272af68a2031b4239a0bc831f2c6ab34733a041464d46b3ea36dce88d6c11714446e06b@178.62.208.109:42786",
|
||||||
|
"enode://f6f0d6b9b7d02ec9e8e4a16e38675f3621ea5e69860c739a65c1597ca28aefb3cec7a6d84e471ac927d42a1b64c1cbdefad75e7ce8872d57548ddcece20afdd1@159.203.64.95:42786"
|
||||||
|
],
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
|
"bb94f0ceb32257275b2a7a9c094c13e469b4563e": {
|
||||||
|
"balance": "10000000000000000000000000"
|
||||||
|
},
|
||||||
|
"15656715068ab0dbdf0ab00748a8a19e40f28192": {
|
||||||
|
"balance": "1000000000000000000000000"
|
||||||
|
},
|
||||||
|
"c075fa11f85bda3aaba67106226aaf086ac16f4e": {
|
||||||
|
"balance": "100000000000000000000000"
|
||||||
|
},
|
||||||
|
"93decab0cd745598860f782ac1e8f046cb99e898": {
|
||||||
|
"balance": "10000000000000000000000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +1,160 @@
|
|||||||
{
|
{
|
||||||
"name": "Frontier",
|
"name": "Frontier/Homestead",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x118c30",
|
||||||
|
"daoHardforkTransition": "0x1d4c00",
|
||||||
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
|
"daoHardforkAccounts": [
|
||||||
|
"0xd4fe7bc31cedb7bfb8a345f31e668033056b2728",
|
||||||
|
"0xb3fb0e5aba0e20e5c49d252dfd30e102b171a425",
|
||||||
|
"0x2c19c7f9ae8b751e37aeb2d93a699722395ae18f",
|
||||||
|
"0xecd135fa4f61a655311e86238c92adcd779555d2",
|
||||||
|
"0x1975bd06d486162d5dc297798dfc41edd5d160a7",
|
||||||
|
"0xa3acf3a1e16b1d7c315e23510fdd7847b48234f6",
|
||||||
|
"0x319f70bab6845585f412ec7724b744fec6095c85",
|
||||||
|
"0x06706dd3f2c9abf0a21ddcc6941d9b86f0596936",
|
||||||
|
"0x5c8536898fbb74fc7445814902fd08422eac56d0",
|
||||||
|
"0x6966ab0d485353095148a2155858910e0965b6f9",
|
||||||
|
"0x779543a0491a837ca36ce8c635d6154e3c4911a6",
|
||||||
|
"0x2a5ed960395e2a49b1c758cef4aa15213cfd874c",
|
||||||
|
"0x5c6e67ccd5849c0d29219c4f95f1a7a93b3f5dc5",
|
||||||
|
"0x9c50426be05db97f5d64fc54bf89eff947f0a321",
|
||||||
|
"0x200450f06520bdd6c527622a273333384d870efb",
|
||||||
|
"0xbe8539bfe837b67d1282b2b1d61c3f723966f049",
|
||||||
|
"0x6b0c4d41ba9ab8d8cfb5d379c69a612f2ced8ecb",
|
||||||
|
"0xf1385fb24aad0cd7432824085e42aff90886fef5",
|
||||||
|
"0xd1ac8b1ef1b69ff51d1d401a476e7e612414f091",
|
||||||
|
"0x8163e7fb499e90f8544ea62bbf80d21cd26d9efd",
|
||||||
|
"0x51e0ddd9998364a2eb38588679f0d2c42653e4a6",
|
||||||
|
"0x627a0a960c079c21c34f7612d5d230e01b4ad4c7",
|
||||||
|
"0xf0b1aa0eb660754448a7937c022e30aa692fe0c5",
|
||||||
|
"0x24c4d950dfd4dd1902bbed3508144a54542bba94",
|
||||||
|
"0x9f27daea7aca0aa0446220b98d028715e3bc803d",
|
||||||
|
"0xa5dc5acd6a7968a4554d89d65e59b7fd3bff0f90",
|
||||||
|
"0xd9aef3a1e38a39c16b31d1ace71bca8ef58d315b",
|
||||||
|
"0x63ed5a272de2f6d968408b4acb9024f4cc208ebf",
|
||||||
|
"0x6f6704e5a10332af6672e50b3d9754dc460dfa4d",
|
||||||
|
"0x77ca7b50b6cd7e2f3fa008e24ab793fd56cb15f6",
|
||||||
|
"0x492ea3bb0f3315521c31f273e565b868fc090f17",
|
||||||
|
"0x0ff30d6de14a8224aa97b78aea5388d1c51c1f00",
|
||||||
|
"0x9ea779f907f0b315b364b0cfc39a0fde5b02a416",
|
||||||
|
"0xceaeb481747ca6c540a000c1f3641f8cef161fa7",
|
||||||
|
"0xcc34673c6c40e791051898567a1222daf90be287",
|
||||||
|
"0x579a80d909f346fbfb1189493f521d7f48d52238",
|
||||||
|
"0xe308bd1ac5fda103967359b2712dd89deffb7973",
|
||||||
|
"0x4cb31628079fb14e4bc3cd5e30c2f7489b00960c",
|
||||||
|
"0xac1ecab32727358dba8962a0f3b261731aad9723",
|
||||||
|
"0x4fd6ace747f06ece9c49699c7cabc62d02211f75",
|
||||||
|
"0x440c59b325d2997a134c2c7c60a8c61611212bad",
|
||||||
|
"0x4486a3d68fac6967006d7a517b889fd3f98c102b",
|
||||||
|
"0x9c15b54878ba618f494b38f0ae7443db6af648ba",
|
||||||
|
"0x27b137a85656544b1ccb5a0f2e561a5703c6a68f",
|
||||||
|
"0x21c7fdb9ed8d291d79ffd82eb2c4356ec0d81241",
|
||||||
|
"0x23b75c2f6791eef49c69684db4c6c1f93bf49a50",
|
||||||
|
"0x1ca6abd14d30affe533b24d7a21bff4c2d5e1f3b",
|
||||||
|
"0xb9637156d330c0d605a791f1c31ba5890582fe1c",
|
||||||
|
"0x6131c42fa982e56929107413a9d526fd99405560",
|
||||||
|
"0x1591fc0f688c81fbeb17f5426a162a7024d430c2",
|
||||||
|
"0x542a9515200d14b68e934e9830d91645a980dd7a",
|
||||||
|
"0xc4bbd073882dd2add2424cf47d35213405b01324",
|
||||||
|
"0x782495b7b3355efb2833d56ecb34dc22ad7dfcc4",
|
||||||
|
"0x58b95c9a9d5d26825e70a82b6adb139d3fd829eb",
|
||||||
|
"0x3ba4d81db016dc2890c81f3acec2454bff5aada5",
|
||||||
|
"0xb52042c8ca3f8aa246fa79c3feaa3d959347c0ab",
|
||||||
|
"0xe4ae1efdfc53b73893af49113d8694a057b9c0d1",
|
||||||
|
"0x3c02a7bc0391e86d91b7d144e61c2c01a25a79c5",
|
||||||
|
"0x0737a6b837f97f46ebade41b9bc3e1c509c85c53",
|
||||||
|
"0x97f43a37f595ab5dd318fb46e7a155eae057317a",
|
||||||
|
"0x52c5317c848ba20c7504cb2c8052abd1fde29d03",
|
||||||
|
"0x4863226780fe7c0356454236d3b1c8792785748d",
|
||||||
|
"0x5d2b2e6fcbe3b11d26b525e085ff818dae332479",
|
||||||
|
"0x5f9f3392e9f62f63b8eac0beb55541fc8627f42c",
|
||||||
|
"0x057b56736d32b86616a10f619859c6cd6f59092a",
|
||||||
|
"0x9aa008f65de0b923a2a4f02012ad034a5e2e2192",
|
||||||
|
"0x304a554a310c7e546dfe434669c62820b7d83490",
|
||||||
|
"0x914d1b8b43e92723e64fd0a06f5bdb8dd9b10c79",
|
||||||
|
"0x4deb0033bb26bc534b197e61d19e0733e5679784",
|
||||||
|
"0x07f5c1e1bc2c93e0402f23341973a0e043f7bf8a",
|
||||||
|
"0x35a051a0010aba705c9008d7a7eff6fb88f6ea7b",
|
||||||
|
"0x4fa802324e929786dbda3b8820dc7834e9134a2a",
|
||||||
|
"0x9da397b9e80755301a3b32173283a91c0ef6c87e",
|
||||||
|
"0x8d9edb3054ce5c5774a420ac37ebae0ac02343c6",
|
||||||
|
"0x0101f3be8ebb4bbd39a2e3b9a3639d4259832fd9",
|
||||||
|
"0x5dc28b15dffed94048d73806ce4b7a4612a1d48f",
|
||||||
|
"0xbcf899e6c7d9d5a215ab1e3444c86806fa854c76",
|
||||||
|
"0x12e626b0eebfe86a56d633b9864e389b45dcb260",
|
||||||
|
"0xa2f1ccba9395d7fcb155bba8bc92db9bafaeade7",
|
||||||
|
"0xec8e57756626fdc07c63ad2eafbd28d08e7b0ca5",
|
||||||
|
"0xd164b088bd9108b60d0ca3751da4bceb207b0782",
|
||||||
|
"0x6231b6d0d5e77fe001c2a460bd9584fee60d409b",
|
||||||
|
"0x1cba23d343a983e9b5cfd19496b9a9701ada385f",
|
||||||
|
"0xa82f360a8d3455c5c41366975bde739c37bfeb8a",
|
||||||
|
"0x9fcd2deaff372a39cc679d5c5e4de7bafb0b1339",
|
||||||
|
"0x005f5cee7a43331d5a3d3eec71305925a62f34b6",
|
||||||
|
"0x0e0da70933f4c7849fc0d203f5d1d43b9ae4532d",
|
||||||
|
"0xd131637d5275fd1a68a3200f4ad25c71a2a9522e",
|
||||||
|
"0xbc07118b9ac290e4622f5e77a0853539789effbe",
|
||||||
|
"0x47e7aa56d6bdf3f36be34619660de61275420af8",
|
||||||
|
"0xacd87e28b0c9d1254e868b81cba4cc20d9a32225",
|
||||||
|
"0xadf80daec7ba8dcf15392f1ac611fff65d94f880",
|
||||||
|
"0x5524c55fb03cf21f549444ccbecb664d0acad706",
|
||||||
|
"0x40b803a9abce16f50f36a77ba41180eb90023925",
|
||||||
|
"0xfe24cdd8648121a43a7c86d289be4dd2951ed49f",
|
||||||
|
"0x17802f43a0137c506ba92291391a8a8f207f487d",
|
||||||
|
"0x253488078a4edf4d6f42f113d1e62836a942cf1a",
|
||||||
|
"0x86af3e9626fce1957c82e88cbf04ddf3a2ed7915",
|
||||||
|
"0xb136707642a4ea12fb4bae820f03d2562ebff487",
|
||||||
|
"0xdbe9b615a3ae8709af8b93336ce9b477e4ac0940",
|
||||||
|
"0xf14c14075d6c4ed84b86798af0956deef67365b5",
|
||||||
|
"0xca544e5c4687d109611d0f8f928b53a25af72448",
|
||||||
|
"0xaeeb8ff27288bdabc0fa5ebb731b6f409507516c",
|
||||||
|
"0xcbb9d3703e651b0d496cdefb8b92c25aeb2171f7",
|
||||||
|
"0x6d87578288b6cb5549d5076a207456a1f6a63dc0",
|
||||||
|
"0xb2c6f0dfbb716ac562e2d85d6cb2f8d5ee87603e",
|
||||||
|
"0xaccc230e8a6e5be9160b8cdf2864dd2a001c28b6",
|
||||||
|
"0x2b3455ec7fedf16e646268bf88846bd7a2319bb2",
|
||||||
|
"0x4613f3bca5c44ea06337a9e439fbc6d42e501d0a",
|
||||||
|
"0xd343b217de44030afaa275f54d31a9317c7f441e",
|
||||||
|
"0x84ef4b2357079cd7a7c69fd7a37cd0609a679106",
|
||||||
|
"0xda2fef9e4a3230988ff17df2165440f37e8b1708",
|
||||||
|
"0xf4c64518ea10f995918a454158c6b61407ea345c",
|
||||||
|
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
|
||||||
|
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
||||||
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
|
],
|
||||||
|
"eip150Transition": "0x259518",
|
||||||
|
"eip155Transition": "0x28d138",
|
||||||
|
"eip160Transition": "0x28d138",
|
||||||
|
"eip161abcTransition": "0x28d138",
|
||||||
|
"eip161dTransition": "0x28d138",
|
||||||
|
"maxCodeSize": 24576
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"frontierCompatibilityModeLimit": "0xf4240",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
"networkID" : "0x1",
|
||||||
"minimumDifficulty": "0x020000",
|
"forkBlock": "0x1d4c00",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"forkCanonHash": "0x4985f5ca3d2afbec36529aa96f74de3cc10a2a4a6c44f2157a57d2c6059a11bb"
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"networkID" : "0x1"
|
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x0000000000000042",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x400000000",
|
"difficulty": "0x400000000",
|
||||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -29,13 +165,14 @@
|
|||||||
"nodes": [
|
"nodes": [
|
||||||
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
|
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
|
||||||
"enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303",
|
"enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303",
|
||||||
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"
|
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303",
|
||||||
|
"enode://4cd540b2c3292e17cff39922e864094bf8b0741fcc8c5dcea14957e389d7944c70278d872902e3d0345927f621547efa659013c400865485ab4bfa0c6596936f@138.201.144.135:30303"
|
||||||
],
|
],
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
|
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
"3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
|
"3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
|
||||||
"balance": "1337000000000000000000"
|
"balance": "1337000000000000000000"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,24 +1,157 @@
|
|||||||
{
|
{
|
||||||
"engineName": "Frontier (Test)",
|
"name": "Frontier (Test)",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x118c30",
|
||||||
|
"daoHardforkTransition": "0x1d4c00",
|
||||||
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
|
"daoHardforkAccounts": [
|
||||||
|
"0xd4fe7bc31cedb7bfb8a345f31e668033056b2728",
|
||||||
|
"0xb3fb0e5aba0e20e5c49d252dfd30e102b171a425",
|
||||||
|
"0x2c19c7f9ae8b751e37aeb2d93a699722395ae18f",
|
||||||
|
"0xecd135fa4f61a655311e86238c92adcd779555d2",
|
||||||
|
"0x1975bd06d486162d5dc297798dfc41edd5d160a7",
|
||||||
|
"0xa3acf3a1e16b1d7c315e23510fdd7847b48234f6",
|
||||||
|
"0x319f70bab6845585f412ec7724b744fec6095c85",
|
||||||
|
"0x06706dd3f2c9abf0a21ddcc6941d9b86f0596936",
|
||||||
|
"0x5c8536898fbb74fc7445814902fd08422eac56d0",
|
||||||
|
"0x6966ab0d485353095148a2155858910e0965b6f9",
|
||||||
|
"0x779543a0491a837ca36ce8c635d6154e3c4911a6",
|
||||||
|
"0x2a5ed960395e2a49b1c758cef4aa15213cfd874c",
|
||||||
|
"0x5c6e67ccd5849c0d29219c4f95f1a7a93b3f5dc5",
|
||||||
|
"0x9c50426be05db97f5d64fc54bf89eff947f0a321",
|
||||||
|
"0x200450f06520bdd6c527622a273333384d870efb",
|
||||||
|
"0xbe8539bfe837b67d1282b2b1d61c3f723966f049",
|
||||||
|
"0x6b0c4d41ba9ab8d8cfb5d379c69a612f2ced8ecb",
|
||||||
|
"0xf1385fb24aad0cd7432824085e42aff90886fef5",
|
||||||
|
"0xd1ac8b1ef1b69ff51d1d401a476e7e612414f091",
|
||||||
|
"0x8163e7fb499e90f8544ea62bbf80d21cd26d9efd",
|
||||||
|
"0x51e0ddd9998364a2eb38588679f0d2c42653e4a6",
|
||||||
|
"0x627a0a960c079c21c34f7612d5d230e01b4ad4c7",
|
||||||
|
"0xf0b1aa0eb660754448a7937c022e30aa692fe0c5",
|
||||||
|
"0x24c4d950dfd4dd1902bbed3508144a54542bba94",
|
||||||
|
"0x9f27daea7aca0aa0446220b98d028715e3bc803d",
|
||||||
|
"0xa5dc5acd6a7968a4554d89d65e59b7fd3bff0f90",
|
||||||
|
"0xd9aef3a1e38a39c16b31d1ace71bca8ef58d315b",
|
||||||
|
"0x63ed5a272de2f6d968408b4acb9024f4cc208ebf",
|
||||||
|
"0x6f6704e5a10332af6672e50b3d9754dc460dfa4d",
|
||||||
|
"0x77ca7b50b6cd7e2f3fa008e24ab793fd56cb15f6",
|
||||||
|
"0x492ea3bb0f3315521c31f273e565b868fc090f17",
|
||||||
|
"0x0ff30d6de14a8224aa97b78aea5388d1c51c1f00",
|
||||||
|
"0x9ea779f907f0b315b364b0cfc39a0fde5b02a416",
|
||||||
|
"0xceaeb481747ca6c540a000c1f3641f8cef161fa7",
|
||||||
|
"0xcc34673c6c40e791051898567a1222daf90be287",
|
||||||
|
"0x579a80d909f346fbfb1189493f521d7f48d52238",
|
||||||
|
"0xe308bd1ac5fda103967359b2712dd89deffb7973",
|
||||||
|
"0x4cb31628079fb14e4bc3cd5e30c2f7489b00960c",
|
||||||
|
"0xac1ecab32727358dba8962a0f3b261731aad9723",
|
||||||
|
"0x4fd6ace747f06ece9c49699c7cabc62d02211f75",
|
||||||
|
"0x440c59b325d2997a134c2c7c60a8c61611212bad",
|
||||||
|
"0x4486a3d68fac6967006d7a517b889fd3f98c102b",
|
||||||
|
"0x9c15b54878ba618f494b38f0ae7443db6af648ba",
|
||||||
|
"0x27b137a85656544b1ccb5a0f2e561a5703c6a68f",
|
||||||
|
"0x21c7fdb9ed8d291d79ffd82eb2c4356ec0d81241",
|
||||||
|
"0x23b75c2f6791eef49c69684db4c6c1f93bf49a50",
|
||||||
|
"0x1ca6abd14d30affe533b24d7a21bff4c2d5e1f3b",
|
||||||
|
"0xb9637156d330c0d605a791f1c31ba5890582fe1c",
|
||||||
|
"0x6131c42fa982e56929107413a9d526fd99405560",
|
||||||
|
"0x1591fc0f688c81fbeb17f5426a162a7024d430c2",
|
||||||
|
"0x542a9515200d14b68e934e9830d91645a980dd7a",
|
||||||
|
"0xc4bbd073882dd2add2424cf47d35213405b01324",
|
||||||
|
"0x782495b7b3355efb2833d56ecb34dc22ad7dfcc4",
|
||||||
|
"0x58b95c9a9d5d26825e70a82b6adb139d3fd829eb",
|
||||||
|
"0x3ba4d81db016dc2890c81f3acec2454bff5aada5",
|
||||||
|
"0xb52042c8ca3f8aa246fa79c3feaa3d959347c0ab",
|
||||||
|
"0xe4ae1efdfc53b73893af49113d8694a057b9c0d1",
|
||||||
|
"0x3c02a7bc0391e86d91b7d144e61c2c01a25a79c5",
|
||||||
|
"0x0737a6b837f97f46ebade41b9bc3e1c509c85c53",
|
||||||
|
"0x97f43a37f595ab5dd318fb46e7a155eae057317a",
|
||||||
|
"0x52c5317c848ba20c7504cb2c8052abd1fde29d03",
|
||||||
|
"0x4863226780fe7c0356454236d3b1c8792785748d",
|
||||||
|
"0x5d2b2e6fcbe3b11d26b525e085ff818dae332479",
|
||||||
|
"0x5f9f3392e9f62f63b8eac0beb55541fc8627f42c",
|
||||||
|
"0x057b56736d32b86616a10f619859c6cd6f59092a",
|
||||||
|
"0x9aa008f65de0b923a2a4f02012ad034a5e2e2192",
|
||||||
|
"0x304a554a310c7e546dfe434669c62820b7d83490",
|
||||||
|
"0x914d1b8b43e92723e64fd0a06f5bdb8dd9b10c79",
|
||||||
|
"0x4deb0033bb26bc534b197e61d19e0733e5679784",
|
||||||
|
"0x07f5c1e1bc2c93e0402f23341973a0e043f7bf8a",
|
||||||
|
"0x35a051a0010aba705c9008d7a7eff6fb88f6ea7b",
|
||||||
|
"0x4fa802324e929786dbda3b8820dc7834e9134a2a",
|
||||||
|
"0x9da397b9e80755301a3b32173283a91c0ef6c87e",
|
||||||
|
"0x8d9edb3054ce5c5774a420ac37ebae0ac02343c6",
|
||||||
|
"0x0101f3be8ebb4bbd39a2e3b9a3639d4259832fd9",
|
||||||
|
"0x5dc28b15dffed94048d73806ce4b7a4612a1d48f",
|
||||||
|
"0xbcf899e6c7d9d5a215ab1e3444c86806fa854c76",
|
||||||
|
"0x12e626b0eebfe86a56d633b9864e389b45dcb260",
|
||||||
|
"0xa2f1ccba9395d7fcb155bba8bc92db9bafaeade7",
|
||||||
|
"0xec8e57756626fdc07c63ad2eafbd28d08e7b0ca5",
|
||||||
|
"0xd164b088bd9108b60d0ca3751da4bceb207b0782",
|
||||||
|
"0x6231b6d0d5e77fe001c2a460bd9584fee60d409b",
|
||||||
|
"0x1cba23d343a983e9b5cfd19496b9a9701ada385f",
|
||||||
|
"0xa82f360a8d3455c5c41366975bde739c37bfeb8a",
|
||||||
|
"0x9fcd2deaff372a39cc679d5c5e4de7bafb0b1339",
|
||||||
|
"0x005f5cee7a43331d5a3d3eec71305925a62f34b6",
|
||||||
|
"0x0e0da70933f4c7849fc0d203f5d1d43b9ae4532d",
|
||||||
|
"0xd131637d5275fd1a68a3200f4ad25c71a2a9522e",
|
||||||
|
"0xbc07118b9ac290e4622f5e77a0853539789effbe",
|
||||||
|
"0x47e7aa56d6bdf3f36be34619660de61275420af8",
|
||||||
|
"0xacd87e28b0c9d1254e868b81cba4cc20d9a32225",
|
||||||
|
"0xadf80daec7ba8dcf15392f1ac611fff65d94f880",
|
||||||
|
"0x5524c55fb03cf21f549444ccbecb664d0acad706",
|
||||||
|
"0x40b803a9abce16f50f36a77ba41180eb90023925",
|
||||||
|
"0xfe24cdd8648121a43a7c86d289be4dd2951ed49f",
|
||||||
|
"0x17802f43a0137c506ba92291391a8a8f207f487d",
|
||||||
|
"0x253488078a4edf4d6f42f113d1e62836a942cf1a",
|
||||||
|
"0x86af3e9626fce1957c82e88cbf04ddf3a2ed7915",
|
||||||
|
"0xb136707642a4ea12fb4bae820f03d2562ebff487",
|
||||||
|
"0xdbe9b615a3ae8709af8b93336ce9b477e4ac0940",
|
||||||
|
"0xf14c14075d6c4ed84b86798af0956deef67365b5",
|
||||||
|
"0xca544e5c4687d109611d0f8f928b53a25af72448",
|
||||||
|
"0xaeeb8ff27288bdabc0fa5ebb731b6f409507516c",
|
||||||
|
"0xcbb9d3703e651b0d496cdefb8b92c25aeb2171f7",
|
||||||
|
"0x6d87578288b6cb5549d5076a207456a1f6a63dc0",
|
||||||
|
"0xb2c6f0dfbb716ac562e2d85d6cb2f8d5ee87603e",
|
||||||
|
"0xaccc230e8a6e5be9160b8cdf2864dd2a001c28b6",
|
||||||
|
"0x2b3455ec7fedf16e646268bf88846bd7a2319bb2",
|
||||||
|
"0x4613f3bca5c44ea06337a9e439fbc6d42e501d0a",
|
||||||
|
"0xd343b217de44030afaa275f54d31a9317c7f441e",
|
||||||
|
"0x84ef4b2357079cd7a7c69fd7a37cd0609a679106",
|
||||||
|
"0xda2fef9e4a3230988ff17df2165440f37e8b1708",
|
||||||
|
"0xf4c64518ea10f995918a454158c6b61407ea345c",
|
||||||
|
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
|
||||||
|
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
||||||
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
|
],
|
||||||
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"frontierCompatibilityModeLimit": "0xf4240",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"networkID" : "0x1"
|
"networkID" : "0x1"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x0000000000000042",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x400000000",
|
"difficulty": "0x400000000",
|
||||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -26,9 +159,9 @@
|
|||||||
"gasLimit": "0x1388"
|
"gasLimit": "0x1388"
|
||||||
},
|
},
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
|
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,37 @@
|
|||||||
{
|
{
|
||||||
"engineName": "Frontier (Test)",
|
"name": "Frontier (Test)",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x7fffffffffffffff",
|
||||||
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"frontierCompatibilityModeLimit": "0xffffffffffffffff",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"networkID" : "0x1"
|
"networkID" : "0x1"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x0000000000000042",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x400000000",
|
"difficulty": "0x400000000",
|
||||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -26,9 +39,9 @@
|
|||||||
"gasLimit": "0x1388"
|
"gasLimit": "0x1388"
|
||||||
},
|
},
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
|
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,37 @@
|
|||||||
{
|
{
|
||||||
"name": "Homestead (Test)",
|
"name": "Homestead (Test)",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x0",
|
||||||
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"frontierCompatibilityModeLimit": 0,
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
|
||||||
"networkID" : "0x1"
|
"networkID" : "0x1"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x0000000000000042",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x400000000",
|
"difficulty": "0x400000000",
|
||||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -26,9 +39,9 @@
|
|||||||
"gasLimit": "0x1388"
|
"gasLimit": "0x1388"
|
||||||
},
|
},
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
|
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,54 @@
|
|||||||
{
|
{
|
||||||
"name": "Morden",
|
"name": "Morden",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar": "0x8e4e9b13d4b45cb0befc93c3061b1408f67316b2",
|
||||||
|
"homesteadTransition": "0x789b0",
|
||||||
|
"eip150Transition": "0x1b34d8",
|
||||||
|
"eip155Transition": "0x1cc348",
|
||||||
|
"eip160Transition": "0x1cc348",
|
||||||
|
"eip161abcTransition": "0x1cc348",
|
||||||
|
"eip161dTransition": "0x1cc348"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x0100000",
|
"accountStartNonce": "0x0100000",
|
||||||
"frontierCompatibilityModeLimit": "0xdbba0",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
"networkID" : "0x2",
|
||||||
"minimumDifficulty": "0x020000",
|
"forkBlock": "0x1b34d8",
|
||||||
"difficultyBoundDivisor": "0x0800",
|
"forkCanonHash": "0xf376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145"
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar": "",
|
|
||||||
"networkID" : "0x2"
|
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x00006d6f7264656e",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x00006d6f7264656e",
|
||||||
|
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x20000",
|
"difficulty": "0x20000",
|
||||||
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"extraData": "0x",
|
"extraData": "0x",
|
||||||
"gasLimit": "0x2fefd8"
|
"gasLimit": "0x2fefd8"
|
||||||
},
|
},
|
||||||
|
"nodes": [
|
||||||
|
"enode://e731347db0521f3476e6bbbb83375dcd7133a1601425ebd15fd10f3835fd4c304fba6282087ca5a0deeafadf0aa0d4fd56c3323331901c1f38bd181c283e3e35@128.199.55.137:30303",
|
||||||
|
"enode://ceb5c0f85eb994dbe9693bf46d99b03f6b838d17cc74e68d5eb003171ff39e5f120b17f965b267c319303f94d80b9d994b77062fb1486d76ce95d9f3d8fe1cb4@46.101.122.141:30303"
|
||||||
|
],
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,37 @@
|
|||||||
{
|
{
|
||||||
"name": "Olympic",
|
"name": "Olympic",
|
||||||
"engineName": "Ethash",
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x08",
|
||||||
|
"blockReward": "0x14D1120D7B160000",
|
||||||
|
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
|
||||||
|
"homesteadTransition": "0x7fffffffffffffff",
|
||||||
|
"eip150Transition": "0x7fffffffffffffff",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x00",
|
"accountStartNonce": "0x00",
|
||||||
"frontierCompatibilityModeLimit": "0xffffffffffffffff",
|
|
||||||
"maximumExtraDataSize": "0x0400",
|
"maximumExtraDataSize": "0x0400",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "125000",
|
"minGasLimit": "125000",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
|
||||||
"durationLimit": "0x08",
|
|
||||||
"blockReward": "0x14D1120D7B160000",
|
|
||||||
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
|
|
||||||
"networkID" : "0x0"
|
"networkID" : "0x0"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x000000000000002a",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x000000000000002a",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x20000",
|
"difficulty": "0x20000",
|
||||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -26,10 +39,10 @@
|
|||||||
"gasLimit": "0x2fefd8"
|
"gasLimit": "0x2fefd8"
|
||||||
},
|
},
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
|
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
"dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
"dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
||||||
"e6716f9544a56c530d868e4bfbacb172315bdead": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
"e6716f9544a56c530d868e4bfbacb172315bdead": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
||||||
"b9c015918bdaba24b4ff057a92a3873d6eb201be": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
"b9c015918bdaba24b4ff057a92a3873d6eb201be": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
|
||||||
|
|||||||
Submodule ethcore/res/ethereum/tests updated: 3116f85a49...9028c4801f
167
ethcore/res/ethereum/transition_test.json
Normal file
167
ethcore/res/ethereum/transition_test.json
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
{
|
||||||
|
"name": "EIP150.1b hard-fork consensus test",
|
||||||
|
"engine": {
|
||||||
|
"Ethash": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"minimumDifficulty": "0x020000",
|
||||||
|
"difficultyBoundDivisor": "0x0800",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"blockReward": "0x4563918244F40000",
|
||||||
|
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
|
||||||
|
"homesteadTransition": "0x5",
|
||||||
|
"daoHardforkTransition": "0x8",
|
||||||
|
"daoHardforkBeneficiary": "0xbf4ed7b27f1d666546e30d74d50d173d20bca754",
|
||||||
|
"daoHardforkAccounts": [
|
||||||
|
"0xd4fe7bc31cedb7bfb8a345f31e668033056b2728",
|
||||||
|
"0xb3fb0e5aba0e20e5c49d252dfd30e102b171a425",
|
||||||
|
"0x2c19c7f9ae8b751e37aeb2d93a699722395ae18f",
|
||||||
|
"0xecd135fa4f61a655311e86238c92adcd779555d2",
|
||||||
|
"0x1975bd06d486162d5dc297798dfc41edd5d160a7",
|
||||||
|
"0xa3acf3a1e16b1d7c315e23510fdd7847b48234f6",
|
||||||
|
"0x319f70bab6845585f412ec7724b744fec6095c85",
|
||||||
|
"0x06706dd3f2c9abf0a21ddcc6941d9b86f0596936",
|
||||||
|
"0x5c8536898fbb74fc7445814902fd08422eac56d0",
|
||||||
|
"0x6966ab0d485353095148a2155858910e0965b6f9",
|
||||||
|
"0x779543a0491a837ca36ce8c635d6154e3c4911a6",
|
||||||
|
"0x2a5ed960395e2a49b1c758cef4aa15213cfd874c",
|
||||||
|
"0x5c6e67ccd5849c0d29219c4f95f1a7a93b3f5dc5",
|
||||||
|
"0x9c50426be05db97f5d64fc54bf89eff947f0a321",
|
||||||
|
"0x200450f06520bdd6c527622a273333384d870efb",
|
||||||
|
"0xbe8539bfe837b67d1282b2b1d61c3f723966f049",
|
||||||
|
"0x6b0c4d41ba9ab8d8cfb5d379c69a612f2ced8ecb",
|
||||||
|
"0xf1385fb24aad0cd7432824085e42aff90886fef5",
|
||||||
|
"0xd1ac8b1ef1b69ff51d1d401a476e7e612414f091",
|
||||||
|
"0x8163e7fb499e90f8544ea62bbf80d21cd26d9efd",
|
||||||
|
"0x51e0ddd9998364a2eb38588679f0d2c42653e4a6",
|
||||||
|
"0x627a0a960c079c21c34f7612d5d230e01b4ad4c7",
|
||||||
|
"0xf0b1aa0eb660754448a7937c022e30aa692fe0c5",
|
||||||
|
"0x24c4d950dfd4dd1902bbed3508144a54542bba94",
|
||||||
|
"0x9f27daea7aca0aa0446220b98d028715e3bc803d",
|
||||||
|
"0xa5dc5acd6a7968a4554d89d65e59b7fd3bff0f90",
|
||||||
|
"0xd9aef3a1e38a39c16b31d1ace71bca8ef58d315b",
|
||||||
|
"0x63ed5a272de2f6d968408b4acb9024f4cc208ebf",
|
||||||
|
"0x6f6704e5a10332af6672e50b3d9754dc460dfa4d",
|
||||||
|
"0x77ca7b50b6cd7e2f3fa008e24ab793fd56cb15f6",
|
||||||
|
"0x492ea3bb0f3315521c31f273e565b868fc090f17",
|
||||||
|
"0x0ff30d6de14a8224aa97b78aea5388d1c51c1f00",
|
||||||
|
"0x9ea779f907f0b315b364b0cfc39a0fde5b02a416",
|
||||||
|
"0xceaeb481747ca6c540a000c1f3641f8cef161fa7",
|
||||||
|
"0xcc34673c6c40e791051898567a1222daf90be287",
|
||||||
|
"0x579a80d909f346fbfb1189493f521d7f48d52238",
|
||||||
|
"0xe308bd1ac5fda103967359b2712dd89deffb7973",
|
||||||
|
"0x4cb31628079fb14e4bc3cd5e30c2f7489b00960c",
|
||||||
|
"0xac1ecab32727358dba8962a0f3b261731aad9723",
|
||||||
|
"0x4fd6ace747f06ece9c49699c7cabc62d02211f75",
|
||||||
|
"0x440c59b325d2997a134c2c7c60a8c61611212bad",
|
||||||
|
"0x4486a3d68fac6967006d7a517b889fd3f98c102b",
|
||||||
|
"0x9c15b54878ba618f494b38f0ae7443db6af648ba",
|
||||||
|
"0x27b137a85656544b1ccb5a0f2e561a5703c6a68f",
|
||||||
|
"0x21c7fdb9ed8d291d79ffd82eb2c4356ec0d81241",
|
||||||
|
"0x23b75c2f6791eef49c69684db4c6c1f93bf49a50",
|
||||||
|
"0x1ca6abd14d30affe533b24d7a21bff4c2d5e1f3b",
|
||||||
|
"0xb9637156d330c0d605a791f1c31ba5890582fe1c",
|
||||||
|
"0x6131c42fa982e56929107413a9d526fd99405560",
|
||||||
|
"0x1591fc0f688c81fbeb17f5426a162a7024d430c2",
|
||||||
|
"0x542a9515200d14b68e934e9830d91645a980dd7a",
|
||||||
|
"0xc4bbd073882dd2add2424cf47d35213405b01324",
|
||||||
|
"0x782495b7b3355efb2833d56ecb34dc22ad7dfcc4",
|
||||||
|
"0x58b95c9a9d5d26825e70a82b6adb139d3fd829eb",
|
||||||
|
"0x3ba4d81db016dc2890c81f3acec2454bff5aada5",
|
||||||
|
"0xb52042c8ca3f8aa246fa79c3feaa3d959347c0ab",
|
||||||
|
"0xe4ae1efdfc53b73893af49113d8694a057b9c0d1",
|
||||||
|
"0x3c02a7bc0391e86d91b7d144e61c2c01a25a79c5",
|
||||||
|
"0x0737a6b837f97f46ebade41b9bc3e1c509c85c53",
|
||||||
|
"0x97f43a37f595ab5dd318fb46e7a155eae057317a",
|
||||||
|
"0x52c5317c848ba20c7504cb2c8052abd1fde29d03",
|
||||||
|
"0x4863226780fe7c0356454236d3b1c8792785748d",
|
||||||
|
"0x5d2b2e6fcbe3b11d26b525e085ff818dae332479",
|
||||||
|
"0x5f9f3392e9f62f63b8eac0beb55541fc8627f42c",
|
||||||
|
"0x057b56736d32b86616a10f619859c6cd6f59092a",
|
||||||
|
"0x9aa008f65de0b923a2a4f02012ad034a5e2e2192",
|
||||||
|
"0x304a554a310c7e546dfe434669c62820b7d83490",
|
||||||
|
"0x914d1b8b43e92723e64fd0a06f5bdb8dd9b10c79",
|
||||||
|
"0x4deb0033bb26bc534b197e61d19e0733e5679784",
|
||||||
|
"0x07f5c1e1bc2c93e0402f23341973a0e043f7bf8a",
|
||||||
|
"0x35a051a0010aba705c9008d7a7eff6fb88f6ea7b",
|
||||||
|
"0x4fa802324e929786dbda3b8820dc7834e9134a2a",
|
||||||
|
"0x9da397b9e80755301a3b32173283a91c0ef6c87e",
|
||||||
|
"0x8d9edb3054ce5c5774a420ac37ebae0ac02343c6",
|
||||||
|
"0x0101f3be8ebb4bbd39a2e3b9a3639d4259832fd9",
|
||||||
|
"0x5dc28b15dffed94048d73806ce4b7a4612a1d48f",
|
||||||
|
"0xbcf899e6c7d9d5a215ab1e3444c86806fa854c76",
|
||||||
|
"0x12e626b0eebfe86a56d633b9864e389b45dcb260",
|
||||||
|
"0xa2f1ccba9395d7fcb155bba8bc92db9bafaeade7",
|
||||||
|
"0xec8e57756626fdc07c63ad2eafbd28d08e7b0ca5",
|
||||||
|
"0xd164b088bd9108b60d0ca3751da4bceb207b0782",
|
||||||
|
"0x6231b6d0d5e77fe001c2a460bd9584fee60d409b",
|
||||||
|
"0x1cba23d343a983e9b5cfd19496b9a9701ada385f",
|
||||||
|
"0xa82f360a8d3455c5c41366975bde739c37bfeb8a",
|
||||||
|
"0x9fcd2deaff372a39cc679d5c5e4de7bafb0b1339",
|
||||||
|
"0x005f5cee7a43331d5a3d3eec71305925a62f34b6",
|
||||||
|
"0x0e0da70933f4c7849fc0d203f5d1d43b9ae4532d",
|
||||||
|
"0xd131637d5275fd1a68a3200f4ad25c71a2a9522e",
|
||||||
|
"0xbc07118b9ac290e4622f5e77a0853539789effbe",
|
||||||
|
"0x47e7aa56d6bdf3f36be34619660de61275420af8",
|
||||||
|
"0xacd87e28b0c9d1254e868b81cba4cc20d9a32225",
|
||||||
|
"0xadf80daec7ba8dcf15392f1ac611fff65d94f880",
|
||||||
|
"0x5524c55fb03cf21f549444ccbecb664d0acad706",
|
||||||
|
"0x40b803a9abce16f50f36a77ba41180eb90023925",
|
||||||
|
"0xfe24cdd8648121a43a7c86d289be4dd2951ed49f",
|
||||||
|
"0x17802f43a0137c506ba92291391a8a8f207f487d",
|
||||||
|
"0x253488078a4edf4d6f42f113d1e62836a942cf1a",
|
||||||
|
"0x86af3e9626fce1957c82e88cbf04ddf3a2ed7915",
|
||||||
|
"0xb136707642a4ea12fb4bae820f03d2562ebff487",
|
||||||
|
"0xdbe9b615a3ae8709af8b93336ce9b477e4ac0940",
|
||||||
|
"0xf14c14075d6c4ed84b86798af0956deef67365b5",
|
||||||
|
"0xca544e5c4687d109611d0f8f928b53a25af72448",
|
||||||
|
"0xaeeb8ff27288bdabc0fa5ebb731b6f409507516c",
|
||||||
|
"0xcbb9d3703e651b0d496cdefb8b92c25aeb2171f7",
|
||||||
|
"0x6d87578288b6cb5549d5076a207456a1f6a63dc0",
|
||||||
|
"0xb2c6f0dfbb716ac562e2d85d6cb2f8d5ee87603e",
|
||||||
|
"0xaccc230e8a6e5be9160b8cdf2864dd2a001c28b6",
|
||||||
|
"0x2b3455ec7fedf16e646268bf88846bd7a2319bb2",
|
||||||
|
"0x4613f3bca5c44ea06337a9e439fbc6d42e501d0a",
|
||||||
|
"0xd343b217de44030afaa275f54d31a9317c7f441e",
|
||||||
|
"0x84ef4b2357079cd7a7c69fd7a37cd0609a679106",
|
||||||
|
"0xda2fef9e4a3230988ff17df2165440f37e8b1708",
|
||||||
|
"0xf4c64518ea10f995918a454158c6b61407ea345c",
|
||||||
|
"0x7602b46df5390e432ef1c307d4f2c9ff6d65cc97",
|
||||||
|
"0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
||||||
|
"0x807640a13483f8ac783c557fcdf27be11ea4ac7a"
|
||||||
|
],
|
||||||
|
"eip150Transition": "0xa",
|
||||||
|
"eip155Transition": "0x7fffffffffffffff",
|
||||||
|
"eip160Transition": "0x7fffffffffffffff",
|
||||||
|
"eip161abcTransition": "0x7fffffffffffffff",
|
||||||
|
"eip161dTransition": "0x7fffffffffffffff"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x00",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x1"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x0000000000000042",
|
||||||
|
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x400000000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
|
||||||
|
"gasLimit": "0x1388"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
|
||||||
|
}
|
||||||
|
}
|
||||||
33
ethcore/res/instant_seal.json
Normal file
33
ethcore/res/instant_seal.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "TestInstantSeal",
|
||||||
|
"engine": {
|
||||||
|
"InstantSeal": null
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x0100000",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x2"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x00006d6f7264656e",
|
||||||
|
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x20000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x2fefd8"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
|
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
||||||
|
}
|
||||||
|
}
|
||||||
33
ethcore/res/null.json
Normal file
33
ethcore/res/null.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "Morden",
|
||||||
|
"engine": {
|
||||||
|
"Null": null
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x0",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x2"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x00006d6f7264656e",
|
||||||
|
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x20000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x2fefd8"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "0", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "0", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "0", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "0", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
|
"9cce34f7ab185c7aba1b7c8140d620b4bda941d6": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "0" }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "Morden",
|
"name": "Morden",
|
||||||
"engineName": "NullEngine",
|
"engine": {
|
||||||
|
"Null": null
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"accountStartNonce": "0x0100000",
|
"accountStartNonce": "0x0",
|
||||||
"frontierCompatibilityModeLimit": "0xfffa2990",
|
|
||||||
"maximumExtraDataSize": "0x20",
|
"maximumExtraDataSize": "0x20",
|
||||||
"tieBreakingGas": false,
|
|
||||||
"minGasLimit": "0x1388",
|
"minGasLimit": "0x1388",
|
||||||
"gasLimitBoundDivisor": "0x0400",
|
|
||||||
"minimumDifficulty": "0x020000",
|
|
||||||
"difficultyBoundDivisor": "0x0800",
|
|
||||||
"durationLimit": "0x0d",
|
|
||||||
"blockReward": "0x4563918244F40000",
|
|
||||||
"registrar": "",
|
|
||||||
"networkID" : "0x2"
|
"networkID" : "0x2"
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"nonce": "0x00006d6f7264656e",
|
"seal": {
|
||||||
|
"ethereum": {
|
||||||
|
"nonce": "0x00006d6f7264656e",
|
||||||
|
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||||
|
}
|
||||||
|
},
|
||||||
"difficulty": "0x20000",
|
"difficulty": "0x20000",
|
||||||
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
|
|
||||||
"author": "0x0000000000000000000000000000000000000000",
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
"timestamp": "0x00",
|
"timestamp": "0x00",
|
||||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
@@ -26,10 +24,10 @@
|
|||||||
"gasLimit": "0x2fefd8"
|
"gasLimit": "0x2fefd8"
|
||||||
},
|
},
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
|
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
ethcore/res/test_authority.json
Normal file
39
ethcore/res/test_authority.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "TestAuthority",
|
||||||
|
"engine": {
|
||||||
|
"BasicAuthority": {
|
||||||
|
"params": {
|
||||||
|
"gasLimitBoundDivisor": "0x0400",
|
||||||
|
"durationLimit": "0x0d",
|
||||||
|
"authorities" : ["0x9cce34f7ab185c7aba1b7c8140d620b4bda941d6"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"accountStartNonce": "0x0100000",
|
||||||
|
"maximumExtraDataSize": "0x20",
|
||||||
|
"minGasLimit": "0x1388",
|
||||||
|
"networkID" : "0x69"
|
||||||
|
},
|
||||||
|
"genesis": {
|
||||||
|
"seal": {
|
||||||
|
"generic": {
|
||||||
|
"fields": 1,
|
||||||
|
"rlp": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"difficulty": "0x20000",
|
||||||
|
"author": "0x0000000000000000000000000000000000000000",
|
||||||
|
"timestamp": "0x00",
|
||||||
|
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"extraData": "0x",
|
||||||
|
"gasLimit": "0x2fefd8"
|
||||||
|
},
|
||||||
|
"accounts": {
|
||||||
|
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||||
|
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||||
|
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||||
|
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||||
|
"9cce34f7ab185c7aba1b7c8140d620b4bda941d6": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,9 +19,15 @@
|
|||||||
use util::*;
|
use util::*;
|
||||||
use pod_account::*;
|
use pod_account::*;
|
||||||
use account_db::*;
|
use account_db::*;
|
||||||
|
use lru_cache::LruCache;
|
||||||
|
|
||||||
|
use std::cell::{RefCell, Cell};
|
||||||
|
|
||||||
|
const STORAGE_CACHE_ITEMS: usize = 8192;
|
||||||
|
|
||||||
/// Single account in the system.
|
/// Single account in the system.
|
||||||
#[derive(Clone)]
|
/// Keeps track of changes to the code and storage.
|
||||||
|
/// The changes are applied in `commit_storage` and `commit_code`
|
||||||
pub struct Account {
|
pub struct Account {
|
||||||
// Balance of the account.
|
// Balance of the account.
|
||||||
balance: U256,
|
balance: U256,
|
||||||
@@ -29,12 +35,22 @@ pub struct Account {
|
|||||||
nonce: U256,
|
nonce: U256,
|
||||||
// Trie-backed storage.
|
// Trie-backed storage.
|
||||||
storage_root: H256,
|
storage_root: H256,
|
||||||
// Overlay on trie-backed storage - tuple is (<clean>, <value>).
|
// LRU Cache of the trie-backed storage.
|
||||||
storage_overlay: RefCell<HashMap<H256, (Filth, H256)>>,
|
// This is limited to `STORAGE_CACHE_ITEMS` recent queries
|
||||||
// Code hash of the account. If None, means that it's a contract whose code has not yet been set.
|
storage_cache: RefCell<LruCache<H256, H256>>,
|
||||||
code_hash: Option<H256>,
|
// Modified storage. Accumulates changes to storage made in `set_storage`
|
||||||
|
// Takes precedence over `storage_cache`.
|
||||||
|
storage_changes: HashMap<H256, H256>,
|
||||||
|
// Code hash of the account.
|
||||||
|
code_hash: H256,
|
||||||
|
// Size of the accoun code.
|
||||||
|
code_size: Option<u64>,
|
||||||
// Code cache of the account.
|
// Code cache of the account.
|
||||||
code_cache: Bytes,
|
code_cache: Arc<Bytes>,
|
||||||
|
// Account code new or has been modified.
|
||||||
|
code_filth: Filth,
|
||||||
|
// Cached address hash.
|
||||||
|
address_hash: Cell<Option<H256>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Account {
|
impl Account {
|
||||||
@@ -45,23 +61,33 @@ impl Account {
|
|||||||
balance: balance,
|
balance: balance,
|
||||||
nonce: nonce,
|
nonce: nonce,
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
storage_overlay: RefCell::new(storage.into_iter().map(|(k, v)| (k, (Filth::Dirty, v))).collect()),
|
storage_cache: Self::empty_storage_cache(),
|
||||||
code_hash: Some(code.sha3()),
|
storage_changes: storage,
|
||||||
code_cache: code
|
code_hash: code.sha3(),
|
||||||
|
code_size: Some(code.len() as u64),
|
||||||
|
code_cache: Arc::new(code),
|
||||||
|
code_filth: Filth::Dirty,
|
||||||
|
address_hash: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
fn empty_storage_cache() -> RefCell<LruCache<H256, H256>> {
|
||||||
#[cfg(feature = "json-tests")]
|
RefCell::new(LruCache::new(STORAGE_CACHE_ITEMS))
|
||||||
|
}
|
||||||
|
|
||||||
/// General constructor.
|
/// General constructor.
|
||||||
pub fn from_pod(pod: PodAccount) -> Account {
|
pub fn from_pod(pod: PodAccount) -> Account {
|
||||||
Account {
|
Account {
|
||||||
balance: pod.balance,
|
balance: pod.balance,
|
||||||
nonce: pod.nonce,
|
nonce: pod.nonce,
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
storage_overlay: RefCell::new(pod.storage.into_iter().map(|(k, v)| (k, (Filth::Dirty, v))).collect()),
|
storage_cache: Self::empty_storage_cache(),
|
||||||
code_hash: Some(pod.code.sha3()),
|
storage_changes: pod.storage.into_iter().collect(),
|
||||||
code_cache: pod.code
|
code_hash: pod.code.as_ref().map_or(SHA3_EMPTY, |c| c.sha3()),
|
||||||
|
code_filth: Filth::Dirty,
|
||||||
|
code_size: Some(pod.code.as_ref().map_or(0, |c| c.len() as u64)),
|
||||||
|
code_cache: Arc::new(pod.code.map_or_else(|| { warn!("POD account with unknown code is being created! Assuming no code."); vec![] }, |c| c)),
|
||||||
|
address_hash: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,9 +97,13 @@ impl Account {
|
|||||||
balance: balance,
|
balance: balance,
|
||||||
nonce: nonce,
|
nonce: nonce,
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
storage_overlay: RefCell::new(HashMap::new()),
|
storage_cache: Self::empty_storage_cache(),
|
||||||
code_hash: Some(SHA3_EMPTY),
|
storage_changes: HashMap::new(),
|
||||||
code_cache: vec![],
|
code_hash: SHA3_EMPTY,
|
||||||
|
code_cache: Arc::new(vec![]),
|
||||||
|
code_size: Some(0),
|
||||||
|
code_filth: Filth::Clean,
|
||||||
|
address_hash: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,42 +114,82 @@ impl Account {
|
|||||||
nonce: r.val_at(0),
|
nonce: r.val_at(0),
|
||||||
balance: r.val_at(1),
|
balance: r.val_at(1),
|
||||||
storage_root: r.val_at(2),
|
storage_root: r.val_at(2),
|
||||||
storage_overlay: RefCell::new(HashMap::new()),
|
storage_cache: Self::empty_storage_cache(),
|
||||||
code_hash: Some(r.val_at(3)),
|
storage_changes: HashMap::new(),
|
||||||
code_cache: vec![],
|
code_hash: r.val_at(3),
|
||||||
|
code_cache: Arc::new(vec![]),
|
||||||
|
code_size: None,
|
||||||
|
code_filth: Filth::Clean,
|
||||||
|
address_hash: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new contract account.
|
/// Create a new contract account.
|
||||||
/// NOTE: make sure you use `init_code` on this before `commit`ing.
|
/// NOTE: make sure you use `init_code` on this before `commit`ing.
|
||||||
pub fn new_contract(balance: U256) -> Account {
|
pub fn new_contract(balance: U256, nonce: U256) -> Account {
|
||||||
Account {
|
Account {
|
||||||
balance: balance,
|
balance: balance,
|
||||||
nonce: U256::from(0u8),
|
nonce: nonce,
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
storage_overlay: RefCell::new(HashMap::new()),
|
storage_cache: Self::empty_storage_cache(),
|
||||||
code_hash: None,
|
storage_changes: HashMap::new(),
|
||||||
code_cache: vec![],
|
code_hash: SHA3_EMPTY,
|
||||||
|
code_cache: Arc::new(vec![]),
|
||||||
|
code_size: None,
|
||||||
|
code_filth: Filth::Clean,
|
||||||
|
address_hash: Cell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set this account's code to the given code.
|
/// Set this account's code to the given code.
|
||||||
/// NOTE: Account should have been created with `new_contract()`
|
/// NOTE: Account should have been created with `new_contract()`
|
||||||
pub fn init_code(&mut self, code: Bytes) {
|
pub fn init_code(&mut self, code: Bytes) {
|
||||||
assert!(self.code_hash.is_none());
|
self.code_hash = code.sha3();
|
||||||
self.code_cache = code;
|
self.code_cache = Arc::new(code);
|
||||||
|
self.code_size = Some(self.code_cache.len() as u64);
|
||||||
|
self.code_filth = Filth::Dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Reset this account's code to the given code.
|
||||||
|
pub fn reset_code(&mut self, code: Bytes) {
|
||||||
|
self.init_code(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set (and cache) the contents of the trie's storage at `key` to `value`.
|
/// Set (and cache) the contents of the trie's storage at `key` to `value`.
|
||||||
pub fn set_storage(&mut self, key: H256, value: H256) {
|
pub fn set_storage(&mut self, key: H256, value: H256) {
|
||||||
self.storage_overlay.borrow_mut().insert(key, (Filth::Dirty, value));
|
self.storage_changes.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get (and cache) the contents of the trie's storage at `key`.
|
/// Get (and cache) the contents of the trie's storage at `key`.
|
||||||
|
/// Takes modifed storage into account.
|
||||||
pub fn storage_at(&self, db: &AccountDB, key: &H256) -> H256 {
|
pub fn storage_at(&self, db: &AccountDB, key: &H256) -> H256 {
|
||||||
self.storage_overlay.borrow_mut().entry(key.clone()).or_insert_with(||{
|
if let Some(value) = self.cached_storage_at(key) {
|
||||||
(Filth::Clean, H256::from(SecTrieDB::new(db, &self.storage_root).get(key.bytes()).map_or(U256::zero(), |v| -> U256 {decode(v)})))
|
return value;
|
||||||
}).1.clone()
|
}
|
||||||
|
let db = SecTrieDB::new(db, &self.storage_root)
|
||||||
|
.expect("Account storage_root initially set to zero (valid) and only altered by SecTrieDBMut. \
|
||||||
|
SecTrieDBMut would not set it to an invalid state root. Therefore the root is valid and DB creation \
|
||||||
|
using it will not fail.");
|
||||||
|
|
||||||
|
let item: U256 = match db.get(key){
|
||||||
|
Ok(x) => x.map_or_else(U256::zero, decode),
|
||||||
|
Err(e) => panic!("Encountered potential DB corruption: {}", e),
|
||||||
|
};
|
||||||
|
let value: H256 = item.into();
|
||||||
|
self.storage_cache.borrow_mut().insert(key.clone(), value.clone());
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get cached storage value if any. Returns `None` if the
|
||||||
|
/// key is not in the cache.
|
||||||
|
pub fn cached_storage_at(&self, key: &H256) -> Option<H256> {
|
||||||
|
if let Some(value) = self.storage_changes.get(key) {
|
||||||
|
return Some(value.clone())
|
||||||
|
}
|
||||||
|
if let Some(value) = self.storage_cache.borrow_mut().get_mut(key) {
|
||||||
|
return Some(value.clone())
|
||||||
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return the balance associated with this account.
|
/// return the balance associated with this account.
|
||||||
@@ -128,101 +198,168 @@ impl Account {
|
|||||||
/// return the nonce associated with this account.
|
/// return the nonce associated with this account.
|
||||||
pub fn nonce(&self) -> &U256 { &self.nonce }
|
pub fn nonce(&self) -> &U256 { &self.nonce }
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
/// return the code hash associated with this account.
|
/// return the code hash associated with this account.
|
||||||
pub fn code_hash(&self) -> H256 {
|
pub fn code_hash(&self) -> H256 {
|
||||||
self.code_hash.clone().unwrap_or(SHA3_EMPTY)
|
self.code_hash.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// return the code hash associated with this account.
|
||||||
|
pub fn address_hash(&self, address: &Address) -> H256 {
|
||||||
|
let hash = self.address_hash.get();
|
||||||
|
hash.unwrap_or_else(|| {
|
||||||
|
let hash = address.sha3();
|
||||||
|
self.address_hash.set(Some(hash.clone()));
|
||||||
|
hash
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// returns the account's code. If `None` then the code cache isn't available -
|
/// returns the account's code. If `None` then the code cache isn't available -
|
||||||
/// get someone who knows to call `note_code`.
|
/// get someone who knows to call `note_code`.
|
||||||
pub fn code(&self) -> Option<&[u8]> {
|
pub fn code(&self) -> Option<Arc<Bytes>> {
|
||||||
match self.code_hash {
|
if self.code_hash != SHA3_EMPTY && self.code_cache.is_empty() {
|
||||||
Some(SHA3_EMPTY) | None if self.code_cache.is_empty() => Some(&self.code_cache),
|
return None;
|
||||||
Some(_) if !self.code_cache.is_empty() => Some(&self.code_cache),
|
|
||||||
None => Some(&self.code_cache),
|
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
|
Some(self.code_cache.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// returns the account's code size. If `None` then the code cache or code size cache isn't available -
|
||||||
|
/// get someone who knows to call `note_code`.
|
||||||
|
pub fn code_size(&self) -> Option<u64> {
|
||||||
|
self.code_size.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
/// Provide a byte array which hashes to the `code_hash`. returns the hash as a result.
|
/// Provide a byte array which hashes to the `code_hash`. returns the hash as a result.
|
||||||
pub fn note_code(&mut self, code: Bytes) -> Result<(), H256> {
|
pub fn note_code(&mut self, code: Bytes) -> Result<(), H256> {
|
||||||
let h = code.sha3();
|
let h = code.sha3();
|
||||||
match self.code_hash {
|
if self.code_hash == h {
|
||||||
Some(ref i) if h == *i => {
|
self.code_cache = Arc::new(code);
|
||||||
self.code_cache = code;
|
self.code_size = Some(self.code_cache.len() as u64);
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
} else {
|
||||||
_ => Err(h)
|
Err(h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is `code_cache` valid; such that code is going to return Some?
|
/// Is `code_cache` valid; such that code is going to return Some?
|
||||||
pub fn is_cached(&self) -> bool {
|
pub fn is_cached(&self) -> bool {
|
||||||
!self.code_cache.is_empty() || (self.code_cache.is_empty() && self.code_hash == Some(SHA3_EMPTY))
|
!self.code_cache.is_empty() || (self.code_cache.is_empty() && self.code_hash == SHA3_EMPTY)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a database to lookup `code_hash`. Should not be called if it is a contract without code.
|
/// Provide a database to get `code_hash`. Should not be called if it is a contract without code.
|
||||||
pub fn cache_code(&mut self, db: &AccountDB) -> bool {
|
pub fn cache_code(&mut self, db: &AccountDB) -> bool {
|
||||||
// TODO: fill out self.code_cache;
|
// TODO: fill out self.code_cache;
|
||||||
trace!("Account::cache_code: ic={}; self.code_hash={:?}, self.code_cache={}", self.is_cached(), self.code_hash, self.code_cache.pretty());
|
trace!("Account::cache_code: ic={}; self.code_hash={:?}, self.code_cache={}", self.is_cached(), self.code_hash, self.code_cache.pretty());
|
||||||
self.is_cached() ||
|
self.is_cached() ||
|
||||||
match self.code_hash {
|
match db.get(&self.code_hash) {
|
||||||
Some(ref h) => match db.lookup(h) {
|
Some(x) => {
|
||||||
Some(x) => { self.code_cache = x.to_vec(); true },
|
self.code_cache = Arc::new(x.to_vec());
|
||||||
|
self.code_size = Some(x.len() as u64);
|
||||||
|
true
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
warn!("Failed reverse get of {}", self.code_hash);
|
||||||
|
false
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provide a database to get `code_size`. Should not be called if it is a contract without code.
|
||||||
|
pub fn cache_code_size(&mut self, db: &AccountDB) -> bool {
|
||||||
|
// TODO: fill out self.code_cache;
|
||||||
|
trace!("Account::cache_code_size: ic={}; self.code_hash={:?}, self.code_cache={}", self.is_cached(), self.code_hash, self.code_cache.pretty());
|
||||||
|
self.code_size.is_some() ||
|
||||||
|
if self.code_hash != SHA3_EMPTY {
|
||||||
|
match db.get(&self.code_hash) {
|
||||||
|
Some(x) => {
|
||||||
|
self.code_size = Some(x.len() as u64);
|
||||||
|
true
|
||||||
|
},
|
||||||
_ => {
|
_ => {
|
||||||
warn!("Failed reverse lookup of {}", h);
|
warn!("Failed reverse get of {}", self.code_hash);
|
||||||
false
|
false
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
_ => false,
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
/// Determine whether there are any un-`commit()`-ed storage-setting operations.
|
/// Determine whether there are any un-`commit()`-ed storage-setting operations.
|
||||||
pub fn storage_is_clean(&self) -> bool { self.storage_overlay.borrow().iter().find(|&(_, &(f, _))| f == Filth::Dirty).is_none() }
|
pub fn storage_is_clean(&self) -> bool { self.storage_changes.is_empty() }
|
||||||
|
|
||||||
|
/// Check if account has zero nonce, balance, no code and no storage.
|
||||||
|
///
|
||||||
|
/// NOTE: Will panic if `!self.storage_is_clean()`
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
assert!(self.storage_is_clean(), "Account::is_empty() may only legally be called when storage is clean.");
|
||||||
|
self.is_null() && self.storage_root == SHA3_NULL_RLP
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if account has zero nonce, balance, no code.
|
||||||
|
pub fn is_null(&self) -> bool {
|
||||||
|
self.balance.is_zero() &&
|
||||||
|
self.nonce.is_zero() &&
|
||||||
|
self.code_hash == SHA3_EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
/// return the storage root associated with this account or None if it has been altered via the overlay.
|
/// return the storage root associated with this account or None if it has been altered via the overlay.
|
||||||
pub fn storage_root(&self) -> Option<&H256> { if self.storage_is_clean() {Some(&self.storage_root)} else {None} }
|
pub fn storage_root(&self) -> Option<&H256> { if self.storage_is_clean() {Some(&self.storage_root)} else {None} }
|
||||||
|
|
||||||
/// return the storage overlay.
|
/// return the storage overlay.
|
||||||
pub fn storage_overlay(&self) -> Ref<HashMap<H256, (Filth, H256)>> { self.storage_overlay.borrow() }
|
pub fn storage_changes(&self) -> &HashMap<H256, H256> { &self.storage_changes }
|
||||||
|
|
||||||
/// Increment the nonce of the account by one.
|
/// Increment the nonce of the account by one.
|
||||||
pub fn inc_nonce(&mut self) { self.nonce = self.nonce + U256::from(1u8); }
|
pub fn inc_nonce(&mut self) {
|
||||||
|
self.nonce = self.nonce + U256::from(1u8);
|
||||||
|
}
|
||||||
|
|
||||||
/// Increment the nonce of the account by one.
|
/// Increase account balance.
|
||||||
pub fn add_balance(&mut self, x: &U256) { self.balance = self.balance + *x; }
|
pub fn add_balance(&mut self, x: &U256) {
|
||||||
|
self.balance = self.balance + *x;
|
||||||
|
}
|
||||||
|
|
||||||
/// Increment the nonce of the account by one.
|
/// Decrease account balance.
|
||||||
pub fn sub_balance(&mut self, x: &U256) { self.balance = self.balance - *x; }
|
/// Panics if balance is less than `x`
|
||||||
|
pub fn sub_balance(&mut self, x: &U256) {
|
||||||
|
assert!(self.balance >= *x);
|
||||||
|
self.balance = self.balance - *x;
|
||||||
|
}
|
||||||
|
|
||||||
/// Commit the `storage_overlay` to the backing DB and update `storage_root`.
|
/// Commit the `storage_changes` to the backing DB and update `storage_root`.
|
||||||
pub fn commit_storage(&mut self, db: &mut AccountDBMut) {
|
pub fn commit_storage(&mut self, trie_factory: &TrieFactory, db: &mut AccountDBMut) {
|
||||||
let mut t = SecTrieDBMut::from_existing(db, &mut self.storage_root);
|
let mut t = trie_factory.from_existing(db, &mut self.storage_root)
|
||||||
for (k, &mut (ref mut f, ref mut v)) in self.storage_overlay.borrow_mut().iter_mut() {
|
.expect("Account storage_root initially set to zero (valid) and only altered by SecTrieDBMut. \
|
||||||
if f == &Filth::Dirty {
|
SecTrieDBMut would not set it to an invalid state root. Therefore the root is valid and DB creation \
|
||||||
// cast key and value to trait type,
|
using it will not fail.");
|
||||||
// so we can call overloaded `to_bytes` method
|
for (k, v) in self.storage_changes.drain() {
|
||||||
match v.is_zero() {
|
// cast key and value to trait type,
|
||||||
true => { t.remove(k); },
|
// so we can call overloaded `to_bytes` method
|
||||||
false => { t.insert(k, &encode(&U256::from(v.as_slice()))); },
|
let res = match v.is_zero() {
|
||||||
}
|
true => t.remove(k.as_slice()),
|
||||||
*f = Filth::Clean;
|
false => t.insert(k.as_slice(), &encode(&U256::from(v.as_slice()))),
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Err(e) = res {
|
||||||
|
warn!("Encountered potential DB corruption: {}", e);
|
||||||
}
|
}
|
||||||
|
self.storage_cache.borrow_mut().insert(k, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Commit any unsaved code. `code_hash` will always return the hash of the `code_cache` after this.
|
/// Commit any unsaved code. `code_hash` will always return the hash of the `code_cache` after this.
|
||||||
pub fn commit_code(&mut self, db: &mut AccountDBMut) {
|
pub fn commit_code(&mut self, db: &mut AccountDBMut) {
|
||||||
trace!("Commiting code of {:?} - {:?}, {:?}", self, self.code_hash.is_none(), self.code_cache.is_empty());
|
trace!("Commiting code of {:?} - {:?}, {:?}", self, self.code_filth == Filth::Dirty, self.code_cache.is_empty());
|
||||||
match (self.code_hash.is_none(), self.code_cache.is_empty()) {
|
match (self.code_filth == Filth::Dirty, self.code_cache.is_empty()) {
|
||||||
(true, true) => self.code_hash = Some(SHA3_EMPTY),
|
(true, true) => {
|
||||||
|
self.code_size = Some(0);
|
||||||
|
self.code_filth = Filth::Clean;
|
||||||
|
},
|
||||||
(true, false) => {
|
(true, false) => {
|
||||||
self.code_hash = Some(db.insert(&self.code_cache));
|
db.emplace(self.code_hash.clone(), (*self.code_cache).clone());
|
||||||
|
self.code_size = Some(self.code_cache.len() as u64);
|
||||||
|
self.code_filth = Filth::Clean;
|
||||||
},
|
},
|
||||||
(false, _) => {},
|
(false, _) => {},
|
||||||
}
|
}
|
||||||
@@ -234,9 +371,59 @@ impl Account {
|
|||||||
stream.append(&self.nonce);
|
stream.append(&self.nonce);
|
||||||
stream.append(&self.balance);
|
stream.append(&self.balance);
|
||||||
stream.append(&self.storage_root);
|
stream.append(&self.storage_root);
|
||||||
stream.append(self.code_hash.as_ref().expect("Cannot form RLP of contract account without code."));
|
stream.append(&self.code_hash);
|
||||||
stream.out()
|
stream.out()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Clone basic account data
|
||||||
|
pub fn clone_basic(&self) -> Account {
|
||||||
|
Account {
|
||||||
|
balance: self.balance.clone(),
|
||||||
|
nonce: self.nonce.clone(),
|
||||||
|
storage_root: self.storage_root.clone(),
|
||||||
|
storage_cache: Self::empty_storage_cache(),
|
||||||
|
storage_changes: HashMap::new(),
|
||||||
|
code_hash: self.code_hash.clone(),
|
||||||
|
code_size: self.code_size.clone(),
|
||||||
|
code_cache: self.code_cache.clone(),
|
||||||
|
code_filth: self.code_filth,
|
||||||
|
address_hash: self.address_hash.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clone account data and dirty storage keys
|
||||||
|
pub fn clone_dirty(&self) -> Account {
|
||||||
|
let mut account = self.clone_basic();
|
||||||
|
account.storage_changes = self.storage_changes.clone();
|
||||||
|
account.code_cache = self.code_cache.clone();
|
||||||
|
account
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clone account data, dirty storage keys and cached storage keys.
|
||||||
|
pub fn clone_all(&self) -> Account {
|
||||||
|
let mut account = self.clone_dirty();
|
||||||
|
account.storage_cache = self.storage_cache.clone();
|
||||||
|
account
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replace self with the data from other account merging storage cache.
|
||||||
|
/// Basic account data and all modifications are overwritten
|
||||||
|
/// with new values.
|
||||||
|
pub fn overwrite_with(&mut self, other: Account) {
|
||||||
|
self.balance = other.balance;
|
||||||
|
self.nonce = other.nonce;
|
||||||
|
self.storage_root = other.storage_root;
|
||||||
|
self.code_hash = other.code_hash;
|
||||||
|
self.code_filth = other.code_filth;
|
||||||
|
self.code_cache = other.code_cache;
|
||||||
|
self.code_size = other.code_size;
|
||||||
|
self.address_hash = other.address_hash;
|
||||||
|
let mut cache = self.storage_cache.borrow_mut();
|
||||||
|
for (k, v) in other.storage_cache.into_inner().into_iter() {
|
||||||
|
cache.insert(k.clone() , v.clone()); //TODO: cloning should not be required here
|
||||||
|
}
|
||||||
|
self.storage_changes = other.storage_changes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Account {
|
impl fmt::Debug for Account {
|
||||||
@@ -252,14 +439,24 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use account_db::*;
|
use account_db::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn account_compress() {
|
||||||
|
let raw = Account::new_basic(2.into(), 4.into()).rlp();
|
||||||
|
let rlp = UntrustedRlp::new(&raw);
|
||||||
|
let compact_vec = rlp.compress(RlpType::Snapshot).to_vec();
|
||||||
|
assert!(raw.len() > compact_vec.len());
|
||||||
|
let again_raw = UntrustedRlp::new(&compact_vec).decompress(RlpType::Snapshot);
|
||||||
|
assert_eq!(raw, again_raw.to_vec());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn storage_at() {
|
fn storage_at() {
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
let rlp = {
|
let rlp = {
|
||||||
let mut a = Account::new_contract(U256::from(69u8));
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
a.set_storage(H256::from(&U256::from(0x00u64)), H256::from(&U256::from(0x1234u64)));
|
a.set_storage(H256::from(&U256::from(0x00u64)), H256::from(&U256::from(0x1234u64)));
|
||||||
a.commit_storage(&mut db);
|
a.commit_storage(&Default::default(), &mut db);
|
||||||
a.init_code(vec![]);
|
a.init_code(vec![]);
|
||||||
a.commit_code(&mut db);
|
a.commit_code(&mut db);
|
||||||
a.rlp()
|
a.rlp()
|
||||||
@@ -277,7 +474,7 @@ mod tests {
|
|||||||
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
|
|
||||||
let rlp = {
|
let rlp = {
|
||||||
let mut a = Account::new_contract(U256::from(69u8));
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
a.init_code(vec![0x55, 0x44, 0xffu8]);
|
a.init_code(vec![0x55, 0x44, 0xffu8]);
|
||||||
a.commit_code(&mut db);
|
a.commit_code(&mut db);
|
||||||
a.rlp()
|
a.rlp()
|
||||||
@@ -292,40 +489,57 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_storage() {
|
fn commit_storage() {
|
||||||
let mut a = Account::new_contract(U256::from(69u8));
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
a.set_storage(x!(0), x!(0x1234));
|
a.set_storage(0.into(), 0x1234.into());
|
||||||
assert_eq!(a.storage_root(), None);
|
assert_eq!(a.storage_root(), None);
|
||||||
a.commit_storage(&mut db);
|
a.commit_storage(&Default::default(), &mut db);
|
||||||
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
|
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_remove_commit_storage() {
|
fn commit_remove_commit_storage() {
|
||||||
let mut a = Account::new_contract(U256::from(69u8));
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
a.set_storage(x!(0), x!(0x1234));
|
a.set_storage(0.into(), 0x1234.into());
|
||||||
a.commit_storage(&mut db);
|
a.commit_storage(&Default::default(), &mut db);
|
||||||
a.set_storage(x!(1), x!(0x1234));
|
a.set_storage(1.into(), 0x1234.into());
|
||||||
a.commit_storage(&mut db);
|
a.commit_storage(&Default::default(), &mut db);
|
||||||
a.set_storage(x!(1), x!(0));
|
a.set_storage(1.into(), 0.into());
|
||||||
a.commit_storage(&mut db);
|
a.commit_storage(&Default::default(), &mut db);
|
||||||
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
|
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_code() {
|
fn commit_code() {
|
||||||
let mut a = Account::new_contract(U256::from(69u8));
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
a.init_code(vec![0x55, 0x44, 0xffu8]);
|
a.init_code(vec![0x55, 0x44, 0xffu8]);
|
||||||
assert_eq!(a.code_hash(), SHA3_EMPTY);
|
assert_eq!(a.code_filth, Filth::Dirty);
|
||||||
|
assert_eq!(a.code_size(), Some(3));
|
||||||
a.commit_code(&mut db);
|
a.commit_code(&mut db);
|
||||||
assert_eq!(a.code_hash().hex(), "af231e631776a517ca23125370d542873eca1fb4d613ed9b5d5335a46ae5b7eb");
|
assert_eq!(a.code_hash().hex(), "af231e631776a517ca23125370d542873eca1fb4d613ed9b5d5335a46ae5b7eb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn reset_code() {
|
||||||
|
let mut a = Account::new_contract(69.into(), 0.into());
|
||||||
|
let mut db = MemoryDB::new();
|
||||||
|
let mut db = AccountDBMut::new(&mut db, &Address::new());
|
||||||
|
a.init_code(vec![0x55, 0x44, 0xffu8]);
|
||||||
|
assert_eq!(a.code_filth, Filth::Dirty);
|
||||||
|
a.commit_code(&mut db);
|
||||||
|
assert_eq!(a.code_filth, Filth::Clean);
|
||||||
|
assert_eq!(a.code_hash().hex(), "af231e631776a517ca23125370d542873eca1fb4d613ed9b5d5335a46ae5b7eb");
|
||||||
|
a.reset_code(vec![0x55]);
|
||||||
|
assert_eq!(a.code_filth, Filth::Dirty);
|
||||||
|
a.commit_code(&mut db);
|
||||||
|
assert_eq!(a.code_hash().hex(), "37bf2238b11b68cdc8382cece82651b59d3c3988873b6e0f33d79694aa45f1be");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rlpio() {
|
fn rlpio() {
|
||||||
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
||||||
@@ -338,8 +552,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_account() {
|
fn new_account() {
|
||||||
use rustc_serialize::hex::ToHex;
|
|
||||||
|
|
||||||
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
||||||
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
||||||
assert_eq!(a.balance(), &U256::from(69u8));
|
assert_eq!(a.balance(), &U256::from(69u8));
|
||||||
@@ -350,8 +562,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_account() {
|
fn create_account() {
|
||||||
use rustc_serialize::hex::ToHex;
|
|
||||||
|
|
||||||
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
|
||||||
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,59 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! DB backend wrapper for Account trie
|
//! DB backend wrapper for Account trie
|
||||||
use util::*;
|
use util::*;
|
||||||
|
|
||||||
static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];
|
static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];
|
||||||
|
|
||||||
|
// combines a key with an address hash to ensure uniqueness.
|
||||||
|
// leaves the first 96 bits untouched in order to support partial key lookup.
|
||||||
|
#[inline]
|
||||||
|
fn combine_key<'a>(address_hash: &'a H256, key: &'a H256) -> H256 {
|
||||||
|
let mut dst = key.clone();
|
||||||
|
{
|
||||||
|
let last_src: &[u8] = &*address_hash;
|
||||||
|
let last_dst: &mut [u8] = &mut *dst;
|
||||||
|
for (k, a) in last_dst[12..].iter_mut().zip(&last_src[12..]) {
|
||||||
|
*k ^= *a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dst
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: introduce HashDBMut?
|
// TODO: introduce HashDBMut?
|
||||||
/// DB backend wrapper for Account trie
|
/// DB backend wrapper for Account trie
|
||||||
/// Transforms trie node keys for the database
|
/// Transforms trie node keys for the database
|
||||||
pub struct AccountDB<'db> {
|
pub struct AccountDB<'db> {
|
||||||
db: &'db HashDB,
|
db: &'db HashDB,
|
||||||
address: H256,
|
address_hash: H256,
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn combine_key<'a>(address: &'a H256, key: &'a H256) -> H256 {
|
|
||||||
let mut addr_hash = address.sha3();
|
|
||||||
// preserve 96 bits of original key for db lookup
|
|
||||||
addr_hash[0..12].clone_from_slice(&[0u8; 12]);
|
|
||||||
&addr_hash ^ key
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> AccountDB<'db> {
|
impl<'db> AccountDB<'db> {
|
||||||
pub fn new(db: &'db HashDB, address: &Address) -> AccountDB<'db> {
|
/// Create a new AccountDB from an address.
|
||||||
|
pub fn new(db: &'db HashDB, address: &Address) -> Self {
|
||||||
|
Self::from_hash(db, address.sha3())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a new AcountDB from an address' hash.
|
||||||
|
pub fn from_hash(db: &'db HashDB, address_hash: H256) -> Self {
|
||||||
AccountDB {
|
AccountDB {
|
||||||
db: db,
|
db: db,
|
||||||
address: x!(address.clone()),
|
address_hash: address_hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,18 +63,18 @@ impl<'db> HashDB for AccountDB<'db>{
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lookup(&self, key: &H256) -> Option<&[u8]> {
|
fn get(&self, key: &H256) -> Option<&[u8]> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(&NULL_RLP_STATIC);
|
return Some(&NULL_RLP_STATIC);
|
||||||
}
|
}
|
||||||
self.db.lookup(&combine_key(&self.address, key))
|
self.db.get(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exists(&self, key: &H256) -> bool {
|
fn contains(&self, key: &H256) -> bool {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
self.db.exists(&combine_key(&self.address, key))
|
self.db.contains(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert(&mut self, _value: &[u8]) -> H256 {
|
fn insert(&mut self, _value: &[u8]) -> H256 {
|
||||||
@@ -55,7 +85,7 @@ impl<'db> HashDB for AccountDB<'db>{
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kill(&mut self, _key: &H256) {
|
fn remove(&mut self, _key: &H256) {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,20 +93,26 @@ impl<'db> HashDB for AccountDB<'db>{
|
|||||||
/// DB backend wrapper for Account trie
|
/// DB backend wrapper for Account trie
|
||||||
pub struct AccountDBMut<'db> {
|
pub struct AccountDBMut<'db> {
|
||||||
db: &'db mut HashDB,
|
db: &'db mut HashDB,
|
||||||
address: H256,
|
address_hash: H256,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> AccountDBMut<'db> {
|
impl<'db> AccountDBMut<'db> {
|
||||||
pub fn new(db: &'db mut HashDB, address: &Address) -> AccountDBMut<'db> {
|
/// Create a new AccountDB from an address.
|
||||||
|
pub fn new(db: &'db mut HashDB, address: &Address) -> Self {
|
||||||
|
Self::from_hash(db, address.sha3())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create a new AcountDB from an address' hash.
|
||||||
|
pub fn from_hash(db: &'db mut HashDB, address_hash: H256) -> Self {
|
||||||
AccountDBMut {
|
AccountDBMut {
|
||||||
db: db,
|
db: db,
|
||||||
address: x!(address.clone()),
|
address_hash: address_hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn immutable(&'db self) -> AccountDB<'db> {
|
pub fn immutable(&'db self) -> AccountDB<'db> {
|
||||||
AccountDB { db: self.db, address: self.address.clone() }
|
AccountDB { db: self.db, address_hash: self.address_hash.clone() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,35 +121,44 @@ impl<'db> HashDB for AccountDBMut<'db>{
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lookup(&self, key: &H256) -> Option<&[u8]> {
|
fn get(&self, key: &H256) -> Option<&[u8]> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(&NULL_RLP_STATIC);
|
return Some(&NULL_RLP_STATIC);
|
||||||
}
|
}
|
||||||
self.db.lookup(&combine_key(&self.address, key))
|
self.db.get(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exists(&self, key: &H256) -> bool {
|
fn contains(&self, key: &H256) -> bool {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
self.db.exists(&combine_key(&self.address, key))
|
self.db.contains(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert(&mut self, value: &[u8]) -> H256 {
|
fn insert(&mut self, value: &[u8]) -> H256 {
|
||||||
|
if value == &NULL_RLP {
|
||||||
|
return SHA3_NULL_RLP.clone();
|
||||||
|
}
|
||||||
let k = value.sha3();
|
let k = value.sha3();
|
||||||
let ak = combine_key(&self.address, &k);
|
let ak = combine_key(&self.address_hash, &k);
|
||||||
self.db.emplace(ak, value.to_vec());
|
self.db.emplace(ak, value.to_vec());
|
||||||
k
|
k
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emplace(&mut self, key: H256, value: Bytes) {
|
fn emplace(&mut self, key: H256, value: Bytes) {
|
||||||
let key = combine_key(&self.address, &key);
|
if key == SHA3_NULL_RLP {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let key = combine_key(&self.address_hash, &key);
|
||||||
self.db.emplace(key, value.to_vec())
|
self.db.emplace(key, value.to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn kill(&mut self, key: &H256) {
|
fn remove(&mut self, key: &H256) {
|
||||||
let key = combine_key(&self.address, key);
|
if key == &SHA3_NULL_RLP {
|
||||||
self.db.kill(&key)
|
return;
|
||||||
|
}
|
||||||
|
let key = combine_key(&self.address_hash, key);
|
||||||
|
self.db.remove(&key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
355
ethcore/src/account_provider.rs
Normal file
355
ethcore/src/account_provider.rs
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Account management.
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::time::{Instant, Duration};
|
||||||
|
use util::{Address as H160, H256, H520, Mutex, RwLock};
|
||||||
|
use ethstore::{SecretStore, Error as SSError, SafeAccount, EthStore};
|
||||||
|
use ethstore::dir::{KeyDirectory};
|
||||||
|
use ethstore::ethkey::{Address as SSAddress, Message as SSMessage, Secret as SSSecret, Random, Generator};
|
||||||
|
|
||||||
|
|
||||||
|
/// Type of unlock.
|
||||||
|
#[derive(Clone)]
|
||||||
|
enum Unlock {
|
||||||
|
/// If account is unlocked temporarily, it should be locked after first usage.
|
||||||
|
Temp,
|
||||||
|
/// Account unlocked permantently can always sign message.
|
||||||
|
/// Use with caution.
|
||||||
|
Perm,
|
||||||
|
/// Account unlocked with a timeout
|
||||||
|
Timed((Instant, u32)),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Data associated with account.
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct AccountData {
|
||||||
|
unlock: Unlock,
|
||||||
|
password: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `AccountProvider` errors.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Error {
|
||||||
|
/// Returned when account is not unlocked.
|
||||||
|
NotUnlocked,
|
||||||
|
/// Returned when signing fails.
|
||||||
|
SStore(SSError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Error {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||||
|
match *self {
|
||||||
|
Error::NotUnlocked => write!(f, "Account is locked"),
|
||||||
|
Error::SStore(ref e) => write!(f, "{}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<SSError> for Error {
|
||||||
|
fn from(e: SSError) -> Self {
|
||||||
|
Error::SStore(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macro_rules! impl_bridge_type {
|
||||||
|
($name: ident, $size: expr, $core: ident, $store: ident) => {
|
||||||
|
/// Primitive
|
||||||
|
pub struct $name([u8; $size]);
|
||||||
|
|
||||||
|
impl From<[u8; $size]> for $name {
|
||||||
|
fn from(s: [u8; $size]) -> Self {
|
||||||
|
$name(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<$core> for $name {
|
||||||
|
fn from(s: $core) -> Self {
|
||||||
|
$name(s.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<$store> for $name {
|
||||||
|
fn from(s: $store) -> Self {
|
||||||
|
$name(s.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<$core> for $name {
|
||||||
|
fn into(self) -> $core {
|
||||||
|
$core(self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<$store> for $name {
|
||||||
|
fn into(self) -> $store {
|
||||||
|
$store::from(self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_bridge_type!(Secret, 32, H256, SSSecret);
|
||||||
|
impl_bridge_type!(Message, 32, H256, SSMessage);
|
||||||
|
impl_bridge_type!(Address, 20, H160, SSAddress);
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct NullDir {
|
||||||
|
accounts: RwLock<HashMap<SSAddress, SafeAccount>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl KeyDirectory for NullDir {
|
||||||
|
fn load(&self) -> Result<Vec<SafeAccount>, SSError> {
|
||||||
|
Ok(self.accounts.read().values().cloned().collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn insert(&self, account: SafeAccount) -> Result<SafeAccount, SSError> {
|
||||||
|
self.accounts.write().insert(account.address.clone(), account.clone());
|
||||||
|
Ok(account)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove(&self, address: &SSAddress) -> Result<(), SSError> {
|
||||||
|
self.accounts.write().remove(address);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Account management.
|
||||||
|
/// Responsible for unlocking accounts.
|
||||||
|
pub struct AccountProvider {
|
||||||
|
unlocked: Mutex<HashMap<SSAddress, AccountData>>,
|
||||||
|
sstore: Box<SecretStore>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Collected account metadata
|
||||||
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
pub struct AccountMeta {
|
||||||
|
/// The name of the account.
|
||||||
|
pub name: String,
|
||||||
|
/// The rest of the metadata of the account.
|
||||||
|
pub meta: String,
|
||||||
|
/// The 128-bit UUID of the account, if it has one (brain-wallets don't).
|
||||||
|
pub uuid: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for AccountMeta {
|
||||||
|
fn default() -> Self {
|
||||||
|
AccountMeta {
|
||||||
|
name: String::new(),
|
||||||
|
meta: "{}".to_owned(),
|
||||||
|
uuid: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AccountProvider {
|
||||||
|
/// Creates new account provider.
|
||||||
|
pub fn new(sstore: Box<SecretStore>) -> Self {
|
||||||
|
AccountProvider {
|
||||||
|
unlocked: Mutex::new(HashMap::new()),
|
||||||
|
sstore: sstore,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates not disk backed provider.
|
||||||
|
pub fn transient_provider() -> Self {
|
||||||
|
AccountProvider {
|
||||||
|
unlocked: Mutex::new(HashMap::new()),
|
||||||
|
sstore: Box::new(EthStore::open(Box::new(NullDir::default())).unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates new random account.
|
||||||
|
pub fn new_account(&self, password: &str) -> Result<H160, Error> {
|
||||||
|
let secret = Random.generate().unwrap().secret().clone();
|
||||||
|
let address = try!(self.sstore.insert_account(secret, password));
|
||||||
|
Ok(Address::from(address).into())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Inserts new account into underlying store.
|
||||||
|
/// Does not unlock account!
|
||||||
|
pub fn insert_account<S>(&self, secret: S, password: &str) -> Result<H160, Error> where Secret: From<S> {
|
||||||
|
let s = Secret::from(secret);
|
||||||
|
let address = try!(self.sstore.insert_account(s.into(), password));
|
||||||
|
Ok(Address::from(address).into())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns addresses of all accounts.
|
||||||
|
pub fn accounts(&self) -> Result<Vec<H160>, Error> {
|
||||||
|
let accounts = try!(self.sstore.accounts()).into_iter().map(|a| H160(a.into())).collect();
|
||||||
|
Ok(accounts)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns each account along with name and meta.
|
||||||
|
pub fn accounts_info(&self) -> Result<HashMap<H160, AccountMeta>, Error> {
|
||||||
|
let r: HashMap<H160, AccountMeta> = try!(self.sstore.accounts())
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| (H160(a.clone().into()), self.account_meta(a).unwrap_or_else(|_| Default::default())))
|
||||||
|
.collect();
|
||||||
|
Ok(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns each account along with name and meta.
|
||||||
|
pub fn account_meta<A>(&self, account: A) -> Result<AccountMeta, Error> where Address: From<A> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
Ok(AccountMeta {
|
||||||
|
name: try!(self.sstore.name(&account)),
|
||||||
|
meta: try!(self.sstore.meta(&account)),
|
||||||
|
uuid: self.sstore.uuid(&account).ok().map(Into::into), // allowed to not have a UUID
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns each account along with name and meta.
|
||||||
|
pub fn set_account_name<A>(&self, account: A, name: String) -> Result<(), Error> where Address: From<A> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
try!(self.sstore.set_name(&account, name));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns each account along with name and meta.
|
||||||
|
pub fn set_account_meta<A>(&self, account: A, meta: String) -> Result<(), Error> where Address: From<A> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
try!(self.sstore.set_meta(&account, meta));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Helper method used for unlocking accounts.
|
||||||
|
fn unlock_account<A>(&self, account: A, password: String, unlock: Unlock) -> Result<(), Error> where Address: From<A> {
|
||||||
|
let a = Address::from(account);
|
||||||
|
let account = a.into();
|
||||||
|
// verify password by signing dump message
|
||||||
|
// result may be discarded
|
||||||
|
let _ = try!(self.sstore.sign(&account, &password, &Default::default()));
|
||||||
|
|
||||||
|
// check if account is already unlocked pernamently, if it is, do nothing
|
||||||
|
let mut unlocked = self.unlocked.lock();
|
||||||
|
if let Some(data) = unlocked.get(&account) {
|
||||||
|
if let Unlock::Perm = data.unlock {
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let data = AccountData {
|
||||||
|
unlock: unlock,
|
||||||
|
password: password,
|
||||||
|
};
|
||||||
|
|
||||||
|
unlocked.insert(account, data);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlocks account permanently.
|
||||||
|
pub fn unlock_account_permanently<A>(&self, account: A, password: String) -> Result<(), Error> where Address: From<A> {
|
||||||
|
self.unlock_account(account, password, Unlock::Perm)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlocks account temporarily (for one signing).
|
||||||
|
pub fn unlock_account_temporarily<A>(&self, account: A, password: String) -> Result<(), Error> where Address: From<A> {
|
||||||
|
self.unlock_account(account, password, Unlock::Temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlocks account temporarily with a timeout.
|
||||||
|
pub fn unlock_account_timed<A>(&self, account: A, password: String, duration_ms: u32) -> Result<(), Error> where Address: From<A> {
|
||||||
|
self.unlock_account(account, password, Unlock::Timed((Instant::now(), duration_ms)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks if given account is unlocked
|
||||||
|
pub fn is_unlocked<A>(&self, account: A) -> bool where Address: From<A> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
let unlocked = self.unlocked.lock();
|
||||||
|
unlocked.get(&account).is_some()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Signs the message. Account must be unlocked.
|
||||||
|
pub fn sign<A, M>(&self, account: A, message: M) -> Result<H520, Error> where Address: From<A>, Message: From<M> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
let message = Message::from(message).into();
|
||||||
|
|
||||||
|
let data = {
|
||||||
|
let mut unlocked = self.unlocked.lock();
|
||||||
|
let data = try!(unlocked.get(&account).ok_or(Error::NotUnlocked)).clone();
|
||||||
|
if let Unlock::Temp = data.unlock {
|
||||||
|
unlocked.remove(&account).expect("data exists: so key must exist: qed");
|
||||||
|
}
|
||||||
|
if let Unlock::Timed((ref start, ref duration)) = data.unlock {
|
||||||
|
if start.elapsed() > Duration::from_millis(*duration as u64) {
|
||||||
|
unlocked.remove(&account).expect("data exists: so key must exist: qed");
|
||||||
|
return Err(Error::NotUnlocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data
|
||||||
|
};
|
||||||
|
|
||||||
|
let signature = try!(self.sstore.sign(&account, &data.password, &message));
|
||||||
|
Ok(H520(signature.into()))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlocks an account, signs the message, and locks it again.
|
||||||
|
pub fn sign_with_password<A, M>(&self, account: A, password: String, message: M) -> Result<H520, Error> where Address: From<A>, Message: From<M> {
|
||||||
|
let account = Address::from(account).into();
|
||||||
|
let message = Message::from(message).into();
|
||||||
|
let signature = try!(self.sstore.sign(&account, &password, &message));
|
||||||
|
Ok(H520(signature.into()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::AccountProvider;
|
||||||
|
use ethstore::ethkey::{Generator, Random};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unlock_account_temp() {
|
||||||
|
let kp = Random.generate().unwrap();
|
||||||
|
let ap = AccountProvider::transient_provider();
|
||||||
|
assert!(ap.insert_account(kp.secret().clone(), "test").is_ok());
|
||||||
|
assert!(ap.unlock_account_temporarily(kp.address(), "test1".into()).is_err());
|
||||||
|
assert!(ap.unlock_account_temporarily(kp.address(), "test".into()).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unlock_account_perm() {
|
||||||
|
let kp = Random.generate().unwrap();
|
||||||
|
let ap = AccountProvider::transient_provider();
|
||||||
|
assert!(ap.insert_account(kp.secret().clone(), "test").is_ok());
|
||||||
|
assert!(ap.unlock_account_permanently(kp.address(), "test1".into()).is_err());
|
||||||
|
assert!(ap.unlock_account_permanently(kp.address(), "test".into()).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
assert!(ap.unlock_account_temporarily(kp.address(), "test".into()).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unlock_account_timer() {
|
||||||
|
let kp = Random.generate().unwrap();
|
||||||
|
let ap = AccountProvider::transient_provider();
|
||||||
|
assert!(ap.insert_account(kp.secret().clone(), "test").is_ok());
|
||||||
|
assert!(ap.unlock_account_timed(kp.address(), "test1".into(), 2000).is_err());
|
||||||
|
assert!(ap.unlock_account_timed(kp.address(), "test".into(), 2000).is_ok());
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_ok());
|
||||||
|
::std::thread::sleep(Duration::from_millis(2000));
|
||||||
|
assert!(ap.sign(kp.address(), [0u8; 32]).is_err());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Evm input params.
|
//! Evm input params.
|
||||||
use util::hash::*;
|
use common::*;
|
||||||
use util::uint::*;
|
use ethjson;
|
||||||
use util::bytes::*;
|
use types::executed::CallType;
|
||||||
|
|
||||||
/// Transaction value
|
/// Transaction value
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -28,12 +28,23 @@ pub enum ActionValue {
|
|||||||
Apparent(U256)
|
Apparent(U256)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ActionValue {
|
||||||
|
/// Returns action value as U256.
|
||||||
|
pub fn value(&self) -> U256 {
|
||||||
|
match *self {
|
||||||
|
ActionValue::Transfer(x) | ActionValue::Apparent(x) => x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: should be a trait, possible to avoid cloning everything from a Transaction(/View).
|
// TODO: should be a trait, possible to avoid cloning everything from a Transaction(/View).
|
||||||
/// Action (call/create) input params. Everything else should be specified in Externalities.
|
/// Action (call/create) input params. Everything else should be specified in Externalities.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ActionParams {
|
pub struct ActionParams {
|
||||||
/// Address of currently executed code.
|
/// Address of currently executed code.
|
||||||
pub code_address: Address,
|
pub code_address: Address,
|
||||||
|
/// Hash of currently executed code.
|
||||||
|
pub code_hash: H256,
|
||||||
/// Receive address. Usually equal to code_address,
|
/// Receive address. Usually equal to code_address,
|
||||||
/// except when called using CALLCODE.
|
/// except when called using CALLCODE.
|
||||||
pub address: Address,
|
pub address: Address,
|
||||||
@@ -48,9 +59,12 @@ pub struct ActionParams {
|
|||||||
/// Transaction value.
|
/// Transaction value.
|
||||||
pub value: ActionValue,
|
pub value: ActionValue,
|
||||||
/// Code being executed.
|
/// Code being executed.
|
||||||
pub code: Option<Bytes>,
|
pub code: Option<Arc<Bytes>>,
|
||||||
/// Input data.
|
/// Input data.
|
||||||
pub data: Option<Bytes>
|
pub data: Option<Bytes>,
|
||||||
|
/// Type of call
|
||||||
|
pub call_type: CallType,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ActionParams {
|
impl Default for ActionParams {
|
||||||
@@ -58,6 +72,7 @@ impl Default for ActionParams {
|
|||||||
fn default() -> ActionParams {
|
fn default() -> ActionParams {
|
||||||
ActionParams {
|
ActionParams {
|
||||||
code_address: Address::new(),
|
code_address: Address::new(),
|
||||||
|
code_hash: SHA3_EMPTY,
|
||||||
address: Address::new(),
|
address: Address::new(),
|
||||||
sender: Address::new(),
|
sender: Address::new(),
|
||||||
origin: Address::new(),
|
origin: Address::new(),
|
||||||
@@ -65,7 +80,27 @@ impl Default for ActionParams {
|
|||||||
gas_price: U256::zero(),
|
gas_price: U256::zero(),
|
||||||
value: ActionValue::Transfer(U256::zero()),
|
value: ActionValue::Transfer(U256::zero()),
|
||||||
code: None,
|
code: None,
|
||||||
data: None
|
data: None,
|
||||||
|
call_type: CallType::None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<ethjson::vm::Transaction> for ActionParams {
|
||||||
|
fn from(t: ethjson::vm::Transaction) -> Self {
|
||||||
|
let address: Address = t.address.into();
|
||||||
|
ActionParams {
|
||||||
|
code_address: Address::new(),
|
||||||
|
code_hash: (&*t.code).sha3(),
|
||||||
|
address: address,
|
||||||
|
sender: t.sender.into(),
|
||||||
|
origin: t.origin.into(),
|
||||||
|
code: Some(Arc::new(t.code.into())),
|
||||||
|
data: Some(t.data.into()),
|
||||||
|
gas: t.gas.into(),
|
||||||
|
gas_price: t.gas_price.into(),
|
||||||
|
value: ActionValue::Transfer(t.value.into()),
|
||||||
|
call_type: match address.is_zero() { true => CallType::None, false => CallType::Call }, // TODO @debris is this correct?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ pub type LogBloom = H2048;
|
|||||||
/// Constant 2048-bit datum for 0. Often used as a default.
|
/// Constant 2048-bit datum for 0. Often used as a default.
|
||||||
pub static ZERO_LOGBLOOM: LogBloom = H2048([0x00; 256]);
|
pub static ZERO_LOGBLOOM: LogBloom = H2048([0x00; 256]);
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(enum_variant_names))]
|
||||||
/// Semantic boolean for when a seal/signature is included.
|
/// Semantic boolean for when a seal/signature is included.
|
||||||
pub enum Seal {
|
pub enum Seal {
|
||||||
/// The seal/signature is included.
|
/// The seal/signature is included.
|
||||||
|
|||||||
@@ -16,16 +16,16 @@
|
|||||||
|
|
||||||
//! Blockchain block.
|
//! Blockchain block.
|
||||||
|
|
||||||
#![allow(ptr_arg)] // Because of &LastHashes -> &Vec<_>
|
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use engine::*;
|
use engines::Engine;
|
||||||
use state::*;
|
use state::*;
|
||||||
use verification::PreVerifiedBlock;
|
use state_db::StateDB;
|
||||||
|
use verification::PreverifiedBlock;
|
||||||
|
use trace::FlatTrace;
|
||||||
|
use evm::Factory as EvmFactory;
|
||||||
|
|
||||||
/// A block, encoded as it is on the block chain.
|
/// A block, encoded as it is on the block chain.
|
||||||
// TODO: rename to Block
|
#[derive(Default, Debug, Clone, PartialEq)]
|
||||||
#[derive(Default, Debug, Clone)]
|
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// The header of this block.
|
/// The header of this block.
|
||||||
pub header: Header,
|
pub header: Header,
|
||||||
@@ -37,31 +37,25 @@ pub struct Block {
|
|||||||
|
|
||||||
impl Block {
|
impl Block {
|
||||||
/// Returns true if the given bytes form a valid encoding of a block in RLP.
|
/// Returns true if the given bytes form a valid encoding of a block in RLP.
|
||||||
// TODO: implement Decoder for this and have this use that.
|
|
||||||
pub fn is_good(b: &[u8]) -> bool {
|
pub fn is_good(b: &[u8]) -> bool {
|
||||||
/*
|
|
||||||
let urlp = UntrustedRlp::new(&b);
|
|
||||||
if !urlp.is_list() || urlp.item_count() != 3 || urlp.size() != b.len() { return false; }
|
|
||||||
if urlp.val_at::<Header>(0).is_err() { return false; }
|
|
||||||
|
|
||||||
if !urlp.at(1).unwrap().is_list() { return false; }
|
|
||||||
if urlp.at(1).unwrap().iter().find(|i| i.as_val::<Transaction>().is_err()).is_some() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !urlp.at(2).unwrap().is_list() { return false; }
|
|
||||||
if urlp.at(2).unwrap().iter().find(|i| i.as_val::<Header>().is_err()).is_some() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
true*/
|
|
||||||
UntrustedRlp::new(b).as_val::<Block>().is_ok()
|
UntrustedRlp::new(b).as_val::<Block>().is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the RLP-encoding of the block with or without the seal.
|
||||||
|
pub fn rlp_bytes(&self, seal: Seal) -> Bytes {
|
||||||
|
let mut block_rlp = RlpStream::new_list(3);
|
||||||
|
self.header.stream_rlp(&mut block_rlp, seal);
|
||||||
|
block_rlp.append(&self.transactions);
|
||||||
|
block_rlp.append(&self.uncles);
|
||||||
|
block_rlp.out()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Decodable for Block {
|
impl Decodable for Block {
|
||||||
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
||||||
if decoder.as_raw().len() != try!(decoder.as_rlp().payload_info()).total() {
|
if decoder.as_raw().len() != try!(decoder.as_rlp().payload_info()).total() {
|
||||||
return Err(DecoderError::RlpIsTooBig);
|
return Err(DecoderError::RlpIsTooBig);
|
||||||
}
|
}
|
||||||
let d = decoder.as_rlp();
|
let d = decoder.as_rlp();
|
||||||
if d.item_count() != 3 {
|
if d.item_count() != 3 {
|
||||||
@@ -76,52 +70,93 @@ impl Decodable for Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Internal type for a block's common elements.
|
/// Internal type for a block's common elements.
|
||||||
// TODO: rename to ExecutedBlock
|
#[derive(Clone)]
|
||||||
// TODO: use BareBlock
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct ExecutedBlock {
|
pub struct ExecutedBlock {
|
||||||
base: Block,
|
base: Block,
|
||||||
|
|
||||||
receipts: Vec<Receipt>,
|
receipts: Vec<Receipt>,
|
||||||
transactions_set: HashSet<H256>,
|
transactions_set: HashSet<H256>,
|
||||||
state: State,
|
state: State,
|
||||||
|
traces: Option<Vec<Vec<FlatTrace>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of references to `ExecutedBlock` fields that are publicly accessible.
|
/// A set of references to `ExecutedBlock` fields that are publicly accessible.
|
||||||
pub struct BlockRefMut<'a> {
|
pub struct BlockRefMut<'a> {
|
||||||
|
/// Block header.
|
||||||
|
pub header: &'a mut Header,
|
||||||
|
/// Block transactions.
|
||||||
|
pub transactions: &'a [SignedTransaction],
|
||||||
|
/// Block uncles.
|
||||||
|
pub uncles: &'a [Header],
|
||||||
|
/// Transaction receipts.
|
||||||
|
pub receipts: &'a [Receipt],
|
||||||
|
/// State.
|
||||||
|
pub state: &'a mut State,
|
||||||
|
/// Traces.
|
||||||
|
pub traces: &'a Option<Vec<Vec<FlatTrace>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A set of immutable references to `ExecutedBlock` fields that are publicly accessible.
|
||||||
|
pub struct BlockRef<'a> {
|
||||||
/// Block header.
|
/// Block header.
|
||||||
pub header: &'a Header,
|
pub header: &'a Header,
|
||||||
/// Block transactions.
|
/// Block transactions.
|
||||||
pub transactions: &'a Vec<SignedTransaction>,
|
pub transactions: &'a [SignedTransaction],
|
||||||
/// Block uncles.
|
/// Block uncles.
|
||||||
pub uncles: &'a Vec<Header>,
|
pub uncles: &'a [Header],
|
||||||
/// Transaction receipts.
|
/// Transaction receipts.
|
||||||
pub receipts: &'a Vec<Receipt>,
|
pub receipts: &'a [Receipt],
|
||||||
/// State.
|
/// State.
|
||||||
pub state: &'a mut State,
|
pub state: &'a State,
|
||||||
|
/// Traces.
|
||||||
|
pub traces: &'a Option<Vec<Vec<FlatTrace>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExecutedBlock {
|
impl ExecutedBlock {
|
||||||
/// Create a new block from the given `state`.
|
/// Create a new block from the given `state`.
|
||||||
fn new(state: State) -> ExecutedBlock { ExecutedBlock { base: Default::default(), receipts: Default::default(), transactions_set: Default::default(), state: state } }
|
fn new(state: State, tracing: bool) -> ExecutedBlock {
|
||||||
|
ExecutedBlock {
|
||||||
|
base: Default::default(),
|
||||||
|
receipts: Default::default(),
|
||||||
|
transactions_set: Default::default(),
|
||||||
|
state: state,
|
||||||
|
traces: if tracing {Some(Vec::new())} else {None},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a structure containing individual references to all public fields.
|
/// Get a structure containing individual references to all public fields.
|
||||||
pub fn fields(&mut self) -> BlockRefMut {
|
pub fn fields_mut(&mut self) -> BlockRefMut {
|
||||||
BlockRefMut {
|
BlockRefMut {
|
||||||
header: &self.base.header,
|
header: &mut self.base.header,
|
||||||
transactions: &self.base.transactions,
|
transactions: &self.base.transactions,
|
||||||
uncles: &self.base.uncles,
|
uncles: &self.base.uncles,
|
||||||
state: &mut self.state,
|
state: &mut self.state,
|
||||||
receipts: &self.receipts,
|
receipts: &self.receipts,
|
||||||
|
traces: &self.traces,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a structure containing individual references to all public fields.
|
||||||
|
pub fn fields(&self) -> BlockRef {
|
||||||
|
BlockRef {
|
||||||
|
header: &self.base.header,
|
||||||
|
transactions: &self.base.transactions,
|
||||||
|
uncles: &self.base.uncles,
|
||||||
|
state: &self.state,
|
||||||
|
receipts: &self.receipts,
|
||||||
|
traces: &self.traces,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for a object that is_a `ExecutedBlock`.
|
/// Trait for a object that is a `ExecutedBlock`.
|
||||||
pub trait IsBlock {
|
pub trait IsBlock {
|
||||||
/// Get the block associated with this object.
|
/// Get the `ExecutedBlock` associated with this object.
|
||||||
fn block(&self) -> &ExecutedBlock;
|
fn block(&self) -> &ExecutedBlock;
|
||||||
|
|
||||||
|
/// Get the base `Block` object associated with this.
|
||||||
|
fn base(&self) -> &Block { &self.block().base }
|
||||||
|
|
||||||
/// Get the header associated with this object's block.
|
/// Get the header associated with this object's block.
|
||||||
fn header(&self) -> &Header { &self.block().base.header }
|
fn header(&self) -> &Header { &self.block().base.header }
|
||||||
|
|
||||||
@@ -129,13 +164,22 @@ pub trait IsBlock {
|
|||||||
fn state(&self) -> &State { &self.block().state }
|
fn state(&self) -> &State { &self.block().state }
|
||||||
|
|
||||||
/// Get all information on transactions in this block.
|
/// Get all information on transactions in this block.
|
||||||
fn transactions(&self) -> &Vec<SignedTransaction> { &self.block().base.transactions }
|
fn transactions(&self) -> &[SignedTransaction] { &self.block().base.transactions }
|
||||||
|
|
||||||
/// Get all information on receipts in this block.
|
/// Get all information on receipts in this block.
|
||||||
fn receipts(&self) -> &Vec<Receipt> { &self.block().receipts }
|
fn receipts(&self) -> &[Receipt] { &self.block().receipts }
|
||||||
|
|
||||||
|
/// Get all information concerning transaction tracing in this block.
|
||||||
|
fn traces(&self) -> &Option<Vec<Vec<FlatTrace>>> { &self.block().traces }
|
||||||
|
|
||||||
/// Get all uncles in this block.
|
/// Get all uncles in this block.
|
||||||
fn uncles(&self) -> &Vec<Header> { &self.block().base.uncles }
|
fn uncles(&self) -> &[Header] { &self.block().base.uncles }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Trait for a object that has a state database.
|
||||||
|
pub trait Drain {
|
||||||
|
/// Drop this object and return the underlieing database.
|
||||||
|
fn drain(self) -> StateDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IsBlock for ExecutedBlock {
|
impl IsBlock for ExecutedBlock {
|
||||||
@@ -144,48 +188,77 @@ impl IsBlock for ExecutedBlock {
|
|||||||
|
|
||||||
/// Block that is ready for transactions to be added.
|
/// Block that is ready for transactions to be added.
|
||||||
///
|
///
|
||||||
/// It's a bit like a Vec<Transaction>, eccept that whenever a transaction is pushed, we execute it and
|
/// It's a bit like a Vec<Transaction>, except that whenever a transaction is pushed, we execute it and
|
||||||
/// maintain the system `state()`. We also archive execution receipts in preparation for later block creation.
|
/// maintain the system `state()`. We also archive execution receipts in preparation for later block creation.
|
||||||
pub struct OpenBlock<'x, 'y> {
|
pub struct OpenBlock<'x> {
|
||||||
block: ExecutedBlock,
|
block: ExecutedBlock,
|
||||||
engine: &'x Engine,
|
engine: &'x Engine,
|
||||||
last_hashes: &'y LastHashes,
|
vm_factory: &'x EvmFactory,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just like OpenBlock, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
/// Just like `OpenBlock`, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
||||||
/// and collected the uncles.
|
/// and collected the uncles.
|
||||||
///
|
///
|
||||||
/// There is no function available to push a transaction. If you want that you'll need to `reopen()` it.
|
/// There is no function available to push a transaction.
|
||||||
pub struct ClosedBlock<'x, 'y> {
|
#[derive(Clone)]
|
||||||
open_block: OpenBlock<'x, 'y>,
|
pub struct ClosedBlock {
|
||||||
|
block: ExecutedBlock,
|
||||||
|
uncle_bytes: Bytes,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
unclosed_state: State,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
|
||||||
|
///
|
||||||
|
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct LockedBlock {
|
||||||
|
block: ExecutedBlock,
|
||||||
uncle_bytes: Bytes,
|
uncle_bytes: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A block that has a valid seal.
|
/// A block that has a valid seal.
|
||||||
///
|
///
|
||||||
/// The block's header has valid seal arguments. The block cannot be reversed into a ClosedBlock or OpenBlock.
|
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
|
||||||
pub struct SealedBlock {
|
pub struct SealedBlock {
|
||||||
block: ExecutedBlock,
|
block: ExecutedBlock,
|
||||||
uncle_bytes: Bytes,
|
uncle_bytes: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'x, 'y> OpenBlock<'x, 'y> {
|
impl<'x> OpenBlock<'x> {
|
||||||
/// Create a new OpenBlock ready for transaction pushing.
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
pub fn new<'a, 'b>(engine: &'a Engine, db: JournalDB, parent: &Header, last_hashes: &'b LastHashes, author: Address, extra_data: Bytes) -> OpenBlock<'a, 'b> {
|
/// Create a new `OpenBlock` ready for transaction pushing.
|
||||||
|
pub fn new(
|
||||||
|
engine: &'x Engine,
|
||||||
|
vm_factory: &'x EvmFactory,
|
||||||
|
trie_factory: TrieFactory,
|
||||||
|
tracing: bool,
|
||||||
|
db: StateDB,
|
||||||
|
parent: &Header,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
author: Address,
|
||||||
|
gas_range_target: (U256, U256),
|
||||||
|
extra_data: Bytes,
|
||||||
|
) -> Result<Self, Error> {
|
||||||
|
let state = try!(State::from_existing(db, parent.state_root().clone(), engine.account_start_nonce(), trie_factory));
|
||||||
let mut r = OpenBlock {
|
let mut r = OpenBlock {
|
||||||
block: ExecutedBlock::new(State::from_existing(db, parent.state_root().clone(), engine.account_start_nonce())),
|
block: ExecutedBlock::new(state, tracing),
|
||||||
engine: engine,
|
engine: engine,
|
||||||
|
vm_factory: vm_factory,
|
||||||
last_hashes: last_hashes,
|
last_hashes: last_hashes,
|
||||||
};
|
};
|
||||||
|
|
||||||
r.block.base.header.set_number(parent.number() + 1);
|
r.block.base.header.parent_hash = parent.hash();
|
||||||
r.block.base.header.set_author(author);
|
r.block.base.header.number = parent.number + 1;
|
||||||
r.block.base.header.set_extra_data(extra_data);
|
r.block.base.header.author = author;
|
||||||
r.block.base.header.set_timestamp_now();
|
r.block.base.header.set_timestamp_now(parent.timestamp());
|
||||||
|
r.block.base.header.extra_data = extra_data;
|
||||||
|
r.block.base.header.note_dirty();
|
||||||
|
|
||||||
engine.populate_from_parent(&mut r.block.base.header, parent);
|
engine.populate_from_parent(&mut r.block.base.header, parent, gas_range_target.0, gas_range_target.1);
|
||||||
engine.on_new_block(&mut r.block);
|
engine.on_new_block(&mut r.block);
|
||||||
r
|
Ok(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Alter the author for the block.
|
/// Alter the author for the block.
|
||||||
@@ -203,6 +276,15 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
|
|||||||
/// Alter the gas limit for the block.
|
/// Alter the gas limit for the block.
|
||||||
pub fn set_gas_used(&mut self, a: U256) { self.block.base.header.set_gas_used(a); }
|
pub fn set_gas_used(&mut self, a: U256) { self.block.base.header.set_gas_used(a); }
|
||||||
|
|
||||||
|
/// Alter the uncles hash the block.
|
||||||
|
pub fn set_uncles_hash(&mut self, h: H256) { self.block.base.header.set_uncles_hash(h); }
|
||||||
|
|
||||||
|
/// Alter transactions root for the block.
|
||||||
|
pub fn set_transactions_root(&mut self, h: H256) { self.block.base.header.set_transactions_root(h); }
|
||||||
|
|
||||||
|
/// Alter the receipts root for the block.
|
||||||
|
pub fn set_receipts_root(&mut self, h: H256) { self.block.base.header.set_receipts_root(h); }
|
||||||
|
|
||||||
/// Alter the extra_data for the block.
|
/// Alter the extra_data for the block.
|
||||||
pub fn set_extra_data(&mut self, extra_data: Bytes) -> Result<(), BlockError> {
|
pub fn set_extra_data(&mut self, extra_data: Bytes) -> Result<(), BlockError> {
|
||||||
if extra_data.len() > self.engine.maximum_extra_data_size() {
|
if extra_data.len() > self.engine.maximum_extra_data_size() {
|
||||||
@@ -218,8 +300,8 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
|
|||||||
/// NOTE Will check chain constraints and the uncle number but will NOT check
|
/// NOTE Will check chain constraints and the uncle number but will NOT check
|
||||||
/// that the header itself is actually valid.
|
/// that the header itself is actually valid.
|
||||||
pub fn push_uncle(&mut self, valid_uncle_header: Header) -> Result<(), BlockError> {
|
pub fn push_uncle(&mut self, valid_uncle_header: Header) -> Result<(), BlockError> {
|
||||||
if self.block.base.uncles.len() >= self.engine.maximum_uncle_count() {
|
if self.block.base.uncles.len() + 1 > self.engine.maximum_uncle_count() {
|
||||||
return Err(BlockError::TooManyUncles(OutOfBounds{min: None, max: Some(self.engine.maximum_uncle_count()), found: self.block.base.uncles.len()}));
|
return Err(BlockError::TooManyUncles(OutOfBounds{min: None, max: Some(self.engine.maximum_uncle_count()), found: self.block.base.uncles.len() + 1}));
|
||||||
}
|
}
|
||||||
// TODO: check number
|
// TODO: check number
|
||||||
// TODO: check not a direct ancestor (use last_hashes for that)
|
// TODO: check not a direct ancestor (use last_hashes for that)
|
||||||
@@ -235,7 +317,7 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
|
|||||||
author: self.block.base.header.author.clone(),
|
author: self.block.base.header.author.clone(),
|
||||||
timestamp: self.block.base.header.timestamp,
|
timestamp: self.block.base.header.timestamp,
|
||||||
difficulty: self.block.base.header.difficulty.clone(),
|
difficulty: self.block.base.header.difficulty.clone(),
|
||||||
last_hashes: self.last_hashes.clone(), // TODO: should be a reference.
|
last_hashes: self.last_hashes.clone(),
|
||||||
gas_used: self.block.receipts.last().map_or(U256::zero(), |r| r.gas_used),
|
gas_used: self.block.receipts.last().map_or(U256::zero(), |r| r.gas_used),
|
||||||
gas_limit: self.block.base.header.gas_limit.clone(),
|
gas_limit: self.block.base.header.gas_limit.clone(),
|
||||||
}
|
}
|
||||||
@@ -245,72 +327,152 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
|
|||||||
///
|
///
|
||||||
/// If valid, it will be executed, and archived together with the receipt.
|
/// If valid, it will be executed, and archived together with the receipt.
|
||||||
pub fn push_transaction(&mut self, t: SignedTransaction, h: Option<H256>) -> Result<&Receipt, Error> {
|
pub fn push_transaction(&mut self, t: SignedTransaction, h: Option<H256>) -> Result<&Receipt, Error> {
|
||||||
|
if self.block.transactions_set.contains(&t.hash()) {
|
||||||
|
return Err(From::from(TransactionError::AlreadyImported));
|
||||||
|
}
|
||||||
|
|
||||||
let env_info = self.env_info();
|
let env_info = self.env_info();
|
||||||
// info!("env_info says gas_used={}", env_info.gas_used);
|
// info!("env_info says gas_used={}", env_info.gas_used);
|
||||||
match self.block.state.apply(&env_info, self.engine, &t) {
|
match self.block.state.apply(&env_info, self.engine, self.vm_factory, &t, self.block.traces.is_some()) {
|
||||||
Ok(receipt) => {
|
Ok(outcome) => {
|
||||||
self.block.transactions_set.insert(h.unwrap_or_else(||t.hash()));
|
self.block.transactions_set.insert(h.unwrap_or_else(||t.hash()));
|
||||||
self.block.base.transactions.push(t);
|
self.block.base.transactions.push(t);
|
||||||
self.block.receipts.push(receipt);
|
let t = outcome.trace;
|
||||||
Ok(&self.block.receipts.last().unwrap())
|
self.block.traces.as_mut().map(|traces| traces.push(t));
|
||||||
|
self.block.receipts.push(outcome.receipt);
|
||||||
|
Ok(self.block.receipts.last().unwrap())
|
||||||
}
|
}
|
||||||
Err(x) => Err(From::from(x))
|
Err(x) => Err(From::from(x))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn this into a `ClosedBlock`. A BlockChain must be provided in order to figure out the uncles.
|
/// Turn this into a `ClosedBlock`. A `BlockChain` must be provided in order to figure out the uncles.
|
||||||
pub fn close(self) -> ClosedBlock<'x, 'y> {
|
pub fn close(self) -> ClosedBlock {
|
||||||
let mut s = self;
|
let mut s = self;
|
||||||
|
|
||||||
|
let unclosed_state = s.block.state.clone();
|
||||||
|
|
||||||
s.engine.on_close_block(&mut s.block);
|
s.engine.on_close_block(&mut s.block);
|
||||||
s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|ref e| e.rlp_bytes().to_vec()).collect());
|
s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|ref e| e.rlp_bytes().to_vec()).collect());
|
||||||
let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append(&u.rlp(Seal::With)); s} ).out();
|
let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out();
|
||||||
s.block.base.header.uncles_hash = uncle_bytes.sha3();
|
s.block.base.header.uncles_hash = uncle_bytes.sha3();
|
||||||
s.block.base.header.state_root = s.block.state.root().clone();
|
s.block.base.header.state_root = s.block.state.root().clone();
|
||||||
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect());
|
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect());
|
||||||
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b |= &r.log_bloom; b});
|
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator
|
||||||
s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used);
|
s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used);
|
||||||
s.block.base.header.note_dirty();
|
s.block.base.header.note_dirty();
|
||||||
|
|
||||||
ClosedBlock::new(s, uncle_bytes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'x, 'y> IsBlock for OpenBlock<'x, 'y> {
|
|
||||||
fn block(&self) -> &ExecutedBlock { &self.block }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'x, 'y> IsBlock for ClosedBlock<'x, 'y> {
|
|
||||||
fn block(&self) -> &ExecutedBlock { &self.open_block.block }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'x, 'y> ClosedBlock<'x, 'y> {
|
|
||||||
fn new<'a, 'b>(open_block: OpenBlock<'a, 'b>, uncle_bytes: Bytes) -> ClosedBlock<'a, 'b> {
|
|
||||||
ClosedBlock {
|
ClosedBlock {
|
||||||
open_block: open_block,
|
block: s.block,
|
||||||
|
uncle_bytes: uncle_bytes,
|
||||||
|
last_hashes: s.last_hashes,
|
||||||
|
unclosed_state: unclosed_state,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Turn this into a `LockedBlock`. A BlockChain must be provided in order to figure out the uncles.
|
||||||
|
pub fn close_and_lock(self) -> LockedBlock {
|
||||||
|
let mut s = self;
|
||||||
|
|
||||||
|
s.engine.on_close_block(&mut s.block);
|
||||||
|
if s.block.base.header.transactions_root.is_zero() || s.block.base.header.transactions_root == SHA3_NULL_RLP {
|
||||||
|
s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|ref e| e.rlp_bytes().to_vec()).collect());
|
||||||
|
}
|
||||||
|
let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out();
|
||||||
|
if s.block.base.header.uncles_hash.is_zero() {
|
||||||
|
s.block.base.header.uncles_hash = uncle_bytes.sha3();
|
||||||
|
}
|
||||||
|
if s.block.base.header.receipts_root.is_zero() || s.block.base.header.receipts_root == SHA3_NULL_RLP {
|
||||||
|
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect());
|
||||||
|
}
|
||||||
|
s.block.base.header.state_root = s.block.state.root().clone();
|
||||||
|
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator
|
||||||
|
s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used);
|
||||||
|
s.block.base.header.note_dirty();
|
||||||
|
|
||||||
|
LockedBlock {
|
||||||
|
block: s.block,
|
||||||
uncle_bytes: uncle_bytes,
|
uncle_bytes: uncle_bytes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
/// Return mutable block reference. To be used in tests only.
|
||||||
|
pub fn block_mut (&mut self) -> &mut ExecutedBlock { &mut self.block }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'x> IsBlock for OpenBlock<'x> {
|
||||||
|
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'x> IsBlock for ClosedBlock {
|
||||||
|
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'x> IsBlock for LockedBlock {
|
||||||
|
fn block(&self) -> &ExecutedBlock { &self.block }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ClosedBlock {
|
||||||
|
/// Get the hash of the header without seal arguments.
|
||||||
|
pub fn hash(&self) -> H256 { self.header().rlp_sha3(Seal::Without) }
|
||||||
|
|
||||||
|
/// Turn this into a `LockedBlock`, unable to be reopened again.
|
||||||
|
pub fn lock(self) -> LockedBlock {
|
||||||
|
LockedBlock {
|
||||||
|
block: self.block,
|
||||||
|
uncle_bytes: self.uncle_bytes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Given an engine reference, reopen the `ClosedBlock` into an `OpenBlock`.
|
||||||
|
pub fn reopen<'a>(self, engine: &'a Engine, vm_factory: &'a EvmFactory) -> OpenBlock<'a> {
|
||||||
|
// revert rewards (i.e. set state back at last transaction's state).
|
||||||
|
let mut block = self.block;
|
||||||
|
block.state = self.unclosed_state;
|
||||||
|
OpenBlock {
|
||||||
|
block: block,
|
||||||
|
engine: engine,
|
||||||
|
vm_factory: vm_factory,
|
||||||
|
last_hashes: self.last_hashes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LockedBlock {
|
||||||
/// Get the hash of the header without seal arguments.
|
/// Get the hash of the header without seal arguments.
|
||||||
pub fn hash(&self) -> H256 { self.header().rlp_sha3(Seal::Without) }
|
pub fn hash(&self) -> H256 { self.header().rlp_sha3(Seal::Without) }
|
||||||
|
|
||||||
/// Provide a valid seal in order to turn this into a `SealedBlock`.
|
/// Provide a valid seal in order to turn this into a `SealedBlock`.
|
||||||
///
|
///
|
||||||
/// NOTE: This does not check the validity of `seal` with the engine.
|
/// NOTE: This does not check the validity of `seal` with the engine.
|
||||||
pub fn seal(self, seal: Vec<Bytes>) -> Result<SealedBlock, BlockError> {
|
pub fn seal(self, engine: &Engine, seal: Vec<Bytes>) -> Result<SealedBlock, BlockError> {
|
||||||
let mut s = self;
|
let mut s = self;
|
||||||
if seal.len() != s.open_block.engine.seal_fields() {
|
if seal.len() != engine.seal_fields() {
|
||||||
return Err(BlockError::InvalidSealArity(Mismatch{expected: s.open_block.engine.seal_fields(), found: seal.len()}));
|
return Err(BlockError::InvalidSealArity(Mismatch{expected: engine.seal_fields(), found: seal.len()}));
|
||||||
}
|
}
|
||||||
s.open_block.block.base.header.set_seal(seal);
|
s.block.base.header.set_seal(seal);
|
||||||
Ok(SealedBlock { block: s.open_block.block, uncle_bytes: s.uncle_bytes })
|
Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn this back into an `OpenBlock`.
|
/// Provide a valid seal in order to turn this into a `SealedBlock`.
|
||||||
pub fn reopen(self) -> OpenBlock<'x, 'y> { self.open_block }
|
/// This does check the validity of `seal` with the engine.
|
||||||
|
/// Returns the `ClosedBlock` back again if the seal is no good.
|
||||||
|
pub fn try_seal(self, engine: &Engine, seal: Vec<Bytes>) -> Result<SealedBlock, LockedBlock> {
|
||||||
|
let mut s = self;
|
||||||
|
s.block.base.header.set_seal(seal);
|
||||||
|
match engine.verify_block_seal(&s.block.base.header) {
|
||||||
|
Err(_) => Err(s),
|
||||||
|
_ => Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drain for LockedBlock {
|
||||||
/// Drop this object and return the underlieing database.
|
/// Drop this object and return the underlieing database.
|
||||||
pub fn drain(self) -> JournalDB { self.open_block.block.state.drop().1 }
|
fn drain(self) -> StateDB {
|
||||||
|
self.block.state.drop().1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SealedBlock {
|
impl SealedBlock {
|
||||||
@@ -322,9 +484,13 @@ impl SealedBlock {
|
|||||||
block_rlp.append_raw(&self.uncle_bytes, 1);
|
block_rlp.append_raw(&self.uncle_bytes, 1);
|
||||||
block_rlp.out()
|
block_rlp.out()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drain for SealedBlock {
|
||||||
/// Drop this object and return the underlieing database.
|
/// Drop this object and return the underlieing database.
|
||||||
pub fn drain(self) -> JournalDB { self.block.state.drop().1 }
|
fn drain(self) -> StateDB {
|
||||||
|
self.block.state.drop().1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IsBlock for SealedBlock {
|
impl IsBlock for SealedBlock {
|
||||||
@@ -332,40 +498,87 @@ impl IsBlock for SealedBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Enact the block given by block header, transactions and uncles
|
/// Enact the block given by block header, transactions and uncles
|
||||||
pub fn enact<'x, 'y>(header: &Header, transactions: &[SignedTransaction], uncles: &[Header], engine: &'x Engine, db: JournalDB, parent: &Header, last_hashes: &'y LastHashes) -> Result<ClosedBlock<'x, 'y>, Error> {
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
|
pub fn enact(
|
||||||
|
header: &Header,
|
||||||
|
transactions: &[SignedTransaction],
|
||||||
|
uncles: &[Header],
|
||||||
|
engine: &Engine,
|
||||||
|
tracing: bool,
|
||||||
|
db: StateDB,
|
||||||
|
parent: &Header,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
vm_factory: &EvmFactory,
|
||||||
|
trie_factory: TrieFactory,
|
||||||
|
) -> Result<LockedBlock, Error> {
|
||||||
{
|
{
|
||||||
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
||||||
let s = State::from_existing(db.clone(), parent.state_root().clone(), engine.account_start_nonce());
|
let s = try!(State::from_existing(db.boxed_clone(), parent.state_root().clone(), engine.account_start_nonce(), trie_factory.clone()));
|
||||||
trace!("enact(): root={}, author={}, author_balance={}\n", s.root(), header.author(), s.balance(&header.author()));
|
trace!(target: "enact", "num={}, root={}, author={}, author_balance={}\n", header.number(), s.root(), header.author(), s.balance(&header.author()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut b = OpenBlock::new(engine, db, parent, last_hashes, header.author().clone(), header.extra_data().clone());
|
let mut b = try!(OpenBlock::new(engine, vm_factory, trie_factory, tracing, db, parent, last_hashes, Address::new(), (3141562.into(), 31415620.into()), vec![]));
|
||||||
b.set_difficulty(*header.difficulty());
|
b.set_difficulty(*header.difficulty());
|
||||||
b.set_gas_limit(*header.gas_limit());
|
b.set_gas_limit(*header.gas_limit());
|
||||||
b.set_timestamp(header.timestamp());
|
b.set_timestamp(header.timestamp());
|
||||||
|
b.set_author(header.author().clone());
|
||||||
|
b.set_extra_data(header.extra_data().clone()).unwrap_or_else(|e| warn!("Couldn't set extradata: {}. Ignoring.", e));
|
||||||
|
b.set_uncles_hash(header.uncles_hash().clone());
|
||||||
|
b.set_transactions_root(header.transactions_root().clone());
|
||||||
|
b.set_receipts_root(header.receipts_root().clone());
|
||||||
for t in transactions { try!(b.push_transaction(t.clone(), None)); }
|
for t in transactions { try!(b.push_transaction(t.clone(), None)); }
|
||||||
for u in uncles { try!(b.push_uncle(u.clone())); }
|
for u in uncles { try!(b.push_uncle(u.clone())); }
|
||||||
Ok(b.close())
|
Ok(b.close_and_lock())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
||||||
pub fn enact_bytes<'x, 'y>(block_bytes: &[u8], engine: &'x Engine, db: JournalDB, parent: &Header, last_hashes: &'y LastHashes) -> Result<ClosedBlock<'x, 'y>, Error> {
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
|
pub fn enact_bytes(
|
||||||
|
block_bytes: &[u8],
|
||||||
|
engine: &Engine,
|
||||||
|
tracing: bool,
|
||||||
|
db: StateDB,
|
||||||
|
parent: &Header,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
vm_factory: &EvmFactory,
|
||||||
|
trie_factory: TrieFactory,
|
||||||
|
) -> Result<LockedBlock, Error> {
|
||||||
let block = BlockView::new(block_bytes);
|
let block = BlockView::new(block_bytes);
|
||||||
let header = block.header();
|
let header = block.header();
|
||||||
enact(&header, &block.transactions(), &block.uncles(), engine, db, parent, last_hashes)
|
enact(&header, &block.transactions(), &block.uncles(), engine, tracing, db, parent, last_hashes, vm_factory, trie_factory)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
||||||
pub fn enact_verified<'x, 'y>(block: &PreVerifiedBlock, engine: &'x Engine, db: JournalDB, parent: &Header, last_hashes: &'y LastHashes) -> Result<ClosedBlock<'x, 'y>, Error> {
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
|
pub fn enact_verified(
|
||||||
|
block: &PreverifiedBlock,
|
||||||
|
engine: &Engine,
|
||||||
|
tracing: bool,
|
||||||
|
db: StateDB,
|
||||||
|
parent: &Header,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
vm_factory: &EvmFactory,
|
||||||
|
trie_factory: TrieFactory,
|
||||||
|
) -> Result<LockedBlock, Error> {
|
||||||
let view = BlockView::new(&block.bytes);
|
let view = BlockView::new(&block.bytes);
|
||||||
enact(&block.header, &block.transactions, &view.uncles(), engine, db, parent, last_hashes)
|
enact(&block.header, &block.transactions, &view.uncles(), engine, tracing, db, parent, last_hashes, vm_factory, trie_factory)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header. Seal the block aferwards
|
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header. Seal the block aferwards
|
||||||
pub fn enact_and_seal(block_bytes: &[u8], engine: &Engine, db: JournalDB, parent: &Header, last_hashes: &LastHashes) -> Result<SealedBlock, Error> {
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
|
pub fn enact_and_seal(
|
||||||
|
block_bytes: &[u8],
|
||||||
|
engine: &Engine,
|
||||||
|
tracing: bool,
|
||||||
|
db: StateDB,
|
||||||
|
parent: &Header,
|
||||||
|
last_hashes: Arc<LastHashes>,
|
||||||
|
vm_factory: &EvmFactory,
|
||||||
|
trie_factory: TrieFactory,
|
||||||
|
) -> Result<SealedBlock, Error> {
|
||||||
let header = BlockView::new(block_bytes).header_view();
|
let header = BlockView::new(block_bytes).header_view();
|
||||||
Ok(try!(try!(enact_bytes(block_bytes, engine, db, parent, last_hashes)).seal(header.seal())))
|
Ok(try!(try!(enact_bytes(block_bytes, engine, tracing, db, parent, last_hashes, vm_factory, trie_factory)).seal(engine, header.seal())))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -373,44 +586,87 @@ mod tests {
|
|||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use common::*;
|
use common::*;
|
||||||
use engine::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn open_block() {
|
fn open_block() {
|
||||||
use spec::*;
|
use spec::*;
|
||||||
let engine = Spec::new_test().to_engine().unwrap();
|
let spec = Spec::new_test();
|
||||||
let genesis_header = engine.spec().genesis_header();
|
let genesis_header = spec.genesis_header();
|
||||||
let mut db_result = get_temp_journal_db();
|
let mut db_result = get_temp_state_db();
|
||||||
let mut db = db_result.take();
|
let mut db = db_result.take();
|
||||||
engine.spec().ensure_db_good(&mut db);
|
spec.ensure_db_good(&mut db).unwrap();
|
||||||
let last_hashes = vec![genesis_header.hash()];
|
let last_hashes = Arc::new(vec![genesis_header.hash()]);
|
||||||
let b = OpenBlock::new(engine.deref(), db, &genesis_header, &last_hashes, Address::zero(), vec![]);
|
let vm_factory = Default::default();
|
||||||
let b = b.close();
|
let b = OpenBlock::new(&*spec.engine, &vm_factory, Default::default(), false, db, &genesis_header, last_hashes, Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap();
|
||||||
let _ = b.seal(vec![]);
|
let b = b.close_and_lock();
|
||||||
|
let _ = b.seal(&*spec.engine, vec![]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn enact_block() {
|
fn enact_block() {
|
||||||
use spec::*;
|
use spec::*;
|
||||||
let engine = Spec::new_test().to_engine().unwrap();
|
let spec = Spec::new_test();
|
||||||
let genesis_header = engine.spec().genesis_header();
|
let engine = &*spec.engine;
|
||||||
|
let genesis_header = spec.genesis_header();
|
||||||
|
|
||||||
let mut db_result = get_temp_journal_db();
|
let mut db_result = get_temp_state_db();
|
||||||
let mut db = db_result.take();
|
let mut db = db_result.take();
|
||||||
engine.spec().ensure_db_good(&mut db);
|
spec.ensure_db_good(&mut db).unwrap();
|
||||||
let b = OpenBlock::new(engine.deref(), db, &genesis_header, &vec![genesis_header.hash()], Address::zero(), vec![]).close().seal(vec![]).unwrap();
|
let vm_factory = Default::default();
|
||||||
|
let last_hashes = Arc::new(vec![genesis_header.hash()]);
|
||||||
|
let b = OpenBlock::new(engine, &vm_factory, Default::default(), false, db, &genesis_header, last_hashes.clone(), Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap()
|
||||||
|
.close_and_lock().seal(engine, vec![]).unwrap();
|
||||||
let orig_bytes = b.rlp_bytes();
|
let orig_bytes = b.rlp_bytes();
|
||||||
let orig_db = b.drain();
|
let orig_db = b.drain();
|
||||||
|
|
||||||
let mut db_result = get_temp_journal_db();
|
let mut db_result = get_temp_state_db();
|
||||||
let mut db = db_result.take();
|
let mut db = db_result.take();
|
||||||
engine.spec().ensure_db_good(&mut db);
|
spec.ensure_db_good(&mut db).unwrap();
|
||||||
let e = enact_and_seal(&orig_bytes, engine.deref(), db, &genesis_header, &vec![genesis_header.hash()]).unwrap();
|
let e = enact_and_seal(&orig_bytes, engine, false, db, &genesis_header, last_hashes, &Default::default(), Default::default()).unwrap();
|
||||||
|
|
||||||
assert_eq!(e.rlp_bytes(), orig_bytes);
|
assert_eq!(e.rlp_bytes(), orig_bytes);
|
||||||
|
|
||||||
let db = e.drain();
|
let db = e.drain();
|
||||||
assert_eq!(orig_db.keys(), db.keys());
|
assert_eq!(orig_db.journal_db().keys(), db.journal_db().keys());
|
||||||
assert!(orig_db.keys().iter().filter(|k| orig_db.get(k.0) != db.get(k.0)).next() == None);
|
assert!(orig_db.journal_db().keys().iter().filter(|k| orig_db.journal_db().get(k.0) != db.journal_db().get(k.0)).next() == None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn enact_block_with_uncle() {
|
||||||
|
use spec::*;
|
||||||
|
let spec = Spec::new_test();
|
||||||
|
let engine = &*spec.engine;
|
||||||
|
let genesis_header = spec.genesis_header();
|
||||||
|
|
||||||
|
let mut db_result = get_temp_state_db();
|
||||||
|
let mut db = db_result.take();
|
||||||
|
spec.ensure_db_good(&mut db).unwrap();
|
||||||
|
let vm_factory = Default::default();
|
||||||
|
let last_hashes = Arc::new(vec![genesis_header.hash()]);
|
||||||
|
let mut open_block = OpenBlock::new(engine, &vm_factory, Default::default(), false, db, &genesis_header, last_hashes.clone(), Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap();
|
||||||
|
let mut uncle1_header = Header::new();
|
||||||
|
uncle1_header.extra_data = b"uncle1".to_vec();
|
||||||
|
let mut uncle2_header = Header::new();
|
||||||
|
uncle2_header.extra_data = b"uncle2".to_vec();
|
||||||
|
open_block.push_uncle(uncle1_header).unwrap();
|
||||||
|
open_block.push_uncle(uncle2_header).unwrap();
|
||||||
|
let b = open_block.close_and_lock().seal(engine, vec![]).unwrap();
|
||||||
|
|
||||||
|
let orig_bytes = b.rlp_bytes();
|
||||||
|
let orig_db = b.drain();
|
||||||
|
|
||||||
|
let mut db_result = get_temp_state_db();
|
||||||
|
let mut db = db_result.take();
|
||||||
|
spec.ensure_db_good(&mut db).unwrap();
|
||||||
|
let e = enact_and_seal(&orig_bytes, engine, false, db, &genesis_header, last_hashes, &Default::default(), Default::default()).unwrap();
|
||||||
|
|
||||||
|
let bytes = e.rlp_bytes();
|
||||||
|
assert_eq!(bytes, orig_bytes);
|
||||||
|
let uncles = BlockView::new(&bytes).uncles();
|
||||||
|
assert_eq!(uncles[1].extra_data, b"uncle2");
|
||||||
|
|
||||||
|
let db = e.drain();
|
||||||
|
assert_eq!(orig_db.journal_db().keys(), db.journal_db().keys());
|
||||||
|
assert!(orig_db.journal_db().keys().iter().filter(|k| orig_db.journal_db().get(k.0) != db.journal_db().get(k.0)).next() == None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,97 +14,177 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! A queue of blocks. Sits between network or other I/O and the BlockChain.
|
//! A queue of blocks. Sits between network or other I/O and the `BlockChain`.
|
||||||
//! Sorts them ready for blockchain insertion.
|
//! Sorts them ready for blockchain insertion.
|
||||||
use std::thread::{JoinHandle, self};
|
use std::thread::{JoinHandle, self};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
|
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrdering};
|
||||||
|
use std::sync::{Condvar as SCondvar, Mutex as SMutex};
|
||||||
use util::*;
|
use util::*;
|
||||||
|
use io::*;
|
||||||
use verification::*;
|
use verification::*;
|
||||||
use error::*;
|
use error::*;
|
||||||
use engine::Engine;
|
use engines::Engine;
|
||||||
use views::*;
|
use views::*;
|
||||||
use header::*;
|
use header::*;
|
||||||
use service::*;
|
use service::*;
|
||||||
use client::BlockStatus;
|
use client::BlockStatus;
|
||||||
|
|
||||||
/// Block queue status
|
pub use types::block_queue_info::BlockQueueInfo;
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct BlockQueueInfo {
|
known_heap_size!(0, UnverifiedBlock, VerifyingBlock, PreverifiedBlock);
|
||||||
/// Indicates that queue is full
|
|
||||||
pub full: bool,
|
const MIN_MEM_LIMIT: usize = 16384;
|
||||||
/// Number of queued blocks pending verification
|
const MIN_QUEUE_LIMIT: usize = 512;
|
||||||
pub unverified_queue_size: usize,
|
|
||||||
/// Number of verified queued blocks pending import
|
/// Block queue configuration
|
||||||
pub verified_queue_size: usize,
|
#[derive(Debug, PartialEq)]
|
||||||
/// Number of blocks being verified
|
pub struct BlockQueueConfig {
|
||||||
pub verifying_queue_size: usize,
|
/// Maximum number of blocks to keep in unverified queue.
|
||||||
|
/// When the limit is reached, is_full returns true.
|
||||||
|
pub max_queue_size: usize,
|
||||||
|
/// Maximum heap memory to use.
|
||||||
|
/// When the limit is reached, is_full returns true.
|
||||||
|
pub max_mem_use: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for BlockQueueConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
BlockQueueConfig {
|
||||||
|
max_queue_size: 30000,
|
||||||
|
max_mem_use: 50 * 1024 * 1024,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl BlockQueueInfo {
|
impl BlockQueueInfo {
|
||||||
/// The total size of the queues.
|
/// The total size of the queues.
|
||||||
pub fn total_queue_size(&self) -> usize { self.unverified_queue_size + self.verified_queue_size + self.verifying_queue_size }
|
pub fn total_queue_size(&self) -> usize { self.unverified_queue_size + self.verified_queue_size + self.verifying_queue_size }
|
||||||
|
|
||||||
/// The size of the unverified and verifying queues.
|
/// The size of the unverified and verifying queues.
|
||||||
pub fn incomplete_queue_size(&self) -> usize { self.unverified_queue_size + self.verifying_queue_size }
|
pub fn incomplete_queue_size(&self) -> usize { self.unverified_queue_size + self.verifying_queue_size }
|
||||||
|
|
||||||
|
/// Indicates that queue is full
|
||||||
|
pub fn is_full(&self) -> bool {
|
||||||
|
self.unverified_queue_size + self.verified_queue_size + self.verifying_queue_size > self.max_queue_size ||
|
||||||
|
self.mem_used > self.max_mem_use
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Indicates that queue is empty
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.unverified_queue_size + self.verified_queue_size + self.verifying_queue_size == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A queue of blocks. Sits between network or other I/O and the BlockChain.
|
// the internal queue sizes.
|
||||||
|
struct Sizes {
|
||||||
|
unverified: AtomicUsize,
|
||||||
|
verifying: AtomicUsize,
|
||||||
|
verified: AtomicUsize,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A queue of blocks. Sits between network or other I/O and the `BlockChain`.
|
||||||
/// Sorts them ready for blockchain insertion.
|
/// Sorts them ready for blockchain insertion.
|
||||||
pub struct BlockQueue {
|
pub struct BlockQueue {
|
||||||
engine: Arc<Box<Engine>>,
|
panic_handler: Arc<PanicHandler>,
|
||||||
more_to_verify: Arc<Condvar>,
|
engine: Arc<Engine>,
|
||||||
verification: Arc<Mutex<Verification>>,
|
more_to_verify: Arc<SCondvar>,
|
||||||
|
verification: Arc<Verification>,
|
||||||
verifiers: Vec<JoinHandle<()>>,
|
verifiers: Vec<JoinHandle<()>>,
|
||||||
deleting: Arc<AtomicBool>,
|
deleting: Arc<AtomicBool>,
|
||||||
ready_signal: Arc<QueueSignal>,
|
ready_signal: Arc<QueueSignal>,
|
||||||
empty: Arc<Condvar>,
|
empty: Arc<SCondvar>,
|
||||||
processing: RwLock<HashSet<H256>>
|
processing: RwLock<HashSet<H256>>,
|
||||||
|
max_queue_size: usize,
|
||||||
|
max_mem_use: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UnVerifiedBlock {
|
struct UnverifiedBlock {
|
||||||
header: Header,
|
header: Header,
|
||||||
bytes: Bytes,
|
bytes: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VerifyingBlock {
|
struct VerifyingBlock {
|
||||||
hash: H256,
|
hash: H256,
|
||||||
block: Option<PreVerifiedBlock>,
|
block: Option<PreverifiedBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QueueSignal {
|
struct QueueSignal {
|
||||||
|
deleting: Arc<AtomicBool>,
|
||||||
signalled: AtomicBool,
|
signalled: AtomicBool,
|
||||||
message_channel: IoChannel<NetSyncMessage>,
|
message_channel: IoChannel<ClientIoMessage>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl QueueSignal {
|
impl QueueSignal {
|
||||||
fn set(&self) {
|
#[cfg_attr(feature="dev", allow(bool_comparison))]
|
||||||
|
fn set_sync(&self) {
|
||||||
|
// Do not signal when we are about to close
|
||||||
|
if self.deleting.load(AtomicOrdering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if self.signalled.compare_and_swap(false, true, AtomicOrdering::Relaxed) == false {
|
if self.signalled.compare_and_swap(false, true, AtomicOrdering::Relaxed) == false {
|
||||||
self.message_channel.send(UserMessage(SyncMessage::BlockVerified)).expect("Error sending BlockVerified message");
|
if let Err(e) = self.message_channel.send_sync(ClientIoMessage::BlockVerified) {
|
||||||
|
debug!("Error sending BlockVerified message: {:?}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(bool_comparison))]
|
||||||
|
fn set_async(&self) {
|
||||||
|
// Do not signal when we are about to close
|
||||||
|
if self.deleting.load(AtomicOrdering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.signalled.compare_and_swap(false, true, AtomicOrdering::Relaxed) == false {
|
||||||
|
if let Err(e) = self.message_channel.send(ClientIoMessage::BlockVerified) {
|
||||||
|
debug!("Error sending BlockVerified message: {:?}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn reset(&self) {
|
fn reset(&self) {
|
||||||
self.signalled.store(false, AtomicOrdering::Relaxed);
|
self.signalled.store(false, AtomicOrdering::Relaxed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Verification {
|
struct Verification {
|
||||||
unverified: VecDeque<UnVerifiedBlock>,
|
// All locks must be captured in the order declared here.
|
||||||
verified: VecDeque<PreVerifiedBlock>,
|
unverified: Mutex<VecDeque<UnverifiedBlock>>,
|
||||||
verifying: VecDeque<VerifyingBlock>,
|
verifying: Mutex<VecDeque<VerifyingBlock>>,
|
||||||
bad: HashSet<H256>,
|
verified: Mutex<VecDeque<PreverifiedBlock>>,
|
||||||
|
bad: Mutex<HashSet<H256>>,
|
||||||
|
more_to_verify: SMutex<()>,
|
||||||
|
empty: SMutex<()>,
|
||||||
|
sizes: Sizes,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_UNVERIFIED_QUEUE_SIZE: usize = 50000;
|
|
||||||
|
|
||||||
impl BlockQueue {
|
impl BlockQueue {
|
||||||
/// Creates a new queue instance.
|
/// Creates a new queue instance.
|
||||||
pub fn new(engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
|
pub fn new(config: BlockQueueConfig, engine: Arc<Engine>, message_channel: IoChannel<ClientIoMessage>) -> BlockQueue {
|
||||||
let verification = Arc::new(Mutex::new(Verification::default()));
|
let verification = Arc::new(Verification {
|
||||||
let more_to_verify = Arc::new(Condvar::new());
|
unverified: Mutex::new(VecDeque::new()),
|
||||||
let ready_signal = Arc::new(QueueSignal { signalled: AtomicBool::new(false), message_channel: message_channel });
|
verifying: Mutex::new(VecDeque::new()),
|
||||||
|
verified: Mutex::new(VecDeque::new()),
|
||||||
|
bad: Mutex::new(HashSet::new()),
|
||||||
|
more_to_verify: SMutex::new(()),
|
||||||
|
empty: SMutex::new(()),
|
||||||
|
sizes: Sizes {
|
||||||
|
unverified: AtomicUsize::new(0),
|
||||||
|
verifying: AtomicUsize::new(0),
|
||||||
|
verified: AtomicUsize::new(0),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let more_to_verify = Arc::new(SCondvar::new());
|
||||||
let deleting = Arc::new(AtomicBool::new(false));
|
let deleting = Arc::new(AtomicBool::new(false));
|
||||||
let empty = Arc::new(Condvar::new());
|
let ready_signal = Arc::new(QueueSignal {
|
||||||
|
deleting: deleting.clone(),
|
||||||
|
signalled: AtomicBool::new(false),
|
||||||
|
message_channel: message_channel
|
||||||
|
});
|
||||||
|
let empty = Arc::new(SCondvar::new());
|
||||||
|
let panic_handler = PanicHandler::new_in_arc();
|
||||||
|
|
||||||
let mut verifiers: Vec<JoinHandle<()>> = Vec::new();
|
let mut verifiers: Vec<JoinHandle<()>> = Vec::new();
|
||||||
let thread_count = max(::num_cpus::get(), 3) - 2;
|
let thread_count = max(::num_cpus::get(), 3) - 2;
|
||||||
@@ -115,11 +195,21 @@ impl BlockQueue {
|
|||||||
let ready_signal = ready_signal.clone();
|
let ready_signal = ready_signal.clone();
|
||||||
let empty = empty.clone();
|
let empty = empty.clone();
|
||||||
let deleting = deleting.clone();
|
let deleting = deleting.clone();
|
||||||
verifiers.push(thread::Builder::new().name(format!("Verifier #{}", i)).spawn(move || BlockQueue::verify(verification, engine, more_to_verify, ready_signal, deleting, empty))
|
let panic_handler = panic_handler.clone();
|
||||||
.expect("Error starting block verification thread"));
|
verifiers.push(
|
||||||
|
thread::Builder::new()
|
||||||
|
.name(format!("Verifier #{}", i))
|
||||||
|
.spawn(move || {
|
||||||
|
panic_handler.catch_panic(move || {
|
||||||
|
BlockQueue::verify(verification, engine, more_to_verify, ready_signal, deleting, empty)
|
||||||
|
}).unwrap()
|
||||||
|
})
|
||||||
|
.expect("Error starting block verification thread")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
BlockQueue {
|
BlockQueue {
|
||||||
engine: engine,
|
engine: engine,
|
||||||
|
panic_handler: panic_handler,
|
||||||
ready_signal: ready_signal.clone(),
|
ready_signal: ready_signal.clone(),
|
||||||
more_to_verify: more_to_verify.clone(),
|
more_to_verify: more_to_verify.clone(),
|
||||||
verification: verification.clone(),
|
verification: verification.clone(),
|
||||||
@@ -127,211 +217,303 @@ impl BlockQueue {
|
|||||||
deleting: deleting.clone(),
|
deleting: deleting.clone(),
|
||||||
processing: RwLock::new(HashSet::new()),
|
processing: RwLock::new(HashSet::new()),
|
||||||
empty: empty.clone(),
|
empty: empty.clone(),
|
||||||
|
max_queue_size: max(config.max_queue_size, MIN_QUEUE_LIMIT),
|
||||||
|
max_mem_use: max(config.max_mem_use, MIN_MEM_LIMIT),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn verify(verification: Arc<Mutex<Verification>>, engine: Arc<Box<Engine>>, wait: Arc<Condvar>, ready: Arc<QueueSignal>, deleting: Arc<AtomicBool>, empty: Arc<Condvar>) {
|
fn verify(verification: Arc<Verification>, engine: Arc<Engine>, wait: Arc<SCondvar>, ready: Arc<QueueSignal>, deleting: Arc<AtomicBool>, empty: Arc<SCondvar>) {
|
||||||
while !deleting.load(AtomicOrdering::Relaxed) {
|
while !deleting.load(AtomicOrdering::Acquire) {
|
||||||
{
|
{
|
||||||
let mut lock = verification.lock().unwrap();
|
let mut more_to_verify = verification.more_to_verify.lock().unwrap();
|
||||||
|
|
||||||
if lock.unverified.is_empty() && lock.verifying.is_empty() {
|
if verification.unverified.lock().is_empty() && verification.verifying.lock().is_empty() {
|
||||||
empty.notify_all();
|
empty.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
while lock.unverified.is_empty() && !deleting.load(AtomicOrdering::Relaxed) {
|
while verification.unverified.lock().is_empty() && !deleting.load(AtomicOrdering::Acquire) {
|
||||||
lock = wait.wait(lock).unwrap();
|
more_to_verify = wait.wait(more_to_verify).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
if deleting.load(AtomicOrdering::Relaxed) {
|
if deleting.load(AtomicOrdering::Acquire) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let block = {
|
let block = {
|
||||||
let mut v = verification.lock().unwrap();
|
let mut unverified = verification.unverified.lock();
|
||||||
if v.unverified.is_empty() {
|
if unverified.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let block = v.unverified.pop_front().unwrap();
|
let mut verifying = verification.verifying.lock();
|
||||||
v.verifying.push_back(VerifyingBlock{ hash: block.header.hash(), block: None });
|
let block = unverified.pop_front().unwrap();
|
||||||
|
verification.sizes.unverified.fetch_sub(block.heap_size_of_children(), AtomicOrdering::SeqCst);
|
||||||
|
verifying.push_back(VerifyingBlock{ hash: block.header.hash(), block: None });
|
||||||
block
|
block
|
||||||
};
|
};
|
||||||
|
|
||||||
let block_hash = block.header.hash();
|
let block_hash = block.header.hash();
|
||||||
match verify_block_unordered(block.header, block.bytes, engine.deref().deref()) {
|
let is_ready = match verify_block_unordered(block.header, block.bytes, &*engine) {
|
||||||
Ok(verified) => {
|
Ok(verified) => {
|
||||||
let mut v = verification.lock().unwrap();
|
let mut verifying = verification.verifying.lock();
|
||||||
for e in &mut v.verifying {
|
for e in verifying.iter_mut() {
|
||||||
if e.hash == block_hash {
|
if e.hash == block_hash {
|
||||||
|
verification.sizes.verifying.fetch_add(verified.heap_size_of_children(), AtomicOrdering::SeqCst);
|
||||||
e.block = Some(verified);
|
e.block = Some(verified);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !v.verifying.is_empty() && v.verifying.front().unwrap().hash == block_hash {
|
if !verifying.is_empty() && verifying.front().unwrap().hash == block_hash {
|
||||||
// we're next!
|
// we're next!
|
||||||
let mut vref = v.deref_mut();
|
let mut verified = verification.verified.lock();
|
||||||
BlockQueue::drain_verifying(&mut vref.verifying, &mut vref.verified, &mut vref.bad);
|
let mut bad = verification.bad.lock();
|
||||||
ready.set();
|
BlockQueue::drain_verifying(&mut verifying, &mut verified, &mut bad, &verification.sizes);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let mut v = verification.lock().unwrap();
|
let mut verifying = verification.verifying.lock();
|
||||||
|
let mut verified = verification.verified.lock();
|
||||||
|
let mut bad = verification.bad.lock();
|
||||||
warn!(target: "client", "Stage 2 block verification failed for {}\nError: {:?}", block_hash, err);
|
warn!(target: "client", "Stage 2 block verification failed for {}\nError: {:?}", block_hash, err);
|
||||||
v.bad.insert(block_hash.clone());
|
bad.insert(block_hash.clone());
|
||||||
v.verifying.retain(|e| e.hash != block_hash);
|
verifying.retain(|e| e.hash != block_hash);
|
||||||
let mut vref = v.deref_mut();
|
if !verifying.is_empty() && verifying.front().unwrap().hash == block_hash {
|
||||||
BlockQueue::drain_verifying(&mut vref.verifying, &mut vref.verified, &mut vref.bad);
|
BlockQueue::drain_verifying(&mut verifying, &mut verified, &mut bad, &verification.sizes);
|
||||||
ready.set();
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if is_ready {
|
||||||
|
// Import the block immediately
|
||||||
|
ready.set_sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn drain_verifying(verifying: &mut VecDeque<VerifyingBlock>, verified: &mut VecDeque<PreVerifiedBlock>, bad: &mut HashSet<H256>) {
|
fn drain_verifying(verifying: &mut VecDeque<VerifyingBlock>, verified: &mut VecDeque<PreverifiedBlock>, bad: &mut HashSet<H256>, sizes: &Sizes) {
|
||||||
|
let mut removed_size = 0;
|
||||||
|
let mut inserted_size = 0;
|
||||||
while !verifying.is_empty() && verifying.front().unwrap().block.is_some() {
|
while !verifying.is_empty() && verifying.front().unwrap().block.is_some() {
|
||||||
let block = verifying.pop_front().unwrap().block.unwrap();
|
let block = verifying.pop_front().unwrap().block.unwrap();
|
||||||
if bad.contains(&block.header.parent_hash) {
|
let size = block.heap_size_of_children();
|
||||||
|
removed_size += size;
|
||||||
|
|
||||||
|
if bad.contains(&block.header.parent_hash()) {
|
||||||
bad.insert(block.header.hash());
|
bad.insert(block.header.hash());
|
||||||
}
|
} else {
|
||||||
else {
|
inserted_size += size;
|
||||||
verified.push_back(block);
|
verified.push_back(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sizes.verifying.fetch_sub(removed_size, AtomicOrdering::SeqCst);
|
||||||
|
sizes.verified.fetch_add(inserted_size, AtomicOrdering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear the queue and stop verification activity.
|
/// Clear the queue and stop verification activity.
|
||||||
pub fn clear(&mut self) {
|
pub fn clear(&self) {
|
||||||
let mut verification = self.verification.lock().unwrap();
|
let mut unverified = self.verification.unverified.lock();
|
||||||
verification.unverified.clear();
|
let mut verifying = self.verification.verifying.lock();
|
||||||
verification.verifying.clear();
|
let mut verified = self.verification.verified.lock();
|
||||||
verification.verified.clear();
|
unverified.clear();
|
||||||
self.processing.write().unwrap().clear();
|
verifying.clear();
|
||||||
|
verified.clear();
|
||||||
|
|
||||||
|
let sizes = &self.verification.sizes;
|
||||||
|
sizes.unverified.store(0, AtomicOrdering::Release);
|
||||||
|
sizes.verifying.store(0, AtomicOrdering::Release);
|
||||||
|
sizes.verified.store(0, AtomicOrdering::Release);
|
||||||
|
|
||||||
|
self.processing.write().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wait for queue to be empty
|
/// Wait for unverified queue to be empty
|
||||||
pub fn flush(&mut self) {
|
pub fn flush(&self) {
|
||||||
let mut verification = self.verification.lock().unwrap();
|
let mut lock = self.verification.empty.lock().unwrap();
|
||||||
while !verification.unverified.is_empty() || !verification.verifying.is_empty() {
|
while !self.verification.unverified.lock().is_empty() || !self.verification.verifying.lock().is_empty() {
|
||||||
verification = self.empty.wait(verification).unwrap();
|
lock = self.empty.wait(lock).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the block is currently in the queue
|
/// Check if the block is currently in the queue
|
||||||
pub fn block_status(&self, hash: &H256) -> BlockStatus {
|
pub fn block_status(&self, hash: &H256) -> BlockStatus {
|
||||||
if self.processing.read().unwrap().contains(&hash) {
|
if self.processing.read().contains(hash) {
|
||||||
return BlockStatus::Queued;
|
return BlockStatus::Queued;
|
||||||
}
|
}
|
||||||
if self.verification.lock().unwrap().bad.contains(&hash) {
|
if self.verification.bad.lock().contains(hash) {
|
||||||
return BlockStatus::Bad;
|
return BlockStatus::Bad;
|
||||||
}
|
}
|
||||||
BlockStatus::Unknown
|
BlockStatus::Unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a block to the queue.
|
/// Add a block to the queue.
|
||||||
pub fn import_block(&mut self, bytes: Bytes) -> ImportResult {
|
pub fn import_block(&self, bytes: Bytes) -> ImportResult {
|
||||||
let header = BlockView::new(&bytes).header();
|
let header = BlockView::new(&bytes).header();
|
||||||
let h = header.hash();
|
let h = header.hash();
|
||||||
if self.processing.read().unwrap().contains(&h) {
|
|
||||||
return Err(ImportError::AlreadyQueued);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
let mut verification = self.verification.lock().unwrap();
|
if self.processing.read().contains(&h) {
|
||||||
if verification.bad.contains(&h) {
|
return Err(ImportError::AlreadyQueued.into());
|
||||||
return Err(ImportError::Bad(None));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if verification.bad.contains(&header.parent_hash) {
|
let mut bad = self.verification.bad.lock();
|
||||||
verification.bad.insert(h.clone());
|
if bad.contains(&h) {
|
||||||
return Err(ImportError::Bad(None));
|
return Err(ImportError::KnownBad.into());
|
||||||
|
}
|
||||||
|
|
||||||
|
if bad.contains(&header.parent_hash) {
|
||||||
|
bad.insert(h.clone());
|
||||||
|
return Err(ImportError::KnownBad.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match verify_block_basic(&header, &bytes, self.engine.deref().deref()) {
|
match verify_block_basic(&header, &bytes, &*self.engine) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
self.processing.write().unwrap().insert(h.clone());
|
self.processing.write().insert(h.clone());
|
||||||
self.verification.lock().unwrap().unverified.push_back(UnVerifiedBlock { header: header, bytes: bytes });
|
let block = UnverifiedBlock { header: header, bytes: bytes };
|
||||||
|
self.verification.sizes.unverified.fetch_add(block.heap_size_of_children(), AtomicOrdering::SeqCst);
|
||||||
|
self.verification.unverified.lock().push_back(block);
|
||||||
self.more_to_verify.notify_all();
|
self.more_to_verify.notify_all();
|
||||||
Ok(h)
|
Ok(h)
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(target: "client", "Stage 1 block verification failed for {}\nError: {:?}", BlockView::new(&bytes).header_view().sha3(), err);
|
warn!(target: "client", "Stage 1 block verification failed for {}\nError: {:?}", BlockView::new(&bytes).header_view().sha3(), err);
|
||||||
self.verification.lock().unwrap().bad.insert(h.clone());
|
self.verification.bad.lock().insert(h.clone());
|
||||||
Err(From::from(err))
|
Err(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark given block and all its children as bad. Stops verification.
|
/// Mark given block and all its children as bad. Stops verification.
|
||||||
pub fn mark_as_bad(&mut self, hash: &H256) {
|
pub fn mark_as_bad(&self, block_hashes: &[H256]) {
|
||||||
let mut verification_lock = self.verification.lock().unwrap();
|
if block_hashes.is_empty() {
|
||||||
let mut verification = verification_lock.deref_mut();
|
return;
|
||||||
verification.bad.insert(hash.clone());
|
}
|
||||||
self.processing.write().unwrap().remove(&hash);
|
let mut verified_lock = self.verification.verified.lock();
|
||||||
|
let mut verified = &mut *verified_lock;
|
||||||
|
let mut bad = self.verification.bad.lock();
|
||||||
|
let mut processing = self.processing.write();
|
||||||
|
bad.reserve(block_hashes.len());
|
||||||
|
for hash in block_hashes {
|
||||||
|
bad.insert(hash.clone());
|
||||||
|
processing.remove(hash);
|
||||||
|
}
|
||||||
|
|
||||||
let mut new_verified = VecDeque::new();
|
let mut new_verified = VecDeque::new();
|
||||||
for block in verification.verified.drain(..) {
|
let mut removed_size = 0;
|
||||||
if verification.bad.contains(&block.header.parent_hash) {
|
for block in verified.drain(..) {
|
||||||
verification.bad.insert(block.header.hash());
|
if bad.contains(&block.header.parent_hash) {
|
||||||
self.processing.write().unwrap().remove(&block.header.hash());
|
removed_size += block.heap_size_of_children();
|
||||||
}
|
bad.insert(block.header.hash());
|
||||||
else {
|
processing.remove(&block.header.hash());
|
||||||
|
} else {
|
||||||
new_verified.push_back(block);
|
new_verified.push_back(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verification.verified = new_verified;
|
|
||||||
|
self.verification.sizes.verified.fetch_sub(removed_size, AtomicOrdering::SeqCst);
|
||||||
|
*verified = new_verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark given block as processed
|
/// Mark given item as processed.
|
||||||
pub fn mark_as_good(&mut self, hashes: &[H256]) {
|
/// Returns true if the queue becomes empty.
|
||||||
let mut processing = self.processing.write().unwrap();
|
pub fn mark_as_good(&self, hashes: &[H256]) -> bool {
|
||||||
for h in hashes {
|
if hashes.is_empty() {
|
||||||
processing.remove(&h);
|
return self.processing.read().is_empty();
|
||||||
}
|
}
|
||||||
//TODO: reward peers
|
let mut processing = self.processing.write();
|
||||||
|
for hash in hashes {
|
||||||
|
processing.remove(hash);
|
||||||
|
}
|
||||||
|
processing.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes up to `max` verified blocks from the queue
|
/// Removes up to `max` verified blocks from the queue
|
||||||
pub fn drain(&mut self, max: usize) -> Vec<PreVerifiedBlock> {
|
pub fn drain(&self, max: usize) -> Vec<PreverifiedBlock> {
|
||||||
let mut verification = self.verification.lock().unwrap();
|
let mut verified = self.verification.verified.lock();
|
||||||
let count = min(max, verification.verified.len());
|
let count = min(max, verified.len());
|
||||||
let mut result = Vec::with_capacity(count);
|
let mut result = Vec::with_capacity(count);
|
||||||
for _ in 0..count {
|
for _ in 0..count {
|
||||||
let block = verification.verified.pop_front().unwrap();
|
let block = verified.pop_front().unwrap();
|
||||||
|
self.verification.sizes.verified.fetch_sub(block.heap_size_of_children(), AtomicOrdering::SeqCst);
|
||||||
result.push(block);
|
result.push(block);
|
||||||
}
|
}
|
||||||
self.ready_signal.reset();
|
self.ready_signal.reset();
|
||||||
if !verification.verified.is_empty() {
|
if !verified.is_empty() {
|
||||||
self.ready_signal.set();
|
self.ready_signal.set_async();
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get queue status.
|
/// Get queue status.
|
||||||
pub fn queue_info(&self) -> BlockQueueInfo {
|
pub fn queue_info(&self) -> BlockQueueInfo {
|
||||||
let verification = self.verification.lock().unwrap();
|
use std::mem::size_of;
|
||||||
|
let (unverified_len, unverified_bytes) = {
|
||||||
|
let len = self.verification.unverified.lock().len();
|
||||||
|
let size = self.verification.sizes.unverified.load(AtomicOrdering::Acquire);
|
||||||
|
|
||||||
|
(len, size + len * size_of::<UnverifiedBlock>())
|
||||||
|
};
|
||||||
|
let (verifying_len, verifying_bytes) = {
|
||||||
|
let len = self.verification.verifying.lock().len();
|
||||||
|
let size = self.verification.sizes.verifying.load(AtomicOrdering::Acquire);
|
||||||
|
(len, size + len * size_of::<VerifyingBlock>())
|
||||||
|
};
|
||||||
|
let (verified_len, verified_bytes) = {
|
||||||
|
let len = self.verification.verified.lock().len();
|
||||||
|
let size = self.verification.sizes.verified.load(AtomicOrdering::Acquire);
|
||||||
|
(len, size + len * size_of::<PreverifiedBlock>())
|
||||||
|
};
|
||||||
BlockQueueInfo {
|
BlockQueueInfo {
|
||||||
full: verification.unverified.len() + verification.verifying.len() + verification.verified.len() >= MAX_UNVERIFIED_QUEUE_SIZE,
|
unverified_queue_size: unverified_len,
|
||||||
verified_queue_size: verification.verified.len(),
|
verifying_queue_size: verifying_len,
|
||||||
unverified_queue_size: verification.unverified.len(),
|
verified_queue_size: verified_len,
|
||||||
verifying_queue_size: verification.verifying.len(),
|
max_queue_size: self.max_queue_size,
|
||||||
|
max_mem_use: self.max_mem_use,
|
||||||
|
mem_used: unverified_bytes
|
||||||
|
+ verifying_bytes
|
||||||
|
+ verified_bytes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Optimise memory footprint of the heap fields.
|
||||||
|
pub fn collect_garbage(&self) {
|
||||||
|
{
|
||||||
|
self.verification.unverified.lock().shrink_to_fit();
|
||||||
|
self.verification.verifying.lock().shrink_to_fit();
|
||||||
|
self.verification.verified.lock().shrink_to_fit();
|
||||||
|
}
|
||||||
|
self.processing.write().shrink_to_fit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MayPanic for BlockQueue {
|
||||||
|
fn on_panic<F>(&self, closure: F) where F: OnPanicListener {
|
||||||
|
self.panic_handler.on_panic(closure);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for BlockQueue {
|
impl Drop for BlockQueue {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
trace!(target: "shutdown", "[BlockQueue] Closing...");
|
||||||
self.clear();
|
self.clear();
|
||||||
self.deleting.store(true, AtomicOrdering::Relaxed);
|
self.deleting.store(true, AtomicOrdering::Release);
|
||||||
self.more_to_verify.notify_all();
|
self.more_to_verify.notify_all();
|
||||||
for t in self.verifiers.drain(..) {
|
for t in self.verifiers.drain(..) {
|
||||||
t.join().unwrap();
|
t.join().unwrap();
|
||||||
}
|
}
|
||||||
|
trace!(target: "shutdown", "[BlockQueue] Closed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use util::*;
|
use util::*;
|
||||||
|
use io::*;
|
||||||
use spec::*;
|
use spec::*;
|
||||||
use block_queue::*;
|
use block_queue::*;
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
@@ -340,21 +522,21 @@ mod tests {
|
|||||||
|
|
||||||
fn get_test_queue() -> BlockQueue {
|
fn get_test_queue() -> BlockQueue {
|
||||||
let spec = get_test_spec();
|
let spec = get_test_spec();
|
||||||
let engine = spec.to_engine().unwrap();
|
let engine = spec.engine;
|
||||||
BlockQueue::new(Arc::new(engine), IoChannel::disconnected())
|
BlockQueue::new(BlockQueueConfig::default(), engine, IoChannel::disconnected())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_be_created() {
|
fn can_be_created() {
|
||||||
// TODO better test
|
// TODO better test
|
||||||
let spec = Spec::new_test();
|
let spec = Spec::new_test();
|
||||||
let engine = spec.to_engine().unwrap();
|
let engine = spec.engine;
|
||||||
let _ = BlockQueue::new(Arc::new(engine), IoChannel::disconnected());
|
let _ = BlockQueue::new(BlockQueueConfig::default(), engine, IoChannel::disconnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_import_blocks() {
|
fn can_import_blocks() {
|
||||||
let mut queue = get_test_queue();
|
let queue = get_test_queue();
|
||||||
if let Err(e) = queue.import_block(get_good_dummy_block()) {
|
if let Err(e) = queue.import_block(get_good_dummy_block()) {
|
||||||
panic!("error importing block that is valid by definition({:?})", e);
|
panic!("error importing block that is valid by definition({:?})", e);
|
||||||
}
|
}
|
||||||
@@ -362,7 +544,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_error_for_duplicates() {
|
fn returns_error_for_duplicates() {
|
||||||
let mut queue = get_test_queue();
|
let queue = get_test_queue();
|
||||||
if let Err(e) = queue.import_block(get_good_dummy_block()) {
|
if let Err(e) = queue.import_block(get_good_dummy_block()) {
|
||||||
panic!("error importing block that is valid by definition({:?})", e);
|
panic!("error importing block that is valid by definition({:?})", e);
|
||||||
}
|
}
|
||||||
@@ -371,7 +553,7 @@ mod tests {
|
|||||||
match duplicate_import {
|
match duplicate_import {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
match e {
|
match e {
|
||||||
ImportError::AlreadyQueued => {},
|
Error::Import(ImportError::AlreadyQueued) => {},
|
||||||
_ => { panic!("must return AlreadyQueued error"); }
|
_ => { panic!("must return AlreadyQueued error"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,7 +563,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_ok_for_drained_duplicates() {
|
fn returns_ok_for_drained_duplicates() {
|
||||||
let mut queue = get_test_queue();
|
let queue = get_test_queue();
|
||||||
let block = get_good_dummy_block();
|
let block = get_good_dummy_block();
|
||||||
let hash = BlockView::new(&block).header().hash().clone();
|
let hash = BlockView::new(&block).header().hash().clone();
|
||||||
if let Err(e) = queue.import_block(block) {
|
if let Err(e) = queue.import_block(block) {
|
||||||
@@ -395,4 +577,29 @@ mod tests {
|
|||||||
panic!("error importing block that has already been drained ({:?})", e);
|
panic!("error importing block that has already been drained ({:?})", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn returns_empty_once_finished() {
|
||||||
|
let queue = get_test_queue();
|
||||||
|
queue.import_block(get_good_dummy_block()).expect("error importing block that is valid by definition");
|
||||||
|
queue.flush();
|
||||||
|
queue.drain(1);
|
||||||
|
|
||||||
|
assert!(queue.queue_info().is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_mem_limit() {
|
||||||
|
let spec = get_test_spec();
|
||||||
|
let engine = spec.engine;
|
||||||
|
let mut config = BlockQueueConfig::default();
|
||||||
|
config.max_mem_use = super::MIN_MEM_LIMIT; // empty queue uses about 15000
|
||||||
|
let queue = BlockQueue::new(config, engine, IoChannel::disconnected());
|
||||||
|
assert!(!queue.queue_info().is_full());
|
||||||
|
let mut blocks = get_good_dummy_block_seq(50);
|
||||||
|
for b in blocks.drain(..) {
|
||||||
|
queue.import_block(b).unwrap();
|
||||||
|
}
|
||||||
|
assert!(queue.queue_info().is_full());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,827 +0,0 @@
|
|||||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
|
||||||
// This file is part of Parity.
|
|
||||||
|
|
||||||
// Parity 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.
|
|
||||||
|
|
||||||
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
//! Blockchain database.
|
|
||||||
|
|
||||||
use util::*;
|
|
||||||
use rocksdb::{DB, WriteBatch, Writable};
|
|
||||||
use header::*;
|
|
||||||
use extras::*;
|
|
||||||
use transaction::*;
|
|
||||||
use views::*;
|
|
||||||
|
|
||||||
/// Represents a tree route between `from` block and `to` block:
|
|
||||||
pub struct TreeRoute {
|
|
||||||
/// A vector of hashes of all blocks, ordered from `from` to `to`.
|
|
||||||
pub blocks: Vec<H256>,
|
|
||||||
/// Best common ancestor of these blocks.
|
|
||||||
pub ancestor: H256,
|
|
||||||
/// An index where best common ancestor would be.
|
|
||||||
pub index: usize
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents blockchain's in-memory cache size in bytes.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct CacheSize {
|
|
||||||
/// Blocks cache size.
|
|
||||||
pub blocks: usize,
|
|
||||||
/// BlockDetails cache size.
|
|
||||||
pub block_details: usize,
|
|
||||||
/// Transaction addresses cache size.
|
|
||||||
pub transaction_addresses: usize,
|
|
||||||
/// Logs cache size.
|
|
||||||
pub block_logs: usize,
|
|
||||||
/// Blooms cache size.
|
|
||||||
pub blocks_blooms: usize
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CacheSize {
|
|
||||||
/// Total amount used by the cache.
|
|
||||||
fn total(&self) -> usize { self.blocks + self.block_details + self.transaction_addresses + self.block_logs + self.blocks_blooms }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Information about best block gathered together
|
|
||||||
struct BestBlock {
|
|
||||||
pub hash: H256,
|
|
||||||
pub number: BlockNumber,
|
|
||||||
pub total_difficulty: U256
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BestBlock {
|
|
||||||
fn new() -> BestBlock {
|
|
||||||
BestBlock {
|
|
||||||
hash: H256::new(),
|
|
||||||
number: 0,
|
|
||||||
total_difficulty: U256::from(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Interface for querying blocks by hash and by number.
|
|
||||||
pub trait BlockProvider {
|
|
||||||
/// Returns true if the given block is known
|
|
||||||
/// (though not necessarily a part of the canon chain).
|
|
||||||
fn is_known(&self, hash: &H256) -> bool;
|
|
||||||
|
|
||||||
/// Get raw block data
|
|
||||||
fn block(&self, hash: &H256) -> Option<Bytes>;
|
|
||||||
|
|
||||||
/// Get the familial details concerning a block.
|
|
||||||
fn block_details(&self, hash: &H256) -> Option<BlockDetails>;
|
|
||||||
|
|
||||||
/// Get the hash of given block's number.
|
|
||||||
fn block_hash(&self, index: BlockNumber) -> Option<H256>;
|
|
||||||
|
|
||||||
/// Get the partial-header of a block.
|
|
||||||
fn block_header(&self, hash: &H256) -> Option<Header> {
|
|
||||||
self.block(hash).map(|bytes| BlockView::new(&bytes).header())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a list of uncles for a given block.
|
|
||||||
/// Returns None if block deos not exist.
|
|
||||||
fn uncles(&self, hash: &H256) -> Option<Vec<Header>> {
|
|
||||||
self.block(hash).map(|bytes| BlockView::new(&bytes).uncles())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a list of uncle hashes for a given block.
|
|
||||||
/// Returns None if block does not exist.
|
|
||||||
fn uncle_hashes(&self, hash: &H256) -> Option<Vec<H256>> {
|
|
||||||
self.block(hash).map(|bytes| BlockView::new(&bytes).uncle_hashes())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the number of given block's hash.
|
|
||||||
fn block_number(&self, hash: &H256) -> Option<BlockNumber> {
|
|
||||||
self.block(hash).map(|bytes| BlockView::new(&bytes).header_view().number())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a list of transactions for a given block.
|
|
||||||
/// Returns None if block deos not exist.
|
|
||||||
fn transactions(&self, hash: &H256) -> Option<Vec<SignedTransaction>> {
|
|
||||||
self.block(hash).map(|bytes| BlockView::new(&bytes).transactions())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns reference to genesis hash.
|
|
||||||
fn genesis_hash(&self) -> H256 {
|
|
||||||
self.block_hash(0).expect("Genesis hash should always exist")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the header of the genesis block.
|
|
||||||
fn genesis_header(&self) -> Header {
|
|
||||||
self.block_header(&self.genesis_hash()).unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Hash, Eq, PartialEq, Clone)]
|
|
||||||
enum CacheID {
|
|
||||||
Block(H256),
|
|
||||||
Extras(ExtrasIndex, H256),
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CacheManager {
|
|
||||||
cache_usage: VecDeque<HashSet<CacheID>>,
|
|
||||||
in_use: HashSet<CacheID>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Structure providing fast access to blockchain data.
|
|
||||||
///
|
|
||||||
/// **Does not do input data verification.**
|
|
||||||
pub struct BlockChain {
|
|
||||||
pref_cache_size: usize,
|
|
||||||
max_cache_size: usize,
|
|
||||||
|
|
||||||
best_block: RwLock<BestBlock>,
|
|
||||||
|
|
||||||
// block cache
|
|
||||||
blocks: RwLock<HashMap<H256, Bytes>>,
|
|
||||||
|
|
||||||
// extra caches
|
|
||||||
block_details: RwLock<HashMap<H256, BlockDetails>>,
|
|
||||||
block_hashes: RwLock<HashMap<BlockNumber, H256>>,
|
|
||||||
transaction_addresses: RwLock<HashMap<H256, TransactionAddress>>,
|
|
||||||
block_logs: RwLock<HashMap<H256, BlockLogBlooms>>,
|
|
||||||
blocks_blooms: RwLock<HashMap<H256, BlocksBlooms>>,
|
|
||||||
|
|
||||||
extras_db: DB,
|
|
||||||
blocks_db: DB,
|
|
||||||
|
|
||||||
cache_man: RwLock<CacheManager>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BlockProvider for BlockChain {
|
|
||||||
/// Returns true if the given block is known
|
|
||||||
/// (though not necessarily a part of the canon chain).
|
|
||||||
fn is_known(&self, hash: &H256) -> bool {
|
|
||||||
self.query_extras_exist(hash, &self.block_details)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get raw block data
|
|
||||||
fn block(&self, hash: &H256) -> Option<Bytes> {
|
|
||||||
{
|
|
||||||
let read = self.blocks.read().unwrap();
|
|
||||||
if let Some(v) = read.get(hash) {
|
|
||||||
return Some(v.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let opt = self.blocks_db.get(hash)
|
|
||||||
.expect("Low level database error. Some issue with disk?");
|
|
||||||
|
|
||||||
self.note_used(CacheID::Block(hash.clone()));
|
|
||||||
|
|
||||||
match opt {
|
|
||||||
Some(b) => {
|
|
||||||
let bytes: Bytes = b.to_vec();
|
|
||||||
let mut write = self.blocks.write().unwrap();
|
|
||||||
write.insert(hash.clone(), bytes.clone());
|
|
||||||
Some(bytes)
|
|
||||||
},
|
|
||||||
None => None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the familial details concerning a block.
|
|
||||||
fn block_details(&self, hash: &H256) -> Option<BlockDetails> {
|
|
||||||
self.query_extras(hash, &self.block_details)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the hash of given block's number.
|
|
||||||
fn block_hash(&self, index: BlockNumber) -> Option<H256> {
|
|
||||||
self.query_extras(&index, &self.block_hashes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const COLLECTION_QUEUE_SIZE: usize = 8;
|
|
||||||
|
|
||||||
impl BlockChain {
|
|
||||||
/// Create new instance of blockchain from given Genesis
|
|
||||||
///
|
|
||||||
/// ```rust
|
|
||||||
/// extern crate ethcore_util as util;
|
|
||||||
/// extern crate ethcore;
|
|
||||||
/// use std::env;
|
|
||||||
/// use std::str::FromStr;
|
|
||||||
/// use ethcore::spec::*;
|
|
||||||
/// use ethcore::blockchain::*;
|
|
||||||
/// use ethcore::ethereum;
|
|
||||||
/// use util::hash::*;
|
|
||||||
/// use util::uint::*;
|
|
||||||
///
|
|
||||||
/// fn main() {
|
|
||||||
/// let spec = ethereum::new_frontier();
|
|
||||||
///
|
|
||||||
/// let mut dir = env::temp_dir();
|
|
||||||
/// dir.push(H32::random().hex());
|
|
||||||
///
|
|
||||||
/// let bc = BlockChain::new(&spec.genesis_block(), &dir);
|
|
||||||
///
|
|
||||||
/// let genesis_hash = "d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3";
|
|
||||||
/// assert_eq!(bc.genesis_hash(), H256::from_str(genesis_hash).unwrap());
|
|
||||||
/// assert!(bc.is_known(&bc.genesis_hash()));
|
|
||||||
/// assert_eq!(bc.genesis_hash(), bc.block_hash(0).unwrap());
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
pub fn new(genesis: &[u8], path: &Path) -> BlockChain {
|
|
||||||
// open extras db
|
|
||||||
let mut extras_path = path.to_path_buf();
|
|
||||||
extras_path.push("extras");
|
|
||||||
let extras_db = DB::open_default(extras_path.to_str().unwrap()).unwrap();
|
|
||||||
|
|
||||||
// open blocks db
|
|
||||||
let mut blocks_path = path.to_path_buf();
|
|
||||||
blocks_path.push("blocks");
|
|
||||||
let blocks_db = DB::open_default(blocks_path.to_str().unwrap()).unwrap();
|
|
||||||
|
|
||||||
let mut cache_man = CacheManager{cache_usage: VecDeque::new(), in_use: HashSet::new()};
|
|
||||||
(0..COLLECTION_QUEUE_SIZE).foreach(|_| cache_man.cache_usage.push_back(HashSet::new()));
|
|
||||||
|
|
||||||
let bc = BlockChain {
|
|
||||||
pref_cache_size: 1 << 14,
|
|
||||||
max_cache_size: 1 << 20,
|
|
||||||
best_block: RwLock::new(BestBlock::new()),
|
|
||||||
blocks: RwLock::new(HashMap::new()),
|
|
||||||
block_details: RwLock::new(HashMap::new()),
|
|
||||||
block_hashes: RwLock::new(HashMap::new()),
|
|
||||||
transaction_addresses: RwLock::new(HashMap::new()),
|
|
||||||
block_logs: RwLock::new(HashMap::new()),
|
|
||||||
blocks_blooms: RwLock::new(HashMap::new()),
|
|
||||||
extras_db: extras_db,
|
|
||||||
blocks_db: blocks_db,
|
|
||||||
cache_man: RwLock::new(cache_man),
|
|
||||||
};
|
|
||||||
|
|
||||||
// load best block
|
|
||||||
let best_block_hash = match bc.extras_db.get(b"best").unwrap() {
|
|
||||||
Some(best) => H256::from_slice(&best),
|
|
||||||
None => {
|
|
||||||
// best block does not exist
|
|
||||||
// we need to insert genesis into the cache
|
|
||||||
let block = BlockView::new(genesis);
|
|
||||||
let header = block.header_view();
|
|
||||||
let hash = block.sha3();
|
|
||||||
|
|
||||||
let details = BlockDetails {
|
|
||||||
number: header.number(),
|
|
||||||
total_difficulty: header.difficulty(),
|
|
||||||
parent: header.parent_hash(),
|
|
||||||
children: vec![]
|
|
||||||
};
|
|
||||||
|
|
||||||
bc.blocks_db.put(&hash, genesis).unwrap();
|
|
||||||
|
|
||||||
let batch = WriteBatch::new();
|
|
||||||
batch.put_extras(&hash, &details);
|
|
||||||
batch.put_extras(&header.number(), &hash);
|
|
||||||
batch.put(b"best", &hash).unwrap();
|
|
||||||
bc.extras_db.write(batch).unwrap();
|
|
||||||
|
|
||||||
hash
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
let mut best_block = bc.best_block.write().unwrap();
|
|
||||||
best_block.number = bc.block_number(&best_block_hash).unwrap();
|
|
||||||
best_block.total_difficulty = bc.block_details(&best_block_hash).unwrap().total_difficulty;
|
|
||||||
best_block.hash = best_block_hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
bc
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set the cache configuration.
|
|
||||||
pub fn configure_cache(&mut self, pref_cache_size: usize, max_cache_size: usize) {
|
|
||||||
self.pref_cache_size = pref_cache_size;
|
|
||||||
self.max_cache_size = max_cache_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a tree route between `from` and `to`, which is a tuple of:
|
|
||||||
///
|
|
||||||
/// - a vector of hashes of all blocks, ordered from `from` to `to`.
|
|
||||||
///
|
|
||||||
/// - common ancestor of these blocks.
|
|
||||||
///
|
|
||||||
/// - an index where best common ancestor would be
|
|
||||||
///
|
|
||||||
/// 1.) from newer to older
|
|
||||||
///
|
|
||||||
/// - bc: `A1 -> A2 -> A3 -> A4 -> A5`
|
|
||||||
/// - from: A5, to: A4
|
|
||||||
/// - route:
|
|
||||||
///
|
|
||||||
/// ```json
|
|
||||||
/// { blocks: [A5], ancestor: A4, index: 1 }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// 2.) from older to newer
|
|
||||||
///
|
|
||||||
/// - bc: `A1 -> A2 -> A3 -> A4 -> A5`
|
|
||||||
/// - from: A3, to: A4
|
|
||||||
/// - route:
|
|
||||||
///
|
|
||||||
/// ```json
|
|
||||||
/// { blocks: [A4], ancestor: A3, index: 0 }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// 3.) fork:
|
|
||||||
///
|
|
||||||
/// - bc:
|
|
||||||
///
|
|
||||||
/// ```text
|
|
||||||
/// A1 -> A2 -> A3 -> A4
|
|
||||||
/// -> B3 -> B4
|
|
||||||
/// ```
|
|
||||||
/// - from: B4, to: A4
|
|
||||||
/// - route:
|
|
||||||
///
|
|
||||||
/// ```json
|
|
||||||
/// { blocks: [B4, B3, A3, A4], ancestor: A2, index: 2 }
|
|
||||||
/// ```
|
|
||||||
pub fn tree_route(&self, from: H256, to: H256) -> Option<TreeRoute> {
|
|
||||||
let from_details = match self.block_details(&from) {
|
|
||||||
Some(h) => h,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
let to_details = match self.block_details(&to) {
|
|
||||||
Some(h) => h,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
Some(self.tree_route_aux((&from_details, &from), (&to_details, &to)))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Similar to `tree_route` function, but can be used to return a route
|
|
||||||
/// between blocks which may not be in database yet.
|
|
||||||
fn tree_route_aux(&self, from: (&BlockDetails, &H256), to: (&BlockDetails, &H256)) -> TreeRoute {
|
|
||||||
let mut from_branch = vec![];
|
|
||||||
let mut to_branch = vec![];
|
|
||||||
|
|
||||||
let mut from_details = from.0.clone();
|
|
||||||
let mut to_details = to.0.clone();
|
|
||||||
let mut current_from = from.1.clone();
|
|
||||||
let mut current_to = to.1.clone();
|
|
||||||
|
|
||||||
// reset from && to to the same level
|
|
||||||
while from_details.number > to_details.number {
|
|
||||||
from_branch.push(current_from);
|
|
||||||
current_from = from_details.parent.clone();
|
|
||||||
from_details = self.block_details(&from_details.parent).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
while to_details.number > from_details.number {
|
|
||||||
to_branch.push(current_to);
|
|
||||||
current_to = to_details.parent.clone();
|
|
||||||
to_details = self.block_details(&to_details.parent).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_eq!(from_details.number, to_details.number);
|
|
||||||
|
|
||||||
// move to shared parent
|
|
||||||
while current_from != current_to {
|
|
||||||
from_branch.push(current_from);
|
|
||||||
current_from = from_details.parent.clone();
|
|
||||||
from_details = self.block_details(&from_details.parent).unwrap();
|
|
||||||
|
|
||||||
to_branch.push(current_to);
|
|
||||||
current_to = to_details.parent.clone();
|
|
||||||
to_details = self.block_details(&to_details.parent).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let index = from_branch.len();
|
|
||||||
|
|
||||||
from_branch.extend(to_branch.into_iter().rev());
|
|
||||||
|
|
||||||
TreeRoute {
|
|
||||||
blocks: from_branch,
|
|
||||||
ancestor: current_from,
|
|
||||||
index: index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Inserts the block into backing cache database.
|
|
||||||
/// Expects the block to be valid and already verified.
|
|
||||||
/// If the block is already known, does nothing.
|
|
||||||
pub fn insert_block(&self, bytes: &[u8]) {
|
|
||||||
// create views onto rlp
|
|
||||||
let block = BlockView::new(bytes);
|
|
||||||
let header = block.header_view();
|
|
||||||
let hash = header.sha3();
|
|
||||||
|
|
||||||
if self.is_known(&hash) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// store block in db
|
|
||||||
self.blocks_db.put(&hash, &bytes).unwrap();
|
|
||||||
let (batch, new_best, details) = self.block_to_extras_insert_batch(bytes);
|
|
||||||
|
|
||||||
// update best block
|
|
||||||
let mut best_block = self.best_block.write().unwrap();
|
|
||||||
if let Some(b) = new_best {
|
|
||||||
*best_block = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update caches
|
|
||||||
let mut write = self.block_details.write().unwrap();
|
|
||||||
write.remove(&header.parent_hash());
|
|
||||||
write.insert(hash.clone(), details);
|
|
||||||
self.note_used(CacheID::Block(hash));
|
|
||||||
|
|
||||||
// update extras database
|
|
||||||
self.extras_db.write(batch).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Transforms block into WriteBatch that may be written into database
|
|
||||||
/// Additionally, if it's new best block it returns new best block object.
|
|
||||||
fn block_to_extras_insert_batch(&self, bytes: &[u8]) -> (WriteBatch, Option<BestBlock>, BlockDetails) {
|
|
||||||
// create views onto rlp
|
|
||||||
let block = BlockView::new(bytes);
|
|
||||||
let header = block.header_view();
|
|
||||||
|
|
||||||
// prepare variables
|
|
||||||
let hash = block.sha3();
|
|
||||||
let mut parent_details = self.block_details(&header.parent_hash()).expect("Invalid parent hash.");
|
|
||||||
let total_difficulty = parent_details.total_difficulty + header.difficulty();
|
|
||||||
let is_new_best = total_difficulty > self.best_block_total_difficulty();
|
|
||||||
let parent_hash = header.parent_hash();
|
|
||||||
|
|
||||||
// create current block details
|
|
||||||
let details = BlockDetails {
|
|
||||||
number: header.number(),
|
|
||||||
total_difficulty: total_difficulty,
|
|
||||||
parent: parent_hash.clone(),
|
|
||||||
children: vec![]
|
|
||||||
};
|
|
||||||
|
|
||||||
// prepare the batch
|
|
||||||
let batch = WriteBatch::new();
|
|
||||||
|
|
||||||
// insert new block details
|
|
||||||
batch.put_extras(&hash, &details);
|
|
||||||
|
|
||||||
// update parent details
|
|
||||||
parent_details.children.push(hash.clone());
|
|
||||||
batch.put_extras(&parent_hash, &parent_details);
|
|
||||||
|
|
||||||
// if it's not new best block, just return
|
|
||||||
if !is_new_best {
|
|
||||||
return (batch, None, details);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if its new best block we need to make sure that all ancestors
|
|
||||||
// are moved to "canon chain"
|
|
||||||
// find the route between old best block and the new one
|
|
||||||
let best_hash = self.best_block_hash();
|
|
||||||
let best_details = self.block_details(&best_hash).expect("best block hash is invalid!");
|
|
||||||
let route = self.tree_route_aux((&best_details, &best_hash), (&details, &hash));
|
|
||||||
|
|
||||||
match route.blocks.len() {
|
|
||||||
// its our parent
|
|
||||||
1 => batch.put_extras(&header.number(), &hash),
|
|
||||||
// it is a fork
|
|
||||||
i if i > 1 => {
|
|
||||||
let ancestor_number = self.block_number(&route.ancestor).unwrap();
|
|
||||||
let start_number = ancestor_number + 1;
|
|
||||||
for (index, hash) in route.blocks.iter().skip(route.index).enumerate() {
|
|
||||||
batch.put_extras(&(start_number + index as BlockNumber), hash);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// route.blocks.len() could be 0 only if inserted block is best block,
|
|
||||||
// and this is not possible at this stage
|
|
||||||
_ => { unreachable!(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
// this is new best block
|
|
||||||
batch.put(b"best", &hash).unwrap();
|
|
||||||
|
|
||||||
let best_block = BestBlock {
|
|
||||||
hash: hash,
|
|
||||||
number: header.number(),
|
|
||||||
total_difficulty: total_difficulty
|
|
||||||
};
|
|
||||||
|
|
||||||
(batch, Some(best_block), details)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if transaction is known.
|
|
||||||
pub fn is_known_transaction(&self, hash: &H256) -> bool {
|
|
||||||
self.query_extras_exist(hash, &self.transaction_addresses)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get best block hash.
|
|
||||||
pub fn best_block_hash(&self) -> H256 {
|
|
||||||
self.best_block.read().unwrap().hash.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get best block number.
|
|
||||||
pub fn best_block_number(&self) -> BlockNumber {
|
|
||||||
self.best_block.read().unwrap().number
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get best block total difficulty.
|
|
||||||
pub fn best_block_total_difficulty(&self) -> U256 {
|
|
||||||
self.best_block.read().unwrap().total_difficulty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the transactions' log blooms of a block.
|
|
||||||
pub fn log_blooms(&self, hash: &H256) -> Option<BlockLogBlooms> {
|
|
||||||
self.query_extras(hash, &self.block_logs)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn query_extras<K, T>(&self, hash: &K, cache: &RwLock<HashMap<K, T>>) -> Option<T> where
|
|
||||||
T: Clone + Decodable + ExtrasIndexable,
|
|
||||||
K: ExtrasSliceConvertable + Eq + Hash + Clone {
|
|
||||||
{
|
|
||||||
let read = cache.read().unwrap();
|
|
||||||
if let Some(v) = read.get(hash) {
|
|
||||||
return Some(v.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(h) = hash.as_h256() {
|
|
||||||
self.note_used(CacheID::Extras(T::extras_index(), h.clone()));
|
|
||||||
}
|
|
||||||
|
|
||||||
self.extras_db.get_extras(hash).map(| t: T | {
|
|
||||||
let mut write = cache.write().unwrap();
|
|
||||||
write.insert(hash.clone(), t.clone());
|
|
||||||
t
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn query_extras_exist<K, T>(&self, hash: &K, cache: &RwLock<HashMap<K, T>>) -> bool where
|
|
||||||
K: ExtrasSliceConvertable + Eq + Hash + Clone,
|
|
||||||
T: ExtrasIndexable {
|
|
||||||
{
|
|
||||||
let read = cache.read().unwrap();
|
|
||||||
if let Some(_) = read.get(hash) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.extras_db.extras_exists::<_, T>(hash)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get current cache size.
|
|
||||||
pub fn cache_size(&self) -> CacheSize {
|
|
||||||
CacheSize {
|
|
||||||
blocks: self.blocks.read().unwrap().heap_size_of_children(),
|
|
||||||
block_details: self.block_details.read().unwrap().heap_size_of_children(),
|
|
||||||
transaction_addresses: self.transaction_addresses.read().unwrap().heap_size_of_children(),
|
|
||||||
block_logs: self.block_logs.read().unwrap().heap_size_of_children(),
|
|
||||||
blocks_blooms: self.blocks_blooms.read().unwrap().heap_size_of_children()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Let the cache system know that a cacheable item has been used.
|
|
||||||
fn note_used(&self, id: CacheID) {
|
|
||||||
let mut cache_man = self.cache_man.write().unwrap();
|
|
||||||
if !cache_man.cache_usage[0].contains(&id) {
|
|
||||||
cache_man.cache_usage[0].insert(id.clone());
|
|
||||||
if cache_man.in_use.contains(&id) {
|
|
||||||
if let Some(c) = cache_man.cache_usage.iter_mut().skip(1).find(|e|e.contains(&id)) {
|
|
||||||
c.remove(&id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cache_man.in_use.insert(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Ticks our cache system and throws out any old data.
|
|
||||||
pub fn collect_garbage(&self) {
|
|
||||||
if self.cache_size().total() < self.pref_cache_size { return; }
|
|
||||||
|
|
||||||
for _ in 0..COLLECTION_QUEUE_SIZE {
|
|
||||||
{
|
|
||||||
let mut cache_man = self.cache_man.write().unwrap();
|
|
||||||
let mut blocks = self.blocks.write().unwrap();
|
|
||||||
let mut block_details = self.block_details.write().unwrap();
|
|
||||||
let mut block_hashes = self.block_hashes.write().unwrap();
|
|
||||||
let mut transaction_addresses = self.transaction_addresses.write().unwrap();
|
|
||||||
let mut block_logs = self.block_logs.write().unwrap();
|
|
||||||
let mut blocks_blooms = self.blocks_blooms.write().unwrap();
|
|
||||||
|
|
||||||
for id in cache_man.cache_usage.pop_back().unwrap().into_iter() {
|
|
||||||
cache_man.in_use.remove(&id);
|
|
||||||
match id {
|
|
||||||
CacheID::Block(h) => { blocks.remove(&h); },
|
|
||||||
CacheID::Extras(ExtrasIndex::BlockDetails, h) => { block_details.remove(&h); },
|
|
||||||
CacheID::Extras(ExtrasIndex::TransactionAddress, h) => { transaction_addresses.remove(&h); },
|
|
||||||
CacheID::Extras(ExtrasIndex::BlockLogBlooms, h) => { block_logs.remove(&h); },
|
|
||||||
CacheID::Extras(ExtrasIndex::BlocksBlooms, h) => { blocks_blooms.remove(&h); },
|
|
||||||
_ => panic!(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cache_man.cache_usage.push_front(HashSet::new());
|
|
||||||
|
|
||||||
// TODO: handle block_hashes properly.
|
|
||||||
block_hashes.clear();
|
|
||||||
}
|
|
||||||
if self.cache_size().total() < self.max_cache_size { break; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: m_lastCollection = chrono::system_clock::now();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use std::str::FromStr;
|
|
||||||
use rustc_serialize::hex::FromHex;
|
|
||||||
use util::hash::*;
|
|
||||||
use blockchain::*;
|
|
||||||
use tests::helpers::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn valid_tests_extra32() {
|
|
||||||
let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0363659b251bf8b819179874c8cce7b9b983d7f3704cbb58a3b334431f7032871889032d09c281e1236c0c0".from_hex().unwrap();
|
|
||||||
|
|
||||||
let temp = RandomTempPath::new();
|
|
||||||
let bc = BlockChain::new(&genesis, temp.as_path());
|
|
||||||
|
|
||||||
let genesis_hash = H256::from_str("3caa2203f3d7c136c0295ed128a7d31cea520b1ca5e27afe17d0853331798942").unwrap();
|
|
||||||
|
|
||||||
assert_eq!(bc.genesis_hash(), genesis_hash.clone());
|
|
||||||
assert_eq!(bc.best_block_number(), 0);
|
|
||||||
assert_eq!(bc.best_block_hash(), genesis_hash.clone());
|
|
||||||
assert_eq!(bc.block_hash(0), Some(genesis_hash.clone()));
|
|
||||||
assert_eq!(bc.block_hash(1), None);
|
|
||||||
|
|
||||||
let first = "f90285f90219a03caa2203f3d7c136c0295ed128a7d31cea520b1ca5e27afe17d0853331798942a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0d45893a296c1490a978e0bd321b5f2635d8280365c1fe9f693d65f233e791344a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b845627cb99a00102030405060708091011121314151617181920212223242526272829303132a08ccb2837fb2923bd97e8f2d08ea32012d6e34be018c73e49a0f98843e8f47d5d88e53be49fec01012ef866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ba0cb088b8d2ff76a7b2c6616c9d02fb6b7a501afbf8b69d7180b09928a1b80b5e4a06448fe7476c606582039bb72a9f6f4b4fad18507b8dfbd00eebbe151cc573cd2c0".from_hex().unwrap();
|
|
||||||
|
|
||||||
bc.insert_block(&first);
|
|
||||||
|
|
||||||
let first_hash = H256::from_str("a940e5af7d146b3b917c953a82e1966b906dace3a4e355b5b0a4560190357ea1").unwrap();
|
|
||||||
|
|
||||||
assert_eq!(bc.block_hash(0), Some(genesis_hash.clone()));
|
|
||||||
assert_eq!(bc.best_block_number(), 1);
|
|
||||||
assert_eq!(bc.best_block_hash(), first_hash.clone());
|
|
||||||
assert_eq!(bc.block_hash(1), Some(first_hash.clone()));
|
|
||||||
assert_eq!(bc.block_details(&first_hash).unwrap().parent, genesis_hash.clone());
|
|
||||||
assert_eq!(bc.block_details(&genesis_hash).unwrap().children, vec![first_hash.clone()]);
|
|
||||||
assert_eq!(bc.block_hash(2), None);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[allow(cyclomatic_complexity)]
|
|
||||||
fn test_small_fork() {
|
|
||||||
let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a059262c330941f3fe2a34d16d6e3c7b30d2ceb37c6a0e9a994c494ee1a61d2410885aa4c8bf8e56e264c0c0".from_hex().unwrap();
|
|
||||||
let b1 = "f90261f901f9a05716670833ec874362d65fea27a7cd35af5897d275b31a44944113111e4e96d2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a0e78628dd45a1f8dc495594d83b76c588a3ee67463260f8b7d4a42f574aeab29aa0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882520884562791e580a051b3ecba4e3f2b49c11d42dd0851ec514b1be3138080f72a2b6e83868275d98f8877671f479c414b47f862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca09e2709d7ec9bbe6b1bbbf0b2088828d14cd5e8642a1fee22dc74bfa89761a7f9a04bd8813dee4be989accdb708b1c2e325a7e9c695a8024e30e89d6c644e424747c0".from_hex().unwrap();
|
|
||||||
let b2 = "f902ccf901f9a0437e51676ff10756fcfee5edd9159fa41dbcb1b2c592850450371cbecd54ee4fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0c70a5dc56146e5ef025e4e5726a6373c6f12fd2f6784093a19ead0a7d17fb292a040645cbce4fd399e7bb9160b4c30c40d7ee616a030d4e18ef0ed3b02bdb65911a086e608555f63628417032a011d107b36427af37d153f0da02ce3f90fdd5e8c08b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd882c0e384562791e880a0e3cc39ff775cc0a32f175995b92e84b729e5c9a3563ff899e3555b908bc21d75887c3cde283f4846a6f8cdf8cb01018304cb2f8080b87e6060604052606e8060106000396000f360606040526000357c010000000000000000000000000000000000000000000000000000000090048063c0406226146037576035565b005b60406004506056565b6040518082815260200191505060405180910390f35b6000600560006000508190555060059050606b565b90561ba05258615c63503c0a600d6994b12ea5750d45b3c69668e2a371b4fbfb9eeff6b8a0a11be762bc90491231274a2945be35a43f23c27775b1ff24dd521702fe15f73ec0".from_hex().unwrap();
|
|
||||||
let b3a = "f90261f901f9a036fde1253128666fcb95a5956da14a73489e988bb72738717ec1d31e1cee781aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a05fb2b4bfdef7b314451cb138a534d225c922fc0e5fbe25e451142732c3e25c25a09dc4b1357c0b7b8108f8a098f4f9a1a274957bc9ebc22a9ae67ae81739e5b19ca007c6fdfa8eea7e86b81f5b0fc0f78f90cc19f4aa60d323151e0cac660199e9a1b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd882524d84562791eb80a074861666bd346c025889745c793b91ab9cd1e2ca19b5cf3c50d04d135b0a4d2b8809fe9587ea4cdc04f862f86002018304cb2f94ec0e71ad0a90ffe1909d27dac207f7680abba42d01801ba06fd84874d36d5de9e8e48978c03619b53a96b7ae0a4cd1ac118f103098b44801a00572596974dd7df4f9f69bd7456585618c568d8434ef6453391b89281ce12ae1c0".from_hex().unwrap();
|
|
||||||
let b3b = "f90265f901f9a036fde1253128666fcb95a5956da14a73489e988bb72738717ec1d31e1cee781aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ab87dc338bfd6f662b1cd90bc0c9e40a1b2146a095312393c9e13ce3a5008b09a0e609b7a7d4b8a2403ec1268627ecd98783627246e8f1b26addb3ff504f76a054a0592fabf92476512952db3a69a2481a42912e668a1ee28c4c322e703bb665f8beb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd882a1f084562791ee80a0fe7098fa7e4ac5d637eea81fb23f8f78346826dbab430068dd9a249d0afa99818853e1a6b201ae3545f866f86402018304cb2f94ec0e71ad0a90ffe1909d27dac207f7680abba42d0284c04062261ca06edc9ce8e7da4cc34067beb325dcad59e5655a164a5100a50bc3eb681b12c716a0abf9053d5de65b1be81fe50d327b84de685efbeecea34e7b747180a6c6023e44c0".from_hex().unwrap();
|
|
||||||
|
|
||||||
let genesis_hash = H256::from_str("5716670833ec874362d65fea27a7cd35af5897d275b31a44944113111e4e96d2").unwrap();
|
|
||||||
let b1_hash = H256::from_str("437e51676ff10756fcfee5edd9159fa41dbcb1b2c592850450371cbecd54ee4f").unwrap();
|
|
||||||
let b2_hash = H256::from_str("36fde1253128666fcb95a5956da14a73489e988bb72738717ec1d31e1cee781a").unwrap();
|
|
||||||
let b3a_hash = H256::from_str("c208f88c9f5bf7e00840439742c12e5226d9752981f3ec0521bdcb6dd08af277").unwrap();
|
|
||||||
let b3b_hash = H256::from_str("bf72270ae0d95c9ea39a6adab994793fddb8c10fba7391e26279474124605d54").unwrap();
|
|
||||||
|
|
||||||
// b3a is a part of canon chain, whereas b3b is part of sidechain
|
|
||||||
let best_block_hash = H256::from_str("c208f88c9f5bf7e00840439742c12e5226d9752981f3ec0521bdcb6dd08af277").unwrap();
|
|
||||||
|
|
||||||
let temp = RandomTempPath::new();
|
|
||||||
let bc = BlockChain::new(&genesis, temp.as_path());
|
|
||||||
bc.insert_block(&b1);
|
|
||||||
bc.insert_block(&b2);
|
|
||||||
bc.insert_block(&b3a);
|
|
||||||
bc.insert_block(&b3b);
|
|
||||||
|
|
||||||
assert_eq!(bc.best_block_hash(), best_block_hash);
|
|
||||||
assert_eq!(bc.block_number(&genesis_hash).unwrap(), 0);
|
|
||||||
assert_eq!(bc.block_number(&b1_hash).unwrap(), 1);
|
|
||||||
assert_eq!(bc.block_number(&b2_hash).unwrap(), 2);
|
|
||||||
assert_eq!(bc.block_number(&b3a_hash).unwrap(), 3);
|
|
||||||
assert_eq!(bc.block_number(&b3b_hash).unwrap(), 3);
|
|
||||||
|
|
||||||
assert_eq!(bc.block_hash(0).unwrap(), genesis_hash);
|
|
||||||
assert_eq!(bc.block_hash(1).unwrap(), b1_hash);
|
|
||||||
assert_eq!(bc.block_hash(2).unwrap(), b2_hash);
|
|
||||||
assert_eq!(bc.block_hash(3).unwrap(), b3a_hash);
|
|
||||||
|
|
||||||
// test trie route
|
|
||||||
let r0_1 = bc.tree_route(genesis_hash.clone(), b1_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r0_1.ancestor, genesis_hash);
|
|
||||||
assert_eq!(r0_1.blocks, [b1_hash.clone()]);
|
|
||||||
assert_eq!(r0_1.index, 0);
|
|
||||||
|
|
||||||
let r0_2 = bc.tree_route(genesis_hash.clone(), b2_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r0_2.ancestor, genesis_hash);
|
|
||||||
assert_eq!(r0_2.blocks, [b1_hash.clone(), b2_hash.clone()]);
|
|
||||||
assert_eq!(r0_2.index, 0);
|
|
||||||
|
|
||||||
let r1_3a = bc.tree_route(b1_hash.clone(), b3a_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r1_3a.ancestor, b1_hash);
|
|
||||||
assert_eq!(r1_3a.blocks, [b2_hash.clone(), b3a_hash.clone()]);
|
|
||||||
assert_eq!(r1_3a.index, 0);
|
|
||||||
|
|
||||||
let r1_3b = bc.tree_route(b1_hash.clone(), b3b_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r1_3b.ancestor, b1_hash);
|
|
||||||
assert_eq!(r1_3b.blocks, [b2_hash.clone(), b3b_hash.clone()]);
|
|
||||||
assert_eq!(r1_3b.index, 0);
|
|
||||||
|
|
||||||
let r3a_3b = bc.tree_route(b3a_hash.clone(), b3b_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r3a_3b.ancestor, b2_hash);
|
|
||||||
assert_eq!(r3a_3b.blocks, [b3a_hash.clone(), b3b_hash.clone()]);
|
|
||||||
assert_eq!(r3a_3b.index, 1);
|
|
||||||
|
|
||||||
let r1_0 = bc.tree_route(b1_hash.clone(), genesis_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r1_0.ancestor, genesis_hash);
|
|
||||||
assert_eq!(r1_0.blocks, [b1_hash.clone()]);
|
|
||||||
assert_eq!(r1_0.index, 1);
|
|
||||||
|
|
||||||
let r2_0 = bc.tree_route(b2_hash.clone(), genesis_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r2_0.ancestor, genesis_hash);
|
|
||||||
assert_eq!(r2_0.blocks, [b2_hash.clone(), b1_hash.clone()]);
|
|
||||||
assert_eq!(r2_0.index, 2);
|
|
||||||
|
|
||||||
let r3a_1 = bc.tree_route(b3a_hash.clone(), b1_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r3a_1.ancestor, b1_hash);
|
|
||||||
assert_eq!(r3a_1.blocks, [b3a_hash.clone(), b2_hash.clone()]);
|
|
||||||
assert_eq!(r3a_1.index, 2);
|
|
||||||
|
|
||||||
let r3b_1 = bc.tree_route(b3b_hash.clone(), b1_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r3b_1.ancestor, b1_hash);
|
|
||||||
assert_eq!(r3b_1.blocks, [b3b_hash.clone(), b2_hash.clone()]);
|
|
||||||
assert_eq!(r3b_1.index, 2);
|
|
||||||
|
|
||||||
let r3b_3a = bc.tree_route(b3b_hash.clone(), b3a_hash.clone()).unwrap();
|
|
||||||
assert_eq!(r3b_3a.ancestor, b2_hash);
|
|
||||||
assert_eq!(r3b_3a.blocks, [b3b_hash.clone(), b3a_hash.clone()]);
|
|
||||||
assert_eq!(r3b_3a.index, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_reopen_blockchain_db() {
|
|
||||||
let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a059262c330941f3fe2a34d16d6e3c7b30d2ceb37c6a0e9a994c494ee1a61d2410885aa4c8bf8e56e264c0c0".from_hex().unwrap();
|
|
||||||
let b1 = "f90261f901f9a05716670833ec874362d65fea27a7cd35af5897d275b31a44944113111e4e96d2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a0e78628dd45a1f8dc495594d83b76c588a3ee67463260f8b7d4a42f574aeab29aa0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882520884562791e580a051b3ecba4e3f2b49c11d42dd0851ec514b1be3138080f72a2b6e83868275d98f8877671f479c414b47f862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca09e2709d7ec9bbe6b1bbbf0b2088828d14cd5e8642a1fee22dc74bfa89761a7f9a04bd8813dee4be989accdb708b1c2e325a7e9c695a8024e30e89d6c644e424747c0".from_hex().unwrap();
|
|
||||||
let genesis_hash = H256::from_str("5716670833ec874362d65fea27a7cd35af5897d275b31a44944113111e4e96d2").unwrap();
|
|
||||||
let b1_hash = H256::from_str("437e51676ff10756fcfee5edd9159fa41dbcb1b2c592850450371cbecd54ee4f").unwrap();
|
|
||||||
|
|
||||||
let temp = RandomTempPath::new();
|
|
||||||
{
|
|
||||||
let bc = BlockChain::new(&genesis, temp.as_path());
|
|
||||||
assert_eq!(bc.best_block_hash(), genesis_hash);
|
|
||||||
bc.insert_block(&b1);
|
|
||||||
assert_eq!(bc.best_block_hash(), b1_hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let bc = BlockChain::new(&genesis, temp.as_path());
|
|
||||||
assert_eq!(bc.best_block_hash(), b1_hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_arbitrary_block_sequence() {
|
|
||||||
let bc_result = generate_dummy_blockchain(50);
|
|
||||||
let bc = bc_result.reference();
|
|
||||||
assert_eq!(bc.best_block_number(), 49);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_collect_garbage() {
|
|
||||||
let bc_result = generate_dummy_blockchain(3000);
|
|
||||||
let bc = bc_result.reference();
|
|
||||||
|
|
||||||
assert_eq!(bc.best_block_number(), 2999);
|
|
||||||
let best_hash = bc.best_block_hash();
|
|
||||||
let mut block_header = bc.block_header(&best_hash);
|
|
||||||
|
|
||||||
while !block_header.is_none() {
|
|
||||||
block_header = bc.block_header(&block_header.unwrap().parent_hash);
|
|
||||||
}
|
|
||||||
assert!(bc.cache_size().blocks > 1024 * 1024);
|
|
||||||
|
|
||||||
for _ in 0..2 {
|
|
||||||
bc.collect_garbage();
|
|
||||||
}
|
|
||||||
assert!(bc.cache_size().blocks < 1024 * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_arbitrary_block_sequence_with_extra() {
|
|
||||||
let bc_result = generate_dummy_blockchain_with_extra(25);
|
|
||||||
let bc = bc_result.reference();
|
|
||||||
assert_eq!(bc.best_block_number(), 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_only_genesis_block() {
|
|
||||||
let bc_result = generate_dummy_empty_blockchain();
|
|
||||||
let bc = bc_result.reference();
|
|
||||||
assert_eq!(bc.best_block_number(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
32
ethcore/src/blockchain/best_block.rs
Normal file
32
ethcore/src/blockchain/best_block.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::bytes::Bytes;
|
||||||
|
use util::numbers::{U256,H256};
|
||||||
|
use header::BlockNumber;
|
||||||
|
|
||||||
|
/// Best block info.
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct BestBlock {
|
||||||
|
/// Best block hash.
|
||||||
|
pub hash: H256,
|
||||||
|
/// Best block number.
|
||||||
|
pub number: BlockNumber,
|
||||||
|
/// Best block total difficulty.
|
||||||
|
pub total_difficulty: U256,
|
||||||
|
/// Best block uncompressed bytes
|
||||||
|
pub block: Bytes,
|
||||||
|
}
|
||||||
54
ethcore/src/blockchain/block_info.rs
Normal file
54
ethcore/src/blockchain/block_info.rs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::numbers::{U256,H256};
|
||||||
|
use header::BlockNumber;
|
||||||
|
|
||||||
|
/// Brief info about inserted block.
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct BlockInfo {
|
||||||
|
/// Block hash.
|
||||||
|
pub hash: H256,
|
||||||
|
/// Block number.
|
||||||
|
pub number: BlockNumber,
|
||||||
|
/// Total block difficulty.
|
||||||
|
pub total_difficulty: U256,
|
||||||
|
/// Block location in blockchain.
|
||||||
|
pub location: BlockLocation
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Describes location of newly inserted block.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum BlockLocation {
|
||||||
|
/// It's part of the canon chain.
|
||||||
|
CanonChain,
|
||||||
|
/// It's not a part of the canon chain.
|
||||||
|
Branch,
|
||||||
|
/// It's part of the fork which should become canon chain,
|
||||||
|
/// because its total difficulty is higher than current
|
||||||
|
/// canon chain difficulty.
|
||||||
|
BranchBecomingCanonChain(BranchBecomingCanonChainData),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct BranchBecomingCanonChainData {
|
||||||
|
/// Hash of the newest common ancestor with old canon chain.
|
||||||
|
pub ancestor: H256,
|
||||||
|
/// Hashes of the blocks between ancestor and this block.
|
||||||
|
pub enacted: Vec<H256>,
|
||||||
|
/// Hashes of the blocks which were invalidated.
|
||||||
|
pub retracted: Vec<H256>,
|
||||||
|
}
|
||||||
1788
ethcore/src/blockchain/blockchain.rs
Normal file
1788
ethcore/src/blockchain/blockchain.rs
Normal file
File diff suppressed because it is too large
Load Diff
37
ethcore/src/blockchain/cache.rs
Normal file
37
ethcore/src/blockchain/cache.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/// Represents blockchain's in-memory cache size in bytes.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct CacheSize {
|
||||||
|
/// Blocks cache size.
|
||||||
|
pub blocks: usize,
|
||||||
|
/// BlockDetails cache size.
|
||||||
|
pub block_details: usize,
|
||||||
|
/// Transaction addresses cache size.
|
||||||
|
pub transaction_addresses: usize,
|
||||||
|
/// Blooms cache size.
|
||||||
|
pub blocks_blooms: usize,
|
||||||
|
/// Block receipts size.
|
||||||
|
pub block_receipts: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CacheSize {
|
||||||
|
/// Total amount used by the cache.
|
||||||
|
pub fn total(&self) -> usize {
|
||||||
|
self.blocks + self.block_details + self.transaction_addresses + self.blocks_blooms + self.block_receipts
|
||||||
|
}
|
||||||
|
}
|
||||||
39
ethcore/src/blockchain/config.rs
Normal file
39
ethcore/src/blockchain/config.rs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Blockchain configuration.
|
||||||
|
|
||||||
|
/// Blockchain configuration.
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct Config {
|
||||||
|
/// Preferred cache size in bytes.
|
||||||
|
pub pref_cache_size: usize,
|
||||||
|
/// Maximum cache size in bytes.
|
||||||
|
pub max_cache_size: usize,
|
||||||
|
/// Backing db cache_size
|
||||||
|
pub db_cache_size: Option<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Config {
|
||||||
|
fn default() -> Self {
|
||||||
|
Config {
|
||||||
|
pref_cache_size: 1 << 14,
|
||||||
|
max_cache_size: 1 << 20,
|
||||||
|
db_cache_size: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
243
ethcore/src/blockchain/extras.rs
Normal file
243
ethcore/src/blockchain/extras.rs
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Blockchain DB extras.
|
||||||
|
|
||||||
|
use bloomchain;
|
||||||
|
use util::*;
|
||||||
|
use header::BlockNumber;
|
||||||
|
use receipt::Receipt;
|
||||||
|
use db::Key;
|
||||||
|
use blooms::{GroupPosition, BloomGroup};
|
||||||
|
|
||||||
|
/// Represents index of extra data in database
|
||||||
|
#[derive(Copy, Debug, Hash, Eq, PartialEq, Clone)]
|
||||||
|
pub enum ExtrasIndex {
|
||||||
|
/// Block details index
|
||||||
|
BlockDetails = 0,
|
||||||
|
/// Block hash index
|
||||||
|
BlockHash = 1,
|
||||||
|
/// Transaction address index
|
||||||
|
TransactionAddress = 2,
|
||||||
|
/// Block blooms index
|
||||||
|
BlocksBlooms = 3,
|
||||||
|
/// Block receipts index
|
||||||
|
BlockReceipts = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_index(hash: &H256, i: ExtrasIndex) -> H264 {
|
||||||
|
let mut result = H264::default();
|
||||||
|
result[0] = i as u8;
|
||||||
|
(*result)[1..].clone_from_slice(hash);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct BlockNumberKey([u8; 5]);
|
||||||
|
|
||||||
|
impl Deref for BlockNumberKey {
|
||||||
|
type Target = [u8];
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key<H256> for BlockNumber {
|
||||||
|
type Target = BlockNumberKey;
|
||||||
|
|
||||||
|
fn key(&self) -> Self::Target {
|
||||||
|
let mut result = [0u8; 5];
|
||||||
|
result[0] = ExtrasIndex::BlockHash as u8;
|
||||||
|
result[1] = (self >> 24) as u8;
|
||||||
|
result[2] = (self >> 16) as u8;
|
||||||
|
result[3] = (self >> 8) as u8;
|
||||||
|
result[4] = *self as u8;
|
||||||
|
BlockNumberKey(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key<BlockDetails> for H256 {
|
||||||
|
type Target = H264;
|
||||||
|
|
||||||
|
fn key(&self) -> H264 {
|
||||||
|
with_index(self, ExtrasIndex::BlockDetails)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct LogGroupKey([u8; 6]);
|
||||||
|
|
||||||
|
impl Deref for LogGroupKey {
|
||||||
|
type Target = [u8];
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
|
pub struct LogGroupPosition(GroupPosition);
|
||||||
|
|
||||||
|
impl From<bloomchain::group::GroupPosition> for LogGroupPosition {
|
||||||
|
fn from(position: bloomchain::group::GroupPosition) -> Self {
|
||||||
|
LogGroupPosition(From::from(position))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeapSizeOf for LogGroupPosition {
|
||||||
|
fn heap_size_of_children(&self) -> usize {
|
||||||
|
self.0.heap_size_of_children()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key<BloomGroup> for LogGroupPosition {
|
||||||
|
type Target = LogGroupKey;
|
||||||
|
|
||||||
|
fn key(&self) -> Self::Target {
|
||||||
|
let mut result = [0u8; 6];
|
||||||
|
result[0] = ExtrasIndex::BlocksBlooms as u8;
|
||||||
|
result[1] = self.0.level;
|
||||||
|
result[2] = (self.0.index >> 24) as u8;
|
||||||
|
result[3] = (self.0.index >> 16) as u8;
|
||||||
|
result[4] = (self.0.index >> 8) as u8;
|
||||||
|
result[5] = self.0.index as u8;
|
||||||
|
LogGroupKey(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key<TransactionAddress> for H256 {
|
||||||
|
type Target = H264;
|
||||||
|
|
||||||
|
fn key(&self) -> H264 {
|
||||||
|
with_index(self, ExtrasIndex::TransactionAddress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Key<BlockReceipts> for H256 {
|
||||||
|
type Target = H264;
|
||||||
|
|
||||||
|
fn key(&self) -> H264 {
|
||||||
|
with_index(self, ExtrasIndex::BlockReceipts)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Familial details concerning a block
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct BlockDetails {
|
||||||
|
/// Block number
|
||||||
|
pub number: BlockNumber,
|
||||||
|
/// Total difficulty of the block and all its parents
|
||||||
|
pub total_difficulty: U256,
|
||||||
|
/// Parent block hash
|
||||||
|
pub parent: H256,
|
||||||
|
/// List of children block hashes
|
||||||
|
pub children: Vec<H256>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeapSizeOf for BlockDetails {
|
||||||
|
fn heap_size_of_children(&self) -> usize {
|
||||||
|
self.children.heap_size_of_children()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Decodable for BlockDetails {
|
||||||
|
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
||||||
|
let d = decoder.as_rlp();
|
||||||
|
let details = BlockDetails {
|
||||||
|
number: try!(d.val_at(0)),
|
||||||
|
total_difficulty: try!(d.val_at(1)),
|
||||||
|
parent: try!(d.val_at(2)),
|
||||||
|
children: try!(d.val_at(3)),
|
||||||
|
};
|
||||||
|
Ok(details)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for BlockDetails {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.begin_list(4);
|
||||||
|
s.append(&self.number);
|
||||||
|
s.append(&self.total_difficulty);
|
||||||
|
s.append(&self.parent);
|
||||||
|
s.append(&self.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Represents address of certain transaction within block
|
||||||
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
|
pub struct TransactionAddress {
|
||||||
|
/// Block hash
|
||||||
|
pub block_hash: H256,
|
||||||
|
/// Transaction index within the block
|
||||||
|
pub index: usize
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeapSizeOf for TransactionAddress {
|
||||||
|
fn heap_size_of_children(&self) -> usize { 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Decodable for TransactionAddress {
|
||||||
|
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
||||||
|
let d = decoder.as_rlp();
|
||||||
|
let tx_address = TransactionAddress {
|
||||||
|
block_hash: try!(d.val_at(0)),
|
||||||
|
index: try!(d.val_at(1)),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(tx_address)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for TransactionAddress {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.begin_list(2);
|
||||||
|
s.append(&self.block_hash);
|
||||||
|
s.append(&self.index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Contains all block receipts.
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct BlockReceipts {
|
||||||
|
pub receipts: Vec<Receipt>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BlockReceipts {
|
||||||
|
pub fn new(receipts: Vec<Receipt>) -> Self {
|
||||||
|
BlockReceipts {
|
||||||
|
receipts: receipts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Decodable for BlockReceipts {
|
||||||
|
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
||||||
|
Ok(BlockReceipts {
|
||||||
|
receipts: try!(Decodable::decode(decoder))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for BlockReceipts {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.append(&self.receipts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeapSizeOf for BlockReceipts {
|
||||||
|
fn heap_size_of_children(&self) -> usize {
|
||||||
|
self.receipts.heap_size_of_children()
|
||||||
|
}
|
||||||
|
}
|
||||||
72
ethcore/src/blockchain/generator/block.rs
Normal file
72
ethcore/src/blockchain/generator/block.rs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::rlp::*;
|
||||||
|
use util::{H256, H2048};
|
||||||
|
use util::bytes::Bytes;
|
||||||
|
use header::Header;
|
||||||
|
use transaction::SignedTransaction;
|
||||||
|
|
||||||
|
use super::fork::Forkable;
|
||||||
|
use super::bloom::WithBloom;
|
||||||
|
use super::complete::CompleteBlock;
|
||||||
|
use super::transaction::WithTransaction;
|
||||||
|
|
||||||
|
/// Helper structure, used for encoding blocks.
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct Block {
|
||||||
|
pub header: Header,
|
||||||
|
pub transactions: Vec<SignedTransaction>,
|
||||||
|
pub uncles: Vec<Header>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encodable for Block {
|
||||||
|
fn rlp_append(&self, s: &mut RlpStream) {
|
||||||
|
s.begin_list(3);
|
||||||
|
s.append(&self.header);
|
||||||
|
s.append(&self.transactions);
|
||||||
|
s.append(&self.uncles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Forkable for Block {
|
||||||
|
fn fork(mut self, fork_number: usize) -> Self where Self: Sized {
|
||||||
|
let difficulty = self.header.difficulty().clone() - fork_number.into();
|
||||||
|
self.header.difficulty = difficulty;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WithBloom for Block {
|
||||||
|
fn with_bloom(mut self, bloom: H2048) -> Self where Self: Sized {
|
||||||
|
self.header.log_bloom = bloom;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WithTransaction for Block {
|
||||||
|
fn with_transaction(mut self, transaction: SignedTransaction) -> Self where Self: Sized {
|
||||||
|
self.transactions.push(transaction);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CompleteBlock for Block {
|
||||||
|
fn complete(mut self, parent_hash: H256) -> Bytes {
|
||||||
|
self.header.parent_hash = parent_hash;
|
||||||
|
encode(&self).to_vec()
|
||||||
|
}
|
||||||
|
}
|
||||||
35
ethcore/src/blockchain/generator/bloom.rs
Normal file
35
ethcore/src/blockchain/generator/bloom.rs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::hash::H2048;
|
||||||
|
|
||||||
|
pub trait WithBloom {
|
||||||
|
fn with_bloom(self, bloom: H2048) -> Self where Self: Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Bloom<'a, I> where I: 'a {
|
||||||
|
pub iter: &'a mut I,
|
||||||
|
pub bloom: H2048,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, I> Iterator for Bloom<'a, I> where I: Iterator, <I as Iterator>::Item: WithBloom {
|
||||||
|
type Item = <I as Iterator>::Item;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
self.iter.next().map(|item| item.with_bloom(self.bloom.clone()))
|
||||||
|
}
|
||||||
|
}
|
||||||
53
ethcore/src/blockchain/generator/complete.rs
Normal file
53
ethcore/src/blockchain/generator/complete.rs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::hash::H256;
|
||||||
|
use util::bytes::Bytes;
|
||||||
|
use util::sha3::Hashable;
|
||||||
|
use views::BlockView;
|
||||||
|
|
||||||
|
#[derive(Default, Clone)]
|
||||||
|
pub struct BlockFinalizer {
|
||||||
|
parent_hash: H256
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BlockFinalizer {
|
||||||
|
pub fn fork(&self) -> Self {
|
||||||
|
self.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait CompleteBlock {
|
||||||
|
fn complete(self, parent_hash: H256) -> Bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Complete<'a, I> where I: 'a {
|
||||||
|
pub iter: &'a mut I,
|
||||||
|
pub finalizer: &'a mut BlockFinalizer,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, I> Iterator for Complete<'a, I> where I: Iterator, <I as Iterator>::Item: CompleteBlock {
|
||||||
|
type Item = Bytes;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
self.iter.next().map(|item| {
|
||||||
|
let rlp = item.complete(self.finalizer.parent_hash.clone());
|
||||||
|
self.finalizer.parent_hash = BlockView::new(&rlp).header_view().sha3();
|
||||||
|
rlp
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
42
ethcore/src/blockchain/generator/fork.rs
Normal file
42
ethcore/src/blockchain/generator/fork.rs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
pub trait Forkable {
|
||||||
|
fn fork(self, fork_number: usize) -> Self where Self: Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Fork<I> {
|
||||||
|
pub iter: I,
|
||||||
|
pub fork_number: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I> Clone for Fork<I> where I: Iterator + Clone {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Fork {
|
||||||
|
iter: self.iter.clone(),
|
||||||
|
fork_number: self.fork_number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I> Iterator for Fork<I> where I: Iterator, <I as Iterator>::Item: Forkable {
|
||||||
|
type Item = <I as Iterator>::Item;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
self.iter.next().map(|item| item.fork(self.fork_number))
|
||||||
|
}
|
||||||
|
}
|
||||||
180
ethcore/src/blockchain/generator/generator.rs
Normal file
180
ethcore/src/blockchain/generator/generator.rs
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use util::hash::H2048;
|
||||||
|
use util::numbers::U256;
|
||||||
|
use util::bytes::Bytes;
|
||||||
|
use header::BlockNumber;
|
||||||
|
use transaction::SignedTransaction;
|
||||||
|
use super::fork::Fork;
|
||||||
|
use super::bloom::Bloom;
|
||||||
|
use super::complete::{BlockFinalizer, CompleteBlock, Complete};
|
||||||
|
use super::block::Block;
|
||||||
|
use super::transaction::Transaction;
|
||||||
|
|
||||||
|
/// Chain iterator interface.
|
||||||
|
pub trait ChainIterator: Iterator + Sized {
|
||||||
|
/// Should be called to create a fork of current iterator.
|
||||||
|
/// Blocks generated by fork will have lower difficulty than current chain.
|
||||||
|
fn fork(&self, fork_number: usize) -> Fork<Self> where Self: Clone;
|
||||||
|
/// Should be called to make every consecutive block have given bloom.
|
||||||
|
fn with_bloom(&mut self, bloom: H2048) -> Bloom<Self>;
|
||||||
|
/// Should be called to make every consecutive block have given transaction.
|
||||||
|
fn with_transaction(&mut self, transaction: SignedTransaction) -> Transaction<Self>;
|
||||||
|
/// Should be called to complete block. Without complete, block may have incorrect hash.
|
||||||
|
fn complete<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Complete<'a, Self>;
|
||||||
|
/// Completes and generates block.
|
||||||
|
fn generate<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Option<Bytes> where Self::Item: CompleteBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I> ChainIterator for I where I: Iterator + Sized {
|
||||||
|
fn fork(&self, fork_number: usize) -> Fork<Self> where I: Clone {
|
||||||
|
Fork {
|
||||||
|
iter: self.clone(),
|
||||||
|
fork_number: fork_number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_bloom(&mut self, bloom: H2048) -> Bloom<Self> {
|
||||||
|
Bloom {
|
||||||
|
iter: self,
|
||||||
|
bloom: bloom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_transaction(&mut self, transaction: SignedTransaction) -> Transaction<Self> {
|
||||||
|
Transaction {
|
||||||
|
iter: self,
|
||||||
|
transaction: transaction,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn complete<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Complete<'a, Self> {
|
||||||
|
Complete {
|
||||||
|
iter: self,
|
||||||
|
finalizer: finalizer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn generate<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Option<Bytes> where <I as Iterator>::Item: CompleteBlock {
|
||||||
|
self.complete(finalizer).next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Blockchain generator.
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct ChainGenerator {
|
||||||
|
/// Next block number.
|
||||||
|
number: BlockNumber,
|
||||||
|
/// Next block difficulty.
|
||||||
|
difficulty: U256,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ChainGenerator {
|
||||||
|
fn prepare_block(&self) -> Block {
|
||||||
|
let mut block = Block::default();
|
||||||
|
block.header.number = self.number;
|
||||||
|
block.header.difficulty = self.difficulty;
|
||||||
|
block
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for ChainGenerator {
|
||||||
|
fn default() -> Self {
|
||||||
|
ChainGenerator {
|
||||||
|
number: 0,
|
||||||
|
difficulty: 1000.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Iterator for ChainGenerator {
|
||||||
|
type Item = Block;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
let block = self.prepare_block();
|
||||||
|
self.number += 1;
|
||||||
|
Some(block)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod tests {
|
||||||
|
use util::hash::{H256, H2048};
|
||||||
|
use util::sha3::Hashable;
|
||||||
|
use views::BlockView;
|
||||||
|
use blockchain::generator::{ChainIterator, ChainGenerator, BlockFinalizer};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn canon_chain_generator() {
|
||||||
|
let mut canon_chain = ChainGenerator::default();
|
||||||
|
let mut finalizer = BlockFinalizer::default();
|
||||||
|
|
||||||
|
let genesis_rlp = canon_chain.generate(&mut finalizer).unwrap();
|
||||||
|
let genesis = BlockView::new(&genesis_rlp);
|
||||||
|
|
||||||
|
assert_eq!(genesis.header_view().parent_hash(), H256::default());
|
||||||
|
assert_eq!(genesis.header_view().number(), 0);
|
||||||
|
|
||||||
|
let b1_rlp = canon_chain.generate(&mut finalizer).unwrap();
|
||||||
|
let b1 = BlockView::new(&b1_rlp);
|
||||||
|
|
||||||
|
assert_eq!(b1.header_view().parent_hash(), genesis.header_view().sha3());
|
||||||
|
assert_eq!(b1.header_view().number(), 1);
|
||||||
|
|
||||||
|
let mut fork_chain = canon_chain.fork(1);
|
||||||
|
|
||||||
|
let b2_rlp_fork = fork_chain.generate(&mut finalizer.fork()).unwrap();
|
||||||
|
let b2_fork = BlockView::new(&b2_rlp_fork);
|
||||||
|
|
||||||
|
assert_eq!(b2_fork.header_view().parent_hash(), b1.header_view().sha3());
|
||||||
|
assert_eq!(b2_fork.header_view().number(), 2);
|
||||||
|
|
||||||
|
let b2_rlp = canon_chain.generate(&mut finalizer).unwrap();
|
||||||
|
let b2 = BlockView::new(&b2_rlp);
|
||||||
|
|
||||||
|
assert_eq!(b2.header_view().parent_hash(), b1.header_view().sha3());
|
||||||
|
assert_eq!(b2.header_view().number(), 2);
|
||||||
|
assert!(b2.header_view().difficulty() > b2_fork.header_view().difficulty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn with_bloom_generator() {
|
||||||
|
let bloom = H2048([0x1; 256]);
|
||||||
|
let mut gen = ChainGenerator::default();
|
||||||
|
let mut finalizer = BlockFinalizer::default();
|
||||||
|
|
||||||
|
let block0_rlp = gen.with_bloom(bloom).generate(&mut finalizer).unwrap();
|
||||||
|
let block1_rlp = gen.generate(&mut finalizer).unwrap();
|
||||||
|
let block0 = BlockView::new(&block0_rlp);
|
||||||
|
let block1 = BlockView::new(&block1_rlp);
|
||||||
|
|
||||||
|
assert_eq!(block0.header_view().number(), 0);
|
||||||
|
assert_eq!(block0.header_view().parent_hash(), H256::default());
|
||||||
|
|
||||||
|
assert_eq!(block1.header_view().number(), 1);
|
||||||
|
assert_eq!(block1.header_view().parent_hash(), block0.header_view().sha3());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn generate_1000_blocks() {
|
||||||
|
let generator = ChainGenerator::default();
|
||||||
|
let mut finalizer = BlockFinalizer::default();
|
||||||
|
let blocks: Vec<_> = generator.take(1000).complete(&mut finalizer).collect();
|
||||||
|
assert_eq!(blocks.len(), 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
27
ethcore/src/blockchain/generator/mod.rs
Normal file
27
ethcore/src/blockchain/generator/mod.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Blockchain generator for tests.
|
||||||
|
|
||||||
|
mod bloom;
|
||||||
|
mod block;
|
||||||
|
mod complete;
|
||||||
|
mod fork;
|
||||||
|
pub mod generator;
|
||||||
|
mod transaction;
|
||||||
|
|
||||||
|
pub use self::complete::BlockFinalizer;
|
||||||
|
pub use self::generator::{ChainIterator, ChainGenerator};
|
||||||
35
ethcore/src/blockchain/generator/transaction.rs
Normal file
35
ethcore/src/blockchain/generator/transaction.rs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use transaction::SignedTransaction;
|
||||||
|
|
||||||
|
pub trait WithTransaction {
|
||||||
|
fn with_transaction(self, transaction: SignedTransaction) -> Self where Self: Sized;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Transaction<'a, I> where I: 'a {
|
||||||
|
pub iter: &'a mut I,
|
||||||
|
pub transaction: SignedTransaction,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl <'a, I> Iterator for Transaction<'a, I> where I: Iterator, <I as Iterator>::Item: WithTransaction {
|
||||||
|
type Item = <I as Iterator>::Item;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
self.iter.next().map(|item| item.with_transaction(self.transaction.clone()))
|
||||||
|
}
|
||||||
|
}
|
||||||
135
ethcore/src/blockchain/import_route.rs
Normal file
135
ethcore/src/blockchain/import_route.rs
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Import route.
|
||||||
|
|
||||||
|
use util::hash::H256;
|
||||||
|
use blockchain::block_info::{BlockInfo, BlockLocation};
|
||||||
|
|
||||||
|
/// Import route for newly inserted block.
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct ImportRoute {
|
||||||
|
/// Blocks that were invalidated by new block.
|
||||||
|
pub retracted: Vec<H256>,
|
||||||
|
/// Blocks that were validated by new block.
|
||||||
|
pub enacted: Vec<H256>,
|
||||||
|
/// Blocks which are neither retracted nor enacted.
|
||||||
|
pub omitted: Vec<H256>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ImportRoute {
|
||||||
|
pub fn none() -> Self {
|
||||||
|
ImportRoute {
|
||||||
|
retracted: vec![],
|
||||||
|
enacted: vec![],
|
||||||
|
omitted: vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<BlockInfo> for ImportRoute {
|
||||||
|
fn from(info: BlockInfo) -> ImportRoute {
|
||||||
|
match info.location {
|
||||||
|
BlockLocation::CanonChain => ImportRoute {
|
||||||
|
retracted: vec![],
|
||||||
|
enacted: vec![info.hash],
|
||||||
|
omitted: vec![],
|
||||||
|
},
|
||||||
|
BlockLocation::Branch => ImportRoute {
|
||||||
|
retracted: vec![],
|
||||||
|
enacted: vec![],
|
||||||
|
omitted: vec![info.hash],
|
||||||
|
},
|
||||||
|
BlockLocation::BranchBecomingCanonChain(mut data) => {
|
||||||
|
data.enacted.push(info.hash);
|
||||||
|
ImportRoute {
|
||||||
|
retracted: data.retracted,
|
||||||
|
enacted: data.enacted,
|
||||||
|
omitted: vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use util::hash::H256;
|
||||||
|
use util::numbers::U256;
|
||||||
|
use blockchain::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
|
||||||
|
use blockchain::ImportRoute;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn import_route_none() {
|
||||||
|
assert_eq!(ImportRoute::none(), ImportRoute {
|
||||||
|
enacted: vec![],
|
||||||
|
retracted: vec![],
|
||||||
|
omitted: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn import_route_branch() {
|
||||||
|
let info = BlockInfo {
|
||||||
|
hash: H256::from(U256::from(1)),
|
||||||
|
number: 0,
|
||||||
|
total_difficulty: U256::from(0),
|
||||||
|
location: BlockLocation::Branch,
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(ImportRoute::from(info), ImportRoute {
|
||||||
|
retracted: vec![],
|
||||||
|
enacted: vec![],
|
||||||
|
omitted: vec![H256::from(U256::from(1))],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn import_route_canon_chain() {
|
||||||
|
let info = BlockInfo {
|
||||||
|
hash: H256::from(U256::from(1)),
|
||||||
|
number: 0,
|
||||||
|
total_difficulty: U256::from(0),
|
||||||
|
location: BlockLocation::CanonChain,
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(ImportRoute::from(info), ImportRoute {
|
||||||
|
retracted: vec![],
|
||||||
|
enacted: vec![H256::from(U256::from(1))],
|
||||||
|
omitted: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn import_route_branch_becoming_canon_chain() {
|
||||||
|
let info = BlockInfo {
|
||||||
|
hash: H256::from(U256::from(2)),
|
||||||
|
number: 0,
|
||||||
|
total_difficulty: U256::from(0),
|
||||||
|
location: BlockLocation::BranchBecomingCanonChain(BranchBecomingCanonChainData {
|
||||||
|
ancestor: H256::from(U256::from(0)),
|
||||||
|
enacted: vec![H256::from(U256::from(1))],
|
||||||
|
retracted: vec![H256::from(U256::from(3)), H256::from(U256::from(4))],
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(ImportRoute::from(info), ImportRoute {
|
||||||
|
retracted: vec![H256::from(U256::from(3)), H256::from(U256::from(4))],
|
||||||
|
enacted: vec![H256::from(U256::from(1)), H256::from(U256::from(2))],
|
||||||
|
omitted: vec![],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
35
ethcore/src/blockchain/mod.rs
Normal file
35
ethcore/src/blockchain/mod.rs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity 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.
|
||||||
|
|
||||||
|
// Parity 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 Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Blockchain database.
|
||||||
|
|
||||||
|
mod best_block;
|
||||||
|
mod block_info;
|
||||||
|
pub mod blockchain;
|
||||||
|
mod cache;
|
||||||
|
mod config;
|
||||||
|
pub mod extras;
|
||||||
|
mod import_route;
|
||||||
|
mod update;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod generator;
|
||||||
|
|
||||||
|
pub use self::blockchain::{BlockProvider, BlockChain};
|
||||||
|
pub use self::cache::CacheSize;
|
||||||
|
pub use self::config::Config;
|
||||||
|
pub use types::tree_route::TreeRoute;
|
||||||
|
pub use self::import_route::ImportRoute;
|
||||||
24
ethcore/src/blockchain/update.rs
Normal file
24
ethcore/src/blockchain/update.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use util::numbers::H256;
|
||||||
|
use header::BlockNumber;
|
||||||
|
use blockchain::block_info::BlockInfo;
|
||||||
|
use blooms::BloomGroup;
|
||||||
|
use super::extras::{BlockDetails, BlockReceipts, TransactionAddress, LogGroupPosition};
|
||||||
|
|
||||||
|
/// Block extras update info.
|
||||||
|
pub struct ExtrasUpdate<'a> {
|
||||||
|
/// Block info.
|
||||||
|
pub info: BlockInfo,
|
||||||
|
/// Current block uncompressed rlp bytes
|
||||||
|
pub block: &'a [u8],
|
||||||
|
/// Modified block hashes.
|
||||||
|
pub block_hashes: HashMap<BlockNumber, H256>,
|
||||||
|
/// Modified block details.
|
||||||
|
pub block_details: HashMap<H256, BlockDetails>,
|
||||||
|
/// Modified block receipts.
|
||||||
|
pub block_receipts: HashMap<H256, BlockReceipts>,
|
||||||
|
/// Modified blocks blooms.
|
||||||
|
pub blocks_blooms: HashMap<LogGroupPosition, BloomGroup>,
|
||||||
|
/// Modified transaction addresses (None signifies removed transactions).
|
||||||
|
pub transactions_addresses: HashMap<H256, Option<TransactionAddress>>,
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user