Compare commits

...

2918 Commits

Author SHA1 Message Date
Marek Kotewicz
a9a41a03c5 Merge pull request #1782 from ethcore/beta-staging
BETA: fixed trace_transaction crash when block contained suicide
2016-07-31 17:26:15 +02:00
arkpar
73376f0c3a Removed test 2016-07-31 14:49:23 +02:00
arkpar
e4f6871646 Updated json-ipc-server 2016-07-31 14:40:12 +02:00
arkpar
282e7d10d0 Version 1.2.3 2016-07-31 14:39:37 +02:00
debris
bdd04d10af fixed trace_transaction crash when block contained suicide 2016-07-31 13:18:56 +02:00
Tomasz Drwięga
8b658b257f [beta] Updating UI (#1778)
* Updating UI

* Fix for building without UI
2016-07-31 12:54:02 +02:00
Marek Kotewicz
03fad0869e tracing backport (#1770)
* Suicides tracing (#1688)

* tracing suicide

* fixed #1635

* fixed typo

* Stackoverflow #1686 (#1698)

* flat trace serialization

* tracing finds transaction which creates contract

* flatten traces before inserting them to the db

* Trace other types of calls (#1727)

* Trace through DELEGATECALL and CALLCODE

Add them to the JSON output and RLP database store.

* Fix tests.

* Fix all tests.

* Fix one more test.

* filtering transactions toAddress includes contract creation (#1697)

* tracing finds transaction which creates contract

* comma cleanup

Remove when following `}`s, add to final entries.

* Various improvements to tracing & diagnostics. (#1707)

* Various improvements to tracing & diagnostics.

- Manage possibility of `Account` not having code for `PodAccount`
- New RPC: `trace_sendRawTransaction`
- See raw transaction dump when inspecting over RPC

* Fix test

* Remove one of the dupe error messages

* Remove unneeded `&`s

* Reformat and extremely minor optimisation

* Minor optimisation

* Remove unneeded let

* Fix tests.

* Additional fix.

* Minor rename.

[ci:skip]

* Bowing to the pressure.

* Stackoverflow fix (#1742)

* executive tracer builds flat traces without intermediate struct

* temporarilt commented out tests for traces

* fixed new way of building trace address

* fixed new way of building trace address

* updating state tests with flat tracing in progress

* fixed flat tracing tests

* fixed compiling ethcore-rpc with new flat traces

* removed warnings from ethcore module

* remove unused data structures
2016-07-30 06:39:26 -07:00
Arkadiy Paronyan
8017daf47c Backport commits to beta (#1763)
* Don't try to sync to ancient blocks

* Parallel block body download

* Fixed reading chunked EIP8 handshake (#1712)

* Fixed reading chunked EIP8 handshake

* Added missing break

* Disconnect peers on a fork

* Updated json-ipc-server

* Combine mining queue and enabled into single locked datum (#1749)

* Combine mining queue and enabled into single locked datum

Additional tracing.

* Fix bug uncovered by test.

* Fix typo

* Remove unneeded log initialisation in test.

* fix failing test (#1756)

* Fixed test

* Suicides tracing (#1688)

* tracing suicide

* fixed #1635

* fixed typo

* Stackoverflow #1686 (#1698)

* flat trace serialization

* tracing finds transaction which creates contract

* flatten traces before inserting them to the db

* Trace other types of calls (#1727)

* Trace through DELEGATECALL and CALLCODE

Add them to the JSON output and RLP database store.

* Fix tests.

* Fix all tests.

* Fix one more test.

* filtering transactions toAddress includes contract creation (#1697)

* tracing finds transaction which creates contract

* comma cleanup

Remove when following `}`s, add to final entries.

* Various improvements to tracing & diagnostics. (#1707)

* Various improvements to tracing & diagnostics.

- Manage possibility of `Account` not having code for `PodAccount`
- New RPC: `trace_sendRawTransaction`
- See raw transaction dump when inspecting over RPC

* Fix test

* Remove one of the dupe error messages

* Remove unneeded `&`s

* Reformat and extremely minor optimisation

* Minor optimisation

* Remove unneeded let

* Fix tests.

* Additional fix.

* Minor rename.

* Bowing to the pressure.

* Stackoverflow fix (#1742)

* executive tracer builds flat traces without intermediate struct

* temporarilt commented out tests for traces

* fixed new way of building trace address

* fixed new way of building trace address

* updating state tests with flat tracing in progress

* fixed flat tracing tests

* fixed compiling ethcore-rpc with new flat traces

* removed warnings from ethcore module

* remove unused data structures
2016-07-30 06:37:18 -07:00
Arkadiy Paronyan
429c83f92f Deadlock on incoming connection (#1672) (#1675) 2016-07-20 18:12:07 +02:00
Arkadiy Paronyan
a453bab9e8 Removed DAO soft fork traces (#1640) 2016-07-16 19:50:13 +02:00
Arkadiy Paronyan
2cf4549d01 DAO hard-fork (#1483) (#1636)
* DAO hard-fork (#1483)

* Minor additions to allow resetting of code.

* Add test.

* Provisional DAO hard-fork proposal.

* Change to reflect latest HF spec.

* Include extradata restrictions and overrides.

* Introduce new tests.

* Update tests to new spec format.

* Allow JSON chain spec fields to be optional.

* Remove superfluous definitions. Fix overflow risk.

* Fix build.

* Add missing file.

* Remove old flag.

* Update to latest address set.

* Update tests and test spec to latest.

Change the mining default to release only on own transactions.

* Updated tests submodule
2016-07-16 15:04:02 +02:00
Arkadiy Paronyan
68dfae8f06 Backports for beta (#1628)
* Remove soft-fork stuff.

* Fix tests.

* Fix "pending" parameter on RPC block requests (#1602)

* Initial commit.

* Pending blocks work.

* Address grumbles.

* Fix up for new API.

* Fixed test
2016-07-15 16:44:27 +02:00
Arkadiy Paronyan
b7caa24c2e don't batch best block for branches (#1623) (#1626) 2016-07-15 10:13:12 +02:00
Arkadiy Paronyan
ed5d797662 Merge bugfixes from master to beta (#1605)
* Attempt to fix blochchain DB sync

* Fix bloomchain on blockchain repair

* Make sure reserved peers are in the node table

* fixed #1606 (#1615)
2016-07-14 12:52:07 +02:00
Nikolay Volf
69847e3b8b (BETA) using block options cache instead of general cache for rocksdb (#1613)
* using block options cache instead of general cache for rocksdb

* remove previous cache setup
2016-07-14 10:25:09 +02:00
Arkadiy Paronyan
ef124fa3ef Backport sealing fixes to beta (#1583)
* Update sealing just once when  externally importing many blocks (#1541)

Fixes Issue #1372

* Fixing deadlock in miner (#1569)

* Fixing deadlock in miner
* Adding more comments
2016-07-12 09:52:46 +02:00
Arkadiy Paronyan
aece120e77 v1.2.2 in beta (#1581)
* v1.2.2

* Fixed warning
2016-07-12 09:48:52 +02:00
Gav Wood
cc127eed15 Fix the reseal mechanism. 2016-07-06 12:37:45 +02:00
Gav Wood
acfabe5431 Skipping transactions with invalid nonces when pushing to block. (#1545) (#1547)
* Changing some logging levels

* Skipping invalid nonce errors
2016-07-06 10:41:29 +02:00
arkpar
a600b1ac80 Merge remote-tracking branch 'origin/work-notify' into beta 2016-07-01 13:10:22 +02:00
arkpar
1ce3fc24cf Save the block reference in the queue on notification 2016-07-01 11:37:31 +02:00
Arkadiy Paronyan
7ae0eb8137 Merge pull request #1513 from ethcore/fixmining
Fix the reseal mechanism.
2016-07-01 08:09:06 +02:00
arkpar
df04c95f9a Merge branch 'fixmining' of github.com:ethcore/parity into beta 2016-06-30 23:20:28 +02:00
arkpar
6e7b003e78 Merge branch 'fixmining' of github.com:ethcore/parity into beta 2016-06-30 23:20:12 +02:00
Gav Wood
1d780f456a Fix is_new. 2016-06-30 23:14:54 +02:00
arkpar
0de297adf7 Merge branch 'work-notify' into beta 2016-06-30 22:44:09 +02:00
Gav Wood
29b6ba4a87 Fix the reseal mechanism. 2016-06-30 22:35:59 +02:00
arkpar
5a7fd628db Added comment 2016-06-30 22:34:54 +02:00
Arkadiy Paronyan
cf7830fa8f Merge pull request #1509 from General-Beck/patch-15
Update Dockerfile ubuntu-aarch64
2016-06-30 22:34:24 +02:00
Arkadiy Paronyan
1dc56fc3e1 Merge pull request #1510 from General-Beck/patch-16
Update Ubuntu-arm Dockerfile
2016-06-30 22:34:18 +02:00
Arkadiy Paronyan
91efef8497 Merge pull request #1511 from General-Beck/patch-17
Update Ubuntu-jit Dockerfile
2016-06-30 22:34:15 +02:00
Arkadiy Paronyan
6962e1d211 Merge pull request #1512 from General-Beck/patch-18
Update Ubuntu Dockerfile
2016-06-30 22:34:13 +02:00
Arkadiy Paronyan
dd62e2d43b Merge pull request #1508 from General-Beck/patch-14
Update CentOS Dockerfile
2016-06-30 22:33:55 +02:00
Denis S. Soldatov aka General-Beck
038ef2b3c3 Update Ubuntu Dockerfile
[ci skip]
2016-07-01 03:29:45 +07:00
Denis S. Soldatov aka General-Beck
c8c7fbbf27 Update Ubuntu-jit Dockerfile
[ci skip]
2016-07-01 03:29:00 +07:00
Denis S. Soldatov aka General-Beck
6bbd237711 Update Ubuntu-arm Dockerfile
[ci skip]
2016-07-01 03:28:18 +07:00
Denis S. Soldatov aka General-Beck
6bdbc2cb93 Update Dockerfile ubuntu-aarch64
[ci skip]
2016-07-01 03:27:36 +07:00
Denis S. Soldatov aka General-Beck
f370e17a54 Update CentOS Dockerfile
[ci skip]
2016-07-01 03:26:56 +07:00
Arkadiy Paronyan
30f2e8f60c Merge pull request #1502 from ethcore/bump-status-page
bump status page v0.5.1
2016-06-30 22:16:32 +02:00
Nikolay Volf
4a60407c2a Merge pull request #1507 from General-Beck/patch-13
Update CentOS Dockerfile
2016-07-01 00:16:09 +04:00
Nikolay Volf
5dd3c6196c Merge pull request #1506 from General-Beck/patch-12
Update Dockerfile ubuntu-aarch64
2016-07-01 00:15:56 +04:00
Nikolay Volf
a681566967 Merge pull request #1505 from General-Beck/patch-11
Update Ubuntu-arm Dockerfile
2016-07-01 00:15:41 +04:00
Nikolay Volf
ff0d8ea868 Merge pull request #1504 from General-Beck/patch-10
Update Ubuntu-jit Dockerfile
2016-07-01 00:15:21 +04:00
Nikolay Volf
489ddd1d6f Merge pull request #1503 from General-Beck/patch-9
Update Ubuntu Dockerfile
2016-07-01 00:15:00 +04:00
Denis S. Soldatov aka General-Beck
90a4475f52 Update CentOS Dockerfile
[ci skip]
2016-07-01 03:10:58 +07:00
Denis S. Soldatov aka General-Beck
bee2102424 Update Dockerfile ubuntu-aarch64
[ci skip]
2016-07-01 03:09:48 +07:00
Denis S. Soldatov aka General-Beck
bb70cd889e Update Ubuntu-arm Dockerfile
[ci skip]
2016-07-01 03:08:58 +07:00
Denis S. Soldatov aka General-Beck
8134a89b87 Update Ubuntu-jit Dockerfile
[ci skip]
2016-07-01 03:08:07 +07:00
Denis S. Soldatov aka General-Beck
d3cb79833b Update Ubuntu Dockerfile
[ci skip]
2016-07-01 03:07:22 +07:00
Arkadiy Paronyan
673c5afd4d Update install-parity.sh 2016-06-30 18:56:16 +02:00
arkpar
3921e10af0 Merge branch 'work-notify' of github.com:ethcore/parity into beta 2016-06-30 18:21:12 +02:00
arkpar
4ba8b3c1e0 Merge remote-tracking branch 'origin/master' into beta 2016-06-30 18:20:06 +02:00
goldylucks
6616b5e17d bump status page v0.5.1 2016-06-30 18:14:20 +02:00
goldylucks
a7c332ecea status page bump 2016-06-30 18:07:38 +02:00
arkpar
070c1b170f Save the block reference in the queue on notification 2016-06-30 17:33:21 +02:00
arkpar
c38d15ad4d Merge branch 'master' of github.com:ethcore/parity into beta 2016-06-30 16:11:56 +02:00
Arkadiy Paronyan
24e73f3aec Merge pull request #1497 from ethcore/clone-work
Optionally clone block behind work-package
2016-06-30 15:50:27 +02:00
Gav Wood
6ae467252c Fix no colour on windows. (#1498) 2016-06-30 15:49:00 +02:00
Gav Wood
9c58ebf2d2 Merge branch 'master' into clone-work 2016-06-30 13:16:48 +02:00
Arkadiy Paronyan
ff29c82c9e Merge pull request #1495 from ethcore/work-notify
Workaround for hyper panic
2016-06-30 13:14:24 +02:00
Gav Wood
dff7d9603c Fix for fake new work packages. 2016-06-30 13:12:15 +02:00
Gav Wood
9c07e5c355 Optionally clone block behind work-package. 2016-06-30 12:56:58 +02:00
Gav Wood
5665083e20 UsingQueue can clone rather than just take. 2016-06-30 12:21:04 +02:00
Arkadiy Paronyan
30fad64621 Merge pull request #1488 from ethcore/notification-on-mine
Colourful notification on mine
2016-06-30 11:42:43 +02:00
arkpar
51c6b85f80 Workaround hyper panic 2016-06-30 10:07:33 +02:00
Tomasz Drwięga
af65945b58 Specifying max open files (#1494) 2016-06-30 08:24:01 +02:00
Gav Wood
5a794b21cf Make output less green. 2016-06-30 08:20:34 +02:00
Gav Wood
6ca2e6b29b Remove extraneous messages. 2016-06-30 08:20:34 +02:00
Gav Wood
93a89049ed More colour! 2016-06-30 08:20:34 +02:00
Gav Wood
92edf7f511 Safe coloured logging. 2016-06-30 08:20:34 +02:00
Gav Wood
4a6206c514 Log for when we mine a block with lots of info.
Fixes #1468
2016-06-30 08:20:34 +02:00
Arkadiy Paronyan
60270083e5 Merge pull request #1491 from ethcore/work-notify
Work notification over HTTP
2016-06-30 08:19:45 +02:00
Arkadiy Paronyan
34155730ff Merge pull request #1492 from ethcore/v1.2.1
v1.2.1 in beta
2016-06-30 08:13:17 +02:00
Arkadiy Paronyan
946c1fd76a Merge pull request #1478 from ethcore/seal-import
Sealed block importing and propagation optimization
2016-06-30 08:13:07 +02:00
arkpar
2df737bebf v1.2.1 2016-06-29 22:27:49 +02:00
arkpar
9885bdcf0a Merge remote-tracking branch 'origin/master' into beta 2016-06-29 22:14:42 +02:00
Gav Wood
86ba6f1912 Fix test compilation. 2016-06-29 22:05:00 +02:00
arkpar
ee01ad1324 Shortcut sealed block into the chain 2016-06-29 21:49:22 +02:00
Gav Wood
f24ba94fbd Merge branch 'work-notify' of github.com:ethcore/parity into work-notify 2016-06-29 20:14:32 +02:00
Gav Wood
dc24448900 Include number in eth_getWork. 2016-06-29 20:09:13 +02:00
arkpar
b3f37f3cb4 HTTP work notifier 2016-06-29 20:07:21 +02:00
Gav Wood
e24f9c9936 Add CLI option and route to MinerOptions. 2016-06-29 20:06:03 +02:00
arkpar
19d83a9074 Merge branch 'work-notify' of github.com:ethcore/parity into work-notify 2016-06-29 20:05:11 +02:00
arkpar
5958c87e56 HTTP work notifier 2016-06-29 20:04:52 +02:00
Robert Habermeier
83c967c082 Merge pull request #1487 from ethcore/vm-fact
vm factory to mining client
2016-06-29 18:00:54 +02:00
Adam Goldman
aec4130dca topbar dialog fix (#1479)
* topbar dialog fix

* push goldylucks changes to ethcore umbrella
2016-06-29 17:19:04 +02:00
Gav Wood
98ae9cad6f Minor additions to allow resetting of code. (#1482)
* Minor additions to allow resetting of code.

* Add test.
2016-06-29 16:29:04 +02:00
Gav Wood
5d1ff3d7ba Introduce options for fine-grained management of work queue. (#1484)
* Introduce options for fine-grained management of work queue.

- Minimum reseal period between non-mandatory (transaction) reseals.
- Maximum historical cached block size.

Defaults changed to reflect real-world scenarios (2s, 20 blocks).

* Fix test bug.

* 50 -> 20.
2016-06-29 16:26:19 +02:00
NikVolf
580913fa7d vm factory to mining client 2016-06-29 17:23:29 +03:00
Gav Wood
05927eba1f Include number in eth_getWork. 2016-06-29 15:43:34 +02:00
Gav Wood
7c27f9dfed Add CLI option and route to MinerOptions. 2016-06-29 15:37:11 +02:00
Gav Wood
c096c087df Ensure we don't reject our own transactions for gasprice. (#1485)
* Ensure we don't reject our own transactions for gasprice.

* Add test.
2016-06-29 15:23:41 +02:00
Arkadiy Paronyan
78ebc8b975 Merge pull request #1481 from ethcore/av-signing
Signing parity executable & windows installer in appveyor
2016-06-29 10:39:33 +02:00
Gav Wood
e3214c63c6 Rearrange fork CLI options. (#1476)
* Rearrange fork CLI options.

* Fixed compilation
2016-06-29 09:28:56 +02:00
NikVolf
2138a53067 Merge branch 'master' into av-signing 2016-06-29 02:02:02 +03:00
NikVolf
72771bd833 signing executable also 2016-06-29 01:58:15 +03:00
Nikolay Volf
91aee536ca Merge pull request #1475 from ethcore/appveyor_choking
give appveyor some breath
2016-06-29 02:35:12 +04:00
arkpar
09e1970bbf Merge with master 2016-06-28 20:04:00 +02:00
NikVolf
ebcbb19aef sign command 2016-06-28 21:02:15 +03:00
Tomasz Drwięga
e3ca87c4d1 Updating WS version 2016-06-28 19:40:23 +02:00
Tomasz Drwięga
1fcf5c7cc2 Fixing HTTP file serving on ws-rs 2016-06-28 19:40:22 +02:00
Tomasz Drwięga
dd0e681847 Using stable version of ws-rs 2016-06-28 19:40:22 +02:00
arkpar
c006f446a4 Reduced IO messages; removed panics on IO notifications 2016-06-28 19:39:59 +02:00
Gav Wood
9a16e593e2 Update configuration.rs 2016-06-28 19:39:31 +02:00
Gav Wood
5ef767f7f2 Update cli.rs
[ci:skip]
2016-06-28 19:39:31 +02:00
Nikolay Volf
071da2eec5 fix tests 2016-06-28 19:39:31 +02:00
Nikolay Volf
a3f165cf48 cli config 2016-06-28 19:39:31 +02:00
Nikolay Volf
93facbf854 ethcore client config 2016-06-28 19:39:31 +02:00
Nikolay Volf
42f5d7f897 jdb to new settings config 2016-06-28 19:39:31 +02:00
Nikolay Volf
97e553f1bf extra helpers for prefix 2016-06-28 19:38:48 +02:00
Nikolay Volf
8caa859111 compaction struct and helpers 2016-06-28 19:38:48 +02:00
Gav Wood
a3758161ac Ensure we always get the latest work when mining on submitted. (#1469)
* Ensure we always get the latest work when mining on submitted.

* Build fix.

* Smaller timeslices for the wait.
2016-06-28 18:46:09 +02:00
Marek Kotewicz
38870fb3e4 Merge pull request #1471 from ethcore/tests_for_views
Tests for views
2016-06-28 17:37:27 +02:00
NikVolf
3ae8ccf8c6 signing installer 2016-06-28 18:13:21 +03:00
Nikolay Volf
477fdefb55 json ipc version bump (#1470)
* bump version once

* version bump 2
2016-06-28 16:22:05 +02:00
debris
8dbf182618 give appveyor some breath 2016-06-28 16:10:21 +02:00
debris
2462193df8 Merge branch 'master' of github.com:ethcore/parity into tests_for_views 2016-06-28 14:28:54 +02:00
debris
0b86723e68 tests for HeaderView and BlockView, fixed #144 2016-06-28 14:28:42 +02:00
Marek Kotewicz
af891f65a7 verifier is no longer a template type of client (#1467)
* verifier is no longer a template type of client

* added missing ,
2016-06-28 13:23:15 +02:00
Arkadiy Paronyan
39307b2bea Merge pull request #1460 from ethcore/miner-improvements
Allow configuration of when to reseal blocks.
2016-06-28 13:11:24 +02:00
debris
4ecf23df9a tests for TransactionView 2016-06-28 12:08:30 +02:00
Marek Kotewicz
4f56f8b27c removed unsafe code (#1466) 2016-06-28 11:52:59 +02:00
Tomasz Drwięga
6895a56099 Adding default for value (#1465) 2016-06-28 11:10:39 +02:00
Gav Wood
599a6104b7 Minor renaming. 2016-06-28 10:40:35 +02:00
Gav Wood
31de739122 U256 instead of Option<U256>. Fix up tests. 2016-06-28 10:21:29 +02:00
Gav Wood
af935df553 Merge branch 'master' into miner-improvements 2016-06-28 10:02:33 +02:00
Gav Wood
d0cec2434e Merge branch 'miner-improvements' of github.com:ethcore/parity into miner-improvements 2016-06-28 10:00:51 +02:00
Gav Wood
c221f69ccd Clean up some of the FP stuff. 2016-06-28 10:00:28 +02:00
Arkadiy Paronyan
a3a68a20f4 Merge pull request #1461 from ethcore/db-repair
Attempt DB repair if corrupted
2016-06-28 07:37:49 +02:00
Arkadiy Paronyan
993f707fbe Merge pull request #1454 from ethcore/db-config-ext
Database configuration extended
2016-06-28 07:07:05 +02:00
Gav Wood
ff788e4199 Fix another typo
[ci:skip]
2016-06-27 21:06:40 +02:00
Gav Wood
5919c660e5 Fix typo
[ci:skip]
2016-06-27 21:06:10 +02:00
Gav Wood
495e56034f Merge branch 'master' into miner-improvements 2016-06-27 21:02:55 +02:00
arkpar
ed153995f9 Attempt DB repair if corrupted 2016-06-27 20:41:02 +02:00
arkpar
150d7c1c78 Merge remote-tracking branch 'origin/master' into db-config-ext 2016-06-27 20:33:07 +02:00
arkpar
5d67a32cef Merge remote-tracking branch 'origin/master' into miner-improvements 2016-06-27 20:31:57 +02:00
Gav Wood
10aa32b0f5 Include RPC configurability for max tx gas limit.
Also Move the gas limit into the transaction queue from the miner.
2016-06-27 20:19:01 +02:00
Arkadiy Paronyan
a83def78b3 Merge pull request #1459 from ethcore/stable-ws
Updating WS-RS server
2016-06-27 19:53:24 +02:00
Arkadiy Paronyan
60b70dada1 Reduced IO messages; removed panics on IO notifications (#1457) 2016-06-27 19:30:13 +02:00
Gav Wood
dc79e63db7 Update configuration.rs 2016-06-27 19:22:54 +02:00
Gav Wood
7b5eeb1dd7 Update cli.rs
[ci:skip]
2016-06-27 19:22:28 +02:00
Gav Wood
a102015ecf Fix doc test. 2016-06-27 19:16:26 +02:00
Gav Wood
2a51a30d41 Fix up the pending set stuff. 2016-06-27 19:06:54 +02:00
Nikolay Volf
9f4bfd9e7a fix tests 2016-06-27 18:47:50 +02:00
Gav Wood
1667808ecb More miner options.
- Optional limit for the amount of gas transactions may have;
- option to restruct transactions returned/queried to only those
which have been executed.
2016-06-27 18:27:06 +02:00
Tomasz Drwięga
ac9e6f2649 Handle errors when starting parity (#1451) 2016-06-27 17:24:47 +02:00
Arkadiy Paronyan
33dfb819f0 Fixed losing queued blocks on ancient block error (#1453) 2016-06-27 17:24:36 +02:00
Gav Wood
6c1802e412 Allow configuration of when to reseal blocks. 2016-06-27 17:23:54 +02:00
arkpar
2e99bfafc8 Updated to latest hyper with patched mio 2016-06-27 17:22:38 +02:00
Gav Wood
a2c4d550d0 Retweak BASE and MULTIPLIER in rocksdb config. (#1445) 2016-06-27 17:21:25 +02:00
Gav Wood
bc8ba10184 More conservative settings for rocksdb. (#1440) 2016-06-27 17:09:18 +02:00
Tomasz Drwięga
222404f801 Updating WS version 2016-06-27 16:34:46 +02:00
Tomasz Drwięga
044bf5511a Fixing HTTP file serving on ws-rs 2016-06-27 16:34:39 +02:00
Tomasz Drwięga
1fdbfa14ad Handle errors when starting parity (#1451) 2016-06-27 16:00:16 +02:00
Arkadiy Paronyan
6859152c21 Fixed losing queued blocks on ancient block error (#1453) 2016-06-27 15:59:45 +02:00
Nikolay Volf
f9f25fd147 cli config 2016-06-27 14:25:50 +02:00
Nikolay Volf
2e5d5f12dd ethcore client config 2016-06-27 13:58:12 +02:00
Nikolay Volf
627b67db0a jdb to new settings config 2016-06-27 13:23:50 +02:00
Nikolay Volf
07098fd16f extra helpers for prefix 2016-06-27 13:14:40 +02:00
Nikolay Volf
e4763e90bc compaction struct and helpers 2016-06-27 13:03:34 +02:00
Marek Kotewicz
6b51dffca0 Merge pull request #1450 from ethcore/rpc-server-fix
Updated to latest hyper with patched mio
2016-06-27 11:36:37 +02:00
arkpar
c21550a663 Updated to latest hyper with patched mio 2016-06-27 10:39:37 +02:00
Gav Wood
4f1f33d1b8 Retweak BASE and MULTIPLIER in rocksdb config. (#1445) 2016-06-27 09:20:38 +02:00
Marek Kotewicz
b3398cec33 Merge pull request #1410 from ethcore/miner-no-default
Removing Miner::default.
2016-06-27 09:18:42 +02:00
Tomasz Drwięga
593d947fcd Using stable version of ws-rs 2016-06-26 23:48:59 +02:00
Tomasz Drwięga
2bd0c5ebcb Unwrap or default 2016-06-26 22:48:09 +02:00
Tomasz Drwięga
6bbaced3cd Merge branch 'master' into miner-no-default
Conflicts:
	ethcore/src/miner/miner.rs
	parity/main.rs
2016-06-26 22:44:34 +02:00
Gav Wood
cdc34957db Don't mine without --author (#1436)
Requires --author to be set before mining is allowed to happen.
2016-06-26 22:28:55 +02:00
Gav Wood
8a644e7185 Revert the rescuedao extradata. 2016-06-26 22:28:27 +02:00
Gav Wood
516b015325 Don't mine without --author (#1436)
Requires --author to be set before mining is allowed to happen.
2016-06-26 22:02:17 +02:00
Arkadiy Paronyan
2ef929dcbd Merge pull request #1437 from ethcore/revertrescuedaoed
Revert the rescuedao extradata.
2016-06-26 14:27:56 +02:00
Gav Wood
2400001675 More conservative settings for rocksdb. (#1440) 2016-06-25 23:13:34 +02:00
Gav Wood
2574d000a3 Revert the rescuedao extradata. 2016-06-25 14:35:43 +02:00
Arkadiy Paronyan
a72d8ee0e7 v1.3.0 (#1421) 2016-06-25 10:32:05 +02:00
Arkadiy Paronyan
482d910b15 Merge pull request #1429 from General-Beck/patch-7
Update Ubuntu-arm Dockerfile
2016-06-24 22:53:33 +02:00
Arkadiy Paronyan
b02d7a4311 Merge pull request #1430 from General-Beck/patch-8
Create Dockerfile ubuntu-aarch64
2016-06-24 22:53:11 +02:00
Denis S. Soldatov aka General-Beck
ab0d280232 Create Dockerfile ubuntu-aarch64
Create Dockerfile ubuntu-aarch64
[ci skip]
2016-06-25 03:51:05 +07:00
Denis S. Soldatov aka General-Beck
4fd0a95112 Update Ubuntu-arm Dockerfile
Update Ubuntu-arm Dockerfile
[ci skip]
2016-06-25 02:58:06 +07:00
Arkadiy Paronyan
59d1a82814 Merge pull request #1424 from General-Beck/patch-4
Update CentOS Dockerfile
2016-06-24 21:55:45 +02:00
Arkadiy Paronyan
83af81f443 Merge pull request #1426 from General-Beck/patch-5
Update Ubuntu Dockerfile
2016-06-24 21:52:58 +02:00
Arkadiy Paronyan
6c40cdf5c6 Merge pull request #1427 from General-Beck/patch-6
Update Ubuntu-jit Dockerfile
2016-06-24 21:52:35 +02:00
Denis S. Soldatov aka General-Beck
a109a4a72b Update Ubuntu-jit Dockerfile
Update Ubuntu-jit Dockerfile
[ci skip]
2016-06-25 02:03:36 +07:00
Denis S. Soldatov aka General-Beck
102626f2c2 Update Ubuntu Dockerfile
Update Ubuntu Dockerfile
[ci skip]
2016-06-25 01:57:29 +07:00
Denis S. Soldatov aka General-Beck
8cc349bcb0 Update Dockerfile
Update CentOS Dockerfile
[ci skip]
2016-06-25 00:59:03 +07:00
Arkadiy Paronyan
3c63244c00 Merge pull request #1418 from ethcore/newblocknumber
Update SF blocknumber to 1800000.
2016-06-24 17:50:03 +02:00
Arkadiy Paronyan
a9b757a75c Update install-parity.sh 2016-06-24 17:27:43 +02:00
Arkadiy Paronyan
92bc21ba9c Update README.md 2016-06-24 17:04:40 +02:00
Arkadiy Paronyan
879bee994d Merge pull request #1420 from ethcore/pdb-exe-artifact
(BETA) add artifacts
2016-06-24 16:53:13 +02:00
NikVolf
a6f7957042 add artifacts 2016-06-24 17:48:42 +03:00
arkpar
2785d61e75 Merge branch 'newblocknumber' of github.com:ethcore/parity into beta 2016-06-24 16:34:26 +02:00
arkpar
8b49b315d9 Merge branch 'master' of github.com:ethcore/parity into beta 2016-06-24 16:34:17 +02:00
Arkadiy Paronyan
313d9048bf Merge pull request #1417 from ethcore/ui
Signer enabled by default for UI
2016-06-24 16:31:14 +02:00
Arkadiy Paronyan
29e2ba91a7 Merge pull request #1415 from ethcore/removebadpruningoptions
Remove experimental pruning options.
2016-06-24 16:16:48 +02:00
Gav Wood
bf11fb6633 Fix up selection. 2016-06-24 16:12:15 +02:00
arkpar
3e7edb2665 More cases 2016-06-24 14:29:15 +02:00
Gav Wood
60d259c9d5 Update SF blocknumber to 1800000. 2016-06-24 14:20:50 +02:00
arkpar
568dc90769 Signer enabled by default for UI 2016-06-24 14:20:39 +02:00
Arkadiy Paronyan
b9649c0e78 Merge pull request #1414 from ethcore/uifix
Fixing interface and port for parity ui
2016-06-24 14:08:06 +02:00
Arkadiy Paronyan
4e0d6f735a Merge pull request #1405 from ethcore/sfedgecase
Configurable gas limit cap.
2016-06-24 13:36:40 +02:00
Gav Wood
44d6e1f443 Remove experimental pruning options. 2016-06-24 13:32:43 +02:00
Arkadiy Paronyan
031a91ebc6 Merge pull request #1413 from ethcore/dapps-bump
Bumping TopBar, Minimal SignerUI and wallet
2016-06-24 13:00:29 +02:00
Tomasz Drwięga
4ece68349c Fixing sync doctests 2016-06-24 12:41:48 +02:00
Tomasz Drwięga
653a368783 Changing macos impl 2016-06-24 12:30:54 +02:00
Tomasz Drwięga
566bb030ec Fixing detecting if dapps are off 2016-06-24 12:21:21 +02:00
Tomasz Drwięga
23732fa516 Fixing interface and port for parity ui 2016-06-24 12:10:36 +02:00
Gav Wood
84ce5af2b0 max/min incorrect 2016-06-24 11:40:25 +02:00
Tomasz Drwięga
e3e10335f9 Bumping TopBar, Minimal SignerUI and wallet 2016-06-24 11:26:04 +02:00
Nikolay Volf
54fc5a533b Merge pull request #1411 from ethcore/sync
Sync: Update highest block for progress reporting
2016-06-24 12:21:01 +03:00
Tomasz Drwięga
dc7c53d59a Fixing json tests 2016-06-24 10:57:44 +02:00
Tomasz Drwięga
34c89e5841 fixing json_tests 2016-06-24 10:49:13 +02:00
arkpar
84ded6f43c Merge branch 'master' of github.com:ethcore/parity into beta 2016-06-24 09:16:49 +02:00
arkpar
e77cce66a1 Update highest block progress 2016-06-23 22:40:44 +02:00
Tomasz Drwięga
6edb981bfa Merge branch 'master' into miner-no-default
Conflicts:
	sync/src/lib.rs
2016-06-23 21:18:43 +02:00
Arkadiy Paronyan
416781a8d4 Tweaked cli options (#1407) 2016-06-23 18:57:42 +02:00
Nikolay Volf
27b18df3dd further rocksdb tuning (#1409) 2016-06-23 18:56:43 +02:00
Nikolay Volf
1d31cee524 Merge pull request #1406 from ethcore/jit
Fixing jit compilation
2016-06-23 18:32:14 +03:00
Tomasz Drwięga
19585947a5 Fixing jit compilation 2016-06-23 14:46:33 +02:00
Gav Wood
bca9e1f31a Merge branch 'master' into sfedgecase 2016-06-23 14:43:42 +02:00
Gav Wood
41e0769e63 Fix tests, 2016-06-23 14:43:20 +02:00
Gav Wood
8fcec20398 Gas limit ceiling option. 2016-06-23 14:29:16 +02:00
Robert Habermeier
082294fe81 Merge pull request #1403 from ethcore/bump-clippy
Bump clippy
2016-06-23 14:23:46 +02:00
Arkadiy Paronyan
f3486c48ea Merge pull request #1401 from ethcore/sfedgecase
Shortcut SF condition when canon known
2016-06-23 13:08:30 +02:00
Robert Habermeier
fb7ca8539e Merge pull request #1402 from ethcore/txqueue-assert
Additional assertions for internal state of queue
2016-06-23 12:52:56 +02:00
Tomasz Drwięga
5bf906625b Fixing warnings 2016-06-23 12:19:38 +02:00
Gav Wood
129ce97ad5 Constants for SF# and update. 2016-06-23 11:30:48 +02:00
Gav Wood
4f39fb2551 Merge branch 'master' into sfedgecase 2016-06-23 11:19:19 +02:00
keorn
be8f922b3f Replace deprecated hashdb trait names (#1394)
* replace deprecated hashdb method names

* spaces -> tabs
2016-06-23 11:16:11 +02:00
Tomasz Drwięga
a76e3a134f Bumping clippy 2016-06-23 10:54:25 +02:00
Robert Habermeier
9ac30ad409 Merge pull request #1400 from ethcore/ipc-rpc-api-fix
rpc api by default for ipc
2016-06-23 10:32:25 +02:00
Gav Wood
8a867262ad Build fix. 2016-06-23 02:42:56 +02:00
Gav Wood
fc9ceb9131 Merge branch 'master' into sfedgecase 2016-06-22 21:38:56 +02:00
Gav Wood
1602906b56 Shortcut SF condition when canon known 2016-06-22 21:37:29 +02:00
Gav Wood
230c6c889a Ensure judging the SF trigger by relative branch (#1399)
Rather than just the canon chain.
2016-06-22 21:33:10 +02:00
Tomasz Drwięga
9a1e1b7c89 Signer with Unlocked Account (#1398) 2016-06-22 21:32:26 +02:00
Gav Wood
e346cbc7f9 Make --signer default. (#1392) 2016-06-22 21:32:17 +02:00
Arkadiy Paronyan
cb9b1e2ad5 Merge pull request #1376 from ethcore/presale_wallet
Presale wallet
2016-06-22 20:14:35 +02:00
Tomasz Drwięga
d53306382d Removing signer connection limit (#1396) 2016-06-22 19:52:18 +02:00
NikVolf
cc7038383a rpc api by default for ipc 2016-06-22 20:51:36 +03:00
Gav Wood
5302a7dd58 Ensure judging the SF trigger by relative branch
Rather than just the canon chain.
2016-06-22 19:49:07 +02:00
debris
9547324b46 ethstore cli loads passwords from files 2016-06-22 17:02:58 +02:00
debris
927ffa7e9c Merge branch 'master' into presale_wallet 2016-06-22 16:14:02 +02:00
arkpar
eafc1b153d Merge branch 'master' of github.com:ethcore/parity into beta 2016-06-22 16:01:16 +02:00
Robert Habermeier
f947a9cb71 Optional gas price in transactions come from statistics (#1388)
* use gas price statistics for default transaction gas price

* create new signing queue client properly

* replace one more usage of sensible_gas_price

* fill_optional_fields as a free function

* keep test client alive
2016-06-22 15:55:07 +02:00
Marek Kotewicz
78cc5a6ed1 Update README.md (#1389) 2016-06-22 15:53:39 +02:00
Tomasz Drwięga
bc1f603e0c Fixing overflow during multiplication (#1381) 2016-06-22 15:37:41 +02:00
Gav Wood
353b9e91e6 Update SF to latest spec (#1386)
* Introduce whitelist for softfork

* Use extradata for fork id.

* Fix condition.
2016-06-22 15:37:25 +02:00
arkpar
53b0862096 Set version to beta 2016-06-22 12:19:49 +02:00
Arkadiy Paronyan
11314a660d Sync optimization (#1385)
* Minor sync fixes

* Fixed session count sub

* handle NewBlock when downloading

* Accept new blocks right away

* block collection update fixed
2016-06-22 12:10:26 +02:00
Tomasz Drwięga
e2de1987c7 Fixing order of if statements to avoid overflows. (#1384)
* Removing old transactions

* Explanation comment [ci skip]
2016-06-22 11:15:22 +02:00
Tomasz Drwięga
e7d96484a1 New topbar & signer UI (#1383) 2016-06-22 11:14:00 +02:00
Arkadiy Paronyan
7c94b1495e Merge pull request #1329 from ethcore/softforktrigger
Install trigger for DAO-rescue soft-fork.
2016-06-21 22:25:24 +02:00
Arkadiy Paronyan
0e9ffff8ea Merge pull request #1375 from ethcore/rocksdb-flush-limit
Rocksdb flush/compact limit
2016-06-21 22:24:57 +02:00
Arkadiy Paronyan
1646a82ecc Merge pull request #1377 from General-Beck/patch-3
CentOS Dockerfile
2016-06-21 21:08:35 +02:00
Denis S. Soldatov aka General-Beck
b82b44bc1a Create Dockerfile
Dockerfile to build parity for CentOS
2016-06-22 02:05:10 +07:00
Arkadiy Paronyan
0ba9782bb2 Merge pull request #1371 from ethcore/txcount-rpc
RPC method to return number of unconfirmed transactions...
2016-06-21 20:07:30 +02:00
debris
bbe5cd001a presale wallet cli for parity 2016-06-21 17:50:22 +02:00
Arkadiy Paronyan
6e4ddde005 Merge pull request #1369 from rphmeier/update-rpc-http
bump jsonrpc-http-server
2016-06-21 17:41:49 +02:00
Arkadiy Paronyan
613d4c95f6 Merge pull request #1364 from ethcore/miner-lock
Fix lock order when updating sealing
2016-06-21 17:41:44 +02:00
Tomasz Drwięga
fe09d8d291 Merge branch 'master' into txqueue-assert
Conflicts:
	ethcore/src/miner/transaction_queue.rs
2016-06-21 16:35:18 +02:00
NikVolf
de079ebe31 Merge branch 'master' into rocksdb-flush-limit 2016-06-21 17:32:07 +03:00
NikVolf
9132895d0e limit flush rate 2016-06-21 17:20:47 +03:00
Arkadiy Paronyan
b2891fcdda Update sealing on new transactions (#1365) 2016-06-21 16:00:34 +02:00
Arkadiy Paronyan
bca4e23df6 Fixed panic on aborted connection (#1370) 2016-06-21 15:56:00 +02:00
arkpar
3aaf938add Fixed build 2016-06-21 15:24:17 +02:00
debris
94a0193047 Merge branch 'master' of github.com:ethcore/parity into presale_wallet 2016-06-21 15:19:31 +02:00
Tomasz Drwięga
a8bc86151e Merge branch 'master' into txcount-rpc
Conflicts:
	rpc/src/v1/tests/mocked/ethcore.rs
2016-06-21 15:13:41 +02:00
debris
7136cd7057 improved import wallet test 2016-06-21 15:07:15 +02:00
debris
be03a6acbd import-wallet option for ethstore executable 2016-06-21 15:04:36 +02:00
Tomasz Drwięga
7cfb9a2b0b RPC for number of unconfirmed transactions 2016-06-21 14:57:35 +02:00
Marek Kotewicz
57e9ed3f08 importing presale wallet (#1368)
* importing presale wallet in progress

* PresaleWallet data structure
2016-06-21 14:42:27 +02:00
Gav Wood
840f961dc2 don't bother assigning queue. 2016-06-21 14:34:22 +02:00
Nikolay Volf
c5f6250668 Set default database file size large enough (#1363)
* make default 100mb file size

* update again

* fix type

* little less extreme file sizes
2016-06-21 13:57:06 +02:00
Robert Habermeier
951512f9c9 Reserved peers rpc API (#1360)
* reserved peers: lock them, use a hashset, and provide to networkcontext

* adding and removing reserved peer service API

* add NonReservedPeerMode, and setters in host

* setting non reserved mode, restriction accepted connections

* implement RPC apis

* fix deadlock

* fix rpc tests
2016-06-21 13:56:33 +02:00
Robert Habermeier
878298f061 bump jsonrpc-http-server 2016-06-21 13:56:06 +02:00
Tomasz Drwięga
e0b4eab819 Fixing replacing transaction with lower gas_price in one of the edge cases (#1343) 2016-06-21 13:55:26 +02:00
debris
a8a731ba11 PresaleWallet data structure 2016-06-21 13:30:32 +02:00
Gav Wood
70db48961a Fix up flag struct. 2016-06-21 13:18:07 +02:00
debris
c2ffa90478 importing presale wallet in progress 2016-06-21 13:11:32 +02:00
Tomasz Drwięga
3de482a431 Additional assertions for internal state of queue 2016-06-21 12:31:50 +02:00
Robert Habermeier
06ba7e258e Merge pull request #1362 from ethcore/fix_migration
fixed migration of empty pruning dir
2016-06-21 12:21:31 +02:00
Gav Wood
d2057a3f72 Make names slightly less contentious. 2016-06-21 11:30:30 +02:00
arkpar
b667378820 Release lock while pushing transactions 2016-06-21 11:26:43 +02:00
NikVolf
d42f8eac1e little less extreme file sizes 2016-06-21 12:07:07 +03:00
arkpar
c912bb8c17 Fix lock order 2016-06-20 23:48:47 +02:00
Arkadiy Paronyan
f58e211b11 Merge pull request #1335 from ethcore/tx_perf
Transaction processing queue
2016-06-20 23:47:35 +02:00
Arkadiy Paronyan
7e424d2713 Merge pull request #1359 from ethcore/lastnonce-fix
Fixing last nonce values in case transaction is replaced
2016-06-20 23:03:09 +02:00
debris
7aa73f300a fixed migration of empty pruning dir 2016-06-20 22:35:59 +02:00
NikVolf
1f599ac6f9 fix type 2016-06-20 23:01:09 +03:00
NikVolf
f4f842f48e update again 2016-06-20 22:52:31 +03:00
NikVolf
d874555310 make default 100mb file size 2016-06-20 22:45:24 +03:00
Arkadiy Paronyan
05583c2cd7 Merge pull request #1358 from ethcore/no_docopt_deps
docopt is an optional dependency of ethkey and ethstore
2016-06-20 21:37:52 +02:00
Arkadiy Paronyan
855ae91c4c Merge pull request #1354 from ethcore/warnings-fix
Fixing clippy warnings
2016-06-20 21:21:51 +02:00
Arkadiy Paronyan
5705ecf95f Merge pull request #1357 from ethcore/sync
Reduce locking when syncing
2016-06-20 21:21:47 +02:00
Tomasz Drwięga
beedbd5126 Merge pull request #1356 from ethcore/clean_parity_start
removed unnecessary logs
2016-06-20 21:15:32 +02:00
Gav Wood
72debeebcf Update code hash. 2016-06-20 20:47:07 +02:00
Tomasz Drwięga
69c29fce84 Updating parity-dapps (#1353) 2016-06-20 18:51:36 +02:00
Marek Kotewicz
71bfda3534 moved keystore tests files from util to ethstore (#1352) 2016-06-20 18:51:11 +02:00
arkpar
09b8116cde TX processing queue 2016-06-20 18:42:50 +02:00
Tomasz Drwięga
8fa9a240cc Fixing last nonce values in case transaction is replaced 2016-06-20 18:37:59 +02:00
debris
0716eaa036 docopt is an optional dependency of ethkey and ethstore 2016-06-20 17:50:38 +02:00
Arkadiy Paronyan
38b9264de6 Merge pull request #1351 from ethcore/removed_bigint_deps
removed redundant bigint deps
2016-06-20 17:36:33 +02:00
Arkadiy Paronyan
5f7bdc028d Merge pull request #1350 from ethcore/revert-1349-revert-1347-reserved-peers
Reopen "reserved peers and reserved-only flag"
2016-06-20 17:29:39 +02:00
Arkadiy Paronyan
8b845e56da Merge pull request #1348 from ethcore/db-cache-size
Configurable rocksdb cache size
2016-06-20 17:29:18 +02:00
arkpar
1ffe0c185c Reduce locking 2016-06-20 17:28:48 +02:00
debris
7b9db37d84 removed unnecessary logs 2016-06-20 16:29:04 +02:00
Marek Kotewicz
75a38500f1 Merge pull request #1346 from ethcore/txqueue-future
Fixing future order and errors when reaching limit.
2016-06-20 15:31:39 +02:00
Marek Kotewicz
e9900be6ea Merge pull request #1342 from ethcore/txqueue-local-noprio
Removing priority on local transactions
2016-06-20 15:31:06 +02:00
Tomasz Drwięga
da7b30628b Fixing warnings 2016-06-20 15:20:55 +02:00
debris
71c49eaaa2 removed redundant bigint deps 2016-06-20 14:19:02 +02:00
Robert Habermeier
7a6fa97d98 Revert "Revert "Reserved peers, reserved-only flag"" 2016-06-20 14:13:33 +02:00
Robert Habermeier
b05c218338 Merge pull request #1349 from ethcore/revert-1347-reserved-peers
Revert "Reserved peers, reserved-only flag"
2016-06-20 14:10:30 +02:00
Robert Habermeier
3d3041d418 Revert "Reserved peers, reserved-only flag" 2016-06-20 14:09:41 +02:00
Arkadiy Paronyan
f5682737d3 Merge pull request #1345 from ethcore/sync-bodies
Sync attack defense: Deactivate peers on invalid block bodies
2016-06-20 14:03:53 +02:00
Marek Kotewicz
a6713467a7 Merge pull request #1347 from rphmeier/reserved-peers
Reserved peers, reserved-only flag
2016-06-20 14:03:47 +02:00
Marek Kotewicz
09253ef19c Merge pull request #1341 from ethcore/new_libs_integration
CI for ethkey and ethstore
2016-06-20 14:01:12 +02:00
Nikolay Volf
c6616431b0 fix tests 2016-06-20 14:20:13 +03:00
Nikolay Volf
deb20c6249 fix docopt 2016-06-20 14:02:09 +03:00
Arkadiy Paronyan
e97f62e33c Merge pull request #1340 from ethcore/sync
Fixed empty block body composition
2016-06-20 12:57:29 +02:00
Arkadiy Paronyan
a4b35180d1 Merge pull request #1334 from ethcore/givetoken
Provide a signer UI token by default.
2016-06-20 12:53:42 +02:00
Robert Habermeier
8d61c0298c indentation fix
[ci skip]
2016-06-20 12:48:00 +02:00
Nikolay Volf
7e452ab2e0 configurable cache size 2016-06-20 13:42:04 +03:00
Robert Habermeier
06a3557e3e reserved_only CLI flag 2016-06-20 12:17:06 +02:00
Tomasz Drwięga
c348508b40 Fixing future order and drops because of limit errors 2016-06-20 12:14:19 +02:00
debris
1bad0783fe ethkey and ethstore added to hook.sh 2016-06-20 11:37:37 +02:00
Tomasz Drwięga
edd43cd5c3 Fixing local transactions prioritization 2016-06-20 11:32:29 +02:00
Arkadiy Paronyan
18c35a031b Merge pull request #1344 from ethcore/docker_rustup
docker uses rustup, fixes #1337
2016-06-20 11:17:30 +02:00
arkpar
5e9c8db4c9 Deactivate peers on invalid block bodies 2016-06-20 11:07:22 +02:00
debris
7393de94f7 docker uses rustup, fixes #1337 2016-06-20 11:02:31 +02:00
arkpar
1dd87a39f5 Fixed tests 2016-06-20 10:44:15 +02:00
Tomasz Drwięga
d0b2df07db Removing priority on local transactions 2016-06-20 10:32:52 +02:00
Marek Kotewicz
3bf67486ae Merge pull request #1339 from ethcore/net-dispose
Fixed network service dispose
2016-06-20 10:30:02 +02:00
Tomasz Drwięga
a2f24a0083 Removing Default from Miner 2016-06-20 10:28:38 +02:00
debris
91acb22bd4 updated .travis.yml 2016-06-20 10:18:53 +02:00
debris
ca35f116a6 added new libraries: ethkey and ethstore to cov.sh, doc.sh and test.sh 2016-06-20 10:13:14 +02:00
debris
03cd1c0494 added license headers to ethkey and ethstore 2016-06-20 10:06:49 +02:00
debris
074311d95b Updated ethkey to the latest version 2016-06-20 10:02:02 +02:00
arkpar
6d435d038f Fixed empty block body composition 2016-06-20 01:26:40 +02:00
arkpar
4b3f23f0ac Fixed network service dispose 2016-06-20 01:16:15 +02:00
Arkadiy Paronyan
bf6308312e Sync: Cache last sync round block parents (#1331)
* Cache last sync round block parents

* Limit incoming transactions and new hashes
2016-06-20 00:40:11 +02:00
Gav Wood
3ee3171b8c Merge branch 'master' into softforktrigger 2016-06-20 00:37:40 +02:00
Marek Kotewicz
6b074e8fb2 secret store separated from util (#1304)
* bump rust-crypto

* initial version of account provider utilizing secret store

* update lazy_static to latest version

* AccountProvider accounts method

* new AccountProvider tests in progress

* basic tests for new AccountProvider

* ethcore compiles with new account provider and secret store

* ethcore-rpc build now compiling with new AccountProvider

* most rpc tests passing with new accounts_provider

* fixed basic_authority tests

* fixed eth_transaction_count rpc test

* fixed mocked/eth.rs tests

* fixed personal tests

* fixed personal signer rpc tests

* removed warnings

* parity compiling fine with new sstore

* fixed import direction

* do not unlock temporarily when we have the password

* removed TODO in account import

* display warning on auto account import failure

* fixed compiling of ethstore on windows

* ethstore as a part of parity repo

* added ethkey
2016-06-20 00:10:34 +02:00
Robert Habermeier
ab4561b5bc fix compilation errors 2016-06-19 21:34:02 +02:00
Robert Habermeier
2ea45134ab prefer pinned nodes when establishing peer connections. 2016-06-19 20:58:02 +02:00
Robert Habermeier
d8fca91a2f add daoRescueSoftFork to failing rpc and json tests 2016-06-19 17:12:14 +02:00
Robert Habermeier
a4dacca262 CLI option and network configuration 2016-06-19 15:59:12 +02:00
Gav Wood
08522eec37 --geth prevent getTransactionReceipt from using pending. (#1325)
This mimics the fucntionality of Geth and the current unratified
JSONRPC spec (but not the functionality of eth and the ratified
spec).
2016-06-19 14:51:51 +02:00
Gav Wood
5ceb1b084c Add missing args and some new JSONs for testing. 2016-06-19 14:49:06 +02:00
Gav Wood
2245baaaab Provide CLI options to disable aspects of soft-fork.
Soft-fork will remain default behaviour, but you can now disable
either the whole mechanism (you'll lose money if you mine with this
when the majority network doesn't) or just vote against it but
otherwise go with the flow.
2016-06-19 13:20:14 +02:00
Tomasz Drwięga
8fad728e9b Fixing locks order (#1328) 2016-06-19 12:33:50 +02:00
Gav Wood
7430cf72e2 Minor typo. 2016-06-19 12:29:39 +02:00
Gav Wood
46d588dcae CLI option and colour. 2016-06-19 12:28:24 +02:00
debris
026bfd6741 fixed incomplete merge 2016-06-19 02:09:17 +02:00
Gav Wood
bff1c5bdcb Merge branch 'master' into softforktrigger 2016-06-18 20:55:50 +02:00
Gav Wood
d915eae7f7 Remove comment. 2016-06-18 20:54:44 +02:00
Gav Wood
2582253f95 Install trigger for DAO-rescue soft-fork.
Soft-fork should only be primed to trigger if the gas-limit of
block #1760000 is at most 4,000,000.

To accomplish this we pass in the gas limit of that block to
EnvInfo so it can inform Schedule. This gets marshalled through
`OpenBlock`/`ClosedBlock` and the `enact` functions much like
`last_hashes`. `block.rs`'s `env_info()` takes care to ensure
that if the current block happens to be #1760000, then we
populate with the current `gas_limit`.
2016-06-18 20:26:44 +02:00
Marek Kotewicz
3617923d3c Merge pull request #1324 from ethcore/renamefield
Update default gas limit, rename field
2016-06-18 20:22:05 +02:00
Edward Wang
2b65011706 Use constants for DatabaseConfig (#1318)
Closes #1157
2016-06-18 17:58:28 +02:00
Gav Wood
47cd9ff34c Remove code no longer in master :-S 2016-06-18 15:18:36 +02:00
Gav Wood
7208f9f95c Unsaved file. Duh. 2016-06-18 15:12:13 +02:00
Tomasz Drwięga
81df97a737 Fixing warnings (#1321) 2016-06-18 15:11:10 +02:00
Tomasz Drwięga
c1c64bedc2 Bumping topbar. Fixing ws server closing when suspending (#1312)
* More meaningful errors when sending transaction

* Fixing returned value

* Consolidating all RPC error codes

* Fixed loosing peers on incoming connections. (#1293)

* Deactivate peer if it has no new data

* Fixed node table timer registration

* Fixed handshake timeout expiration

* Extra trace

* Fixed session count calculation

* Only deactivate incapable peers in ChainHead state

* Timer registration is not needed

* x64 path

* firewall rules

* Fix read-ahead bug.

Re-ahead 8 bytes rather than 3 to ensure large blocks import fine.

* Refactor to use a const.

* Update README.md

* Gas price statistics. (#1291)

* Gas price statistics.

Affects eth_gasPrice.
Added ethcore_gasPriceStatistics.

Closes #1265

* Fix a bug in eth_gasPrice

* Fix tests.

* Revert minor alteration.

* Tests for gas_price_statistics.

- Tests;
- Additional infrastructure for generating test blocks with
transactions.

* Key load avoid warning (#1303)

* avoid warning with key

* fix intendations

* more intendation fix

* ok() instead of expect()

* Appveyor config for windows build+installer (#1302)

* appveyor

* proper dist name

* quote

* win-build config

* proper build section

* tests in release

* plugin dir

* cache binaries

* quotes

* escaped quotes

* forces user dir

* fixes

* syntax

* proper cahce dir

* quotes?

* root nsis instead of bin

* submodules init

* artifact path fix

* no submodule

* raw link here

* another way to force cargo cache

* include vc++ 2015 redist

* fix name of the dist

* ETHCORE -> Ethcore

* Bumping topbar. Fixing ws server closing when suspending
2016-06-18 15:10:36 +02:00
Arkadiy Paronyan
ec654feaf8 Syncing fix (#1320)
* Fixed aborting peer for expired session

* Don't ban for usesless
2016-06-18 15:10:24 +02:00
Gav Wood
d416e5d9bc Merge branch 'master' into renamefield 2016-06-18 15:05:43 +02:00
Gav Wood
22e390f922 Rename block_dao -> reject_dao. 2016-06-18 15:00:12 +02:00
Gav Wood
c9f8eff92d Change CLI default for gas floor target. 2016-06-18 14:59:52 +02:00
Tomasz Drwięga
5e1e3ce857 Filling-in optional fields of TransactionRequest... (#1305)
* More meaningful errors when sending transaction

* Fixing returned value

* Consolidating all RPC error codes

* Fixed loosing peers on incoming connections. (#1293)

* Deactivate peer if it has no new data

* Fixed node table timer registration

* Fixed handshake timeout expiration

* Extra trace

* Fixed session count calculation

* Only deactivate incapable peers in ChainHead state

* Timer registration is not needed

* x64 path

* firewall rules

* Fix read-ahead bug.

Re-ahead 8 bytes rather than 3 to ensure large blocks import fine.

* Refactor to use a const.

* Update README.md

* Gas price statistics. (#1291)

* Gas price statistics.

Affects eth_gasPrice.
Added ethcore_gasPriceStatistics.

Closes #1265

* Fix a bug in eth_gasPrice

* Fix tests.

* Revert minor alteration.

* Tests for gas_price_statistics.

- Tests;
- Additional infrastructure for generating test blocks with
transactions.

* Key load avoid warning (#1303)

* avoid warning with key

* fix intendations

* more intendation fix

* ok() instead of expect()

* Filling-in optional fields of TransactionRequest.

* Adding reference to miner
2016-06-18 14:55:46 +02:00
Tomasz Drwięga
91dc31fd70 Removing Maker and DAO dapps (#1319) 2016-06-18 13:08:55 +02:00
Tomasz Drwięga
e957565144 Disabling ethcore_set* APIs by default (+ Status page update) (#1315)
* More meaningful errors when sending transaction

* Fixing returned value

* Consolidating all RPC error codes

* Fixed loosing peers on incoming connections. (#1293)

* Deactivate peer if it has no new data

* Fixed node table timer registration

* Fixed handshake timeout expiration

* Extra trace

* Fixed session count calculation

* Only deactivate incapable peers in ChainHead state

* Timer registration is not needed

* x64 path

* firewall rules

* Fix read-ahead bug.

Re-ahead 8 bytes rather than 3 to ensure large blocks import fine.

* Refactor to use a const.

* Update README.md

* Gas price statistics. (#1291)

* Gas price statistics.

Affects eth_gasPrice.
Added ethcore_gasPriceStatistics.

Closes #1265

* Fix a bug in eth_gasPrice

* Fix tests.

* Revert minor alteration.

* Tests for gas_price_statistics.

- Tests;
- Additional infrastructure for generating test blocks with
transactions.

* Key load avoid warning (#1303)

* avoid warning with key

* fix intendations

* more intendation fix

* ok() instead of expect()

* Appveyor config for windows build+installer (#1302)

* appveyor

* proper dist name

* quote

* win-build config

* proper build section

* tests in release

* plugin dir

* cache binaries

* quotes

* escaped quotes

* forces user dir

* fixes

* syntax

* proper cahce dir

* quotes?

* root nsis instead of bin

* submodules init

* artifact path fix

* no submodule

* raw link here

* another way to force cargo cache

* include vc++ 2015 redist

* fix name of the dist

* ETHCORE -> Ethcore

* Disabling ethcore_set* APIs (+ Status page)
2016-06-18 12:33:45 +02:00
Marek Kotewicz
75a7cf2860 fixed #1180 (#1282) 2016-06-18 12:09:29 +02:00
Arkadiy Paronyan
591fa9625d Merge pull request #1313 from ethcore/net
Network start/stop
2016-06-18 11:04:24 +02:00
Gav Wood
42478add64 DAO Rescue soft fork (#1309)
* DAO Rescue soft fork

* Address minor issues.

* Fix tests.
2016-06-18 10:54:15 +02:00
Nikolay Volf
76b413b5f7 Appveyor config for windows build+installer (#1302)
* appveyor

* proper dist name

* quote

* win-build config

* proper build section

* tests in release

* plugin dir

* cache binaries

* quotes

* escaped quotes

* forces user dir

* fixes

* syntax

* proper cahce dir

* quotes?

* root nsis instead of bin

* submodules init

* artifact path fix

* no submodule

* raw link here

* another way to force cargo cache

* include vc++ 2015 redist

* fix name of the dist

* ETHCORE -> Ethcore
2016-06-18 10:54:15 +02:00
Nikolay Volf
b4aae6bd9c Key load avoid warning (#1303)
* avoid warning with key

* fix intendations

* more intendation fix

* ok() instead of expect()
2016-06-18 10:54:15 +02:00
Tomasz Drwięga
1baa150086 Consolidating all RPC error codes 2016-06-18 10:54:15 +02:00
Tomasz Drwięga
defe688797 Fixing returned value 2016-06-18 10:54:15 +02:00
Tomasz Drwięga
2c9a5fc0a9 More meaningful errors when sending transaction 2016-06-18 10:54:12 +02:00
Gav Wood
335bce85e8 Gas price statistics. (#1291)
* Gas price statistics.

Affects eth_gasPrice.
Added ethcore_gasPriceStatistics.

Closes #1265

* Fix a bug in eth_gasPrice

* Fix tests.

* Revert minor alteration.

* Tests for gas_price_statistics.

- Tests;
- Additional infrastructure for generating test blocks with
transactions.
2016-06-18 10:52:50 +02:00
Arkadiy Paronyan
6026dd3657 Update README.md 2016-06-18 10:52:50 +02:00
Gav Wood
d6701065ea Refactor to use a const. 2016-06-18 10:52:50 +02:00
Gav Wood
da058d0e86 Fix read-ahead bug.
Re-ahead 8 bytes rather than 3 to ensure large blocks import fine.
2016-06-18 10:52:50 +02:00
NikVolf
232274546b firewall rules 2016-06-18 10:52:50 +02:00
NikVolf
55fec2dcc3 x64 path 2016-06-18 10:52:50 +02:00
Arkadiy Paronyan
29e286572c Fixed loosing peers on incoming connections. (#1293)
* Deactivate peer if it has no new data

* Fixed node table timer registration

* Fixed handshake timeout expiration

* Extra trace

* Fixed session count calculation

* Only deactivate incapable peers in ChainHead state

* Timer registration is not needed
2016-06-18 10:52:46 +02:00
arkpar
3f77f7ce1f Removed RPC methods 2016-06-18 09:50:05 +02:00
Gav Wood
16412eb0c9 DAO Rescue soft fork (#1309)
* DAO Rescue soft fork

* Address minor issues.

* Fix tests.
2016-06-17 22:15:18 +02:00
arkpar
fc60ed92e6 Removed info 2016-06-17 18:28:19 +02:00
arkpar
c340d8a34f Tests 2016-06-17 18:26:54 +02:00
arkpar
67ffac1df9 Check for session expiration on peer registration 2016-06-17 16:01:33 +02:00
arkpar
b38488dd07 Network shutdown 2016-06-17 12:58:28 +02:00
Nikolay Volf
2a101baf1d Appveyor config for windows build+installer (#1302)
* appveyor

* proper dist name

* quote

* win-build config

* proper build section

* tests in release

* plugin dir

* cache binaries

* quotes

* escaped quotes

* forces user dir

* fixes

* syntax

* proper cahce dir

* quotes?

* root nsis instead of bin

* submodules init

* artifact path fix

* no submodule

* raw link here

* another way to force cargo cache

* include vc++ 2015 redist

* fix name of the dist

* ETHCORE -> Ethcore
2016-06-16 17:02:55 +02:00
Nikolay Volf
07641b8f0a Key load avoid warning (#1303)
* avoid warning with key

* fix intendations

* more intendation fix

* ok() instead of expect()
2016-06-16 14:14:22 +02:00
Nikolay Volf
10bbe8c8a2 Merge pull request #1290 from ethcore/send-tx-errors
More meaningful errors when sending transaction
2016-06-16 15:27:21 +04:00
Gav Wood
88b03580ff Gas price statistics. (#1291)
* Gas price statistics.

Affects eth_gasPrice.
Added ethcore_gasPriceStatistics.

Closes #1265

* Fix a bug in eth_gasPrice

* Fix tests.

* Revert minor alteration.

* Tests for gas_price_statistics.

- Tests;
- Additional infrastructure for generating test blocks with
transactions.
2016-06-16 12:44:08 +02:00
Arkadiy Paronyan
1e9da1e0fa Update README.md 2016-06-16 11:21:35 +02:00
Nikolay Volf
5a0d367e0b Merge pull request #1298 from ethcore/fiximport
Fix read-ahead bug.
2016-06-16 13:17:13 +04:00
Gav Wood
80e56cb8d7 Refactor to use a const. 2016-06-15 23:12:43 +02:00
Gav Wood
9603597da7 Fix read-ahead bug.
Re-ahead 8 bytes rather than 3 to ensure large blocks import fine.
2016-06-15 21:31:19 +02:00
Marek Kotewicz
77c3e10b6a Merge pull request #1297 from ethcore/nsis-firewall
firewall rules for windows installer
2016-06-15 21:12:48 +02:00
NikVolf
7649037e51 firewall rules 2016-06-15 21:40:41 +03:00
Arkadiy Paronyan
87e9ca7517 Merge pull request #1296 from ethcore/nsis-path
x64 program files path for installer
2016-06-15 19:53:52 +02:00
NikVolf
5538527016 x64 path 2016-06-15 20:52:00 +03:00
Arkadiy Paronyan
7284df9bf5 Fixed loosing peers on incoming connections. (#1293)
* Deactivate peer if it has no new data

* Fixed node table timer registration

* Fixed handshake timeout expiration

* Extra trace

* Fixed session count calculation

* Only deactivate incapable peers in ChainHead state

* Timer registration is not needed
2016-06-15 19:01:58 +02:00
Tomasz Drwięga
6803375301 Consolidating all RPC error codes 2016-06-15 18:32:21 +02:00
Tomasz Drwięga
dcd64f73d4 Merge branch 'master' into send-tx-errors 2016-06-15 18:27:56 +02:00
Marek Kotewicz
549647b6f2 fixed #1261, overflow when calculating work (#1283)
* fixed #1261, overflow when calculating work

* tests for difficulty_to_boundary

* return !U256::zer() for boundary <= 1
2016-06-15 16:33:38 +02:00
Robert Habermeier
6b852a0635 Merge pull request #1287 from rphmeier/update_readme
clarify build instructions
2016-06-15 12:48:54 +02:00
Robert Habermeier
2527130831 indentation (renders the same)
[ci skip]
2016-06-15 12:46:02 +02:00
Robert Habermeier
3d86d099bb remove either/or commands, keep it simple
[ci skip]
2016-06-15 12:22:36 +02:00
Marek Kotewicz
0f1e2f5d2f Merge pull request #1280 from ethcore/1255
fixed #1255
2016-06-15 11:39:39 +02:00
Tomasz Drwięga
818b87e311 Fixing returned value 2016-06-15 09:01:57 +02:00
Marek Kotewicz
79bd168267 bump rust-crypto (#1289) 2016-06-15 01:27:47 +02:00
Gav Wood
be6c572449 Update eth.rs 2016-06-15 01:26:58 +02:00
Robert Habermeier
44ed899fb3 address comments
[ci skip]
2016-06-15 01:16:16 +02:00
debris
dac387fac1 changed rpc error message to Still Syncing, when mining is not ready 2016-06-15 01:12:46 +02:00
Arkadiy Paronyan
71131c41e5 Security audit issues fixed (#1279)
* Restrict network key file permissions

* Check for overflow in str to bigint conversion

* RLP decoder overflow check
2016-06-15 00:58:08 +02:00
Tomasz Drwięga
b562480173 Fixing origin/host validation (#1273) 2016-06-15 00:57:49 +02:00
Tomasz Drwięga
b89888eda1 Merge branch 'master' into send-tx-errors
Conflicts:
	Cargo.lock
2016-06-15 00:30:54 +02:00
Tomasz Drwięga
efa8f661e5 More meaningful errors when sending transaction 2016-06-15 00:17:23 +02:00
Arkadiy Paronyan
f7536876d5 Merge pull request #1284 from ethcore/win-nsis
windows installer + parity start ui cli option
2016-06-14 23:33:30 +02:00
Arkadiy Paronyan
aeae4670f1 Merge pull request #1285 from ethcore/ipc-bump
ipc lib version bump
2016-06-14 23:29:08 +02:00
Robert Habermeier
58948c53ff clarify windows instructions
[ci skip]
2016-06-14 19:37:51 +02:00
Nikolay Volf
f5cc3db4da fixes with buffered writes 2016-06-14 20:12:42 +03:00
Nikolay Volf
7b89d6a263 bump further 2016-06-14 18:45:12 +03:00
Nikolay Volf
a26a4edc85 version bump 2016-06-14 18:37:04 +03:00
Nikolay Volf
91bb6c5d43 final fix 2016-06-14 18:26:40 +03:00
NikVolf
37260d7cf5 fix build and remove .cargo regs 2016-06-14 18:16:41 +03:00
NikVolf
8ced25b36c remove some comments from sample 2016-06-14 18:12:41 +03:00
NikVolf
39e2f6c891 cfg attrs 2016-06-14 17:37:01 +03:00
NikVolf
5920a7068f installer initial, ui option for executable 2016-06-14 17:12:46 +03:00
debris
7610d308e8 fixed #1255 2016-06-14 15:17:17 +02:00
Arkadiy Paronyan
a03da30510 Merge pull request #1274 from ethcore/sync
Syncing improvements
2016-06-14 15:01:31 +02:00
arkpar
65d42d6a5a Fixed valid response condition 2016-06-14 13:25:06 +02:00
NikVolf
b3caeee758 Merge branch 'master' of github.com:ethcore/parity 2016-06-14 14:18:31 +03:00
Marek Kotewicz
9940432051 Merge pull request #1270 from ethcore/redundant_if_condition
removed redundant if condition
2016-06-14 04:06:08 -07:00
Tomasz Drwięga
dbddb6a566 Fixing generating new token while another parity instance is running. (#1272) 2016-06-14 12:23:01 +02:00
arkpar
9ed2122ae2 Style + comments 2016-06-14 12:18:20 +02:00
arkpar
5c019b74e4 Validate header response 2016-06-14 11:30:51 +02:00
debris
0b8710a2a1 removed redundant if condition 2016-06-14 03:04:06 +02:00
Marek Kotewicz
ca33f7c18d Merge pull request #1266 from ethcore/arkpar-patch-1
README: rustup and windows instructions
2016-06-13 12:44:22 -07:00
arkpar
1dac2e3b23 Fixed NewHashes response 2016-06-13 20:57:15 +02:00
arkpar
8c7bcdafdb Continue reading session data in the same iteration if available 2016-06-13 20:57:04 +02:00
arkpar
925869d462 Fix returning non-canonical headers 2016-06-13 20:56:55 +02:00
arkpar
bee3669e9b Deactivate peers giving us invalid/empty headers 2016-06-13 20:56:44 +02:00
Arkadiy Paronyan
4c812169d1 Update README.md 2016-06-13 20:26:17 +02:00
Arkadiy Paronyan
f5efd444f5 rustup and windows instructions 2016-06-13 19:22:54 +02:00
Arkadiy Paronyan
6b12334136 Windows build (#1253)
* Networking refactoring

* Fixed typo

* Trace logging

* Updated dependencies for windows build

* Windows fixes

* use mio 0.5

* nix build

* Windows build fix

* style

* removed unused import

* ipc crate version bump

* ipc config for named pipes

* tweaks and fixes

* tweaks and fixes

* final version bump

* Fixed tests

* Disable color output on windows

* Added missing doc
2016-06-13 18:55:24 +02:00
Marek Kotewicz
4ef4819bf9 removed try_seal from MinerClient interface (#1262) 2016-06-13 18:51:14 +02:00
Marek Kotewicz
a8831fe896 Merge pull request #1232 from ethcore/simplified_block_opening
simplified block opening
2016-06-13 06:56:24 -07:00
debris
12a76597d4 Merge branch 'master' into simplified_block_opening 2016-06-13 15:11:14 +02:00
Arkadiy Paronyan
b33482ce74 Merge pull request #1259 from ethcore/clippy-bump
Clippy bump
2016-06-13 11:57:07 +02:00
Arkadiy Paronyan
b1849bd1ad Merge pull request #1258 from ethcore/uint-fix
Fixing uint ASM macros compilation
2016-06-13 11:57:01 +02:00
Arkadiy Paronyan
7064624b6f Merge pull request #1252 from ethcore/dapps-bump
Signer port returned from RPC + Topbar showing count of unconfirmed transactions.
2016-06-12 12:02:48 +02:00
Arkadiy Paronyan
7f9e8d0b48 Merge pull request #1250 from ethcore/codegen-unwraps
codegen - avoid unwraps leading to compilation crash
2016-06-12 12:02:26 +02:00
Arkadiy Paronyan
070aae6562 Merge pull request #1257 from ethcore/dapps-bump2
Dapps bump
2016-06-12 12:02:02 +02:00
Tomasz Drwięga
fca22e92ce Bumping clippy 2016-06-12 11:26:07 +02:00
Tomasz Drwięga
9260d44362 Fixing uint ASM macros 2016-06-12 10:30:44 +02:00
Tomasz Drwięga
c2b226ec57 Dapps bump 2016-06-12 10:23:16 +02:00
NikVolf
833dc16040 cargo dev config to gitignore 2016-06-11 12:21:12 +03:00
Tomasz Drwięga
6d9baef12c Bumping minimal sysui [ci skip] 2016-06-10 15:59:03 +02:00
Tomasz Drwięga
89a77149bf Removing clone 2016-06-10 15:48:22 +02:00
Tomasz Drwięga
e5e238746b Bumping sysui & topbar. personal_signerEnabled returns port 2016-06-10 15:39:34 +02:00
Tomasz Drwięga
036b324804 Bumping dapps 2016-06-10 15:23:18 +02:00
Arkadiy Paronyan
3e7d8bf1a8 Merge pull request #1236 from rphmeier/hash_unsafety
remove unsafety from util/hash.rs and util/bigint/uint.rs
2016-06-10 14:11:36 +02:00
Arkadiy Paronyan
e633cd2f75 Merge pull request #1247 from ethcore/rpc-cors-fix
Fixing CORS settings for special values: * & null.
2016-06-10 14:09:10 +02:00
Nikolay Volf
383b7a3cab avoid unwraps 2016-06-10 09:56:13 +03:00
debris
2a92e10fcd Merge branch 'master' of github.com:ethcore/parity into simplified_block_opening 2016-06-09 11:09:12 -07:00
Tomasz Drwięga
d54d3a2c60 Fixing match 2016-06-09 15:19:48 +02:00
Nikolay Volf
6e7828fa71 Merge pull request #1246 from ethcore/jsonsertests
JSONRPC test strings avoid using \ char
2016-06-09 15:48:44 +04:00
Tomasz Drwięga
2e52c99042 Fixing CORS settings 2016-06-09 10:02:52 +02:00
Gav Wood
c6369a4ae7 Merge branch 'master' into jsonsertests 2016-06-08 12:46:34 -07:00
Gav Wood
2e56fbad2c Use nicer strings for tests. 2016-06-08 12:41:29 -07:00
Gav Wood
293d9f15d5 Tests for JSON serialisation of statediff/vmtrace (#1241)
* Splitting RPC Apis into more fine-grained sets

* Remove old code/comment.

* Add test for VMTrace ser.

* Add StateDiff ser test.
2016-06-08 12:40:55 -07:00
Marek Kotewicz
a72ee5c16a Merge pull request #1245 from ethcore/updating-topbar
Bumping Dapps & TopBar to newest version.
2016-06-08 21:29:49 +02:00
Tomasz Drwięga
cfaa0389e1 Bumping dapps 2016-06-08 17:27:21 +02:00
Gav Wood
becf1d7b28 Merge branch 'master' into jsonsertests 2016-06-08 06:18:44 -07:00
Nikolay Volf
b4b883b341 keys import (#1240)
* pattern importing

* tests for import

* cli options for account import

* [options] for import also

* removed globbing

* removed glob crate refs
2016-06-08 06:17:37 -07:00
Tomasz Drwięga
be435cde99 Splitting RPC Apis into more fine-grained sets (#1234) 2016-06-07 13:52:48 -07:00
Gav Wood
c5d8f5e136 Add StateDiff ser test. 2016-06-07 12:44:57 -07:00
Gav Wood
446c9096f4 Add test for VMTrace ser. 2016-06-07 12:30:44 -07:00
Gav Wood
5397da0c93 Remove old code/comment. 2016-06-07 12:30:35 -07:00
Robert Habermeier
13968aaa38 Refactor triedb constructors to error on invalid state root (#1230)
* add TrieError, refactor Trie DB creation

* remove Result type alias due to glob import conflicts

* fix fallout in state.rs

* add debug, display impl for TrieError

* fix fallout in account.rs

* ethcore::Error::TrieError variant

* fix remaining fallout in ethcore crate

* added From<TrieError> impl for Error, removed map_err calls

* fix test breakages

* fix doc tests

* update docs

[ci skip]
2016-06-07 11:44:09 -07:00
Gav Wood
2abe8cc5dd Merge branch 'master' into apis-split 2016-06-07 10:42:09 -07:00
Tomasz Drwięga
fdc22db3f4 Signer RPC method to check if signer is enabled (#1238)
* API to check if signer is enabled

* Fixing compilation warnings
2016-06-07 10:33:32 -07:00
Tomasz Drwięga
bf9173e673 Fixing signer behaviour when confirming transaction with wrong password. (#1237)
* Avoid removing transactions when trying to confirm and the password is invalid

* Fix order
2016-06-07 08:25:01 -07:00
Tomasz Drwięga
f61ee1a5f1 SystemUIs authorization (#1233)
* Initial implementation of AuthCodeStore for SystemUIs

* SystemUIs authorization

* Renaming SystemUI -> SignerUI

* Fixing clippy warnings

* Lowering time threshold

* Bumping sysui

* Fixing test
2016-06-07 08:21:19 -07:00
Nikolay Volf
e6d141e14f fixed path for testnet config (#1231) 2016-06-07 08:14:03 -07:00
Robert Habermeier
5168a1c851 remove some unsafety from uint.rs 2016-06-07 16:42:07 +02:00
Robert Habermeier
db869fcdd1 remove unnecessary reference 2016-06-07 16:18:50 +02:00
Robert Habermeier
e46c9f67ab remove outdated comments 2016-06-07 16:16:23 +02:00
Robert Habermeier
482fe3b211 fixed indentation 2016-06-07 16:11:34 +02:00
Robert Habermeier
9ae93d6962 remove unsafety from util/hash.rs 2016-06-07 16:04:26 +02:00
Nikolay Volf
ef39eed12f Merge pull request #1225 from ethcore/serdestatediff
StateDiff and VMTrace uses serde preprocessor.
2016-06-07 15:06:50 +04:00
Tomasz Drwięga
62e37aef8f Splitting RPC Apis into more fine-grained sets 2016-06-07 13:01:37 +02:00
Gav Wood
3db2328f52 Merge branch 'txtracingforcall' into serdestatediff 2016-06-06 19:24:07 -07:00
Gav Wood
4efd658577 Merge branch 'master' into txtracingforcall 2016-06-06 19:19:32 -07:00
Gav Wood
0cb1affd48 Use serialize framework for VMTrace JSON. 2016-06-06 15:18:38 -07:00
Nikolay Volf
e408b7ac99 Merge pull request #1227 from ethcore/warnings
Removing compilation warnings
2016-06-07 00:33:33 +04:00
Robert Habermeier
b4899f4d47 Merge pull request #1226 from ethcore/signer-auth
Allowing connections only from chrome-extension and self-hosted client
2016-06-06 17:36:36 +02:00
debris
79919bdc3c simplified block opening 2016-06-06 14:34:23 +02:00
Tomasz Drwięga
18ffd94674 Fixing warnings 2016-06-06 12:18:17 +02:00
Tomasz Drwięga
1dae61f22f Merge branch 'master' into signer-auth 2016-06-06 12:12:38 +02:00
Tomasz Drwięga
302126ebcf Allowing connections only from chrome-extension and self-hosted client 2016-06-06 12:03:01 +02:00
Arkadiy Paronyan
98d9752097 Merge pull request #1219 from ethcore/clippy-bump
Clippy bump & fixing warnings
2016-06-06 11:46:59 +02:00
Marek Kotewicz
b93c83b8a0 Merge pull request #1216 from ethcore/serde-bump
Bumping serde & syntex
2016-06-06 11:32:13 +02:00
Marek Kotewicz
54c20f6f9c Merge pull request #1211 from ethcore/signer-ui
Minimal Signer UI (System UI) exposed over websockets.
2016-06-06 11:31:45 +02:00
Marek Kotewicz
a460813788 Merge pull request #1208 from ethcore/switchrpcns
Switch RPC namespace form ethcore_ to trace_
2016-06-06 11:30:36 +02:00
Marek Kotewicz
ba8c7bc959 Merge pull request #1217 from rphmeier/state_at_state_root
Verify the state root exists before creating a State
2016-06-06 11:29:39 +02:00
Tomasz Drwięga
a7de430193 Merge branch 'master' into clippy-bump
Conflicts:
	dapps/Cargo.toml
2016-06-06 10:13:42 +02:00
Tomasz Drwięga
67b9e08ff0 Ignoring tests 2016-06-06 10:13:01 +02:00
Tomasz Drwięga
a063a63ac7 Merge branch 'master' into serde-bump
Conflicts:
	ethcore/src/types/state_diff.rs
2016-06-06 10:10:06 +02:00
Tomasz Drwięga
9572f6e5fc Merge branch 'master' into signer-ui 2016-06-06 10:06:48 +02:00
Gav Wood
1fa8f108d9 StateDiff uses serde preprocessor. 2016-06-06 00:24:21 +02:00
Robert Habermeier
64b74eae43 fix travis build 2016-06-05 23:50:27 +02:00
Robert Habermeier
3dff5a9f3f add early exit for pruned blocks 2016-06-05 22:14:40 +02:00
Robert Habermeier
e6921144dc simplify conditional in state_at 2016-06-05 22:05:01 +02:00
Gav Wood
f775606c37 Merge branch 'switchrpcns' into txtracingforcall 2016-06-05 21:38:11 +02:00
Gav Wood
bbd024d646 Merge branch 'master' into switchrpcns 2016-06-05 21:37:56 +02:00
Gav Wood
4675b7408f Merge branch 'switchrpcns' into txtracingforcall 2016-06-05 21:35:58 +02:00
Marek Kotewicz
c8c47ebe32 Merge pull request #1206 from ethcore/diffing
Integrate state diffing into the ethcore JSONRPC
2016-06-05 21:35:36 +02:00
Gav Wood
ec61c7534c Merge branch 'diffing' into switchrpcns 2016-06-05 21:35:03 +02:00
Gav Wood
d39b9506d2 Minor code refactor. 2016-06-05 18:24:17 +02:00
Gav Wood
4153052148 Fix fn call in miner.rs same as client.rs. 2016-06-05 17:23:27 +02:00
Tomasz Drwięga
d5048967e2 Updating topbar to latest version (#1220) 2016-06-03 17:52:39 +02:00
Robert Habermeier
aa465fa2cd conditional style fix 2016-06-03 12:15:27 +02:00
Robert Habermeier
6f850ebdac does_pruning -> is_pruned 2016-06-03 12:10:10 +02:00
Gav Wood
4dc9aedfb5 Merge branch 'master' into txtracingforcall 2016-06-03 12:06:39 +02:00
Tomasz Drwięga
bb1b8cc08a Loading local Dapps from FS. (#1214)
* apps list to separate module

* Preparing to support serving files from disk

* Serving files from disk

* Using dapps path from CLI

* Adding more docs
2016-06-03 11:51:11 +02:00
Tomasz Drwięga
3905717d5d Fixing warnings 2016-06-03 11:36:30 +02:00
Tomasz Drwięga
ae2deaaf72 Bumping clippy version 2016-06-03 11:15:38 +02:00
Robert Habermeier
1e10445f82 exists -> contains 2016-06-02 21:23:43 +02:00
Robert Habermeier
6c6229c963 check if state root is valid for old blocks 2016-06-02 20:52:21 +02:00
Robert Habermeier
d7b79c1274 don't return a state in state_at if the db prunes and the block is before guaranteed history 2016-06-02 20:34:38 +02:00
Tomasz Drwięga
3ba15f6c64 Updating httpserver and core 2016-06-02 20:32:48 +02:00
Tomasz Drwięga
8752a60018 Merge branch 'serde-bump' of github.com:ethcore/parity into serde-bump
Conflicts:
	Cargo.lock
	dapps/Cargo.toml
	rpc/Cargo.toml
	signer/src/lib.rs
2016-06-02 20:28:23 +02:00
Tomasz Drwięga
3e2479cf40 Merge branch 'master' into signer-ui 2016-06-02 20:00:25 +02:00
Nikolay Volf
81d8dafd9e Ipc serialization & protocol fixes (#1188)
* serialization and codegen fixes from branch

* nano lib fixes

* fixes error encoding & comment

* another comment fix

* client timeout -> const
2016-06-02 19:04:42 +02:00
Robert Habermeier
0318bb9fe9 Have Ext::ret take self by value (#1187)
* refactor externalities::ret to take self by-value, add GasLeft enum, and alter evm::Result.

* remove unused imports, StopExecutionWithGasLeft variant

* adjust tests

* remove extraneous call to reserve

* update json_tests Ext to match new trait

* adjust executive json_test

* have evms own their memory for their entire lifetime

* make finalize API more friendly

* indentation fix

[ci skip]
2016-06-02 19:04:15 +02:00
Tomasz Drwięga
18dac64abb Simple WebSockets notification about new request (#1202)
* Splitting methods requiring signing into separate trait

* Single place where RPC apis are created.

* Separating eth_filter

* Separating eth_signing

* Stubs for Personal Signer methods

* Test for EthSigningQueueClient

* TransactionConfirmation API

* Exposing PersonalSigner API

* Defining ApiSets dependent on context

* Removing types

* Supporting sending notification to WS connected SystemUIs

* Sending a notification on every new messages

* Adding logs to signing queue

* Shutting down broadcaster

* Refactoring the signing queue

* Fixing wait loop in case of spurious wake-ups.
2016-06-02 17:05:13 +02:00
Gav Wood
f357274ced Merge branch 'master' into txtracingforcall 2016-06-02 16:44:11 +02:00
Gav Wood
7dc05f1bcc Unify tracing interface into a single call. 2016-06-02 16:30:28 +02:00
Tomasz Drwięga
35753f22f7 Removing leftovers of ethminer (#1207) 2016-06-02 15:58:21 +02:00
Nikolay Volf
c3404c9b59 Merge pull request #1205 from ethcore/fixed_1204
fixed #1204
2016-06-02 14:06:08 +02:00
Gav Wood
a132fefcc7 Transaction tracing for eth_call. 2016-06-02 13:50:50 +02:00
Tomasz Drwięga
cce18cb4c5 Enabling DAOdapp 2016-06-02 13:34:26 +02:00
Tomasz Drwięga
79a60e157b Merge branch 'signer-wsnotification' into signer-ui 2016-06-02 13:25:38 +02:00
Tomasz Drwięga
ee3f608204 Fixing wait loop in case of spurious wake-ups. 2016-06-02 13:19:44 +02:00
Gav Wood
c202abe09d Switch RPC namespace form ethcore_ to trace_ 2016-06-02 13:14:49 +02:00
Tomasz Drwięga
d40504caa5 Merge branch 'signer-wsnotification' into signer-ui 2016-06-02 13:09:11 +02:00
Tomasz Drwięga
77942c0b48 Merge branch 'master' into signer-wsnotification 2016-06-02 13:02:10 +02:00
Gav Wood
4c44994807 Merge branch 'master' into diffing 2016-06-02 12:44:38 +02:00
debris
9a626c84bc fixed #1204 2016-06-02 12:44:05 +02:00
Gav Wood
29e18cfc4d Merge branch 'vmtracing' 2016-06-02 12:43:14 +02:00
Gav Wood
401bdca153 Merge branch 'master' of github.com:ethcore/parity 2016-06-02 12:42:16 +02:00
Gav Wood
b17581d7de VM tracing and JSON RPC endpoint for it. (#1169)
* Groundwork for basic VM tracing.

* RPC endpoint for VM tracing and ser/de types ready.

* Create VMTracer trait.

* Rearchitected VM tracing to reflect existing tracing.

Should more or less work now.

* Integrated VM tracing into JSONRPC.

* Fix ethcore module tests.

* Add tests for VM tracing.

* Fix consensus test code.

* Fix mock tests.

* Added VM trace information for post-execution stuff.

* Fix max-value calls and add "creates" field to getTransaction.

* Tests for VM tracing.

* Don't implement the trait with unimplemented.

* Remove invlaid comment.

* Fix tests.
2016-06-02 12:40:31 +02:00
Gav Wood
b9ec87548d Minor renaming diff -> state_diff 2016-06-02 12:39:25 +02:00
Gav Wood
bc5c3da2af Merge branch 'vmtracing' into diffing 2016-06-02 12:28:09 +02:00
Tomasz Drwięga
716c9bb43c Merge branch 'master' into signer-wsnotification
Conflicts:
	rpc/src/v1/impls/mod.rs
2016-06-02 12:22:52 +02:00
Tomasz Drwięga
e9bcce05a1 Refactoring the signing queue 2016-06-02 12:17:28 +02:00
Nikolay Volf
7ad9c73c75 devtools helpers extended (#1186)
* devtools extensions

* some doc effort
2016-06-02 11:51:03 +02:00
Arkadiy Paronyan
8596a347ea Networking refactoring (#1172)
* Networking refactoring

* Make sure the same socket is reused

* Safer atomic ordering

* Replaced eq with ==
2016-06-02 11:49:56 +02:00
Gav Wood
d40a038f37 Fix tests. 2016-06-02 11:49:27 +02:00
Gav Wood
26da38a439 Merge remote-tracking branch 'origin/master' into vmtracing 2016-06-02 11:40:39 +02:00
Robert Habermeier
e170916563 Merge pull request #1195 from ethcore/client-refact
Client & Miner refactoring
2016-06-01 20:54:19 +02:00
Tomasz Drwięga
5f68b81f68 Updating jsonrpc-core 2016-06-01 20:32:16 +02:00
Tomasz Drwięga
89deaef809 Merge branch 'signer-wsnotification' into signer-ui 2016-06-01 20:13:36 +02:00
Nikolay Volf
626acda6a3 fix warnings 2016-06-01 20:11:05 +02:00
Robert Habermeier
b7ada4dee0 update readme (#1201)
* update readme

[ci skip]

* minor fixes

* mention dapps server.

[ci skip]
2016-06-01 20:10:51 +02:00
Gav Wood
5c63311268 Add missing types. 2016-06-01 20:02:23 +02:00
Tomasz Drwięga
555555e6f7 Merge branch 'master' into signer-wsnotification
Conflicts:
	parity/signer.rs
	rpc/src/v1/helpers/signing_queue.rs
	rpc/src/v1/impls/eth_signing.rs
	rpc/src/v1/impls/personal_signer.rs
	signer/src/ws_server/mod.rs
2016-06-01 20:00:43 +02:00
Nikolay Volf
c370bcaded merge fixes 2016-06-01 19:57:34 +02:00
Nikolay Volf
6676c6cf7e Merge branch 'master' into client-refact 2016-06-01 19:42:32 +02:00
Tomasz Drwięga
99e26b8480 Simple signing queue, confirmation APIs exposed in signer WebSockets. (#1182)
* Splitting methods requiring signing into separate trait

* Single place where RPC apis are created.

* Separating eth_filter

* Separating eth_signing

* Stubs for Personal Signer methods

* Test for EthSigningQueueClient

* TransactionConfirmation API

* Exposing PersonalSigner API

* Defining ApiSets dependent on context

* Removing types

* Fixing default impl

* Fixing un-mocked tests

* Update signing_queue.rs

[ci skip]

* Removing unused import [ci skip]
2016-06-01 19:37:34 +02:00
Tomasz Drwięga
a7a2b55362 Using ethcore http server 2016-06-01 19:32:05 +02:00
Tomasz Drwięga
d601e11d59 Removing typeS 2016-06-01 19:05:27 +02:00
Tomasz Drwięga
4742860b2e Using ethcore http server 2016-06-01 18:00:40 +02:00
Tomasz Drwięga
1fd9110829 Serde bump 2016-06-01 17:59:21 +02:00
Robert Habermeier
b9b0ce8d65 Merge pull request #1199 from ethcore/ordered-dapps
Using ordered hashmap to keep the order of dapps on home screen
2016-06-01 16:19:00 +02:00
Nikolay Volf
1ef4db82e8 doctest fixes 2016-06-01 14:50:06 +02:00
Tomasz Drwięga
ae572cb8f5 Using ordered hashmap to keep the order of dapps on home screen 2016-06-01 13:25:20 +02:00
Marek Kotewicz
ee77fc3bc3 Merge pull request #1197 from ethcore/x-frame
Disabling `ethcore` by default, adding x-frame-options header to dapps.
2016-06-01 13:20:46 +02:00
Nikolay Volf
985d412c48 fix merges again 2016-06-01 13:03:26 +02:00
Nikolay Volf
c00b84e10b merge fixes 2016-06-01 12:54:47 +02:00
Nikolay Volf
0c782bf34b Merge branch 'master' into client-refact 2016-06-01 12:45:04 +02:00
Arkadiy Paronyan
f41466c8b5 Merge pull request #1196 from rphmeier/rpc-tests
transaction count verifier tests
2016-06-01 12:44:51 +02:00
Nikolay Volf
db749dc564 fix remaining tests & doctest 2016-06-01 12:44:11 +02:00
Arkadiy Paronyan
e743972102 Merge pull request #1192 from rphmeier/x_macros
expunge x! and xx! from the codebase
2016-06-01 12:43:15 +02:00
Nikolay Volf
cee31f9e8d fix travis 2016-06-01 03:19:20 +02:00
Nikolay Volf
d45a676dc0 all tests fixed 2016-05-31 22:24:32 +02:00
Tomasz Drwięga
67421fc69e Adding explanatory comment for safe_to_embed 2016-05-31 21:56:41 +02:00
Tomasz Drwięga
ae1bcd6a5b Disabling ethcore APIs for RPC and IPC 2016-05-31 21:53:20 +02:00
Robert Habermeier
5fd4b9d7bd formatting fix 2016-05-31 21:50:25 +02:00
Nikolay Volf
dad61bb7cf test and travis fix for absent crate 2016-05-31 21:40:26 +02:00
Tomasz Drwięga
9957328607 DENY frames from other origins to prevent clickjacking 2016-05-31 21:39:11 +02:00
Nikolay Volf
c33b1caf21 executable all issues resolved 2016-05-31 21:38:07 +02:00
Robert Habermeier
bbb858b386 address small syntax breakages 2016-05-31 21:38:05 +02:00
Nikolay Volf
77cef76518 rpc bindings resolved 2016-05-31 21:31:42 +02:00
Robert Habermeier
4146e1f02b add empty rule to map macros 2016-05-31 21:18:54 +02:00
Nikolay Volf
2a08fb8fe3 and conditional dispatch 2016-05-31 21:17:46 +02:00
Nikolay Volf
495e7feb62 dispatching message return 2016-05-31 21:13:32 +02:00
Gav Wood
34edecd59d State diffing, exposed through JSONRPC. 2016-05-31 21:03:44 +02:00
Robert Habermeier
ec7af964ab correct map macro invocation 2016-05-31 21:01:47 +02:00
Nikolay Volf
10d914d6c6 restored chain_new_blocks 2016-05-31 20:58:33 +02:00
Nikolay Volf
f5ed31792f fixed sync with client only 2016-05-31 20:54:02 +02:00
Nikolay Volf
a845e08bc6 rename of the trait 2016-05-31 20:33:26 +02:00
Tomasz Drwięga
ed0d60bc16 Fixing clippy warnings 2016-05-31 20:21:46 +02:00
Tomasz Drwięga
4d29508b4c Minimal System UI 2016-05-31 20:12:47 +02:00
Nikolay Volf
8e252d5f1b refactored to merge client & client 2016-05-31 19:52:53 +02:00
Robert Habermeier
c81e4e24b3 add ability to have heavy tests 2016-05-31 19:51:24 +02:00
Robert Habermeier
4ccaabde40 add transaction count verifier tests 2016-05-31 19:30:40 +02:00
Nikolay Volf
4f732972bc refactoring to hold miner within the client 2016-05-31 19:01:37 +02:00
Robert Habermeier
da9d6bf8d5 rename [hash_]mapx to [hash_]map_into 2016-05-31 17:29:01 +02:00
Robert Habermeier
c62bfcddef finish purging x! from parity, remove x! and xx! macros 2016-05-31 17:25:25 +02:00
Robert Habermeier
3abaeadcf3 finish purging x! from ethcore 2016-05-31 17:18:21 +02:00
Nikolay Volf
3dd642abe9 Merge pull request #1185 from ethcore/ipc-fixes
Database service upgrade (from the ipc branch)
2016-05-31 17:00:07 +02:00
Robert Habermeier
ff7c755930 mostly purge x! from ethcore 2016-05-31 16:59:01 +02:00
Nikolay Volf
0cd8644292 split interfaces 2016-05-31 16:41:15 +02:00
Robert Habermeier
3788b3a149 expunge x! from util 2016-05-31 16:40:48 +02:00
Robert Habermeier
b729a381f8 rewrite map macros not to use an intermediate allocation 2016-05-31 16:29:53 +02:00
Robert Habermeier
5cb58c4269 use Miner in rpc tests, remove chain_harness 2016-05-31 15:25:14 +02:00
Robert Habermeier
266b4eedaa correct locked_account_secret docs 2016-05-31 15:25:14 +02:00
Robert Habermeier
1465b0d34c refactor Miner to not wrap accounts in an RwLock, and to take a generalized AccountProvider 2016-05-31 15:25:14 +02:00
Nikolay Volf
a944638b5e version lock 2016-05-31 13:17:45 +02:00
Nikolay Volf
1d5f407a29 database & write que import 2016-05-31 13:08:15 +02:00
Nikolay Volf
134f48cdfb lib import 2016-05-31 13:05:43 +02:00
Nikolay Volf
d0b32f8d42 trait import from branch 2016-05-31 13:02:53 +02:00
Gav Wood
2d604324b9 Merge branch 'vmtracing' into diffing 2016-05-31 13:00:47 +02:00
Gav Wood
f9a0cc47a0 Enable PoD sutff. 2016-05-31 12:59:00 +02:00
Gav Wood
12547ecd37 Remove invlaid comment. 2016-05-31 12:58:47 +02:00
Gav Wood
1fdb1de218 Don't implement the trait with unimplemented. 2016-05-31 12:58:10 +02:00
Gav Wood
649767b911 Merge remote-tracking branch 'origin/master' into vmtracing 2016-05-31 12:05:23 +02:00
Gav Wood
5766354c19 Tests for VM tracing. 2016-05-31 12:04:53 +02:00
Tomasz Drwięga
d49152c8b0 Merge branch 'master' into signer-wsnotification 2016-05-31 11:41:03 +02:00
Robert Habermeier
b036f1de98 stop eth_syncing from returning true forever (#1181) 2016-05-31 10:31:36 +02:00
Arkadiy Paronyan
6d25e7f8b4 Merge pull request #1164 from ethcore/sync
Sync fixes and tweaks
2016-05-30 22:29:29 +02:00
Gav Wood
8082fdb3ff Fix max-value calls and add "creates" field to getTransaction. 2016-05-30 22:27:28 +02:00
Tomasz Drwięga
70cecb49b0 Merge branch 'signer-signing' into signer-wsnotification
Conflicts:
	rpc/src/v1/impls/mod.rs
	signer/src/lib.rs
2016-05-30 22:06:27 +02:00
Tomasz Drwięga
fb5efa2ffc Merge branch 'master' into signer-signing
Conflicts:
	rpc/src/v1/impls/eth.rs
	rpc/src/v1/tests/mocked/eth.rs
	rpc/src/v1/traits/eth.rs
2016-05-30 21:46:37 +02:00
Marek Kotewicz
43348c1629 Merge pull request #1167 from ethcore/signer-rpc
Exposing RPC over Signer WebSockets
2016-05-30 21:31:20 +02:00
Tomasz Drwięga
baa2f7c5bb Shutting down broadcaster 2016-05-30 20:39:20 +02:00
Tomasz Drwięga
b4bc395c6e Adding logs to signing queue 2016-05-30 20:23:19 +02:00
Tomasz Drwięga
84882922b4 Sending a notification on every new messages 2016-05-30 19:30:16 +02:00
Tomasz Drwięga
ba296408d5 Supporting sending notification to WS connected SystemUIs 2016-05-30 18:50:11 +02:00
Nikolay Volf
13e5c19be7 Merge pull request #1171 from rphmeier/rpc-unimplemented
implement missing rpc methods and tests
2016-05-30 18:15:24 +02:00
Arkadiy Paronyan
68e62030d5 Merge pull request #1170 from ethcore/ipc-server-bump
json ipc server version bump
2016-05-30 18:11:52 +02:00
Gav Wood
79503e4f14 Added VM trace information for post-execution stuff. 2016-05-30 17:19:15 +02:00
Arkadiy Paronyan
e037f32408 Merge pull request #1173 from ethcore/deps
Updated dependencies for windows build
2016-05-30 16:21:27 +02:00
arkpar
76bb0729ba Updated dependencies for windows build 2016-05-30 15:38:23 +02:00
Robert Habermeier
16432129b5 move transaction import error warning into miner implementation 2016-05-30 13:14:32 +02:00
Robert Habermeier
ea26deaab1 mocked test for eth_syncing 2016-05-30 12:33:49 +02:00
Gav Wood
11f4e8cb73 Fix mock tests. 2016-05-30 11:53:20 +02:00
Robert Habermeier
bbe6a287f8 add mocked test for eth_coinbase 2016-05-29 17:18:37 +02:00
Robert Habermeier
89659606dd add mocked test for eth_sendRawTransaction 2016-05-29 17:07:39 +02:00
Robert Habermeier
be1ec93271 implement eth_sign 2016-05-29 15:46:57 +02:00
Robert Habermeier
7cea3eb5ed move rpc_unimplemented into impls module 2016-05-29 15:21:23 +02:00
Robert Habermeier
191bae5cd4 add stubs for missing eth_* rpc methods 2016-05-29 15:21:23 +02:00
Robert Habermeier
fb2ea765d5 remove default implementations using rpc_unimplemented!() 2016-05-29 15:21:23 +02:00
Gav Wood
af05939d74 Fix consensus test code. 2016-05-29 14:01:34 +02:00
Tomasz Drwięga
1176f6acec fixing test 2016-05-29 13:25:31 +02:00
Nikolay Volf
7dfd7e883f another bump 2016-05-29 13:22:45 +02:00
Nikolay Volf
a8cf0ddf50 json ipc server version bump 2016-05-29 13:09:51 +02:00
Gav Wood
22c4298bee Add tests for VM tracing. 2016-05-29 13:05:41 +02:00
Gav Wood
c20eaf98ec Fix ethcore module tests. 2016-05-29 11:37:35 +02:00
Gav Wood
a5808833b1 Merge remote-tracking branch 'origin/master' into vmtracing 2016-05-29 11:13:48 +02:00
Gav Wood
cd16828fef Integrated VM tracing into JSONRPC. 2016-05-29 00:58:52 +02:00
Arkadiy Paronyan
b9f7ed9185 Merge pull request #1141 from rphmeier/rpc-tests
Framework for improved RPC unit tests
2016-05-29 00:50:19 +02:00
arkpar
7f3ba85a3f Fixed block/hashes propagation 2016-05-29 00:38:10 +02:00
Gav Wood
86fdcabd0e Rearchitected VM tracing to reflect existing tracing.
Should more or less work now.
2016-05-28 23:57:16 +02:00
Robert Habermeier
ea08dd76a5 remove all possible unsafe code in crypto (#1168)
* use #[repr(C)] for all hash types

* use a zeroed buffer in crypto::ec::sign

* eliminate most usages of unsafe in crypto::ecdh::agree

* eliminate all possible unsafety in crypto module
2016-05-28 21:48:42 +02:00
Tomasz Drwięga
1ba39538a7 Removing types 2016-05-28 19:50:57 +02:00
Tomasz Drwięga
f339b6a491 Merge branch 'signer-rpc' into signer-signing 2016-05-28 19:40:34 +02:00
Tomasz Drwięga
d74fc2c285 Merge branch 'master' into signer-rpc
Conflicts:
	dapps/src/lib.rs
	parity/main.rs
	parity/signer.rs
	signer/Cargo.toml
	signer/src/lib.rs
2016-05-28 19:36:57 +02:00
Tomasz Drwięga
87d0f09a44 Base for Signer Websockets server (#1158)
* Basic signing queue

* Adding docs

* WebSockets server for signer

* Removing TODO

* Shortening the syntax

* Exposing types from RPC

* Fixing indentation

* Update main.rs
2016-05-28 19:30:31 +02:00
Tomasz Drwięga
d4e66ba52f Defining ApiSets dependent on context 2016-05-28 19:26:01 +02:00
Tomasz Drwięga
1607478405 Merge branch 'signer-rpc' into signer-signing
Conflicts:
	parity/signer.rs
2016-05-28 19:13:04 +02:00
Tomasz Drwięga
50e5c88b7b Fixing compilation 2016-05-28 19:10:17 +02:00
Tomasz Drwięga
30362bfebe Merge branch 'master' into signer-rpc 2016-05-28 19:09:45 +02:00
Tomasz Drwięga
a7dfa83da1 Exposing PersonalSigner API 2016-05-28 19:05:23 +02:00
Tomasz Drwięga
99f9747a3f TransactionConfirmation API 2016-05-28 18:50:00 +02:00
Gav Wood
d4a06b27ed Create VMTracer trait. 2016-05-28 17:50:20 +02:00
Tomasz Drwięga
8c3b56511a Test for EthSigningQueueClient 2016-05-28 17:22:43 +02:00
arkpar
1e8bf8c89d More tweaks 2016-05-28 17:17:10 +02:00
arkpar
0e905a06d9 Tweaked propagation order 2016-05-28 17:17:10 +02:00
arkpar
d1fc5a5611 Tweaked some constansts for slower machines 2016-05-28 17:17:10 +02:00
arkpar
f85e409ff7 Make sure downloaded blocks are unmarked on send error 2016-05-28 17:17:10 +02:00
Tomasz Drwięga
6d5ba59515 Stubs for Personal Signer methods 2016-05-28 17:07:40 +02:00
Gav Wood
c1ed520de0 RPC endpoint for VM tracing and ser/de types ready. 2016-05-28 16:52:33 +02:00
Tomasz Drwięga
f794018e95 Separating eth_signing 2016-05-28 14:32:31 +02:00
Tomasz Drwięga
ffa113511b Separating eth_filter 2016-05-28 14:21:43 +02:00
Tomasz Drwięga
07399d377f Single place where RPC apis are created. 2016-05-28 13:42:53 +02:00
Gav Wood
42e4c2d51c Groundwork for basic VM tracing. 2016-05-27 20:41:29 +02:00
Tomasz Drwięga
129ad0bbcb Splitting methods requiring signing into separate trait 2016-05-27 20:24:46 +02:00
Arkadiy Paronyan
468d761e5c Merge pull request #1163 from ethcore/warnings
Fixing few clippy warnings
2016-05-27 19:06:37 +02:00
Gav Wood
098f9b6ebb Merge branch 'master' of github.com:ethcore/parity 2016-05-27 19:02:19 +02:00
Robert Habermeier
5197ca87ee merge with master 2016-05-27 18:55:01 +02:00
Tomasz Drwięga
20846c11c9 Merge branch 'signer-server' into signer-rpc
Conflicts:
	parity/signer.rs
	signer/Cargo.toml
	signer/src/lib.rs
	signer/src/ws_server/mod.rs
2016-05-27 18:53:01 +02:00
Tomasz Drwięga
f60097ddb6 Merge branch 'master' into signer-server
Conflicts:
	rpc/src/v1/types/bytes.rs
2016-05-27 18:50:47 +02:00
Tomasz Drwięga
6f93ecf1d2 Exposing types from RPC 2016-05-27 18:50:04 +02:00
Marek Kotewicz
325a257f7d Merge pull request #1154 from rphmeier/personal_sign_and_send
Change eth_signAndSendTransaction to personal_SignAndSendTransaction
2016-05-27 18:45:20 +02:00
Robert Habermeier
c021ecd13b move "integration" tests out into main module 2016-05-27 18:40:48 +02:00
Robert Habermeier
9d4cd7b73e assert the transaction is being signed correctly 2016-05-27 18:21:27 +02:00
Robert Habermeier
e7791c220a rebase fixes and address style concern 2016-05-27 18:21:26 +02:00
Robert Habermeier
7ee23240f0 fix travis test build 2016-05-27 18:19:18 +02:00
Robert Habermeier
4c55e4968e add eth_blockNumber, eth_TransactionCount integration tests.
also adds an EthTester struct for more test flexibility.
2016-05-27 18:18:44 +02:00
Robert Habermeier
1de7ea090c add informative comment on transaction::Action 2016-05-27 18:18:44 +02:00
Robert Habermeier
f67486e31f have miner service update the pending nonces on transaction import 2016-05-27 18:18:42 +02:00
Robert Habermeier
688790f13f re-export AccountProvider trait 2016-05-27 18:14:43 +02:00
Robert Habermeier
cf18c4bb0a make MinerService object-safe 2016-05-27 18:14:43 +02:00
Robert Habermeier
d370a86b43 More flexible chain extraction, get_balance test 2016-05-27 18:13:53 +02:00
Robert Habermeier
152bb6f21b create integration test harness for eth RPC API 2016-05-27 18:13:49 +02:00
Robert Habermeier
56b020987e refine tests for call deserialization 2016-05-27 18:09:32 +02:00
Tomasz Drwięga
58039fb420 Fixing few clippy warnings 2016-05-27 17:56:25 +02:00
Tomasz Drwięga
c4e2f65051 Exposing RPC over websockets 2016-05-27 17:55:12 +02:00
Robert Habermeier
b28a8411a4 refactor dispatch_transaction and sign_and_dispatch into impls module
this has the added benefit of allowing the removal of redundant upgrades.
2016-05-27 16:50:25 +02:00
Robert Habermeier
ba600ac06a have parity create the PersonalClient properly 2016-05-27 16:45:26 +02:00
Robert Habermeier
194ca19720 move tests to personal 2016-05-27 16:45:26 +02:00
Robert Habermeier
c9efb56e19 move sign_and_send_transaction implementation to personal 2016-05-27 16:45:26 +02:00
Robert Habermeier
db2efe8485 move signAndSendTransaction to Personal trait. 2016-05-27 16:45:26 +02:00
Arkadiy Paronyan
72031d6f95 Merge pull request #1149 from rphmeier/rpc-earliest-specific
Support "earliest" and specific block parameters in RPC where possible
2016-05-27 16:39:08 +02:00
Robert Habermeier
a272f8570c correct indentation 2016-05-27 16:35:42 +02:00
Robert Habermeier
3f89362630 rename x_latest to latest_x in BlockChainClient 2016-05-27 16:35:42 +02:00
Robert Habermeier
30eee76767 use new nonce function in eth_TransactionCount 2016-05-27 16:35:42 +02:00
Robert Habermeier
c2a4ed6fc4 change nonce, balance, storage_at to *_latest counterparts 2016-05-27 16:35:41 +02:00
Robert Habermeier
a3b1cdb175 add docs for nonce_latest 2016-05-27 16:35:41 +02:00
Robert Habermeier
5afa4621f9 added balance_latest, storage_at_latest utilities
with modus ponens panickers
2016-05-27 16:35:41 +02:00
Robert Habermeier
3c7e4b8c6c added nonce, nonce_latest 2016-05-27 16:35:41 +02:00
Robert Habermeier
86eab79d9d consolidate [balance/storage]_at and _at_id functionality 2016-05-27 16:35:41 +02:00
Robert Habermeier
3405f3eab1 implement storage_at_id 2016-05-27 16:35:41 +02:00
Robert Habermeier
2b7fae8fa6 add state_at_id and balance_at_id, integrate with RPC 2016-05-27 16:35:41 +02:00
Tomasz Drwięga
cf19e38663 Exposing types from RPC 2016-05-27 15:46:07 +02:00
Tomasz Drwięga
d0ae713b29 Shortening the syntax 2016-05-27 13:05:54 +02:00
Tomasz Drwięga
e2db4972be Removing TODO 2016-05-27 13:04:54 +02:00
Tomasz Drwięga
b77fdcdd68 WebSockets server for signer 2016-05-27 13:03:00 +02:00
Tomasz Drwięga
945ebcbf9b Merge branch 'master' into signer-server 2016-05-27 10:53:30 +02:00
Gav Wood
aa9e4af783 Merge branch 'master' of github.com:ethcore/parity 2016-05-27 08:29:28 +02:00
Marek Kotewicz
ca008fb541 migration fixes (#1155)
* dont use system temp for migration, do backup

* fixed issue with number of open files on osx

* fixed compilation of util tests
2016-05-27 08:23:29 +02:00
Robert Habermeier
637f4eeb12 Merge pull request #1150 from ethcore/signer-crate
Empty trusted signer crate with it's general purpose described.
2016-05-26 22:36:09 +02:00
Arkadiy Paronyan
8872558e0d Merge pull request #1153 from ethcore/mordenbootnodes
More bootnodes for morden.
2016-05-26 21:49:09 +02:00
Arkadiy Paronyan
1a1467169d Merge pull request #1151 from rphmeier/move-rpc-tests
move existing rpc tests into mocked module
2016-05-26 21:48:50 +02:00
Robert Habermeier
e0e722784c move existing rpc tests into mocked module 2016-05-26 20:37:08 +02:00
Gav Wood
946ee8f8c4 Merge branch 'master' of github.com:ethcore/parity 2016-05-26 19:37:58 +02:00
Tomasz Drwięga
a7bf13f23f Merge branch 'signer-crate' into signer-server 2016-05-26 19:30:52 +02:00
Tomasz Drwięga
977ad428ae Merge branch 'master' into signer-crate
Conflicts:
	.travis.yml
	Cargo.toml
	cov.sh
	doc.sh
	fmt.sh
	hook.sh
	test.sh
2016-05-26 18:58:25 +02:00
Tomasz Drwięga
a61bf90c17 Adding docs 2016-05-26 18:34:23 +02:00
Marek Kotewicz
7370776af1 Bloomchain (#1014)
* use bloomchain crate in blockchain module. remove obsole chainfilter submodule

* update database version to 6.0

* removed redundant line

* simple db migration

* make migration slightly more functional

* bloomchain migration

* migration version is just a single unsigned integer

* updated migration v6

* parity migration

* db migration

* removed hardcoded migration dir

* replace ptr::copy with clone_from_slice, removed potential endianess problem from trace/db.rs

* removed superfluous line

* blockchains log blooms config is not exposed any more
2016-05-26 18:24:51 +02:00
Tomasz Drwięga
cc1a334ba7 Renaming dapps repos. Updating dapps (#1142)
* Renaming dapps repos. Updating dapps

* Skipping legacy options for compatibility. Fixing tabs

* Fixing CLI options
2016-05-26 18:21:15 +02:00
Gav Wood
33f187eeee Merge branch 'master' of github.com:ethcore/parity 2016-05-26 18:18:07 +02:00
Tomasz Drwięga
28391d2f52 Basic signing queue 2016-05-26 17:46:44 +02:00
Tomasz Drwięga
09d9697985 Fixing docs 2016-05-26 16:49:14 +02:00
Tomasz Drwięga
28545d706f Empty trusted signer crate with it's general purpose 2016-05-26 16:43:04 +02:00
Marek Kotewicz
3a5e7fc2ed Merge pull request #1147 from ethcore/fixed_pending_transactions
fixed pending transactions
2016-05-26 15:53:36 +02:00
Marek Kotewicz
94ec245187 Merge pull request #1148 from ethcore/fixing-warnings
Fixing clippy warnings
2016-05-26 13:44:19 +02:00
debris
6fd9780e60 do not clone pending transaction hashes 2016-05-26 12:44:17 +02:00
Gav Wood
049537e470 Merge branch 'master' of github.com:ethcore/parity 2016-05-26 12:34:45 +02:00
Tomasz Drwięga
5b0c936fee Fixing clippy warnings 2016-05-26 11:49:58 +02:00
debris
f811fdc2cd fixed pending transactions 2016-05-26 11:42:27 +02:00
Arkadiy Paronyan
32298cad6b Merge pull request #1143 from rphmeier/raw-mut-sig
correct signature of SecTrieDB::raw_mut
2016-05-25 23:10:27 +02:00
Robert Habermeier
e24ab5a4f1 correct signature of SecTrieDB::raw_mut
&mut T is invariant over its type parameter, so we need to specify the trait's lifetime explicitly rather than coerce it to the elided lifetime
2016-05-25 17:10:01 +02:00
Tomasz Drwięga
fa6b35ec8d Bumping clippy. Fixing warnings (#1139)
* Bumping clippy. Fixing warnings

* Removing unused import

* Fixing complexity and arguments warning on two functions
2016-05-25 17:03:58 +02:00
Gav Wood
75d0606bc0 More bootnodes for morden. 2016-05-25 11:37:19 +02:00
Gav Wood
a0bc1f9dae Display progress when importing (#1136)
* Display progress when importing

* Additional polish.

* Fix strange yielding behaviour.

* Allow colour to be disabled.

Fixed #1135
2016-05-25 09:57:31 +02:00
Marek Kotewicz
1741597a20 foundation of simple db migration (#1128)
* simple db migration

* make migration slightly more functional

* migration version is just a single unsigned integer
2016-05-24 22:38:11 +02:00
Marek Kotewicz
ebd0cdbc7a Fixpending (#1074)
* Fix --geth IPC for MacOS.

* fix pending_* methods in MinerService, add pending_receipts

* pending logs

* include pending logs when polling

* fixed returning pending logs multiple timees

* log type

* transactionHash is supplied to pending logs

* miner returns receipts together with hashes

* bring back miners all_transactions used by sync module
2016-05-24 21:56:32 +02:00
Arkadiy Paronyan
fba5082b00 Propagate uncles (#1134) 2016-05-24 21:56:17 +02:00
Gav Wood
27380cdadb Coloured, padding logging. (#1133)
* Add info message for mined block.

* Coloured, padding logging.

* Remove superfluous logs.

* Use better term colour module.
2016-05-24 20:30:21 +02:00
Gav Wood
2969d015ed Importing (#1132)
* Basic hex block exporting.

* Export formats and to file.

* First bits.

* Block importing.

* Fix error text.

* Wait for queue to empty before shutting down after import.
2016-05-24 20:29:19 +02:00
Marek Kotewicz
bf46531372 Merge pull request #1116 from rphmeier/die_display
Have `die_with_error` use `fmt::Display` rather than Debug
2016-05-24 20:00:50 +02:00
Gav Wood
90a272c519 Merge branch 'master' of github.com:ethcore/parity 2016-05-24 16:46:08 +02:00
Arkadiy Paronyan
f484beb7e1 Merge pull request #1129 from ethcore/exporting
Exporting
2016-05-24 15:06:19 +02:00
Gav Wood
78d3dfbfa6 Fix error text. 2016-05-24 13:31:03 +02:00
Nikolay Volf
503a5aea19 Merge pull request #1124 from ethcore/sign-and-send
Sign and send transaction
2016-05-24 12:03:57 +02:00
Nikolay Volf
31b6b59f20 Merge pull request #1125 from ethcore/warnings
Fixing unused imports warnings
2016-05-24 12:02:40 +02:00
Tomasz Drwięga
1def165c0b Adding info messages on mined blocks (#1127) 2016-05-23 18:47:11 +02:00
Gav Wood
11f1aeb36e Add info message for mined block. 2016-05-23 18:46:08 +02:00
Gav Wood
6c64aec137 Export formats and to file. 2016-05-23 18:42:59 +02:00
Tomasz Drwięga
b1cfbc460e Using signAndSend in topbar 2016-05-23 12:56:18 +02:00
Tomasz Drwięga
fb0be9e730 Updating status page (new docs) 2016-05-23 11:55:10 +02:00
Tomasz Drwięga
256557d3cc Removing warnings 2016-05-23 11:46:01 +02:00
Tomasz Drwięga
5579582a52 Sign and send transaction 2016-05-23 11:30:11 +02:00
Gav Wood
564a996620 Basic hex block exporting. 2016-05-23 09:51:36 +02:00
Robert Habermeier
49899d0dee trace error in die_with_io_error 2016-05-22 12:48:40 -04:00
Robert Habermeier
6fb54f4c9d remove extraneous braces in ExecutionError Display impl 2016-05-22 12:47:42 -04:00
Robert Habermeier
1251315b28 use fmt::Display in die_with_io_error printing 2016-05-22 12:43:21 -04:00
Robert Habermeier
5d997ef099 address match style concerns 2016-05-22 12:41:45 -04:00
Arkadiy Paronyan
f738f5e032 Merge pull request #1123 from ethcore/fixstyling
Fix styling - don't mix spaces with tabs!!!
2016-05-22 13:41:41 +02:00
Gav Wood
0c4cd00c1f Fix styling - don't mix spaces with tabs!!! 2016-05-22 12:42:22 +02:00
Gav Wood
c8d2237f0a Fix is_syncing so it's false as long as the update is trivial. (#1122) 2016-05-22 11:47:17 +02:00
Gav Wood
b53d0050dd Relock unlocked accounts after first use (#1120)
* Add `SecretStore::unlock_account_temp` function.

* Test for relocking accounts.
2016-05-21 22:23:16 +02:00
Gav Wood
9f84326ca7 Avoid importing keys into wrong place. (#1119)
* Avoid importing keys into wrong place.

- Now a `--no-import-keys` option;
- `--testnet` now alters the import location for keys and the store path.

Fixes #1112 and #1089.

* Avoid double-bools.
2016-05-21 18:46:18 +02:00
Gav Wood
9706f78a09 Merge branch 'master' of github.com:ethcore/parity 2016-05-21 17:26:03 +02:00
Marek Kotewicz
e952d62950 Merge pull request #1118 from ethcore/implementreceiptgasused
Implement receipt's gasUsed field
2016-05-21 16:30:40 +02:00
Gav Wood
33e7f5e390 Merge branch 'master' of github.com:ethcore/parity 2016-05-21 15:30:44 +02:00
Tomasz Drwięga
f8553ef90a New dapps & query parameter handling (#1113)
* DAO dapp

* Adding Maker OTC dapp

* Updating makerotc to contain topbar

* Updating daodapp

* Bumping versions after authors has been updated

* Adding webapps to tests

* Enabling all accounts in wallet
2016-05-21 15:27:55 +02:00
Gav Wood
828bf7cb9e Make receipt's gasUsed property work properly.
Fixes #1111
2016-05-21 14:49:21 +02:00
Gav Wood
399dfc4c2e Merge remote-tracking branch 'origin/master' 2016-05-21 14:49:09 +02:00
Robert Habermeier
3cba91bdd5 alter die_with_error to use fmt::Display, not Debug 2016-05-20 18:13:30 -04:00
Robert Habermeier
a7d7cb9ecb add Display impl for ethcore::Error, UtilError 2016-05-20 18:13:16 -04:00
Robert Habermeier
b0452cf309 add DIsplay impl for ExecutionError, CryptoError, and NetworkError 2016-05-20 18:12:51 -04:00
Robert Habermeier
5e1229366d add Display impl for Mismatch 2016-05-20 15:27:20 -04:00
Robert Habermeier
cf9b6e9e07 Add Display impl for OutOfBounds 2016-05-20 15:19:26 -04:00
Marek Kotewicz
852155959d Merge pull request #1098 from ethcore/trace_err
pretty print trace error
2016-05-19 18:00:39 +02:00
Marek Kotewicz
f383af093c Merge pull request #1095 from ethcore/sync-hashes
New syncing strategy
2016-05-19 17:59:53 +02:00
arkpar
ca6c91f591 New sync algorithm 2016-05-19 16:16:11 +02:00
debris
5ec096d57e Fixed ethcore-rpc compilation errors. 2016-05-19 15:48:40 +02:00
Nikolay Volf
dfac17538f ethcore-db crate (#1097)
* trait

* implentated, lifetime issue still

* full api

* test mod

* working open

* get/retrieve

* fix warnings and bug

* working serialization of &[u8] parameters

* client attributes

* fix empty payload ser/de

* [ci skip] debug assert out

* extra deserialization test

* extra serialization test

* extra serialization test

* serialization fixes, nupdate rocksdb

* open test working

* result bug & remove some scaffolds

* fix warnings

* more simple tests

* consistent quotes

* get rid of dedicated is_open flag

* hashmap -> btreemap
2016-05-19 14:36:15 +02:00
debris
95365670e4 Merge branch 'master' of github.com:ethcore/parity into trace_err 2016-05-19 14:15:05 +02:00
Nikolay Volf
1946346711 Merge pull request #1107 from ethcore/defaultarchive
Fix the default for pruning.
2016-05-19 14:06:39 +03:00
Nikolay Volf
f084399d4b Merge pull request #1105 from ethcore/consistent_db
Make Id/ID and db/Db/DB usage consistent
2016-05-19 12:49:31 +03:00
Gav Wood
bfdbff5ac7 basic pruning method still experimental. 2016-05-19 11:40:43 +02:00
debris
506ca15a15 Merge branch 'master' of github.com:ethcore/parity into trace_err 2016-05-19 11:07:53 +02:00
debris
634679966e Make Id/ID and db/Db/DB usage consistent 2016-05-19 11:00:32 +02:00
Gav Wood
306315e3e5 Default to archive mode. 2016-05-19 10:03:45 +02:00
Gav Wood
0ac41975a4 Merge branch 'master' of github.com:ethcore/parity 2016-05-19 10:03:31 +02:00
Marek Kotewicz
7d873b2c81 Merge pull request #1091 from ethcore/miner-spec-refact
Miner holds it's own copy of spec/engine
2016-05-19 09:40:30 +02:00
Marek Kotewicz
bb56c5827b Merge pull request #1101 from ethcore/apps-api
Apps listing API & Home webapp.
2016-05-19 09:38:43 +02:00
Nikolay Volf
6c6bbe9c57 Merge branch 'master' into miner-spec-refact
Conflicts:
	ethcore/src/client/client.rs
	ethcore/src/client/mod.rs
	ethcore/src/client/test_client.rs
	miner/src/miner.rs
2016-05-19 03:51:05 +03:00
debris
7f0d1173ba fixed weird line breaking 2016-05-19 01:05:24 +02:00
debris
55ebab2392 Merge branch 'master' of github.com:ethcore/parity into trace_err 2016-05-19 01:03:55 +02:00
Marek Kotewicz
6cff58055d CLI option for using JITEVM (#1103)
* easily configurable vm (in progress)

* completely removed vm_factory from engine

* --jitvm command line flag
2016-05-19 00:44:49 +02:00
Gav Wood
46f3b5f913 Fix up the seal fields in RPC output. (#1096)
Make Ethash::extra_info() work.
Seal fields now decode the RLP.
2016-05-19 00:41:41 +02:00
debris
8f6febae18 fixed docs compilation error 2016-05-18 16:44:11 +02:00
debris
407f046b9c fixed compilation errors 2016-05-18 13:49:23 +02:00
Marek Kotewicz
01db310cea Merge pull request #1102 from ethcore/fixing-warnings
Fixing some warnings
2016-05-18 13:43:49 +02:00
Tomasz Drwięga
ef38d9c769 Updating idmanager 2016-05-18 12:19:40 +02:00
Tomasz Drwięga
44c29ece17 Merge branch 'master' into fixing-warnings 2016-05-18 11:59:55 +02:00
Tomasz Drwięga
b9febdda34 Home page 2016-05-18 11:54:15 +02:00
debris
57b0be2a0b pretty print trace error 2016-05-18 11:44:55 +02:00
debris
14b6b389f2 propagate trace error to the top 2016-05-18 11:34:15 +02:00
Tomasz Drwięga
361d36f7d6 Webapps details 2016-05-17 16:55:08 +02:00
Gav Wood
53308b4deb Merge remote-tracking branch 'origin/master' 2016-05-17 16:29:51 +02:00
Marek Kotewicz
dcc695dda5 Merge pull request #1094 from ethcore/seal_fields_fix
fixed incorrect decoding of header seal_fields. added tests. #1090
2016-05-17 11:47:07 +02:00
Marek Kotewicz
f9604892ce Merge pull request #1093 from ethcore/bump-clippy
Bumping Clippy
2016-05-17 11:14:11 +02:00
debris
28fc0aacc0 header seal fields should be post-RLP-encoded, not pre 2016-05-17 11:07:51 +02:00
debris
fa7944ce3d fixed incorrect decoding of header seal_fields. added tests. #1090 2016-05-17 10:50:11 +02:00
Tomasz Drwięga
a950b81ee8 Fixing clippy warnings 2016-05-17 10:32:05 +02:00
Tomasz Drwięga
f7929ffdd4 Disabling some lints to clear the output 2016-05-17 09:38:21 +02:00
Tomasz Drwięga
9b9ea93ff7 Bumping clippy & crossbeam 2016-05-17 09:33:01 +02:00
Nikolay Volf
00ae3cf218 Merge pull request #1092 from ethcore/idmanager
Injectable topbar support.
2016-05-17 00:14:35 +03:00
Nikolay Volf
d249918fe7 Merge pull request #1088 from ethcore/sync-hashes-collection
New syncing part 1: Block collection
2016-05-16 23:19:16 +03:00
Nikolay Volf
d424194bbf test spec explicitly 2016-05-16 22:32:18 +03:00
Tomasz Drwięga
2ef6f756d0 Merge branch 'master' into idmanager
Conflicts:
	webapp/src/apps.rs
	webapp/src/page/mod.rs
	webapp/src/proxypac.rs
	webapp/src/router/mod.rs
2016-05-16 20:22:19 +02:00
Tomasz Drwięga
6363b0f69f Bumping status&idmanager 2016-05-16 20:10:43 +02:00
arkpar
9d2823da89 style 2016-05-16 19:46:09 +02:00
Nikolay Volf
f3f45a1dd9 ethsync tests fixed 2016-05-16 20:25:05 +03:00
Nikolay Volf
caec38d533 Merge branch 'master' into miner-spec-refact
Conflicts:
	ethcore/build.rs
2016-05-16 19:46:56 +03:00
Nikolay Volf
8cc321fe24 fix warnings 2016-05-16 19:45:16 +03:00
Nikolay Volf
7c28b1cef9 removed engine retrieval from client public api 2016-05-16 19:43:48 +03:00
Nikolay Volf
4e41cbca81 Moving all Client public API types to separate mod & binary serialization codegen for that mod (#1051)
* transaction moved

* trash remove

* ids move

* receipt

* tree-route

* blockchain info

* log_entry move

* trace filter moved

* executed & trace moved

* localized trace moved

* block status moved

* build scripts and codegen refs

* Cargo.lock update

* binary for blockstatus, blockchaininfo

* binary for trace

* trace filters binary ser

* binary for log entries & executed

* binary for receipt

* special case for u8 & transaction binary attribute

* resolved remaining issues & error binary serialization

* json-tests util import

* fix warnings

* ids attr

* add missing attributes

* Update build.rs
2016-05-16 18:33:32 +02:00
Nikolay Volf
994d056922 miner will use separate spec 2016-05-16 19:16:56 +03:00
Nikolay Volf
71278def5e Merge branch 'master' into types-binary 2016-05-16 17:48:18 +03:00
Tomasz Drwięga
9301963d98 Subdomains support in content server (webapps server). (#1082)
* Proxy.pac serving

* Subdomains router for dapps

* Proper handling of prefixed and non-prefixed apps

* Changing dapps domain to parity
2016-05-16 16:08:52 +02:00
Arkadiy Paronyan
ab06c9209b Merge pull request #1087 from ethcore/fixuncle
Fix uncle getter
2016-05-16 14:55:11 +02:00
arkpar
b5e10a53af Sync block collection 2016-05-16 14:42:04 +02:00
Gav Wood
56c705968b Fix typo. 2016-05-16 13:33:29 +02:00
Tomasz Drwięga
2d18bc936f Merge branch 'content-server' into idmanager
Conflicts:
	webapp/src/lib.rs
2016-05-16 13:15:18 +02:00
Tomasz Drwięga
237bd37030 Changing dapps domain to parity 2016-05-16 13:01:56 +02:00
Tomasz Drwięga
d94030294a Bumping idmanager version 2016-05-16 13:00:55 +02:00
Gav Wood
f4d5c7b48e Fix uncle getter
Uncle blocks don't necessarily have BlockDetails, so can't get total
difficulty directly.
Closes #1057
2016-05-16 12:46:09 +02:00
Nikolay Volf
96e92f1c38 add missing attributes 2016-05-15 02:34:27 +03:00
Nikolay Volf
d67d1eb355 ids attr 2016-05-15 02:32:53 +03:00
Nikolay Volf
9e7968c92e fix warnings 2016-05-15 02:13:45 +03:00
Nikolay Volf
326e1b3a42 json-tests util import 2016-05-15 01:56:18 +03:00
Nikolay Volf
483687b6bf resolved remaining issues & error binary serialization 2016-05-15 00:51:02 +03:00
Nikolay Volf
2d992d0c29 Merge branch 'master' into types-binary
Conflicts:
	ethcore/src/error.rs
2016-05-14 23:12:18 +03:00
Nikolay Volf
52e22b8a51 Merge pull request #1085 from ethcore/fix1073
Provide fallback for usd-per-eth option when offline.
2016-05-14 22:02:35 +03:00
Nikolay Volf
05f00a946d Merge pull request #1083 from ethcore/path-man
path centralized
2016-05-14 22:01:37 +03:00
Nikolay Volf
3ea26fcb0a merged out function return 2016-05-14 20:43:29 +03:00
Nikolay Volf
93aa6c613a Merge branch 'master' into path-man
Conflicts:
	parity/configuration.rs
2016-05-14 20:22:59 +03:00
Gav Wood
33248528b9 Provide fallback for usd-per-eth option when offline.
Fixes #1073.
2016-05-14 14:53:46 +01:00
Nikolay Volf
354ac7d6e5 Limiting result of the execution to execution-specific errors (#1071)
* execution error/result limiting

* missing trailing comma

* fix executive tests

* adding original error as string to the generic transaction error

* 'mallformed'-s all around
2016-05-14 13:28:44 +01:00
Nikolay Volf
2b78e511c9 Configurable keys security (#1080)
* adding options & cli flags

* adding it to the key deriving

* removed duplicated option
2016-05-14 12:30:25 +01:00
Marek Kotewicz
9b91444638 comma delimeting multiple cors headers (#1078) 2016-05-14 12:29:26 +01:00
Tomasz Drwięga
72b1b41748 Supporting topbar injection 2016-05-13 18:40:20 +02:00
Nikolay Volf
96496d6349 by ref 2016-05-13 18:36:18 +03:00
Nikolay Volf
7c19930efa creating all in one place 2016-05-13 18:32:32 +03:00
Nikolay Volf
9150538ac4 refactoring in configuration 2016-05-13 13:53:33 +03:00
Nikolay Volf
d5d5b0918c mod for paths & ethereum default paths 2016-05-13 13:12:32 +03:00
Tomasz Drwięga
0a85df10e8 Proper handling of prefixed and non-prefixed apps 2016-05-13 10:21:41 +02:00
Arkadiy Paronyan
effa2cf96d Merge pull request #1081 from poppingtonic/fix-drop-impl-error-message
Update error message
2016-05-12 20:43:32 +02:00
Brian Muhia
4a8fe6c99d Update error message 2016-05-12 18:39:12 +03:00
Tomasz Drwięga
3fc7faf24c Subdomains router for dapps 2016-05-12 15:53:04 +02:00
Tomasz Drwięga
f62d058186 Proxy.pac serving 2016-05-12 14:45:09 +02:00
Marek Kotewicz
06aefb54bc Merge pull request #1076 from ethcore/wallet-bump
Updating dapp-wallet
2016-05-12 07:46:35 +03:00
Tomasz Drwięga
a22f0a0d03 Updating dapp-wallet 2016-05-11 18:10:42 +02:00
Nikolay Volf
889642c3d4 special case for u8 & transaction binary attribute 2016-05-11 13:23:11 +03:00
Arkadiy Paronyan
89b1b25fde Merge pull request #1070 from ethcore/net-local-connect-fix
Fixed connecting to local nodes on startup
2016-05-11 11:28:50 +02:00
Nikolay Volf
6c74bfb153 Merge branch 'master' into types-binary 2016-05-11 11:55:43 +03:00
arkpar
9836c79962 Fixed connecting to local nodes on startup 2016-05-11 00:08:35 +02:00
Arkadiy Paronyan
ab288268bc Validate signature in Tx queue (#1068)
* moving deps to ethcore/hyper and bumping jsonrpc-http-server version

* Validate signature in tx queue
2016-05-10 11:43:26 +01:00
Arkadiy Paronyan
80e48f3672 Merge pull request #1067 from ethcore/hyper-update-3
moving deps to ethcore/hyper and bumping jsonrpc-http-server version
2016-05-10 11:34:06 +02:00
Nikolay Volf
16395a820f moving deps to ethcore/hyper and bumping jsonrpc-http-server version 2016-05-10 11:38:21 +03:00
Nikolay Volf
6d8749fbdd Merge branch 'master' into types-binary 2016-05-10 11:01:14 +03:00
Nikolay Volf
152afbcbf7 Merge pull request #1064 from ethcore/status-bump
Updating status page. Bringing back wallet
2016-05-10 10:59:36 +03:00
Tomasz Drwięga
7f26b5cbba Updating status page. Bringing back wallet 2016-05-09 14:40:46 +02:00
Gav Wood
2a19f91e99 Fix --geth IPC for MacOS. (#1062) 2016-05-09 12:04:00 +01:00
Tomasz Drwięga
49cc40708d Fixing formatter for defaultExtraData (#1060) 2016-05-08 21:34:15 +01:00
Nikolay Volf
a4dcbceb10 Merge pull request #1059 from ethcore/gethcompat
--geth IPC compatibility
2016-05-08 16:13:14 +03:00
Gav Wood
c75348392c Merge branch 'master' of github.com:ethcore/parity 2016-05-08 13:34:14 +01:00
Gav Wood
04f7322f06 --geth compatibility option 2016-05-08 13:34:01 +01:00
Arkadiy Paronyan
f5e44e373e Merge pull request #1050 from ethcore/syntex-lib-update
Moving dependencies to ethcore & uniforming syntax libs through all crates
2016-05-07 22:12:11 +02:00
Nikolay Volf
da6a8b98e2 Merge branch 'master' into syntex-lib-update
Conflicts:
	Cargo.lock
2016-05-07 18:23:01 +04:00
Marek Kotewicz
5bf047825f Merge pull request #1054 from ethcore/hyper-update-2
update hyper branch mio
2016-05-07 13:41:50 +01:00
Nikolay Volf
2e76def295 update hyper branch mio 2016-05-07 11:22:20 +04:00
Nikolay Volf
79d6c84a43 binary for receipt 2016-05-06 17:41:17 +04:00
Nikolay Volf
e7c4e5273a binary for log entries & executed 2016-05-06 17:38:00 +04:00
Nikolay Volf
f9c08df235 trace filters binary ser 2016-05-06 17:30:36 +04:00
Nikolay Volf
c622fc62d5 binary for trace 2016-05-06 17:19:53 +04:00
Nikolay Volf
29531ae72f binary for blockstatus, blockchaininfo 2016-05-06 17:16:03 +04:00
Nikolay Volf
96a4eb5b9e Cargo.lock update 2016-05-06 17:01:33 +04:00
Nikolay Volf
8721f868a6 Merge branch 'syntex-lib-update' into types-binary 2016-05-06 16:59:47 +04:00
Nikolay Volf
0d642f3109 removing unused externs 2016-05-06 16:43:29 +04:00
Nikolay Volf
d9acbbb027 finalizing deps rearrange 2016-05-06 16:40:24 +04:00
Nikolay Volf
c16a46dca7 all to ethcore 2016-05-06 14:58:37 +04:00
Nikolay Volf
2cb085db91 fixing issues with syntax 2016-05-06 02:25:58 +04:00
Nikolay Volf
aa6db4e69d placing right versions 2016-05-06 01:54:15 +04:00
Nikolay Volf
00ce4aaa26 build scripts and codegen refs 2016-05-06 01:10:50 +04:00
Nikolay Volf
14bcca54d2 block status moved 2016-05-06 00:47:47 +04:00
Nikolay Volf
e95f610195 localized trace moved 2016-05-06 00:38:13 +04:00
Nikolay Volf
25c88b7529 executed & trace moved 2016-05-06 00:33:43 +04:00
Nikolay Volf
2a721b4eda trace filter moved 2016-05-06 00:17:03 +04:00
Nikolay Volf
a8affa6dee log_entry move 2016-05-05 23:57:10 +04:00
Nikolay Volf
beb33672bd blockchain info 2016-05-05 23:47:07 +04:00
Nikolay Volf
b6d1801e12 tree-route 2016-05-05 23:04:59 +04:00
Nikolay Volf
7e9779e334 receipt 2016-05-05 22:56:44 +04:00
Nikolay Volf
271d3f3e57 ids move 2016-05-05 22:37:30 +04:00
Nikolay Volf
7d27aceee4 trash remove 2016-05-05 22:21:40 +04:00
Nikolay Volf
23f1a8fd48 transaction moved 2016-05-05 22:20:34 +04:00
Gav Wood
e74c333819 Merge branch 'master' of github.com:ethcore/parity 2016-05-05 10:56:17 +02:00
Nikolay Volf
a51bc6cd36 bump ipc lib version (#1047) 2016-05-05 10:55:32 +02:00
Tomasz Drwięga
75981ec0ab Updating hyper-mio commit (#1048) 2016-05-05 10:55:06 +02:00
Gav Wood
0bb5167fda Merge branch 'master' of github.com:ethcore/parity 2016-05-04 23:04:08 +02:00
Nikolay Volf
b99825bcac bump lib version (#1046) 2016-05-04 22:45:17 +02:00
Gav Wood
0d507922ce Tidy up CLI options and make JSONRPC & webapps on by default. (#1045)
* Tidy up CLI options and make JSONRPC & webapps on by default.

* Fix test.
2016-05-04 22:44:42 +02:00
Gav Wood
5a1564a63b Fix test. 2016-05-04 22:09:30 +02:00
Gav Wood
4dd63c81a6 Tidy up CLI options and make JSONRPC & webapps on by default. 2016-05-04 19:26:47 +02:00
Nikolay Volf
ad00bd7bc8 Merge pull request #1044 from ethcore/clippy-warnings
Fixing clippy warnings
2016-05-04 18:10:03 +03:00
Arkadiy Paronyan
0b1442faa2 Merge pull request #1041 from ethcore/rpc_modules
Fixing RPC modules compatibility
2016-05-04 15:48:07 +02:00
Arkadiy Paronyan
4480cf512a Merge pull request #1043 from ethcore/hyper-mio
Fixing hyper-mio revision
2016-05-04 15:46:45 +02:00
Tomasz Drwięga
b32e2f9549 Updating locations of webapp stuff (#1040) 2016-05-04 15:37:29 +02:00
Nikolay Volf
c449bf5663 JSON-RPC over IPC (#1039)
* moving namespaces for http/rpc

* cli options for ipc

* jsonrpc exposed fully

* updating json-ipc-server & removing non-standart traces api from defaults

* spelling & format
2016-05-04 15:37:09 +02:00
Tomasz Drwięga
15a8860e8a Fixing clippy warnings 2016-05-04 15:22:22 +02:00
Tomasz Drwięga
0a49efd018 Fixing hyper-mio revision 2016-05-04 15:10:04 +02:00
Tomasz Drwięga
c3f33aefdd Fixing RPC modules compatibility 2016-05-04 14:03:29 +02:00
petevine
58fd0175bf Update Cargo.toml (#1036) 2016-05-03 19:24:19 +02:00
Gav Wood
ac73b2628a Basic Authority (#991)
* Firt commit.

* First non-functional but correct implementation of BasicAuthority.

Still needs:
- Sealing infrastructure.

* Punch a hole to give miner access to key store.

* Fix test built.

* Basic version of synchronous mining.

This will seal a block whenever a new transaction comes through.
To be made better we need a timer which will wait for one second after the
last block before sealing a new one - better still would be to cooperatively
interleave blocks with other sealing nodes.

* Add tests.

* Fix minor issues from repotting.

* Address grumbles.
2016-05-03 17:23:53 +02:00
Tomasz Drwięga
1583f7d434 Prioritizing of local transaction (#1023)
* Changing is_local flag to TransactionOrigin enum

* Prioritize local transactions
2016-05-03 16:14:33 +02:00
Arkadiy Paronyan
8f56b21ca9 Merge pull request #1030 from ethcore/master-version
Version 1.2
2016-05-03 10:05:28 +02:00
Arkadiy Paronyan
59ed67a3f7 Update install-parity.sh 2016-05-02 18:35:10 +02:00
Arkadiy Paronyan
b49e652ae7 Merge pull request #1033 from ethcore/status-bump
Bumping status page
2016-05-02 17:47:01 +02:00
Arkadiy Paronyan
9b13dd7216 Merge pull request #1032 from ethcore/default-extra-data
Exposing default extra data via ethcore RPC
2016-05-02 17:12:25 +02:00
Tomasz Drwięga
1e117d1ee5 Bumping status page 2016-05-02 16:41:14 +02:00
arkpar
0595caf50c Flush password prompt 2016-05-02 16:28:15 +02:00
Tomasz Drwięga
2ac438a82d Exposing default extra data 2016-05-02 16:12:01 +02:00
arkpar
008d009e3e Version 1.2 2016-05-02 15:02:26 +02:00
Arkadiy Paronyan
c34e3535e0 Net etiquette: Track useless peers, Send out disconnect packet (#1028) 2016-05-02 14:48:30 +02:00
Tomasz Drwięga
e2465b1eab Bumping clippy & fixing warnings (#1024)
* Bumping clippy

* Fixing warnings found by clippy
2016-05-02 13:13:12 +02:00
Marek Kotewicz
7c2adc4137 Tracedb interface && cli (#997)
* traces cli and jsonrpc api

* missing if in docs

* adding traces to modules
2016-05-02 12:17:30 +02:00
Tomasz Drwięga
e22e4b9b8b Switching to geth-attach supporting version of rpc core and server (#1022) 2016-04-30 19:41:56 +01:00
Tomasz Drwięga
fdd030d101 Fixing status page displaying homestead (#1020)
* Fixing status page displaying homestead when running with --testnet switch

* Putting cli parsing logic in single place. Adding tests
2016-04-30 18:58:28 +01:00
Marek Kotewicz
66477a9476 Core tracedb functionality. (#996)
* fixed encoding 0u8

* simplified if else stmt

* tracedb core

* more comprehensive tracedb tests

* fixed minor review issues

* addresses filter

* fixed typos

* replace malformed with corrupted

* trace switch

* db key is generic and can be made smaller

* smaller tracedb keys

* tracedb version

* fixed ignored tests

* rename Tracedb -> TraceDB

* fixed typos

* proves

* trace only top level calls to builtins to avoid DDoS attacks

* fixed tracedb config switches

* fix comments fat replaced with trace

* vector-addressing scheme for localized traces

* removed comments

* removed first, redundant 0 from trace address

* updated db.trace method

* additional tests for tracedb.trace()
2016-04-30 16:41:24 +01:00
Tomasz Drwięga
e942f86bd7 Modules RPC (#1019) 2016-04-29 19:52:08 +01:00
Tomasz Drwięga
4fe99b7dea Updating status page (#1015)
* Updating status page

* Bump

* Bumping version of status page
2016-04-29 19:50:07 +01:00
Tomasz Drwięga
0ab9775561 Disabling wallet (#1017)
* Disabling wallet

* Fixing compilation
2016-04-28 20:48:13 +01:00
Arkadiy Paronyan
f83a8f3ba1 More detailed fatal error reporting (#1016) 2016-04-28 20:48:00 +01:00
Arkadiy Paronyan
8f7624f5cb Support 'pending' block in RPC (#1007)
* Support `pending` block in RPC

* Forward calls from miner to client in case no pending block is available
2016-04-28 20:47:44 +01:00
Tomasz Drwięga
ea669ac6b6 Enable pending block when there is local transaction pending. (#1005)
* Enabling sealing while importing own transaction

* Fixing import transaction deadlock

* Checking if there are local transactions in queue

* Updating hyper-mio

* Switching to rust-url#1.0.0
2016-04-28 16:36:53 +01:00
Nikolay Volf
d238b5e578 updating key files permissions on save (#1010)
* chmod when saving keyfile content

* to func

* returning error upstream instead of panic
2016-04-28 15:59:40 +01:00
Nikolay Volf
a86c39f7fa IPC JSON RPC (for external interface) (#1009)
* initial

* rpc file

* compiling nano part

* remove from rpc lib so far

* drop & stop improved

* ok(0)
2016-04-28 15:58:18 +01:00
Arkadiy Paronyan
0260e9322a Merge pull request #1013 from ethcore/ff-fix
Fixing Firefox authorization issues
2016-04-28 13:21:01 +02:00
Tomasz Drwięga
5ef2605cbc Fixing Firefox authorization issues 2016-04-28 11:50:45 +02:00
Arkadiy Paronyan
d1f123967c Merge pull request #1012 from ethcore/rustup
cargo update
2016-04-28 11:49:34 +02:00
debris
6cd4724901 cargo update 2016-04-28 10:21:58 +02:00
Marek Kotewicz
aed9c79237 Merge pull request #1011 from ethcore/url-update
Switching to rust-url@1.0.0
2016-04-28 10:09:13 +02:00
Tomasz Drwięga
6a544b7d8e Router refactoring 2016-04-28 10:06:41 +02:00
Marek Kotewicz
7068901649 Merge pull request #988 from ethcore/rpc-exception-handling
Exception handling in RPC & WebApps
2016-04-28 10:02:12 +02:00
Tomasz Drwięga
ea4346e945 Switching to rust-url#1.0.0 2016-04-27 22:41:46 +02:00
Nikolay Volf
c2787d80c8 Merge pull request #1008 from ethcore/uint-deserialization
Fixed uint deserialization from hex
2016-04-27 20:18:09 +03:00
arkpar
bf62357731 Fixed uint deserialization 2016-04-27 14:39:46 +02:00
Arkadiy Paronyan
b16fa5cc34 Merge pull request #1004 from ethcore/sync-timeout
Tweak timeout and packet size to handle slow networks better
2016-04-27 12:01:31 +02:00
Arkadiy Paronyan
3865e4cdba Merge pull request #998 from ethcore/ipc-new-serialization
IPC with new serialization
2016-04-26 15:52:38 +02:00
arkpar
45b908f6ba Inrease timeout, decrease number of requested blocks 2016-04-26 14:04:00 +02:00
Tomusdrw
2f52699c9b Merge branch 'master' into rpc-exception-handling 2016-04-26 11:30:37 +02:00
Tomusdrw
940dda885b Updating cargo.lock 2016-04-26 11:20:07 +02:00
Marek Kotewicz
9ecbc160dc Merge pull request #1001 from ethcore/jsonrpc_engine_agnostic
make jsonrpc api engine agnostic
2016-04-25 23:26:31 +02:00
Marek Kotewicz
b9d956c69b Merge pull request #1002 from ethcore/updated_cargolock
updated cargo.lock
2016-04-25 18:19:04 +02:00
Tomusdrw
36104edc63 Merge branch 'master' into rpc-exception-handling 2016-04-25 17:37:55 +02:00
debris
5aaa8e439f updated cargo.lock 2016-04-25 16:42:16 +02:00
Nikolay Volf
922400f191 ipc fixes 2016-04-25 17:21:54 +03:00
debris
d4a0ad0a60 make jsonrpc api engine agnostic 2016-04-25 16:06:08 +02:00
arkpar
fe14f6f160 Track import errors and restart sync 2016-04-25 10:53:28 +02:00
Arkadiy Paronyan
1e9b64a786 Merge pull request #993 from ethcore/parityup
updated parity dependencies
2016-04-25 10:04:42 +02:00
Nikolay Volf
9a3e6a6135 hypervisor fix 2016-04-25 06:34:11 +03:00
Nikolay Volf
7cacdba191 fixing codegen links 2016-04-25 06:29:20 +03:00
Nikolay Volf
020b490a72 some commas 2016-04-25 02:43:21 +03:00
Nikolay Volf
2d6f9af612 Merge pull request #980 from ethcore/binary-serializer
Auto (with codegen) binary serializer
2016-04-25 02:37:21 +03:00
Nikolay Volf
22e6e3f995 Merge pull request #995 from ethcore/tx-queue-fix
Fixing transaction queue last_nonces update
2016-04-25 02:37:00 +03:00
Nikolay Volf
a73323e64c Merge pull request #994 from ethcore/ommited
import route contains ommited blocks
2016-04-25 02:36:51 +03:00
Gav Wood
242b986196 Fix spelling of "omitted" 2016-04-24 22:16:34 +01:00
Gav Wood
0810de4415 Fix spelling of "omitted" 2016-04-24 22:16:06 +01:00
Marek Kotewicz
80a28b9b72 fixed encoding 0u8 (#992)
* fixed encoding 0u8

* simplified if else stmt
2016-04-24 22:12:49 +01:00
Gav Wood
b4fc75828e Update transaction_queue.rs
Avoid extraneous `U256` operations and split-state local.
2016-04-24 22:08:27 +01:00
Nikolay Volf
2947a91c3e commas 2016-04-24 21:34:19 +03:00
Tomasz Drwięga
0f4fbadd36 Fixing transaction queue last_nonces update 2016-04-24 19:45:01 +02:00
debris
d5555de1b9 import route contains ommited blocks 2016-04-24 19:40:04 +02:00
debris
3417b27832 updated parity dependencies 2016-04-24 19:10:56 +02:00
Arkadiy Paronyan
0b78a1ead9 Use latest netstats (#989) 2016-04-24 13:24:38 +01:00
Nikolay Volf
4670fd43ed and some more spaces 2016-04-23 18:53:09 +03:00
Nikolay Volf
5d06b04e41 final space 2016-04-23 18:52:12 +03:00
Nikolay Volf
4709edefff another fixed spaces 2016-04-23 18:50:12 +03:00
Nikolay Volf
53281a9454 fixed spaces 2016-04-23 18:49:39 +03:00
Nikolay Volf
fb82d185c7 refactored to new serialization 2016-04-23 18:15:50 +03:00
Tomasz Drwięga
8956d7e02b Exception handling in RPC & WebApps 2016-04-23 12:29:12 +02:00
Nikolay Volf
dcb7546d6d refactored to new serialization 2016-04-22 19:45:09 +03:00
Nikolay Volf
3c6669bd98 Merge pull request #984 from ethcore/rpc-shared-miner
RPC shared external miner
2016-04-22 16:46:36 +03:00
Nikolay Volf
6b1db6a656 merge bugs and fix warnings 2016-04-22 16:46:09 +03:00
Nikolay Volf
4c5425dbde Merge branch 'master' into binary-serializer
Conflicts:
	ipc/codegen/src/codegen.rs
2016-04-22 16:40:16 +03:00
Nikolay Volf
c97cb5d665 struct with reference serialization 2016-04-22 16:37:22 +03:00
Tomasz Drwięga
8b84b4f128 Merge branch 'master' into rpc-shared-miner
Conflicts:
	parity/main.rs
2016-04-22 12:16:15 +02:00
Arkadiy Paronyan
11b0daf6cb Merge pull request #983 from ethcore/rpc-settings
Additional RPC methods for settings
2016-04-22 11:37:24 +02:00
Nikolay Volf
04e704603f fixed warnings 2016-04-21 23:23:06 +03:00
Nikolay Volf
729f9c803d codegen updated 2016-04-21 23:03:05 +03:00
Nikolay Volf
bb6d47d0cd finished with io 2016-04-21 22:18:13 +03:00
Tomasz Drwięga
08a0d42ed3 Compilation fix 2016-04-21 20:53:44 +02:00
Arkadiy Paronyan
5fc944ae1d Merge pull request #985 from ethcore/tx-queue-deadlock
Fixing transaction_queue deadlock
2016-04-21 20:45:29 +02:00
Tomasz Drwięga
bacac7d0af Fixing transaction_queue deadlock 2016-04-21 20:42:36 +02:00
Tomasz Drwięga
0458a3378c Additional RPC methods for settings 2016-04-21 19:24:10 +02:00
Marek Kotewicz
5ccf653841 Merge pull request #981 from ethcore/main-refactor
Refactoring of `parity/main.rs`
2016-04-21 18:43:02 +02:00
Tomasz Drwięga
ef9b49f0b2 Merge branch 'main-refactor' into rpc-shared-miner 2016-04-21 17:38:21 +02:00
Tomasz Drwięga
ffc5d726bd Merge branch 'master' into main-refactor
Conflicts:
	parity/main.rs
2016-04-21 17:35:54 +02:00
Tomasz Drwięga
f5c2bea134 Shared instance of ExternalMiner 2016-04-21 17:32:53 +02:00
Arkadiy Paronyan
8381e79da6 Merge pull request #982 from ethcore/warnings
Fixing clippy warnings.
2016-04-21 17:28:30 +02:00
Tomasz Drwięga
3e280a3386 Splitting Configuration to separate module 2016-04-21 16:45:07 +02:00
Tomasz Drwięga
f5fcada5ba Getting rid of generated code warnings 2016-04-21 16:32:44 +02:00
Tomasz Drwięga
ee474b425b Fixing hook. 2016-04-21 16:19:47 +02:00
Tomasz Drwięga
c47d08e308 Fixing warnings 2016-04-21 16:06:54 +02:00
Tomasz Drwięga
69af2de3ba Fixing clippy warning 2016-04-21 16:02:11 +02:00
Tomasz Drwięga
bad735a8e6 Separating 2016-04-21 15:41:25 +02:00
Tomasz Drwięga
3e4adcb3b6 Splitting informant,io_handler and webapps 2016-04-21 13:57:27 +02:00
Tomasz Drwięga
09b2d7b3a6 Separating RPC 2016-04-21 13:12:43 +02:00
Arkadiy Paronyan
3c665f7640 Merge pull request #977 from ethcore/status-bump
Bumping status page
2016-04-21 11:26:35 +02:00
Arkadiy Paronyan
f2a5630fdf Merge pull request #972 from ethcore/db_writer
querying extras separated to its own module
2016-04-21 11:26:13 +02:00
Tomasz Drwięga
26ed38ecc2 Version 0.2.2 of status page 2016-04-21 09:43:42 +02:00
Nikolay Volf
ffc10fec8b read from bytes finished 2016-04-20 23:07:01 +03:00
Nikolay Volf
a61ab6d40f vec serialization 2016-04-20 23:06:48 +03:00
Nikolay Volf
e3c20e1c64 fix for raw struct 2016-04-20 23:06:35 +03:00
Nikolay Volf
8b1197b335 working serialization gen 2016-04-20 23:06:23 +03:00
Nikolay Volf
3908ddf609 compilation fixed 2016-04-20 23:06:08 +03:00
Nikolay Volf
59e18ad659 making this work 2016-04-20 23:05:53 +03:00
Nikolay Volf
e0ae0724e2 initial commit 2016-04-20 23:05:40 +03:00
Marek Kotewicz
e149402d81 Merge pull request #976 from ethcore/rpc-logs
Exposing application logs via RPC.
2016-04-20 18:47:30 +02:00
Arkadiy Paronyan
e47af7f745 Merge pull request #966 from ethcore/from-bytes-extend
Addressing binary serialization for db types
2016-04-20 18:17:00 +02:00
debris
273e4d6f32 removed db/module, a single file is enoguh 2016-04-20 15:53:01 +02:00
debris
bffa1e1ec9 simplified writing and reading from database with cache 2016-04-20 15:45:42 +02:00
debris
9ce9fd390d Merge branch 'master' of github.com:ethcore/parity into db_writer 2016-04-20 13:45:53 +02:00
Tomasz Drwięga
4b82fc1d1f Bumping status page 2016-04-20 10:07:02 +02:00
Tomasz Drwięga
c56a67a55a Adding tests for RotatingLogger 2016-04-20 00:47:56 +02:00
Tomasz Drwięga
f2a08d57e4 Merge branch 'master' into rpc-logs
Conflicts:
	rpc/src/v1/tests/ethcore.rs
	rpc/src/v1/traits/ethcore.rs
2016-04-19 19:59:50 +02:00
Marek Kotewicz
225a5ee825 removed redundant unwraps (#935)
* removed redundant unwraps

* fixed compilation error, removed warnings

* fixed transaction queue merge conflict

* fixed failing ethminer doc test
2016-04-19 10:35:32 -07:00
Tomasz Drwięga
407ab30503 Using ArrayVec to store logs 2016-04-19 19:22:14 +02:00
Tomasz Drwięga
a21f2a0998 Exposing loggin via RPC 2016-04-19 18:27:12 +02:00
Arkadiy Paronyan
2f174a6441 Merge pull request #975 from ethcore/fixed_tq_merge_conflict
fixed transaction queue merge conflict
2016-04-19 18:24:35 +02:00
debris
314ced57c8 fixed transaction queue merge conflict 2016-04-19 16:20:04 +02:00
Marek Kotewicz
46c8324c52 Merge pull request #974 from ethcore/tx-limit-conf
Configurable limit for transaction queue (CLI & Ethcore-RPC)
2016-04-19 16:02:28 +02:00
Marek Kotewicz
b8eb3d07ba Merge pull request #973 from ethcore/tx-limit-bug
Enforce limit caused `last_nonce` to return incorrect values.
2016-04-19 16:02:08 +02:00
Tomasz Drwięga
3c67ac636b Merge branch 'master' into tx-limit-conf
Conflicts:
	miner/src/transaction_queue.rs
2016-04-19 00:03:20 +02:00
Tomasz Drwięga
10e2659600 Fixing last_nonces updating when transactions are removed because of the limit 2016-04-19 00:00:55 +02:00
Tomasz Drwięga
98b3962412 RPC methods to set the limits 2016-04-18 23:13:38 +02:00
Tomasz Drwięga
5df817c8e0 Setting limit from CLI 2016-04-18 23:03:41 +02:00
Tomasz Drwięga
cd044ec096 Merge branch 'master' into tx-limit-bug
Conflicts:
	miner/src/transaction_queue.rs
2016-04-18 21:58:19 +02:00
Tomasz Drwięga
caf4d179a2 Even more detailed errors for transaction queue (#969)
* Even more detailed errors for transaction queue

* Small rename

* Removing macros in favour of functions+try!()
2016-04-18 10:34:59 -07:00
Tomasz Drwięga
58c47069d8 Enforce-limit + last_nonces bug 2016-04-18 18:39:14 +02:00
debris
60157e6f6c Merge branch 'master' of github.com:ethcore/parity into db_writer 2016-04-18 18:15:10 +02:00
debris
62455a4094 separated from blockchain and made reusable db reader and batch writer 2016-04-18 18:15:03 +02:00
Tomasz Drwięga
41153dd37c Removing macros in favour of functions+try!() 2016-04-18 17:20:35 +02:00
Arkadiy Paronyan
55051951f8 Merge pull request #970 from ethcore/blockchain_panic_fix
temporary fix of panic in blockchain garbage collection
2016-04-18 15:30:04 +02:00
debris
524a495ffd temporary fix of panic in blockchain garbage collection 2016-04-18 15:18:14 +02:00
Tomasz Drwięga
2812f8cae6 Small rename 2016-04-18 13:35:19 +02:00
Tomasz Drwięga
881678b613 Even more detailed errors for transaction queue 2016-04-18 13:16:46 +02:00
Arkadiy Paronyan
5aa54e0c1a Merge pull request #967 from ethcore/ipc-codegen-upgrades
IPC codegen - some minor fixes & enhancements
2016-04-18 12:55:10 +02:00
Arkadiy Paronyan
5b8ca74d65 Merge pull request #968 from ethcore/tx-tracing
Additional logging for transactions
2016-04-18 10:41:30 +02:00
Tomasz Drwięga
d093c5755e Moving own transaction tracing to miner create 2016-04-17 20:36:37 +02:00
Nikolay Volf
3c1c3ac156 Merge pull request #963 from ethcore/dbkeys
refactored blockchain extras keys building
2016-04-17 20:48:06 +03:00
Tomasz Drwięga
8389f771e9 Tracing whole transaction 2016-04-17 18:36:07 +02:00
Nikolay Volf
3c88e70270 upgrades from try-migration branch 2016-04-17 19:30:23 +03:00
Tomasz Drwięga
5086880093 Additional logging for transactions 2016-04-17 18:26:15 +02:00
Nikolay Volf
bde0a5b811 test for triples and bug fix 2016-04-17 19:12:10 +03:00
Nikolay Volf
3138584320 generalized fixedsized structs with macro 2016-04-17 18:52:44 +03:00
Nikolay Volf
17f26ad588 finished for BlockLocation 2016-04-17 18:30:42 +03:00
Nikolay Volf
bd2149406d from/to for BlockLocation 2016-04-17 18:18:25 +03:00
Arkadiy Paronyan
5547b44e5a Merge pull request #957 from ethcore/webapps-mio
Using hyper-mio branch in webapps.
2016-04-17 15:36:23 +02:00
Arkadiy Paronyan
6826712861 Merge pull request #965 from ethcore/build-remove-nano
Remove nanomsg from build-dependencies
2016-04-17 13:52:54 +02:00
Nikolay Volf
0ffc222fba no need for ipc in build-dependencies 2016-04-17 14:11:45 +03:00
Nikolay Volf
ef34b3d9aa convertables 2016-04-17 14:06:14 +03:00
Nikolay Volf
3e2875f3d5 removing redundant implements 2016-04-17 11:13:25 +03:00
Nikolay Volf
060e4bcd32 adding docs 2016-04-17 11:06:59 +03:00
Nikolay Volf
2812dee8d4 ongoing change 2016-04-17 10:40:35 +03:00
Nikolay Volf
799f1b7b08 Merge pull request #964 from petevine/master
Fix build for --target=armv7-unknown-linux-gnueabihf
2016-04-17 04:42:40 +03:00
petevine
763d78af87 Update dependencies 2016-04-17 01:50:04 +02:00
Nikolay Volf
119ae94816 raw bytes refactoring 2016-04-16 20:11:18 +03:00
Tomasz Drwięga
7516b737ee Fixing compilation errors 2016-04-16 00:57:13 +02:00
debris
5c4086bf8e log errors when db queries fails 2016-04-15 19:32:30 +02:00
debris
295efdba55 refactored blockchain extras keys building 2016-04-15 18:54:35 +02:00
Arkadiy Paronyan
ca4ddfb963 Merge pull request #962 from ethcore/ipc-nested-interfaces
IPC RPC codegen extra feature
2016-04-15 17:46:30 +02:00
Tomasz Drwięga
13c25c5d49 Merge branch 'master' into webapps-mio
Conflicts:
	Cargo.lock
	parity/main.rs
2016-04-15 17:14:39 +02:00
NikVolf
29b0bb1184 ipc-nested-interfaces 2016-04-15 17:50:10 +03:00
Arkadiy Paronyan
59f98a2a20 Merge pull request #961 from ethcore/ipc-nested-interfaces
IPC RPC codegen for generic implementation
2016-04-15 16:30:57 +02:00
Arkadiy Paronyan
38fa25edbe Merge pull request #960 from ethcore/upgrade-path
using db_path directory when upgrading
2016-04-15 16:30:44 +02:00
NikVolf
099e57c4e3 fix warning 2016-04-15 16:33:42 +03:00
NikVolf
d5b6f42965 Merge branch 'master' into ipc-nested-interfaces 2016-04-15 16:17:25 +03:00
NikVolf
058ef59b13 codegen for service with generics 2016-04-15 16:16:58 +03:00
arkpar
d84f382ab8 fixed build 2016-04-15 14:45:49 +02:00
arkpar
e7d8cfb8e0 update nanomsg-sys 2016-04-15 13:56:24 +02:00
Arkadiy Paronyan
b441750cc9 Merge pull request #958 from ethcore/ipc-hypervisor
IPC hypervisor
2016-04-15 10:31:19 +02:00
Tomasz Drwięga
00372cf747 Removing a transaction from queue now removes all from this sender with lower nonces. (#950)
* Changing  to wipe-out all transactions from particular sender lower then given nonce.

* Changing given nonce to be client_nonce

* Fixing test_client to support proper nonces when transactions are added to blockchain

* Fixing logic for transactions from new blocks in chain
2016-04-14 22:38:23 -07:00
Gav Wood
0b589915b9 Update auth.rs 2016-04-14 22:24:13 -07:00
Gav Wood
16ad086e7f Update mod.rs 2016-04-14 22:23:20 -07:00
Gav Wood
264c9bfd3c Update lib.rs 2016-04-14 22:16:58 -07:00
Gav Wood
77a535865b Update api.rs 2016-04-14 22:16:21 -07:00
Gav Wood
99b8e28051 Update mod.rs 2016-04-14 22:13:38 -07:00
Adam Goldman
c4c17aa1da bump status page version 0.1.7 (#955) 2016-04-14 22:07:46 -07:00
NikVolf
222a1bd29b using db_path directory 2016-04-15 02:49:42 +03:00
NikVolf
b7798d3869 updating nanomsg-sys 2016-04-15 00:01:20 +03:00
Arkadiy Paronyan
9b2f545391 Merge pull request #956 from ethcore/cors-option
Changing cors header to be optional
2016-04-14 21:16:57 +02:00
Arkadiy Paronyan
b7ab2c4da8 Merge pull request #959 from General-Beck/patch-1
Update ARM Dockerfile
2016-04-14 21:12:40 +02:00
Denis S. Soldatov aka General-Beck
1708a0e3b4 Update Dockerfile
switch to RUST 1.8 stable
remove cargo update
2016-04-15 02:04:35 +07:00
Gav Wood
d909bc05c4 Sensible gas limits for eth_sendTransaction (#953)
* Sensible gas limits for eth_sendTransaction

Fixes #859

* Compile fix.

* Remove !.
2016-04-14 12:01:12 -07:00
NikVolf
dc7e105ef8 Merge branch 'master' into ipc-hypervisor 2016-04-14 21:57:24 +03:00
NikVolf
edb8f1fd7e doc effort 2016-04-14 21:50:35 +03:00
NikVolf
6f4a98333e child processes spawn 2016-04-14 21:45:53 +03:00
Tomasz Drwięga
f81914351d Rewriting webapps to use hyper-mio branch 2016-04-14 20:38:48 +02:00
NikVolf
7ac985dded fix warnings 2016-04-14 20:56:06 +03:00
NikVolf
1b2ef60bbe working tests including warmup 2016-04-14 20:43:14 +03:00
Tomasz Drwięga
313e77fc3b Bumping jsonrpc-http-server 2016-04-14 19:30:53 +02:00
NikVolf
4d527e152c hypervisor-service chain 2016-04-14 18:49:25 +03:00
NikVolf
4931a300f2 first tests 2016-04-14 18:22:31 +03:00
Tomasz Drwięga
5b2d726a02 Changing cors header to be optional 2016-04-14 14:38:07 +02:00
Arkadiy Paronyan
01e7d2d872 Merge pull request #954 from ethcore/fixupgrade
Fix upgrade script and make parity run when no .parity dir.
2016-04-14 11:17:30 +02:00
Gav Wood
f5985bbffc Fix upgrade script and make parity run when no .parity dir. 2016-04-13 18:02:16 -07:00
Gav Wood
32ca8066e9 Tracing and docs. (#952) 2016-04-13 11:26:41 -07:00
NikVolf
405e3e2e7d initial setup 2016-04-13 19:03:57 +03:00
Tomasz Drwięga
30dc58ce49 Some tuning of rustfmt 2016-04-13 17:39:20 +02:00
Arkadiy Paronyan
cb4288b861 Merge pull request #946 from ethcore/numbers-serde-bin
IPC serialization for custom parameters
2016-04-13 14:10:12 +02:00
NikVolf
08874e8483 little test 2016-04-13 13:46:49 +03:00
NikVolf
987b84c530 cosmetic changes 2016-04-13 13:34:41 +03:00
NikVolf
1e1e567435 fix namespaces 2016-04-13 13:30:58 +03:00
NikVolf
f5f79ee0a9 [ci-skip] fix warnings 2016-04-13 13:29:49 +03:00
Nikolay Volf
293722a179 Merge pull request #948 from ethcore/filter_from_default
default filter from block should be Latest, not Earliest
2016-04-13 13:08:58 +03:00
debris
fd2d55934b default filter from block should be Latest, not Earliest 2016-04-13 11:32:28 +02:00
NikVolf
158f75b65d compiles with custom bytes convertable arguments 2016-04-13 12:09:47 +03:00
NikVolf
3f5382d52c finally compiled codegen/typegen 2016-04-13 09:57:35 +03:00
Nikolay Volf
dca67a3c85 Merge pull request #943 from kobigurk/master
README.md: removes sudo from multirust installation
2016-04-13 03:50:47 +03:00
NikVolf
a9cceefaa4 mapping and custom serializers 2016-04-13 03:46:36 +03:00
Tomasz Drwięga
3ce2374aeb Disable long lines formatting (#939) 2016-04-12 15:06:02 -07:00
Tomasz Drwięga
fbc28ce493 Additional methods for ethcore-specific rpc. Altering miner parameters (#934) 2016-04-12 15:04:40 -07:00
Tomasz Drwięga
f88498dad0 Merge pull request #941 from ethcore/ipc-nanomsg-local
Use ethcore nanomsg bindings
2016-04-13 00:02:47 +02:00
Kobi Gurkan
4b9aa76f1a README.md: removes sudo from multirust installation 2016-04-12 14:44:40 -07:00
Tomasz Drwięga
9892e43c4e Getting rid of iron dependency 2016-04-12 22:44:53 +02:00
Arkadiy Paronyan
f858a38d3b Merge pull request #938 from ethcore/ipc-update-syntax-libs
Update IPC codegen to latest syntax libs
2016-04-12 21:07:23 +02:00
arkpar
a19629e2d2 Use ethcores' nanomsg bindings 2016-04-12 20:37:09 +02:00
NikVolf
6149423e47 Merge branch 'ipc-update-syntax-libs' into numbers-serde-bin 2016-04-12 18:41:38 +03:00
NikVolf
3ce71171b6 serde helper crate 2016-04-12 18:41:23 +03:00
NikVolf
fc4dbe8713 remove from this pr 2016-04-12 18:16:59 +03:00
Arkadiy Paronyan
87c2d27a5a Merge pull request #937 from ethcore/ipc-doc-effort
IPC documentation
2016-04-12 17:14:54 +02:00
NikVolf
b191d3517d update versions and fix bugs 2016-04-12 18:03:58 +03:00
Arkadiy Paronyan
c7d6444ae0 Merge pull request #936 from ethcore/bumping-clippy
Bumping clippy and fixing warnings.
2016-04-12 16:49:30 +02:00
Nikolay Volf
bdb35cfaed Merge pull request #927 from ethcore/pruning_auto
Pruning auto
2016-04-12 16:00:39 +03:00
NikVolf
5a5f13205e Merge branch 'master' into ipc-doc-effort 2016-04-12 15:16:05 +03:00
Nikolay Volf
f1f81777cc Merge pull request #933 from ethcore/ipc-prs-client
IPC persistent client link
2016-04-12 15:13:06 +03:00
NikVolf
dab16af018 Merge branch 'master' into ipc-doc-effort 2016-04-12 15:10:47 +03:00
Tomasz Drwięga
7fbe3f4721 Fixing clippy warnings 2016-04-12 13:54:34 +02:00
Tomasz Drwięga
6b03a3218c Bumping clippy version 2016-04-12 13:51:39 +02:00
NikVolf
99c7e1efed Merge branch 'ipc-doc-effort' of github.com:ethcore/parity into ipc-doc-effort 2016-04-12 14:23:31 +03:00
NikVolf
8af86aae84 some docs 2016-04-12 14:22:47 +03:00
NikVolf
b1330b9375 removed global paths and fix warn 2016-04-12 14:22:47 +03:00
NikVolf
806f5b9064 working client spawn 2016-04-12 14:22:47 +03:00
NikVolf
cb1096d1e1 adding init wait 2016-04-12 14:22:47 +03:00
NikVolf
9a82607385 client & server dual tests (not working) 2016-04-12 14:22:47 +03:00
NikVolf
40e0d370c2 client spawner 2016-04-12 14:22:47 +03:00
NikVolf
5609b555d2 removed ready func 2016-04-12 14:22:47 +03:00
NikVolf
0c42126b8f client handshake tests, errors 2016-04-12 14:22:47 +03:00
NikVolf
fa47f1c28b codegen for client handshake 2016-04-12 14:22:47 +03:00
NikVolf
9adb79ed0e handshake dispatch test 2016-04-12 14:22:47 +03:00
NikVolf
a6d140616b server handshake 2016-04-12 14:22:47 +03:00
NikVolf
c5dc281934 reserved message ids and little endian for client 2016-04-12 14:22:47 +03:00
NikVolf
f836e07fd3 reserved message ids and little endian for client 2016-04-12 14:22:47 +03:00
NikVolf
c351bcd5a2 ipcconfig trait 2016-04-12 14:22:47 +03:00
Nikolay Volf
41f15929b9 Merge pull request #928 from ethcore/ipc-handshake
IPC handshake (negotiating protocol/api version)
2016-04-12 14:19:35 +03:00
NikVolf
14241c8d14 line breaks 2016-04-12 13:05:13 +03:00
Arkadiy Paronyan
283ce13454 Merge pull request #914 from ethcore/upgrades
Upgrade logic between versions
2016-04-12 11:30:52 +02:00
Arkadiy Paronyan
6af8e5f7e7 Merge pull request #903 from ethcore/tracing
executive tracing cleanup
2016-04-12 11:30:18 +02:00
NikVolf
ef3e9489a8 missing space 2016-04-12 12:18:48 +03:00
NikVolf
a232aabda3 some docs 2016-04-12 11:53:41 +03:00
NikVolf
36515570b4 removed global paths and fix warn 2016-04-12 11:41:26 +03:00
NikVolf
9b329296e4 working client spawn 2016-04-12 11:34:56 +03:00
NikVolf
593ccd2510 adding init wait 2016-04-12 11:13:27 +03:00
arkpar
54300b136c ARM Dockerfile 2016-04-12 10:06:54 +02:00
NikVolf
98ab30d102 client & server dual tests (not working) 2016-04-12 10:41:17 +03:00
NikVolf
c0e7b859d7 client spawner 2016-04-12 10:18:39 +03:00
NikVolf
93822bd2a2 Merge branch 'master' into ipc-handshake 2016-04-12 08:22:52 +03:00
NikVolf
60ea89ca1c removed ready func 2016-04-12 07:17:57 +03:00
NikVolf
a8bd7d07df client handshake tests, errors 2016-04-12 07:13:31 +03:00
NikVolf
edba351335 codegen for client handshake 2016-04-12 07:07:12 +03:00
NikVolf
be7eb63d1c handshake dispatch test 2016-04-12 06:43:45 +03:00
NikVolf
8ecbb53e99 reducing code 2016-04-12 06:19:15 +03:00
Gav Wood
fa95419c27 --pruning=auto option. 2016-04-11 18:42:50 -07:00
Gav Wood
6e97496b27 Support for --pruning=auto. 2016-04-11 15:51:14 -07:00
Tomasz Drwięga
3fe21f5931 Ethcore-specific RPC methods (#923)
* Ethcore-specific rpc methods

* Initializing ethcore-rpc
2016-04-11 12:06:32 -07:00
Gav Wood
c48374dbc6 Parameter to allow user to force the sealing mechanism (#918)
* Allow block sealing mechanism to be forced, even when not mining.

* Fix deadlock in dispatch_transaction. Fix tests.

* Horrible workaround for transaction importing.

* Reduce tracing. Cleanups.

* Remove logging.

* Remove broken code inherited from dodgy implementation.

* pre-query tx queue nonce also if any

* remove outside nonce queries

* remove queue nonces
2016-04-11 11:52:33 -07:00
NikVolf
1d09844950 Merge branch 'master' into upgrades 2016-04-11 21:43:07 +03:00
Arkadiy Paronyan
edf4735542 Update install-parity.sh 2016-04-11 19:52:42 +02:00
Marek Kotewicz
2d9db0cf67 Merge pull request #921 from ethcore/rustup
updated dependencies
2016-04-11 14:39:59 +02:00
debris
dfa8196543 updated dependencies 2016-04-11 13:21:55 +02:00
Marek Kotewicz
2004f1b5e5 Merge pull request #920 from ethcore/fixed_send_transaction_deadlock
Fixed send transaction deadlock
2016-04-11 13:20:59 +02:00
debris
dc6ade4ae3 fixed transaction deadlock 2016-04-11 12:44:57 +02:00
debris
4bfbb56701 added explanatory comments 2016-04-11 11:36:39 +02:00
debris
610251fdf7 Merge branch 'master' into tracing 2016-04-11 11:35:07 +02:00
debris
66e63ee081 Merge branch 'master' of github.com:ethcore/parity 2016-04-11 11:32:34 +02:00
Gav Wood
587862a370 Merge branch 'master' of github.com:ethcore/parity 2016-04-10 15:35:53 -07:00
Gav Wood
6c35c5e604 --unlock is comma-delimited. (#916) 2016-04-10 14:01:41 -07:00
Marek Kotewicz
fed853593b fixed eth_getLogs (#915)
* fixed eth_getLogs

* removed empty lines
2016-04-10 11:42:03 -07:00
debris
8340f135fc fixed eth_getLogs 2016-04-10 19:43:42 +02:00
NikVolf
26e23da4c0 some newver/oldver logics 2016-04-10 17:15:40 +03:00
NikVolf
d3411a50a4 locked ver.lock upgrade 2016-04-10 16:42:33 +03:00
NikVolf
69add61174 basic upgrade scenario 2016-04-10 16:12:20 +03:00
Nikolay Volf
032d29ec86 Merge pull request #912 from ethcore/keys-path-fix-create
create provided custom dir for keys if none
2016-04-10 17:01:51 +04:00
NikVolf
5f7cc437dd removing lower-level defaults 2016-04-10 14:38:57 +03:00
NikVolf
219e88a023 create provided custom dir for keys if none 2016-04-10 14:20:48 +03:00
Gav Wood
6ebd5009fc --unlock is comma-delimited. 2016-04-09 12:58:13 -07:00
Marek Kotewicz
373284ca0a spec loading cleanup (#858)
* spec loading cleanup in progress

* changed engine field in json spec

* refactored engine params

* polishing spec loading refactor

* fixed compiling json tests

* fixed compiling parity

* removed warnings

* removed commented out code

* fixed failing test

* bringing back removed TODO in spec.
2016-04-09 10:20:35 -07:00
Gav Wood
d823fd7685 Merge pull request #906 from ethcore/webapps-auth
WebApps HTTP Basic Auth Support
2016-04-09 10:19:59 -07:00
Tomasz Drwięga
a63be702e1 Merge pull request #888 from ethcore/h256
Removing match on constant
2016-04-09 11:28:01 +02:00
Tomasz Drwięga
04d5b5cbe6 Merge branch 'master' into h256
Conflicts:
	ethcore/src/account.rs
2016-04-09 11:27:19 +02:00
Tomasz Drwięga
e839404bd2 Merge pull request #907 from ethcore/gavofyork-patch-1
Update auth.rs
2016-04-09 11:25:05 +02:00
Gav Wood
1d5b29fb48 Update auth.rs 2016-04-08 17:51:20 -07:00
Gav Wood
60875905ac Merge pull request #904 from ethcore/webapp-default
Enabling webapps compilation by default
2016-04-08 17:43:13 -07:00
Gav Wood
0ef6de930f Update account.rs 2016-04-08 17:42:17 -07:00
Gav Wood
215973c7ab Merge pull request #898 from ethcore/fixed_895
fixed #895
2016-04-08 17:41:54 -07:00
Tomasz Drwięga
dab54cf2a7 HTTP Basic Authorization for WebApps server. 2016-04-08 16:11:58 +02:00
Tomasz Drwięga
8f16515d82 HTTP Authorization support in router 2016-04-08 15:25:20 +02:00
NikVolf
80d04ead33 server handshake 2016-04-08 14:07:25 +03:00
debris
fcf7f392f0 fixed failing tests 2016-04-08 11:48:37 +02:00
Tomasz Drwięga
508daad011 Enabling webapps by default 2016-04-08 11:18:46 +02:00
Arkadiy Paronyan
f9f11b6f74 Merge pull request #899 from ethcore/webapps2
Support for compile-time included WebApplications.
2016-04-08 10:54:40 +02:00
Tomasz Drwięga
f129126a82 Adding couple of missing commas 2016-04-08 10:13:42 +02:00
debris
64294853cc separated tracing logic to its own trait 2016-04-08 01:50:55 +02:00
NikVolf
c4727ac021 reserved message ids and little endian for client 2016-04-07 23:32:41 +03:00
NikVolf
2560640b29 reserved message ids and little endian for client 2016-04-07 23:32:33 +03:00
NikVolf
72acd67644 ipcconfig trait 2016-04-07 23:18:48 +03:00
Tomasz Drwięga
6395095659 Updating version of parity-status 2016-04-07 18:42:51 +02:00
Tomasz Drwięga
1852f1b462 REST-API PoC 2016-04-07 18:22:53 +02:00
Tomasz Drwięga
9bd41761fc Reverting back to old-hyper version of rpc 2016-04-07 16:31:42 +02:00
Tomasz Drwięga
b7c790d741 Disabling rpc until we switch to async hyper 2016-04-07 16:22:02 +02:00
Tomasz Drwięga
bf4ab6daa8 Merge branch 'master' into webapps2
Conflicts:
	parity/main.rs
2016-04-07 16:13:58 +02:00
Tomasz Drwięga
4569c25127 Specifying webapp interface 2016-04-07 15:59:45 +02:00
Arkadiy Paronyan
46a25b31ab Merge pull request #894 from ethcore/send-transactions
Propagate transaction queue
2016-04-07 15:36:01 +02:00
Marek Kotewicz
08980dabd6 Merge pull request #901 from ethcore/rpc
Use new json RPC server
2016-04-07 15:31:35 +02:00
Tomasz Drwięga
ed633bd0b7 Adding StatusPage and main page support 2016-04-07 15:14:39 +02:00
arkpar
8074fee28c Use new json RPC server 2016-04-07 14:32:44 +02:00
Arkadiy Paronyan
8e64379ed4 Merge pull request #900 from ethcore/fixing-rpc
Gracefully dying when trying to enable RPC and app is compiled without it.
2016-04-07 14:25:22 +02:00
Tomasz Drwięga
6279237c86 Adding documentation 2016-04-07 13:15:59 +02:00
Tomasz Drwięga
db2354a252 Merge branch 'fixing-rpc' into webapps2
Conflicts:
	parity/main.rs
2016-04-07 13:09:58 +02:00
Tomasz Drwięga
2adeb9fe88 Removing Option from setup_rpc_server method return type 2016-04-07 12:55:06 +02:00
Tomasz Drwięga
d1e3c633e5 Fixing compilation with rpc feature disabled 2016-04-07 12:50:35 +02:00
Arkadiy Paronyan
123a0f0b40 Merge pull request #893 from ethcore/closing
Additional logging and friendlier error messages
2016-04-07 12:36:19 +02:00
Tomasz Drwięga
1e0a787012 Merge branch 'closing' of github.com:ethcore/parity into closing 2016-04-07 12:30:48 +02:00
Tomasz Drwięga
ccd417f713 Reverting order of shutdown event 2016-04-07 12:27:54 +02:00
Tomasz Drwięga
91f1f4c174 Changing default setup to be safer for now 2016-04-07 12:20:35 +02:00
Tomasz Drwięga
1e9e0c32fa Disabling webapp server by default 2016-04-07 12:15:39 +02:00
Tomasz Drwięga
da05aa51fe Adding all APIs to webapp rpc server 2016-04-07 12:12:26 +02:00
Tomasz Drwięga
ad37b7fd2a Adding webapps router 2016-04-07 12:10:26 +02:00
Tomasz Drwięga
5d6ca1498e CLI options to run webapp server 2016-04-07 11:06:49 +02:00
Tomasz Drwięga
e3ce5d94e1 Adding webapps crate 2016-04-07 10:49:00 +02:00
Tomasz Drwięga
12d1dcddeb Updating rpc comments 2016-04-07 10:31:42 +02:00
Arkadiy Paronyan
0668f91b0c Merge pull request #897 from ethcore/closing-panic
Avoid signalling readiness when app is about to be closed.
2016-04-07 02:34:07 +02:00
debris
d1d3d847ab fixed #895 2016-04-07 00:33:55 +02:00
Tomasz Drwięga
730d60e5e4 Avoid signalling readiness when app is about to be closed 2016-04-07 00:20:03 +02:00
Tomasz Drwięga
f27d88f6ab More descriptive message when closing 2016-04-06 23:58:23 +02:00
Tomasz Drwięga
d4f0902968 Tracing shutdown and changed order of IoManager shutdown process 2016-04-06 23:45:19 +02:00
arkpar
3438cda432 Propagate transaction queue 2016-04-06 23:03:07 +02:00
debris
09beeaba8e trace result is a structure; 2016-04-06 21:23:52 +02:00
Tomasz Drwięga
fd03f58eae Rewriting messages 2016-04-06 19:22:10 +02:00
Tomasz Drwięga
a52043d5b3 Removing additional thread from JSON-RPC 2016-04-06 19:14:05 +02:00
Tomasz Drwięga
1f9eb97d0a Merge branch 'master' into closing 2016-04-06 19:07:56 +02:00
Tomasz Drwięga
dc91e57c2f Additional logging and error messages 2016-04-06 19:07:27 +02:00
Arkadiy Paronyan
5685fde606 Merge pull request #890 from ethcore/fix_875
fixed #875 and added tests for eth_sendTransaction
2016-04-06 16:24:32 +02:00
Marek Kotewicz
a8eb34ddb8 Merge pull request #891 from ethcore/issue-882
passing key path to all invocations
2016-04-06 15:05:47 +02:00
Nikolay Volf
b671cbd71f Merge pull request #892 from ethcore/eth-call-fix
Fixed eth_call nonce and gas handling
2016-04-06 15:54:58 +04:00
Arkadiy Paronyan
460d5bffd7 Merge pull request #886 from ethcore/ipc-nano
ipc rpc with nano transport (simple duplex)
2016-04-06 13:22:59 +02:00
Arkadiy Paronyan
ca17644289 Merge pull request #889 from ethcore/clippy
Bumping clippy and fixing warnings
2016-04-06 13:22:34 +02:00
NikVolf
e6be5016f9 replacing /home/nikky also 2016-04-06 14:21:19 +03:00
arkpar
9b7c48110a Fixed eth_call nonce and gas handling 2016-04-06 13:05:58 +02:00
NikVolf
8b3e84f7fe passing key path to all invocations 2016-04-06 14:03:53 +03:00
debris
d14d590c2b fixed #875 and added tests for eth_sendTransaction 2016-04-06 12:15:20 +02:00
Tomasz Drwięga
d5f9cccf5e Removing match on constant 2016-04-06 11:10:04 +02:00
Tomasz Drwięga
405a6bfc04 Removing match on constant 2016-04-06 10:58:51 +02:00
Tomasz Drwięga
1105b74174 Fixing match on constant 2016-04-06 10:58:07 +02:00
Tomasz Drwięga
85da55a537 Fixing warnings 2016-04-06 10:55:40 +02:00
Tomasz Drwięga
e8fa429438 Bumping clippy 2016-04-06 09:53:56 +02:00
NikVolf
aea185471a using nanomsg polling 2016-04-06 00:10:24 +03:00
NikVolf
47cfab2bbf loop size 2016-04-05 12:37:05 +03:00
NikVolf
6d425bb5bb fix doc 2016-04-05 12:35:45 +03:00
NikVolf
201d47a483 fixing url 2016-04-05 12:11:05 +03:00
NikVolf
0d7e52ac6f dispatch buf and proper polling 2016-04-05 12:08:42 +03:00
NikVolf
4cde01d81a guarding endpoints 2016-04-04 20:47:16 +03:00
Marek Kotewicz
d01a79f58f Merge pull request #878 from ethcore/expect-text
More descriptive expectations to transaction queue consistency.
2016-04-04 12:33:44 +02:00
Marek Kotewicz
963b82afe9 Merge pull request #879 from ethcore/fix-another-uint
uint bug - replace add with or
2016-04-04 11:59:00 +02:00
Nikolay Volf
9d8feff28d replace add with or 2016-04-04 11:06:16 +02:00
NikVolf
952a834e43 savework 2016-04-04 10:55:06 +03:00
Marek Kotewicz
d8179ceeb2 Merge pull request #877 from ethcore/uint-fix
Fixing typo in bigint
2016-04-04 09:54:37 +02:00
Tomasz Drwięga
919c185021 Fixing fn arguments indentation 2016-04-04 09:13:24 +02:00
Tomasz Drwięga
18503eaa53 Fixing typo in bigint 2016-04-04 09:00:22 +02:00
Tomasz Drwięga
2a185963a9 More descriptive expectations to transaction queue consistency. 2016-04-04 08:56:59 +02:00
Gav Wood
072a8e0105 Merge pull request #874 from ethcore/NikVolf-patch-1
update misleading cli help msg for author
2016-04-03 21:59:44 -04:00
Nikolay Volf
167f61bef0 [ci skip] update misleading cli help msg for author 2016-04-04 04:03:20 +04:00
NikVolf
35465debd6 flush 2016-04-04 01:52:19 +03:00
NikVolf
fa63d9e34a non-working test for dispatching 2016-04-04 01:44:30 +03:00
NikVolf
675af841e8 dummy service 2016-04-04 00:54:30 +03:00
NikVolf
1395d58d39 actual test flag 2016-04-04 00:42:00 +03:00
NikVolf
99d127bb34 duplex & tests 2016-04-04 00:33:30 +03:00
NikVolf
5cd6a04082 to pollng also 2016-04-04 00:00:57 +03:00
NikVolf
326855dc3a basic polling 2016-04-03 23:58:18 +03:00
NikVolf
b04d8196c7 dispatch_buf 2016-04-03 23:39:49 +03:00
Arkadiy Paronyan
ebd9eb1715 Merge pull request #871 from rphmeier/geth_keystore
Find geth data store cross-platform.
2016-04-03 21:39:57 +02:00
Robert Habermeier
2f02b43352 Find geth data store cross-platform.
Fixes #869
2016-04-03 14:54:13 -04:00
NikVolf
0a60da622f new crate 2016-04-03 21:43:35 +03:00
Gav Wood
8c447dcce2 Merge pull request #872 from ethcore/geth-import
Import geth 1.4.0 keys
2016-04-03 09:19:40 -04:00
arkpar
2fd23dc18f Handle geth keys with lowercase crypto key 2016-04-03 15:07:52 +02:00
Gav Wood
da315845ff Merge pull request #854 from ethcore/ipc-prox
Syntax helpers for IPC RPC (part 2)
2016-04-03 07:24:09 -04:00
Gav Wood
f29c59404f Merge pull request #870 from ethcore/fix-bootnode
Fixed bootnode URL and error message
2016-04-03 07:23:31 -04:00
Arkadiy Paronyan
54d594c486 Merge pull request #867 from ethcore/fix-861
replace popcnt with mov (861)
2016-04-02 19:08:09 +02:00
arkpar
67d04c5952 Fixed bootnode URL and error message 2016-04-02 19:01:41 +02:00
arkpar
4854f6923b Full restart on bad block 2016-04-02 09:29:12 +02:00
arkpar
a8772ed5c1 Track import errors and restart sync 2016-04-02 09:01:53 +02:00
Marek Kotewicz
3468b9a8c0 Merge pull request #865 from ethcore/depsup
weekly dependencies update
2016-04-01 21:22:34 +02:00
NikVolf
123287d977 replace popcnt with mov 2016-04-01 17:56:29 +03:00
Arkadiy Paronyan
0f7e3cdfe2 Merge pull request #866 from rphmeier/unused_mut
Remove unused mut
2016-04-01 16:19:12 +02:00
Robert Habermeier
12f4b5ea8a Remove unused mut 2016-04-01 09:33:12 -04:00
debris
f23f35aa13 weekly dependencies update 2016-04-01 12:04:04 +02:00
Marek Kotewicz
71dd9fb2df Merge pull request #864 from ethcore/fixed_855
fixed #855
2016-04-01 11:55:38 +02:00
Marek Kotewicz
7f1a1b7b96 Merge pull request #862 from ethcore/trace_styles
simplified trace from functions, removed clippy warnings
2016-04-01 11:49:05 +02:00
debris
0681346201 fixed #855 2016-04-01 11:26:14 +02:00
debris
239e2c82e6 simplified trace from functions, removed clippy warnings 2016-04-01 03:08:42 +02:00
Gav Wood
d681b96a7b Merge pull request #857 from rphmeier/hashdb_deprecated_docs
Update deprecated HashDB methods in docs.
2016-03-31 16:10:02 +02:00
NikVolf
97fbc11a8f more doc effort 2016-03-30 19:31:09 +03:00
NikVolf
92feabf3e7 fixed sig/body 2016-03-30 19:27:39 +03:00
NikVolf
3bbfcefb0b client method generation documented 2016-03-30 19:20:39 +03:00
NikVolf
ba30234397 codegen proxy->client 2016-03-30 18:27:31 +03:00
NikVolf
054fa71b52 dried namespaces 2016-03-30 18:25:31 +03:00
NikVolf
0291b9a1c3 fixed tests 2016-03-30 18:19:03 +03:00
NikVolf
71de6b8849 proxy -> client 2016-03-30 18:17:49 +03:00
Robert Habermeier
40d3301c68 Update deprecated HashDB methods in docs. 2016-03-30 01:36:35 -04:00
Nikolay Volf
3e09f99845 Merge pull request #853 from ethcore/json_tx_refactor
refactored loading transaction json tests
2016-03-30 03:32:41 +04:00
NikVolf
7097451323 forgotten upper files 2016-03-30 02:21:47 +03:00
NikVolf
be40553674 extra test and method encode fix 2016-03-30 02:20:01 +03:00
NikVolf
198613a854 redundant tab 2016-03-29 22:40:38 +03:00
NikVolf
fc3d424315 cleanup 2016-03-29 22:31:20 +03:00
NikVolf
579d2b1f02 final static functions 2016-03-29 22:29:43 +03:00
NikVolf
34f6c1f2f1 replaced hand-written with generated 2016-03-29 22:15:45 +03:00
NikVolf
bd377e1f28 almost valid signature (re)generation 2016-03-29 22:00:23 +03:00
Arkadiy Paronyan
bf5023f4d4 Update install-parity.sh 2016-03-29 18:05:41 +02:00
debris
94ec102d67 fixed homestead transition block number in transaction json-tests 2016-03-29 14:34:03 +02:00
debris
3d578bec76 removed unused code 2016-03-29 13:34:12 +02:00
debris
3a2f5954d7 refactored loading json tests 2016-03-29 13:01:39 +02:00
NikVolf
3de46a31d9 extracting type info for args 2016-03-29 01:55:04 +03:00
NikVolf
44ea98801b invoke with hand-written code and tests 2016-03-29 01:40:43 +03:00
NikVolf
15ecbaf59c invoke with hand-written code and tests 2016-03-29 01:40:30 +03:00
Nikolay Volf
02b336ee29 Merge pull request #852 from peterjoel/price_info_refactor
reorganised price info lookup
2016-03-29 01:53:25 +04:00
Peter
40b97045f0 Reorganised price info lookup
This helped stop my eyes from hurting.

Further simplification
2016-03-28 22:11:28 +01:00
Gav Wood
6399c0a2c7 Merge pull request #850 from ethcore/pubtxs
Publish locally-made transactions to peers.
2016-03-28 19:41:53 +02:00
Gav Wood
5d626c7dd3 Use sensible gas price. 2016-03-28 18:53:33 +02:00
Gav Wood
9592ccc0df Publish locally-made transactions to peers. 2016-03-28 18:11:00 +02:00
Arkadiy Paronyan
b1cf44a88c Merge pull request #847 from ethcore/ymltoken
Add generalbeck's token
2016-03-28 16:35:59 +02:00
Gav Wood
6da9e19f73 Add generalbeck's token 2016-03-28 15:47:57 +02:00
Gav Wood
cd6a09c0df Merge pull request #846 from ethcore/fixmining
Fix response for mining.
2016-03-28 12:43:05 +02:00
Gav Wood
6a7c25e2be Fix response for mining. 2016-03-28 11:23:22 +02:00
Gav Wood
c20ca0fa4e Merge pull request #843 from ethcore/usdgaspricing
USD-based pricing of gas.
2016-03-28 10:53:38 +02:00
Gav Wood
3ebfd0183a Merge pull request #811 from ethcore/bettermining
Parity can accept older work packages
2016-03-28 10:48:35 +02:00
Gav Wood
63a9fa172c Avoid openssl dep. 2016-03-28 10:25:19 +02:00
Gav Wood
d7c377dea6 Fix build. 2016-03-28 10:12:15 +02:00
Gav Wood
75b23aac02 Merge remote-tracking branch 'origin/master' into bettermining 2016-03-28 09:44:34 +02:00
Gav Wood
ad86feb667 Rename spawn -> boxed_clone 2016-03-28 09:42:50 +02:00
Arkadiy Paronyan
2178f09eec Merge pull request #841 from peterjoel/ethcompute
Caching for computing seed hashes (#541)
2016-03-28 01:43:45 +02:00
Gav Wood
b606fb68cf USD-based pricing of gas. 2016-03-28 00:49:35 +02:00
Gav Wood
d150529730 Merge remote-tracking branch 'origin/master' into bettermining 2016-03-27 22:16:24 +02:00
Peter
9655ce8dbf Caching for computing seed hashes (#541)
Code review changes
2016-03-27 20:42:24 +01:00
Gav Wood
7c5b171e3f Differentiate between ClosedBlock (can be reopened) and LockedBlock (cannot).
`ClosedBlock`s still keep the pre-finalised state (i.e. state after the last transaction).
`LockedBlock`s do not. New mining algo needs to reopen these `ClosedBlock`s, however enactment
system does not (and `ClosedBlock`s are slower & more hungry), hence the distinction.
2016-03-27 20:33:23 +02:00
Gav Wood
6b8e7bdfb3 Merge pull request #838 from ethcore/tx-queue-resp
checking transaction queue for pending transaction
2016-03-27 19:51:37 +02:00
NikVolf
a8c725a891 test for pending 2016-03-27 17:16:15 +03:00
Gav Wood
6cac296366 Remove comments. 2016-03-27 15:39:45 +02:00
Gav Wood
8bb49f05d0 Merge pull request #817 from ethcore/state_tests
refactored loading of state tests
2016-03-27 15:35:16 +02:00
Nikolay Volf
8b7e0a0dbe Merge pull request #837 from ethcore/835
tests for deserialization of transaction from issue #835
2016-03-27 17:13:21 +04:00
NikVolf
254ac6f253 checking tx queue 2016-03-27 16:12:21 +03:00
Gav Wood
43e1d89067 Fix State cloning. 2016-03-27 14:35:27 +02:00
debris
0d453e52ad tests for deserialization of issue #835 2016-03-27 14:14:05 +02:00
Gav Wood
f608db3a68 Merge pull request #834 from ethcore/unlock-pass
unlocks with no expiration [on top of 833]
2016-03-27 11:53:06 +02:00
NikVolf
6db02134e9 Merge branch 'master' into unlock-pass 2016-03-27 04:49:02 +03:00
Nikolay Volf
bdd6674958 Merge pull request #833 from ethcore/unlockcli
Unlock accounts on CLI.
2016-03-27 05:47:34 +04:00
Gav Wood
156a2336de Allow passwords on multiple lines in --password files. 2016-03-27 03:15:41 +02:00
NikVolf
cbe1e4599d fix test 2016-03-27 03:49:12 +03:00
NikVolf
32fd35843f in cli call 2016-03-27 03:45:43 +03:00
NikVolf
a37647b3d1 Merge remote-tracking branch 'origin/unlockcli' into unlock-pass 2016-03-27 03:42:32 +03:00
NikVolf
edc527b3ab unlimited unlock 2016-03-27 03:41:57 +03:00
Gav Wood
8805d04183 Minor refactor. 2016-03-27 01:41:28 +01:00
Gav Wood
53c4ed09a3 Unlock accounts on CLI. 2016-03-27 01:35:42 +01:00
Gav Wood
fc211f0934 Merge remote-tracking branch 'origin/master' into bettermining 2016-03-26 23:35:51 +01:00
Gav Wood
7d7b315511 Fix tests and a couple of warnings. 2016-03-26 23:35:36 +01:00
Gav Wood
c8ac1a2351 Fix test. 2016-03-26 23:32:54 +01:00
Gav Wood
ff0e6eb0d5 Merge pull request #829 from ethcore/optionalblocknumberinrpc-master
Make BlockNumber optional, fix eth_call
2016-03-26 23:29:53 +01:00
Gav Wood
993e16afbd Fix miner, 2016-03-26 20:36:03 +01:00
Gav Wood
785e9d1be6 Merge pull request #831 from ethcore/test-socket-devtools
Test socket to common test code (ethcore-devtools)
2016-03-26 20:07:40 +01:00
NikVolf
f9c0e0c152 removed from util 2016-03-26 19:08:06 +03:00
NikVolf
579d41b174 fix lib 2016-03-26 19:04:42 +03:00
NikVolf
c2ffb6c255 test socket to common test tools 2016-03-26 19:04:12 +03:00
Gav Wood
64819981f2 Merge branch 'master' into bettermining 2016-03-26 13:45:38 +01:00
Gav Wood
00685f357f Remove info!s. 2016-03-26 13:45:13 +01:00
Gav Wood
845fa97da1 Fix eth_call so it doesn't need the secret of the sender. 2016-03-26 13:30:02 +01:00
Gav Wood
aaf04e793d Make BlockNumber optional. 2016-03-26 12:41:24 +01:00
Gav Wood
b34ff82987 Merge branch 'master' of github.com:ethcore/parity 2016-03-26 12:40:04 +01:00
Gav Wood
af14c68acc Merge pull request #822 from ethcore/netidfix
Use network id for the web3_net_version return.
2016-03-26 11:25:09 +01:00
Gav Wood
2aa3183c16 Merge branch 'master' of github.com:ethcore/parity 2016-03-26 11:21:49 +01:00
Gav Wood
8ea53b69eb Merge pull request #824 from ethcore/web3-sha3
json-rpc web3_sha3
2016-03-26 11:20:52 +01:00
Gav Wood
44d9ccf2c5 Update web3.rs
[ci-skip]
2016-03-26 11:19:51 +01:00
Gav Wood
c981d6431d Merge pull request #819 from ethcore/travis-cleanup
remove some unused files
2016-03-26 11:19:04 +01:00
NikVolf
52726088f3 actually fix build 2016-03-26 04:06:40 +03:00
NikVolf
079a39a5f1 wiki test 2016-03-26 03:19:55 +03:00
NikVolf
dc4654fa4c avoid copy 2016-03-26 03:15:27 +03:00
NikVolf
3d94670f1f web3_sha3 2016-03-26 03:00:05 +03:00
Gav Wood
b30fc3a715 Fix build. 2016-03-26 00:53:35 +01:00
Gav Wood
51d182eb5a Merge pull request #818 from ethcore/debug-symbols
debug symbols for master/beta
2016-03-26 00:30:29 +01:00
Gav Wood
3f04f4e5c6 Merge pull request #809 from ethcore/ipc-syntax
Syntax helpers for IPC RPC
2016-03-26 00:30:00 +01:00
Gav Wood
f231440480 Use network id for the web3_net_version return. 2016-03-26 00:23:07 +01:00
Gav Wood
b45ed30936 Disable two tests that will require an improved TestBlockChainClient 2016-03-25 16:41:01 +01:00
NikVolf
8184e27cb8 deleted atavisms 2016-03-25 17:24:04 +03:00
NikVolf
c014d5d12e debug symbols for master/beta 2016-03-25 16:55:48 +03:00
debris
22d9edb138 Merge branch 'master' of github.com:ethcore/parity into state_tests 2016-03-25 13:09:59 +01:00
debris
cdcbc56255 refactored state tests 2016-03-25 13:08:57 +01:00
Gav Wood
100e6fa88f Merge pull request #803 from ethcore/executive_tests
refactored loading of execution tests
2016-03-25 10:43:33 +00:00
debris
e1b841b526 Merge branch 'master' of github.com:ethcore/parity into executive_tests 2016-03-25 10:40:21 +01:00
Marek Kotewicz
2c2e8ef154 Merge pull request #805 from ethcore/rustfmt
Rustfmt.toml
2016-03-25 10:39:59 +01:00
Gav Wood
c99a486826 UsingQueue: Tests for new function, remove unused function. 2016-03-24 23:15:51 +01:00
Gav Wood
d50c9f9fac Merge remote-tracking branch 'origin/master' into bettermining 2016-03-24 23:10:54 +01:00
Gav Wood
830ef7ddfc New mining framework.
Fixes #756.
2016-03-24 23:03:22 +01:00
NikVolf
cb2e1e1572 one more 2016-03-25 00:44:02 +03:00
NikVolf
1864c243fa indents 2016-03-25 00:42:09 +03:00
NikVolf
19e05595c8 whitespace extra 2016-03-25 00:41:15 +03:00
NikVolf
17a9bb81e8 whitespaces 2016-03-25 00:39:20 +03:00
Gav Wood
28122a1e89 Merge pull request #810 from ethcore/debris-patch-1
install-partiy runs brew reinstall parity on osx
2016-03-24 21:27:20 +00:00
Marek Kotewicz
ee337471c2 install-partiy runs brew reinstall parity on osx 2016-03-24 22:22:04 +01:00
NikVolf
aa7ecdbd65 initial commit 2016-03-25 00:07:01 +03:00
Arkadiy Paronyan
01a39e4f4e Merge pull request #807 from ethcore/tracegetwork
Fix mining from spinning
2016-03-24 18:27:17 +01:00
Arkadiy Paronyan
b2665d0c5e Update install-parity.sh 2016-03-24 18:11:07 +01:00
Gav Wood
3be2763929 Merge branch 'master' into bettermining 2016-03-24 16:43:17 +00:00
arkpar
416040f313 Fixed test 2016-03-24 17:09:41 +01:00
Gav Wood
8dbd6f36b5 Avoid warning. 2016-03-24 16:00:32 +00:00
debris
a7ce6fca9e fixed checking if state is correct in executive tests 2016-03-24 16:40:52 +01:00
Gav Wood
ae5eece76f Don't care if engaged in sync since it's typically doing so. 2016-03-24 14:40:13 +00:00
Gav Wood
6c18a1f285 Fix logic. agaib. 2016-03-24 14:40:10 +00:00
Gav Wood
cbba403992 Fix logic error. 2016-03-24 14:39:32 +00:00
Gav Wood
e6136eb075 Fix mining. 2016-03-24 14:39:29 +00:00
Gav Wood
e214489106 Fix compile. 2016-03-24 13:56:22 +00:00
Gav Wood
0ab57c48c3 Add tracing. 2016-03-24 13:51:51 +00:00
Tomasz Drwięga
bc03040b0f Removing ethash sizes 2016-03-24 11:50:33 +01:00
Gav Wood
1700b6a087 Add UsingQueue. 2016-03-24 07:49:54 +00:00
debris
1aa34e9dd4 fixed loading of executive tests, unrevealed failing consensus tests 2016-03-24 01:25:59 +01:00
debris
3352b0e916 json-tests vm loading 2016-03-23 18:36:05 +01:00
Tomasz Drwięga
9a867ad277 Adding new crates 2016-03-23 18:20:06 +01:00
Gav Wood
4e013ba2fc Refactor pending_block to always return invalid txs and sometimes a block.
Docuemnt SealingWork properly.
2016-03-23 16:28:02 +00:00
Tomasz Drwięga
a0db1d5416 Merge branch 'master' into rustfmt
Conflicts:
	ethash/src/sizes.rs
	util/src/uint.rs
2016-03-23 16:55:54 +01:00
Gav Wood
97449afbb9 Merge branch 'master' into bettermining 2016-03-23 14:18:16 +01:00
Gav Wood
038b67cbd4 Merge pull request #802 from ethcore/tx_queue_bugs
Fixing future-current transactions clash
2016-03-23 14:02:44 +01:00
Tomasz Drwięga
c2d2e41624 Fixing future-current transactions clash 2016-03-23 12:23:50 +01:00
Arkadiy Paronyan
ebd7273071 Merge pull request #800 from ethcore/fixjsonrpc
Increase threads to num_cpus & fix author reporting
2016-03-22 21:08:59 +01:00
Gav Wood
0e026ed11f Fix author reporting. num_cpus for JSONRPC threads. 2016-03-22 19:12:17 +01:00
Gav Wood
7624bcf49e Increase threads to 4. 2016-03-22 18:43:06 +01:00
Gav Wood
d7fb464fa9 Merge pull request #798 from ethcore/eth_rpc
another batch of rpc improvements
2016-03-22 18:38:55 +01:00
debris
a0cbe7cd7e fixed eth_call, eth_sendTransaction and eth_estimateGas 2016-03-22 17:17:50 +01:00
debris
0cdac6de3c uncle 2016-03-22 16:07:42 +01:00
Gav Wood
a134f939e9 Non-functioning draft of code. 2016-03-22 13:05:18 +01:00
Nikolay Volf
0c8afa932a Merge pull request #794 from ethcore/tracing
Avoid tracing DELEGATECALL and CALLCODE. Plus tests for it.
2016-03-22 10:21:31 +03:00
debris
f2a0e24491 removed outdated comment 2016-03-21 20:29:35 +01:00
Gav Wood
2ab9d02158 Fix test. 2016-03-21 12:39:13 +01:00
debris
0e5395013a implemented eth_sendRawTransaction 2016-03-21 12:00:30 +01:00
Gav Wood
8906b78b07 Revert break. 2016-03-21 11:56:11 +01:00
Gav Wood
205f062433 Merge branch 'master' into tracing 2016-03-21 11:54:50 +01:00
Gav Wood
8ed8652296 Reuse should_Trace. 2016-03-21 11:53:52 +01:00
debris
068c0f3782 test for eth_getTransactionReceipt 2016-03-21 11:47:50 +01:00
Gav Wood
c4d45e0cf0 Trace basic calls! And tests. 2016-03-21 11:24:03 +01:00
Gav Wood
6701aff2a2 Merge pull request #793 from loxal/patch-1
complete getting started steps for OS X
2016-03-21 10:46:42 +01:00
Alexander Orlov
677193ca52 complete getting started steps for OS X
You get 
`multirust: no default toolchain configured` 
when 
`multirust default stable`
is not executed.
2016-03-20 20:44:32 +01:00
Gav Wood
7051529880 Merge pull request #788 from ethcore/test-fix
Auto detect available port (with fixed test)
2016-03-20 19:43:57 +01:00
Gav Wood
74f7f3f016 Merge pull request #792 from ethcore/eth_getTransactionReceipt
eth_getTransactionReceipt
2016-03-20 19:43:49 +01:00
Gav Wood
72b604b8e8 Avoid tracing DELEGATECALL and CALLCODE. Plus tests for it. 2016-03-20 19:20:37 +01:00
debris
52e9801721 client implementation of transaction receipt 2016-03-20 18:44:57 +01:00
Arkadiy Paronyan
8a5aa354f2 Merge pull request #791 from ethcore/tracing
Comprehensive tests for tracing transactions
2016-03-20 18:44:24 +01:00
Gav Wood
c2933e005a Tests for not tracking builtin calls. 2016-03-20 17:51:22 +01:00
debris
2a3e695f8a LocalizedReceipt 2016-03-20 17:29:39 +01:00
Gav Wood
b4c2505eab Merge branch 'master' into tracing 2016-03-20 16:30:59 +01:00
Gav Wood
dcb23de65c Merge pull request #771 from ethcore/tx_queue_timeout
Disable preparing work package if miners don't ask for it.
2016-03-20 16:29:13 +01:00
Gav Wood
6ac350a996 Tests for lots more configurations. 2016-03-20 16:24:19 +01:00
arkpar
6e9ea76aab Auto detect available port 2016-03-20 16:21:49 +01:00
Marek Kotewicz
f1f421af76 Merge pull request #786 from ethcore/clitweak
Listen on all interfaces for JSONRPC by default.
2016-03-20 15:13:45 +01:00
Marek Kotewicz
fbb166f3ce Merge pull request #787 from ethcore/eth_estimateGas
eth_estimateGas
2016-03-20 15:13:22 +01:00
Tomasz Drwięga
ef10c6f637 Avoiding possible overflow when block number gets smaller. 2016-03-20 12:18:41 +01:00
Arkadiy Paronyan
f4df3860b0 Merge pull request #789 from ethcore/revert-782-test-fix
Revert "Auto detect available port"
2016-03-20 12:18:16 +01:00
Tomasz Drwięga
40fc3dc060 Merge branch 'master' into tx_queue_timeout 2016-03-20 12:16:57 +01:00
Arkadiy Paronyan
2ec40604d9 Revert "Auto detect available port" 2016-03-20 12:12:58 +01:00
Gav Wood
5afd32dd84 Minor tweaks. 2016-03-20 12:09:55 +01:00
Gav Wood
d2d5806e9b Test for failed create transactions, failed actions are logged as such. 2016-03-20 12:04:31 +01:00
debris
aa47d944e1 implemented rpc eth_estimateGas method, added tests for rpc eth_call and eth_estimateGas 2016-03-20 11:34:19 +01:00
Gav Wood
f75fb6a59f Create transaction tracing test. 2016-03-20 11:33:36 +01:00
debris
d15ce15751 Merge branch 'eth_call' into eth_estimateGas 2016-03-20 10:40:18 +01:00
debris
d536d20643 fixed indentation 2016-03-20 10:36:44 +01:00
Gav Wood
05a9c16329 JSONRPC interface defaults to local.
Please enter the commit message for your changes. Lines starting
2016-03-20 10:34:34 +01:00
debris
83d08ba399 Merge branch 'master' of github.com:ethcore/parity into eth_call 2016-03-20 10:29:43 +01:00
debris
7c6f0e472d implementation of eth_estimateGas 2016-03-20 10:29:30 +01:00
Marek Kotewicz
6feb503c67 Merge pull request #777 from ethcore/call
added output to execution result
2016-03-20 10:28:28 +01:00
Gav Wood
004cd00f13 Merge pull request #782 from ethcore/test-fix
Auto detect available port
2016-03-20 10:23:55 +01:00
Marek Kotewicz
865847f71d Merge pull request #785 from ethcore/author0x
Allow 0x prefix for --author.
2016-03-20 10:19:58 +01:00
Gav Wood
c611566a3e Listen on all interfaces for JSONRPC by default. 2016-03-20 10:19:21 +01:00
Marek Kotewicz
4396eaeebb Merge pull request #784 from ethcore/cargo_impr
updated dependencies, moved rpctest to its own submodule
2016-03-20 10:09:24 +01:00
debris
fef8237701 fixes after merge 2016-03-20 10:07:50 +01:00
debris
46bfed6750 Merge branch 'call' into eth_call 2016-03-20 10:05:22 +01:00
debris
9fb19e6dd0 Merge branch 'master' of github.com:ethcore/parity into call 2016-03-20 10:04:27 +01:00
Gav Wood
0cef2cfc46 Merge pull request #778 from ethcore/json_tests_refactor
use ethjson module to load chain json tests
2016-03-20 09:51:36 +01:00
Gav Wood
c729f9d9ca Merge pull request #772 from ethcore/tracing
Tracing implemented.
2016-03-19 23:52:23 +01:00
Gav Wood
387d0743e6 Allow 0x prefix for --author. 2016-03-19 23:51:24 +01:00
Marek Kotewicz
83b132ace2 Merge pull request #780 from ethcore/travis_ethjson
test ethjson module on travis
2016-03-19 23:32:16 +01:00
debris
b9623e6c5b improvements to build, updated dependencies, moved rpctest to its own submodule 2016-03-19 23:27:50 +01:00
Gav Wood
2cb1937e1e Move code to right module. 2016-03-19 22:37:11 +01:00
arkpar
cabccf9ef5 Test URL logged 2016-03-19 22:19:59 +01:00
Gav Wood
7bba745f8b Fix JSON test again. 2016-03-19 22:14:16 +01:00
Gav Wood
bc6a892f2b Test outer create. 2016-03-19 22:12:52 +01:00
debris
9a227dce46 Merge branch 'json_tests_refactor' into eth_call 2016-03-19 21:42:10 +01:00
debris
521f2a1433 implemented eth_call 2016-03-19 21:37:11 +01:00
Gav Wood
718feeccbc Fix for JSON tests. 2016-03-19 21:05:18 +01:00
Gav Wood
a2fc006ee5 First test. 2016-03-19 21:02:44 +01:00
arkpar
da027e93cf Auto detect available port 2016-03-19 21:00:05 +01:00
Gav Wood
2d55e08b41 Fix for jsontests, 2016-03-19 19:06:13 +01:00
Gav Wood
ab9b8c7bf3 Output data (code) for creates. 2016-03-19 18:46:41 +01:00
debris
40f20de7aa test ethjson module on travis 2016-03-19 18:46:28 +01:00
debris
24cb15ef2e fixed missing import 2016-03-19 18:38:02 +01:00
Gav Wood
7d93fa2533 Output stored for calls. 2016-03-19 18:37:55 +01:00
debris
2face3f938 use ethjson module to load chain json tests 2016-03-19 18:13:14 +01:00
Gav Wood
bd7cd68c32 Track depth. 2016-03-19 14:35:09 +01:00
debris
bc5df9c908 added output to execution result 2016-03-19 14:29:09 +01:00
Gav Wood
c837c3164a Merge pull request #775 from ethcore/rpc
batch of rpc fixes
2016-03-19 14:14:02 +01:00
Gav Wood
152f132b7b Fix JSONRPC test utils. 2016-03-19 14:10:32 +01:00
Gav Wood
66837452c2 Expose tracing all the way to BlockChain; now it's up to blockchain to integrate. 2016-03-19 13:37:47 +01:00
Gav Wood
203438fb42 Fix tests. 2016-03-19 13:07:49 +01:00
debris
693a3b0739 fixed failing eth rpc tests 2016-03-19 12:55:36 +01:00
Gav Wood
1bfcbca8af Add doumentation, make tracing optional and expose at OpenBlock level. 2016-03-19 12:54:34 +01:00
debris
e5c6579a8c next batch of rpc fixes, 103 still failing 2016-03-19 12:23:48 +01:00
debris
52dbcd8152 rpc tests, now 421 passing / 116 failing 2016-03-19 11:44:36 +01:00
debris
906e9b395e fixed parsing blockchain file, added default account to rpc tests 2016-03-19 11:02:44 +01:00
Tomasz Drwięga
48d8d1c628 Merge branch 'master' into tx_queue_timeout
Conflicts:
	miner/src/miner.rs
2016-03-19 09:26:05 +01:00
Gav Wood
1d822132f0 Merge pull request #757 from ethcore/ethrpc_test
rpctest executable
2016-03-19 08:45:13 +01:00
Gav Wood
d6f94c4ad7 Fix test and first part of optionality. 2016-03-19 08:31:19 +01:00
debris
a76aad2e12 fixed invalid json files 2016-03-18 23:56:51 +01:00
Gav Wood
d16558eb83 Merge pull request #753 from ethcore/tx_queue_live
Refactoring error transaction_queue error handling and `update_sealing` method.
2016-03-18 23:54:22 +01:00
Gav Wood
bd338a5741 Tracing implemented.
TODO:
- make it optional;
- track output;
- usher through to level higher than ExecutionResult.
2016-03-18 23:49:12 +01:00
debris
ef297dbec7 removed warnings by adding missing documentation 2016-03-18 22:57:26 +01:00
debris
79aa8570d0 pricing { linear: {} } 2016-03-18 22:54:36 +01:00
Tomasz Drwięga
48be70e4a8 Fixing ethminer doctest 2016-03-18 20:45:07 +01:00
debris
e4ec80941c fixed failing builin test 2016-03-18 20:17:25 +01:00
Tomasz Drwięga
f8dd1a6354 Merge branch 'master' into tx_queue_timeout
Conflicts:
	ethcore/src/client/test_client.rs
	miner/src/miner.rs
2016-03-18 19:36:32 +01:00
debris
839cecd2da fixed od builting parsing 2016-03-18 19:31:31 +01:00
Tomasz Drwięga
62c32eb288 Merge branch 'master' into tx_queue_live
Conflicts:
	miner/src/miner.rs
2016-03-18 19:31:14 +01:00
debris
1c9cc6167d updated rpc helpers docs 2016-03-18 19:16:46 +01:00
debris
3b8c6a1ab2 linear -> pricing 2016-03-18 19:08:57 +01:00
debris
79b8dd829d fixed compilation with --release flag 2016-03-18 18:16:22 +01:00
debris
ae3e6d7fe8 fixed name of rpctest executable in rpctest --help 2016-03-18 18:08:28 +01:00
debris
757f0c9bc4 Merge branch 'master' of github.com:ethcore/parity into ethrpc_test 2016-03-18 18:05:29 +01:00
Gav Wood
2309e19fd9 Merge pull request #760 from ethcore/tx_queue_gas_limit
Avoid importing transactions with gas above 1.1*block_gas_limit to transaction queue
2016-03-18 18:05:26 +01:00
Gav Wood
a1fb0619bb Merge pull request #752 from ethcore/tx_queue_invalid
Removing transactions that failed to be pushed to block.
2016-03-18 18:03:11 +01:00
Tomasz Drwięga
7d77324765 BlockGasLimit taken from push_transaction result 2016-03-18 14:22:50 +01:00
Tomasz Drwięga
0dc1ddef9a Flipping sealing_enabled flag after no requests for sealing_block for some time 2016-03-18 13:59:11 +01:00
Tomasz Drwięga
58bb5e967a Merge branch 'master' into tx_queue_gas_limit
Conflicts:
	miner/src/transaction_queue.rs
2016-03-18 12:25:36 +01:00
Gav Wood
4e97a0b868 Merge pull request #766 from ethcore/updating_clippy
Updating clippy
2016-03-18 12:16:03 +01:00
Tomasz Drwięga
7fb365634a Updating gas_limit in test_client generated blocks 2016-03-18 10:36:01 +01:00
Tomasz Drwięga
942d38fb13 Removing allow dead_code 2016-03-18 10:22:00 +01:00
Tomasz Drwięga
e58ec31e20 Fixing warnings 2016-03-18 10:14:19 +01:00
Tomasz Drwięga
338e5fadb9 Bumping clippy 2016-03-18 10:08:47 +01:00
Tomasz Drwięga
cee45e1a8e Merge branch 'master' into tx_queue_live
Conflicts:
	miner/src/miner.rs
2016-03-18 09:48:35 +01:00
Tomasz Drwięga
a6bd15d333 Fixing compilation 2016-03-18 09:46:13 +01:00
Tomasz Drwięga
48c72a168c Merge branch 'master' into tx_queue_invalid 2016-03-18 09:44:31 +01:00
debris
3e6d0602ea running rpc tests 2016-03-17 23:58:30 +01:00
Arkadiy Paronyan
0d77937caf Merge pull request #754 from ethcore/tx_queue_all
Attempting to add all transactions to mined block
2016-03-17 20:02:54 +01:00
Gav Wood
4da8ede826 Merge pull request #761 from ethcore/ver-fix
Prettier version w/o git dir; Use rustc compile time version
2016-03-17 19:32:42 +01:00
arkpar
a61d1d8d51 Indent 2016-03-17 18:43:01 +01:00
arkpar
b1793fcb16 Prettier version wo git dir; Use rustc compile time version 2016-03-17 18:41:55 +01:00
Tomasz Drwięga
2dc314f993 Removing update_seal when new transactions arrives 2016-03-17 18:30:26 +01:00
Tomasz Drwięga
7ae60056b2 Common error handling 2016-03-17 16:13:00 +01:00
debris
a3f6d36018 Merge branch 'master' of github.com:ethcore/parity into ethrpc_test 2016-03-17 15:52:09 +01:00
debris
c695b83e52 new way of loading PodState 2016-03-17 15:51:40 +01:00
Gav Wood
3fb180973b Merge pull request #751 from ethcore/tq-stop-sync
Stop adding transactions to queue while not fully synced
2016-03-17 15:47:06 +01:00
Tomasz Drwięga
fece330ca4 Refactoring removing invalid transactions from queue 2016-03-17 15:30:03 +01:00
Tomasz Drwięga
309af743e0 Ignoring transactions slightly above gas_limit 2016-03-17 15:23:25 +01:00
debris
1f03ae54d6 moved ethcores spec to its own module, added genesis 2016-03-17 15:15:10 +01:00
Nikolay Volf
85b08e6e7b get rid of the function 2016-03-17 15:09:08 +01:00
Nikolay Volf
7929af67c8 propagation is out 2016-03-17 15:02:18 +01:00
Nikolay Volf
0f96ce9bd2 no flag also 2016-03-17 14:56:19 +01:00
Tomasz Drwięga
c4021a77ca Stop adding transactions right after we know that no other will make it to block. 2016-03-17 14:40:40 +01:00
Nikolay Volf
0b35a36cb0 Merge branch 'master' into tq-stop-sync
Conflicts:
	sync/src/chain.rs
2016-03-17 14:19:12 +01:00
Nikolay Volf
a285fbab6d overhaul to flag 2016-03-17 14:11:32 +01:00
debris
0f889d4222 added genesis method to ethjson blockchain 2016-03-17 14:03:53 +01:00
Tomasz Drwięga
dec69651fd Attempting to add all transactions to mined block 2016-03-17 13:41:30 +01:00
debris
0621da8535 ethjson spec submodule 2016-03-17 13:41:11 +01:00
Tomasz Drwięga
833c5fdd31 Merge branch 'master' into tx_queue_live
Conflicts:
	sync/src/chain.rs
2016-03-17 13:35:01 +01:00
Gav Wood
a76eb022d0 Merge pull request #746 from ethcore/tx_queue
Verify sender's balance before importing transaction to queue
2016-03-17 13:32:48 +01:00
Gav Wood
c88601a376 Merge pull request #750 from ethcore/tx_block_pending
Returning number of transactions pending in block not queue
2016-03-17 13:21:06 +01:00
Tomasz Drwięga
caedb64ade Adding missing space 2016-03-17 13:18:26 +01:00
Nikolay Volf
83f5cc6aa6 adding helper can_sync 2016-03-17 13:14:06 +01:00
Tomasz Drwięga
e1c3ab1846 Renaming status fields to something more descriptive. 2016-03-17 13:07:34 +01:00
Tomasz Drwięga
b684bc9ba0 Updating sealing when new transactions are received 2016-03-17 12:52:26 +01:00
Arkadiy Paronyan
cd26ccba6b Merge pull request #733 from ethcore/build_speedup
Speeding up build
2016-03-17 12:47:29 +01:00
Tomasz Drwięga
c382fa7eab Removing invalid transactions from queue 2016-03-17 12:29:55 +01:00
Nikolay Volf
5c4edbdd6b Merge branch 'master' into tq-stop-sync 2016-03-17 12:25:14 +01:00
Arkadiy Paronyan
de484b2495 Merge pull request #742 from ethcore/mining-stop-sync
adding check for a sync when giving work to miner
2016-03-17 12:23:43 +01:00
Tomasz Drwięga
7247f9e27f Fixing doctest 2016-03-17 12:23:15 +01:00
Nikolay Volf
03ca9d2c06 adding message from client to sync and disabling sending transactions to the queue while syncing 2016-03-17 12:17:53 +01:00
debris
f92a0c8df2 rpctest executable 2016-03-17 11:50:31 +01:00
Tomasz Drwięga
bc04e0c713 Adding missing commas 2016-03-17 11:49:56 +01:00
Tomasz Drwięga
b1557b547b Reverting check if block queue is empty 2016-03-17 11:47:41 +01:00
Tomasz Drwięga
0e7778a7b7 Increasing balance in tests 2016-03-17 11:27:38 +01:00
Gav Wood
4050462ad4 Update sync_provider.rs 2016-03-17 11:23:30 +01:00
Gav Wood
22bc9f6458 Merge pull request #745 from ethcore/ethjson
json deserialization module
2016-03-17 11:21:29 +01:00
Tomasz Drwięga
884f2dd873 Returning number of transactions pending in block not queue 2016-03-17 11:19:12 +01:00
debris
5e44769f82 Merge branch 'ethjson' into ethrpc_test 2016-03-17 10:56:30 +01:00
Tomasz Drwięga
95dda4aa68 Full transaction cost 2016-03-17 10:44:10 +01:00
Tomasz Drwięga
81c36499ea Fixing sync test 2016-03-17 10:20:35 +01:00
Tomasz Drwięga
10c309fccb Merge branch 'master' into tx_queue 2016-03-17 10:20:21 +01:00
Arkadiy Paronyan
c0da47db9c Merge pull request #749 from ethcore/arkpar-patch-1
Update install-parity.sh
2016-03-17 10:08:30 +01:00
Arkadiy Paronyan
5cd3eaa111 Update install-parity.sh 2016-03-17 09:54:05 +01:00
Gav Wood
ecfcc4f3b6 Merge pull request #747 from ethcore/sync
Restart sync on getting old unknown header
2016-03-16 20:32:10 +01:00
arkpar
b9584b7ec9 restart sync on getting old unknown header 2016-03-16 18:25:32 +01:00
Tomasz Drwięga
0925968840 Adding test 2016-03-16 17:22:23 +01:00
Tomasz Drwięga
8741a85443 Fixing build 2016-03-16 16:56:36 +01:00
Tomasz Drwięga
d54c95da9d Removing unused import 2016-03-16 10:48:31 +01:00
Tomasz Drwięga
fdba8de600 Validating senders balance before importing transaction to queue 2016-03-16 10:45:55 +01:00
Nikolay Volf
bd892026f6 tests 2016-03-16 10:37:08 +01:00
Tomasz Drwięga
be32e79a7a Merge branch 'master' into tx_queue 2016-03-16 09:28:37 +01:00
Nikolay Volf
8427e99c73 checking queue also 2016-03-15 23:58:46 +01:00
Tomasz Drwięga
974222aabd Removing printlns 2016-03-15 23:13:53 +01:00
Tomasz Drwięga
188e325b20 Importing transactions from hashset. Notifying about every block 2016-03-15 23:01:36 +01:00
Gav Wood
5a96f99a8c Merge pull request #744 from ethcore/sync
Missing return for #737
2016-03-15 19:43:05 +01:00
debris
196c6e8ecc tests for loading test json files 2016-03-15 19:32:07 +01:00
debris
b4849d1c58 finished blockchain test deserialization 2016-03-15 18:42:23 +01:00
arkpar
e538b417f0 Missing return 2016-03-15 18:35:07 +01:00
debris
d96858d38c proper blockchain json parsing 2016-03-15 18:17:48 +01:00
Nikolay Volf
99bae23996 [ci skip] grammar fix 2016-03-15 17:56:35 +01:00
Nikolay Volf
ab4bfbac0d adding check for a sync 2016-03-15 17:13:44 +01:00
Arkadiy Paronyan
77bdca5b68 Merge pull request #741 from ethcore/block-test
Enact block with uncles test
2016-03-15 16:55:50 +01:00
Tomasz Drwięga
d57b0177a7 Disabling benches and beta tests 2016-03-15 15:55:37 +01:00
Tomasz Drwięga
74245be4f5 Enabling fast finish 2016-03-15 15:09:12 +01:00
Arkadiy Paronyan
eac73a4e54 Merge pull request #740 from ethcore/fix-libc-ver
Fix outdated libc version on dependency
2016-03-15 14:51:12 +01:00
Tomasz Drwięga
c970d7f80e Merge branch 'master' into build_speedup
Conflicts:
	.travis.yml
2016-03-15 14:48:19 +01:00
arkpar
9dea31031c Enact block with uncles test 2016-03-15 14:35:45 +01:00
Nikolay Volf
1eb0f1b991 Merge branch 'master' into fix-libc-ver 2016-03-15 13:37:10 +01:00
Nikolay Volf
6d939ddfce updating lock 2016-03-15 13:36:27 +01:00
Arkadiy Paronyan
828d20629b Merge pull request #735 from ethcore/transaction_queue_race
Fixing possible race in transaction queue
2016-03-15 12:47:30 +01:00
Gav Wood
b0f233a06c Merge pull request #737 from ethcore/sync
Sync fixed again
2016-03-15 12:13:44 +01:00
Arkadiy Paronyan
e5f54966af Merge pull request #734 from ethcore/fixblockchainrace
Don't change best block until extras is committed.
2016-03-15 11:56:49 +01:00
Arkadiy Paronyan
b64713e5ac Merge pull request #736 from ethcore/travis-stable-only
stable only until travis speedup
2016-03-15 11:56:11 +01:00
Gav Wood
e98cfd84a9 Merge pull request #629 from ethcore/uint_opt
Optimizing uint operations (architecture independent)
2016-03-15 11:24:00 +01:00
arkpar
b9b0444662 Trace sending to unconfirmed session 2016-03-15 11:20:19 +01:00
Nikolay Volf
ec4f7c4190 stable only until travis speedup 2016-03-15 11:12:54 +01:00
Tomasz Drwięga
7045e9f2f7 More cleaning 2016-03-15 11:05:31 +01:00
Tomasz Drwięga
2cecb1eada Cleaning 2016-03-15 11:04:48 +01:00
Gav Wood
59d0d2df9a Don't change best block until extras is committed. 2016-03-15 10:59:58 +01:00
Tomasz Drwięga
26dd67ebeb Speeding up build 2016-03-15 10:57:09 +01:00
Tomasz Drwięga
40ac01b730 Fixing possible race in transaction queue 2016-03-15 10:54:19 +01:00
arkpar
85833d228a Ignore new blocks while seeking 2016-03-15 01:22:58 +01:00
Tomasz Drwięga
d5ec1775ef Merge branch 'master' into uint_opt
Conflicts:
	test.sh
	util/bigint/src/uint.rs
2016-03-14 23:45:16 +01:00
Gav Wood
d6d0f8d4eb Merge pull request #725 from ethcore/unclesminingfix
Add RLP, not a data item.
2016-03-14 20:20:45 +01:00
Gav Wood
7ba396b8d3 Merge pull request #687 from ethcore/pv63-receipts
PV63 receipts response
2016-03-14 20:18:10 +01:00
Gav Wood
7628df6fe6 Merge pull request #723 from ethcore/rpc_tests
another batch of rpc tests
2016-03-14 19:18:08 +01:00
Arkadiy Paronyan
ffbc6f51cb Merge pull request #726 from ethcore/docker
dockerfiles update
2016-03-14 19:02:04 +01:00
debris
dfef09161c update dockerfiles 2016-03-14 18:47:23 +01:00
debris
c476e7da31 update docker 2016-03-14 18:25:05 +01:00
Gav Wood
97051cb949 Add RLP, not a data item. 2016-03-14 18:20:24 +01:00
debris
81beaf1094 update dockerfiles 2016-03-14 17:53:08 +01:00
Nikolay Volf
8cdb013f9f Merge branch 'master' into pv63-receipts
Conflicts:
	ethcore/src/client/client.rs
2016-03-14 17:36:51 +01:00
Arkadiy Paronyan
683c13db37 Merge pull request #721 from ethcore/titi
Lock reports to avoid out of order badness.
2016-03-14 17:26:01 +01:00
debris
9b241faf01 uncle method mock 2016-03-14 17:01:29 +01:00
Arkadiy Paronyan
d844de442a Merge pull request #722 from ethcore/network
Fixed handshake leak
2016-03-14 16:23:54 +01:00
debris
47ca84041b tests for eth_mining, eth_compileLLL, eth_compileSolidity, eth_compileSerpent 2016-03-14 14:59:09 +01:00
arkpar
4e5ebc9457 missing mut 2016-03-14 14:22:18 +01:00
arkpar
f6e8c03ff6 Merge branch 'master' of github.com:ethcore/parity into titi 2016-03-14 14:18:59 +01:00
debris
0de73609d2 eth_hashrate && eth_submitHashrate tests 2016-03-14 14:18:29 +01:00
Arkadiy Paronyan
38de95cc3b Merge pull request #719 from ethcore/targetgaslimit
Allow configuration of target gas limit.
2016-03-14 14:04:09 +01:00
arkpar
c8b65c769b Fixed handshake leak 2016-03-14 13:54:06 +01:00
Arkadiy Paronyan
42499addc8 Merge pull request #714 from ethcore/master-version
Version 1.1 in master
2016-03-14 13:40:52 +01:00
Gav Wood
5503cd4646 Lock reports to avoid out of order badness. 2016-03-14 12:41:11 +01:00
Gav Wood
44223f3658 Merge pull request #720 from ethcore/network
Silence UDP warnings
2016-03-14 11:10:12 +01:00
Nikolay Volf
8f4323f3bb Merge branch 'master' into pv63-receipts
Conflicts:
	ethcore/src/client/test_client.rs
2016-03-14 11:06:28 +01:00
Gav Wood
7320ad077f Merge remote-tracking branch 'origin/master' into targetgaslimit 2016-03-14 10:54:38 +01:00
Nikolay Volf
3eb08b0d61 fix tests and deuncommented 2016-03-14 10:53:37 +01:00
Gav Wood
dc8b9c3205 Fix build. 2016-03-14 10:48:32 +01:00
Nikolay Volf
829ed4d0a6 commented empty slice/vec comparison 2016-03-14 10:47:22 +01:00
Arkadiy Paronyan
acd39843d4 Merge pull request #715 from ethcore/rpc-personal-tests
Rpc personal tests
2016-03-14 10:31:01 +01:00
Arkadiy Paronyan
a1fe1a6136 Merge pull request #704 from ethcore/fixing_warnings
Fixing warnings
2016-03-14 10:28:28 +01:00
Arkadiy Paronyan
d5fa49376e Merge pull request #713 from ethcore/docoptclean
docopts cleanups
2016-03-14 10:26:38 +01:00
arkpar
d3c1b5455b Silenced UDP warnings 2016-03-14 10:25:04 +01:00
Nikolay Volf
8532f2dc2e removed tests that used fixedhash 2016-03-14 09:44:02 +01:00
Nikolay Volf
b4ba070619 Merge branch 'master' into master-version 2016-03-14 09:40:38 +01:00
Nikolay Volf
6827ff9319 [ci skip] fix tesh.sh 2016-03-14 09:38:44 +01:00
Gav Wood
7af0a1dc2c Missing comma. 2016-03-14 02:02:32 +01:00
Gav Wood
f6b7884a1d Allow configuration of target gas limit. 2016-03-14 02:00:22 +01:00
Arkadiy Paronyan
c53974f125 Merge pull request #717 from ethcore/build
Removed rocksdb build dependency
2016-03-14 01:58:15 +01:00
Gav Wood
8ad66875e5 Merge pull request #710 from ethcore/fix-discovery
Fixed splitting Neighbours packet
2016-03-14 01:32:13 +01:00
arkpar
7bc3c0b026 Removed rocksdb build dependency 2016-03-14 01:27:27 +01:00
Nikolay Volf
2117d363e2 new account test & fix 2016-03-14 01:06:42 +01:00
arkpar
9e7ff2c00e Version 1.1 2016-03-14 01:00:17 +01:00
Gav Wood
e792998d0a Merge remote-tracking branch 'origin/master' into fixing_warnings 2016-03-14 01:00:12 +01:00
Gav Wood
fe722419e7 Merge branch 'master' into fixing_warnings 2016-03-14 00:57:49 +01:00
Gav Wood
2d1a837a8b docopts cleanups.
one for @LefterisJP: 80-character line for docopts.
2016-03-14 00:52:31 +01:00
Nikolay Volf
1957a14961 personal tests setup 2016-03-14 00:48:43 +01:00
arkpar
615e03542e Use slice.chunks 2016-03-14 00:41:25 +01:00
arkpar
45c3600d5a Fixed splitting Neighbours packet 2016-03-13 23:20:26 +01:00
Gav Wood
97fe4fcab4 Merge pull request #701 from ethcore/sstore-key-exp
management of account expiration & memory
2016-03-13 23:19:49 +01:00
Gav Wood
3a019801d2 Merge pull request #708 from ethcore/docsfix
Remove EarlyMerge from user docs.
2016-03-13 23:15:45 +01:00
Gav Wood
8fd8f687ee Remove EarlyMerge from user docs. 2016-03-13 23:12:47 +01:00
Gav Wood
eb651b6462 Merge pull request #705 from ethcore/refcounteddb
Fixes and traces for refcountdb.
2016-03-13 23:07:58 +01:00
Gav Wood
5c964694b4 Merge pull request #706 from ethcore/fix-accountdb
Check for NULL_RLP in AccountDB
2016-03-13 22:29:19 +01:00
Gav Wood
26f41b711c Bring back batching. 2016-03-13 21:54:06 +01:00
Gav Wood
0ccb9df4f1 Merge remote-tracking branch 'origin/master' into rcdb 2016-03-13 21:43:41 +01:00
Tomasz Drwięga
fd834084f9 unknonw lint 2016-03-13 21:39:23 +01:00
Gav Wood
90d135e018 Merge pull request #700 from ethcore/merge_ethminer
ethminer as crate
2016-03-13 21:35:27 +01:00
arkpar
420f473f90 Check for NULL_RLP in AccountDB 2016-03-13 21:28:57 +01:00
Gav Wood
1be92ea8ef Fixes and traces for refcountdb. 2016-03-13 21:21:30 +01:00
Tomasz Drwięga
13df958f4a Fixing warnings 2016-03-13 21:14:00 +01:00
Tomasz Drwięga
4cf18c728d Fixing sync invalid sync test 2016-03-13 20:53:47 +01:00
Tomasz Drwięga
e2e067cdd0 Bumping clippy 2016-03-13 20:44:25 +01:00
Tomasz Drwięga
54ff64c0e0 Merge branch 'master' into merge_ethminer
Conflicts:
	parity/main.rs
2016-03-13 20:42:33 +01:00
Nikolay Volf
c5edf237b2 adding shrink-to-fit 2016-03-13 19:52:37 +01:00
Gav Wood
81291622eb Avoid batches for now. 2016-03-13 19:22:42 +01:00
Gav Wood
48df41a30a Merge pull request #692 from ethcore/refcounteddb
Old ref-counted DB code
2016-03-13 19:02:24 +01:00
Gav Wood
706c56f56a Usage of LATEST_ERA fixes for archive and ref-counted DBs. 2016-03-13 18:19:52 +01:00
Gav Wood
5107fc5897 Update options. 2016-03-13 18:09:44 +01:00
Gav Wood
ac655af091 Update overlaydb 2016-03-13 18:07:36 +01:00
Gav Wood
9e912c7c0d Add new file. 2016-03-13 18:07:10 +01:00
Gav Wood
6cedb263aa Add missing file. 2016-03-13 17:01:50 +01:00
Gav Wood
b4f7f220f1 Merge remote-tracking branch 'origin/master' into merge_ethminer 2016-03-13 16:35:52 +01:00
Nikolay Volf
e9f673e08d Merge pull request #699 from ethcore/rpc_tests
next batch of rpc tests and fixes
2016-03-13 16:03:27 +01:00
Nikolay Volf
809c239ff8 fix rev 2016-03-13 15:59:25 +01:00
Gav Wood
76696e3b49 Minor build fixes. 2016-03-13 15:36:03 +01:00
Gav Wood
08b9cc2c41 Merge changes from #674 into branch. 2016-03-13 15:29:55 +01:00
Nikolay Volf
a4f03100e9 registering timer 2016-03-13 15:11:16 +01:00
debris
6ee13b0000 implemented eth_getCompilers 2016-03-13 15:02:46 +01:00
Gav Wood
4a58e142bd Remove duplicate ciippys. 2016-03-13 15:02:08 +01:00
Gav Wood
02f43f2e8c Merge branch 'ethminer_crate' 2016-03-13 15:00:47 +01:00
debris
29c85e16cd added eth_sign and eth_sendRawTransaction to eth interface 2016-03-13 14:57:26 +01:00
Gav Wood
826928d2ba Merge branch 'master' of github.com:ethcore/parity 2016-03-13 14:55:17 +01:00
Nikolay Volf
735aa8ca17 Merge branch 'sstore-key-exp' into account-io 2016-03-13 14:46:49 +01:00
Nikolay Volf
89dc6fa9cc io handlers 2016-03-13 14:46:45 +01:00
debris
00820c342a fixed eth_getCode and added tests for it 2016-03-13 14:45:39 +01:00
debris
c2b3ba533b fixed eth_getTransactionCount**, and eth_getUncleCount** rpc methods, added tests for them 2016-03-13 14:37:33 +01:00
Marek Kotewicz
a4103e0830 Merge pull request #695 from ethcore/rpc_tests
implemented eth_geStorageAt rpc method, added more tests for rpc
2016-03-13 13:57:11 +01:00
Gav Wood
f0862acffe Merge branch 'master' of github.com:ethcore/parity 2016-03-13 13:13:23 +01:00
Gav Wood
4e8092b008 Merge pull request #690 from ethcore/fixjdb
Fix JournalDB era marker
2016-03-13 13:11:12 +01:00
Nikolay Volf
450ae4147f memory and expiration mngmt 2016-03-13 13:03:02 +01:00
Gav Wood
94932386e3 Merge pull request #685 from ethcore/sync
More sync fixes
2016-03-13 12:14:24 +01:00
debris
487ba9b08a implemented eth_storageAt rpc method, added more tests for rpc 2016-03-13 12:09:30 +01:00
arkpar
1131618630 Fixed test 2016-03-13 11:55:48 +01:00
Gav Wood
ead43eecd0 Merge pull request #694 from ethcore/heaviaze-key-tests
mark some key tests as heavy
2016-03-13 11:52:00 +01:00
arkpar
ff51d0fa67 Additional tests 2016-03-13 11:50:09 +01:00
Nikolay Volf
0f21779ec4 make heavy 2016-03-13 11:06:57 +01:00
arkpar
0a6fea1b77 Silenced some non-important warnings 2016-03-13 10:33:55 +01:00
Marek Kotewicz
70624f816a Merge pull request #693 from ethcore/network
Limit incoming connections
2016-03-13 10:11:42 +01:00
Marek Kotewicz
1f8e0f86ac Merge pull request #688 from ethcore/updating_clippy
Updating clippy
2016-03-13 10:07:44 +01:00
Marek Kotewicz
c9e54d8913 Merge pull request #691 from ethcore/rpc_tests
eth_accounts, eth_getBalance rpc functions && tests
2016-03-13 10:05:38 +01:00
Tomasz Drwięga
dac90992ad Merge branch 'master' into updating_clippy
Conflicts:
	Cargo.lock
	util/src/journaldb/overlayrecentdb.rs
2016-03-13 00:20:31 +01:00
debris
49dd666199 EthTester 2016-03-12 20:06:55 +01:00
arkpar
361280a9be Limit incoming connections 2016-03-12 19:52:37 +01:00
debris
e09de6ea3d added missing eth_getBalance rpc method and tests for it 2016-03-12 19:51:24 +01:00
Gav Wood
e7574d4516 Update lib.rs 2016-03-12 19:29:18 +01:00
Nikolay Volf
0684abd345 fixed to return receipts grouped by requested block 2016-03-12 19:23:17 +01:00
Gav Wood
e85a2f3804 Update main.rs
[noci]
2016-03-12 19:22:38 +01:00
debris
a9a1c80fac implemented eth_accounts, fixed personal_accounts, added test account provider, tests for eth_accounts 2016-03-12 19:21:08 +01:00
arkpar
707f67c6b4 Optional last era 2016-03-12 19:19:45 +01:00
Gav Wood
89986ec0e0 Update main.rs
[noci]
2016-03-12 19:19:16 +01:00
arkpar
0b4355d549 rocksdb version bump 2016-03-12 19:03:33 +01:00
Nikolay Volf
bd9cfb4ee5 Merge branch 'pv63-state' into pv63-receipts 2016-03-12 18:52:37 +01:00
Nikolay Volf
ade8b8356b Merge branch 'master' into pv63-state
Conflicts:
	ethcore/src/client/client.rs
2016-03-12 18:09:45 +01:00
arkpar
1ca7c35c19 Fix latest era marker 2016-03-12 17:30:46 +01:00
Arkadiy Paronyan
8ce073ed9a Merge pull request #683 from ethcore/jdb-state-queries
state query for archive jdb
2016-03-12 16:19:00 +01:00
arkpar
1e23a4c888 Don't redownload queued blocks on restart 2016-03-12 16:01:34 +01:00
arkpar
16618094f5 Cleanup header_ids 2016-03-12 16:01:34 +01:00
arkpar
1fe575bf7b Download bodies for validated hash chain only 2016-03-12 16:01:34 +01:00
arkpar
7ad7996144 Fixed common block detection 2016-03-12 16:01:34 +01:00
Arkadiy Paronyan
bf84aee5f6 Merge pull request #658 from ethcore/fixjdb
Fix for option 1 of JournalDB
2016-03-12 15:37:47 +01:00
Gav Wood
51275f79f8 Merge branch 'master' of github.com:ethcore/parity 2016-03-12 14:41:00 +01:00
Tomasz Drwięga
451a5d78e3 Removing unused (?) serde::Error 2016-03-12 13:40:39 +01:00
Tomasz Drwięga
19b6c74675 Two more warnings 2016-03-12 13:39:17 +01:00
Gav Wood
6c6d919eac Merge branch 'master' into fixjdb1 2016-03-12 12:16:08 +01:00
Gav Wood
98bae098be Update cargo lock. 2016-03-12 12:10:55 +01:00
Gav Wood
3250e36b4a Merge pull request #689 from ethcore/jdbrenames
Rename into something that is a little more descriptive.
2016-03-12 11:36:55 +01:00
Gav Wood
b03679e1a6 Fix typos. 2016-03-12 11:22:02 +01:00
Gav Wood
82a8810057 Rename into something that is a little more descriptive. 2016-03-12 11:19:42 +01:00
Gav Wood
d7039b72e2 Update archivedb.rs 2016-03-12 10:48:28 +01:00
Gav Wood
e1c0177932 Update main.rs 2016-03-12 10:44:48 +01:00
Tomasz Drwięga
65dadcc2a2 Adding todos 2016-03-12 10:44:24 +01:00
Tomasz Drwięga
c6dc6c0c41 One more warning 2016-03-12 10:41:35 +01:00
Tomasz Drwięga
d0f7555348 Merge branch 'master' into updating_clippy
Conflicts:
	util/src/journaldb/archivedb.rs
2016-03-12 10:40:22 +01:00
Gav Wood
9424d53062 Update lib.rs 2016-03-12 10:37:27 +01:00
Tomasz Drwięga
4fc8a8d5cd Merge branch 'updating_clippy' of github.com:ethcore/parity into updating_clippy 2016-03-12 10:29:51 +01:00
Tomasz Drwięga
4b6e1dd4d2 Fixing warnings 2016-03-12 10:25:51 +01:00
Tomasz Drwięga
3ea52c2324 Merge branch 'master' into ethminer_crate
Conflicts:
	parity/main.rs
2016-03-12 10:22:43 +01:00
Tomasz Drwięga
c133a2fd35 Fixing warnings 2016-03-12 10:07:55 +01:00
Tomasz Drwięga
e10457d235 Bumping clippy 2016-03-12 10:06:50 +01:00
Gav Wood
88e23fcb9a Merge pull request #634 from ethcore/jdb_option2
JournalDB with in-memory overlay (option2)
2016-03-12 10:01:17 +01:00
Gav Wood
874393ba06 Fix tests, 2016-03-12 09:57:57 +01:00
Gav Wood
e6a273f3a7 Fix tests. 2016-03-12 09:53:54 +01:00
Gav Wood
12e1abdfb7 Port fixes to new infrastrtcutre. 2016-03-12 09:51:17 +01:00
Tomasz Drwięga
aebc91d96f Merge branch 'master' into ethminer_crate
Conflicts:
	Cargo.toml
	rpc/Cargo.toml
	sync/Cargo.toml
2016-03-12 09:50:18 +01:00
Tomasz Drwięga
05ff8a0b94 Merge branch 'ethminer_crate' of github.com:ethcore/parity into ethminer_crate 2016-03-12 00:05:21 +01:00
Tomasz Drwięga
7cfe1d258b Adding more detailed logging 2016-03-11 23:49:32 +01:00
Nikolay Volf
fb51ac0d95 blockchain receipts rlp generation 2016-03-11 23:33:01 +01:00
Arkadiy Paronyan
1031ce641d Merge pull request #682 from ethcore/additional_sstore_test
additional (failing) SecretStore test
2016-03-11 22:45:43 +01:00
arkpar
896ba57555 Merge branch 'master' of github.com:ethcore/parity into jdb_option2 2016-03-11 22:43:59 +01:00
Nikolay Volf
0c9c97fcb9 Merge pull request #670 from ethcore/updating_clippy
Updating clippy & fixing warnings.
2016-03-11 23:57:06 +03:00
Marek Kotewicz
e6aba74726 Merge pull request #681 from ethcore/jsonrpc_tests
rpc web3 tests
2016-03-11 20:53:13 +01:00
Marek Kotewicz
9e23a0c240 Merge pull request #677 from ethcore/personal-rpc-cli
Making personal json-rpc configurable via cli
2016-03-11 20:52:58 +01:00
Nikolay Volf
19f23f8445 increasing history to be useful for geth fast sync 2016-03-11 23:37:47 +04:00
Nikolay Volf
349584772b redundant lines 2016-03-11 23:34:18 +04:00
Nikolay Volf
da6f6d57cd state data query to client 2016-03-11 23:24:44 +04:00
Nikolay Volf
e970dd4530 client state data func 2016-03-11 23:09:14 +04:00
Nikolay Volf
b1327a045f fixed new account generation 2016-03-11 22:47:12 +04:00
debris
90e20cbcad additional (failing) sstore test 2016-03-11 20:08:01 +01:00
Marek Kotewicz
cd835e88fc Merge pull request #661 from ethcore/rpc_pending_filter
RPC Pending Transactions Filter
2016-03-11 19:40:35 +01:00
Tomasz Drwięga
fadbc61dff Merge branch 'ethminer_crate' into rpc_pending_filter
Conflicts:
	miner/src/miner.rs
	parity/main.rs
2016-03-11 19:27:09 +01:00
Tomasz Drwięga
c3a79c1478 Merge branch 'master' into ethminer_crate
Conflicts:
	ethcore/src/client/client.rs
	parity/main.rs
	sync/src/chain.rs
	sync/src/lib.rs
2016-03-11 19:22:40 +01:00
Tomasz Drwięga
f724cab92d Merge branch 'master' into updating_clippy
Conflicts:
	ethcore/src/lib.rs
	sync/src/chain.rs
	sync/src/lib.rs
	util/src/keys/store.rs
	util/src/lib.rs
2016-03-11 19:17:09 +01:00
Nikolay Volf
1e40997ff7 state query for archive jdb 2016-03-11 22:15:56 +04:00
Arkadiy Paronyan
c9f5a9bc9a Merge pull request #678 from ethcore/reorgjdb
Rearrange journaldb infrastructure to make more extensible
2016-03-11 18:47:19 +01:00
Nikolay Volf
03a4f9e268 Merge pull request #673 from ethcore/boxjdb
JournalDB -> Box<JournalDB>, and it's a trait.
2016-03-11 20:03:39 +03:00
Nikolay Volf
08b4488ef3 Merge branch 'master' into personal-rpc-cli
Conflicts:
	parity/main.rs
2016-03-11 20:54:18 +04:00
Nikolay Volf
eaf22198e2 Merge pull request #676 from ethcore/fix-tx-warnings
fix warning for transaction_queue.add usage
2016-03-11 19:48:05 +03:00
Nikolay Volf
87fb0b31eb Merge branch 'master' into reorgjdb 2016-03-11 20:05:41 +04:00
Tomasz Drwięga
9f19d2993c Merge branch 'master' into ethminer_crate
Conflicts:
	util/bigint/src/uint.rs
2016-03-11 16:24:52 +01:00
debris
c6ba378b6b rpc web3 tests 2016-03-11 16:17:09 +01:00
Arkadiy Paronyan
5d3ead91e2 Merge pull request #680 from ethcore/uint_mem
Adding std::mem back (only for asm)
2016-03-11 16:16:21 +01:00
Nikolay Volf
9b28e04b85 Merge pull request #679 from ethcore/master-readme-update
update readme to exclude beta step (stable is ok)
2016-03-11 18:11:25 +03:00
Nikolay Volf
89dbc2ac25 [ci skip] update readme to exclude beta spec (stable is ok) 2016-03-11 18:08:29 +03:00
Tomasz Drwięga
179569f9f8 Adding std::mem back 2016-03-11 16:01:18 +01:00
Tomasz Drwięga
0dbe6684ad adding std::mem 2016-03-11 15:58:12 +01:00
Tomasz Drwięga
9c92d601b1 Merge branch 'master' into ethminer_crate
Conflicts:
	rpc/src/v1/impls/eth.rs
2016-03-11 15:56:30 +01:00
Nikolay Volf
04af38bb0d fix test compilation 2016-03-11 18:54:28 +04:00
Nikolay Volf
fcc0432856 Merge pull request #675 from ethcore/rpc_unit_tests
fixed U256 and transaction request deserialization
2016-03-11 17:25:13 +03:00
Gav Wood
5499f4530c Fix tests. 2016-03-11 15:01:15 +01:00
Tomasz Drwięga
b458452f0e TestSyncProvider fixes 2016-03-11 14:57:17 +01:00
Tomasz Drwięga
36ff65d050 Fixing warnings 2016-03-11 14:53:03 +01:00
Tomasz Drwięga
197ea7f7d6 Using miner in rpc instead of sync 2016-03-11 14:51:07 +01:00
Nikolay Volf
8d67316ece Merge branch 'master' into reorgjdb
Conflicts:
	parity/main.rs
2016-03-11 17:41:04 +04:00
Gav Wood
8ae103087d Fixups for new API. 2016-03-11 15:07:43 +01:00
Gav Wood
cfe3b07130 Merge branch 'boxjdb' into reorgjdb 2016-03-11 15:03:43 +01:00
Gav Wood
38d470f3bc Reorganise command line options into more general engine. 2016-03-11 14:45:19 +01:00
Tomasz Drwięga
03da6c991f Merge branch 'master' into ethminer_crate
Conflicts:
	Cargo.lock
	Cargo.toml
	ethcore/src/client/client.rs
	hook.sh
	parity/main.rs
	rpc/Cargo.toml
	rpc/src/v1/impls/eth.rs
	sync/Cargo.toml
	sync/src/tests/helpers.rs
2016-03-11 14:37:07 +01:00
Gav Wood
7e8b6c3660 Merge branch 'boxjdb' into reorgjdb 2016-03-11 14:06:32 +01:00
Nikolay Volf
22d1def894 Merge pull request #666 from ethcore/moregethcli
More geth compatibility.
2016-03-11 16:05:27 +03:00
Gav Wood
b25551be7b Merge pull request #671 from ethcore/clippy_hook
Removing running clippy by default on nightly.
2016-03-11 14:03:16 +01:00
Marek Kotewicz
176b9a992d Merge pull request #667 from ethcore/rpc_tests
rpc net submodule tests
2016-03-11 13:58:32 +01:00
Gav Wood
51cfd4b0ea Remove unneeded clone. 2016-03-11 13:58:11 +01:00
debris
ecd33a6093 fixed U256 and transaction request deserialization, added tests for transaction request 2016-03-11 13:54:52 +01:00
Gav Wood
4771fdf0fb Rearrange journaldb infrastructure. 2016-03-11 13:50:39 +01:00
Gav Wood
2a856a13f0 Obvious typo fix. 2016-03-11 13:21:53 +01:00
Gav Wood
d71c5d4c17 Place Sync/Send in trait. 2016-03-11 13:19:10 +01:00
Nikolay Volf
d3f83ad7be Merge branch 'master' into personal-rpc-cli 2016-03-11 16:05:22 +04:00
Nikolay Volf
99c5794929 fix warning for transaction_queue.add usage 2016-03-11 16:00:30 +04:00
Gav Wood
e461916f5a Merge remote-tracking branch 'origin/master' into boxjdb 2016-03-11 12:56:33 +01:00
Gav Wood
756f964130 JournalDB -> Box<JournalDB>, and it's a trait. 2016-03-11 12:54:48 +01:00
Nikolay Volf
70ee6aa942 refactoring to use generic account provider as web3 svc 2016-03-11 15:50:13 +04:00
Nikolay Volf
ed0047725c adding cli extension 2016-03-11 15:49:49 +04:00
debris
1554d5adef Merge branch 'master' into rpc_tests 2016-03-11 12:32:08 +01:00
debris
d1fa292956 Merge branch 'master' into rpc_unit_tests 2016-03-11 12:31:56 +01:00
debris
190630cc6b separated transaction_request to its own submodule, added basic tests for it 2016-03-11 12:31:45 +01:00
Tomasz Drwięga
dd2fb4df67 Storing BlockNumber & transactions directly in enum 2016-03-11 12:31:42 +01:00
Nikolay Volf
62e94e1744 Merge pull request #665 from ethcore/client_submodules
Client module overhaul
2016-03-11 14:28:30 +03:00
arkpar
8f54c24e47 Merged changes from jdb_option1, keep LATEST_ERA from decreasing 2016-03-11 11:52:11 +01:00
Tomasz Drwięga
2fd036b073 Merge branch 'ethminer_crate' into rpc_pending_filter
Conflicts:
	rpc/src/v1/helpers/poll_manager.rs
	rpc/src/v1/impls/eth.rs
2016-03-11 11:44:44 +01:00
debris
68a13973a4 fixed ethcore-rpc tests build after merge 2016-03-11 11:42:24 +01:00
Tomasz Drwięga
55a14b3aaf Fixing transaction queue test 2016-03-11 11:40:12 +01:00
Tomasz Drwięga
eb8e92c37f Cargo.lock 2016-03-11 11:18:38 +01:00
debris
389d17974e Merge branch 'client_submodules' into rpc_tests 2016-03-11 11:17:28 +01:00
debris
ebd2a92267 Merge branch 'master' of github.com:ethcore/parity into client_submodules 2016-03-11 11:17:08 +01:00
Tomasz Drwięga
d84e008e00 Removing superflous check for nightly 2016-03-11 11:16:49 +01:00
Marek Kotewicz
fd39975cf0 Merge pull request #587 from ethcore/rpc-signing-extend
Rpc transaction signing
2016-03-11 11:14:17 +01:00
Marek Kotewicz
eb2171e287 Merge pull request #652 from ethcore/tx_queue_rpc
Transaction queue exposed via JSON rpc.
2016-03-11 11:08:16 +01:00
debris
7ea53d39e6 Merge branch 'client_submodules' into rpc_tests 2016-03-11 11:05:25 +01:00
Tomasz Drwięga
a8a21da9ba Updating hook and removing running clippy from dev-dependencies 2016-03-11 11:05:20 +01:00
debris
bfac5f9238 Merge branch 'master' of github.com:ethcore/parity into client_submodules 2016-03-11 11:03:52 +01:00
debris
18939462c3 sync_provider function 2016-03-11 11:03:43 +01:00
Marek Kotewicz
8d6ea3a0ef Merge pull request #499 from ethcore/thread
Remove unneeded locking
2016-03-11 10:59:21 +01:00
Tomasz Drwięga
8709dd28f8 Fixing clippy warnings 2016-03-11 10:58:51 +01:00
Tomasz Drwięga
3a4a7ac822 Bumping clippy version 2016-03-11 10:35:26 +01:00
Tomasz Drwięga
5b204a5ff5 Merge branch 'master' into ethminer_crate
Conflicts:
	parity/main.rs
	rpc/src/v1/impls/eth.rs
	sync/src/lib.rs
2016-03-11 10:31:07 +01:00
debris
3479a9bf95 Merge branch 'client_submodules' into rpc_tests 2016-03-11 10:30:46 +01:00
debris
a6d268db16 fixed missing reexport 2016-03-11 10:30:13 +01:00
debris
8e52510dbb implemented net_listening method 2016-03-11 10:21:25 +01:00
Tomasz Drwięga
3bbdc03d0c Fixing doctest. 2016-03-11 10:17:51 +01:00
debris
34a120e127 net tests 2016-03-11 10:17:20 +01:00
Gav Wood
d9c462a3d3 Use proper listen address. Tidyups. 2016-03-11 10:05:27 +01:00
Gav Wood
4c757997f6 Merge remote-tracking branch 'origin/master' into moregethcli 2016-03-10 21:41:29 +01:00
Gav Wood
29916edb91 More geth compatibility. 2016-03-10 21:36:45 +01:00
debris
87dd42f7bc Merge branch 'master' of github.com:ethcore/parity into client_submodules 2016-03-10 21:17:58 +01:00
arkpar
06a3abd01e Removed unused return type 2016-03-10 21:15:43 +01:00
arkpar
8785bd37e8 Merge branch 'master' of github.com:ethcore/parity into jdb_option2 2016-03-10 21:06:21 +01:00
arkpar
5f37f6edb4 Correct cache update order 2016-03-10 21:01:17 +01:00
debris
c5c8851b50 moved TestBlockChainClient to ethcore 2016-03-10 20:27:50 +01:00
Nikolay Volf
a2dea3885b refactoring to AccountService 2016-03-10 23:09:45 +04:00
Gav Wood
84a48142de Add more geth options. 2016-03-10 19:50:04 +01:00
Nikolay Volf
a207b6a17e Merge pull request #664 from ethcore/sync-provider
extend sync status interface to sync provider
2016-03-10 21:18:41 +03:00
Nikolay Volf
47aacbb819 work is in progress 2016-03-10 21:56:02 +04:00
Nikolay Volf
2a24bb7cc6 Merge pull request #663 from ethcore/archive_default
--archive is default. --pruning is option.
2016-03-10 20:48:04 +03:00
arkpar
a6b5aad8c9 Merge branch 'master' of github.com:ethcore/parity into thread 2016-03-10 18:40:17 +01:00
Nikolay Volf
25a63611f8 extend sync status interface to sync provider 2016-03-10 20:32:17 +04:00
Nikolay Volf
5571503c22 traitified secret store 2016-03-10 20:18:01 +04:00
Gav Wood
c951dee766 --archive is default. --pruning is option. 2016-03-10 17:09:34 +01:00
Tomasz Drwięga
0eaf0a8db1 Updating hook. 2016-03-10 16:40:57 +01:00
Tomasz Drwięga
92022ac14d Merge branch 'master' into ethminer_crate
Conflicts:
	ethcore/src/client.rs
	parity/main.rs
	rpc/src/v1/impls/eth.rs
	sync/src/chain.rs
2016-03-10 16:38:58 +01:00
Nikolay Volf
094ae4e9f9 personal is back to the master ver 2016-03-10 19:15:10 +04:00
Nikolay Volf
3b21a5f54c Merge branch 'master' into rpc-signing-extend
Conflicts:
	parity/main.rs
2016-03-10 19:08:41 +04:00
Tomasz Drwięga
c37370a8a7 PendingTransaction filter. 2016-03-10 16:04:59 +01:00
Gav Wood
8dd41bfe0c Merge pull request #641 from ethcore/jsonrpc_interfaces
jsonrpc uses client and sync interfaces
2016-03-10 15:44:05 +01:00
Tomasz Drwięga
9741d48496 Transaction data associated with polls. 2016-03-10 15:35:36 +01:00
Gav Wood
5764ec5ddc Merge pull request #609 from ethcore/tx-rpc-expose
Expose transaction insertion in sync lib
2016-03-10 15:28:43 +01:00
Gav Wood
29ddf34d6d Merge pull request #660 from ethcore/poll_get
Removing get prefix from poll_info
2016-03-10 15:24:09 +01:00
Tomasz Drwięga
9ea3c0eba0 Fixing compilation on beta & stable 2016-03-10 15:20:54 +01:00
Tomasz Drwięga
027f122aea Removing get prefix from poll_info 2016-03-10 14:24:33 +01:00
Tomasz Drwięga
9db4720162 Fixing clippy warnings. 2016-03-10 14:15:47 +01:00
Tomasz Drwięga
0535fb30c6 Merge branch 'master' into ethminer_crate
Conflicts:
	sync/src/lib.rs
2016-03-10 14:03:09 +01:00
Gav Wood
4cfcaf8521 Merge pull request #657 from ethcore/tx_queue_update_height_bug
Tx queue update height bug
2016-03-10 13:20:00 +01:00
Gav Wood
f708d36fad Merge pull request #651 from ethcore/tx_queue_integration
Tx_queue_docs -> To master
2016-03-10 13:19:40 +01:00
Gav Wood
16e12b1ae5 Merge pull request #645 from ethcore/import_route
blockchain import_route
2016-03-10 13:14:56 +01:00
Gav Wood
1a28e9297c Merge pull request #655 from ethcore/io
Stop workers before stopping event loop
2016-03-10 12:53:00 +01:00
Tomasz Drwięga
eb1fab9202 Adding clippy support to ethminer. 2016-03-10 12:33:29 +01:00
Tomasz Drwięga
2e72173620 Merge branch 'master' into ethminer_crate
Conflicts:
	Cargo.lock
	Cargo.toml
	hook.sh
	miner/src/transaction_queue.rs
	rpc/Cargo.toml
	sync/Cargo.toml
	sync/src/chain.rs
2016-03-10 12:25:36 +01:00
debris
6681aaf76a split client into few submodules 2016-03-10 11:32:10 +01:00
Tomasz Drwięga
d4e7eafede Merge branch 'master' into tx_queue_integration
Conflicts:
	sync/src/transaction_queue.rs
2016-03-10 11:23:39 +01:00
Tomasz Drwięga
6d0578e19c Additional explanation for ordering of commit/insert_block 2016-03-10 11:16:54 +01:00
Tomasz Drwięga
0cf405527e Fixing update height bug 2016-03-10 11:14:25 +01:00
Gav Wood
99e577ad2f Merge pull request #650 from ethcore/tx_queue_validation
Validate sender before importing to queue
2016-03-10 11:14:22 +01:00
Tomasz Drwięga
276768a826 Failing test case for #656 2016-03-10 11:11:59 +01:00
Gav Wood
cd37fa7cb5 Merge pull request #640 from ethcore/tx_queue_min_gas
Gas price threshold for transactions
2016-03-10 11:09:09 +01:00
Gav Wood
90ae7500da Update main.rs 2016-03-10 11:07:10 +01:00
Gav Wood
249a89fc2d Merge pull request #627 from ethcore/clippy-dev
`dev` feature enabled when compiling without `--release`
2016-03-10 11:05:56 +01:00
arkpar
ff12b53ba6 Stop workers before stopping event loop 2016-03-10 10:40:16 +01:00
Nikolay Volf
a2046b429f exposing only one func 2016-03-10 13:27:33 +04:00
debris
190a2c3b35 Merge branch 'master' of github.com:ethcore/parity into import_route 2016-03-10 10:17:44 +01:00
debris
0a7cda09ff changed route name to enacted and retracted 2016-03-10 10:17:17 +01:00
Tomasz Drwięga
02b7e7698a Breaking couple of lines to keep number of characters below limit 2016-03-10 10:09:55 +01:00
Tomasz Drwięga
ca2cf8e591 Lowering minimal gas price 2016-03-10 10:05:51 +01:00
Tomasz Drwięga
cc47c80243 Merge branch 'master' into tx_queue_rpc 2016-03-10 09:44:46 +01:00
Tomasz Drwięga
2f9b955210 Merge branch 'master' into ethminer_crate
Conflicts:
	parity/main.rs
2016-03-10 09:39:26 +01:00
Tomasz Drwięga
9f77a85491 Fixing compilation on nightly 2016-03-10 09:35:46 +01:00
Tomasz Drwięga
878e38c0cf Fixing deps again 2016-03-10 09:33:25 +01:00
Tomasz Drwięga
c3803807a9 Merge pull request #648 from ethcore/bq-fix
Don't call mark_as_bad needlessly
2016-03-10 09:28:26 +01:00
Tomasz Drwięga
6864a08000 Merge branch 'master' into tx_queue_validation 2016-03-10 09:26:57 +01:00
Tomasz Drwięga
3c1888c26a Fixing deps 2016-03-10 09:26:04 +01:00
debris
4750d2f667 Merge branch 'master' into import_route 2016-03-10 01:04:05 +01:00
Gav Wood
2ecad23fab Merge pull request #647 from ethcore/sync
Fixed sync handling large forks
2016-03-10 00:53:20 +01:00
Gav Wood
204d31a056 Merge pull request #631 from ethcore/tx_queue_docs
Additional documentation for transaction queue
2016-03-10 00:45:30 +01:00
Gav Wood
50c8d7f633 Merge pull request #607 from ethcore/tx_queue_integration
Transaction Queue Integration
2016-03-10 00:45:07 +01:00
Gav Wood
ac42045155 Merge pull request #639 from ethcore/keys-cli
Keys cli
2016-03-10 00:25:01 +01:00
Nikolay Volf
ddc3440712 Merge branch 'master' into tx-rpc-expose
Conflicts:
	sync/src/chain.rs
2016-03-10 03:22:32 +04:00
arkpar
84a741d0f9 Don't call mark_as_bad needlessly 2016-03-10 00:21:07 +01:00
debris
f397fb210f fixed typo 2016-03-10 00:11:35 +01:00
Nikolay Volf
663eec8a76 Merge branch 'master' into tx-rpc-expose 2016-03-10 03:03:27 +04:00
arkpar
d7e729a4ea Fixed sync handling large forks 2016-03-09 23:55:56 +01:00
Nikolay Volf
0f056f3abb Merge branch 'master' into clippy-dev
Conflicts:
	Cargo.toml
2016-03-10 02:45:53 +04:00
Arkadiy Paronyan
095a397d7c Merge pull request #643 from ethcore/fix-warning
fix build warning
2016-03-09 21:56:38 +01:00
debris
8b042ac875 blockchain import_route 2016-03-09 21:55:23 +01:00
Marek Kotewicz
abeb50bd08 Merge pull request #642 from ethcore/jsonrpc_update
updated jsonrpc-core and http-server libs
2016-03-09 20:46:49 +01:00
Nikolay Volf
accc1db43f chaning docopt config a bit 2016-03-09 23:39:36 +04:00
Nikolay Volf
8a83e27d6a cfg-test for noop verifier 2016-03-09 22:55:41 +04:00
arkpar
c302fa9a4e Style 2016-03-09 18:37:44 +01:00
debris
423dd7e0a9 updated jsonrpc-core and http-server libs 2016-03-09 18:04:13 +01:00
debris
082a4d9078 jsonrpc uses client and sync interfaces as a preparetion for jsonrpc tests 2016-03-09 17:31:43 +01:00
Tomasz Drwięga
02b23d3deb Merge pull request #638 from ethcore/jsonrpc_panic_handle
jsonrpc panics gracefully shutdown client
2016-03-09 17:16:02 +01:00
Nikolay Volf
7ff4d14544 adding return to if branch 2016-03-09 19:27:44 +04:00
Nikolay Volf
f49e32cc79 Merge branch 'master' into keys-cli 2016-03-09 19:20:17 +04:00
debris
bcb9b0e457 wait_for_exit takes only one input param, which is PanicHandler 2016-03-09 15:32:27 +01:00
Tomasz Drwięga
3c0587b375 Merge branch 'ethminer_crate' into tx_queue_min_gas 2016-03-09 15:27:27 +01:00
Tomasz Drwięga
3d74e5bd47 Fixing doctest 2016-03-09 15:27:07 +01:00
Tomasz Drwięga
493c61f09d Minimal gas price threshold. Closes: #636 2016-03-09 15:22:11 +01:00
Tomasz Drwięga
363de973c9 Adding documentation and ditching EthMiner 2016-03-09 14:26:28 +01:00
Nikolay Volf
6ad0ba8fe2 basic commands 2016-03-09 17:11:15 +04:00
debris
3655354980 Merge branch 'master' into jsonrpc_panic_handle 2016-03-09 13:46:08 +01:00
Tomasz Drwięga
9d664336b5 Tratifying Miner 2016-03-09 13:30:59 +01:00
Tomasz Drwięga
5db84c3233 Adding transactions to block 2016-03-09 13:09:34 +01:00
Tomasz Drwięga
79d2beb42a Same bug in full_mul 2016-03-09 11:50:35 +01:00
debris
a1640dcf72 jsonrpc panic handle 2016-03-09 11:38:53 +01:00
Tomasz Drwięga
9c714688cd Merge branch 'uint_opt' of github.com:ethcore/parity into uint_opt 2016-03-09 11:32:39 +01:00
Tomasz Drwięga
b3fc16ed9a Fixing bug in multiplication implementation 2016-03-09 11:32:23 +01:00
Tomasz Drwięga
f84d40734d Validating sender before importing to queuue 2016-03-09 10:26:51 +01:00
Tomasz Drwięga
e92ee1c0ea Merge branch 'master' into tx_queue_integration 2016-03-09 09:27:20 +01:00
Tomasz Drwięga
389779d86c Updating benchmarks to avoid inlining/optimizing 2016-03-09 00:05:47 +01:00
arkpar
a069e890ba Replaced --archive option with --pruning 2016-03-08 19:14:43 +01:00
arkpar
d31aa05847 Merge branch 'master' of github.com:ethcore/parity into jdb_option2 2016-03-08 18:40:21 +01:00
Arkadiy Paronyan
798c348d0e Merge pull request #633 from ethcore/fixing_docopt
Fixing CLI parameters
2016-03-08 18:36:02 +01:00
arkpar
ca7d3b91d0 Merge branch 'master' of github.com:ethcore/parity into jdb_option2 2016-03-08 18:35:25 +01:00
Tomasz Drwięga
b2fc077f8c Fixing CLI parameters 2016-03-08 16:42:33 +01:00
Tomasz Drwięga
49f1834ffb Fixing travis yml whitespace 2016-03-08 16:40:35 +01:00
Tomasz Drwięga
9acb36af87 Fixing tests compilation. Removing ethminer dependency on client 2016-03-08 16:23:32 +01:00
Tomasz Drwięga
84444c697c Adding ethminer to dev/ci files 2016-03-08 15:53:12 +01:00
Tomasz Drwięga
99a6802b61 Moving block sealing and transaction_queue to separate create 2016-03-08 15:46:44 +01:00
Tomasz Drwięga
799d3bd2c8 Fixing doc test for queue 2016-03-08 12:42:32 +01:00
Tomasz Drwięga
655bb0ed5d Additional documentation for transaction queue 2016-03-08 12:36:06 +01:00
Tomasz Drwięga
c47209e9bf Using better subtraction when optimizations are enabled 2016-03-08 12:09:04 +01:00
Tomasz Drwięga
1184679d23 Merge branch 'tx_queue_integration' into tx_queue_rpc 2016-03-08 10:17:01 +01:00
Tomasz Drwięga
f973610b38 Merge branch 'master' into tx_queue_integration 2016-03-08 10:15:11 +01:00
Tomasz Drwięga
9ae2341ba9 Couple of more aggresive optimizations 2016-03-08 10:05:46 +01:00
Tomasz Drwięga
17b2d2a2d7 Implementing mul and full_mul 2016-03-08 01:20:16 +01:00
Gav Wood
9780897fc7 Merge pull request #628 from ethcore/gethcli
Normal CLI options with geth.
2016-03-07 23:35:40 +01:00
Tomasz Drwięga
76865694ce Subtraction optimization 2016-03-07 19:03:29 +01:00
Tomasz Drwięga
c5840be1cb Small improvements 2016-03-07 18:36:17 +01:00
Tomasz Drwięga
e7be3c5378 Simplifing mul_u32 and add carry 2016-03-07 17:09:19 +01:00
Tomasz Drwięga
cc0adf5442 Optimizing and simplifying add and shl 2016-03-07 17:06:08 +01:00
Tomasz Drwięga
4717be07d6 Optimizing mul_u32 2016-03-07 16:45:50 +01:00
Tomasz Drwięga
0fd52176dc Fixing tests in bigint and util 2016-03-07 16:28:51 +01:00
arkpar
57485a73ec Merge branch 'master' into thread 2016-03-07 15:10:15 +01:00
Tomasz Drwięga
ab42ec8c81 Removing unneeded lifetime 2016-03-07 14:40:39 +01:00
Tomasz Drwięga
b61c0397bc removing unused variable 2016-03-07 14:36:38 +01:00
Tomasz Drwięga
69db469d39 Merge branch 'master' into clippy-dev
Conflicts:
	util/src/journaldb.rs
2016-03-07 14:35:42 +01:00
Tomasz Drwięga
cbc2c0cf0c Fixing clippy warnings. When building on nightly it is required to enable clippy 2016-03-07 14:34:17 +01:00
Gav Wood
f601975701 Merge pull request #626 from ethcore/network
Do not remove the peer immediatelly on send error
2016-03-07 12:31:32 +01:00
Gav Wood
ec3698066b Normal CLI options with geth.
Support node identity.
Support fine-grained JSONRPC API enabling.
2016-03-07 12:21:11 +01:00
Tomasz Drwięga
e83f856104 Merging chain_blocks_verified to chain_new_blocks 2016-03-07 12:16:37 +01:00
Tomasz Drwięga
3153d12bd9 feature enabled when compiling without --release 2016-03-07 11:40:44 +01:00
arkpar
58721475ff Do not remove the peer immediatelly on send error 2016-03-07 11:34:07 +01:00
Gav Wood
f9e93d594b Merge pull request #622 from ethcore/jsonrpc_block_behind
Jsonrpc block behind
2016-03-07 11:00:56 +01:00
Arkadiy Paronyan
92e18a79ea Merge pull request #624 from ethcore/killspam
Remove println!s.
2016-03-07 10:58:50 +01:00
Gav Wood
72016196cd Remove println!s. 2016-03-07 10:56:39 +01:00
debris
bcae4f6e7b fixed jsonrpc reporting current block is one less than actuall, fixed #612 2016-03-07 10:30:19 +01:00
Tomasz Drwięga
b0ac103900 Merge branch 'master' into tx_queue_integration 2016-03-07 09:54:07 +01:00
Gav Wood
318e7e9e04 Merge pull request #613 from ethcore/jdb_option1
JournalDB option 1 fix
2016-03-07 09:38:50 +01:00
debris
0da2ec1c0a Merge branch 'master' of github.com:ethcore/parity 2016-03-07 09:35:31 +01:00
Gav Wood
4d1effb008 Fix tests. 2016-03-07 09:10:02 +01:00
Gav Wood
73207c2355 Revert accidental beta regressions. 2016-03-07 08:01:14 +01:00
Gav Wood
fd87633db6 Remove superfluous LATEST_KEY write. 2016-03-07 07:57:50 +01:00
Arkadiy Paronyan
7e9f13750f Merge pull request #611 from ethcore/network
Network tracing cleanup
2016-03-07 07:44:49 +01:00
arkpar
744c4c7d8b JournalDB documentation 2016-03-07 07:06:55 +01:00
Gav Wood
0980c7130a Fix replay_keys
Counters should never have an entry with zero value.
2016-03-07 06:58:43 +01:00
Gav Wood
4230fdfffe More veriosning fixups. 2016-03-06 22:43:21 +01:00
Gav Wood
bc2fb14b5d Add memory usage reports.
Update to be similar to master.
2016-03-06 22:39:04 +01:00
Gav Wood
bfd882c7e0 Fix warnings. 2016-03-06 22:05:12 +01:00
Gav Wood
51c95d4d67 Implement option 1. 2016-03-06 21:57:55 +01:00
arkpar
d77d9ad9d8 JournalDB with history overlay 2016-03-06 19:57:00 +01:00
Tomasz Drwięga
c49258e866 Merge branch 'tx_queue_integration' into tx_queue_rpc 2016-03-06 11:15:16 +01:00
Tomasz Drwięga
e91de78528 Renaming back bad as retracted 2016-03-06 11:12:02 +01:00
Tomasz Drwięga
64b5e23ba5 Merge branch 'tx_queue_integration' of github.com:ethcore/parity into tx_queue_integration 2016-03-06 11:05:13 +01:00
Tomasz Drwięga
aaf2e0c3fb Locking outside of loop 2016-03-06 11:04:24 +01:00
arkpar
003d1fd0cc Network tracing improvements 2016-03-05 23:32:38 +01:00
Nikolay Volf
ad81356683 fix namespace 2016-03-06 00:48:00 +03:00
Nikolay Volf
e100ecbeac exposing in lib 2016-03-05 23:47:28 +03:00
Nikolay Volf
57e6e1e1b5 [ci ship] redundant lines 2016-03-05 20:15:19 +03:00
Tomasz Drwięga
3f493ab118 Merge branch 'tx_queue_integration' into tx_queue_rpc 2016-03-05 17:46:45 +01:00
Tomasz Drwięga
4a53d62be4 Fixing inconsistency when replacing transactions in queue 2016-03-05 17:41:35 +01:00
Tomasz Drwięga
18cbea394d Small renaming 2016-03-05 17:14:48 +01:00
Tomasz Drwięga
c13afcf404 Removing assertion and just comparing fees 2016-03-05 17:06:04 +01:00
Tomasz Drwięga
ae1c1b918f Fixing compilation 2016-03-05 16:51:01 +01:00
Tomasz Drwięga
67f2bc40e6 Merge remote-tracking branch 'origin/tx_queue_integration' into tx_queue_rpc 2016-03-05 16:49:13 +01:00
Tomasz Drwięga
8915974cf0 Fixing compilation 2016-03-05 16:48:03 +01:00
Tomasz Drwięga
cc3839ae57 Revert "Revert "Transaction Queue integration""
This reverts commit d330f0b7b7.

Conflicts:
	sync/src/transaction_queue.rs
2016-03-05 16:46:04 +01:00
Tomasz Drwięga
5ac7b9f812 Merge branch 'master' into tx_queue_integration
Conflicts:
	sync/src/transaction_queue.rs
2016-03-05 16:44:35 +01:00
Tomasz Drwięga
0a7fc4af73 Recalculating heights in future when removing transaction 2016-03-05 16:42:34 +01:00
Nikolay Volf
bb8a79f18c finalizing 2016-03-05 18:29:01 +03:00
Tomasz Drwięga
6afa1c85b7 Replacing transactions instead of just inserting 2016-03-05 16:20:41 +01:00
Tomasz Drwięga
765d7179f5 Failing tests for transaction queue 2016-03-05 15:43:04 +01:00
Nikolay Volf
1aaae7b553 [ci skip] codegen bug 2016-03-05 16:42:02 +03:00
Tomasz Drwięga
78a39d3ac9 Avoid importing same transaction twice (especially with different nonce_height) 2016-03-05 14:34:15 +01:00
debris
068d776b17 Merge branch 'master' of github.com:ethcore/parity 2016-03-05 13:49:03 +01:00
Tomasz Drwięga
0109e5e9d4 Removing memory leak when transactions are dropped from set 2016-03-05 13:03:34 +01:00
Gav Wood
b14b4cfef8 Merge pull request #602 from ethcore/revert-595-tx_queue_integration
Revert "Transaction Queue integration"
2016-03-05 12:54:01 +01:00
Gav Wood
d330f0b7b7 Revert "Transaction Queue integration" 2016-03-05 12:53:54 +01:00
Nikolay Volf
9e5bf94a5a Merge branch 'master' into rpc-signing-extend 2016-03-05 14:31:39 +03:00
Gav Wood
5ac0da6bba Merge pull request #601 from ethcore/fix-benches
fix benches compilation
2016-03-05 12:30:33 +01:00
Nikolay Volf
cfbaa2d6e9 fixed namespaces 2016-03-05 14:25:46 +03:00
Nikolay Volf
c4fe307b06 Merge pull request #595 from ethcore/tx_queue_integration
Transaction Queue integration
2016-03-05 14:21:54 +03:00
Gav Wood
937a8e26a6 Merge pull request #597 from ethcore/verifier_improvements
verifier trait improvements
2016-03-05 12:12:47 +01:00
Gav Wood
c4faa69049 Merge pull request #600 from ethcore/rust_stable
build on rust stable
2016-03-05 12:11:57 +01:00
Gav Wood
0768d556a9 Merge pull request #599 from ethcore/silent-geth
Geth import silent if no geth
2016-03-05 12:11:21 +01:00
Tomasz Drwięga
b9a6a70ced Renaming bad blocks as retracted 2016-03-05 11:37:19 +01:00
debris
9e5f8d4434 build on rust stable 2016-03-05 11:36:12 +01:00
debris
1743e480e3 rust_stable 2016-03-05 11:35:44 +01:00
Tomasz Drwięga
8a13e87cbe Renaming BlocksWith helper to EachBlockWith 2016-03-05 11:30:27 +01:00
Nikolay Volf
1d04a7b8f9 changing warning to trace 2016-03-05 13:16:09 +03:00
debris
5ad5773014 verifier improvements 2016-03-05 10:45:05 +01:00
Gav Wood
a7e5113f2c Merge pull request #593 from ethcore/journaldb
Additional journaldb logging and assert
2016-03-05 09:48:01 +01:00
Gav Wood
504e74a9ad Merge pull request #578 from ethcore/finduncles
Uncle inclusion in block authoring.
2016-03-05 09:47:51 +01:00
Tomasz Drwięga
77d526fd0b Merge branch 'master' into tx_queue_integration
Conflicts:
	ethcore/src/client.rs
	sync/src/tests/helpers.rs
2016-03-05 00:57:45 +01:00
arkpar
a4640beb2c Typo 2016-03-05 00:00:43 +01:00
arkpar
2d6738fcde Additional logging and assert 2016-03-04 23:53:57 +01:00
Gav Wood
8ed632eb96 Merge pull request #592 from ethcore/network
Fixed potential deadlock on startup
2016-03-04 23:51:56 +01:00
Gav Wood
87cd8ebd26 Merge pull request #591 from ethcore/sync
Fixing an overflow panic
2016-03-04 23:51:45 +01:00
Gav Wood
d7b49c9f15 Merge pull request #590 from ethcore/sync-fix
Fixed one more case of sync stalling
2016-03-04 23:51:32 +01:00
Gav Wood
e11b74e8d2 Merge pull request #589 from ethcore/disablejournaldb
JournalDB can now operate in "archive" mode
2016-03-04 23:51:21 +01:00
Gav Wood
8f00056171 Avoid sealing unnecessarily. 2016-03-04 23:43:59 +01:00
Gav Wood
86c34c7d10 Remove "fix". 2016-03-04 23:29:56 +01:00
Gav Wood
098a6ad2cc Reset HISTORY. 2016-03-04 23:09:05 +01:00
Gav Wood
d63e535b3c Merge branch 'master' into finduncles 2016-03-04 23:08:48 +01:00
Gav Wood
96617533c8 Remove unneeded field. 2016-03-04 22:57:44 +01:00
Gav Wood
559e01ea84 Review remarks resolved. 2016-03-04 22:54:59 +01:00
arkpar
182aec2f94 Fixed potential deadlock on startup 2016-03-04 22:01:36 +01:00
arkpar
f028ff1d40 Use same BlockChainInfo for propagation 2016-03-04 21:52:03 +01:00
Gav Wood
bc018faedc Avoid forcing a resync for the pre-existing journaldbs. 2016-03-04 21:17:42 +01:00
Gav Wood
bbbaffbc53 "--archive" option for disabling the journal DB
Fixes #579
2016-03-04 21:06:28 +01:00
Nikolay Volf
5d9a599b17 Merge branch 'master' into rpc-signing-extend 2016-03-04 22:42:32 +03:00
Nikolay Volf
316e48e3b5 Merge pull request #586 from ethcore/secret-store-ext
Secret store integration with client
2016-03-04 22:41:47 +03:00
Gav Wood
ba67b67ff3 JournalDB can now operate in "archive" mode. 2016-03-04 20:19:36 +01:00
Arkadiy Paronyan
d398326049 Merge pull request #588 from ethcore/fix-build-master
fix build on nightly rust
2016-03-04 19:57:45 +01:00
Nikolay Volf
8ff49c06dd somehow that was not set to the right path 2016-03-04 21:53:24 +03:00
Nikolay Volf
5fdc6be9bc Merge branch 'master' into secret-store-ext 2016-03-04 21:46:20 +03:00
Nikolay Volf
31127425ba Merge pull request #585 from ethcore/uint-deserialize
deserialization for uint generic
2016-03-04 21:45:34 +03:00
Nikolay Volf
a4f4764e2a Merge pull request #559 from ethcore/tx_queue
TransactionsQueue implementation
2016-03-04 21:43:33 +03:00
arkpar
3fa1776ecf Fixed sync stalling on a new block arriving while body request is pending 2016-03-04 19:11:44 +01:00
Nikolay Volf
a8f8195418 Merge pull request #583 from ethcore/json-rpc-personal
JSON-RPC personal service (follows #582)
2016-03-04 20:11:22 +03:00
Nikolay Volf
af5ed8b5f7 rpc-signing-extend 2016-03-04 20:10:07 +03:00
Nikolay Volf
c72c27b47e client integration 2016-03-04 20:09:21 +03:00
Nikolay Volf
2e3fb103ab extended secret store operations 2016-03-04 20:08:42 +03:00
Nikolay Volf
d59972a9ac deserialization for uint generic 2016-03-04 20:07:23 +03:00
Tomasz Drwięga
d9f23470c4 Merge branch 'tx_queue_integration' into tx_queue_rpc 2016-03-04 16:54:00 +01:00
Tomasz Drwięga
bcaed67eaa Swapping order of inserting block to chain and commiting to DB to avoid race conditions 2016-03-04 16:48:10 +01:00
Tomasz Drwięga
bd7614f445 Merge branch 'tx_queue' into tx_queue_integration
Conflicts:
	sync/src/transaction_queue.rs
2016-03-04 16:25:39 +01:00
Tomasz Drwięga
677c3996b9 Taking expected nonce from state into consideration when removing txs 2016-03-04 16:12:48 +01:00
Tomasz Drwięga
b320ff4602 Getting rid of first_nonces (we can fetch it from state) 2016-03-04 15:02:11 +01:00
Nikolay Volf
ae51d99fb8 [ci skip] trailing commas 2016-03-04 16:40:17 +03:00
Nikolay Volf
4131a60b43 Merge branch 'master' into json-rpc-personal 2016-03-04 16:25:49 +03:00
Nikolay Volf
0d01099f44 moving unlock logics to secret-store itself 2016-03-04 16:23:00 +03:00
Marek Kotewicz
9c1f3d5fff Merge pull request #582 from ethcore/secret-store-sync-ready
making key directory thread-safe
2016-03-04 13:22:32 +01:00
Gav Wood
ee312cba1c Merge pull request #581 from ethcore/verifier_trait
verifier trait
2016-03-04 12:58:10 +01:00
Nikolay Volf
4f62e80de7 name fix 2016-03-04 14:53:18 +03:00
Nikolay Volf
da65761712 Merge branch 'secret-store-sync-ready' into json-rpc-personal 2016-03-04 14:49:00 +03:00
Nikolay Volf
e17b2a4db8 replacing unsafe cell with rwlock 2016-03-04 14:48:05 +03:00
Nikolay Volf
6a57e83509 json rpc personal service 2016-03-04 14:46:54 +03:00
Tomasz Drwięga
410bd263dd Merge branch 'tx_queue_integration' into tx_queue_rpc 2016-03-04 12:34:34 +01:00
Tomasz Drwięga
f7371daca3 Merge branch 'tx_queue' into tx_queue_integration 2016-03-04 12:20:31 +01:00
debris
706ce5dfb6 verifier trait 2016-03-04 11:56:04 +01:00
Tomasz Drwięga
8542d651ae Refactoring transactions queue to avoid cloning transactions 2016-03-04 11:45:20 +01:00
Gav Wood
52dceff3ea Merge branch 'master' into finduncles 2016-03-03 15:16:56 +01:00
Gav Wood
00b5fcebe3 Merge pull request #580 from ethcore/fixblockchainmem
shrink_to_fit after removing hashes.
2016-03-03 15:08:47 +01:00
Gav Wood
f8dc1f2e3a Avoid leaking block_details.
Fixes #576
2016-03-03 12:56:34 +01:00
Gav Wood
09e01fa0f8 Merge pull request #504 from ethcore/rpc_poll_ids
support for rpc polling
2016-03-03 12:44:27 +01:00
Gav Wood
f9533c5d16 Merge pull request #569 from ethcore/rpc_serde_generator
limit serde codegen only to rpc types submodule
2016-03-03 12:43:05 +01:00
Gav Wood
806f962b7d Merge pull request #573 from ethcore/issue-test/568
fork test for Issue test/568
2016-03-03 12:41:32 +01:00
Gav Wood
dadc2a96ea shrink_to_fit after removing hashes. 2016-03-03 12:39:19 +01:00
Gav Wood
df77f51bcc History to 30 to pass tests. 2016-03-03 11:47:24 +01:00
Gav Wood
3daa4c6497 Fix max uncles. 2016-03-03 11:39:00 +01:00
Gav Wood
6933bb971b Test. 2016-03-02 23:41:15 +01:00
Tomasz Drwięga
f4a71dc03c Merge branch 'tx_queue' into tx_queue_integration 2016-03-02 21:27:08 +01:00
Tomasz Drwięga
fc9999fb05 Changing uint to numbers 2016-03-02 21:26:48 +01:00
Tomasz Drwięga
82866fcab5 Merge branch 'master' into tx_queue 2016-03-02 21:14:11 +01:00
Gav Wood
039c0056bc Uncle inclusion in block authoring. Still need tests. 2016-03-02 19:38:00 +01:00
Gav Wood
1a7ef8cc85 Merge pull request #560 from ethcore/clippy_warnings
Fixing clippy warnings = small refactoring of `request_blocks`
2016-03-02 19:06:45 +01:00
Gav Wood
877270c35f Fixes. 2016-03-02 18:32:54 +01:00
Gav Wood
42df98450c Include uncles in exclused. 2016-03-02 18:05:47 +01:00
Gav Wood
671965d44f Test for ancestry. 2016-03-02 17:31:42 +01:00
Gav Wood
c75737bcf0 Add ancestry iterator. 2016-03-02 17:04:44 +01:00
Nikolay Volf
c4333461bb Merge pull request #571 from ethcore/journaldb
Improved journaldb logging
2016-03-02 18:07:01 +03:00
Gav Wood
f1cd0299cc Merge pull request #570 from ethcore/ancientenactcheck
Additional check to ancient enactments.
2016-03-02 15:44:43 +01:00
Gav Wood
3c7814c8ac Remove debug line. 2016-03-02 15:43:48 +01:00
Nikolay Volf
028434f93d Merge branch 'master' into issue-test/568
Conflicts:
	ethcore/src/tests/client.rs
2016-03-02 17:15:09 +03:00
Nikolay Volf
02aad03f92 helpers 2016-03-02 17:06:53 +03:00
debris
e66dbac11b Merge branch 'master' into rpc_serde_generator 2016-03-02 14:17:34 +01:00
debris
b1a62575c9 fixed PollFilter::PendingTransaction returning empty hash 2016-03-02 14:09:44 +01:00
debris
190468e1f8 fixed trailing , 2016-03-02 14:03:43 +01:00
debris
03ffcd0e64 Merge branch 'master' into rpc_poll_ids 2016-03-02 13:59:03 +01:00
Gav Wood
f5de0187e7 Merge remote-tracking branch 'origin/master' into clippy_warnings 2016-03-02 13:40:35 +01:00
Gav Wood
1ae573bf21 Fix install-deps.sh. 2016-03-02 13:40:11 +01:00
Gav Wood
47b4729332 Fix check. 2016-03-02 13:28:51 +01:00
Gav Wood
4fd926bfd6 Merge branch 'master' of github.com:ethcore/parity 2016-03-02 13:27:45 +01:00
arkpar
041cfda80b Improved journaldb logging 2016-03-02 13:21:33 +01:00
Gav Wood
3b3399ccc3 Merge pull request #564 from ethcore/inclusive_bloom_ranges
chainfilter shouldnt exclude to_block from results
2016-03-02 13:05:45 +01:00
Gav Wood
13deb4f048 Merge branch 'master' of github.com:ethcore/parity 2016-03-02 13:01:48 +01:00
Gav Wood
931c293426 Merge pull request #567 from ethcore/fix-kcov
Fix coverage test run
2016-03-02 13:01:14 +01:00
Gav Wood
162300a4a6 Merge pull request #547 from ethcore/mining
Mining
2016-03-02 13:00:22 +01:00
Gav Wood
3309959139 Additional check to ancient enactments. 2016-03-02 12:57:34 +01:00
debris
bdf3b197ad limit serde codegen only to rpc types submodule 2016-03-02 12:42:08 +01:00
debris
28c5f6f9c3 fixed failing test 2016-03-02 12:32:30 +01:00
Marek Kotewicz
c9bb7ea0f4 Merge pull request #565 from ethcore/uint-warnings
fix uint warnings
2016-03-02 12:32:01 +01:00
debris
5a7dfa4df2 Merge branch 'master' into rpc_poll_ids 2016-03-02 12:27:38 +01:00
Marek Kotewicz
c46126806e Merge pull request #562 from ethcore/chain_generator
Finished blockchain generator.
2016-03-02 12:17:01 +01:00
Nikolay Volf
771fbcbd27 remove redundant modification 2016-03-02 13:02:33 +03:00
Nikolay Volf
5dfc3d2849 resolving path at runtime 2016-03-02 13:01:38 +03:00
Nikolay Volf
6b9fde5790 Merge branch 'master' into mining 2016-03-02 08:54:21 +03:00
Nikolay Volf
34b812696b remove unused imports 2016-03-02 08:49:48 +03:00
debris
a0acfd5113 Merge branch 'master' into rpc_poll_ids 2016-03-02 06:12:06 +01:00
debris
feff1f9e6e chainfilter shouldnt exclude to_block from results 2016-03-02 06:09:27 +01:00
debris
4f891973aa Merge branch 'master' into chain_generator 2016-03-02 06:03:57 +01:00
Marek Kotewicz
cda48e3ce8 Merge pull request #563 from ethcore/fixed_broken_master
fixed broken master
2016-03-02 06:01:52 +01:00
debris
67a1f2065e fixed broken master 2016-03-02 06:01:31 +01:00
debris
32074cc420 fixed compilation issue caused by incorrect merge 2016-03-02 05:55:42 +01:00
debris
05897ddbb0 fixed pending transaction mock implementation 2016-03-02 05:50:28 +01:00
debris
5f97d51967 renamed poll_indexed to poll_manager 2016-03-02 05:46:38 +01:00
debris
3b4d4a9b63 Merge branch 'master' into rpc_poll_ids 2016-03-02 05:15:21 +01:00
debris
4571df9fc6 Merge branch 'master' of github.com:ethcore/parity into chain_generator 2016-03-02 04:54:55 +01:00
debris
010659cf12 added missing , in comment 2016-03-02 04:54:47 +01:00
debris
68ba016279 improved blockchain generator 2016-03-02 04:25:03 +01:00
arkpar
324e070581 Reverted some changes 2016-03-02 01:24:06 +01:00
arkpar
15ecba57ec Merge branch 'master' of github.com:ethcore/parity into thread 2016-03-02 01:20:41 +01:00
Gav Wood
d55aa54412 Merge branch 'master' into mining 2016-03-02 00:59:39 +01:00
Gav Wood
0082d12ea9 Merge pull request #544 from ethcore/uint-refact
uint to separate crate
2016-03-02 00:59:03 +01:00
Gav Wood
3ac14a6d89 Merge pull request #554 from ethcore/chain_generator
improved test chain generator
2016-03-02 00:58:52 +01:00
Gav Wood
1ad1836bd3 Merge pull request #558 from ethcore/chain_rename
Fixing spelling in propagade->propagate
2016-03-02 00:57:36 +01:00
Gav Wood
173d383f9f Merge pull request #557 from ethcore/transaction_cell
Changing RefCell to Cell in transaction.
2016-03-02 00:57:00 +01:00
Gav Wood
30c6820437 Refactor and cleanup. 2016-03-02 00:52:18 +01:00
Gav Wood
929f44fe4f Tests for Client sealing. 2016-03-02 00:34:38 +01:00
Tomasz Drwięga
c889d9b3eb Exposing transaction queue pending in RPC 2016-03-01 23:06:51 +01:00
Tomasz Drwięga
c6934431d1 Adding test for sync.chain_new_blocks. 2016-03-01 22:52:28 +01:00
Tomasz Drwięga
7565625ce0 Integrating TransactionQueue with client 2016-03-01 22:30:23 +01:00
Tomasz Drwięga
083747dc67 Lowering complexity of request_blocks 2016-03-01 22:05:54 +01:00
Tomasz Drwięga
30e7ac8d6d Fixing trivial warnings 2016-03-01 22:05:50 +01:00
Tomasz Drwięga
725e894f9b TransactionsQueue implementation 2016-03-01 21:48:58 +01:00
Tomasz Drwięga
8c9c701de5 Fixing spelling in propagade->propagate 2016-03-01 21:34:57 +01:00
Tomusdrw
aab274d3ef Changing RefCell to Cell in transaction. Implementing Copy on Uints. 2016-03-01 21:29:22 +01:00
Gav Wood
046b8e4704 Merge branch 'master' into mining 2016-03-01 20:16:27 +01:00
Gav Wood
a21fda23a6 Enable transition test. 2016-03-01 20:14:28 +01:00
Gav Wood
628a53ccec Update tests. Fix our tests. 2016-03-01 20:02:59 +01:00
Gav Wood
140711dd8a Fixups from review.
Reduce size of default extra-data.
Introduce find_uncle_headers.
2016-03-01 19:59:12 +01:00
Nikolay Volf
7c3d7fc460 Merge pull request #556 from ethcore/mordenfix
Fix for morden consensus.
2016-03-01 21:28:29 +03:00
Gav Wood
f2eae8bc50 Merge branch 'master' into mining 2016-03-01 18:46:02 +01:00
Gav Wood
61420d3c9c Fix for morden consensus. 2016-03-01 18:17:59 +01:00
Gav Wood
afc0605080 Refactor engine to make it clear that we're actually checking the seal. 2016-03-01 17:23:44 +01:00
Gav Wood
f705f6957a Merge branch 'master' into mining 2016-03-01 16:59:39 +01:00
Gav Wood
a5c65b2a3d Reduce spam. 2016-03-01 16:59:01 +01:00
Gav Wood
48df869202 --author and --extra-data options. Fixed null parent-hash. 2016-03-01 16:58:14 +01:00
debris
38d74bf78c Merge branch 'master' of github.com:ethcore/parity into chain_generator 2016-03-01 16:22:51 +01:00
debris
3e2366b38b improved chain generator 2016-03-01 16:22:06 +01:00
Marek Kotewicz
bbe2e8076b Merge pull request #550 from ethcore/chain_generator
blockchain generator
2016-03-01 16:21:27 +01:00
debris
47688e49cd removed redundant whitespaces 2016-03-01 13:54:14 +01:00
debris
063020f507 added license headers 2016-03-01 13:46:33 +01:00
debris
ab9fddf6b2 blockchain generator 2016-03-01 13:44:09 +01:00
Nikolay Volf
be4cfa83b3 Merge pull request #545 from ethcore/table
Sparse Table Implementation (Row, Col) -> Val
2016-03-01 15:01:35 +03:00
Nikolay Volf
f9422ea687 Merge pull request #548 from guanqun/patch-1
[ci skip] fixup install script
2016-03-01 11:16:43 +03:00
Lu Guanqun
c45d3560b8 fixup install script
It's renamed in upstream.

ae8e470ca6
2016-03-01 10:09:22 +08:00
Gav Wood
1eca9acffb Fix is_mining. 2016-03-01 02:33:41 +01:00
Gav Wood
e366846ecf Merge pull request #546 from ethcore/clippy_warnings
Fixing clippy warnings
2016-03-01 01:52:59 +01:00
Gav Wood
5ccb172e73 Hashrate now reported correctly. 2016-03-01 01:52:22 +01:00
Gav Wood
2266d74c2a Fix JSONRPC I/O. 2016-03-01 01:15:00 +01:00
Tomasz Drwięga
816e549d4c Changing implementation of is_empty to something more efficient 2016-03-01 00:40:55 +01:00
Gav Wood
2276445790 Merge pull request #543 from wlk/ignore-out-directory
ignore out directory
2016-03-01 00:11:37 +01:00
Gav Wood
394e9c679b Reorganised ImportError to be a type of Errpr (rather than vice-versa).
Added support for eth_submitWork.
2016-03-01 00:02:48 +01:00
Tomasz Drwięga
ed6a35f618 More idiomatic implementations 2016-03-01 00:00:52 +01:00
Tomasz Drwięga
2f3b0c9d1c Removing get_ prefix 2016-02-29 23:57:02 +01:00
Tomasz Drwięga
8c60eaa548 Unused variable 2016-02-29 23:43:48 +01:00
Nikolay Volf
82a528961b remove line 2016-03-01 01:13:00 +03:00
Tomasz Drwięga
212aac42bd Removing clippy warnings 2016-02-29 23:09:51 +01:00
Tomasz Drwięga
f2fdb8b69b Table tests 2016-02-29 22:56:56 +01:00
Nikolay Volf
f528d8c50a common -> numbers (as most narrow) 2016-03-01 00:44:45 +03:00
Nikolay Volf
16038d9555 hash&uint -> numbers 2016-03-01 00:23:49 +03:00
Nikolay Volf
d0125f3ff5 uint to separated crate 2016-03-01 00:21:15 +03:00
Tomusdrw
4bf77c03f5 Moving Table to utils. Fixing couple of small things 2016-02-29 22:16:28 +01:00
arkpar
d0129ff67b Fixed cache memory leak 2016-02-29 21:15:39 +01:00
Wojciech Langiewicz
8920bea241 ignore out directory 2016-02-29 21:14:38 +01:00
arkpar
cb4d17825b Fixed lock order 2016-02-29 19:49:29 +01:00
Gav Wood
ffc5c2ea7b eth_getwork implemented. 2016-02-29 19:30:13 +01:00
Gav Wood
5869dc8273 Merge pull request #539 from ethcore/bigint-u512mul
u256 full multiplication
2016-02-29 19:05:03 +01:00
arkpar
dff7f2e8e5 Merge branch 'master' of github.com:ethcore/parity into thread 2016-02-29 18:25:06 +01:00
arkpar
0ccbba9073 Merge branch 'master' of github.com:ethcore/parity into thread 2016-02-29 18:11:59 +01:00
Nikolay Volf
b30f066651 tabified 2016-02-29 19:15:13 +03:00
Nikolay Volf
1a4e95a9dc u256*u256->u512 2016-02-29 18:57:46 +03:00
Gav Wood
2c32b0fc1c Merge branch 'master' into mining 2016-02-29 16:40:57 +01:00
Arkadiy Paronyan
9c25bebb61 Merge pull request #537 from ethcore/fixpanic
Fix panic when downloading stales, update homestead transition
2016-02-29 16:29:21 +01:00
Gav Wood
a1e1f4f87c Disable stTransitionTest until Dimitri updates to correct number. 2016-02-29 15:33:33 +01:00
Gav Wood
eb0b0b890f Merge branch 'master' into fixpanic 2016-02-29 15:33:24 +01:00
Gav Wood
71da65eb7b Merge branch 'master' of github.com:ethcore/parity 2016-02-29 15:33:02 +01:00
Gav Wood
e20858a5dc Compile fixes. 2016-02-29 15:30:08 +01:00
Gav Wood
72f4dfdd7a Merge pull request #534 from ethcore/bigint-autoinclude
changing x64 asm config
2016-02-29 15:16:30 +01:00
Gav Wood
de645eb6a9 Merge branch 'master' into mining 2016-02-29 15:04:50 +01:00
Gav Wood
791b0d82aa Fix panic when downloading stales. 2016-02-29 14:59:10 +01:00
Gav Wood
83b8e7df5a Initial refactor and block closing. 2016-02-29 14:57:41 +01:00
Nikolay Volf
06623333d9 fix tabs 2016-02-29 15:23:43 +03:00
Gav Wood
6197b3ee60 New provisional Homestead block. 2016-02-29 12:47:34 +01:00
Nikolay Volf
e0c158c12f removed space 2016-02-29 14:40:59 +03:00
Nikolay Volf
2e29e66b92 Merge pull request #533 from ethcore/stTransitionTests
uncomment state transition tests
2016-02-29 14:32:57 +03:00
Nikolay Volf
9b9e054dc3 changing x64 asm config 2016-02-29 14:29:51 +03:00
Marek Kotewicz
47c074adb3 Merge pull request #532 from ethcore/weak_jsonrpc
jsonrpc uses weak pointers to client
2016-02-29 12:29:29 +01:00
debris
5357f58131 uncomment state transition tests 2016-02-29 12:04:58 +01:00
debris
77bfe5ae00 jsonrpc uses weak pointers to client 2016-02-29 11:58:33 +01:00
Arkadiy Paronyan
90b41a81f5 Merge pull request #531 from ethcore/mordenswitch
Morden switch to Homestead rules at #494,000.
2016-02-29 11:15:01 +01:00
Nikolay Volf
f0c11fa0ec Merge pull request #524 from ethcore/blockchain_cleanup
Blockchain module cleanup
2016-02-29 13:09:46 +03:00
Gav Wood
be4b0472c8 Morden switch to Homestead rules at #494,000. 2016-02-29 10:33:57 +01:00
debris
1481f3f477 replaced match with if to shorten the code 2016-02-27 19:27:34 +01:00
debris
1cc719d413 description for prepare_block_blooms_update function 2016-02-27 19:17:29 +01:00
Gav Wood
a01d5f5c4a Merge branch 'master' of github.com:ethcore/parity 2016-02-27 18:45:33 +01:00
debris
1d19196299 Merge branch 'master' of https://github.com/ethcore/parity into blockchain_cleanup 2016-02-27 18:39:39 +01:00
Gav Wood
b1fc9bb342 Merge pull request #528 from ethcore/bigint-opt
Multiplication issue + very exhaustive tests for it
2016-02-27 18:27:15 +01:00
Gav Wood
22a2de971b Merge pull request #498 from ethcore/eip8
EIP-8
2016-02-27 17:49:11 +01:00
Nikolay Volf
afbf41c48c Merge branch 'master' into bigint-opt
Conflicts:
	util/src/uint.rs
2016-02-27 19:17:51 +03:00
Nikolay Volf
6a0e9c5ed0 tabified 2016-02-27 18:55:07 +03:00
Gav Wood
734adf0214 Merge pull request #527 from ethcore/determinatetests
Make "random" trie tests fully deterministic.
2016-02-27 16:50:56 +01:00
Nikolay Volf
019638628c removed duplicates 2016-02-27 18:45:19 +03:00
arkpar
4bdd5267b0 Ack size test 2016-02-27 16:44:47 +01:00
Nikolay Volf
dc604c21b5 most complete carry test ever 2016-02-27 18:43:38 +03:00
arkpar
e6bab014d1 Fixed outgoing ack size 2016-02-27 16:40:22 +01:00
debris
fe13d28472 Merge branch 'master' of https://github.com/ethcore/parity into blockchain_cleanup 2016-02-27 16:13:57 +01:00
Gav Wood
7ee2782a29 Merge branch 'master' of github.com:ethcore/parity 2016-02-27 16:10:15 +01:00
Gav Wood
16bc7b57cb Merge pull request #526 from ethcore/serde_update
udpated serde to version 0.7.0
2016-02-27 16:09:44 +01:00
debris
53b19e9f2d Merge branch 'master' of https://github.com/ethcore/parity into blockchain_cleanup 2016-02-27 16:06:02 +01:00
debris
b60b84fe67 use transient-hashmap from crates.io 2016-02-27 15:56:41 +01:00
Gav Wood
b3f09596b1 Merge pull request #516 from ethcore/sync
Better memory management
2016-02-27 15:54:19 +01:00
Gav Wood
ec8c1cb5f9 Make "random" trie tests fully determinate. 2016-02-27 15:49:44 +01:00
debris
f1538ebc76 Merge branch 'master' into rpc_poll_ids 2016-02-27 15:34:02 +01:00
Gav Wood
faa6347896 Update handshake.rs 2016-02-27 15:07:21 +01:00
Gav Wood
213bfc4417 Update handshake.rs 2016-02-27 15:05:13 +01:00
Gav Wood
b2dd6ded1d Update discovery.rs 2016-02-27 15:02:05 +01:00
debris
11de5b4923 udpated serde to version 0.7.0 2016-02-27 13:14:58 +01:00
Nikolay Volf
e3c8c99583 finally caught mul bug 2016-02-27 15:02:02 +03:00
Gav Wood
d01c1c0d32 Merge branch 'master' of github.com:ethcore/parity 2016-02-27 11:40:41 +01:00
Marek Kotewicz
db9774fb62 Merge pull request #523 from ethcore/typo
Typo
2016-02-27 10:32:41 +01:00
debris
7b3613e1f0 updated ExtrasUpdate function 2016-02-27 10:21:44 +01:00
debris
01f69ca80c moved creation of blockchains db transaction to apply_update function 2016-02-27 10:19:33 +01:00
debris
d57518d90c Merge branch 'master' into blockchain_cleanup 2016-02-27 02:18:07 +01:00
debris
cd43e32e25 added docs and license headers 2016-02-27 02:16:39 +01:00
debris
53e8d99075 blockchain split into few separate submodules, cleanup insert_block process 2016-02-27 01:37:12 +01:00
Gav Wood
07b9f9f6f3 Merge pull request #521 from ethcore/bigint-u512-opt
U512 add/sub optimize
2016-02-26 23:46:47 +01:00
Gav Wood
bcc6ba3603 Merge branch 'master' of github.com:ethcore/parity 2016-02-26 23:15:10 +01:00
Gav Wood
a211520d19 Merge pull request #509 from ethcore/geth-import-no-utility-crate
Account management + geth keystore import (no utility crate added)
2016-02-26 23:13:20 +01:00
Gav Wood
9b244022c7 Fix up README. 2016-02-26 22:44:33 +01:00
Gav Wood
5d5471f981 Fix minor typo. 2016-02-26 22:40:32 +01:00
Gav Wood
92625a5095 Merge branch 'master' of github.com:ethcore/parity 2016-02-26 22:39:23 +01:00
Gav Wood
52faf8164d Update store.rs 2016-02-26 21:38:05 +01:00
Nikolay Volf
98a75d06d1 benches 2016-02-26 23:37:13 +03:00
Gav Wood
8bd585b2b9 Merge pull request #505 from ethcore/network
Delayed UPnP initialization
2016-02-26 21:33:29 +01:00
Nikolay Volf
9585138f20 add/sub 512 2016-02-26 23:24:04 +03:00
Gav Wood
e64293dbe7 Merge pull request #503 from ethcore/client_bugs
Fixing marking blocks as bad & SyncMessage bugs + small client refactoring.
2016-02-26 21:10:04 +01:00
Tomasz Drwięga
f118e30b20 Renaming variables to more descriptive 2016-02-26 19:56:32 +01:00
Tomasz Drwięga
f55d111469 Merge branch 'master' into client_bugs
Conflicts:
	ethcore/src/client.rs
2016-02-26 19:43:06 +01:00
Gav Wood
fd63fa6836 Update block.rs 2016-02-26 17:27:56 +01:00
Gav Wood
a51ba5ca33 Merge pull request #515 from ethcore/bigint-opt
optimization of U256
2016-02-26 17:25:18 +01:00
debris
2947a1415b Merge branch 'master' into rpc_poll_ids 2016-02-26 15:57:23 +01:00
Nikolay Volf
3750a8964c removed redundant clones 2016-02-26 17:48:50 +03:00
Gav Wood
d18e0cb21b Merge pull request #520 from ethcore/db
Removed rocksdb from build scripts and instructions
2016-02-26 14:53:36 +01:00
Nikolay Volf
5013c4d1f1 naughty overflow bug fixed 2016-02-26 16:50:12 +03:00
arkpar
34bc02af1e Merge branch 'master' of github.com:ethcore/parity into network 2016-02-26 14:23:10 +01:00
Nikolay Volf
023c623650 mul overflow multipart test 2016-02-26 16:19:55 +03:00
Nikolay Volf
3858a2011f [ci skip] mul multipart tests 2016-02-26 16:12:47 +03:00
Nikolay Volf
228e3fefe0 [ci skip] multipart sub test 2016-02-26 16:03:04 +03:00
Nikolay Volf
e95538f3ec [ci skip] style fixes, multipart add test 2016-02-26 15:56:55 +03:00
arkpar
10ef7123c4 Merge branch 'master' of github.com:ethcore/parity into sync 2016-02-26 13:55:42 +01:00
arkpar
2e66ba7b64 Merge branch 'master' of github.com:ethcore/parity into sync 2016-02-26 13:53:01 +01:00
Gav Wood
6e5ae636cc Merge pull request #464 from ethcore/db
RocksDB abstraction layer + Hash index for state DB
2016-02-26 13:51:13 +01:00
arkpar
08d54f9b49 Merge branch 'master' of github.com:ethcore/parity into thread 2016-02-26 13:38:06 +01:00
arkpar
80d60cedf6 Removed rocksdb from build scripts and instructions 2016-02-26 13:27:05 +01:00
arkpar
9920dcea17 Merge branch 'master' of github.com:ethcore/parity into db 2016-02-26 13:16:22 +01:00
Gav Wood
7a706fa0d2 Merge pull request #418 from ethcore/jsonrpc2
bloomfilter
2016-02-26 13:08:41 +01:00
Nikolay Volf
f29417eea9 allow dead code for macros expansion 2016-02-26 14:50:55 +03:00
Nikolay Volf
9823e30c2e Merge pull request #519 from ethcore/net-fix
Fixed a race condition when connecting peer disconnects immediately
2016-02-26 14:48:15 +03:00
arkpar
c66178e3f7 Fixed a race condition when a connecting peer disconnects immediately 2016-02-26 11:38:06 +01:00
Arkadiy Paronyan
4af8657c21 Merge pull request #518 from wlk/fix-gitignore-for-intellij
ignore intellij idea project files as well
2016-02-26 10:53:22 +01:00
Wojciech Langiewicz
5545cbc6bc ignore intellij idea project files as well 2016-02-26 10:07:30 +01:00
arkpar
c76fc14a5c rocksdb dependency version bump 2016-02-26 03:22:18 +01:00
arkpar
4660612e08 Merge branch 'master' of github.com:ethcore/parity into db 2016-02-25 20:52:31 +01:00
Nikolay Volf
4b0ec64299 random init for benches 2016-02-25 22:48:34 +03:00
Nikolay Volf
e946e2ab18 epic mul overflow bug 2016-02-25 22:27:22 +03:00
arkpar
937547f178 rocksdb dependency version bump 2016-02-25 20:20:00 +01:00
Nikolay Volf
600859ed04 [ci skip] flush 2016-02-25 19:58:09 +03:00
arkpar
c139b6bcbb Fixed json tests build 2016-02-25 17:48:23 +01:00
Tomasz Drwięga
a0f930fa07 Merge branch 'master' into client_bugs 2016-02-25 17:22:13 +01:00
arkpar
0344f2b4c9 Block queue mem limit test 2016-02-25 17:14:45 +01:00
arkpar
bed89d0740 Fixed sync tests 2016-02-25 16:32:34 +01:00
Nikolay Volf
2ee4a0c8c6 mistake of ne/jcxz 2016-02-25 18:16:08 +03:00
Nikolay Volf
5d22ad3fc8 counter jump better 2016-02-25 18:10:33 +03:00
Nikolay Volf
864e754074 overflowing_sub in sub 2016-02-25 18:02:08 +03:00
Nikolay Volf
7525ff23cf removed artefact cls/pushf/popf 2016-02-25 17:59:08 +03:00
Nikolay Volf
fb5779a00e specific feature for asm opt 2016-02-25 16:55:03 +03:00
Nikolay Volf
5467b06c4f fix bench iter 2016-02-25 16:40:36 +03:00
arkpar
21f62012d6 Merge branch 'master' of github.com:ethcore/parity into sync 2016-02-25 14:22:41 +01:00
Arkadiy Paronyan
6b0be50dd0 Merge pull request #517 from ethcore/unicase_update
updated version of unicase
2016-02-25 14:22:22 +01:00
debris
85350f3c66 updated version of unicase 2016-02-25 14:21:29 +01:00
Nikolay Volf
f17d893f53 fixed mul, fixed register pref 2016-02-25 16:20:57 +03:00
arkpar
1b9f428183 Merge branch 'master' of github.com:ethcore/parity into sync 2016-02-25 14:20:28 +01:00
arkpar
781f763f1f Memory management 2016-02-25 14:09:39 +01:00
Marek Kotewicz
ba464bbac4 Merge pull request #493 from ethcore/jsonrpc_security
jsonrpc security, cors headers, fixed #359
2016-02-25 14:08:18 +01:00
Nikolay Volf
b6a6bc0f4e Merge pull request #482 from peterjoel/issue_161
Rust implementations to replace data tables (#161)
2016-02-25 03:31:04 +03:00
Nikolay Volf
ae76a509dc inline test 2016-02-25 03:10:02 +03:00
Nikolay Volf
da69ea51fe inline 2016-02-25 03:09:33 +03:00
Nikolay Volf
370d9015b4 Merge branch 'master' into bigint-opt 2016-02-25 02:10:19 +03:00
Nikolay Volf
53af2d7dfb Merge pull request #512 from ethcore/fix-block-inclusive
fix issue with starting requested block number was not included itself
2016-02-25 02:09:28 +03:00
Nikolay Volf
0794049d18 fix naughty macros 2016-02-25 02:05:59 +03:00
Nikolay Volf
ccaa194681 mul, bench showtime 2016-02-25 02:00:34 +03:00
arkpar
1a73d70334 Report memory usage 2016-02-24 22:37:28 +01:00
arkpar
5a9bba3fa5 Merge branch 'master' of github.com:ethcore/parity into db 2016-02-24 21:32:21 +01:00
arkpar
cb3608c6d3 Limit download ahead 2016-02-24 21:23:58 +01:00
Nikolay Volf
7821505139 sub x64 optimize 2016-02-24 23:08:21 +03:00
Nikolay Volf
476bb85d41 r m/r + setc/xor 2016-02-24 21:36:31 +03:00
Nikolay Volf
dd8652dbf4 u256 to inline assembly opt 2016-02-24 21:17:29 +03:00
Tomasz Drwięga
08647282df Fixing mark_as_bad implementation 2016-02-24 17:01:29 +01:00
debris
0318907fb3 rpc eth_getFilterChanges returns new blocks, implemented eth_uninstallFilter 2016-02-24 14:16:05 +01:00
Nikolay Volf
d4ad673d64 tested out 2016-02-24 15:01:45 +03:00
Nikolay Volf
d51942e59d fix issue with starting requested block number was not included itself 2016-02-24 14:36:41 +03:00
Marek Kotewicz
e519e162df Merge pull request #510 from ethcore/fixed_gh_token
fixed travis --org GH_TOKEN
2016-02-24 11:24:42 +01:00
debris
365218590c fixed travis --org GH_TOKEN 2016-02-24 11:19:27 +01:00
Tomasz Drwięga
d914a27bdf Removing lifetimes from Blocks 2016-02-24 11:17:25 +01:00
Tomasz Drwięga
d3fe3f2691 Client refactoring [WIP] 2016-02-24 10:55:39 +01:00
debris
932b31227f Merge branch 'jsonrpc2' into rpc_poll_ids 2016-02-24 10:45:26 +01:00
debris
da936d2e94 removed unused umports 2016-02-24 10:45:17 +01:00
debris
4ce9aad749 Merge branch 'jsonrpc2' into rpc_poll_ids 2016-02-24 10:35:15 +01:00
debris
ca251215cf simplified filter iterators 2016-02-24 10:35:05 +01:00
debris
394e57d3ce removed unnecessary maps 2016-02-24 10:23:25 +01:00
debris
ad268d27d7 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-24 10:10:49 +01:00
Nikolay Volf
5bd355e0af removing extra crate 2016-02-24 09:55:09 +03:00
Nikolay Volf
769e776ee4 Merge pull request #506 from ethcore/log
Improved log format
2016-02-23 23:19:52 +03:00
arkpar
40f908a499 Log formatting 2016-02-23 20:14:37 +01:00
arkpar
8beba717f8 Delayed UPnP initialization 2016-02-23 19:38:06 +01:00
debris
35cabecad8 support for polling 2016-02-23 18:51:29 +01:00
Tomasz Drwięga
4084acd869 Removing dangling comment 2016-02-23 18:51:18 +01:00
Tomasz Drwięga
990c5c8faa Refactoring client and fixing mark_as_bad & SyncMessage bugs 2016-02-23 18:44:13 +01:00
Nikolay Volf
6fe189cbd9 Merge pull request #502 from ethcore/network
Log address on failed connection attempt
2016-02-23 17:59:50 +03:00
arkpar
492bf7154e Log address 2016-02-23 15:02:08 +01:00
debris
52ed69b619 Merge branch 'master' into jsonrpc2 2016-02-23 14:53:09 +01:00
Nikolay Volf
a05e8d226f Merge pull request #501 from ethcore/todr
Bumping clippy and fixing warnings.
2016-02-23 14:23:45 +03:00
Tomusdrw
3734959f55 Deriving PartialEq and disabling clippy warning 2016-02-23 11:54:10 +01:00
Tomusdrw
07e704c968 Fixing clippy warnings. Implementing PartialEq for Uints 2016-02-23 11:40:23 +01:00
Tomusdrw
c2952b49b4 Bumping clippy version Fixes #496 2016-02-23 10:47:57 +01:00
Nikolay Volf
cffaa3b2ee Merge pull request #500 from ethcore/todr
Bumping versions. Fixes #496
2016-02-23 12:34:15 +03:00
debris
bda778626c Merge branch 'master' into jsonrpc_security 2016-02-23 10:28:27 +01:00
Tomusdrw
60a8b92e10 Bumping versions. Fixes #496 2016-02-23 10:14:56 +01:00
arkpar
778fa92ebe Remove locks from the block chain 2016-02-22 23:52:39 +01:00
arkpar
c8076b2f9d Threading performance optimizations 2016-02-22 23:41:59 +01:00
arkpar
000d2446b5 EIP8 2016-02-22 23:05:27 +01:00
Nikolay Volf
bceafe9094 fix import statement 2016-02-23 00:05:28 +03:00
Nikolay Volf
94f9501702 Merge branch 'master' into geth-import 2016-02-22 23:41:06 +03:00
Nikolay Volf
4061799e90 scrypto decrypt fix 2016-02-22 23:40:38 +03:00
Nikolay Volf
e604c97a43 more account tests 2016-02-22 23:12:13 +03:00
Nikolay Volf
93f2ee66bc geth directory import 2016-02-22 22:19:33 +03:00
Arkadiy Paronyan
4e023a1bb8 Merge pull request #494 from ethcore/usererrors
Manage final user-input errors.
2016-02-22 20:04:17 +01:00
Gav Wood
72d0719223 Update docs. 2016-02-22 18:11:53 +01:00
Gav Wood
a6c41514d4 Update docs. 2016-02-22 18:10:21 +01:00
Nikolay Volf
61a3e687f5 store extra interface 2016-02-22 20:08:16 +03:00
Nikolay Volf
753f52fc22 geth import finish 2016-02-22 20:07:56 +03:00
debris
4b69b96f9b added assert checking bloom index size 2016-02-22 15:14:35 +01:00
Arkadiy Paronyan
5fdc9c8adb Merge pull request #495 from ethcore/netcleanups
Remove unneeded code, fix minor potential issue with length.
2016-02-22 14:38:31 +01:00
Gav Wood
5917290562 Remove unneeded code, fix minor potential issue with length. 2016-02-22 13:59:25 +01:00
Gav Wood
64d566ff52 Manage final user-input errors. 2016-02-22 13:58:41 +01:00
arkpar
764f6e9347 Merge branch 'db' of github.com:ethcore/parity into db 2016-02-22 13:48:43 +01:00
arkpar
077c5662a8 Fixed a warning 2016-02-22 13:47:25 +01:00
arkpar
61949d0ed4 Merge branch 'master' of github.com:ethcore/parity into db 2016-02-22 13:44:25 +01:00
debris
90184658a7 jsonrpc security, cors headers, fixed #359 2016-02-22 13:41:38 +01:00
debris
5e27e1b9aa Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-22 11:08:51 +01:00
Marek Kotewicz
38ccc24577 Merge pull request #488 from ethcore/shortversio
Remove "unknown" from version string.
2016-02-22 10:54:34 +01:00
debris
2be4f2f737 added trailin , 2016-02-22 10:14:31 +01:00
debris
8f4c2d98ba added trailin , 2016-02-22 10:11:07 +01:00
debris
61e1720d07 fork back tests 2016-02-22 09:54:56 +01:00
debris
4adb7ee969 tests for blockchain reseting chain head and rebuilding blooms 2016-02-22 09:12:15 +01:00
Gav Wood
e63aba73c5 Remove "unknown" from version string. 2016-02-22 09:04:44 +01:00
debris
155404bf92 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-22 08:50:03 +01:00
debris
8db8e5b5f8 unit tests for reset chain head 2016-02-22 08:46:47 +01:00
Gav Wood
aedc65dbbf Merge branch 'master' of github.com:ethcore/parity 2016-02-21 21:46:17 +01:00
Gav Wood
fbee46d69d Fix netstats. 2016-02-21 21:45:56 +01:00
Nikolay Volf
a8f4d24dad Merge branch 'master' into geth-import 2016-02-21 23:44:52 +03:00
Nikolay Volf
8bc0b7c77c import pub 2016-02-21 23:44:12 +03:00
Gav Wood
0477d245bc Merge pull request #486 from ethcore/gitversion
Include git commit date & hash.
2016-02-21 21:41:20 +01:00
Nikolay Volf
5b05cbb128 extended keys with accont meta 2016-02-21 23:23:46 +03:00
Gav Wood
0c832853b6 Avoid the dep = "*" 2016-02-21 21:22:11 +01:00
Gav Wood
ea187253a2 Include git commit date & hash. 2016-02-21 21:14:09 +01:00
Gav Wood
22ff5bb7d7 Merge pull request #485 from ethcore/properversion
Use proper version string.
2016-02-21 20:23:37 +01:00
Gav Wood
6fa2284c68 Remove unneeded deps. 2016-02-21 20:03:01 +01:00
Gav Wood
63bbd0ccd8 Use proper version string. 2016-02-21 20:00:45 +01:00
Gav Wood
75129613c5 Merge pull request #480 from ethcore/network
Networking fixes
2016-02-21 18:57:10 +01:00
arkpar
67cd29f4e1 Whitespaces 2016-02-21 16:58:56 +01:00
arkpar
91276ad82e Added comments 2016-02-21 16:52:25 +01:00
Gav Wood
8b50fa658f Fix typo in deps script. 2016-02-21 16:32:11 +01:00
Gav Wood
8b692e6d9d Merge pull request #484 from ethcore/discovery
Fix potential deadlock on node table update
2016-02-21 15:11:13 +01:00
arkpar
fe84eb4ff6 Fix locking 2016-02-21 14:04:10 +01:00
Nikolay Volf
bcc4ca48ab to new namespace 2016-02-21 15:19:08 +03:00
Nikolay Volf
a6316b1e20 Merge branch 'master' into db 2016-02-21 15:05:36 +03:00
Peter
ce81a24bfd Tests for issue #161
Implementations of get_cache_size and get_data_size in Rust (issue #161)
Removed sizes module, containing replaced data tables

Fixed whitespace issues after code review
2016-02-21 02:11:09 +00:00
arkpar
93d259e8cb Merge branch 'master' of github.com:ethcore/parity into network 2016-02-21 00:11:32 +01:00
Gav Wood
6448d073a7 Merge pull request #481 from ethcore/warnings
Squash more warnings
2016-02-20 22:00:08 +01:00
Gav Wood
26ad918e03 Merge pull request #477 from ethcore/temp-path
dev/test/build tools to separate crate
2016-02-20 21:59:59 +01:00
arkpar
7bc2853de9 Removed TODO 2016-02-20 15:14:54 +01:00
arkpar
8bd052b986 Fixed warnings 2016-02-20 11:54:12 +01:00
arkpar
b1bfd00875 Zombie connections 2016-02-20 11:47:39 +01:00
Nikolay Volf
0b48507d39 Delete LICENSE.txt 2016-02-20 12:38:16 +03:00
arkpar
69df91de68 Deregister handshake properly when converting to session 2016-02-20 01:36:08 +01:00
arkpar
00f2c6e3e4 Merge branch 'master' of github.com:ethcore/parity into db 2016-02-20 00:48:36 +01:00
Gav Wood
b66f88181a Merge pull request #479 from ethcore/network
Back to original slab crate
2016-02-20 00:25:17 +01:00
Gav Wood
548f77d6d3 Merge pull request #476 from ethcore/usererrors
Better user errors.
2016-02-20 00:24:59 +01:00
arkpar
e64d3daa06 exclude common headers from coverage 2016-02-19 20:14:28 +01:00
Gav Wood
dc3ceeb5bb Use new is_valid_node_url function. 2016-02-19 20:02:23 +01:00
Gav Wood
5f164e1c98 Merge branch 'master' of github.com:ethcore/parity 2016-02-19 19:55:26 +01:00
Gav Wood
6c82e405dd Remove regex &c., use network code for enode ID. 2016-02-19 19:42:23 +01:00
arkpar
5572d1792d Back to original slab crate 2016-02-19 18:43:55 +01:00
Nikolay Volf
84e7ce2758 Merge branch 'master' into temp-path
Conflicts:
	util/Cargo.toml
	util/src/lib.rs
2016-02-19 19:11:24 +03:00
Gav Wood
6518576a3f Merge pull request #440 from ethcore/discovery
UDP Discovery
2016-02-19 16:57:40 +01:00
arkpar
2a1d984bf1 exclude common headers from coverage 2016-02-19 16:41:05 +01:00
arkpar
ab233a941f Slightly improved tests 2016-02-19 16:34:31 +01:00
arkpar
9648081abe exclude common headers from coverage 2016-02-19 16:14:17 +01:00
Nikolay Volf
ab0fe65f3f unlisting as dev-dependencies 2016-02-19 18:09:31 +03:00
debris
3253d2a17b fixed ethsync tests compile errors and warnings 2016-02-19 15:34:12 +01:00
Nikolay Volf
bd18b4930d license for random_path.rs 2016-02-19 17:20:02 +03:00
Nikolay Volf
fed90c126e dev/test tools to separate crate 2016-02-19 17:18:20 +03:00
arkpar
2f62994f61 Updated cargo.lock 2016-02-19 15:17:31 +01:00
debris
ec428c070b added trailing , 2016-02-19 14:17:04 +01:00
arkpar
beab90c707 Added is_valid_node_url 2016-02-19 14:13:20 +01:00
debris
a760f5263f Merge branch 'jsonrpc2' of github.com:ethcore/parity into jsonrpc2 2016-02-19 14:08:33 +01:00
debris
8113c689fc Merge branch 'master' into jsonrpc2 2016-02-19 14:07:11 +01:00
Gav Wood
fd71e1395c Merge branch 'master' of github.com:ethcore/parity 2016-02-19 13:55:00 +01:00
arkpar
f15275bb5b Merge branch 'master' of github.com:ethcore/parity into db 2016-02-19 13:52:07 +01:00
arkpar
85c842b7fd Restored service test 2016-02-19 13:47:13 +01:00
arkpar
1d60d82698 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-19 13:44:57 +01:00
arkpar
d9fec87143 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-19 13:39:43 +01:00
Gav Wood
1866174327 Merge pull request #475 from ethcore/multirust-override
update readme with rust override
2016-02-19 13:31:28 +01:00
Gav Wood
8747fe2dc9 Merge pull request #449 from ethcore/secret-store-enc
Secret store (part2 - encrypted key/value svc)
2016-02-19 13:30:45 +01:00
Gav Wood
d43b23d663 Update directory.rs 2016-02-19 13:30:36 +01:00
Gav Wood
9dfa54a6b7 Merge pull request #474 from ethcore/rustbeta
fixed warnings on rust beta
2016-02-19 13:28:49 +01:00
Nikolay Volf
fe979f0d46 [ci skip] update readme with rust override 2016-02-19 15:21:52 +03:00
Gav Wood
2cc690f31f Better user errors.
Fixed up README.
2016-02-19 12:54:51 +01:00
Nikolay Volf
63c5a2e58f copy instead of ref-map 2016-02-19 14:52:29 +03:00
debris
ef8055f900 Merge branch 'master' into jsonrpc2 2016-02-19 12:52:16 +01:00
debris
ecde760b42 Merge branch 'master' of github.com:ethcore/parity into rustbeta 2016-02-19 12:40:30 +01:00
debris
b5d6359030 fixed allow warnings in ethcore 2016-02-19 12:40:23 +01:00
Arkadiy Paronyan
57ef5e2691 Merge pull request #473 from ethcore/killtest
Kill bad test.
2016-02-19 12:36:36 +01:00
Nikolay Volf
25bae2897b [ci skip] merging master 2016-02-19 14:25:51 +03:00
Gav Wood
1cd76de8ba Update readme for betaUpdate readme for beta 2016-02-19 11:57:59 +01:00
debris
f50bf528e6 fixed allow warnings in util 2016-02-19 11:57:52 +01:00
Gav Wood
33b649bb01 Update script. 2016-02-19 11:57:04 +01:00
Gav Wood
4f6bff1c47 Kill bad test. 2016-02-19 11:39:36 +01:00
Gav Wood
0e10efc727 Update blockchain.rs 2016-02-19 11:33:46 +01:00
Gav Wood
a4846e4aad Update bytes.rs 2016-02-19 11:31:40 +01:00
Marek Kotewicz
f307a0c705 Merge pull request #470 from ethcore/rustbeta
Rustbeta
2016-02-19 11:28:32 +01:00
Gav Wood
ba4c2c94ec Update Cargo.toml 2016-02-19 11:26:24 +01:00
debris
8831e73d98 ignore panic forwarding tests 2016-02-19 11:05:39 +01:00
debris
2ad8f6bd74 do not run benches on travis 2016-02-19 11:03:02 +01:00
debris
bef6d5f2a1 fixed insecure rlp uint conversion, and failing json tests 2016-02-19 10:51:35 +01:00
debris
e3e84020f4 travis-beta and travis-nightly feaetures 2016-02-19 01:25:06 +01:00
debris
f45b2f9a24 .travis matrix fixes for rust beta 2016-02-19 01:13:00 +01:00
debris
1486b7e6a0 add beta to build matrix 2016-02-19 00:55:57 +01:00
Arkadiy Paronyan
89b84d4551 Merge pull request #469 from ethcore/ethcore_compiling
parity compiling fine
2016-02-19 00:53:50 +01:00
debris
c0aca706d2 removed commented out line 2016-02-19 00:51:17 +01:00
debris
19a3daf533 parity compiling fine 2016-02-19 00:50:23 +01:00
arkpar
8fa62130e3 Added TODOs 2016-02-19 00:23:05 +01:00
Nikolay Volf
d2349cdd8e Merge pull request #468 from ethcore/ethcore_compiling
compiling ethcore on beta
2016-02-19 02:12:23 +03:00
debris
df3d17789a compiling ethcore on beta 2016-02-19 00:06:06 +01:00
Marek Kotewicz
3c599838dc Merge pull request #467 from ethcore/ark_beta
Utils compiling in beta
2016-02-18 23:33:39 +01:00
arkpar
af8ba06795 utils compilable in beta 2016-02-18 23:29:41 +01:00
Nikolay Volf
704d6bd069 Merge pull request #466 from ethcore/ethash
Get rid of lru_cache dependency
2016-02-19 00:38:21 +03:00
arkpar
cc5384fff5 Get rid of lru_cache dependency 2016-02-18 22:35:14 +01:00
arkpar
e0623f57f9 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-18 21:49:11 +01:00
arkpar
68795ea031 Fixed typos 2016-02-18 21:40:17 +01:00
arkpar
99600ba370 DB Test 2016-02-18 21:15:56 +01:00
Gav Wood
8e93989eec Merge branch 'rustup' into rustbeta 2016-02-18 21:09:36 +01:00
Gav Wood
ae2ef83f16 Merge branch 'clippy_optional' of https://github.com/Manishearth/parity into Manishearth-clippy_optional 2016-02-18 20:59:28 +01:00
Nikolay Volf
beb0da4ff4 and adding actual dependency 2016-02-18 22:56:21 +03:00
Gav Wood
f84ffdbfef Merge pull request #459 from ethcore/daemonize
Add daemonization.
2016-02-18 20:50:10 +01:00
Nikolay Volf
031b15daab update cargo.lock 2016-02-18 22:12:25 +03:00
Nikolay Volf
8b4278aeaa feature dep for heapsize 2016-02-18 22:06:59 +03:00
Nikolay Volf
198119466b forking heapsize 2016-02-18 19:21:24 +03:00
debris
80f4f422fc updated heapsizeof 2016-02-18 15:17:26 +01:00
debris
ebe8e19cc0 fixed compiling with rustc 1.8.0-nightly (57c357d89 2016-02-16) 2016-02-18 14:36:59 +01:00
Gav Wood
7d75626e75 Fix options. 2016-02-18 14:28:24 +01:00
Gav Wood
1447fb9d30 Switch to using non-macro ready for beta. 2016-02-18 14:16:55 +01:00
Gav Wood
379876341e Correct alignment. 2016-02-18 13:56:15 +01:00
Gav Wood
c6bcd464c2 Avoid changing user for daemonize. Just stick to the basics. 2016-02-18 13:54:18 +01:00
Gav Wood
7f2acedf9f Reintroduce daemonize. 2016-02-18 13:10:04 +01:00
Gav Wood
870731cb9f No need to bring in daemonize module. 2016-02-18 13:08:25 +01:00
Gav Wood
ca353dd18e Remove daemonize feature. 2016-02-18 13:07:57 +01:00
Gav Wood
97f549cf5f Add daemonization. 2016-02-18 12:42:01 +01:00
arkpar
e99f604133 rocksdb abstraction layer 2016-02-18 03:46:34 +01:00
arkpar
68d606b5f0 rocksdb abstraction layer 2016-02-18 03:46:24 +01:00
Nikolay Volf
fffd93607d just in case check 2016-02-17 23:38:16 +03:00
Nikolay Volf
95c74dbd30 more func 2016-02-17 23:34:55 +03:00
Nikolay Volf
aad49cb19f more functional 2016-02-17 23:25:25 +03:00
debris
ed880b3b58 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-17 15:59:36 +01:00
debris
046984f7e8 fixed log transaction hashes 2016-02-17 14:57:54 +01:00
debris
49027c529a increase db version 2016-02-17 14:46:23 +01:00
debris
68d546ce02 tests for log serialization 2016-02-17 14:45:25 +01:00
debris
c74c016ce2 moved filter logic from rpc module to ethcore 2016-02-17 14:13:51 +01:00
arkpar
0cfc4cbb34 More tests 2016-02-17 14:07:26 +01:00
arkpar
c9f3f5e544 Tweaked connection limits to be a bit more aggressive 2016-02-17 14:07:11 +01:00
arkpar
eef193e8bd Don't add useless peers to table 2016-02-17 14:06:19 +01:00
debris
5826a34ebb storing block receitps in db, client logs method implementation 2016-02-17 12:35:37 +01:00
Nikolay Volf
40f5ea4007 removed idea trash 2016-02-17 11:59:14 +03:00
Nikolay Volf
ca99679d1d fixed test names 2016-02-17 11:57:13 +03:00
Nikolay Volf
14b02ff26f tests and fixes 2016-02-17 11:48:12 +03:00
arkpar
e4baf37bf8 Fixed adding boot nodes to discovery table; Ping optimization 2016-02-17 02:55:46 +01:00
arkpar
a179722542 Merge branch 'discovery' of github.com:ethcore/parity into discovery 2016-02-17 01:39:27 +01:00
arkpar
39a98cd555 Prevent connection deletion until unregister is called; minor tweaks 2016-02-17 01:39:16 +01:00
Nikolay Volf
0b916e0a51 Merge branch 'master' into discovery 2016-02-17 03:21:41 +03:00
Nikolay Volf
d63f13245f doc typo 2016-02-17 03:17:02 +03:00
Nikolay Volf
4a028f5faf cleanup asserts 2016-02-17 02:49:13 +03:00
Nikolay Volf
63f6ab4e6d resolved with bytes-encodable issue 2016-02-17 02:32:16 +03:00
arkpar
b6ccbdb694 Lower max handshakes to reduce network load 2016-02-16 23:37:24 +01:00
arkpar
7e0dfb41d0 Minor test tweaks and code cleanup 2016-02-16 23:33:32 +01:00
Manish Goregaokar
8802fb2fd8 Make clippy an optional dependency 2016-02-17 02:07:41 +05:30
arkpar
fbe06d3f2f More tests 2016-02-16 21:25:01 +01:00
arkpar
4f73d63f90 Tweaked CLI options 2016-02-16 19:51:51 +01:00
arkpar
217cbec50e Disconnect test 2016-02-16 19:08:58 +01:00
Nikolay Volf
9895f00e5e warnings, docs, and finding bugs 2016-02-16 20:52:36 +03:00
debris
b01652f3e7 LocalizedLogEntry and Filter in ethcore module 2016-02-16 18:21:45 +01:00
arkpar
f4fa747cd0 ip_utils tests 2016-02-16 17:55:37 +01:00
arkpar
a4ea0737b2 Fixed some tests 2016-02-16 17:54:34 +01:00
arkpar
d95e971030 Prevent deadlocks 2016-02-16 17:53:31 +01:00
Nikolay Volf
a649d6f131 first vector up 2016-02-16 19:19:32 +03:00
debris
7e5e56de40 bloom_filters finally working 2016-02-16 16:54:58 +01:00
Nikolay Volf
ac0ca94230 Merge branch 'master' into secret-store-enc 2016-02-16 17:02:08 +03:00
debris
d000ad2441 more tests and fixes for blockchains bloom filters 2016-02-16 14:46:21 +01:00
Nikolay Volf
50b6c6d4ad Merge pull request #448 from ethcore/master-upgrade
Master upgrade
2016-02-16 15:06:43 +03:00
debris
0699cdd5d0 tests for blockchain bloomfilters 2016-02-16 11:41:34 +01:00
Nikolay Volf
feb9b96ce7 version bump, test script for full suite 2016-02-16 13:40:58 +03:00
Nikolay Volf
6bafb34586 Merge pull request #447 from ethcore/rmcontrib
Remove contributing stuff now that we have CLA bot.
2016-02-16 13:20:18 +03:00
Nikolay Volf
b7c5b0a3c1 script for full test suite 2016-02-16 13:12:29 +03:00
Marek Kotewicz
cdce3697e0 Merge pull request #446 from ethcore/mordenboot
Add Morden bootnode.
2016-02-16 11:06:16 +01:00
Gav Wood
672518ba36 Merge branch 'master' of github.com:ethcore/parity 2016-02-16 11:01:12 +01:00
Tomusdrw
22e2458ce5 Adding rustfmt_skip and fixing couple of places that have troubles after formatting. 2016-02-16 11:01:04 +01:00
Gav Wood
714f01fda7 Remove contributing stuff now that we have CLA bot. 2016-02-16 11:00:38 +01:00
Tomusdrw
771bcb5bda Adding formatting script 2016-02-16 10:57:58 +01:00
Tomusdrw
f0ef6ed016 If-else in single line 2016-02-16 10:57:52 +01:00
Gav Wood
425350aa65 Add Morden bootnode. 2016-02-16 10:53:28 +01:00
debris
0d80821841 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-16 10:11:30 +01:00
Nikolay Volf
26e992ad2e encrypting any bytes covertible now via hashmap 2016-02-16 11:30:22 +03:00
Nikolay Volf
67058123ba Merge branch 'master' into secret-store-enc 2016-02-16 09:17:28 +03:00
arkpar
33e8d749d2 Max handhsakes reached is now a debug warning 2016-02-16 03:05:05 +01:00
arkpar
fa316c21ae Merge branch 'discovery' of github.com:ethcore/parity into discovery 2016-02-16 02:31:53 +01:00
arkpar
c5ca293d72 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-16 02:31:31 +01:00
arkpar
58fdfe77d3 Handle pinning and enable_discovery options 2016-02-16 02:31:17 +01:00
arkpar
f771306867 Get public address/UPNP refactoring 2016-02-16 02:05:45 +01:00
arkpar
203947388b Get public address/UPNP refactoring 2016-02-16 02:05:36 +01:00
arkpar
681350b03d Merge branch 'discovery' of github.com:ethcore/parity into discovery 2016-02-16 01:36:23 +01:00
arkpar
dbf3691c22 Return nothing on state requests instead of panicing 2016-02-16 01:13:13 +01:00
arkpar
fb0b5b2e5b Raise fd limit in linux 2016-02-16 00:22:44 +01:00
Arkadiy Paronyan
dc6790915e Merge pull request #441 from ethcore/beta-backmerge
beta fixes to master
2016-02-16 00:08:41 +01:00
Nikolay Volf
6bbe551ce8 returing beta dot-tags 2016-02-16 01:39:58 +03:00
Nikolay Volf
29980d3e96 travis fix 2016-02-16 01:07:39 +03:00
Nikolay Volf
453d880999 resolving frontier conflicts 2016-02-16 01:01:03 +03:00
Nikolay Volf
734652d913 work in progress 2016-02-16 00:56:25 +03:00
debris
0a3e8a0fdb more tests for bloomfilter 2016-02-15 21:56:33 +01:00
arkpar
64913d5009 Additional address filter 2016-02-15 21:43:30 +01:00
debris
9e760e9fb8 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-15 21:39:38 +01:00
debris
6d91852c55 test chainfilter on realdata 2016-02-15 21:32:09 +01:00
arkpar
0bef355494 Removed temp test code 2016-02-15 20:34:05 +01:00
arkpar
a2c0508792 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-15 20:30:08 +01:00
Arkadiy Paronyan
482292551b Merge pull request #423 from ethcore/secret-store
Secret store (part1 - key management)
2016-02-15 20:29:54 +01:00
arkpar
01a83e6031 Populate discovery from node table 2016-02-15 20:28:27 +01:00
arkpar
4b9c7f7517 Add incoming connection to node table 2016-02-15 19:54:27 +01:00
arkpar
0e1e80477a Save key to a file 2016-02-15 18:36:34 +01:00
debris
a9e3875230 fixed ethsync tests 2016-02-15 17:47:01 +01:00
arkpar
30968925ee Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-15 16:03:34 +01:00
Nikolay Volf
017a1adb24 fixing issues and moving 2016-02-15 18:01:52 +03:00
arkpar
4d40991c1a Discovery test 2016-02-15 16:01:45 +01:00
debris
552fe1fb4b removed unused functions and warnings 2016-02-15 15:42:43 +01:00
debris
fb4901cbcf Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-15 15:22:43 +01:00
debris
0fab166fba refactored chainfilter.rs, split out indexer 2016-02-15 15:22:13 +01:00
Nikolay Volf
31762095b7 Merge branch 'master' into secret-store 2016-02-15 17:19:04 +03:00
arkpar
cf45d5914a Node table tests 2016-02-15 14:39:56 +01:00
Marek Kotewicz
e1fe4a3871 Merge pull request #438 from ethcore/currecttransition
Use 1100000 as the homestead transition, fix build instructions.
2016-02-15 14:21:48 +01:00
Gav Wood
75197f4586 Update keys_directory.rs 2016-02-15 14:21:45 +01:00
Gav Wood
9f03640a06 Merge pull request #420 from ethcore/net
More sync and propagation fixes
2016-02-15 14:06:36 +01:00
Gav Wood
38a568e426 Use 1100000 as the homestead transition, fix build instructions. 2016-02-15 13:49:44 +01:00
debris
8b28f627ca fixed order of eth_getLogs 2016-02-15 13:39:58 +01:00
arkpar
f141e69671 Added test for restart on malformed block 2016-02-15 13:34:58 +01:00
debris
fada9bb1ba eth_getLogs implementation 2016-02-15 13:18:26 +01:00
arkpar
b503fb5de8 Merge branch 'master' of github.com:ethcore/parity into net 2016-02-15 12:57:19 +01:00
Marek Kotewicz
e7864c301c Merge pull request #436 from ethcore/cargo_packages
back to cargo crates
2016-02-15 11:58:02 +01:00
arkpar
ba95260113 Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-15 11:56:36 +01:00
arkpar
186c7585d2 Node table persistency 2016-02-15 11:54:38 +01:00
debris
bae2682518 bloom possibilities 2016-02-15 11:47:51 +01:00
debris
89bc3e9153 Merge branch 'cargo_packages' into jsonrpc2 2016-02-15 10:53:07 +01:00
debris
4c474d8d91 Merge branch 'master' into jsonrpc2 2016-02-15 10:53:01 +01:00
Marek Kotewicz
d62d78a0fc Merge pull request #435 from ethcore/clippy_warnings
Fixing clippy warnings
2016-02-15 10:48:47 +01:00
debris
874dcdd840 back to cargo crates 2016-02-15 10:47:56 +01:00
Tomusdrw
2c4700f4c1 Fixing clippy warnings 2016-02-15 00:55:45 +01:00
Gav Wood
5b6e47c56f Merge pull request #434 from ethcore/cargo-lock
preserving root cargo lock
2016-02-14 20:26:41 +01:00
Nikolay Volf
3c82e4865d ignore updates 2016-02-14 20:49:36 +03:00
arkpar
986448ce7a Merge branch 'net' into discovery 2016-02-14 18:27:31 +01:00
arkpar
d496523021 Merge branch 'net' of github.com:ethcore/parity into net 2016-02-14 18:09:11 +01:00
arkpar
8b0ec51c0f Update last imported number on new block 2016-02-14 18:08:30 +01:00
arkpar
76590d5a82 Merge branch 'master' of github.com:ethcore/parity into net 2016-02-14 17:50:14 +01:00
arkpar
debf1ed934 Propagate only one last hash for peers that are too far behind 2016-02-14 17:49:20 +01:00
arkpar
38f4a06f1d Fixed panic on accessing expired node 2016-02-14 17:45:00 +01:00
arkpar
61c52f15a3 Fixed panic on accessing expired node 2016-02-14 17:42:03 +01:00
Nikolay Volf
304173f595 preserving root cargo lock 2016-02-14 19:35:45 +03:00
arkpar
fc7483ab87 Propagate only one last hash for peers that are too far behind 2016-02-14 17:10:55 +01:00
Nikolay Volf
3389606c7b crypto section fails checks 2016-02-14 19:09:36 +03:00
Nikolay Volf
75383199d6 kdf params error checking 2016-02-14 18:22:42 +03:00
Nikolay Volf
c50a687213 Merge branch 'master' into net 2016-02-14 17:53:39 +03:00
Nikolay Volf
ae5ec6bad9 Merge branch 'master' into secret-store 2016-02-14 16:01:29 +03:00
Nikolay Volf
c1ab00d915 Merge pull request #432 from ethcore/nightly-fix
Nightly fix
2016-02-14 15:53:47 +03:00
debris
9e0cfa1fad ignore transition tests for now, make travis build green again 2016-02-14 13:31:51 +01:00
debris
0502951b1c Merge branch 'master' of github.com:ethcore/parity into nightly-fix 2016-02-14 13:27:39 +01:00
debris
3ffaed9857 fixed util benches on nighly 2016-02-14 13:25:12 +01:00
Gav Wood
ef059911dc Merge pull request #431 from ethcore/nightly-fix
nightly fixes
2016-02-14 13:12:40 +01:00
debris
f1b39ee1e5 nightly fixes 2016-02-14 12:54:27 +01:00
Marek Kotewicz
4cfb7a2eb2 Merge pull request #430 from ethcore/delayhomestead
Delay homestead transition
2016-02-14 12:21:20 +01:00
Gav Wood
00992069c5 Delat Homestead transition. 2016-02-14 12:18:26 +01:00
arkpar
dee375bfac Handle session creation error 2016-02-14 12:11:18 +01:00
Nikolay Volf
398a83971f Merge pull request #429 from ethcore/homesteaddelay
Delay Homestead transition from 1,000,000.
2016-02-14 14:07:41 +03:00
Gav Wood
b821412f72 Delay in test frontier file. 2016-02-14 12:02:44 +01:00
Gav Wood
48f657c031 Delay Homestead transition from 1,000,000. 2016-02-14 12:01:18 +01:00
arkpar
7503d6695a Fixed panic on session creation 2016-02-14 11:54:08 +01:00
arkpar
718646f943 Refactored host to use different containers for handshakes and sessions 2016-02-14 11:34:59 +01:00
debris
2748e770e4 Merge branch 'master' into jsonrpc2 2016-02-14 11:13:22 +01:00
Marek Kotewicz
e1cd5186c6 Merge pull request #428 from ethcore/fix-nightly-2
Nightly fix effort (still should fail)
2016-02-14 03:36:17 +01:00
arkpar
2d89708ea8 Reduced thread contention 2016-02-14 02:11:55 +01:00
arkpar
9768fddb19 Homestead block set to 1100000 2016-02-14 01:05:54 +01:00
arkpar
76ea030b78 Small refactoring 2016-02-14 01:03:48 +01:00
Nikolay Volf
9ff3155a64 clippy, returing docopt 2016-02-14 00:58:41 +03:00
arkpar
62b9f4b91d UDP discovery working 2016-02-13 22:57:39 +01:00
Nikolay Volf
2205b80703 trigger build 2016-02-13 18:11:46 +03:00
Marek Kotewicz
254b855963 Merge pull request #425 from ethcore/fix-nightly
clippy version update, docopt-macro moving to fork
2016-02-13 14:17:41 +01:00
debris
3a09b2f226 fixed build 2016-02-13 13:15:46 +01:00
debris
3fcade9f6d bloom possibilities in progress 2016-02-13 13:05:28 +01:00
Nikolay Volf
84c752583a clippy version update, docopt-macro moving to fork 2016-02-13 13:17:16 +03:00
Nikolay Volf
91c6b6e2c1 coverage fix 2016-02-13 01:29:28 +03:00
Nikolay Volf
7fa0fd2440 garbage collection 2016-02-13 01:12:32 +03:00
Nikolay Volf
19e1f63909 issues with loading and more tests 2016-02-12 23:27:09 +03:00
Nikolay Volf
89c5d9f6f6 tests and serialization fixes 2016-02-12 20:09:24 +03:00
Nikolay Volf
f198e53891 documentation effort 2016-02-12 18:39:47 +03:00
arkpar
2af379d4b1 Merge branch 'net' of github.com:ethcore/parity into discovery 2016-02-12 15:52:11 +01:00
arkpar
48924f490b Merge branch 'master' of github.com:ethcore/parity into discovery 2016-02-12 15:52:00 +01:00
arkpar
fcd0dafbe4 Fixed random failing test 2016-02-12 15:48:26 +01:00
arkpar
34b465a125 Check for peer registration 2016-02-12 14:20:18 +01:00
debris
c9e0071fde blockchain bloomfilter should be ok by now... 2016-02-12 14:03:23 +01:00
arkpar
f74c5dc921 More sync and propagation fixes 2016-02-12 13:07:02 +01:00
Nikolay Volf
1c57214786 constructor rename 2016-02-12 12:52:42 +03:00
arkpar
09b6503795 Discovery packets 2016-02-12 09:52:32 +01:00
Gav Wood
23d2899e54 Merge pull request #416 from ethcore/net
Network/Sync fixes and optimizations
2016-02-12 09:18:37 +01:00
debris
b73d528365 bloomfilter reset_chain_head 2016-02-12 02:03:04 +01:00
debris
160c52a14b bloomfilters connected to blockchain (but without reversion) 2016-02-12 00:40:45 +01:00
Gav Wood
3575e6bbc1 Update main.rs 2016-02-12 00:24:10 +01:00
Nikolay Volf
6cdc220406 key directory 2016-02-12 01:43:37 +03:00
arkpar
01d9ffcd9b Minor fixes 2016-02-11 22:14:06 +01:00
arkpar
62ac80d53f Merge branch 'master' of github.com:ethcore/parity into net 2016-02-11 21:10:47 +01:00
arkpar
84732d4b94 Sync fixes 2016-02-11 21:10:41 +01:00
Gav Wood
0a41dedc05 Merge pull request #414 from ethcore/state
Use latest era instead of end era as journal marker
2016-02-11 18:44:52 +01:00
arkpar
aed348ce8b Merge branch 'master' of github.com:ethcore/parity into net 2016-02-11 18:36:45 +01:00
arkpar
f4d8070bda Fixed one extra block/header being requested 2016-02-11 18:36:26 +01:00
Arkadiy Paronyan
6c8f82d865 Merge pull request #402 from ethcore/jsonrpc2
api changes
2016-02-11 18:35:15 +01:00
Nikolay Volf
d9b6ab1128 flush 2016-02-11 19:48:47 +03:00
Nikolay Volf
02990290c6 json generation 2016-02-11 18:25:00 +03:00
debris
2cf0f1b5f3 moved chainfilter from util to ethcore, blockchain stores block blooms 2016-02-11 14:35:03 +01:00
Nikolay Volf
e61376565e parsing tests 2016-02-11 16:17:38 +03:00
arkpar
64b15cdbc0 Merge branch 'master' of github.com:ethcore/parity into net 2016-02-11 14:08:56 +01:00
arkpar
6281d18227 net-key option 2016-02-11 14:08:52 +01:00
arkpar
0d0441a186 Use latest era instead of end era as journal marker 2016-02-11 13:32:27 +01:00
Gav Wood
413502e7f6 Merge branch 'master' of github.com:ethcore/parity 2016-02-11 11:56:09 +01:00
Gav Wood
3bfe8bea45 Deps script. 2016-02-11 11:55:49 +01:00
Arkadiy Paronyan
7b47635879 Merge pull request #408 from ethcore/noinitnodes
Option for no init nodes.
2016-02-11 11:15:07 +01:00
Gav Wood
439e99d32b Option for no init nodes. 2016-02-11 10:46:55 +01:00
Gav Wood
25e2e382ea Add contributing agreement. 2016-02-11 10:34:52 +01:00
debris
b0f2ae147b Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-11 10:20:15 +01:00
Nikolay Volf
50a6e90e3d Merge pull request #406 from ethcore/net
Fixed block_bodies not returning a list
2016-02-11 04:32:19 +03:00
Nikolay Volf
f0431218d6 basic parsing 2016-02-11 04:22:59 +03:00
Arkadiy Paronyan
83c4a05d31 Merge pull request #405 from ethcore/cliopt
Fix test.
2016-02-11 02:08:36 +01:00
arkpar
7bb661e21c Fixed block_bodies not returning a list 2016-02-11 02:07:46 +01:00
Nikolay Volf
ebe3990d0d fixing tests and build 2016-02-11 03:40:22 +03:00
Nikolay Volf
e19b89be2c flush 2016-02-11 03:32:44 +03:00
Gav Wood
5f742c9142 Fix test. 2016-02-11 00:38:19 +01:00
Arkadiy Paronyan
61c8f7b00b Merge pull request #404 from ethcore/cliopt
Allow path to be configured.
2016-02-10 23:55:48 +01:00
Gav Wood
b4faad8469 Merge branch 'master' into cliopt 2016-02-10 23:51:22 +01:00
Nikolay Volf
7bfb832312 type metadata for key files 2016-02-11 01:06:35 +03:00
debris
e577431051 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-10 23:06:03 +01:00
debris
4fe86a4419 eth_getBlockByNumber 2016-02-10 22:54:12 +01:00
debris
93975be5e3 transaction by block number and index 2016-02-10 22:36:59 +01:00
debris
df0fa06e8a applied client interface changes to sync tests 2016-02-10 22:16:25 +01:00
debris
484a4d8bdd Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-10 21:52:52 +01:00
Gav Wood
3e49c960a0 Install both rocksdb deps. 2016-02-10 21:31:21 +01:00
Gav Wood
cb09768145 Fix deps script again. 2016-02-10 21:22:24 +01:00
Gav Wood
30f291e6ce Merge branch 'master' of github.com:ethcore/parity 2016-02-10 21:21:32 +01:00
Gav Wood
25c3e49b4f Fix deps script. 2016-02-10 21:21:17 +01:00
Gav Wood
9ac4f51601 Allow path to be configured. 2016-02-10 21:17:47 +01:00
Nikolay Volf
428962df35 Merge pull request #400 from ethcore/upnp
Upnp
2016-02-10 22:25:19 +03:00
debris
db35e21bcd few client methods use BlockId instead of hash and BlockNumber 2016-02-10 19:29:27 +01:00
Arkadiy Paronyan
0f665a6cbc Merge pull request #398 from ethcore/jsonrpc2
eth_syncing, fixed #397
2016-02-10 19:13:00 +01:00
Gav Wood
1d60e38f14 Merge pull request #399 from ethcore/sigterm
Using modified version of ctrlc that catches SIGTERM
2016-02-10 18:34:53 +01:00
Gav Wood
0e679fbee5 Revert collecting trie stats. 2016-02-10 18:26:39 +01:00
debris
2c360d6c9b fixed protocol_version, hash_rate, block_number and gas_price methods 2016-02-10 18:26:06 +01:00
Gav Wood
e8aaf26ab4 Revert printing trie insertion stats. 2016-02-10 18:26:03 +01:00
Gav Wood
637ca97dc6 Synchronous UPnP. 2016-02-10 18:11:10 +01:00
debris
a938ac67d1 eth_syncing use best_block_hash instead of last_imported_block_number 2016-02-10 18:03:29 +01:00
Gav Wood
39d5b68785 Merge branch 'master' of github.com:ethcore/parity 2016-02-10 17:21:07 +01:00
Nikolay Volf
66a370af9b Merge pull request #396 from ethcore/close_gently
Catching panics.
2016-02-10 18:55:53 +03:00
Tomusdrw
d7a36f4a9d Using modified version of ctrlc that catches SIGTERM 2016-02-10 16:55:15 +01:00
Gav Wood
5c73c298dc Merge branch 'master' of github.com:ethcore/parity 2016-02-10 16:46:06 +01:00
Gav Wood
35374ac09c Start of UPnP. 2016-02-10 16:45:54 +01:00
Tomusdrw
96dda7b73a Forwarding panics from threads 2016-02-10 16:35:52 +01:00
debris
373f0da56a Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-10 16:29:05 +01:00
debris
9159d5812b eth_syncing, fixed #397 2016-02-10 16:28:59 +01:00
Marek Kotewicz
e69cd0f8c3 Merge pull request #391 from ethcore/jsonrpc2
jsonrpc
2016-02-10 15:33:02 +01:00
Tomusdrw
7925642b1b Removing overengineered stuff 2016-02-10 15:28:43 +01:00
debris
5347d4fe43 changed BlockPosition -> Location 2016-02-10 15:15:28 +01:00
debris
dc8fa4ebfd moved BlockId and TransactionId to blockchain.rs 2016-02-10 15:09:38 +01:00
Tomusdrw
0d121dd51a Removing unecessary locks causing dead-locks 2016-02-10 14:49:31 +01:00
Tomusdrw
31bcc541d0 Fixing parity build 2016-02-10 14:16:53 +01:00
Tomusdrw
6b0cc0c8fa Merge branch 'master' into close_gently
Conflicts:
	parity/main.rs
2016-02-10 13:13:04 +01:00
Tomusdrw
2a498fc3eb Implementing PanicHandlers for all places when new thread is spawned. Handling Client panics 2016-02-10 12:50:27 +01:00
debris
75b54cc277 updated BlockId and TransactionId description 2016-02-10 12:43:26 +01:00
debris
8c43c989af fixed Uniquely typo 2016-02-10 12:41:36 +01:00
debris
7491815e27 fixed ethsync tests 2016-02-10 11:44:03 +01:00
debris
626277ef9a block and transaction ids, jsonrpcs eth_getTransactionByHash 2016-02-10 11:28:40 +01:00
debris
b86ddbb923 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-10 10:13:07 +01:00
debris
bceae29fca small clenaup 2016-02-10 10:12:56 +01:00
Gav Wood
9f8766c8da Merge pull request #394 from ethcore/ext-tests
Externalities tests (still clumsy)
2016-02-10 02:50:02 +01:00
Gav Wood
f0e26e3495 Merge pull request #395 from ethcore/coverage-reasonable
excluding test code itself from coverage
2016-02-10 01:49:28 +01:00
Nikolay Volf
92a08c26ad excluding test code itself from coverage 2016-02-10 03:27:54 +03:00
Nikolay Volf
4ab99a6bb3 fixed conflicting namespaces 2016-02-10 02:20:36 +03:00
debris
4df096fed3 optimize blockchains transaction_at 2016-02-10 00:12:09 +01:00
debris
d0792dff31 Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-09 23:23:35 +01:00
Nikolay Volf
dabce9ab45 cleanup, warnings 2016-02-10 01:11:22 +03:00
Nikolay Volf
2982c7973e externalities suicide test 2016-02-10 01:02:31 +03:00
Nikolay Volf
2b6eb97f66 log test 2016-02-10 00:41:45 +03:00
Nikolay Volf
71786dd172 should_panic test 2016-02-10 00:32:47 +03:00
Arkadiy Paronyan
4ab845806d Merge pull request #392 from ethcore/https-fix
(BETA) https link in the installer (?)
2016-02-09 21:15:22 +01:00
Nikolay Volf
167c568d55 https link in the installer 2016-02-09 22:34:15 +03:00
Nikolay Volf
3b01ca93cd call fail test 2016-02-09 22:30:35 +03:00
Gav Wood
a691846cf8 Merge pull request #390 from ethcore/options
Additional tweaks to options.
2016-02-09 19:31:54 +01:00
debris
27acdf38e2 fixed ethsync tests 2016-02-09 18:34:06 +01:00
debris
75ccb22d26 add Debug, PartialEq and Eq to LocalizedTransaction 2016-02-09 18:14:04 +01:00
Nikolay Volf
1603b2bf64 flush 2016-02-09 19:47:14 +03:00
debris
3abe5e941f Merge branch 'master' of github.com:ethcore/parity into jsonrpc2 2016-02-09 17:45:51 +01:00
debris
b12d0f690d fixed filter deserialization 2016-02-09 17:45:39 +01:00
debris
1f69b60041 filter deserialization 2016-02-09 17:37:16 +01:00
Nikolay Volf
5767931df6 dried out tests 2016-02-09 19:29:52 +03:00
Gav Wood
d8f8038f16 Additional tweaks to options. 2016-02-09 17:23:25 +01:00
Nikolay Volf
b42f5145a6 check env_info 2016-02-09 07:54:58 -08:00
Gav Wood
015aaad2c4 Merge pull request #388 from ethcore/options
--chain option for setting which network to go on.
2016-02-09 16:50:31 +01:00
Tomusdrw
0757ac1493 PanicHandler - work in progress 2016-02-09 16:47:21 +01:00
debris
abcfe9f9e8 eth_getBlock properly returns transactions 2016-02-09 16:38:21 +01:00
Nikolay Volf
7f607905ed moving around setups 2016-02-09 07:31:57 -08:00
Gav Wood
8be5340385 Tabs! 2016-02-09 16:19:12 +01:00
Gav Wood
e987a492dc --chain option for setting which network to go on.
Add contents function to util.
2016-02-09 15:51:48 +01:00
Nikolay Volf
cc4206f690 initial test setup 2016-02-09 06:28:27 -08:00
debris
5d05c36791 LocalizedTransaction 2016-02-09 15:17:01 +01:00
Gav Wood
1ae4da46b3 Merge pull request #387 from ethcore/coverage-effort
Ethash unit tests final
2016-02-09 13:59:48 +01:00
Nikolay Volf
97789cbab7 Merge pull request #374 from ethcore/jsonrpc
jsonrpc
2016-02-09 15:51:28 +03:00
debris
ac2ee42804 Merge branch 'jsonrpc' into jsonrpc2 2016-02-09 13:25:47 +01:00
Marek Kotewicz
c57a0a5f2e Merge pull request #384 from ethcore/editorconfig
Editorconfig file.
2016-02-09 13:23:21 +01:00
debris
fd18be4317 change CLIENT_DB_VER_STR instead of DB_VERSION 2016-02-09 13:21:32 +01:00
Nikolay Volf
095c60d440 possible panic resolution, block family tests 2016-02-09 04:20:18 -08:00
debris
c50eb78ca1 jsonrpc optionals 2016-02-09 13:17:55 +01:00
Arkadiy Paronyan
46d3fe3070 Merge pull request #382 from ethcore/coverage-effort
Coverage effort [in progress]
2016-02-09 13:14:55 +01:00
Nikolay Volf
9358e9444c unordered h256-pass fix 2016-02-09 03:58:32 -08:00
debris
40068c1938 added missing docs 2016-02-09 12:27:05 +01:00
Gav Wood
5938b65097 Additional help at he end of the install; no need to install sudo. 2016-02-09 12:24:36 +01:00
Nikolay Volf
55a29bfa86 unordered verification 2016-02-09 03:23:35 -08:00
Gav Wood
ffadbf1d10 Force apt-get update on ubuntu. 2016-02-09 12:20:27 +01:00
Gav Wood
a33fbbd991 Merge branch 'master' of github.com:ethcore/parity 2016-02-09 12:10:14 +01:00
Gav Wood
b1110272a4 Parity install sceipt cleanups. 2016-02-09 12:09:51 +01:00
Gav Wood
83fe91c88f Install script avoids compiling on Ubuntu. 2016-02-09 11:39:04 +01:00
Tomusdrw
9d9c56a054 Editorconfig file. 2016-02-09 10:50:29 +01:00
debris
e911e64704 db_version 2 2016-02-09 10:19:04 +01:00
debris
bb3ffe5764 Merge branch 'master' of github.com:ethcore/parity into jsonrpc 2016-02-09 10:13:35 +01:00
Gav Wood
0fc5a5c91e Merge pull request #380 from ethcore/coverage-config
making root kcov runner simular to the one running on CI
2016-02-09 09:54:47 +01:00
Gav Wood
1b89654d0c Merge pull request #381 from ethcore/docker
add gcc as a dependency to dockerfiles
2016-02-09 09:53:15 +01:00
Nikolay Volf
fc0153a5a4 returning client to the place it should be, cleanup 2016-02-09 00:54:33 +03:00
Nikolay Volf
3ef3f5ac31 Merge branch 'coverage-config' into coverage-effort 2016-02-09 00:11:01 +03:00
Nikolay Volf
22dd075692 proper fail conditions 2016-02-08 23:43:53 +03:00
Nikolay Volf
1ae7db2e03 coverage & panics avoidance 2016-02-08 23:07:14 +03:00
KKudryavtsev
6e89f5ef22 tabified 2016-02-08 19:58:19 +01:00
KKudryavtsev
b9d2b42050 Merge branch 'master' of github.com:ethcore/parity into docker 2016-02-08 19:25:18 +01:00
KKudryavtsev
3fed6a2f1c added gcc dependency to Dockerfiles 2016-02-08 19:23:42 +01:00
Nikolay Volf
8fe5b4e2ba removing tests from coverage 2016-02-08 21:12:12 +03:00
Nikolay Volf
c60c702170 making it EXACTLY the same 2016-02-08 20:20:45 +03:00
Gav Wood
7bc340956f Correct node id for bootnode. 2016-02-08 16:57:57 +01:00
Nikolay Volf
f5b218ba89 making local coverage identical to CI 2016-02-08 07:25:41 -08:00
Gav Wood
ac218dc502 Merge pull request #377 from ethcore/net
beta: Check for handshake expiration before attempting replace
2016-02-08 16:21:31 +01:00
debris
e5e33826a7 fixed failin ethsync test 2016-02-08 16:07:38 +01:00
arkpar
2cf7734897 Enable travis build for beta branch 2016-02-08 15:54:13 +01:00
debris
483ee1fbce blockchain transaction api 2016-02-08 15:53:22 +01:00
arkpar
bb9d5db969 Check for handshake expiration before attempting replace 2016-02-08 15:44:39 +01:00
Gav Wood
76d51a3da6 Merge pull request #375 from ethcore/net
Check for handshake expiration before attempting connection replace
2016-02-08 15:41:49 +01:00
Gav Wood
666a1c3a57 Merge pull request #364 from ethcore/block-propagation
Blocks propagation
2016-02-08 15:41:17 +01:00
Gav Wood
3bd3f7967e Merge pull request #376 from ethcore/netopts
Network params.
2016-02-08 15:40:24 +01:00
Gav Wood
9d495d5beb Network params. 2016-02-08 15:04:12 +01:00
arkpar
b411a3d55d Check for handshake expiration before attempting replace 2016-02-08 15:03:44 +01:00
Gav Wood
4076c41de8 Merge pull request #373 from ethcore/ourbootnode
Add parity-node-zero to bootnodes.
2016-02-08 14:23:43 +01:00
Marek Kotewicz
4c25269b1d Update README.md 2016-02-08 14:19:29 +01:00
Marek Kotewicz
db9a7f4c45 Update README.md 2016-02-08 14:18:48 +01:00
debris
038f80437e Merge branch 'master' of github.com:ethcore/parity into jsonrpc 2016-02-08 14:15:06 +01:00
Gav Wood
a531229076 Back to 30303. 2016-02-08 14:06:49 +01:00
debris
41e64bff4e tests for block serialization 2016-02-08 14:02:47 +01:00
Gav Wood
3c6f61a058 Merge branch 'master' of github.com:ethcore/parity 2016-02-08 14:01:33 +01:00
Gav Wood
35902cb205 Merge pull request #370 from ethcore/travis_job_id
kcov uses travis_job_id instead of coveralls token
2016-02-08 14:00:21 +01:00
Gav Wood
b27a7e0387 30304 for bootnode. 2016-02-08 13:55:49 +01:00
Gav Wood
7c8525ed09 Merge branch 'master' of github.com:ethcore/parity 2016-02-08 13:55:32 +01:00
Gav Wood
69644d74c7 Install dev files for rocksdb. 2016-02-08 13:54:35 +01:00
Gav Wood
047731b11d Add parity-node-zero.ethcore.io to boot nodes. 2016-02-08 13:39:06 +01:00
Gav Wood
986f08e0d8 Merge branch 'master' of github.com:ethcore/parity 2016-02-08 13:35:27 +01:00
Gav Wood
66685b2296 Don't use sudo for multirust. 2016-02-08 13:34:21 +01:00
debris
f532d76928 trying to trigger travis build 2016-02-08 13:34:01 +01:00
debris
d53893b346 kcov uses travis_job_id instead of coveralls token 2016-02-08 13:07:59 +01:00
Nikolay Volf
11103b083a fixed test 2016-02-08 03:35:51 -08:00
Nikolay Volf
3dd220b62f refactoring of report functions, some comments 2016-02-08 03:14:48 -08:00
Nikolay Volf
deffb271bc refactoring of report functions, some comments 2016-02-08 03:14:39 -08:00
debris
a0451a3cb5 eth_getBlockXXX takes into account include_tx param 2016-02-08 12:13:05 +01:00
debris
90f965cf53 Merge branch 'master' of github.com:ethcore/parity into jsonrpc 2016-02-08 11:59:03 +01:00
debris
b2c083ce56 fixed U256 serialization, tests for transaction serialization 2016-02-08 11:58:47 +01:00
debris
3adfebdc20 jsonrpc eth_getCode method 2016-02-08 10:58:08 +01:00
Nikolay Volf
70d59e4a52 Merge branch 'nvolf' into block-propagation 2016-02-08 01:40:15 +03:00
Nikolay Volf
871b7113ec fixes for valid rlp 2016-02-08 01:39:02 +03:00
Nikolay Volf
b6f74bd143 Merge branch 'master' into nvolf
Conflicts:
	util/src/journaldb.rs
2016-02-08 00:58:59 +03:00
Nikolay Volf
69a4349ee2 documentation 2016-02-08 00:52:56 +03:00
Nikolay Volf
e9af2dfd96 new hashes tests 2016-02-08 00:20:59 +03:00
Nikolay Volf
4b1d67ef49 bunch of tests for new block packet 2016-02-08 00:08:15 +03:00
Nikolay Volf
3f17acca1d empty new block test 2016-02-07 23:01:09 +03:00
Nikolay Volf
c3f23839e8 Merge branch 'ark' into nvolf 2016-02-07 13:40:00 +03:00
Nikolay Volf
37cc69542c Merge branch 'state' into nvolf 2016-02-07 13:39:06 +03:00
Nikolay Volf
efef36b5e8 handling sync message 2016-02-07 03:00:43 +03:00
Nikolay Volf
d40d4ef87c fix tests 2016-02-07 01:43:44 +03:00
Nikolay Volf
0e0f1fea69 tests 2016-02-07 01:15:53 +03:00
Nikolay Volf
67c5e376b8 review fixes 2016-02-06 23:40:41 +03:00
debris
4116bdd8fd Merge branch 'master' into jsonrpc 2016-02-06 21:31:46 +01:00
Nikolay Volf
3e84691cec adding expect 2016-02-06 23:31:37 +03:00
Nikolay Volf
74c97ea36d removed unused latest_number 2016-02-06 23:08:20 +03:00
Nikolay Volf
8cd55276c3 ... and test as well 2016-02-06 23:04:58 +03:00
Nikolay Volf
391ef7e664 actually should be this way 2016-02-06 23:03:26 +03:00
Nikolay Volf
9727f27854 blocks + hashes 2016-02-06 23:00:52 +03:00
Nikolay Volf
62f3b8cae5 Merge branch 'master' into block-propagation 2016-02-06 22:34:13 +03:00
Nikolay Volf
6b02b6eddb using rlp::encode 2016-02-06 22:25:20 +03:00
Nikolay Volf
0905372f70 updating peer best hash when sync 2016-02-06 22:23:25 +03:00
Nikolay Volf
49e61b87a0 calculating peer highest number on fly 2016-02-06 22:16:59 +03:00
Nikolay Volf
b606df451e many fixes 2016-02-06 20:56:21 +03:00
Nikolay Volf
b01f954b05 final tests 2016-02-06 01:45:25 +03:00
arkpar
4af85b488b Fixed an issue with forked counters 2016-02-05 22:54:33 +01:00
Nikolay Volf
90e4722284 Merge branch 'master' into block-propagation 2016-02-05 21:47:27 +03:00
Nikolay Volf
cc3f712fec propagade initial 2016-02-05 09:34:08 -08:00
debris
9c3317620d Merge branch 'master' into jsonrpc 2016-02-05 14:16:39 +01:00
debris
432c0d59c4 few additional rpc eth methods 2016-02-05 13:21:34 +01:00
499 changed files with 85949 additions and 11632 deletions

11
.editorconfig Normal file
View File

@@ -0,0 +1,11 @@
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

9
.gitignore vendored
View File

@@ -7,7 +7,8 @@
# Executables
*.exe
Cargo.lock
# Cargo lock in subs
**/Cargo.lock
# Generated by Cargo
**/target/
@@ -24,4 +25,8 @@ Cargo.lock
/json-tests/target/
# jetbrains ide stuff
.idea
.idea
*.iml
# Build artifacts
out/

View File

@@ -6,56 +6,84 @@ branches:
- master
- /^beta-.*$/
- /^stable-.*$/
- /^beta$/
- /^stable$/
git:
depth: 3
matrix:
fast_finish: true
include:
allow_failures:
- rust: nightly
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}"
include:
- rust: stable
env: FEATURES="--features travis-beta" RUN_TESTS="true"
# - rust: beta
# env: FEATURES="--features travis-beta" RUN_TESTS="true"
- rust: stable
env: FEATURES="--features travis-beta" RUN_BUILD="true"
- rust: beta
env: FEATURES="--features travis-beta" RUN_BUILD="true"
- rust: stable
env: FEATURES="--features travis-beta" RUN_COVERAGE="true"
# - rust: nightly
# env: FEATURES="--features travis-nightly" RUN_BENCHES="true"
- rust: nightly
env: FEATURES="--features travis-nightly" RUN_TESTS="true"
env:
global:
# GH_TOKEN
- 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=
- TARGETS="-p ethkey -p ethstore -p ethash -p ethcore-util -p ethcore -p ethsync -p ethcore-rpc -p parity -p ethjson -p ethcore-dapps -p ethcore-signer"
- ARCHIVE_SUFFIX="-${TRAVIS_OS_NAME}-${TRAVIS_TAG}"
- KCOV_FEATURES=""
- KCOV_CMD="./kcov-master/tmp/usr/local/bin/kcov --exclude-pattern /usr/,/.cargo,/root/.multirust,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests target/kcov"
- RUN_TESTS="false"
- RUN_COVERAGE="false"
- RUN_BUILD="false"
- RUN_BENCHES="false"
- RUST_BACKTRACE="1"
cache:
apt: true
directories:
- target/debug/deps
- target/debug/build
- target/release/deps
- target/release/build
- $TRAVIS_BUILD_DIR/target
- $HOME/.cargo
addons:
apt:
packages:
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
before_script: |
sudo add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" &&
sudo apt-get update &&
sudo apt-get install -y --force-yes librocksdb
script:
- cargo build --release --verbose ${FEATURES}
- cargo test --release --verbose ${FEATURES} ${TARGETS}
- cargo bench --no-run ${FEATURES} ${TARGETS}
- tar cvzf parity${ARCHIVE_SUFFIX}.tar.gz -C target/release parity
- if [ "$RUN_TESTS" = "true" ]; then cargo test --release --verbose ${FEATURES} ${TARGETS}; fi
- if [ "$RUN_BENCHES" = "true" ]; then cargo bench --no-run ${FEATURES} ${TARGETS}; fi
- if [ "$RUN_BUILD" = "true" ]; then cargo build --release --verbose ${FEATURES}; fi
- if [ "$RUN_BUILD" = "true" ]; then tar cvzf parity${ARCHIVE_SUFFIX}.tar.gz -C target/release parity; fi
after_success: |
[ "$RUN_COVERAGE" = "true" ] &&
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-* &&
$KCOV_CMD target/debug/deps/ethkey-* &&
$KCOV_CMD target/debug/deps/ethstore-* &&
$KCOV_CMD target/debug/deps/ethcore_util-* &&
$KCOV_CMD target/debug/deps/ethash-* &&
$KCOV_CMD target/debug/deps/ethcore-* &&
$KCOV_CMD target/debug/deps/ethsync-* &&
$KCOV_CMD target/debug/deps/ethcore_rpc-* &&
$KCOV_CMD target/debug/deps/ethcore_dapps-* &&
$KCOV_CMD target/debug/deps/ethcore_signer-* &&
$KCOV_CMD target/debug/deps/ethjson-* &&
$KCOV_CMD target/debug/parity-* &&
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
[ $TRAVIS_RUST_VERSION = nightly ] &&
[ $TRAVIS_RUST_VERSION = stable ] &&
cargo doc --no-deps --verbose ${KCOV_FEATURES} ${TARGETS} &&
echo '<meta http-equiv=refresh content=0;url=ethcore/index.html>' > target/doc/index.html &&
pip install --user ghp-import &&
/home/travis/.local/bin/ghp-import -n target/doc &&
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
@@ -67,9 +95,14 @@ deploy:
tags: true
notifications:
webhooks:
urls:
- https://hooks.slack.com/services/${SLACK_WEBHOOK}
on_success: always
on_failure: always
on_start: never
webhooks:
urls:
- https://hooks.slack.com/services/${SLACK_WEBHOOK}
on_success: always
on_failure: always
on_start: never
notifications:
slack:
rooms:
- ethcore:4EGxt9WP6AS7uX4JKXSfR9vi#chatops

1496
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,66 @@
[package]
description = "Ethcore client."
name = "parity"
version = "0.9.0"
version = "1.2.3"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
build = "build.rs"
[build-dependencies]
rustc_version = "0.1"
syntex = "*"
ethcore-ipc-codegen = { path = "ipc/codegen" }
[dependencies]
log = "0.3"
env_logger = "0.3"
rustc-serialize = "0.3"
docopt = "0.6"
docopt_macros = "0.6"
ctrlc = "1.0"
clippy = "0.0.37"
ethcore-util = { path = "util" }
ethcore = { path = "ethcore" }
ethsync = { path = "sync" }
ethcore-rpc = { path = "rpc", optional = true }
time = "0.1"
ctrlc = { git = "https://github.com/ethcore/rust-ctrlc.git" }
fdlimit = { path = "util/fdlimit" }
num_cpus = "0.2"
number_prefix = "0.2"
rpassword = "0.2.1"
clippy = { version = "0.0.77", optional = true}
ethcore = { path = "ethcore" }
ethcore-util = { path = "util" }
ethsync = { path = "sync" }
ethcore-devtools = { path = "devtools" }
ethcore-rpc = { path = "rpc", optional = true }
ethcore-signer = { path = "signer", optional = true }
ethcore-dapps = { path = "dapps", optional = true }
semver = "0.2"
ethcore-ipc-nano = { path = "ipc/nano" }
ethcore-ipc = { path = "ipc/rpc" }
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ansi_term = "0.7"
[target.'cfg(windows)'.dependencies]
winapi = "0.2"
[target.'cfg(not(windows))'.dependencies]
daemonize = "0.2"
[dependencies.hyper]
version = "0.8"
default-features = false
[features]
default = ["rpc"]
default = ["rpc", "ethcore-signer", "ui", "use-precompiled-js"]
ui = ["dapps", "ethcore-signer/ui"]
use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"]
dapps = ["ethcore-dapps"]
rpc = ["ethcore-rpc"]
dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev",
"ethcore-dapps/dev", "ethcore-signer/dev"]
travis-beta = ["ethcore/json-tests"]
travis-nightly = ["ethcore/json-tests", "dev"]
[[bin]]
path = "parity/main.rs"
name = "parity"
[profile.release]
debug = true
lto = false

122
README.md
View File

@@ -1,76 +1,88 @@
# 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/trogdoro/xiki][gitter-image]][gitter-url] [![GPLv3][license-image]][license-url]
[travis-image]: https://travis-ci.org/ethcore/parity.svg?branch=master
[travis-url]: https://travis-ci.org/ethcore/parity
[coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master&t=Fk0OuQ
[coveralls-url]: https://coveralls.io/r/ethcore/parity?branch=master
[coveralls-image]: https://coveralls.io/repos/github/ethcore/parity/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/ethcore/parity?branch=master
[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
[license-image]: https://img.shields.io/badge/license-GPL%20v3-green.svg
[license-url]: http://www.gnu.org/licenses/gpl-3.0.en.html
[Documentation](http://ethcore.github.io/parity/ethcore/index.html)
[Internal Documentation](http://ethcore.github.io/parity/ethcore/index.html)
### Building from source
----
##### Ubuntu 14.04, 15.04, 15.10
## About Parity
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
# install rocksdb
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
cargo install --git https://github.com/ethcore/parity.git parity
```
##### Other Linux
----
## Build from source
```bash
# install rocksdb
git clone --tag v4.1 --depth=1 https://github.com/facebook/rocksdb.git
cd rocksdb
make shared_lib
sudo cp -a librocksdb.so* /usr/lib
sudo ldconfig
cd ..
# download Parity code
$ git clone https://github.com/ethcore/parity
$ cd parity
# install rust nightly
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sudo sh -s -- --yes
# 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
# build in release mode
$ cargo build --release
```
##### OSX with Homebrew
This will produce an executable in the `./target/release` subdirectory.
To get started, just run
```bash
# install rocksdb && multirust
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
$ ./target/release/parity
```
and parity will begin syncing the Ethereum blockchain.

50
appveyor.yml Normal file
View 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
branches:
only:
- master
- /^beta-.*$/
- /^stable-.*$/
- /^beta$/
- /^stable$/
install:
- git submodule update --init --recursive
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-1.9.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.9.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
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)
- path: target\release\parity.exe
name: Windows Executable (x86_64)
- path: target\release\parity.pdb
name: Windows Executable Debug Symbols (x86_64)
cache:
- target
- C:\users\appveyor\.cargo -> appveyor.yml

49
build.rs Normal file
View 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/>.
extern crate rustc_version;
extern crate syntex;
extern crate ethcore_ipc_codegen as codegen;
use std::env;
use std::path::Path;
use rustc_version::{version_meta, Channel};
fn main() {
if let Channel::Nightly = version_meta().channel {
println!("cargo:rustc-cfg=nightly");
}
let out_dir = env::var_os("OUT_DIR").unwrap();
// ipc pass
{
let src = Path::new("parity/hypervisor/service.rs.in");
let dst = Path::new(&out_dir).join("hypervisor_service_ipc.rs");
let mut registry = syntex::Registry::new();
codegen::register(&mut registry);
registry.expand("", &src, &dst).unwrap();
}
// serialization pass
{
let src = Path::new(&out_dir).join("hypervisor_service_ipc.rs");
let dst = Path::new(&out_dir).join("hypervisor_service_cg.rs");
let mut registry = syntex::Registry::new();
codegen::register(&mut registry);
registry.expand("", &src, &dst).unwrap();
}
}

26
cov.sh
View File

@@ -15,7 +15,29 @@ if ! type kcov > /dev/null; then
exit 1
fi
cargo test --features ethcore/json-tests -p ethcore --no-run || exit $?
cargo test \
-p ethkey \
-p ethstore \
-p ethash \
-p ethcore-util \
-p ethcore \
-p ethsync \
-p ethcore-rpc \
-p parity \
-p ethcore-signer \
-p ethcore-dapps \
--no-run || exit $?
rm -rf target/coverage
mkdir -p target/coverage
kcov --exclude-pattern ~/.multirust,rocksdb,secp256k1 --include-pattern src --verify target/coverage target/debug/deps/ethcore*
EXCLUDE="~/.multirust,rocksdb,secp256k1,src/tests,util/json-tests,util/src/network/tests,sync/src/tests,ethcore/src/tests,ethcore/src/evm/tests,ethstore/tests"
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethkey-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethstore-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethash-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_util-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethsync-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_rpc-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_signer-*
kcov --exclude-pattern $EXCLUDE --include-pattern src --verify target/coverage target/debug/deps/ethcore_dapps-*
xdg-open target/coverage/index.html

45
dapps/Cargo.toml Normal file
View File

@@ -0,0 +1,45 @@
[package]
description = "Parity Dapps crate"
name = "ethcore-dapps"
version = "1.2.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io"]
build = "build.rs"
[lib]
[dependencies]
log = "0.3"
jsonrpc-core = "2.0"
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git" }
hyper = { default-features = false, git = "https://github.com/ethcore/hyper" }
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 = "0.6" }
# List of apps
parity-dapps-status = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6" }
parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6" }
parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "0.6", optional = true }
mime_guess = { version = "1.6.1" }
clippy = { version = "0.0.77", 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
View 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/mod.rs.in");
let dst = Path::new(&out_dir).join("mod.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();
}

69
dapps/src/api/api.rs Normal file
View 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 std::sync::Arc;
use endpoint::{Endpoint, Endpoints, EndpointInfo, Handler, EndpointPath};
use api::response::as_json;
pub struct RestApi {
endpoints: Arc<Endpoints>,
}
#[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 {
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(),
}
}
}
impl RestApi {
pub fn new(endpoints: Arc<Endpoints>) -> Box<Endpoint> {
Box::new(RestApi {
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> {
as_json(&self.list_apps())
}
}

28
dapps/src/api/mod.rs Normal file
View 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/>.
//! REST API
#![warn(missing_docs)]
#![cfg_attr(feature="nightly", feature(custom_derive, custom_attribute, plugin))]
#![cfg_attr(feature="nightly", plugin(serde_macros, clippy))]
#[cfg(feature = "serde_macros")]
include!("mod.rs.in");
#[cfg(not(feature = "serde_macros"))]
include!(concat!(env!("OUT_DIR"), "/mod.rs"));

21
dapps/src/api/mod.rs.in Normal file
View 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/>.
mod api;
mod response;
pub use self::api::RestApi;
pub use self::api::App;

23
dapps/src/api/response.rs Normal file
View 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/>.
use serde::Serialize;
use serde_json;
use endpoint::{ContentHandler, Handler};
pub fn as_json<T : Serialize>(val: &T) -> Box<Handler> {
Box::new(ContentHandler::new(serde_json::to_string(val).unwrap(), "application/json".to_owned()))
}

116
dapps/src/apps/fs.rs Normal file
View 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
View 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())));
}

99
dapps/src/endpoint.rs Normal file
View File

@@ -0,0 +1,99 @@
// 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::status::StatusCode;
use hyper::{header, server, Decoder, Encoder, Next};
use hyper::net::HttpStream;
use std::io::Write;
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<HttpStream> + Send>;
}
pub type Endpoints = BTreeMap<String, Box<Endpoint>>;
pub type Handler = server::Handler<HttpStream> + Send;
pub struct ContentHandler {
content: String,
mimetype: String,
write_pos: usize,
}
impl ContentHandler {
pub fn new(content: String, mimetype: String) -> Self {
ContentHandler {
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(StatusCode::Ok);
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()
},
}
}
}

177
dapps/src/lib.rs Normal file
View File

@@ -0,0 +1,177 @@
// 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;
extern crate hyper;
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 mime_guess;
mod endpoint;
mod apps;
mod page;
mod router;
mod rpc;
mod api;
mod proxypac;
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_unsecure_http(&self, addr: &SocketAddr) -> Result<Server, ServerError> {
Server::start_http(addr, 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, username: &str, password: &str) -> Result<Server, ServerError> {
Server::start_http(addr, 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 {
fn start_http<A: Authorization + 'static>(addr: &SocketAddr, 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(endpoints.clone()));
special.insert(router::SpecialEndpoint::Utils, apps::utils());
special
});
try!(hyper::Server::http(addr))
.handle(move |_| router::Router::new(
apps::main_page(),
endpoints.clone(),
special.clone(),
authorization.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),
}
}
}

154
dapps/src/page/builtin.rs Normal file
View 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
View 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
View 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
View 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;

48
dapps/src/proxypac.rs Normal file
View File

@@ -0,0 +1,48 @@
// 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, ContentHandler, EndpointPath};
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::new(content, "application/javascript".to_owned()))
}
}

161
dapps/src/router/auth.rs Normal file
View File

@@ -0,0 +1,161 @@
// 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::io::Write;
use std::collections::HashMap;
use hyper::{header, server, Decoder, Encoder, Next};
use hyper::net::HttpStream;
use hyper::status::StatusCode;
/// Authorization result
pub enum Authorized {
/// Authorization was successful.
Yes,
/// Unsuccessful authorization. Handler for further work is returned.
No(Box<server::Handler<HttpStream> + Send>),
}
/// Authorization interface
pub trait Authorization : Send + Sync {
/// Checks if authorization is valid.
fn is_authorized(&self, req: &server::Request<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<HttpStream>)-> Authorized {
Authorized::Yes
}
}
impl Authorization for HttpBasicAuth {
fn is_authorized(&self, req: &server::Request<HttpStream>) -> Authorized {
let auth = self.check_auth(&req);
match auth {
Access::Denied => {
Authorized::No(Box::new(UnauthorizedHandler { write_pos: 0 }))
},
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<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,
}
}
}
pub struct UnauthorizedHandler {
write_pos: usize,
}
impl server::Handler<HttpStream> for UnauthorizedHandler {
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);
Next::write()
}
fn on_response_writable(&mut self, encoder: &mut Encoder<HttpStream>) -> Next {
let response = "Unauthorized".as_bytes();
if self.write_pos == response.len() {
return Next::end();
}
match encoder.write(&response[self.write_pos..]) {
Ok(bytes) => {
self.write_pos += bytes;
Next::write()
},
Err(e) => match e.kind() {
::std::io::ErrorKind::WouldBlock => Next::write(),
_ => Next::end()
},
}
}
}
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()
}
}

255
dapps/src/router/mod.rs Normal file
View File

@@ -0,0 +1,255 @@
// 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.
mod url;
mod redirect;
pub mod auth;
use DAPPS_DOMAIN;
use std::sync::Arc;
use std::collections::HashMap;
use url::Host;
use hyper;
use hyper::{server, uri, header};
use hyper::{Next, Encoder, Decoder};
use hyper::net::HttpStream;
use apps;
use endpoint::{Endpoint, Endpoints, EndpointPath};
use self::url::Url;
use self::auth::{Authorization, Authorized};
use self::redirect::Redirection;
/// 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>,
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 {
// Check authorization
let auth = self.authorization.is_authorized(&req);
// Choose proper handler depending on path / domain
self.handler = match auth {
Authorized::No(handler) => handler,
Authorized::Yes => {
let url = extract_url(&req);
let endpoint = extract_endpoint(&url);
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>) -> Self {
let handler = special.get(&SpecialEndpoint::Rpc).unwrap().to_handler(EndpointPath::default());
Router {
main_page: main_page,
endpoints: endpoints,
special: special,
authorization: authorization,
handler: handler,
}
}
}
fn extract_url(req: &server::Request<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,
}
}
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)
);
}

View 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()
}
}

145
dapps/src/router/url.rs Normal file
View 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::Host;
use url::{self};
/// HTTP/HTTPS URL type for Iron.
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Url {
/// Raw url of url
pub raw: url::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::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::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");
}
}

41
dapps/src/rpc.rs Normal file
View File

@@ -0,0 +1,41 @@
// 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: vec![AccessControlAllowOrigin::Null],
})
}
struct RpcEndpoint {
handler: Arc<IoHandler>,
panic_handler: Arc<Mutex<Option<Box<Fn() -> () + Send>>>>,
cors_domain: Vec<AccessControlAllowOrigin>,
}
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(), panic_handler))
}
}

26
db/Cargo.toml Normal file
View File

@@ -0,0 +1,26 @@
[package]
description = "Ethcore Database"
homepage = "http://ethcore.io"
license = "GPL-3.0"
name = "ethcore-db"
version = "1.2.0"
authors = ["Ethcore <admin@ethcore.io>"]
build = "build.rs"
[build-dependencies]
syntex = "*"
ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies]
clippy = { version = "0.0.77", 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
View 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();
}
}

573
db/src/database.rs Normal file
View File

@@ -0,0 +1,573 @@
// 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};
impl From<String> for Error {
fn from(s: String) -> Error {
Error::RocksDb(s)
}
}
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: &Vec<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().unwrap();
let db_lock = self.db.read().unwrap();
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().unwrap();
let db_lock = self.db.read().unwrap();
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().unwrap();
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().unwrap();
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().unwrap();
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().unwrap();
cache_lock.remove(key.to_vec());
Ok(())
}
fn write(&self, transaction: DBTransaction) -> Result<(), Error> {
let mut cache_lock = self.write_cache.write().unwrap();
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().unwrap().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().unwrap();
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().unwrap();
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().unwrap();
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().unwrap();
let db = try!(db_lock.as_ref().ok_or(Error::IsClosed));
let mut iterators = self.iterators.write().unwrap();
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().unwrap();
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().unwrap();
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
View 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
View 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();
}
});
}

132
db/src/traits.rs Normal file
View File

@@ -0,0 +1,132 @@
// 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,
}
/// 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
View 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.2.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
View 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;
pub mod random_path;
pub mod test_socket;
pub mod stop_guard;
pub use random_path::*;
pub use test_socket::*;
pub use stop_guard::*;

View File

@@ -0,0 +1,99 @@
// 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 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);
}
}
}
#[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());
}

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

View File

@@ -0,0 +1,94 @@
// 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());
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 = self.cursor + buf.len();
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!();
}
}

12
doc.sh
View File

@@ -1,4 +1,14 @@
#!/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
cargo doc --no-deps --verbose \
-p ethkey \
-p ethstore \
-p ethash \
-p ethcore-util \
-p ethcore \
-p ethsync \
-p ethcore-rpc \
-p ethcore-signer \
-p ethcore-dapps \
-p parity \

29
docker/centos/Dockerfile Normal file
View 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

View File

@@ -0,0 +1,49 @@
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
# set compilers
ENV CXX aarch64-linux-gnu-g++
ENV CC aarch64-linux-gnu-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 && \
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

View File

@@ -0,0 +1,49 @@
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
# set compilers
ENV CXX arm-linux-gnueabihf-g++
ENV CC arm-linux-gnueabihf-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 && \
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

View File

@@ -8,7 +8,8 @@ RUN apt-get update && \
# add-apt-repository
software-properties-common \
curl \
wget \
g++ \
wget \
git \
# evmjit dependencies
zlib1g-dev \
@@ -17,9 +18,8 @@ RUN apt-get update && \
# cmake, llvm and rocksdb ppas. then update ppas
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://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \
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
RUN git clone https://github.com/debris/evmjit && \
@@ -27,14 +27,11 @@ RUN git clone https://github.com/debris/evmjit && \
mkdir build && cd build && \
cmake .. && make && make install && cd
# install multirust
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
# install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# install nightly and make it default
RUN multirust update nightly && multirust default nightly
# export rust LIBRARY_PATH
ENV LIBRARY_PATH /usr/local/lib
# rustup directory
ENV PATH /root/.cargo/bin:$PATH
# show backtraces
ENV RUST_BACKTRACE 1

View File

@@ -1,46 +1,55 @@
FROM ubuntu:14.04
WORKDIR /build
# install tools and dependencies
RUN apt-get update && \
apt-get install -y \
# make
build-essential \
# add-apt-repository
software-properties-common \
curl \
wget \
git \
# evmjit dependencies
zlib1g-dev \
libedit-dev
apt-get install -y \
# make
build-essential \
# add-apt-repository
software-properties-common \
curl \
wget \
git \
g++ \
binutils \
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" && \
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 install -y --force-yes cmake llvm-3.7-dev librocksdb
add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main" && \
apt-get update && \
apt-get install -y --force-yes cmake llvm-3.7-dev
# install evmjit
RUN git clone https://github.com/debris/evmjit && \
cd evmjit && \
mkdir build && cd build && \
cmake .. && make && make install && cd
cd evmjit && \
mkdir build && cd build && \
cmake .. && make && make install && cd
# install multirust
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
# install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# install nightly and make it default
RUN multirust update nightly && multirust default nightly
# export rust LIBRARY_PATH
ENV LIBRARY_PATH /usr/local/lib
# rustup directory
ENV PATH /root/.cargo/bin:$PATH
# show backtraces
ENV RUST_BACKTRACE 1
# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
# build parity
# TODO: add jit feature
RUN git clone https://github.com/ethcore/parity && \
cd parity && \
cargo install --features rpc
cd parity && \
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

View File

@@ -1,31 +1,35 @@
FROM ubuntu:14.04
WORKDIR /build
# install tools and dependencies
RUN apt-get update && \
apt-get install -y \
curl \
git \
# add-apt-repository
software-properties-common
apt-get install -y \
g++ \
curl \
git \
file \
binutils
# rocksdb ppas. then update ppas
RUN add-apt-repository "deb http://ppa.launchpad.net/giskou/librocksdb/ubuntu trusty main" && \
apt-get update && \
apt-get install -y --force-yes librocksdb
# install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# install multirust
RUN curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes
# install nightly and make it default
RUN multirust update nightly && multirust default nightly
# export rust LIBRARY_PATH
ENV LIBRARY_PATH /usr/local/lib
# rustup directory
ENV PATH /root/.cargo/bin:$PATH
# show backtraces
ENV RUST_BACKTRACE 1
# show tools
RUN rustc -vV && \
cargo -V && \
gcc -v &&\
g++ -v
# build parity
RUN git clone https://github.com/ethcore/parity && \
cd parity && \
cargo install --features rpc
cd parity && \
git checkout beta && \
git pull && \
cargo build --release --verbose && \
ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity
RUN file /build/parity/target/release/parity

View File

@@ -1,11 +1,11 @@
[package]
name = "ethash"
version = "0.1.0"
version = "1.2.0"
authors = ["arkpar <arkadiy@ethcore.io"]
[lib]
[dependencies]
log = "0.3"
lru-cache = "0.0"
sha3 = { path = "../util/sha3" }
primal = "0.2.3"

View File

@@ -19,33 +19,39 @@
// TODO: fix endianess for big endian
use primal::is_prime;
use std::cell::Cell;
use std::sync::Mutex;
use std::mem;
use std::ptr;
use sizes::{CACHE_SIZES, DAG_SIZES};
use sha3;
use std::slice;
use std::path::PathBuf;
use std::io::{Read, Write, self};
use std::io::{self, Read, Write};
use std::fs::{self, File};
pub const ETHASH_EPOCH_LENGTH: u64 = 30000;
pub const ETHASH_CACHE_ROUNDS: usize = 3;
pub const ETHASH_MIX_BYTES: usize = 128;
pub const ETHASH_ACCESSES:usize = 64;
pub const ETHASH_DATASET_PARENTS:u32 = 256;
pub const ETHASH_ACCESSES: usize = 64;
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_BYTES: usize = 64;
const MIX_WORDS: usize = ETHASH_MIX_BYTES / 4;
const MIX_NODES: usize = MIX_WORDS / NODE_WORDS;
const FNV_PRIME: u32 = 0x01000193;
const FNV_PRIME: u32 = 0x01000193;
/// Computation result
pub struct ProofOfWork {
/// Difficulty boundary
pub value: H256,
/// Mix
pub mix_hash: H256
pub mix_hash: H256,
}
struct Node {
@@ -53,7 +59,7 @@ struct Node {
}
impl Default for Node {
fn default() -> Self {
fn default() -> Self {
Node { bytes: [0u8; NODE_BYTES] }
}
}
@@ -81,6 +87,7 @@ pub type H256 = [u8; 32];
pub struct Light {
block_number: u64,
cache: Vec<Node>,
seed_compute: Mutex<SeedHashCompute>,
}
/// Light cache structur
@@ -97,19 +104,19 @@ impl Light {
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();
home.push(".ethash");
home.push("light");
let seed_hash = get_seedhash(block_number);
home.push(to_hex(&seed_hash));
home
}
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 cache_size = get_cache_size(block_number);
if try!(file.metadata()).len() != cache_size as u64 {
return Err(io::Error::new(io::ErrorKind::Other, "Cache file size mismatch"));
@@ -122,21 +129,68 @@ impl Light {
Ok(Light {
cache: nodes,
block_number: block_number,
seed_compute: Mutex::new(seed_compute),
})
}
pub fn to_file(&self) -> io::Result<()> {
let path = Light::file_path(self.block_number);
let seed_compute = self.seed_compute.lock().unwrap();
let path = Light::file_path(seed_compute.get_seedhash(self.block_number));
try!(fs::create_dir_all(path.parent().unwrap()));
let mut file = try!(File::create(path));
let cache_size = self.cache.len() * NODE_BYTES;
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(())
}
}
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]
fn fnv_hash(x: u32, y: u32) -> u32 {
return x.wrapping_mul(FNV_PRIME) ^ y;
@@ -149,25 +203,24 @@ fn sha3_512(input: &[u8], output: &mut [u8]) {
#[inline]
fn get_cache_size(block_number: u64) -> usize {
assert!(block_number / ETHASH_EPOCH_LENGTH < 2048);
return CACHE_SIZES[(block_number / ETHASH_EPOCH_LENGTH) as usize] as usize;
let mut sz: u64 = CACHE_BYTES_INIT + CACHE_BYTES_GROWTH * (block_number / ETHASH_EPOCH_LENGTH);
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]
fn get_data_size(block_number: u64) -> usize {
assert!(block_number / ETHASH_EPOCH_LENGTH < 2048);
return DAG_SIZES[(block_number / ETHASH_EPOCH_LENGTH) as usize] as usize;
let mut sz: u64 = DATASET_BYTES_INIT + DATASET_BYTES_GROWTH * (block_number / ETHASH_EPOCH_LENGTH);
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
///
@@ -198,12 +251,12 @@ pub fn light_compute(light: &Light, header_hash: &H256, nonce: u64) -> ProofOfWo
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 {
panic!("Unaligned full size");
}
// 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(mem::transmute(&nonce), s_mix.get_unchecked_mut(0).bytes[32..].as_mut_ptr(), 8) };
@@ -244,7 +297,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(), mix_hash.as_mut_ptr(), 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 {
mix_hash: mix_hash,
value: value,
@@ -274,7 +327,9 @@ fn calculate_dag_item(node_index: u32, light: &Light) -> Node {
}
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);
if cache_size % NODE_BYTES != 0 {
@@ -289,13 +344,13 @@ fn light_new(block_number: u64) -> Light {
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);
}
for _ in 0..ETHASH_CACHE_ROUNDS {
for i in 0..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();
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);
}
@@ -305,10 +360,11 @@ fn light_new(block_number: u64) -> Light {
Light {
cache: nodes,
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 {
let mut v = Vec::with_capacity(bytes.len() * 2);
for &byte in bytes.iter() {
@@ -316,15 +372,38 @@ fn to_hex(bytes: &[u8]) -> String {
v.push(CHARS[(byte & 0xf) as usize]);
}
unsafe {
String::from_utf8_unchecked(v)
}
unsafe { 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]
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 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 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 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];
assert_eq!(quick_get_difficulty(&hash, nonce, &mix_hash)[..], boundary_good[..]);
@@ -334,8 +413,8 @@ fn test_difficulty_test() {
#[test]
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 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 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 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;
// difficulty = 0x085657254bd9u64;
@@ -344,3 +423,34 @@ fn test_light_compute() {
assert_eq!(result.mix_hash[..], mix_hash[..]);
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);
}

View File

@@ -16,29 +16,40 @@
//! Ethash implementation
//! See https://github.com/ethereum/wiki/wiki/Ethash
extern crate primal;
extern crate sha3;
extern crate lru_cache;
#[macro_use]
extern crate log;
mod sizes;
mod compute;
use lru_cache::LruCache;
use std::mem;
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};
/// 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 {
lights: Mutex<LruCache<u64, Arc<Light>>>
cache: Mutex<LightCache>,
}
impl EthashManager {
/// Create a new new instance of ethash manager
pub fn new() -> EthashManager {
EthashManager {
lights: Mutex::new(LruCache::new(2))
EthashManager {
cache: Mutex::new(LightCache {
recent_epoch: None,
recent: None,
prev_epoch: None,
prev: None,
}),
}
}
@@ -50,12 +61,28 @@ impl EthashManager {
pub fn compute_light(&self, block_number: u64, header_hash: &H256, nonce: u64) -> ProofOfWork {
let epoch = block_number / ETHASH_EPOCH_LENGTH;
let light = {
let mut lights = self.lights.lock().unwrap();
match lights.get_mut(&epoch).map(|l| l.clone()) {
let mut lights = self.cache.lock().unwrap();
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 => {
let light = match Light::from_file(block_number) {
Ok(light) => Arc::new(light),
Err(e) => {
Err(e) => {
debug!("Light cache file not found for {}:{}", block_number, e);
let light = Light::new(block_number);
if let Err(e) = light.to_file() {
@@ -64,12 +91,29 @@ impl EthashManager {
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
}
Some(light) => light
Some(light) => light,
}
};
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().unwrap().recent_epoch.unwrap(), 1);
assert_eq!(ethash.cache.lock().unwrap().prev_epoch.unwrap(), 0);
ethash.compute_light(1, &hash, 1);
assert_eq!(ethash.cache.lock().unwrap().recent_epoch.unwrap(), 0);
assert_eq!(ethash.cache.lock().unwrap().prev_epoch.unwrap(), 1);
ethash.compute_light(70000, &hash, 1);
assert_eq!(ethash.cache.lock().unwrap().recent_epoch.unwrap(), 2);
assert_eq!(ethash.cache.lock().unwrap().prev_epoch.unwrap(), 0);
}

View File

@@ -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
];

View File

@@ -3,27 +3,43 @@ description = "Ethcore library"
homepage = "http://ethcore.io"
license = "GPL-3.0"
name = "ethcore"
version = "0.9.0"
version = "1.2.0"
authors = ["Ethcore <admin@ethcore.io>"]
build = "build.rs"
[build-dependencies]
syntex = "*"
"ethcore-ipc-codegen" = { path = "../ipc/codegen" }
[dependencies]
log = "0.3"
env_logger = "0.3"
rustc-serialize = "0.3"
rocksdb = "0.3"
heapsize = "0.2.0"
heapsize = "0.3"
rust-crypto = "0.2.34"
time = "0.1"
ethcore-util = { path = "../util" }
evmjit = { path = "../evmjit", optional = true }
ethash = { path = "../ethash" }
num_cpus = "0.2"
clippy = "0.0.37"
crossbeam = "0.1.5"
lazy_static = "0.1"
clippy = { version = "0.0.77", optional = true}
crossbeam = "0.2.9"
lazy_static = "0.2"
ethcore-devtools = { path = "../devtools" }
ethjson = { path = "../json" }
bloomchain = "0.1"
"ethcore-ipc" = { path = "../ipc/rpc" }
rayon = "0.3.1"
ethstore = { path = "../ethstore" }
[dependencies.hyper]
git = "https://github.com/ethcore/hyper"
default-features = false
[features]
jit = ["evmjit"]
evm-debug = []
json-tests = []
test-heavy = []
dev = ["clippy"]
default = []

33
ethcore/build.rs Normal file
View File

@@ -0,0 +1,33 @@
// 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;
fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
// serialization pass
{
let src = Path::new("src/types/mod.rs.in");
let dst = Path::new(&out_dir).join("types.rs");
let mut registry = syntex::Registry::new();
codegen::register(&mut registry);
registry.expand("", &src, &dst).unwrap();
}
}

View File

@@ -0,0 +1,162 @@
{
"name": "DAO hard-fork consensus test",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "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"
]
}
}
},
"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 } } } }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,154 @@
{
"name": "Frontier",
"engineName": "Ethash",
"name": "Frontier/Homestead",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "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"
]
}
}
},
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xf4240",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"networkID" : "0x1"
"networkID" : "0x1",
"forkBlock": "0x1d4c00",
"forkCanonHash": "0x4985f5ca3d2afbec36529aa96f74de3cc10a2a4a6c44f2157a57d2c6059a11bb"
},
"genesis": {
"nonce": "0x0000000000000042",
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -29,13 +159,14 @@
"nodes": [
"enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303",
"enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303",
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"
"enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303",
"enode://248f12bc8b18d5289358085520ac78cd8076485211e6d96ab0bc93d6cd25442db0ce3a937dc404f64f207b0b9aed50e25e98ce32af5ac7cb321ff285b97de485@zero.parity.io:30303"
],
"accounts": {
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
"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 } } } },
"3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
"balance": "1337000000000000000000"
},

View File

@@ -1,24 +1,152 @@
{
"engineName": "Frontier (Test)",
"engineName": "Ethash",
"name": "Frontier (Test)",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "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"
]
}
}
},
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xf4240",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"networkID" : "0x1"
},
"genesis": {
"nonce": "0x0000000000000042",
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -26,9 +154,9 @@
"gasLimit": "0x1388"
},
"accounts": {
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
"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 } } } }
}
}

View File

@@ -1,24 +1,32 @@
{
"engineName": "Frontier (Test)",
"engineName": "Ethash",
"name": "Frontier (Test)",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0xffffffffffffffff"
}
}
},
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xffffffffffffffff",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"networkID" : "0x1"
},
"genesis": {
"nonce": "0x0000000000000042",
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -26,9 +34,9 @@
"gasLimit": "0x1388"
},
"accounts": {
"0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
"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 } } } }
}
}

View File

@@ -1,24 +1,32 @@
{
"name": "Homestead (Test)",
"engineName": "Ethash",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"frontierCompatibilityModeLimit": "0x0"
}
}
},
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": 0,
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"tieBreakingGas": false,
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"networkID" : "0x1"
},
"genesis": {
"nonce": "0x0000000000000042",
"seal": {
"ethereum": {
"nonce": "0x0000000000000042",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x400000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -26,9 +34,9 @@
"gasLimit": "0x1388"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } }
"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 } } } }
}
}

View File

@@ -1,35 +1,47 @@
{
"name": "Morden",
"engineName": "Ethash",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar": "",
"frontierCompatibilityModeLimit": "0x789b0"
}
}
},
"params": {
"accountStartNonce": "0x0100000",
"frontierCompatibilityModeLimit": "0xdbba0",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar": "",
"networkID" : "0x2"
},
"genesis": {
"nonce": "0x00006d6f7264656e",
"seal": {
"ethereum": {
"nonce": "0x00006d6f7264656e",
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
}
},
"difficulty": "0x20000",
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x2fefd8"
},
"nodes": [
"enode://e731347db0521f3476e6bbbb83375dcd7133a1601425ebd15fd10f3835fd4c304fba6282087ca5a0deeafadf0aa0d4fd56c3323331901c1f38bd181c283e3e35@128.199.55.137:30303",
"enode://ceb5c0f85eb994dbe9693bf46d99b03f6b838d17cc74e68d5eb003171ff39e5f120b17f965b267c319303f94d80b9d994b77062fb1486d76ce95d9f3d8fe1cb4@46.101.122.141:30303"
],
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
"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" }
}
}

View File

@@ -1,24 +1,31 @@
{
"name": "Olympic",
"engineName": "Ethash",
"engine": {
"Ethash": {
"params": {
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x08",
"blockReward": "0x14D1120D7B160000",
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050"
}
}
},
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xffffffffffffffff",
"maximumExtraDataSize": "0x0400",
"tieBreakingGas": false,
"minGasLimit": "125000",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x08",
"blockReward": "0x14D1120D7B160000",
"registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050",
"networkID" : "0x0"
},
"genesis": {
"nonce": "0x000000000000002a",
"seal": {
"ethereum": {
"nonce": "0x000000000000002a",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -26,10 +33,10 @@
"gasLimit": "0x2fefd8"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
"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 } } } },
"dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
"e6716f9544a56c530d868e4bfbacb172315bdead": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },
"b9c015918bdaba24b4ff057a92a3873d6eb201be": { "balance": "1606938044258990275541962092341162602522202993782792835301376" },

33
ethcore/res/null.json Normal file
View 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" }
}
}

View File

@@ -1,24 +1,22 @@
{
"name": "Morden",
"engineName": "NullEngine",
"engine": {
"Null": null
},
"params": {
"accountStartNonce": "0x0100000",
"frontierCompatibilityModeLimit": "0xfffa2990",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",
"gasLimitBoundDivisor": "0x0400",
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x4563918244F40000",
"registrar": "",
"networkID" : "0x2"
},
"genesis": {
"nonce": "0x00006d6f7264656e",
"seal": {
"ethereum": {
"nonce": "0x00006d6f7264656e",
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
}
},
"difficulty": "0x20000",
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -26,10 +24,10 @@
"gasLimit": "0x2fefd8"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } },
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "linear": { "base": 60, "word": 12 } } },
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } },
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "linear": { "base": 15, "word": 3 } } },
"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" }
}
}

View 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" }
}
}

View File

@@ -51,8 +51,6 @@ impl Account {
}
}
#[cfg(test)]
#[cfg(feature = "json-tests")]
/// General constructor.
pub fn from_pod(pod: PodAccount) -> Account {
Account {
@@ -60,8 +58,8 @@ impl Account {
nonce: pod.nonce,
storage_root: SHA3_NULL_RLP,
storage_overlay: RefCell::new(pod.storage.into_iter().map(|(k, v)| (k, (Filth::Dirty, v))).collect()),
code_hash: Some(pod.code.sha3()),
code_cache: pod.code
code_hash: pod.code.as_ref().map(|c| c.sha3()),
code_cache: pod.code.as_ref().map_or_else(|| { warn!("POD account with unknown code is being created! Assuming no code."); vec![] }, |c| c.clone()),
}
}
@@ -92,10 +90,10 @@ impl Account {
/// Create a new contract account.
/// 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 {
balance: balance,
nonce: U256::from(0u8),
nonce: nonce,
storage_root: SHA3_NULL_RLP,
storage_overlay: RefCell::new(HashMap::new()),
code_hash: None,
@@ -110,6 +108,12 @@ impl Account {
self.code_cache = code;
}
/// Reset this account's code to the given code.
pub fn reset_code(&mut self, code: Bytes) {
self.code_hash = None;
self.init_code(code);
}
/// Set (and cache) the contents of the trie's storage at `key` to `value`.
pub fn set_storage(&mut self, key: H256, value: H256) {
self.storage_overlay.borrow_mut().insert(key, (Filth::Dirty, value));
@@ -118,7 +122,12 @@ impl Account {
/// Get (and cache) the contents of the trie's storage at `key`.
pub fn storage_at(&self, db: &AccountDB, key: &H256) -> H256 {
self.storage_overlay.borrow_mut().entry(key.clone()).or_insert_with(||{
(Filth::Clean, H256::from(SecTrieDB::new(db, &self.storage_root).get(key.bytes()).map_or(U256::zero(), |v| -> U256 {decode(v)})))
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.");
(Filth::Clean, H256::from(db.get(key.bytes()).map_or(U256::zero(), |v| -> U256 {decode(v)})))
}).1.clone()
}
@@ -138,7 +147,7 @@ impl Account {
/// get someone who knows to call `note_code`.
pub fn code(&self) -> Option<&[u8]> {
match self.code_hash {
Some(SHA3_EMPTY) | None if self.code_cache.is_empty() => Some(&self.code_cache),
Some(c) if c == SHA3_EMPTY && self.code_cache.is_empty() => Some(&self.code_cache),
Some(_) if !self.code_cache.is_empty() => Some(&self.code_cache),
None => Some(&self.code_cache),
_ => None,
@@ -163,16 +172,16 @@ impl Account {
!self.code_cache.is_empty() || (self.code_cache.is_empty() && self.code_hash == Some(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 {
// 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());
self.is_cached() ||
match self.code_hash {
Some(ref h) => match db.lookup(h) {
Some(ref h) => match db.get(h) {
Some(x) => { self.code_cache = x.to_vec(); true },
_ => {
warn!("Failed reverse lookup of {}", h);
warn!("Failed reverse get of {}", h);
false
},
},
@@ -183,11 +192,11 @@ impl Account {
#[cfg(test)]
/// 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() }
#[cfg(test)]
/// 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} }
/// return the storage overlay.
pub fn storage_overlay(&self) -> Ref<HashMap<H256, (Filth, H256)>> { self.storage_overlay.borrow() }
@@ -198,11 +207,18 @@ impl Account {
pub fn add_balance(&mut self, x: &U256) { self.balance = self.balance + *x; }
/// Increment the nonce of the account by one.
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`.
pub fn commit_storage(&mut self, db: &mut AccountDBMut) {
let mut t = SecTrieDBMut::from_existing(db, &mut self.storage_root);
let mut t = SecTrieDBMut::from_existing(db, &mut 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.");
for (k, &mut (ref mut f, ref mut v)) in self.storage_overlay.borrow_mut().iter_mut() {
if f == &Filth::Dirty {
// cast key and value to trait type,
@@ -257,7 +273,7 @@ mod tests {
let mut db = MemoryDB::new();
let mut db = AccountDBMut::new(&mut db, &Address::new());
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.commit_storage(&mut db);
a.init_code(vec![]);
@@ -277,7 +293,7 @@ mod tests {
let mut db = AccountDBMut::new(&mut db, &Address::new());
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.commit_code(&mut db);
a.rlp()
@@ -292,10 +308,10 @@ mod tests {
#[test]
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 = 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);
a.commit_storage(&mut db);
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
@@ -303,21 +319,21 @@ mod tests {
#[test]
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 = 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.set_storage(x!(1), x!(0x1234));
a.set_storage(1.into(), 0x1234.into());
a.commit_storage(&mut db);
a.set_storage(x!(1), x!(0));
a.set_storage(1.into(), 0.into());
a.commit_storage(&mut db);
assert_eq!(a.storage_root().unwrap().hex(), "c57e1afb758b07f8d2c8f13a3b6e44fa5ff94ab266facc5a4fd3f062426e50b2");
}
#[test]
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 = AccountDBMut::new(&mut db, &Address::new());
a.init_code(vec![0x55, 0x44, 0xffu8]);
@@ -326,6 +342,21 @@ mod tests {
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_hash(), SHA3_EMPTY);
a.commit_code(&mut db);
assert_eq!(a.code_hash().hex(), "af231e631776a517ca23125370d542873eca1fb4d613ed9b5d5335a46ae5b7eb");
a.reset_code(vec![0x55]);
assert_eq!(a.code_hash(), SHA3_EMPTY);
a.commit_code(&mut db);
assert_eq!(a.code_hash().hex(), "37bf2238b11b68cdc8382cece82651b59d3c3988873b6e0f33d79694aa45f1be");
}
#[test]
fn rlpio() {
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
@@ -338,8 +369,6 @@ mod tests {
#[test]
fn new_account() {
use rustc_serialize::hex::ToHex;
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
assert_eq!(a.balance(), &U256::from(69u8));
@@ -350,8 +379,6 @@ mod tests {
#[test]
fn create_account() {
use rustc_serialize::hex::ToHex;
let a = Account::new(U256::from(69u8), U256::from(0u8), HashMap::new(), Bytes::new());
assert_eq!(a.rlp().to_hex(), "f8448045a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
}

View File

@@ -13,17 +13,14 @@ pub struct AccountDB<'db> {
#[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
address ^ key
}
impl<'db> AccountDB<'db> {
pub fn new(db: &'db HashDB, address: &Address) -> AccountDB<'db> {
AccountDB {
db: db,
address: x!(address.clone()),
address: address.into(),
}
}
}
@@ -33,18 +30,18 @@ impl<'db> HashDB for AccountDB<'db>{
unimplemented!()
}
fn lookup(&self, key: &H256) -> Option<&[u8]> {
fn get(&self, key: &H256) -> Option<&[u8]> {
if key == &SHA3_NULL_RLP {
return Some(&NULL_RLP_STATIC);
}
self.db.lookup(&combine_key(&self.address, key))
self.db.get(&combine_key(&self.address, key))
}
fn exists(&self, key: &H256) -> bool {
fn contains(&self, key: &H256) -> bool {
if key == &SHA3_NULL_RLP {
return true;
}
self.db.exists(&combine_key(&self.address, key))
self.db.contains(&combine_key(&self.address, key))
}
fn insert(&mut self, _value: &[u8]) -> H256 {
@@ -55,7 +52,7 @@ impl<'db> HashDB for AccountDB<'db>{
unimplemented!()
}
fn kill(&mut self, _key: &H256) {
fn remove(&mut self, _key: &H256) {
unimplemented!()
}
}
@@ -70,7 +67,7 @@ impl<'db> AccountDBMut<'db> {
pub fn new(db: &'db mut HashDB, address: &Address) -> AccountDBMut<'db> {
AccountDBMut {
db: db,
address: x!(address.clone()),
address: address.into(),
}
}
@@ -85,21 +82,24 @@ impl<'db> HashDB for AccountDBMut<'db>{
unimplemented!()
}
fn lookup(&self, key: &H256) -> Option<&[u8]> {
fn get(&self, key: &H256) -> Option<&[u8]> {
if key == &SHA3_NULL_RLP {
return Some(&NULL_RLP_STATIC);
}
self.db.lookup(&combine_key(&self.address, key))
self.db.get(&combine_key(&self.address, key))
}
fn exists(&self, key: &H256) -> bool {
fn contains(&self, key: &H256) -> bool {
if key == &SHA3_NULL_RLP {
return true;
}
self.db.exists(&combine_key(&self.address, key))
self.db.contains(&combine_key(&self.address, key))
}
fn insert(&mut self, value: &[u8]) -> H256 {
if value == &NULL_RLP {
return SHA3_NULL_RLP.clone();
}
let k = value.sha3();
let ak = combine_key(&self.address, &k);
self.db.emplace(ak, value.to_vec());
@@ -107,13 +107,19 @@ impl<'db> HashDB for AccountDBMut<'db>{
}
fn emplace(&mut self, key: H256, value: Bytes) {
if key == SHA3_NULL_RLP {
return;
}
let key = combine_key(&self.address, &key);
self.db.emplace(key, value.to_vec())
}
fn kill(&mut self, key: &H256) {
fn remove(&mut self, key: &H256) {
if key == &SHA3_NULL_RLP {
return;
}
let key = combine_key(&self.address, key);
self.db.kill(&key)
self.db.remove(&key)
}
}

View File

@@ -0,0 +1,272 @@
// 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::sync::RwLock;
use std::collections::HashMap;
use util::{Address as H160, H256, H520};
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,
}
/// 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);
struct NullDir;
impl KeyDirectory for NullDir {
fn load(&self) -> Result<Vec<SafeAccount>, SSError> {
Ok(vec![])
}
fn insert(&self, _account: SafeAccount) -> Result<(), SSError> {
Ok(())
}
fn remove(&self, _address: &SSAddress) -> Result<(), SSError> {
Ok(())
}
}
/// Account management.
/// Responsible for unlocking accounts.
pub struct AccountProvider {
unlocked: RwLock<HashMap<SSAddress, AccountData>>,
sstore: Box<SecretStore>,
}
impl AccountProvider {
/// Creates new account provider.
pub fn new(sstore: Box<SecretStore>) -> Self {
AccountProvider {
unlocked: RwLock::new(HashMap::new()),
sstore: sstore,
}
}
/// Creates not disk backed provider.
pub fn transient_provider() -> Self {
AccountProvider {
unlocked: RwLock::new(HashMap::new()),
sstore: Box::new(EthStore::open(Box::new(NullDir)).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) -> Vec<H160> {
self.sstore.accounts().into_iter().map(|a| H160(a.into())).collect()
}
/// 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 unlocked = self.unlocked.read().unwrap();
if let Some(data) = unlocked.get(&account) {
if let Unlock::Perm = data.unlock {
return Ok(())
}
}
}
let data = AccountData {
unlock: unlock,
password: password,
};
let mut unlocked = self.unlocked.write().unwrap();
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)
}
/// 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.read().unwrap();
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 unlocked = self.unlocked.read().unwrap();
try!(unlocked.get(&account).ok_or(Error::NotUnlocked)).clone()
};
if let Unlock::Temp = data.unlock {
let mut unlocked = self.unlocked.write().unwrap();
unlocked.remove(&account).expect("data exists: so key must exist: qed");
}
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};
#[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());
}
}

View File

@@ -15,9 +15,9 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Evm input params.
use util::hash::*;
use util::uint::*;
use util::bytes::*;
use common::*;
use ethjson;
use types::executed::CallType;
/// Transaction value
#[derive(Clone, Debug)]
@@ -28,6 +28,15 @@ pub enum ActionValue {
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).
/// Action (call/create) input params. Everything else should be specified in Externalities.
#[derive(Clone, Debug)]
@@ -50,7 +59,10 @@ pub struct ActionParams {
/// Code being executed.
pub code: Option<Bytes>,
/// Input data.
pub data: Option<Bytes>
pub data: Option<Bytes>,
/// Type of call
pub call_type: CallType,
}
impl Default for ActionParams {
@@ -65,7 +77,26 @@ impl Default for ActionParams {
gas_price: U256::zero(),
value: ActionValue::Transfer(U256::zero()),
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(),
address: address,
sender: t.sender.into(),
origin: t.origin.into(),
code: Some(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?
}
}
}

View File

@@ -0,0 +1,261 @@
// 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/>.
//! A blockchain engine that supports a basic, non-BFT proof-of-authority.
use common::*;
use account_provider::AccountProvider;
use block::*;
use spec::{CommonParams, Spec};
use engine::*;
use evm::Schedule;
use ethjson;
/// `BasicAuthority` params.
#[derive(Debug, PartialEq)]
pub struct BasicAuthorityParams {
/// Gas limit divisor.
pub gas_limit_bound_divisor: U256,
/// Block duration.
pub duration_limit: u64,
/// Valid signatories.
pub authorities: HashSet<Address>,
}
impl From<ethjson::spec::BasicAuthorityParams> for BasicAuthorityParams {
fn from(p: ethjson::spec::BasicAuthorityParams) -> Self {
BasicAuthorityParams {
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
duration_limit: p.duration_limit.into(),
authorities: p.authorities.into_iter().map(Into::into).collect::<HashSet<_>>(),
}
}
}
/// Engine using `BasicAuthority` proof-of-work consensus algorithm, suitable for Ethereum
/// mainnet chains in the Olympic, Frontier and Homestead eras.
pub struct BasicAuthority {
params: CommonParams,
our_params: BasicAuthorityParams,
builtins: BTreeMap<Address, Builtin>,
}
impl BasicAuthority {
/// Create a new instance of BasicAuthority engine
pub fn new(params: CommonParams, our_params: BasicAuthorityParams, builtins: BTreeMap<Address, Builtin>) -> Self {
BasicAuthority {
params: params,
our_params: our_params,
builtins: builtins,
}
}
}
impl Engine for BasicAuthority {
fn name(&self) -> &str { "BasicAuthority" }
fn version(&self) -> SemanticVersion { SemanticVersion::new(1, 0, 0) }
// One field - the signature
fn seal_fields(&self) -> usize { 1 }
fn params(&self) -> &CommonParams { &self.params }
fn builtins(&self) -> &BTreeMap<Address, Builtin> { &self.builtins }
/// Additional engine-specific information for the user/developer concerning `header`.
fn extra_info(&self, _header: &Header) -> HashMap<String, String> { hash_map!["signature".to_owned() => "TODO".to_owned()] }
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
Schedule::new_homestead()
}
fn populate_from_parent(&self, header: &mut Header, parent: &Header, gas_floor_target: U256, _gas_ceil_target: U256) {
header.difficulty = parent.difficulty;
header.gas_limit = {
let gas_limit = parent.gas_limit;
let bound_divisor = self.our_params.gas_limit_bound_divisor;
if gas_limit < gas_floor_target {
min(gas_floor_target, gas_limit + gas_limit / bound_divisor - 1.into())
} else {
max(gas_floor_target, gas_limit - gas_limit / bound_divisor + 1.into())
}
};
header.note_dirty();
// info!("ethash: populate_from_parent #{}: difficulty={} and gas_limit={}", header.number, header.difficulty, header.gas_limit);
}
/// Apply the block reward on finalisation of the block.
/// This assumes that all uncles are valid uncles (i.e. of at least one generation before the current).
fn on_close_block(&self, _block: &mut ExecutedBlock) {}
/// Attempt to seal the block internally.
///
/// This operation is synchronous and may (quite reasonably) not be available, in which `false` will
/// be returned.
fn generate_seal(&self, block: &ExecutedBlock, accounts: Option<&AccountProvider>) -> Option<Vec<Bytes>> {
if let Some(ap) = accounts {
let header = block.header();
let message = header.bare_hash();
// account should be pernamently unlocked, otherwise sealing will fail
if let Ok(signature) = ap.sign(*block.header().author(), message) {
return Some(vec![encode(&signature).to_vec()]);
} else {
trace!(target: "basicauthority", "generate_seal: FAIL: accounts secret key unavailable");
}
} else {
trace!(target: "basicauthority", "generate_seal: FAIL: accounts not provided");
}
None
}
fn verify_block_basic(&self, header: &Header, _block: Option<&[u8]>) -> result::Result<(), Error> {
// check the seal fields.
// TODO: pull this out into common code.
if header.seal.len() != self.seal_fields() {
return Err(From::from(BlockError::InvalidSealArity(
Mismatch { expected: self.seal_fields(), found: header.seal.len() }
)));
}
Ok(())
}
fn verify_block_unordered(&self, header: &Header, _block: Option<&[u8]>) -> result::Result<(), Error> {
// check the signature is legit.
let sig = try!(UntrustedRlp::new(&header.seal[0]).as_val::<H520>());
let signer = Address::from(try!(ec::recover(&sig, &header.bare_hash())).sha3());
if !self.our_params.authorities.contains(&signer) {
return try!(Err(BlockError::InvalidSeal));
}
Ok(())
}
fn verify_block_family(&self, header: &Header, parent: &Header, _block: Option<&[u8]>) -> result::Result<(), Error> {
// we should not calculate difficulty for genesis blocks
if header.number() == 0 {
return Err(From::from(BlockError::RidiculousNumber(OutOfBounds { min: Some(1), max: None, found: header.number() })));
}
// Check difficulty is correct given the two timestamps.
if header.difficulty() != parent.difficulty() {
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: *parent.difficulty(), found: *header.difficulty() })))
}
let gas_limit_divisor = self.our_params.gas_limit_bound_divisor;
let min_gas = parent.gas_limit - parent.gas_limit / gas_limit_divisor;
let max_gas = parent.gas_limit + parent.gas_limit / gas_limit_divisor;
if header.gas_limit <= min_gas || header.gas_limit >= max_gas {
return Err(From::from(BlockError::InvalidGasLimit(OutOfBounds { min: Some(min_gas), max: Some(max_gas), found: header.gas_limit })));
}
Ok(())
}
fn verify_transaction_basic(&self, t: &SignedTransaction, _header: &Header) -> result::Result<(), Error> {
try!(t.check_low_s());
Ok(())
}
fn verify_transaction(&self, t: &SignedTransaction, _header: &Header) -> Result<(), Error> {
t.sender().map(|_|()) // Perform EC recovery and cache sender
}
}
impl Header {
/// Get the none field of the header.
pub fn signature(&self) -> H520 {
decode(&self.seal()[0])
}
}
/// Create a new test chain spec with `BasicAuthority` consensus engine.
pub fn new_test_authority() -> Spec { Spec::load(include_bytes!("../res/test_authority.json")) }
#[cfg(test)]
mod tests {
use super::*;
use common::*;
use block::*;
use tests::helpers::*;
use account_provider::AccountProvider;
#[test]
fn has_valid_metadata() {
let engine = new_test_authority().engine;
assert!(!engine.name().is_empty());
assert!(engine.version().major >= 1);
}
#[test]
fn can_return_schedule() {
let engine = new_test_authority().engine;
let schedule = engine.schedule(&EnvInfo {
number: 10000000,
author: 0.into(),
timestamp: 0,
difficulty: 0.into(),
last_hashes: vec![],
gas_used: 0.into(),
gas_limit: 0.into(),
});
assert!(schedule.stack_limit > 0);
}
#[test]
fn can_do_seal_verification_fail() {
let engine = new_test_authority().engine;
let header: Header = Header::default();
let verify_result = engine.verify_block_basic(&header, None);
match verify_result {
Err(Error::Block(BlockError::InvalidSealArity(_))) => {},
Err(_) => { panic!("should be block seal-arity mismatch error (got {:?})", verify_result); },
_ => { panic!("Should be error, got Ok"); },
}
}
#[test]
fn can_do_signature_verification_fail() {
let engine = new_test_authority().engine;
let mut header: Header = Header::default();
header.set_seal(vec![rlp::encode(&Signature::zero()).to_vec()]);
let verify_result = engine.verify_block_unordered(&header, None);
match verify_result {
Err(Error::Util(UtilError::Crypto(CryptoError::InvalidSignature))) => {},
Err(_) => { panic!("should be block difficulty error (got {:?})", verify_result); },
_ => { panic!("Should be error, got Ok"); },
}
}
#[test]
fn can_generate_seal() {
let tap = AccountProvider::transient_provider();
let addr = tap.insert_account("".sha3(), "").unwrap();
tap.unlock_account_permanently(addr, "".into()).unwrap();
let spec = new_test_authority();
let engine = &spec.engine;
let genesis_header = spec.genesis_header();
let mut db_result = get_temp_journal_db();
let mut db = db_result.take();
spec.ensure_db_good(db.as_hashdb_mut());
let last_hashes = vec![genesis_header.hash()];
let vm_factory = Default::default();
let b = OpenBlock::new(engine.deref(), &vm_factory, false, db, &genesis_header, last_hashes, addr, (3141562.into(), 31415620.into()), vec![]).unwrap();
let b = b.close_and_lock();
let seal = engine.generate_seal(b.block(), Some(&tap)).unwrap();
assert!(b.try_seal(engine.deref(), seal).is_ok());
}
}

View File

@@ -24,6 +24,7 @@ pub type LogBloom = H2048;
/// Constant 2048-bit datum for 0. Often used as a default.
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.
pub enum Seal {
/// The seal/signature is included.

View File

@@ -16,15 +16,16 @@
//! Blockchain block.
#![allow(ptr_arg)] // Because of &LastHashes -> &Vec<_>
#![cfg_attr(feature="dev", allow(ptr_arg))] // Because of &LastHashes -> &Vec<_>
use common::*;
use engine::*;
use state::*;
use verification::PreVerifiedBlock;
use verification::PreverifiedBlock;
use trace::FlatTrace;
use evm::Factory as EvmFactory;
/// A block, encoded as it is on the block chain.
// TODO: rename to Block
#[derive(Default, Debug, Clone)]
pub struct Block {
/// The header of this block.
@@ -37,31 +38,25 @@ pub struct Block {
impl Block {
/// 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 {
/*
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()
}
/// Get the RLP-encoding of the block 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 {
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
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();
if d.item_count() != 3 {
@@ -76,19 +71,34 @@ impl Decodable for Block {
}
/// Internal type for a block's common elements.
// TODO: rename to ExecutedBlock
// TODO: use BareBlock
#[derive(Debug)]
#[derive(Clone)]
pub struct ExecutedBlock {
base: Block,
receipts: Vec<Receipt>,
transactions_set: HashSet<H256>,
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> {
/// Block header.
pub header: &'a mut Header,
/// Block transactions.
pub transactions: &'a Vec<SignedTransaction>,
/// Block uncles.
pub uncles: &'a Vec<Header>,
/// Transaction receipts.
pub receipts: &'a Vec<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.
pub header: &'a Header,
/// Block transactions.
@@ -98,30 +108,56 @@ pub struct BlockRefMut<'a> {
/// Transaction receipts.
pub receipts: &'a Vec<Receipt>,
/// State.
pub state: &'a mut State,
pub state: &'a State,
/// Traces.
pub traces: &'a Option<Vec<Vec<FlatTrace>>>,
}
impl ExecutedBlock {
/// 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.
pub fn fields(&mut self) -> BlockRefMut {
pub fn fields_mut(&mut self) -> BlockRefMut {
BlockRefMut {
header: &self.base.header,
header: &mut self.base.header,
transactions: &self.base.transactions,
uncles: &self.base.uncles,
state: &mut self.state,
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 {
/// Get the block associated with this object.
/// Get the `ExecutedBlock` associated with this object.
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.
fn header(&self) -> &Header { &self.block().base.header }
@@ -134,58 +170,95 @@ pub trait IsBlock {
/// Get all information on receipts in this block.
fn receipts(&self) -> &Vec<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.
fn uncles(&self) -> &Vec<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) -> Box<JournalDB>;
}
impl IsBlock for ExecutedBlock {
fn block(&self) -> &ExecutedBlock { self }
}
/// 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.
pub struct OpenBlock<'x, 'y> {
pub struct OpenBlock<'x> {
block: ExecutedBlock,
engine: &'x Engine,
last_hashes: &'y LastHashes,
vm_factory: &'x EvmFactory,
last_hashes: 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.
///
/// There is no function available to push a transaction. If you want that you'll need to `reopen()` it.
pub struct ClosedBlock<'x, 'y> {
open_block: OpenBlock<'x, 'y>,
/// There is no function available to push a transaction.
#[derive(Clone)]
pub struct ClosedBlock {
block: ExecutedBlock,
uncle_bytes: Bytes,
last_hashes: 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,
}
/// 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 {
block: ExecutedBlock,
uncle_bytes: Bytes,
}
impl<'x, 'y> OpenBlock<'x, 'y> {
/// Create a new OpenBlock ready for transaction pushing.
pub fn new<'a, 'b>(engine: &'a Engine, db: JournalDB, parent: &Header, last_hashes: &'b LastHashes, author: Address, extra_data: Bytes) -> OpenBlock<'a, 'b> {
impl<'x> OpenBlock<'x> {
#[cfg_attr(feature="dev", allow(too_many_arguments))]
/// Create a new `OpenBlock` ready for transaction pushing.
pub fn new(
engine: &'x Engine,
vm_factory: &'x EvmFactory,
tracing: bool,
db: Box<JournalDB>,
parent: &Header,
last_hashes: 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()));
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,
vm_factory: vm_factory,
last_hashes: last_hashes,
};
r.block.base.header.set_number(parent.number() + 1);
r.block.base.header.set_author(author);
r.block.base.header.set_extra_data(extra_data);
r.block.base.header.set_timestamp_now();
r.block.base.header.parent_hash = parent.hash();
r.block.base.header.number = parent.number + 1;
r.block.base.header.author = author;
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);
r
Ok(r)
}
/// Alter the author for the block.
@@ -218,8 +291,8 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
/// NOTE Will check chain constraints and the uncle number but will NOT check
/// that the header itself is actually valid.
pub fn push_uncle(&mut self, valid_uncle_header: Header) -> Result<(), BlockError> {
if self.block.base.uncles.len() >= 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()}));
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() + 1}));
}
// TODO: check number
// TODO: check not a direct ancestor (use last_hashes for that)
@@ -245,72 +318,140 @@ impl<'x, 'y> OpenBlock<'x, 'y> {
///
/// 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> {
if self.block.transactions_set.contains(&t.hash()) {
return Err(From::from(TransactionError::AlreadyImported));
}
let env_info = self.env_info();
// info!("env_info says gas_used={}", env_info.gas_used);
match self.block.state.apply(&env_info, self.engine, &t) {
Ok(receipt) => {
match self.block.state.apply(&env_info, self.engine, self.vm_factory, &t, self.block.traces.is_some()) {
Ok(outcome) => {
self.block.transactions_set.insert(h.unwrap_or_else(||t.hash()));
self.block.base.transactions.push(t);
self.block.receipts.push(receipt);
let t = outcome.trace;
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))
}
}
/// Turn this into a `ClosedBlock`. A BlockChain must be provided in order to figure out the uncles.
pub fn close(self) -> ClosedBlock<'x, 'y> {
/// Turn this into a `ClosedBlock`. A `BlockChain` must be provided in order to figure out the uncles.
pub fn close(self) -> ClosedBlock {
let mut s = self;
let unclosed_state = s.block.state.clone();
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());
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.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.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.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 {
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);
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();
s.block.base.header.uncles_hash = uncle_bytes.sha3();
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.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,
}
}
}
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.
pub fn hash(&self) -> H256 { self.header().rlp_sha3(Seal::Without) }
/// Provide a valid seal in order to turn this into a `SealedBlock`.
///
/// 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;
if seal.len() != s.open_block.engine.seal_fields() {
return Err(BlockError::InvalidSealArity(Mismatch{expected: s.open_block.engine.seal_fields(), found: seal.len()}));
if seal.len() != engine.seal_fields() {
return Err(BlockError::InvalidSealArity(Mismatch{expected: engine.seal_fields(), found: seal.len()}));
}
s.open_block.block.base.header.set_seal(seal);
Ok(SealedBlock { block: s.open_block.block, uncle_bytes: s.uncle_bytes })
s.block.base.header.set_seal(seal);
Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes })
}
/// Turn this back into an `OpenBlock`.
pub fn reopen(self) -> OpenBlock<'x, 'y> { self.open_block }
/// Provide a valid seal in order to turn this into a `SealedBlock`.
/// 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.
pub fn drain(self) -> JournalDB { self.open_block.block.state.drop().1 }
fn drain(self) -> Box<JournalDB> { self.block.state.drop().1 }
}
impl SealedBlock {
@@ -322,9 +463,11 @@ impl SealedBlock {
block_rlp.append_raw(&self.uncle_bytes, 1);
block_rlp.out()
}
}
impl Drain for SealedBlock {
/// Drop this object and return the underlieing database.
pub fn drain(self) -> JournalDB { self.block.state.drop().1 }
fn drain(self) -> Box<JournalDB> { self.block.state.drop().1 }
}
impl IsBlock for SealedBlock {
@@ -332,40 +475,80 @@ impl IsBlock for SealedBlock {
}
/// 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: Box<JournalDB>,
parent: &Header,
last_hashes: LastHashes,
vm_factory: &EvmFactory
) -> Result<LockedBlock, Error> {
{
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()));
trace!("enact(): root={}, author={}, author_balance={}\n", 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, tracing, db, parent, last_hashes, Address::new(), (3141562.into(), 31415620.into()), vec![]));
b.set_difficulty(*header.difficulty());
b.set_gas_limit(*header.gas_limit());
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));
for t in transactions { try!(b.push_transaction(t.clone(), None)); }
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
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: Box<JournalDB>,
parent: &Header,
last_hashes: LastHashes,
vm_factory: &EvmFactory
) -> Result<LockedBlock, Error> {
let block = BlockView::new(block_bytes);
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)
}
/// 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: Box<JournalDB>,
parent: &Header,
last_hashes: LastHashes,
vm_factory: &EvmFactory
) -> Result<LockedBlock, Error> {
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)
}
/// 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: Box<JournalDB>,
parent: &Header,
last_hashes: LastHashes,
vm_factory: &EvmFactory
) -> Result<SealedBlock, Error> {
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)).seal(engine, header.seal())))
}
#[cfg(test)]
@@ -373,39 +556,43 @@ mod tests {
use tests::helpers::*;
use super::*;
use common::*;
use engine::*;
#[test]
fn open_block() {
use spec::*;
let engine = Spec::new_test().to_engine().unwrap();
let genesis_header = engine.spec().genesis_header();
let spec = Spec::new_test();
let engine = &spec.engine;
let genesis_header = spec.genesis_header();
let mut db_result = get_temp_journal_db();
let mut db = db_result.take();
engine.spec().ensure_db_good(&mut db);
spec.ensure_db_good(db.as_hashdb_mut());
let last_hashes = vec![genesis_header.hash()];
let b = OpenBlock::new(engine.deref(), db, &genesis_header, &last_hashes, Address::zero(), vec![]);
let b = b.close();
let _ = b.seal(vec![]);
let vm_factory = Default::default();
let b = OpenBlock::new(engine.deref(), &vm_factory, false, db, &genesis_header, last_hashes, Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap();
let b = b.close_and_lock();
let _ = b.seal(engine.deref(), vec![]);
}
#[test]
fn enact_block() {
use spec::*;
let engine = Spec::new_test().to_engine().unwrap();
let genesis_header = engine.spec().genesis_header();
let spec = Spec::new_test();
let engine = &spec.engine;
let genesis_header = spec.genesis_header();
let mut db_result = get_temp_journal_db();
let mut db = db_result.take();
engine.spec().ensure_db_good(&mut db);
let b = OpenBlock::new(engine.deref(), db, &genesis_header, &vec![genesis_header.hash()], Address::zero(), vec![]).close().seal(vec![]).unwrap();
spec.ensure_db_good(db.as_hashdb_mut());
let vm_factory = Default::default();
let b = OpenBlock::new(engine.deref(), &vm_factory, false, db, &genesis_header, vec![genesis_header.hash()], Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap()
.close_and_lock().seal(engine.deref(), vec![]).unwrap();
let orig_bytes = b.rlp_bytes();
let orig_db = b.drain();
let mut db_result = get_temp_journal_db();
let mut db = db_result.take();
engine.spec().ensure_db_good(&mut db);
let e = enact_and_seal(&orig_bytes, engine.deref(), db, &genesis_header, &vec![genesis_header.hash()]).unwrap();
spec.ensure_db_good(db.as_hashdb_mut());
let e = enact_and_seal(&orig_bytes, engine.deref(), false, db, &genesis_header, vec![genesis_header.hash()], &Default::default()).unwrap();
assert_eq!(e.rlp_bytes(), orig_bytes);
@@ -413,4 +600,42 @@ mod tests {
assert_eq!(orig_db.keys(), db.keys());
assert!(orig_db.keys().iter().filter(|k| orig_db.get(k.0) != 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_journal_db();
let mut db = db_result.take();
spec.ensure_db_good(db.as_hashdb_mut());
let vm_factory = Default::default();
let mut open_block = OpenBlock::new(engine.deref(), &vm_factory, false, db, &genesis_header, vec![genesis_header.hash()], 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.deref(), vec![]).unwrap();
let orig_bytes = b.rlp_bytes();
let orig_db = b.drain();
let mut db_result = get_temp_journal_db();
let mut db = db_result.take();
spec.ensure_db_good(db.as_hashdb_mut());
let e = enact_and_seal(&orig_bytes, engine.deref(), false, db, &genesis_header, vec![genesis_header.hash()], &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.keys(), db.keys());
assert!(orig_db.keys().iter().filter(|k| orig_db.get(k.0) != db.get(k.0)).next() == None);
}
}

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// 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.
use std::thread::{JoinHandle, self};
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
@@ -26,18 +26,48 @@ use views::*;
use header::*;
use service::*;
use client::BlockStatus;
use util::panics::*;
known_heap_size!(0, UnverifiedBlock, VerifyingBlock, PreverifiedBlock);
const MIN_MEM_LIMIT: usize = 16384;
const MIN_QUEUE_LIMIT: usize = 512;
/// Block queue configuration
#[derive(Debug)]
pub struct BlockQueueConfig {
/// 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,
}
}
}
/// Block queue status
#[derive(Debug)]
pub struct BlockQueueInfo {
/// Indicates that queue is full
pub full: bool,
/// Number of queued blocks pending verification
pub unverified_queue_size: usize,
/// Number of verified queued blocks pending import
pub verified_queue_size: usize,
/// Number of blocks being verified
pub verifying_queue_size: usize,
/// Configured maximum number of blocks in the queue
pub max_queue_size: usize,
/// Configured maximum number of bytes to use
pub max_mem_use: usize,
/// Heap memory used in bytes
pub mem_used: usize,
}
impl BlockQueueInfo {
@@ -46,65 +76,97 @@ impl BlockQueueInfo {
/// The size of the unverified and verifying queues.
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.
/// A queue of blocks. Sits between network or other I/O and the `BlockChain`.
/// Sorts them ready for blockchain insertion.
pub struct BlockQueue {
panic_handler: Arc<PanicHandler>,
engine: Arc<Box<Engine>>,
more_to_verify: Arc<Condvar>,
verification: Arc<Mutex<Verification>>,
verification: Arc<Verification>,
verifiers: Vec<JoinHandle<()>>,
deleting: Arc<AtomicBool>,
ready_signal: Arc<QueueSignal>,
empty: Arc<Condvar>,
processing: RwLock<HashSet<H256>>
processing: RwLock<HashSet<H256>>,
max_queue_size: usize,
max_mem_use: usize,
}
struct UnVerifiedBlock {
struct UnverifiedBlock {
header: Header,
bytes: Bytes,
}
struct VerifyingBlock {
hash: H256,
block: Option<PreVerifiedBlock>,
block: Option<PreverifiedBlock>,
}
struct QueueSignal {
deleting: Arc<AtomicBool>,
signalled: AtomicBool,
message_channel: IoChannel<NetSyncMessage>,
}
impl QueueSignal {
#[cfg_attr(feature="dev", allow(bool_comparison))]
fn set(&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 {
self.message_channel.send(UserMessage(SyncMessage::BlockVerified)).expect("Error sending BlockVerified message");
if let Err(e) = self.message_channel.send(UserMessage(SyncMessage::BlockVerified)) {
debug!("Error sending BlockVerified message: {:?}", e);
}
}
}
fn reset(&self) {
self.signalled.store(false, AtomicOrdering::Relaxed);
}
}
#[derive(Default)]
struct Verification {
unverified: VecDeque<UnVerifiedBlock>,
verified: VecDeque<PreVerifiedBlock>,
verifying: VecDeque<VerifyingBlock>,
bad: HashSet<H256>,
// All locks must be captured in the order declared here.
unverified: Mutex<VecDeque<UnverifiedBlock>>,
verified: Mutex<VecDeque<PreverifiedBlock>>,
verifying: Mutex<VecDeque<VerifyingBlock>>,
bad: Mutex<HashSet<H256>>,
}
const MAX_UNVERIFIED_QUEUE_SIZE: usize = 50000;
impl BlockQueue {
/// Creates a new queue instance.
pub fn new(engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
let verification = Arc::new(Mutex::new(Verification::default()));
pub fn new(config: BlockQueueConfig, engine: Arc<Box<Engine>>, message_channel: IoChannel<NetSyncMessage>) -> BlockQueue {
let verification = Arc::new(Verification {
unverified: Mutex::new(VecDeque::new()),
verified: Mutex::new(VecDeque::new()),
verifying: Mutex::new(VecDeque::new()),
bad: Mutex::new(HashSet::new()),
});
let more_to_verify = Arc::new(Condvar::new());
let ready_signal = Arc::new(QueueSignal { signalled: AtomicBool::new(false), message_channel: message_channel });
let deleting = Arc::new(AtomicBool::new(false));
let ready_signal = Arc::new(QueueSignal {
deleting: deleting.clone(),
signalled: AtomicBool::new(false),
message_channel: message_channel
});
let empty = Arc::new(Condvar::new());
let panic_handler = PanicHandler::new_in_arc();
let mut verifiers: Vec<JoinHandle<()>> = Vec::new();
let thread_count = max(::num_cpus::get(), 3) - 2;
@@ -115,11 +177,21 @@ impl BlockQueue {
let ready_signal = ready_signal.clone();
let empty = empty.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))
.expect("Error starting block verification thread"));
let panic_handler = panic_handler.clone();
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 {
engine: engine,
panic_handler: panic_handler,
ready_signal: ready_signal.clone(),
more_to_verify: more_to_verify.clone(),
verification: verification.clone(),
@@ -127,68 +199,73 @@ impl BlockQueue {
deleting: deleting.clone(),
processing: RwLock::new(HashSet::new()),
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>) {
while !deleting.load(AtomicOrdering::Relaxed) {
fn verify(verification: Arc<Verification>, engine: Arc<Box<Engine>>, wait: Arc<Condvar>, ready: Arc<QueueSignal>, deleting: Arc<AtomicBool>, empty: Arc<Condvar>) {
while !deleting.load(AtomicOrdering::Acquire) {
{
let mut lock = verification.lock().unwrap();
let mut unverified = verification.unverified.lock().unwrap();
if lock.unverified.is_empty() && lock.verifying.is_empty() {
if unverified.is_empty() && verification.verifying.lock().unwrap().is_empty() {
empty.notify_all();
}
while lock.unverified.is_empty() && !deleting.load(AtomicOrdering::Relaxed) {
lock = wait.wait(lock).unwrap();
while unverified.is_empty() && !deleting.load(AtomicOrdering::Acquire) {
unverified = wait.wait(unverified).unwrap();
}
if deleting.load(AtomicOrdering::Relaxed) {
if deleting.load(AtomicOrdering::Acquire) {
return;
}
}
let block = {
let mut v = verification.lock().unwrap();
if v.unverified.is_empty() {
let mut unverified = verification.unverified.lock().unwrap();
if unverified.is_empty() {
continue;
}
let block = v.unverified.pop_front().unwrap();
v.verifying.push_back(VerifyingBlock{ hash: block.header.hash(), block: None });
let mut verifying = verification.verifying.lock().unwrap();
let block = unverified.pop_front().unwrap();
verifying.push_back(VerifyingBlock{ hash: block.header.hash(), block: None });
block
};
let block_hash = block.header.hash();
match verify_block_unordered(block.header, block.bytes, engine.deref().deref()) {
Ok(verified) => {
let mut v = verification.lock().unwrap();
for e in &mut v.verifying {
let mut verifying = verification.verifying.lock().unwrap();
for e in verifying.iter_mut() {
if e.hash == block_hash {
e.block = Some(verified);
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!
let mut vref = v.deref_mut();
BlockQueue::drain_verifying(&mut vref.verifying, &mut vref.verified, &mut vref.bad);
let mut verified = verification.verified.lock().unwrap();
let mut bad = verification.bad.lock().unwrap();
BlockQueue::drain_verifying(&mut verifying, &mut verified, &mut bad);
ready.set();
}
},
Err(err) => {
let mut v = verification.lock().unwrap();
let mut verifying = verification.verifying.lock().unwrap();
let mut verified = verification.verified.lock().unwrap();
let mut bad = verification.bad.lock().unwrap();
warn!(target: "client", "Stage 2 block verification failed for {}\nError: {:?}", block_hash, err);
v.bad.insert(block_hash.clone());
v.verifying.retain(|e| e.hash != block_hash);
let mut vref = v.deref_mut();
BlockQueue::drain_verifying(&mut vref.verifying, &mut vref.verified, &mut vref.bad);
bad.insert(block_hash.clone());
verifying.retain(|e| e.hash != block_hash);
BlockQueue::drain_verifying(&mut verifying, &mut verified, &mut bad);
ready.set();
}
}
}
}
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>) {
while !verifying.is_empty() && verifying.front().unwrap().block.is_some() {
let block = verifying.pop_front().unwrap().block.unwrap();
if bad.contains(&block.header.parent_hash) {
@@ -201,19 +278,21 @@ impl BlockQueue {
}
/// Clear the queue and stop verification activity.
pub fn clear(&mut self) {
let mut verification = self.verification.lock().unwrap();
verification.unverified.clear();
verification.verifying.clear();
verification.verified.clear();
pub fn clear(&self) {
let mut unverified = self.verification.unverified.lock().unwrap();
let mut verifying = self.verification.verifying.lock().unwrap();
let mut verified = self.verification.verified.lock().unwrap();
unverified.clear();
verifying.clear();
verified.clear();
self.processing.write().unwrap().clear();
}
/// Wait for queue to be empty
pub fn flush(&mut self) {
let mut verification = self.verification.lock().unwrap();
while !verification.unverified.is_empty() || !verification.verifying.is_empty() {
verification = self.empty.wait(verification).unwrap();
/// Wait for unverified queue to be empty
pub fn flush(&self) {
let mut unverified = self.verification.unverified.lock().unwrap();
while !unverified.is_empty() || !self.verification.verifying.lock().unwrap().is_empty() {
unverified = self.empty.wait(unverified).unwrap();
}
}
@@ -222,85 +301,96 @@ impl BlockQueue {
if self.processing.read().unwrap().contains(&hash) {
return BlockStatus::Queued;
}
if self.verification.lock().unwrap().bad.contains(&hash) {
if self.verification.bad.lock().unwrap().contains(&hash) {
return BlockStatus::Bad;
}
BlockStatus::Unknown
}
/// 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 h = header.hash();
if self.processing.read().unwrap().contains(&h) {
return Err(ImportError::AlreadyQueued);
}
{
let mut verification = self.verification.lock().unwrap();
if verification.bad.contains(&h) {
return Err(ImportError::Bad(None));
if self.processing.read().unwrap().contains(&h) {
return Err(ImportError::AlreadyQueued.into());
}
if verification.bad.contains(&header.parent_hash) {
verification.bad.insert(h.clone());
return Err(ImportError::Bad(None));
let mut bad = self.verification.bad.lock().unwrap();
if bad.contains(&h) {
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()) {
Ok(()) => {
self.processing.write().unwrap().insert(h.clone());
self.verification.lock().unwrap().unverified.push_back(UnVerifiedBlock { header: header, bytes: bytes });
self.verification.unverified.lock().unwrap().push_back(UnverifiedBlock { header: header, bytes: bytes });
self.more_to_verify.notify_all();
Ok(h)
},
Err(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());
Err(From::from(err))
self.verification.bad.lock().unwrap().insert(h.clone());
Err(err)
}
}
}
/// Mark given block and all its children as bad. Stops verification.
pub fn mark_as_bad(&mut self, hash: &H256) {
let mut verification_lock = self.verification.lock().unwrap();
let mut verification = verification_lock.deref_mut();
verification.bad.insert(hash.clone());
self.processing.write().unwrap().remove(&hash);
pub fn mark_as_bad(&self, block_hashes: &[H256]) {
if block_hashes.is_empty() {
return;
}
let mut verified_lock = self.verification.verified.lock().unwrap();
let mut verified = verified_lock.deref_mut();
let mut bad = self.verification.bad.lock().unwrap();
let mut processing = self.processing.write().unwrap();
bad.reserve(block_hashes.len());
for hash in block_hashes {
bad.insert(hash.clone());
processing.remove(&hash);
}
let mut new_verified = VecDeque::new();
for block in verification.verified.drain(..) {
if verification.bad.contains(&block.header.parent_hash) {
verification.bad.insert(block.header.hash());
self.processing.write().unwrap().remove(&block.header.hash());
}
else {
for block in verified.drain(..) {
if bad.contains(&block.header.parent_hash) {
bad.insert(block.header.hash());
processing.remove(&block.header.hash());
} else {
new_verified.push_back(block);
}
}
verification.verified = new_verified;
*verified = new_verified;
}
/// Mark given block as processed
pub fn mark_as_good(&mut self, hashes: &[H256]) {
let mut processing = self.processing.write().unwrap();
for h in hashes {
processing.remove(&h);
pub fn mark_as_good(&self, block_hashes: &[H256]) {
if block_hashes.is_empty() {
return;
}
let mut processing = self.processing.write().unwrap();
for hash in block_hashes {
processing.remove(&hash);
}
//TODO: reward peers
}
/// Removes up to `max` verified blocks from the queue
pub fn drain(&mut self, max: usize) -> Vec<PreVerifiedBlock> {
let mut verification = self.verification.lock().unwrap();
let count = min(max, verification.verified.len());
pub fn drain(&self, max: usize) -> Vec<PreverifiedBlock> {
let mut verified = self.verification.verified.lock().unwrap();
let count = min(max, verified.len());
let mut result = Vec::with_capacity(count);
for _ in 0..count {
let block = verification.verified.pop_front().unwrap();
let block = verified.pop_front().unwrap();
result.push(block);
}
self.ready_signal.reset();
if !verification.verified.is_empty() {
if !verified.is_empty() {
self.ready_signal.set();
}
result
@@ -308,24 +398,60 @@ impl BlockQueue {
/// Get queue status.
pub fn queue_info(&self) -> BlockQueueInfo {
let verification = self.verification.lock().unwrap();
let (unverified_len, unverified_bytes) = {
let v = self.verification.unverified.lock().unwrap();
(v.len(), v.heap_size_of_children())
};
let (verifying_len, verifying_bytes) = {
let v = self.verification.verifying.lock().unwrap();
(v.len(), v.heap_size_of_children())
};
let (verified_len, verified_bytes) = {
let v = self.verification.verified.lock().unwrap();
(v.len(), v.heap_size_of_children())
};
BlockQueueInfo {
full: verification.unverified.len() + verification.verifying.len() + verification.verified.len() >= MAX_UNVERIFIED_QUEUE_SIZE,
verified_queue_size: verification.verified.len(),
unverified_queue_size: verification.unverified.len(),
verifying_queue_size: verification.verifying.len(),
unverified_queue_size: unverified_len,
verifying_queue_size: verifying_len,
verified_queue_size: verified_len,
max_queue_size: self.max_queue_size,
max_mem_use: self.max_mem_use,
mem_used:
unverified_bytes
+ verifying_bytes
+ verified_bytes
// TODO: https://github.com/servo/heapsize/pull/50
//+ self.processing.read().unwrap().heap_size_of_children(),
}
}
/// Optimise memory footprint of the heap fields.
pub fn collect_garbage(&self) {
{
self.verification.unverified.lock().unwrap().shrink_to_fit();
self.verification.verifying.lock().unwrap().shrink_to_fit();
self.verification.verified.lock().unwrap().shrink_to_fit();
}
self.processing.write().unwrap().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 {
fn drop(&mut self) {
trace!(target: "shutdown", "[BlockQueue] Closing...");
self.clear();
self.deleting.store(true, AtomicOrdering::Relaxed);
self.deleting.store(true, AtomicOrdering::Release);
self.more_to_verify.notify_all();
for t in self.verifiers.drain(..) {
t.join().unwrap();
}
trace!(target: "shutdown", "[BlockQueue] Closed.");
}
}
@@ -340,21 +466,21 @@ mod tests {
fn get_test_queue() -> BlockQueue {
let spec = get_test_spec();
let engine = spec.to_engine().unwrap();
BlockQueue::new(Arc::new(engine), IoChannel::disconnected())
let engine = spec.engine;
BlockQueue::new(BlockQueueConfig::default(), Arc::new(engine), IoChannel::disconnected())
}
#[test]
fn can_be_created() {
// TODO better test
let spec = Spec::new_test();
let engine = spec.to_engine().unwrap();
let _ = BlockQueue::new(Arc::new(engine), IoChannel::disconnected());
let engine = spec.engine;
let _ = BlockQueue::new(BlockQueueConfig::default(), Arc::new(engine), IoChannel::disconnected());
}
#[test]
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()) {
panic!("error importing block that is valid by definition({:?})", e);
}
@@ -362,7 +488,7 @@ mod tests {
#[test]
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()) {
panic!("error importing block that is valid by definition({:?})", e);
}
@@ -371,7 +497,7 @@ mod tests {
match duplicate_import {
Err(e) => {
match e {
ImportError::AlreadyQueued => {},
Error::Import(ImportError::AlreadyQueued) => {},
_ => { panic!("must return AlreadyQueued error"); }
}
}
@@ -381,7 +507,7 @@ mod tests {
#[test]
fn returns_ok_for_drained_duplicates() {
let mut queue = get_test_queue();
let queue = get_test_queue();
let block = get_good_dummy_block();
let hash = BlockView::new(&block).header().hash().clone();
if let Err(e) = queue.import_block(block) {
@@ -395,4 +521,29 @@ mod tests {
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, Arc::new(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());
}
}

View File

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

View File

@@ -0,0 +1,29 @@
// 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;
/// 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
}

View File

@@ -0,0 +1,96 @@
// 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;
use util::bytes::{FromRawBytesVariable, FromBytesError, ToBytesWithMap};
/// 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(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 it's total difficulty is higher than current
/// canon chain difficulty.
BranchBecomingCanonChain(BranchBecomingCanonChainData),
}
#[derive(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>,
}
impl FromRawBytesVariable for BranchBecomingCanonChainData {
fn from_bytes_variable(bytes: &[u8]) -> Result<BranchBecomingCanonChainData, FromBytesError> {
type Tuple = (Vec<H256>, Vec<H256>, H256);
let (enacted, retracted, ancestor) = try!(Tuple::from_bytes_variable(bytes));
Ok(BranchBecomingCanonChainData { ancestor: ancestor, enacted: enacted, retracted: retracted })
}
}
impl FromRawBytesVariable for BlockLocation {
fn from_bytes_variable(bytes: &[u8]) -> Result<BlockLocation, FromBytesError> {
match bytes[0] {
0 => Ok(BlockLocation::CanonChain),
1 => Ok(BlockLocation::Branch),
2 => Ok(BlockLocation::BranchBecomingCanonChain(
try!(BranchBecomingCanonChainData::from_bytes_variable(&bytes[1..bytes.len()])))),
_ => Err(FromBytesError::UnknownMarker)
}
}
}
impl ToBytesWithMap for BranchBecomingCanonChainData {
fn to_bytes_map(&self) -> Vec<u8> {
(&self.enacted, &self.retracted, &self.ancestor).to_bytes_map()
}
}
impl ToBytesWithMap for BlockLocation {
fn to_bytes_map(&self) -> Vec<u8> {
match *self {
BlockLocation::CanonChain => vec![0u8],
BlockLocation::Branch => vec![1u8],
BlockLocation::BranchBecomingCanonChain(ref data) => {
let mut bytes = (&data.enacted, &data.retracted, &data.ancestor).to_bytes_map();
bytes.insert(0, 2u8);
bytes
}
}
}
}

File diff suppressed because it is too large Load Diff

View 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
}
}

View 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)]
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,
}
}
}

View 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.deref_mut()[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(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()
}
}

View File

@@ -0,0 +1,64 @@
// 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::U256;
use util::bytes::Bytes;
use header::Header;
use transaction::SignedTransaction;
use super::fork::Forkable;
use super::bloom::WithBloom;
use super::complete::CompleteBlock;
/// 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 {
self.header.difficulty = self.header.difficulty - U256::from(fork_number);
self
}
}
impl WithBloom for Block {
fn with_bloom(mut self, bloom: H2048) -> Self where Self: Sized {
self.header.log_bloom = bloom;
self
}
}
impl CompleteBlock for Block {
fn complete(mut self, parent_hash: H256) -> Bytes {
self.header.parent_hash = parent_hash;
encode(&self).to_vec()
}
}

View 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()))
}
}

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

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

View File

@@ -0,0 +1,169 @@
// 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 super::fork::Fork;
use super::bloom::Bloom;
use super::complete::{BlockFinalizer, CompleteBlock, Complete};
use super::block::Block;
/// 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 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 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: U256::from(1000),
}
}
}
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);
}
}

View 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 bloom;
mod block;
mod complete;
mod fork;
pub mod generator;
pub use self::complete::BlockFinalizer;
pub use self::generator::{ChainIterator, ChainGenerator};

View 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![],
});
}
}

View 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)]
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;

View File

@@ -0,0 +1,22 @@
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 {
/// Block info.
pub info: BlockInfo,
/// 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 transaction addresses.
pub transactions_addresses: HashMap<H256, TransactionAddress>,
/// Modified blocks blooms.
pub blocks_blooms: HashMap<LogGroupPosition, BloomGroup>,
}

View File

@@ -0,0 +1,62 @@
// 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 bloomchain as bc;
use util::rlp::*;
use util::HeapSizeOf;
use basic_types::LogBloom;
/// Helper structure representing bloom of the trace.
#[derive(Debug, Clone)]
pub struct Bloom(LogBloom);
impl From<LogBloom> for Bloom {
fn from(bloom: LogBloom) -> Self {
Bloom(bloom)
}
}
impl From<bc::Bloom> for Bloom {
fn from(bloom: bc::Bloom) -> Self {
let bytes: [u8; 256] = bloom.into();
Bloom(LogBloom::from(bytes))
}
}
impl Into<bc::Bloom> for Bloom {
fn into(self) -> bc::Bloom {
let log = self.0;
bc::Bloom::from(log.0)
}
}
impl Decodable for Bloom {
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
Decodable::decode(decoder).map(Bloom)
}
}
impl Encodable for Bloom {
fn rlp_append(&self, s: &mut RlpStream) {
Encodable::rlp_append(&self.0, s)
}
}
impl HeapSizeOf for Bloom {
fn heap_size_of_children(&self) -> usize {
0
}
}

View File

@@ -0,0 +1,74 @@
// 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 bloomchain::group as bc;
use util::rlp::*;
use util::HeapSizeOf;
use super::Bloom;
/// Represents group of X consecutive blooms.
#[derive(Debug, Clone)]
pub struct BloomGroup {
blooms: Vec<Bloom>,
}
impl From<bc::BloomGroup> for BloomGroup {
fn from(group: bc::BloomGroup) -> Self {
let blooms = group.blooms
.into_iter()
.map(From::from)
.collect();
BloomGroup {
blooms: blooms
}
}
}
impl Into<bc::BloomGroup> for BloomGroup {
fn into(self) -> bc::BloomGroup {
let blooms = self.blooms
.into_iter()
.map(Into::into)
.collect();
bc::BloomGroup {
blooms: blooms
}
}
}
impl Decodable for BloomGroup {
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
let blooms = try!(Decodable::decode(decoder));
let group = BloomGroup {
blooms: blooms
};
Ok(group)
}
}
impl Encodable for BloomGroup {
fn rlp_append(&self, s: &mut RlpStream) {
Encodable::rlp_append(&self.blooms, s)
}
}
impl HeapSizeOf for BloomGroup {
fn heap_size_of_children(&self) -> usize {
self.blooms.heap_size_of_children()
}
}

View 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 bloomchain::group as bc;
use util::HeapSizeOf;
/// Represents `BloomGroup` position in database.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
pub struct GroupPosition {
/// Bloom level.
pub level: u8,
/// Group index.
pub index: u32,
}
impl From<bc::GroupPosition> for GroupPosition {
fn from(p: bc::GroupPosition) -> Self {
GroupPosition {
level: p.level as u8,
index: p.index as u32,
}
}
}
impl HeapSizeOf for GroupPosition {
fn heap_size_of_children(&self) -> usize {
0
}
}

25
ethcore/src/blooms/mod.rs Normal file
View 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/>.
//! Bridge between bloomchain crate types and ethcore.
mod bloom;
mod bloom_group;
mod group_position;
pub use self::bloom::Bloom;
pub use self::bloom_group::BloomGroup;
pub use self::group_position::GroupPosition;

View File

@@ -18,8 +18,9 @@ use util::*;
use crypto::sha2::Sha256;
use crypto::ripemd160::Ripemd160;
use crypto::digest::Digest;
use ethjson;
/// Definition of a contract whose implementation is built-in.
/// Definition of a contract whose implementation is built-in.
pub struct Builtin {
/// The gas cost of running this built-in for the given size of input data.
pub cost: Box<Fn(usize) -> U256>, // TODO: U256 should be bignum.
@@ -46,13 +47,12 @@ impl Builtin {
}
/// Create a new object from a builtin-function name with a linear cost associated with input size.
pub fn from_named_linear(name: &str, base_cost: usize, word_cost: usize) -> Option<Builtin> {
new_builtin_exec(name).map(|b| {
let cost = Box::new(move|s: usize| -> U256 {
U256::from(base_cost) + U256::from(word_cost) * U256::from((s + 31) / 32)
});
Self::new(cost, b)
})
pub fn from_named_linear(name: &str, base_cost: usize, word_cost: usize) -> Builtin {
let cost = Box::new(move|s: usize| -> U256 {
U256::from(base_cost) + U256::from(word_cost) * U256::from((s + 31) / 32)
});
Self::new(cost, new_builtin_exec(name))
}
/// Simple forwarder for cost.
@@ -60,22 +60,15 @@ impl Builtin {
/// Simple forwarder for execute.
pub fn execute(&self, input: &[u8], output: &mut[u8]) { (*self.execute)(input, output); }
}
/// Create a builtin from JSON.
///
/// JSON must be of the form `{ "name": "identity", "linear": {"base": 10, "word": 20} }`.
pub fn from_json(json: &Json) -> Option<Builtin> {
// NICE: figure out a more convenient means of handing errors here.
if let Json::String(ref name) = json["name"] {
if let Json::Object(ref o) = json["linear"] {
if let Json::U64(ref word) = o["word"] {
if let Json::U64(ref base) = o["base"] {
return Self::from_named_linear(&name[..], *base as usize, *word as usize);
}
}
impl From<ethjson::spec::Builtin> for Builtin {
fn from(b: ethjson::spec::Builtin) -> Self {
match b.pricing {
ethjson::spec::Pricing::Linear(linear) => {
Self::from_named_linear(b.name.as_ref(), linear.base, linear.word)
}
}
None
}
}
@@ -90,14 +83,14 @@ pub fn copy_to(src: &[u8], dest: &mut[u8]) {
/// Create a new builtin executor according to `name`.
/// TODO: turn in to a factory with dynamic registration.
pub fn new_builtin_exec(name: &str) -> Option<Box<Fn(&[u8], &mut [u8])>> {
pub fn new_builtin_exec(name: &str) -> Box<Fn(&[u8], &mut [u8])> {
match name {
"identity" => Some(Box::new(move|input: &[u8], output: &mut[u8]| {
"identity" => Box::new(move|input: &[u8], output: &mut[u8]| {
for i in 0..min(input.len(), output.len()) {
output[i] = input[i];
}
})),
"ecrecover" => Some(Box::new(move|input: &[u8], output: &mut[u8]| {
}),
"ecrecover" => Box::new(move|input: &[u8], output: &mut[u8]| {
#[repr(packed)]
#[derive(Debug)]
struct InType {
@@ -120,8 +113,8 @@ pub fn new_builtin_exec(name: &str) -> Option<Box<Fn(&[u8], &mut [u8])>> {
}
}
}
})),
"sha256" => Some(Box::new(move|input: &[u8], output: &mut[u8]| {
}),
"sha256" => Box::new(move|input: &[u8], output: &mut[u8]| {
let mut sha = Sha256::new();
sha.input(input);
if output.len() >= 32 {
@@ -131,21 +124,23 @@ pub fn new_builtin_exec(name: &str) -> Option<Box<Fn(&[u8], &mut [u8])>> {
sha.result(ret.as_slice_mut());
copy_to(&ret, output);
}
})),
"ripemd160" => Some(Box::new(move|input: &[u8], output: &mut[u8]| {
}),
"ripemd160" => Box::new(move|input: &[u8], output: &mut[u8]| {
let mut sha = Ripemd160::new();
sha.input(input);
let mut ret = H256::new();
sha.result(&mut ret.as_slice_mut()[12..32]);
copy_to(&ret, output);
})),
_ => None
}),
_ => {
panic!("invalid builtin name {}", name);
}
}
}
#[test]
fn identity() {
let f = new_builtin_exec("identity").unwrap();
let f = new_builtin_exec("identity");
let i = [0u8, 1, 2, 3];
let mut o2 = [255u8; 2];
@@ -165,7 +160,7 @@ fn identity() {
#[test]
fn sha256() {
use rustc_serialize::hex::FromHex;
let f = new_builtin_exec("sha256").unwrap();
let f = new_builtin_exec("sha256");
let i = [0u8; 0];
let mut o = [255u8; 32];
@@ -184,7 +179,7 @@ fn sha256() {
#[test]
fn ripemd160() {
use rustc_serialize::hex::FromHex;
let f = new_builtin_exec("ripemd160").unwrap();
let f = new_builtin_exec("ripemd160");
let i = [0u8; 0];
let mut o = [255u8; 32];
@@ -211,7 +206,7 @@ fn ecrecover() {
let s = k.sign(&m).unwrap();
println!("Signed: {}", s);*/
let f = new_builtin_exec("ecrecover").unwrap();
let f = new_builtin_exec("ecrecover");
let i = FromHex::from_hex("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
let mut o = [255u8; 32];
@@ -258,9 +253,15 @@ fn ecrecover() {
assert_eq!(&o[..], &(FromHex::from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap())[..]);*/
}
#[test]
#[should_panic]
fn from_unknown_linear() {
let _ = Builtin::from_named_linear("dw", 10, 20);
}
#[test]
fn from_named_linear() {
let b = Builtin::from_named_linear("identity", 10, 20).unwrap();
let b = Builtin::from_named_linear("identity", 10, 20);
assert_eq!((*b.cost)(0), U256::from(10));
assert_eq!((*b.cost)(1), U256::from(30));
assert_eq!((*b.cost)(32), U256::from(30));
@@ -274,9 +275,14 @@ fn from_named_linear() {
#[test]
fn from_json() {
let text = "{ \"name\": \"identity\", \"linear\": {\"base\": 10, \"word\": 20} }";
let json = Json::from_str(text).unwrap();
let b = Builtin::from_json(&json).unwrap();
let b = Builtin::from(ethjson::spec::Builtin {
name: "identity".to_owned(),
pricing: ethjson::spec::Pricing::Linear(ethjson::spec::Linear {
base: 10,
word: 20,
})
});
assert_eq!((*b.cost)(0), U256::from(10));
assert_eq!((*b.cost)(1), U256::from(30));
assert_eq!((*b.cost)(32), U256::from(30));

View File

@@ -1,421 +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 client.
use util::*;
use rocksdb::{Options, DB, DBCompactionStyle};
use blockchain::{BlockChain, BlockProvider, CacheSize};
use views::BlockView;
use error::*;
use header::BlockNumber;
use state::State;
use spec::Spec;
use engine::Engine;
use views::HeaderView;
use block_queue::{BlockQueue, BlockQueueInfo};
use service::NetSyncMessage;
use env_info::LastHashes;
use verification::*;
use block::*;
pub use blockchain::TreeRoute;
/// General block status
#[derive(Debug, Eq, PartialEq)]
pub enum BlockStatus {
/// Part of the blockchain.
InChain,
/// Queued for import.
Queued,
/// Known as bad.
Bad,
/// Unknown.
Unknown,
}
/// Information about the blockchain gthered together.
#[derive(Debug)]
pub struct BlockChainInfo {
/// Blockchain difficulty.
pub total_difficulty: U256,
/// Block queue difficulty.
pub pending_total_difficulty: U256,
/// Genesis block hash.
pub genesis_hash: H256,
/// Best blockchain block hash.
pub best_block_hash: H256,
/// Best blockchain block number.
pub best_block_number: BlockNumber
}
impl fmt::Display for BlockChainInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "#{}.{}", self.best_block_number, self.best_block_hash)
}
}
/// Blockchain database client. Owns and manages a blockchain and a block queue.
pub trait BlockChainClient : Sync + Send {
/// Get raw block header data by block header hash.
fn block_header(&self, hash: &H256) -> Option<Bytes>;
/// Get raw block body data by block header hash.
/// Block body is an RLP list of two items: uncles and transactions.
fn block_body(&self, hash: &H256) -> Option<Bytes>;
/// Get raw block data by block header hash.
fn block(&self, hash: &H256) -> Option<Bytes>;
/// Get block status by block header hash.
fn block_status(&self, hash: &H256) -> BlockStatus;
/// Get block total difficulty.
fn block_total_difficulty(&self, hash: &H256) -> Option<U256>;
/// Get raw block header data by block number.
fn block_header_at(&self, n: BlockNumber) -> Option<Bytes>;
/// Get raw block body data by block number.
/// Block body is an RLP list of two items: uncles and transactions.
fn block_body_at(&self, n: BlockNumber) -> Option<Bytes>;
/// Get raw block data by block number.
fn block_at(&self, n: BlockNumber) -> Option<Bytes>;
/// Get block status by block number.
fn block_status_at(&self, n: BlockNumber) -> BlockStatus;
/// Get block total difficulty.
fn block_total_difficulty_at(&self, n: BlockNumber) -> Option<U256>;
/// Get a tree route between `from` and `to`.
/// See `BlockChain::tree_route`.
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute>;
/// Get latest state node
fn state_data(&self, hash: &H256) -> Option<Bytes>;
/// Get raw block receipts data by block header hash.
fn block_receipts(&self, hash: &H256) -> Option<Bytes>;
/// Import a block into the blockchain.
fn import_block(&self, bytes: Bytes) -> ImportResult;
/// Get block queue information.
fn queue_info(&self) -> BlockQueueInfo;
/// Clear block queue and abort all import activity.
fn clear_queue(&self);
/// Get blockchain information.
fn chain_info(&self) -> BlockChainInfo;
/// Get the best block header.
fn best_block_header(&self) -> Bytes {
self.block_header(&self.chain_info().best_block_hash).unwrap()
}
}
#[derive(Default, Clone, Debug, Eq, PartialEq)]
/// Report on the status of a client.
pub struct ClientReport {
/// How many blocks have been imported so far.
pub blocks_imported: usize,
/// How many transactions have been applied so far.
pub transactions_applied: usize,
/// How much gas has been processed so far.
pub gas_processed: U256,
}
impl ClientReport {
/// Alter internal reporting to reflect the additional `block` has been processed.
pub fn accrue_block(&mut self, block: &PreVerifiedBlock) {
self.blocks_imported += 1;
self.transactions_applied += block.transactions.len();
self.gas_processed += block.header.gas_used;
}
}
/// Blockchain database client backed by a persistent database. Owns and manages a blockchain and a block queue.
/// Call `import_block()` to import a block asynchronously; `flush_queue()` flushes the queue.
pub struct Client {
chain: Arc<RwLock<BlockChain>>,
engine: Arc<Box<Engine>>,
state_db: Mutex<JournalDB>,
block_queue: RwLock<BlockQueue>,
report: RwLock<ClientReport>,
import_lock: Mutex<()>
}
const HISTORY: u64 = 1000;
const CLIENT_DB_VER_STR: &'static str = "1.0";
impl Client {
/// Create a new client with given spec and DB path.
pub fn new(spec: Spec, path: &Path, message_channel: IoChannel<NetSyncMessage> ) -> Result<Arc<Client>, Error> {
let mut dir = path.to_path_buf();
dir.push(H64::from(spec.genesis_header().hash()).hex());
//TODO: sec/fat: pruned/full versioning
dir.push(format!("v{}-sec-pruned", CLIENT_DB_VER_STR));
let path = dir.as_path();
let gb = spec.genesis_block();
let chain = Arc::new(RwLock::new(BlockChain::new(&gb, path)));
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);
/*
opts.set_bytes_per_sync(8388608);
opts.set_disable_data_sync(false);
opts.set_block_cache_size_mb(1024);
opts.set_table_cache_num_shard_bits(6);
opts.set_max_write_buffer_number(32);
opts.set_write_buffer_size(536870912);
opts.set_target_file_size_base(1073741824);
opts.set_min_write_buffer_number_to_merge(4);
opts.set_level_zero_stop_writes_trigger(2000);
opts.set_level_zero_slowdown_writes_trigger(0);
opts.set_compaction_style(DBUniversalCompaction);
opts.set_max_background_compactions(4);
opts.set_max_background_flushes(4);
opts.set_filter_deletes(false);
opts.set_disable_auto_compactions(false);*/
let mut state_path = path.to_path_buf();
state_path.push("state");
let db = Arc::new(DB::open(&opts, state_path.to_str().unwrap()).unwrap());
let engine = Arc::new(try!(spec.to_engine()));
let mut state_db = JournalDB::new_with_arc(db.clone());
if state_db.is_empty() && engine.spec().ensure_db_good(&mut state_db) {
state_db.commit(0, &engine.spec().genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
}
Ok(Arc::new(Client {
chain: chain,
engine: engine.clone(),
state_db: Mutex::new(state_db),
block_queue: RwLock::new(BlockQueue::new(engine, message_channel)),
report: RwLock::new(Default::default()),
import_lock: Mutex::new(()),
}))
}
/// Flush the block import queue.
pub fn flush_queue(&self) {
self.block_queue.write().unwrap().flush();
}
/// This is triggered by a message coming from a block queue when the block is ready for insertion
pub fn import_verified_blocks(&self, _io: &IoChannel<NetSyncMessage>) -> usize {
let mut ret = 0;
let mut bad = HashSet::new();
let _import_lock = self.import_lock.lock();
let blocks = self.block_queue.write().unwrap().drain(128);
let mut good_blocks = Vec::with_capacity(128);
for block in blocks {
if bad.contains(&block.header.parent_hash) {
self.block_queue.write().unwrap().mark_as_bad(&block.header.hash());
bad.insert(block.header.hash());
continue;
}
let header = &block.header;
if let Err(e) = verify_block_family(&header, &block.bytes, self.engine.deref().deref(), self.chain.read().unwrap().deref()) {
warn!(target: "client", "Stage 3 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
self.block_queue.write().unwrap().mark_as_bad(&header.hash());
bad.insert(block.header.hash());
break;
};
let parent = match self.chain.read().unwrap().block_header(&header.parent_hash) {
Some(p) => p,
None => {
warn!(target: "client", "Block import failed for #{} ({}): Parent not found ({}) ", header.number(), header.hash(), header.parent_hash);
self.block_queue.write().unwrap().mark_as_bad(&header.hash());
bad.insert(block.header.hash());
break;
},
};
// build last hashes
let mut last_hashes = LastHashes::new();
last_hashes.resize(256, H256::new());
last_hashes[0] = header.parent_hash.clone();
for i in 0..255 {
match self.chain.read().unwrap().block_details(&last_hashes[i]) {
Some(details) => {
last_hashes[i + 1] = details.parent.clone();
},
None => break,
}
}
let db = self.state_db.lock().unwrap().clone();
let result = match enact_verified(&block, self.engine.deref().deref(), db, &parent, &last_hashes) {
Ok(b) => b,
Err(e) => {
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
bad.insert(block.header.hash());
self.block_queue.write().unwrap().mark_as_bad(&header.hash());
break;
}
};
if let Err(e) = verify_block_final(&header, result.block().header()) {
warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
self.block_queue.write().unwrap().mark_as_bad(&header.hash());
break;
}
good_blocks.push(header.hash().clone());
self.chain.write().unwrap().insert_block(&block.bytes); //TODO: err here?
let ancient = if header.number() >= HISTORY { Some(header.number() - HISTORY) } else { None };
match result.drain().commit(header.number(), &header.hash(), ancient.map(|n|(n, self.chain.read().unwrap().block_hash(n).unwrap()))) {
Ok(_) => (),
Err(e) => {
warn!(target: "client", "State DB commit failed: {:?}", e);
break;
}
}
self.report.write().unwrap().accrue_block(&block);
trace!(target: "client", "Imported #{} ({})", header.number(), header.hash());
ret += 1;
}
self.block_queue.write().unwrap().mark_as_good(&good_blocks);
ret
}
/// Get a copy of the best block's state.
pub fn state(&self) -> State {
State::from_existing(self.state_db.lock().unwrap().clone(), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
}
/// Get info on the cache.
pub fn cache_info(&self) -> CacheSize {
self.chain.read().unwrap().cache_size()
}
/// Get the report.
pub fn report(&self) -> ClientReport {
self.report.read().unwrap().clone()
}
/// Tick the client.
pub fn tick(&self) {
self.chain.read().unwrap().collect_garbage();
}
/// Set up the cache behaviour.
pub fn configure_cache(&self, pref_cache_size: usize, max_cache_size: usize) {
self.chain.write().unwrap().configure_cache(pref_cache_size, max_cache_size);
}
}
impl BlockChainClient for Client {
fn block_header(&self, hash: &H256) -> Option<Bytes> {
self.chain.read().unwrap().block(hash).map(|bytes| BlockView::new(&bytes).rlp().at(0).as_raw().to_vec())
}
fn block_body(&self, hash: &H256) -> Option<Bytes> {
self.chain.read().unwrap().block(hash).map(|bytes| {
let rlp = Rlp::new(&bytes);
let mut body = RlpStream::new();
body.append_raw(rlp.at(1).as_raw(), 1);
body.append_raw(rlp.at(2).as_raw(), 1);
body.out()
})
}
fn block(&self, hash: &H256) -> Option<Bytes> {
self.chain.read().unwrap().block(hash)
}
fn block_status(&self, hash: &H256) -> BlockStatus {
if self.chain.read().unwrap().is_known(&hash) {
BlockStatus::InChain
} else {
self.block_queue.read().unwrap().block_status(hash)
}
}
fn block_total_difficulty(&self, hash: &H256) -> Option<U256> {
self.chain.read().unwrap().block_details(hash).map(|d| d.total_difficulty)
}
fn block_header_at(&self, n: BlockNumber) -> Option<Bytes> {
self.chain.read().unwrap().block_hash(n).and_then(|h| self.block_header(&h))
}
fn block_body_at(&self, n: BlockNumber) -> Option<Bytes> {
self.chain.read().unwrap().block_hash(n).and_then(|h| self.block_body(&h))
}
fn block_at(&self, n: BlockNumber) -> Option<Bytes> {
self.chain.read().unwrap().block_hash(n).and_then(|h| self.block(&h))
}
fn block_status_at(&self, n: BlockNumber) -> BlockStatus {
match self.chain.read().unwrap().block_hash(n) {
Some(h) => self.block_status(&h),
None => BlockStatus::Unknown
}
}
fn block_total_difficulty_at(&self, n: BlockNumber) -> Option<U256> {
self.chain.read().unwrap().block_hash(n).and_then(|h| self.block_total_difficulty(&h))
}
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute> {
self.chain.read().unwrap().tree_route(from.clone(), to.clone())
}
fn state_data(&self, _hash: &H256) -> Option<Bytes> {
unimplemented!();
}
fn block_receipts(&self, _hash: &H256) -> Option<Bytes> {
unimplemented!();
}
fn import_block(&self, bytes: Bytes) -> ImportResult {
let header = BlockView::new(&bytes).header();
if self.chain.read().unwrap().is_known(&header.hash()) {
return Err(ImportError::AlreadyInChain);
}
if self.block_status(&header.parent_hash) == BlockStatus::Unknown {
return Err(ImportError::UnknownParent);
}
self.block_queue.write().unwrap().import_block(bytes)
}
fn queue_info(&self) -> BlockQueueInfo {
self.block_queue.read().unwrap().queue_info()
}
fn clear_queue(&self) {
self.block_queue.write().unwrap().clear();
}
fn chain_info(&self) -> BlockChainInfo {
let chain = self.chain.read().unwrap();
BlockChainInfo {
total_difficulty: chain.best_block_total_difficulty(),
pending_total_difficulty: chain.best_block_total_difficulty(),
genesis_hash: chain.genesis_hash(),
best_block_hash: chain.best_block_hash(),
best_block_number: From::from(chain.best_block_number())
}
}
}

View File

@@ -0,0 +1,873 @@
// 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 client.
use std::path::PathBuf;
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
use util::*;
use util::panics::*;
use views::BlockView;
use error::{ImportError, ExecutionError, BlockError, ImportResult};
use header::{BlockNumber, Header};
use state::State;
use spec::Spec;
use basic_types::Seal;
use engine::Engine;
use views::HeaderView;
use service::{NetSyncMessage, SyncMessage};
use env_info::LastHashes;
use verification;
use verification::{PreverifiedBlock, Verifier};
use block::*;
use transaction::{LocalizedTransaction, SignedTransaction, Action};
use blockchain::extras::TransactionAddress;
use filter::Filter;
use log_entry::LocalizedLogEntry;
use block_queue::{BlockQueue, BlockQueueInfo};
use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute};
use client::{BlockID, TransactionID, UncleID, TraceId, ClientConfig, DatabaseCompactionProfile,
BlockChainClient, MiningBlockChainClient, TraceFilter, CallAnalytics };
use client::Error as ClientError;
use env_info::EnvInfo;
use executive::{Executive, Executed, TransactOptions, contract_address};
use receipt::LocalizedReceipt;
pub use blockchain::CacheSize as BlockChainCacheSize;
use trace::{TraceDB, ImportRequest as TraceImportRequest, LocalizedTrace, Database as TraceDatabase};
use trace;
use trace::FlatTransactionTraces;
// re-export
pub use types::blockchain_info::BlockChainInfo;
pub use types::block_status::BlockStatus;
use evm::Factory as EvmFactory;
use miner::{Miner, MinerService};
const MAX_TX_QUEUE_SIZE: usize = 4096;
impl fmt::Display for BlockChainInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "#{}.{}", self.best_block_number, self.best_block_hash)
}
}
/// Report on the status of a client.
#[derive(Default, Clone, Debug, Eq, PartialEq)]
pub struct ClientReport {
/// How many blocks have been imported so far.
pub blocks_imported: usize,
/// How many transactions have been applied so far.
pub transactions_applied: usize,
/// How much gas has been processed so far.
pub gas_processed: U256,
/// Memory used by state DB
pub state_db_mem: usize,
}
impl ClientReport {
/// Alter internal reporting to reflect the additional `block` has been processed.
pub fn accrue_block(&mut self, block: &PreverifiedBlock) {
self.blocks_imported += 1;
self.transactions_applied += block.transactions.len();
self.gas_processed = self.gas_processed + block.header.gas_used;
}
}
/// Blockchain database client backed by a persistent database. Owns and manages a blockchain and a block queue.
/// Call `import_block()` to import a block asynchronously; `flush_queue()` flushes the queue.
pub struct Client {
chain: Arc<BlockChain>,
tracedb: Arc<TraceDB<BlockChain>>,
engine: Arc<Box<Engine>>,
state_db: Mutex<Box<JournalDB>>,
block_queue: BlockQueue,
report: RwLock<ClientReport>,
import_lock: Mutex<()>,
panic_handler: Arc<PanicHandler>,
verifier: Box<Verifier>,
vm_factory: Arc<EvmFactory>,
miner: Arc<Miner>,
io_channel: IoChannel<NetSyncMessage>,
queue_transactions: AtomicUsize,
}
const HISTORY: u64 = 1200;
// DO NOT TOUCH THIS ANY MORE UNLESS YOU REALLY KNOW WHAT YOU'RE DOING.
// Altering it will force a blanket DB update for *all* JournalDB-derived
// databases.
// Instead, add/upgrade the version string of the individual JournalDB-derived database
// of which you actually want force an upgrade.
const CLIENT_DB_VER_STR: &'static str = "5.3";
/// Get the path for the databases given the root path and information on the databases.
pub fn get_db_path(path: &Path, pruning: journaldb::Algorithm, genesis_hash: H256) -> PathBuf {
let mut dir = path.to_path_buf();
dir.push(H64::from(genesis_hash).hex());
//TODO: sec/fat: pruned/full versioning
// version here is a bit useless now, since it's controlled only be the pruning algo.
dir.push(format!("v{}-sec-{}", CLIENT_DB_VER_STR, pruning));
dir
}
/// Append a path element to the given path and return the string.
pub fn append_path(path: &Path, item: &str) -> String {
let mut p = path.to_path_buf();
p.push(item);
p.to_str().unwrap().to_owned()
}
impl Client {
/// Create a new client with given spec and DB path and custom verifier.
pub fn new(
config: ClientConfig,
spec: Spec,
path: &Path,
miner: Arc<Miner>,
message_channel: IoChannel<NetSyncMessage>)
-> Result<Arc<Client>, ClientError>
{
let path = get_db_path(path, config.pruning, spec.genesis_header().hash());
let gb = spec.genesis_block();
let chain = Arc::new(BlockChain::new(config.blockchain, &gb, &path));
let tracedb = Arc::new(try!(TraceDB::new(config.tracing, &path, chain.clone())));
let mut state_db_config = match config.db_cache_size {
None => DatabaseConfig::default(),
Some(cache_size) => DatabaseConfig::with_cache(cache_size),
};
if config.db_compaction == DatabaseCompactionProfile::HDD {
state_db_config = state_db_config.compaction(CompactionProfile::hdd());
}
let mut state_db = journaldb::new(
&append_path(&path, "state"),
config.pruning,
state_db_config
);
if state_db.is_empty() && spec.ensure_db_good(state_db.as_hashdb_mut()) {
state_db.commit(0, &spec.genesis_header().hash(), None).expect("Error commiting genesis state to state DB");
}
let engine = Arc::new(spec.engine);
let block_queue = BlockQueue::new(config.queue, engine.clone(), message_channel.clone());
let panic_handler = PanicHandler::new_in_arc();
panic_handler.forward_from(&block_queue);
let client = Client {
chain: chain,
tracedb: tracedb,
engine: engine,
state_db: Mutex::new(state_db),
block_queue: block_queue,
report: RwLock::new(Default::default()),
import_lock: Mutex::new(()),
panic_handler: panic_handler,
verifier: verification::new(config.verifier_type),
vm_factory: Arc::new(EvmFactory::new(config.vm_type)),
miner: miner,
io_channel: message_channel,
queue_transactions: AtomicUsize::new(0),
};
Ok(Arc::new(client))
}
/// Flush the block import queue.
pub fn flush_queue(&self) {
self.block_queue.flush();
}
fn build_last_hashes(&self, parent_hash: H256) -> LastHashes {
let mut last_hashes = LastHashes::new();
last_hashes.resize(256, H256::new());
last_hashes[0] = parent_hash;
for i in 0..255 {
match self.chain.block_details(&last_hashes[i]) {
Some(details) => {
last_hashes[i + 1] = details.parent.clone();
},
None => break,
}
}
last_hashes
}
fn check_and_close_block(&self, block: &PreverifiedBlock) -> Result<LockedBlock, ()> {
let engine = self.engine.deref().deref();
let header = &block.header;
// Check the block isn't so old we won't be able to enact it.
let best_block_number = self.chain.best_block_number();
if best_block_number >= HISTORY && header.number() <= best_block_number - HISTORY {
warn!(target: "client", "Block import failed for #{} ({})\nBlock is ancient (current best block: #{}).", header.number(), header.hash(), best_block_number);
return Err(());
}
// Verify Block Family
let verify_family_result = self.verifier.verify_block_family(&header, &block.bytes, engine, self.chain.deref());
if let Err(e) = verify_family_result {
warn!(target: "client", "Stage 3 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
return Err(());
};
// Check if Parent is in chain
let chain_has_parent = self.chain.block_header(&header.parent_hash);
if let None = chain_has_parent {
warn!(target: "client", "Block import failed for #{} ({}): Parent not found ({}) ", header.number(), header.hash(), header.parent_hash);
return Err(());
};
// Enact Verified Block
let parent = chain_has_parent.unwrap();
let last_hashes = self.build_last_hashes(header.parent_hash.clone());
let db = self.state_db.lock().unwrap().boxed_clone();
let enact_result = enact_verified(&block, engine, self.tracedb.tracing_enabled(), db, &parent, last_hashes, &self.vm_factory);
if let Err(e) = enact_result {
warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
return Err(());
};
// Final Verification
let locked_block = enact_result.unwrap();
if let Err(e) = self.verifier.verify_block_final(&header, locked_block.block().header()) {
warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
return Err(());
}
Ok(locked_block)
}
fn calculate_enacted_retracted(&self, import_results: &[ImportRoute]) -> (Vec<H256>, Vec<H256>) {
fn map_to_vec(map: Vec<(H256, bool)>) -> Vec<H256> {
map.into_iter().map(|(k, _v)| k).collect()
}
// In ImportRoute we get all the blocks that have been enacted and retracted by single insert.
// Because we are doing multiple inserts some of the blocks that were enacted in import `k`
// could be retracted in import `k+1`. This is why to understand if after all inserts
// the block is enacted or retracted we iterate over all routes and at the end final state
// will be in the hashmap
let map = import_results.iter().fold(HashMap::new(), |mut map, route| {
for hash in &route.enacted {
map.insert(hash.clone(), true);
}
for hash in &route.retracted {
map.insert(hash.clone(), false);
}
map
});
// Split to enacted retracted (using hashmap value)
let (enacted, retracted) = map.into_iter().partition(|&(_k, v)| v);
// And convert tuples to keys
(map_to_vec(enacted), map_to_vec(retracted))
}
/// This is triggered by a message coming from a block queue when the block is ready for insertion
pub fn import_verified_blocks(&self, io: &IoChannel<NetSyncMessage>) -> usize {
let max_blocks_to_import = 64;
let mut imported_blocks = Vec::with_capacity(max_blocks_to_import);
let mut invalid_blocks = HashSet::new();
let mut import_results = Vec::with_capacity(max_blocks_to_import);
let _import_lock = self.import_lock.lock();
let _timer = PerfTimer::new("import_verified_blocks");
let blocks = self.block_queue.drain(max_blocks_to_import);
for block in blocks {
let header = &block.header;
if invalid_blocks.contains(&header.parent_hash) {
invalid_blocks.insert(header.hash());
continue;
}
let closed_block = self.check_and_close_block(&block);
if let Err(_) = closed_block {
invalid_blocks.insert(header.hash());
continue;
}
let closed_block = closed_block.unwrap();
imported_blocks.push(header.hash());
let route = self.commit_block(closed_block, &header.hash(), &block.bytes);
import_results.push(route);
self.report.write().unwrap().accrue_block(&block);
trace!(target: "client", "Imported #{} ({})", header.number(), header.hash());
}
let imported = imported_blocks.len();
let invalid_blocks = invalid_blocks.into_iter().collect::<Vec<H256>>();
{
if !invalid_blocks.is_empty() {
self.block_queue.mark_as_bad(&invalid_blocks);
}
if !imported_blocks.is_empty() {
self.block_queue.mark_as_good(&imported_blocks);
}
}
{
if !imported_blocks.is_empty() && self.block_queue.queue_info().is_empty() {
let (enacted, retracted) = self.calculate_enacted_retracted(&import_results);
if self.queue_info().is_empty() {
self.miner.chain_new_blocks(self, &imported_blocks, &invalid_blocks, &enacted, &retracted);
}
io.send(NetworkIoMessage::User(SyncMessage::NewChainBlocks {
imported: imported_blocks,
invalid: invalid_blocks,
enacted: enacted,
retracted: retracted,
sealed: Vec::new(),
})).unwrap_or_else(|e| warn!("Error sending IO notification: {:?}", e));
}
}
imported
}
fn commit_block<B>(&self, block: B, hash: &H256, block_data: &Bytes) -> ImportRoute where B: IsBlock + Drain {
let number = block.header().number();
// Are we committing an era?
let ancient = if number >= HISTORY {
let n = number - HISTORY;
Some((n, self.chain.block_hash(n).unwrap()))
} else {
None
};
// Commit results
let receipts = block.receipts().to_owned();
let traces = block.traces().clone().unwrap_or_else(Vec::new);
let traces: Vec<FlatTransactionTraces> = traces.into_iter()
.map(Into::into)
.collect();
//let traces = From::from(block.traces().clone().unwrap_or_else(Vec::new));
// CHECK! I *think* this is fine, even if the state_root is equal to another
// already-imported block of the same number.
// TODO: Prove it with a test.
block.drain().commit(number, hash, ancient).expect("State DB commit failed.");
// And update the chain after commit to prevent race conditions
// (when something is in chain but you are not able to fetch details)
let route = self.chain.insert_block(block_data, receipts);
self.tracedb.import(TraceImportRequest {
traces: traces.into(),
block_hash: hash.clone(),
block_number: number,
enacted: route.enacted.clone(),
retracted: route.retracted.len()
});
route
}
/// Import transactions from the IO queue
pub fn import_queued_transactions(&self, transactions: &[Bytes]) -> usize {
let _timer = PerfTimer::new("import_queued_transactions");
self.queue_transactions.fetch_sub(transactions.len(), AtomicOrdering::SeqCst);
let txs = transactions.iter().filter_map(|bytes| UntrustedRlp::new(&bytes).as_val().ok()).collect();
let results = self.miner.import_external_transactions(self, txs);
results.len()
}
/// Attempt to get a copy of a specific block's state.
///
/// This will not fail if given BlockID::Latest.
/// Otherwise, this can fail (but may not) if the DB prunes state.
pub fn state_at(&self, id: BlockID) -> Option<State> {
// fast path for latest state.
match id.clone() {
BlockID::Pending => return self.miner.pending_state().or_else(|| Some(self.state())),
BlockID::Latest => return Some(self.state()),
_ => {},
}
let block_number = match self.block_number(id.clone()) {
Some(num) => num,
None => return None,
};
self.block_header(id).and_then(|header| {
let db = self.state_db.lock().unwrap().boxed_clone();
// early exit for pruned blocks
if db.is_pruned() && self.chain.best_block_number() >= block_number + HISTORY {
return None;
}
let root = HeaderView::new(&header).state_root();
State::from_existing(db, root, self.engine.account_start_nonce()).ok()
})
}
/// Get a copy of the best block's state.
pub fn state(&self) -> State {
State::from_existing(self.state_db.lock().unwrap().boxed_clone(), HeaderView::new(&self.best_block_header()).state_root(), self.engine.account_start_nonce())
.expect("State root of best block header always valid.")
}
/// Get info on the cache.
pub fn blockchain_cache_info(&self) -> BlockChainCacheSize {
self.chain.cache_size()
}
/// Get the report.
pub fn report(&self) -> ClientReport {
let mut report = self.report.read().unwrap().clone();
report.state_db_mem = self.state_db.lock().unwrap().mem_used();
report
}
/// Tick the client.
pub fn tick(&self) {
self.chain.collect_garbage();
self.block_queue.collect_garbage();
}
/// Set up the cache behaviour.
pub fn configure_cache(&self, pref_cache_size: usize, max_cache_size: usize) {
self.chain.configure_cache(pref_cache_size, max_cache_size);
}
/// Look up the block number for the given block ID.
pub fn block_number(&self, id: BlockID) -> Option<BlockNumber> {
match id {
BlockID::Number(number) => Some(number),
BlockID::Hash(ref hash) => self.chain.block_number(hash),
BlockID::Earliest => Some(0),
BlockID::Latest | BlockID::Pending => Some(self.chain.best_block_number()),
}
}
fn block_hash(chain: &BlockChain, id: BlockID) -> Option<H256> {
match id {
BlockID::Hash(hash) => Some(hash),
BlockID::Number(number) => chain.block_hash(number),
BlockID::Earliest => chain.block_hash(0),
BlockID::Latest | BlockID::Pending => Some(chain.best_block_hash()),
}
}
fn transaction_address(&self, id: TransactionID) -> Option<TransactionAddress> {
match id {
TransactionID::Hash(ref hash) => self.chain.transaction_address(hash),
TransactionID::Location(id, index) => Self::block_hash(&self.chain, id).map(|hash| TransactionAddress {
block_hash: hash,
index: index,
})
}
}
}
impl BlockChainClient for Client {
fn call(&self, t: &SignedTransaction, analytics: CallAnalytics) -> Result<Executed, ExecutionError> {
let header = self.block_header(BlockID::Latest).unwrap();
let view = HeaderView::new(&header);
let last_hashes = self.build_last_hashes(view.hash());
let env_info = EnvInfo {
number: view.number(),
author: view.author(),
timestamp: view.timestamp(),
difficulty: view.difficulty(),
last_hashes: last_hashes,
gas_used: U256::zero(),
gas_limit: U256::max_value(),
};
// that's just a copy of the state.
let mut state = self.state();
let sender = try!(t.sender().map_err(|e| {
let message = format!("Transaction malformed: {:?}", e);
ExecutionError::TransactionMalformed(message)
}));
let balance = state.balance(&sender);
let needed_balance = t.value + t.gas * t.gas_price;
if balance < needed_balance {
// give the sender a sufficient balance
state.add_balance(&sender, &(needed_balance - balance));
}
let options = TransactOptions { tracing: analytics.transaction_tracing, vm_tracing: analytics.vm_tracing, check_nonce: false };
let mut ret = Executive::new(&mut state, &env_info, self.engine.deref().deref(), &self.vm_factory).transact(t, options);
// TODO gav move this into Executive.
if analytics.state_diffing {
if let Ok(ref mut x) = ret {
x.state_diff = Some(state.diff_from(self.state()));
}
}
ret
}
fn block_header(&self, id: BlockID) -> Option<Bytes> {
Self::block_hash(&self.chain, id).and_then(|hash| self.chain.block(&hash).map(|bytes| BlockView::new(&bytes).rlp().at(0).as_raw().to_vec()))
}
fn block_body(&self, id: BlockID) -> Option<Bytes> {
Self::block_hash(&self.chain, id).and_then(|hash| {
self.chain.block(&hash).map(|bytes| {
let rlp = Rlp::new(&bytes);
let mut body = RlpStream::new_list(2);
body.append_raw(rlp.at(1).as_raw(), 1);
body.append_raw(rlp.at(2).as_raw(), 1);
body.out()
})
})
}
fn block(&self, id: BlockID) -> Option<Bytes> {
if let &BlockID::Pending = &id {
if let Some(block) = self.miner.pending_block() {
return Some(block.rlp_bytes(Seal::Without));
}
}
Self::block_hash(&self.chain, id).and_then(|hash| {
self.chain.block(&hash)
})
}
fn block_status(&self, id: BlockID) -> BlockStatus {
match Self::block_hash(&self.chain, id) {
Some(ref hash) if self.chain.is_known(hash) => BlockStatus::InChain,
Some(hash) => self.block_queue.block_status(&hash),
None => BlockStatus::Unknown
}
}
fn block_total_difficulty(&self, id: BlockID) -> Option<U256> {
if let &BlockID::Pending = &id {
if let Some(block) = self.miner.pending_block() {
return Some(*block.header.difficulty() + self.block_total_difficulty(BlockID::Latest).expect("blocks in chain have details; qed"));
}
}
Self::block_hash(&self.chain, id).and_then(|hash| self.chain.block_details(&hash)).map(|d| d.total_difficulty)
}
fn nonce(&self, address: &Address, id: BlockID) -> Option<U256> {
self.state_at(id).map(|s| s.nonce(address))
}
fn block_hash(&self, id: BlockID) -> Option<H256> {
Self::block_hash(&self.chain, id)
}
fn code(&self, address: &Address) -> Option<Bytes> {
self.state().code(address)
}
fn balance(&self, address: &Address, id: BlockID) -> Option<U256> {
self.state_at(id).map(|s| s.balance(address))
}
fn storage_at(&self, address: &Address, position: &H256, id: BlockID) -> Option<H256> {
self.state_at(id).map(|s| s.storage_at(address, position))
}
fn transaction(&self, id: TransactionID) -> Option<LocalizedTransaction> {
self.transaction_address(id).and_then(|address| self.chain.transaction(&address))
}
fn uncle(&self, id: UncleID) -> Option<Header> {
let index = id.1;
self.block(id.0).and_then(|block| BlockView::new(&block).uncle_at(index))
}
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt> {
self.transaction_address(id).and_then(|address| {
let t = self.chain.block(&address.block_hash)
.and_then(|block| BlockView::new(&block).localized_transaction_at(address.index));
match (t, self.chain.transaction_receipt(&address)) {
(Some(tx), Some(receipt)) => {
let block_hash = tx.block_hash.clone();
let block_number = tx.block_number.clone();
let transaction_hash = tx.hash();
let transaction_index = tx.transaction_index;
let prior_gas_used = match tx.transaction_index {
0 => U256::zero(),
i => {
let prior_address = TransactionAddress { block_hash: address.block_hash, index: i - 1 };
let prior_receipt = self.chain.transaction_receipt(&prior_address).expect("Transaction receipt at `address` exists; `prior_address` has lower index in same block; qed");
prior_receipt.gas_used
}
};
Some(LocalizedReceipt {
transaction_hash: tx.hash(),
transaction_index: tx.transaction_index,
block_hash: tx.block_hash,
block_number: tx.block_number,
cumulative_gas_used: receipt.gas_used,
gas_used: receipt.gas_used - prior_gas_used,
contract_address: match tx.action {
Action::Call(_) => None,
Action::Create => Some(contract_address(&tx.sender().unwrap(), &tx.nonce))
},
logs: receipt.logs.into_iter().enumerate().map(|(i, log)| LocalizedLogEntry {
entry: log,
block_hash: block_hash.clone(),
block_number: block_number,
transaction_hash: transaction_hash.clone(),
transaction_index: transaction_index,
log_index: i
}).collect()
})
},
_ => None
}
})
}
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute> {
match self.chain.is_known(from) && self.chain.is_known(to) {
true => Some(self.chain.tree_route(from.clone(), to.clone())),
false => None
}
}
fn find_uncles(&self, hash: &H256) -> Option<Vec<H256>> {
self.chain.find_uncle_hashes(hash, self.engine.maximum_uncle_age())
}
fn state_data(&self, hash: &H256) -> Option<Bytes> {
self.state_db.lock().unwrap().state(hash)
}
fn block_receipts(&self, hash: &H256) -> Option<Bytes> {
self.chain.block_receipts(hash).map(|receipts| rlp::encode(&receipts).to_vec())
}
fn import_block(&self, bytes: Bytes) -> ImportResult {
{
let header = BlockView::new(&bytes).header_view();
if self.chain.is_known(&header.sha3()) {
return Err(ImportError::AlreadyInChain.into());
}
if self.block_status(BlockID::Hash(header.parent_hash())) == BlockStatus::Unknown {
return Err(BlockError::UnknownParent(header.parent_hash()).into());
}
}
self.block_queue.import_block(bytes)
}
fn queue_info(&self) -> BlockQueueInfo {
self.block_queue.queue_info()
}
fn clear_queue(&self) {
self.block_queue.clear();
}
fn chain_info(&self) -> BlockChainInfo {
BlockChainInfo {
total_difficulty: self.chain.best_block_total_difficulty(),
pending_total_difficulty: self.chain.best_block_total_difficulty(),
genesis_hash: self.chain.genesis_hash(),
best_block_hash: self.chain.best_block_hash(),
best_block_number: From::from(self.chain.best_block_number())
}
}
fn blocks_with_bloom(&self, bloom: &H2048, from_block: BlockID, to_block: BlockID) -> Option<Vec<BlockNumber>> {
match (self.block_number(from_block), self.block_number(to_block)) {
(Some(from), Some(to)) => Some(self.chain.blocks_with_bloom(bloom, from, to)),
_ => None
}
}
fn logs(&self, filter: Filter) -> Vec<LocalizedLogEntry> {
// TODO: lock blockchain only once
let mut blocks = filter.bloom_possibilities().iter()
.filter_map(|bloom| self.blocks_with_bloom(bloom, filter.from_block.clone(), filter.to_block.clone()))
.flat_map(|m| m)
// remove duplicate elements
.collect::<HashSet<u64>>()
.into_iter()
.collect::<Vec<u64>>();
blocks.sort();
blocks.into_iter()
.filter_map(|number| self.chain.block_hash(number).map(|hash| (number, hash)))
.filter_map(|(number, hash)| self.chain.block_receipts(&hash).map(|r| (number, hash, r.receipts)))
.filter_map(|(number, hash, receipts)| self.chain.block(&hash).map(|ref b| (number, hash, receipts, BlockView::new(b).transaction_hashes())))
.flat_map(|(number, hash, receipts, hashes)| {
let mut log_index = 0;
receipts.into_iter()
.enumerate()
.flat_map(|(index, receipt)| {
log_index += receipt.logs.len();
receipt.logs.into_iter()
.enumerate()
.filter(|tuple| filter.matches(&tuple.1))
.map(|(i, log)| LocalizedLogEntry {
entry: log,
block_hash: hash.clone(),
block_number: number,
transaction_hash: hashes.get(index).cloned().unwrap_or_else(H256::new),
transaction_index: index,
log_index: log_index + i
})
.collect::<Vec<LocalizedLogEntry>>()
})
.collect::<Vec<LocalizedLogEntry>>()
})
.collect()
}
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>> {
let start = self.block_number(filter.range.start);
let end = self.block_number(filter.range.end);
if start.is_some() && end.is_some() {
let filter = trace::Filter {
range: start.unwrap() as usize..end.unwrap() as usize,
from_address: From::from(filter.from_address),
to_address: From::from(filter.to_address),
};
let traces = self.tracedb.filter(&filter);
Some(traces)
} else {
None
}
}
fn trace(&self, trace: TraceId) -> Option<LocalizedTrace> {
let trace_address = trace.address;
self.transaction_address(trace.transaction)
.and_then(|tx_address| {
self.block_number(BlockID::Hash(tx_address.block_hash))
.and_then(|number| self.tracedb.trace(number, tx_address.index, trace_address))
})
}
fn transaction_traces(&self, transaction: TransactionID) -> Option<Vec<LocalizedTrace>> {
self.transaction_address(transaction)
.and_then(|tx_address| {
self.block_number(BlockID::Hash(tx_address.block_hash))
.and_then(|number| self.tracedb.transaction_traces(number, tx_address.index))
})
}
fn block_traces(&self, block: BlockID) -> Option<Vec<LocalizedTrace>> {
self.block_number(block)
.and_then(|number| self.tracedb.block_traces(number))
}
fn last_hashes(&self) -> LastHashes {
self.build_last_hashes(self.chain.best_block_hash())
}
fn queue_transactions(&self, transactions: Vec<Bytes>) {
if self.queue_transactions.load(AtomicOrdering::Relaxed) > MAX_TX_QUEUE_SIZE {
debug!("Ignoring {} transactions: queue is full", transactions.len());
} else {
let len = transactions.len();
match self.io_channel.send(NetworkIoMessage::User(SyncMessage::NewTransactions(transactions))) {
Ok(_) => {
self.queue_transactions.fetch_add(len, AtomicOrdering::SeqCst);
}
Err(e) => {
debug!("Ignoring {} transactions: error queueing: {}", len, e);
}
}
}
}
fn pending_transactions(&self) -> Vec<SignedTransaction> {
self.miner.pending_transactions()
}
}
impl MiningBlockChainClient for Client {
fn prepare_open_block(&self, author: Address, gas_range_target: (U256, U256), extra_data: Bytes) -> OpenBlock {
let engine = self.engine.deref().deref();
let h = self.chain.best_block_hash();
let mut open_block = OpenBlock::new(
engine,
&self.vm_factory,
false, // TODO: this will need to be parameterised once we want to do immediate mining insertion.
self.state_db.lock().unwrap().boxed_clone(),
&self.chain.block_header(&h).expect("h is best block hash: so it's header must exist: qed"),
self.build_last_hashes(h.clone()),
author,
gas_range_target,
extra_data,
).expect("OpenBlock::new only fails if parent state root invalid; state root of best block's header is never invalid; qed");
// Add uncles
self.chain
.find_uncle_headers(&h, engine.maximum_uncle_age())
.unwrap()
.into_iter()
.take(engine.maximum_uncle_count())
.foreach(|h| {
open_block.push_uncle(h).unwrap();
});
open_block
}
fn vm_factory(&self) -> &EvmFactory {
&self.vm_factory
}
fn import_sealed_block(&self, block: SealedBlock) -> ImportResult {
let _import_lock = self.import_lock.lock();
let _timer = PerfTimer::new("import_sealed_block");
let h = block.header().hash();
let number = block.header().number();
let block_data = block.rlp_bytes();
let route = self.commit_block(block, &h, &block_data);
trace!(target: "client", "Imported sealed block #{} ({})", number, h);
{
let (enacted, retracted) = self.calculate_enacted_retracted(&[route]);
self.miner.chain_new_blocks(self, &[h.clone()], &[], &enacted, &retracted);
self.io_channel.send(NetworkIoMessage::User(SyncMessage::NewChainBlocks {
imported: vec![h.clone()],
invalid: vec![],
enacted: enacted,
retracted: retracted,
sealed: vec![h.clone()],
})).unwrap_or_else(|e| warn!("Error sending IO notification: {:?}", e));
}
Ok(h)
}
}
impl MayPanic for Client {
fn on_panic<F>(&self, closure: F) where F: OnPanicListener {
self.panic_handler.on_panic(closure);
}
}

View File

@@ -0,0 +1,58 @@
// 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 use block_queue::BlockQueueConfig;
pub use blockchain::Config as BlockChainConfig;
pub use trace::{Config as TraceConfig, Switch};
pub use evm::VMType;
pub use verification::VerifierType;
use util::journaldb;
/// Client state db compaction profile
#[derive(Debug, PartialEq)]
pub enum DatabaseCompactionProfile {
/// Default compaction profile
Default,
/// HDD or other slow storage io compaction profile
HDD,
}
impl Default for DatabaseCompactionProfile {
fn default() -> Self { DatabaseCompactionProfile::Default }
}
/// Client configuration. Includes configs for all sub-systems.
#[derive(Debug, Default)]
pub struct ClientConfig {
/// Block queue configuration.
pub queue: BlockQueueConfig,
/// Blockchain configuration.
pub blockchain: BlockChainConfig,
/// Trace configuration.
pub tracing: TraceConfig,
/// VM type.
pub vm_type: VMType,
/// The JournalDB ("pruning") algorithm to use.
pub pruning: journaldb::Algorithm,
/// The name of the client instance.
pub name: String,
/// State db cache-size if not default
pub db_cache_size: Option<usize>,
/// State db compaction profile
pub db_compaction: DatabaseCompactionProfile,
/// Type of block verifier used by client.
pub verifier_type: VerifierType,
}

View File

@@ -0,0 +1,23 @@
use trace::Error as TraceError;
use std::fmt::{Display, Formatter, Error as FmtError};
/// Client configuration errors.
#[derive(Debug)]
pub enum Error {
/// TraceDB configuration error.
Trace(TraceError),
}
impl From<TraceError> for Error {
fn from(err: TraceError) -> Self {
Error::Trace(err)
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
match *self {
Error::Trace(ref err) => write!(f, "{}", err)
}
}
}

232
ethcore/src/client/mod.rs Normal file
View File

@@ -0,0 +1,232 @@
// 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 client.
mod client;
mod config;
mod error;
mod test_client;
mod trace;
pub use self::client::*;
pub use self::config::{ClientConfig, DatabaseCompactionProfile, BlockQueueConfig, BlockChainConfig, Switch, VMType};
pub use self::error::Error;
pub use types::ids::*;
pub use self::test_client::{TestBlockChainClient, EachBlockWith};
pub use self::trace::Filter as TraceFilter;
pub use executive::{Executed, Executive, TransactOptions};
pub use env_info::{LastHashes, EnvInfo};
use util::bytes::Bytes;
use util::hash::{Address, H256, H2048};
use util::numbers::U256;
use util::Itertools;
use blockchain::TreeRoute;
use block_queue::BlockQueueInfo;
use block::{OpenBlock, SealedBlock};
use header::{BlockNumber, Header};
use transaction::{LocalizedTransaction, SignedTransaction};
use log_entry::LocalizedLogEntry;
use filter::Filter;
use views::{BlockView};
use error::{ImportResult, ExecutionError};
use receipt::LocalizedReceipt;
use trace::LocalizedTrace;
use evm::Factory as EvmFactory;
/// Options concerning what analytics we run on the call.
#[derive(Eq, PartialEq, Default, Clone, Copy, Debug)]
pub struct CallAnalytics {
/// Make a transaction trace.
pub transaction_tracing: bool,
/// Make a VM trace.
pub vm_tracing: bool,
/// Make a diff.
pub state_diffing: bool,
}
/// Blockchain database client. Owns and manages a blockchain and a block queue.
pub trait BlockChainClient : Sync + Send {
/// Get raw block header data by block id.
fn block_header(&self, id: BlockID) -> Option<Bytes>;
/// Get raw block body data by block id.
/// Block body is an RLP list of two items: uncles and transactions.
fn block_body(&self, id: BlockID) -> Option<Bytes>;
/// Get raw block data by block header hash.
fn block(&self, id: BlockID) -> Option<Bytes>;
/// Get block status by block header hash.
fn block_status(&self, id: BlockID) -> BlockStatus;
/// Get block total difficulty.
fn block_total_difficulty(&self, id: BlockID) -> Option<U256>;
/// Attempt to get address nonce at given block.
/// May not fail on BlockID::Latest.
fn nonce(&self, address: &Address, id: BlockID) -> Option<U256>;
/// Get address nonce at the latest block's state.
fn latest_nonce(&self, address: &Address) -> U256 {
self.nonce(address, BlockID::Latest)
.expect("nonce will return Some when given BlockID::Latest. nonce was given BlockID::Latest. \
Therefore nonce has returned Some; qed")
}
/// Get block hash.
fn block_hash(&self, id: BlockID) -> Option<H256>;
/// Get address code.
fn code(&self, address: &Address) -> Option<Bytes>;
/// Get address balance at the given block's state.
///
/// May not return None if given BlockID::Latest.
/// Returns None if and only if the block's root hash has been pruned from the DB.
fn balance(&self, address: &Address, id: BlockID) -> Option<U256>;
/// Get address balance at the latest block's state.
fn latest_balance(&self, address: &Address) -> U256 {
self.balance(address, BlockID::Latest)
.expect("balance will return Some if given BlockID::Latest. balance was given BlockID::Latest \
Therefore balance has returned Some; qed")
}
/// Get value of the storage at given position at the given block's state.
///
/// May not return None if given BlockID::Latest.
/// Returns None if and only if the block's root hash has been pruned from the DB.
fn storage_at(&self, address: &Address, position: &H256, id: BlockID) -> Option<H256>;
/// Get value of the storage at given position at the latest block's state.
fn latest_storage_at(&self, address: &Address, position: &H256) -> H256 {
self.storage_at(address, position, BlockID::Latest)
.expect("storage_at will return Some if given BlockID::Latest. storage_at was given BlockID::Latest. \
Therefore storage_at has returned Some; qed")
}
/// Get transaction with given hash.
fn transaction(&self, id: TransactionID) -> Option<LocalizedTransaction>;
/// Get uncle with given id.
fn uncle(&self, id: UncleID) -> Option<Header>;
/// Get transaction receipt with given hash.
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt>;
/// Get a tree route between `from` and `to`.
/// See `BlockChain::tree_route`.
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute>;
/// Get all possible uncle hashes for a block.
fn find_uncles(&self, hash: &H256) -> Option<Vec<H256>>;
/// Get latest state node
fn state_data(&self, hash: &H256) -> Option<Bytes>;
/// Get raw block receipts data by block header hash.
fn block_receipts(&self, hash: &H256) -> Option<Bytes>;
/// Import a block into the blockchain.
fn import_block(&self, bytes: Bytes) -> ImportResult;
/// Get block queue information.
fn queue_info(&self) -> BlockQueueInfo;
/// Clear block queue and abort all import activity.
fn clear_queue(&self);
/// Get blockchain information.
fn chain_info(&self) -> BlockChainInfo;
/// Get the best block header.
fn best_block_header(&self) -> Bytes {
// TODO: lock blockchain only once
self.block_header(BlockID::Hash(self.chain_info().best_block_hash)).unwrap()
}
/// Returns numbers of blocks containing given bloom.
fn blocks_with_bloom(&self, bloom: &H2048, from_block: BlockID, to_block: BlockID) -> Option<Vec<BlockNumber>>;
/// Returns logs matching given filter.
fn logs(&self, filter: Filter) -> Vec<LocalizedLogEntry>;
/// Makes a non-persistent transaction call.
// TODO: should be able to accept blockchain location for call.
fn call(&self, t: &SignedTransaction, analytics: CallAnalytics) -> Result<Executed, ExecutionError>;
/// Returns traces matching given filter.
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>>;
/// Returns trace with given id.
fn trace(&self, trace: TraceId) -> Option<LocalizedTrace>;
/// Returns traces created by transaction.
fn transaction_traces(&self, trace: TransactionID) -> Option<Vec<LocalizedTrace>>;
/// Returns traces created by transaction from block.
fn block_traces(&self, trace: BlockID) -> Option<Vec<LocalizedTrace>>;
/// Get last hashes starting from best block.
fn last_hashes(&self) -> LastHashes;
/// Queue transactions for importing.
fn queue_transactions(&self, transactions: Vec<Bytes>);
/// list all transactions
fn pending_transactions(&self) -> Vec<SignedTransaction>;
/// Get the gas price distribution.
fn gas_price_statistics(&self, sample_size: usize, distribution_size: usize) -> Result<Vec<U256>, ()> {
let mut h = self.chain_info().best_block_hash;
let mut corpus = Vec::new();
for _ in 0..sample_size {
let block_bytes = self.block(BlockID::Hash(h)).expect("h is either the best_block_hash or an ancestor; qed");
let block = BlockView::new(&block_bytes);
let header = block.header_view();
if header.number() == 0 {
break;
}
block.transaction_views().iter().foreach(|t| corpus.push(t.gas_price()));
h = header.parent_hash().clone();
}
corpus.sort();
let n = corpus.len();
if n > 0 {
Ok((0..(distribution_size + 1))
.map(|i| corpus[i * (n - 1) / distribution_size])
.collect::<Vec<_>>()
)
} else {
Err(())
}
}
}
/// Extended client interface used for mining
pub trait MiningBlockChainClient : BlockChainClient {
/// Returns OpenBlock prepared for closing.
fn prepare_open_block(&self, author: Address, gas_range_target: (U256, U256), extra_data: Bytes)
-> OpenBlock;
/// Returns EvmFactory.
fn vm_factory(&self) -> &EvmFactory;
/// Import sealed block. Skips all verifications.
fn import_sealed_block(&self, block: SealedBlock) -> ImportResult;
}

View File

@@ -0,0 +1,505 @@
// 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/>.
//! Test client.
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
use util::*;
use transaction::{Transaction, LocalizedTransaction, SignedTransaction, Action};
use blockchain::TreeRoute;
use client::{BlockChainClient, MiningBlockChainClient, BlockChainInfo, BlockStatus, BlockID,
TransactionID, UncleID, TraceId, TraceFilter, LastHashes, CallAnalytics };
use header::{Header as BlockHeader, BlockNumber};
use filter::Filter;
use log_entry::LocalizedLogEntry;
use receipt::{Receipt, LocalizedReceipt};
use blockchain::extras::BlockReceipts;
use error::{ImportResult};
use evm::Factory as EvmFactory;
use miner::{Miner, MinerService};
use spec::Spec;
use block_queue::BlockQueueInfo;
use block::{OpenBlock, SealedBlock};
use executive::Executed;
use error::{ExecutionError};
use trace::LocalizedTrace;
/// Test client.
pub struct TestBlockChainClient {
/// Blocks.
pub blocks: RwLock<HashMap<H256, Bytes>>,
/// Mapping of numbers to hashes.
pub numbers: RwLock<HashMap<usize, H256>>,
/// Genesis block hash.
pub genesis_hash: H256,
/// Last block hash.
pub last_hash: RwLock<H256>,
/// Difficulty.
pub difficulty: RwLock<U256>,
/// Balances.
pub balances: RwLock<HashMap<Address, U256>>,
/// Nonces.
pub nonces: RwLock<HashMap<Address, U256>>,
/// Storage.
pub storage: RwLock<HashMap<(Address, H256), H256>>,
/// Code.
pub code: RwLock<HashMap<Address, Bytes>>,
/// Execution result.
pub execution_result: RwLock<Option<Executed>>,
/// Transaction receipts.
pub receipts: RwLock<HashMap<TransactionID, LocalizedReceipt>>,
/// Block queue size.
pub queue_size: AtomicUsize,
/// Miner
pub miner: Arc<Miner>,
}
#[derive(Clone)]
/// Used for generating test client blocks.
pub enum EachBlockWith {
/// Plain block.
Nothing,
/// Block with an uncle.
Uncle,
/// Block with a transaction.
Transaction,
/// Block with an uncle and transaction.
UncleAndTransaction
}
impl Default for TestBlockChainClient {
fn default() -> Self {
TestBlockChainClient::new()
}
}
impl TestBlockChainClient {
/// Creates new test client.
pub fn new() -> Self {
let mut client = TestBlockChainClient {
blocks: RwLock::new(HashMap::new()),
numbers: RwLock::new(HashMap::new()),
genesis_hash: H256::new(),
last_hash: RwLock::new(H256::new()),
difficulty: RwLock::new(From::from(0)),
balances: RwLock::new(HashMap::new()),
nonces: RwLock::new(HashMap::new()),
storage: RwLock::new(HashMap::new()),
code: RwLock::new(HashMap::new()),
execution_result: RwLock::new(None),
receipts: RwLock::new(HashMap::new()),
queue_size: AtomicUsize::new(0),
miner: Arc::new(Miner::with_spec(Spec::new_test())),
};
client.add_blocks(1, EachBlockWith::Nothing); // add genesis block
client.genesis_hash = client.last_hash.read().unwrap().clone();
client
}
/// Set the transaction receipt result
pub fn set_transaction_receipt(&self, id: TransactionID, receipt: LocalizedReceipt) {
self.receipts.write().unwrap().insert(id, receipt);
}
/// Set the execution result.
pub fn set_execution_result(&self, result: Executed) {
*self.execution_result.write().unwrap() = Some(result);
}
/// Set the balance of account `address` to `balance`.
pub fn set_balance(&self, address: Address, balance: U256) {
self.balances.write().unwrap().insert(address, balance);
}
/// Set nonce of account `address` to `nonce`.
pub fn set_nonce(&self, address: Address, nonce: U256) {
self.nonces.write().unwrap().insert(address, nonce);
}
/// Set `code` at `address`.
pub fn set_code(&self, address: Address, code: Bytes) {
self.code.write().unwrap().insert(address, code);
}
/// Set storage `position` to `value` for account `address`.
pub fn set_storage(&self, address: Address, position: H256, value: H256) {
self.storage.write().unwrap().insert((address, position), value);
}
/// Set block queue size for testing
pub fn set_queue_size(&self, size: usize) {
self.queue_size.store(size, AtomicOrder::Relaxed);
}
/// Add blocks to test client.
pub fn add_blocks(&self, count: usize, with: EachBlockWith) {
let len = self.numbers.read().unwrap().len();
for n in len..(len + count) {
let mut header = BlockHeader::new();
header.difficulty = From::from(n);
header.parent_hash = self.last_hash.read().unwrap().clone();
header.number = n as BlockNumber;
header.gas_limit = U256::from(1_000_000);
let uncles = match with {
EachBlockWith::Uncle | EachBlockWith::UncleAndTransaction => {
let mut uncles = RlpStream::new_list(1);
let mut uncle_header = BlockHeader::new();
uncle_header.difficulty = From::from(n);
uncle_header.parent_hash = self.last_hash.read().unwrap().clone();
uncle_header.number = n as BlockNumber;
uncles.append(&uncle_header);
header.uncles_hash = uncles.as_raw().sha3();
uncles
},
_ => RlpStream::new_list(0)
};
let txs = match with {
EachBlockWith::Transaction | EachBlockWith::UncleAndTransaction => {
let mut txs = RlpStream::new_list(1);
let keypair = KeyPair::create().unwrap();
// Update nonces value
self.nonces.write().unwrap().insert(keypair.address(), U256::one());
let tx = Transaction {
action: Action::Create,
value: U256::from(100),
data: "3331600055".from_hex().unwrap(),
gas: U256::from(100_000),
gas_price: U256::one(),
nonce: U256::zero()
};
let signed_tx = tx.sign(&keypair.secret());
txs.append(&signed_tx);
txs.out()
},
_ => rlp::EMPTY_LIST_RLP.to_vec()
};
let mut rlp = RlpStream::new_list(3);
rlp.append(&header);
rlp.append_raw(&txs, 1);
rlp.append_raw(uncles.as_raw(), 1);
self.import_block(rlp.as_raw().to_vec()).unwrap();
}
}
/// Make a bad block by setting invalid extra data.
pub fn corrupt_block(&mut self, n: BlockNumber) {
let hash = self.block_hash(BlockID::Number(n)).unwrap();
let mut header: BlockHeader = decode(&self.block_header(BlockID::Number(n)).unwrap());
header.extra_data = b"This extra data is way too long to be considered valid".to_vec();
let mut rlp = RlpStream::new_list(3);
rlp.append(&header);
rlp.append_raw(&rlp::NULL_RLP, 1);
rlp.append_raw(&rlp::NULL_RLP, 1);
self.blocks.write().unwrap().insert(hash, rlp.out());
}
/// Make a bad block by setting invalid parent hash.
pub fn corrupt_block_parent(&mut self, n: BlockNumber) {
let hash = self.block_hash(BlockID::Number(n)).unwrap();
let mut header: BlockHeader = decode(&self.block_header(BlockID::Number(n)).unwrap());
header.parent_hash = H256::from(42);
let mut rlp = RlpStream::new_list(3);
rlp.append(&header);
rlp.append_raw(&rlp::NULL_RLP, 1);
rlp.append_raw(&rlp::NULL_RLP, 1);
self.blocks.write().unwrap().insert(hash, rlp.out());
}
/// TODO:
pub fn block_hash_delta_minus(&mut self, delta: usize) -> H256 {
let blocks_read = self.numbers.read().unwrap();
let index = blocks_read.len() - delta;
blocks_read[&index].clone()
}
fn block_hash(&self, id: BlockID) -> Option<H256> {
match id {
BlockID::Hash(hash) => Some(hash),
BlockID::Number(n) => self.numbers.read().unwrap().get(&(n as usize)).cloned(),
BlockID::Earliest => self.numbers.read().unwrap().get(&0).cloned(),
BlockID::Latest | BlockID::Pending => self.numbers.read().unwrap().get(&(self.numbers.read().unwrap().len() - 1)).cloned()
}
}
}
impl MiningBlockChainClient for TestBlockChainClient {
fn prepare_open_block(&self, _author: Address, _gas_range_target: (U256, U256), _extra_data: Bytes) -> OpenBlock {
unimplemented!();
}
fn vm_factory(&self) -> &EvmFactory {
unimplemented!();
}
fn import_sealed_block(&self, _block: SealedBlock) -> ImportResult {
unimplemented!();
}
}
impl BlockChainClient for TestBlockChainClient {
fn call(&self, _t: &SignedTransaction, _analytics: CallAnalytics) -> Result<Executed, ExecutionError> {
Ok(self.execution_result.read().unwrap().clone().unwrap())
}
fn block_total_difficulty(&self, _id: BlockID) -> Option<U256> {
Some(U256::zero())
}
fn block_hash(&self, id: BlockID) -> Option<H256> {
Self::block_hash(self, id)
}
fn nonce(&self, address: &Address, id: BlockID) -> Option<U256> {
match id {
BlockID::Latest => Some(self.nonces.read().unwrap().get(address).cloned().unwrap_or_else(U256::zero)),
_ => None,
}
}
fn latest_nonce(&self, address: &Address) -> U256 {
self.nonce(address, BlockID::Latest).unwrap()
}
fn code(&self, address: &Address) -> Option<Bytes> {
self.code.read().unwrap().get(address).cloned()
}
fn balance(&self, address: &Address, id: BlockID) -> Option<U256> {
if let BlockID::Latest = id {
Some(self.balances.read().unwrap().get(address).cloned().unwrap_or_else(U256::zero))
} else {
None
}
}
fn latest_balance(&self, address: &Address) -> U256 {
self.balance(address, BlockID::Latest).unwrap()
}
fn storage_at(&self, address: &Address, position: &H256, id: BlockID) -> Option<H256> {
if let BlockID::Latest = id {
Some(self.storage.read().unwrap().get(&(address.clone(), position.clone())).cloned().unwrap_or_else(H256::new))
} else {
None
}
}
fn transaction(&self, _id: TransactionID) -> Option<LocalizedTransaction> {
unimplemented!();
}
fn uncle(&self, _id: UncleID) -> Option<BlockHeader> {
unimplemented!();
}
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt> {
self.receipts.read().unwrap().get(&id).cloned()
}
fn blocks_with_bloom(&self, _bloom: &H2048, _from_block: BlockID, _to_block: BlockID) -> Option<Vec<BlockNumber>> {
unimplemented!();
}
fn logs(&self, _filter: Filter) -> Vec<LocalizedLogEntry> {
unimplemented!();
}
fn last_hashes(&self) -> LastHashes {
unimplemented!();
}
fn block_header(&self, id: BlockID) -> Option<Bytes> {
self.block_hash(id).and_then(|hash| self.blocks.read().unwrap().get(&hash).map(|r| Rlp::new(r).at(0).as_raw().to_vec()))
}
fn block_body(&self, id: BlockID) -> Option<Bytes> {
self.block_hash(id).and_then(|hash| self.blocks.read().unwrap().get(&hash).map(|r| {
let mut stream = RlpStream::new_list(2);
stream.append_raw(Rlp::new(&r).at(1).as_raw(), 1);
stream.append_raw(Rlp::new(&r).at(2).as_raw(), 1);
stream.out()
}))
}
fn block(&self, id: BlockID) -> Option<Bytes> {
self.block_hash(id).and_then(|hash| self.blocks.read().unwrap().get(&hash).cloned())
}
fn block_status(&self, id: BlockID) -> BlockStatus {
match id {
BlockID::Number(number) if (number as usize) < self.blocks.read().unwrap().len() => BlockStatus::InChain,
BlockID::Hash(ref hash) if self.blocks.read().unwrap().get(hash).is_some() => BlockStatus::InChain,
_ => BlockStatus::Unknown
}
}
// works only if blocks are one after another 1 -> 2 -> 3
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute> {
Some(TreeRoute {
ancestor: H256::new(),
index: 0,
blocks: {
let numbers_read = self.numbers.read().unwrap();
let mut adding = false;
let mut blocks = Vec::new();
for (_, hash) in numbers_read.iter().sort_by(|tuple1, tuple2| tuple1.0.cmp(tuple2.0)) {
if hash == to {
if adding {
blocks.push(hash.clone());
}
adding = false;
break;
}
if hash == from {
adding = true;
}
if adding {
blocks.push(hash.clone());
}
}
if adding { Vec::new() } else { blocks }
}
})
}
fn find_uncles(&self, _hash: &H256) -> Option<Vec<H256>> {
None
}
// TODO: returns just hashes instead of node state rlp(?)
fn state_data(&self, hash: &H256) -> Option<Bytes> {
// starts with 'f' ?
if *hash > H256::from("f000000000000000000000000000000000000000000000000000000000000000") {
let mut rlp = RlpStream::new();
rlp.append(&hash.clone());
return Some(rlp.out());
}
None
}
fn block_receipts(&self, hash: &H256) -> Option<Bytes> {
// starts with 'f' ?
if *hash > H256::from("f000000000000000000000000000000000000000000000000000000000000000") {
let receipt = BlockReceipts::new(vec![Receipt::new(
H256::zero(),
U256::zero(),
vec![])]);
let mut rlp = RlpStream::new();
rlp.append(&receipt);
return Some(rlp.out());
}
None
}
fn import_block(&self, b: Bytes) -> ImportResult {
let header = Rlp::new(&b).val_at::<BlockHeader>(0);
let h = header.hash();
let number: usize = header.number as usize;
if number > self.blocks.read().unwrap().len() {
panic!("Unexpected block number. Expected {}, got {}", self.blocks.read().unwrap().len(), number);
}
if number > 0 {
match self.blocks.read().unwrap().get(&header.parent_hash) {
Some(parent) => {
let parent = Rlp::new(parent).val_at::<BlockHeader>(0);
if parent.number != (header.number - 1) {
panic!("Unexpected block parent");
}
},
None => {
panic!("Unknown block parent {:?} for block {}", header.parent_hash, number);
}
}
}
let len = self.numbers.read().unwrap().len();
if number == len {
{
let mut difficulty = self.difficulty.write().unwrap();
*difficulty.deref_mut() = *difficulty.deref() + header.difficulty;
}
mem::replace(self.last_hash.write().unwrap().deref_mut(), h.clone());
self.blocks.write().unwrap().insert(h.clone(), b);
self.numbers.write().unwrap().insert(number, h.clone());
let mut parent_hash = header.parent_hash;
if number > 0 {
let mut n = number - 1;
while n > 0 && self.numbers.read().unwrap()[&n] != parent_hash {
*self.numbers.write().unwrap().get_mut(&n).unwrap() = parent_hash.clone();
n -= 1;
parent_hash = Rlp::new(&self.blocks.read().unwrap()[&parent_hash]).val_at::<BlockHeader>(0).parent_hash;
}
}
}
else {
self.blocks.write().unwrap().insert(h.clone(), b.to_vec());
}
Ok(h)
}
fn queue_info(&self) -> BlockQueueInfo {
BlockQueueInfo {
verified_queue_size: self.queue_size.load(AtomicOrder::Relaxed),
unverified_queue_size: 0,
verifying_queue_size: 0,
max_queue_size: 0,
max_mem_use: 0,
mem_used: 0,
}
}
fn clear_queue(&self) {
}
fn chain_info(&self) -> BlockChainInfo {
BlockChainInfo {
total_difficulty: *self.difficulty.read().unwrap(),
pending_total_difficulty: *self.difficulty.read().unwrap(),
genesis_hash: self.genesis_hash.clone(),
best_block_hash: self.last_hash.read().unwrap().clone(),
best_block_number: self.blocks.read().unwrap().len() as BlockNumber - 1,
}
}
fn filter_traces(&self, _filter: TraceFilter) -> Option<Vec<LocalizedTrace>> {
unimplemented!();
}
fn trace(&self, _trace: TraceId) -> Option<LocalizedTrace> {
unimplemented!();
}
fn transaction_traces(&self, _trace: TransactionID) -> Option<Vec<LocalizedTrace>> {
unimplemented!();
}
fn block_traces(&self, _trace: BlockID) -> Option<Vec<LocalizedTrace>> {
unimplemented!();
}
fn queue_transactions(&self, transactions: Vec<Bytes>) {
// import right here
let txs = transactions.into_iter().filter_map(|bytes| UntrustedRlp::new(&bytes).as_val().ok()).collect();
self.miner.import_external_transactions(self, txs);
}
fn pending_transactions(&self) -> Vec<SignedTransaction> {
self.miner.pending_transactions()
}
}

Some files were not shown because too many files have changed in this diff Show More