Commit Graph

1556 Commits

Author SHA1 Message Date
David
9584faee55 Upgrade to parity-crypto 0.4 (#10650)
* [whisper] Move needed aes_gcm crypto in-crate

In the latest `parity-crypto` release (upcoming 0.4), the aes GCM features were removed (done to remove the dependency on `ring`).
This PR adds the bare minimum crypto needed for Whisper directly to the crate itself and as those were the only features needed from `parity-crypto`, removes the dependency on that crate altogether.

* Upgrade to parity-crypto 0.4

Reverts using NonZeroU32 (introduced [here](b347599cf7)).

* Check for 0 in `args.arg_keys_iteration`

* Use beta.4

* parity-crypto 0.4.0 is released
2019-05-28 07:50:10 +02:00
Niklas Adolfsson
87699f8de0
fix(compilation warnings) (#10649) 2019-05-13 15:10:25 +02:00
Vladyslav Lupashevskyi
8132d38b50 Node table limiting and cache for node filter (#10288)
* Fix nasty typo in NodeTable::update (add ;)

* Add limiting for NodeTable

* Add cache for NodeFilter

* Use expect instead of unwrap

* Move node in ordered_ids if it exists there in note_failure and note_success + fix expect msg

* Add comment

* Improve code style

* DRY in note_failure and note_success

* Fix nodes ordering

* Simplify match expression

* Add tests for get_index_to_insert

* Remove get_mut method from NodeTable, Add get method to NodeTable

* Fix table_last_contact_order for macos failing because of lost nanosecond precision
2019-04-05 13:30:31 +02:00
Talha Cross
002496603c version: bump master to 2.6 (#10560) 2019-04-02 10:41:47 +02:00
5chdn
aa8487c1d0
ethcore: add clique engine (#9981)
* fix broken sync

* correct seal fields

* ethcore: fix comment

* parity: remove duplicate params

* clique: fix whitespaces

* ethcore: fix goerli chain spec

* refactor signer_snapshot into pending/finalized state

* move close_block_extra_data after seal is applied

* refactor most of the logic into the signer_snapshot

* clique: refactor locking logic out of the consensus engine interface

* Fix jsonspec and add an unittest

* Replace space with tabs

* Unbroke sync

* Fix broken sync

* 1/2 state tracking without votes

* 2/2 implement vote tracking

* ci: use travis for goerli

* ci: setup a clique network

* ci: sync a görli node

* add clique deploy script

* ci: fix paths in clique deploy script

* ci: use docker compose

* ci: fix travis job names

* ci: fix build deps

* ci: massively reduce tests

* Revert "ci: massively reduce tests"

This reverts commit 6369f0b069ed2607a7e9f2e1d85489bacdc43384.

* ci: run cargo test directly

* ci: separate build and test stages

* ci: cache rust installation

* ci: simplify ci stages

* ci: make clique deploy script executable

* ci: shutdown goerli sync after 20min

* ci: remove slow sync stage

* ci: use timeout to finish jobs

* ci: fix build path

* ci: use absolute paths to end this confusion

* ci: add geth and parity to path

* ci: be more verbose

* ci: allow for more relaxed caching timeout

* ci: update repositories for custom ppa

* ci: fix typo in file name

* ci: fix docker compose file

* ci: add ethkey to docker

* ci: make sure deploy script is up to date with upstream

* ci: stop docker container after certain time

* ci: force superuser to update permissions on docker files

* ci: reduce run time of script to ~30 min

* ci: remove duplicate caching in travis

* remove trace statements

* clique: add more validation involving the recent signer list

* ethcore: enable constantinople for rinkeby

* ethcore: fix whitespaces in rinkeby spec

* ethcore: reformat goerli.json

* Revert "ci: remove duplicate caching in travis"

This reverts commit a562838d3d194d37f9871dcbe00b783637978f89.

* tmp commit

* another tmp commit

* it builds!

* add sealing capabilities

* add seal_header hook to allow separation of block seal/importing code paths

* clique: remove populate_from_parent.

* add panic

* make turn delay random

* initialize OpenBlock properly in 'enact'

* misc: remove duplicate lines

* misc: fix license headers

* misc: convert spaces to tabs

* misc: fix tabs

* Update Cargo.toml

* Update Cargo.toml

* Update Cargo.toml

* clique: ensure validator restores state before trying to seal

* clique: make 'state' return an Error.  Make some error messages more clear

* Fix compile error after rebase & toolchain upgrade

* fix a bunch of import warnings

* Refactor code

* Fix permissions

* Refactoring syncing

* Implement full validator checks

* Refactor util functions to seperate file

* mining 1

* ethcore: add chainspec for kotti

* ethcore: rename pre-goerli configs

* ethcore: load kotti chain spec

* cli: add kotti to params

* Implement working local sealing

* making sealing & syncing work together

* Relax timestamp checking

* ethcore: prepare for the real goerli to launch

* Implement NOTURN wiggle properly & cleanupnup warnings

* Implement vote casting

* Update docs & skip signing if no signer

* Optimize step-service interval

* Record state on local sealed block

* Fix script filemode

* Cleaning up codebase

* restore enact trace logging

* Delete clique.sh and move sync.sh

* remove travis.yml

* Remove dead code

* Cleanup compile warning

* address review comments

* adding more comments and removing unwrap()

* ci: remove sync script

* Address review comments

* fix compile error

* adding better debugging for timing

* Implement an dedicated thread for sealing timing

* fix(add helper for timestamp overflows) (#10330)

* fix(add helper timestamp overflows)

* fix(simplify code)

* fix(make helper private)

* snap: official image / test (#10168)

* official image / test

* fix / test

* bit more necromancy

* fix paths

* add source bin/df /test

* add source bin/df /test2

* something w paths /test

* something w paths /test

* add source-type /test

* show paths /test

* copy plugin /test

* plugin -> nil

* install rhash

* no questions while installing rhash

* publish snap only for release

* fix(docker): fix not receives SIGINT (#10059)

* fix(docker): fix not receives SIGINT

* fix: update with reviews

* update with review

* update

* update

* Don't add discovery initiators to the node table (#10305)

* Don't add discovery initiators to the node table

* Use enums for tracking state of the nodes in discovery

* Dont try to ping ourselves

* Fix minor nits

* Update timeouts when observing an outdated node

* Extracted update_bucket_record from update_node

* Fixed typo

* Fix two final nits from @todr

* change docker image based on debian instead of ubuntu due to the chan… (#10336)

* change docker image based on debian instead of ubuntu due to the changes of the build container

* role back docker build image and docker deploy image to ubuntu:xenial based (#10338)

* Bundle protocol and packet_id together in chain sync (#10315)

Define a new `enum` where devp2p subprotocol packet ids (currently eth and par) are defined. Additionally provide functionality to query id value and protocol of a given id object.

* snap: prefix version and populate candidate channel (#10343)

* snap: populate candidate releases with beta snaps to avoid stale channel

* snap: prefix version with v*

* addressing review comments

* engine: fix copyright header

* scripts: restore permissions on sign command

* ethcore: enforce tabs

* ethcore: enforce tabs

* ethcore: enforce tabs

* addressing comments

* addressing comments

* addressing more comments

* addressing more comments

* addressing more comments

* addressing more comments

* addressing more comments

* json-spec: fix clique epoch to non-zero u64

* ci: enable travis for parity goerli

* ci: don't separate build and test step

* ci: don't run c++ tests on travis

* ci: simplify cargo test to squeeze into travis timeout

* ci: don't run tests on travis at all

* style(fixes)

* fix(add tests)

* fix(recent_signer bug)

* fix(complete all tests)

* fix(nits)

* fix(simplify asserts)

* fix(cliqueState): simplify code

* fix(nits)

* docs(comments what's need to fixed)

* fix(revert unintended changes)

* fix(tests)

* fix(logs): voting logs

* fix(readability + more logs)

* fix(sync)

* docs(add missing licens header)

* fix(log): info! -> trace!

* docs(fix nits) + fix(remove assert)

* perf(use counter instead of vec)

* fix(remove needless block in match)

* fix(faulty comment)

* grumbles(docs for tests)

* fix(nits)

* fix(revert_vote): only remove vote when votes == 0

* fix(vote counter): checked arithmetics

* fix(simplify tests)

* fix(nits)

* fix(clique): err types

* fix(clique utils): make use of errors

* fix(cleanup nits)

* fix(clique sealing): don't read state no signer

* fix(replace Vec<Signers> with BTreeSet<Signers>)

* fix(tests): BTreeSet and more generic helpers

* fix(nits)

* fix(ethcore_block_seal): remove needless `Box`

* fix(faulty log): info -> trace

* fix(checked SystemTime): prevent SystemTime panics

* style(chain cfg): space after `:`

* style(fn enact): fix whitespace

* docs(clique): StepService

* docs(nit): fix faulty comment

* docs(fix typo)

* style(fix bad indentation)

* fix(bad regex match)

* grumble(on_seal_block): make `&mut` to avoid clone

* docs(on_seal_block): fix faulty documentation

* Delete .travis.yml

* docs: remove eth hf references in spec

* Update client.rs

* fix(nits)

* fix(clique step): `RwLock` -> `AtomicBool`

* fix(clique): use `Duration::as_millis`

* Clean up some Clique documentation

Co-authored-by: soc1c <soc1c@users.noreply.github.com>
Co-authored-by: HCastano <HCastano@users.noreply.github.com>
Co-authored-by: niklasad1 <niklasad1@users.noreply.github.com>
Co-authored-by: jwasinger <jwasinger@users.noreply.github.com>
Co-authored-by: ChainSafe <ChainSafe@users.noreply.github.com>
Co-authored-by: thefallentree <thefallentree@users.noreply.github.com>
Co-authored-by: 5chdn <5chdn@users.noreply.github.com>
2019-03-27 14:13:24 +01:00
Niklas Adolfsson
9519493e32 fix(time-utils): add missing license (#10497) 2019-03-20 16:01:38 +01:00
Niklas Adolfsson
037fd1b309 fix(extract timestamp_checked_add as lib) (#10383)
* fix(extract `timestamp_checked_add` as lib)

* fix(whisper types): remove unused `EmptyTopics`

* fix(time-lib): feature-flag to use time-lib or std

This commit adds conditional compilation checks that falls back to `our time-lib` when
`time_checked_add` is not available in the standard library

Note, `time_checked_add` covers both `checked_add` and `checked_sub`

* fix(grumble): use cfg_attr to define rustc feature
2019-03-19 23:17:05 +01:00
Andrew Jones
97cb010df8 Silence Error::cause deprecations (#10438) 2019-03-02 13:18:18 +01:00
Hernando Castano
ed18c7b54c Use correct name for documentation field in Cargo.toml (#10440) 2019-03-01 16:23:40 +00:00
Marek Kotewicz
3d0ce10fa6 panic_hook module uses eprintln instead of raw stderr interface (#10426) 2019-02-27 09:48:40 +00:00
5chdn
0815cc3b83 version: bump nightly to 2.5 (#10392)
* version: bump nightly to 2.5

* revert(rand 0.3.22)
2019-02-21 20:03:34 +01:00
cheme
6bb106a784 Update to latest mem-db, hash-db and trie-db. (#10314)
* Switch to 'trie' crates, there is an unpublished deps to staging
parity-common triehash still.

* Use crates.io dependency.

* indentation

* Update util/journaldb/src/traits.rs

indentation

Co-Authored-By: cheme <emericchevalier.pro@gmail.com>

* Update ethcore/src/snapshot/tests/state.rs

Co-Authored-By: cheme <emericchevalier.pro@gmail.com>
2019-02-20 21:09:34 +03:00
Hernando Castano
af7dc3676b
Add fields to memzero's Cargo.toml (#10362)
* Add fields to Cargo.toml before publishing to crates.io

* Change license from MIT to GPL-3.0

* Add docs page
2019-02-15 12:32:33 +01:00
Kirill Pimenov
5be0163cde Don't add discovery initiators to the node table (#10305)
* Don't add discovery initiators to the node table

* Use enums for tracking state of the nodes in discovery

* Dont try to ping ourselves

* Fix minor nits

* Update timeouts when observing an outdated node

* Extracted update_bucket_record from update_node

* Fixed typo

* Fix two final nits from @todr
2019-02-12 16:57:53 +01:00
elferdo
b7e8621846 Increase number of requested block bodies in chain sync (#10247)
* Increase the number of block bodies requested during Sync.

* Increase the number of block bodies requested during Sync.

* Check if our peer is an older parity client with the bug
  of not handling large requests properly

* Add a ClientVersion struct and a ClientCapabilites trait

* Make ClientVersion its own module

* Refactor and extend use of ClientVersion

* Replace strings with ClientVersion in PeerInfo

* Group further functionality in ClientCapabilities

* Move parity client version data from tuple to its own struct.

* Implement accessor methods for ParityClientData and remove them
from ClientVersion.

* Minor fixes

* Make functions specific to parity return types specific to parity.

* Test for shorter ID strings

* Fix formatting and remove unneeded dependencies.

* Roll back Cargo.lock

* Commit last Cargo.lock

* Convert from string to ClientVersion

* * When checking if peer accepts service transactions just check
  if it's parity, remove version check.

* Remove dependency on semver in ethcore-sync

* Remove unnecessary String instantiation

* Rename peer_info to peer_version

* Update RPC test helpers

* Simplify From<String>

* Parse static version string only once

* Update RPC tests to new ClientVersion struct

* Document public members

* More robust parsing of ID string

* Minor changes.

* Update version in which large block bodies requests appear.

* Update ethcore/sync/src/block_sync.rs

Co-Authored-By: elferdo <elferdo@gmail.com>

* Update util/network/src/client_version.rs

Co-Authored-By: elferdo <elferdo@gmail.com>

* Update util/network/src/client_version.rs

Co-Authored-By: elferdo <elferdo@gmail.com>

* Update tests.

* Minor fixes.
2019-02-07 15:27:09 +01:00
Andronik Ordian
a3e39c9858 update ring to 0.14 (#10262)
* cargo upgrade hyper-rustls --all

* cargo upgrade parity-crypto --all

* update Cargo.lock

* propagate NonZeroU32

* use NonZeroU32::new_unchecked for crypto::KEY_ITERATIONS

* update Cargo.lock

* replace unsafe code with lazy_static
2019-02-06 17:53:34 +01:00
Sho Sawada
c96d8a742b Update copyright year to 2019. (#10181)
* Update copyright year to 2019.

Have a great year.

* add `(UK)`

* 2018-2019
2019-01-23 09:26:36 +00:00
Niklas Adolfsson
4b11d79829
fix(ManageNetwork): replace Range with RangeInclusive (#10209)
* fix(ManageNetwork): replace Range -> RangeIncls

Fixes `TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)`

* fix(tests)

* fix(grumbles): off-by-one error in debug_asserts

* RangeInclusive::end() is inclusive which means that if start and end is equal the `debug_assert(range.end() >
range.start()` will fail which is shouldn't
2019-01-22 09:51:40 +01:00
Afri Schoedon
a9a278a6e1
Enable St-Peters-Fork ("Constantinople Fix") (#10223)
* ethcore: disable eip-1283 on kovan block 10255201

* ethcore: disable eip-1283 on ropsten block 4939394

* ethcore: enable st-peters-fork on mainnet block 7280000

* ethcore: fix kovan chain spec

* version: update fork blocks

* ethcore: disable eip-1283 on sokol block 7026400
2019-01-21 22:55:44 +01:00
Nicolas Gotchac
1df6361753 Run all igd methods in its own thread (#10195) 2019-01-16 16:35:28 +01:00
Afri Schoedon
a6c6c7c070
pull constantinople on ethereum network (#10189)
* ethcore: pull constantinople on ethereum network

* version: mark update as critical

* ethcore: remove constantinople alltogether from chain spec

* version: revert fork block for ethereum
2019-01-15 21:50:41 +01:00
Afri Schoedon
53c408f549
version: bump fork blocks for kovan and foundation (#10186) 2019-01-15 15:48:50 +01:00
Afri Schoedon
d356c6640d
version: bump nightly to 2.4 (#10165)
* version: bump nightly to 2.4

* revert rand downgrade
2019-01-14 17:29:17 +01:00
Nicolas Gotchac
3687df8da2 Fix _cannot recursively call into Core_ issue (#10144)
* Change igd to github:maufl/rust-igd

* Run `igd::search_gateway_from_timeout` from own thread
2019-01-11 17:59:05 +01:00
Kirill Pimenov
83f706186f Ping nodes from discovery (#10167) 2019-01-10 20:43:16 +01:00
Tomasz Drwięga
ab22d5e278 Replace ethcore-logger with env-logger. (#10102)
* Replace ethcore-logger with env-logger.

* Fix logger initialization in WASM tests.

* uncomment logger initialization in secret store

* Don't use ethcore-logger in whisper.

* Move ethcore-logger within parity dir.

* Uncomment rest from secret-store.

* Use `let _ =` in private_contract for consistency

* `ok()` to `let _ =` fix in service

* Use `let _ = ` for state_db
2019-01-08 15:07:20 +01:00
cheme
589083ad7a Blooms file iterator empty on out of range position. (#10145) 2019-01-07 17:54:06 +01:00
Afri Schoedon
7c335e8764
misc: bump license header to 2019 (#10135)
* misc: bump license header to 2019

* misc: remove_duplicate_empty_lines.sh

* misc: run license header script

* commit cargo lock
2019-01-07 11:33:07 +01:00
Nicolas Gotchac
e435407080 Don't try to send oversized packets (#10042)
* Don't construct oversized packets

* Add test for payload limit

* [eth-sync] Fix wrongly computed data sizes

* Replace `MAX_RECEIPTS_TO_SEND` with overall softlimit
2019-01-04 19:58:21 +01:00
Seun LanLege
912e5599d9 Move EIP-712 crate back to parity-ethereum (#10106)
* move eip-712 crate back to parity-ethereum

* changed license, updated documentation url
2018-12-28 17:36:55 +08:00
Tomasz Drwięga
ff0095ac5e Move a bunch of stuff around (#10101)
* Move devtools.

* Merge stop_guard & rename memzero

* Move price-info to miner.

* Group account management

* Clean up workspace members.

* Move local store closer to miner.

* Move clib examples.

* Move registrar and hash-fetch

* Move rpc_cli/rpc_client

* Move stratum closer to miner.

* Fix naming convention of crates.

* Update Cpp examples path.

* Fix paths for clib-example.

* Fix removing build.
2018-12-28 17:33:49 +08:00
mattrutherford
60718225ac
Implement len caching for parking_lot RwLock (#10032)
- Refactor (and rename crate) and implement RwLock len cache.

- improve docs

- update ethcore verification queue to new version

- Implement Default, From,  also derive Debug

- update: parking_lot to 0.7
2018-12-13 18:07:56 +00:00
Pierre Krieger
1a2fc03083 Update parking_lot to 0.7 (#10050) 2018-12-11 17:22:55 +01:00
mattrutherford
ec886ddefb
LenCachingMutex (#9988)
New util LenCachingMutex can be used in place of a Mutex, when working
with collections, or other types with a len() method. When
the Guard is dropped, the value returned from len() is stored
into an AtomicUsize and can be queried using load_len() without
needing to lock the Mutex. Implementations for ```Vec``` and
```VecDeque```.

Now used in [Verification](4ded4181a6/ethcore/src/verification/queue/mod.rs (L196)) so that calls to ```VerificationQueue.queue_info()```
no longer require locks.
2018-12-04 14:30:52 +00:00
Anton Gavrilov
869fa399b1 Add tokio runtime to ethcore io worker (#9979)
* Add tokio runtime to ethcore io worker

* Reworked with block_on_all
2018-12-03 22:35:46 +08:00
Tomasz Drwięga
0b5bbf6048 Improve block and transaction propagation (#9954)
* Refactor sync to add priority tasks.

* Send priority tasks notifications.

* Propagate blocks, optimize transactions.

* Implement transaction propagation. Use sync_channel.

* Tone down info.

* Prevent deadlock by not waiting forever for sync lock.

* Fix lock order.

* Don't use sync_channel to prevent deadlocks.

* Fix tests.
2018-11-28 11:30:05 +01:00
Nick Sanders
c880716f16 Remove secret_store runtimes. (#9888)
* Remove the independent runtimes from `KeyServerHttpListener` and
  `KeyServerCore` and instead require a `parity_runtime::Executor`
  to be passed upon creation of each.

* Remove the `threads` parameter from both `ClusterConfiguration` structs.

* Implement the `future::Executor` trait for `parity_runtime::Executor`.

* Update tests.
  - Update the `loop_until` function to instead use a oneshot to signal
    completion.
  - Modify the `make_key_servers` function to create and return a runtime.
2018-11-26 01:36:43 +08:00
Niklas Adolfsson
1fdfa1e6c6 chore(eip712): remove unused failure-derive (#9958) 2018-11-23 16:42:44 +00:00
Seun LanLege
a8617e2862
EIP 191 (#9701)
* added sign_191 rpc method

* fixed hash_structured_data return type

* added ConfirmationPayload::SignMessage for non-prefixed signatures, added tests for sign191

* renamed WithValidator -> PresignedTransaction

* rename applicationData to data in test

* adds docs for EIP191Version, renamed SignRequest to EIP191SignRequest
2018-11-14 09:02:40 +01:00
Afri Schoedon
3694b10e22 version: bump nightly to 2.3.0 (#9819)
* version: bump nightly to 2.3.0

* Revert Cargo.lock
2018-10-31 12:38:47 +00:00
Seun LanLege
61c1646b43 EIP-712 implementation (#9631)
* EIP-712 impl

* added more tests

* removed size parsing unwrap

* corrected TYPE_REGEX to disallow zero sized fixed length arrays, replaced LinkedHashSet with IndexSet, added API spec to docs, fixed Type::Byte encoding branch

* use Option<u64> instead of u64 for Type::Array::Length

* replace `.iter()` with  `.values()`

Co-Authored-By: seunlanlege <seunlanlege@gmail.com>

* tabify eip712.rs

* use proper comments for docs

* Cargo.lock: revert unrelated changes

* tabify encode.rs
2018-10-31 00:12:42 +03:00
Nick Sanders
68ca8df22f Replace tokio_core with tokio (ring -> 0.13) (#9657)
* Replace `tokio_core` with `tokio`.

* Remove `tokio-core` and replace with `tokio` in

    - `ethcore/stratum`

    - `secret_store`

    - `util/fetch`

    - `util/reactor`

* Bump hyper to 0.12 in

    - `miner`

    - `util/fake-fetch`

    - `util/fetch`

    - `secret_store`

* Bump `jsonrpc-***` to 0.9 in

    - `parity`

    - `ethcore/stratum`

    - `ipfs`

    - `rpc`

    - `rpc_client`

    - `whisper`

* Bump `ring` to 0.13

* Use a more graceful shutdown process in `secret_store` tests.

* Convert some mutexes to rwlocks in `secret_store`.

* Consolidate Tokio Runtime use, remove `CpuPool`.

* Rename and move the `tokio_reactor` crate (`util/reactor`) to
  `tokio_runtime` (`util/runtime`).

* Rename `EventLoop` to `Runtime`.

    - Rename `EventLoop::spawn` to `Runtime::with_default_thread_count`.

    - Add the `Runtime::with_thread_count` method.

    - Rename `Remote` to `Executor`.

* Remove uses of `CpuPool` and spawn all tasks via the `Runtime` executor
  instead.

* Other changes related to `CpuPool` removal:

    - Remove `Reservations::with_pool`. `::new` now takes an `Executor` as an argument.

    - Remove `SenderReservations::with_pool`. `::new` now takes an `Executor` as an argument.
2018-10-22 09:40:50 +02:00
Afri Schoedon
1f103ab7f1
ethcore: bump ropsten forkblock checkpoint (#9775) 2018-10-18 15:54:42 +02:00
Marek Kotewicz
581cd97ba1
remove unused expired value from Handshake (#9732) 2018-10-10 23:17:17 +02:00
David
c313039526 Update a few parity-common dependencies (#9663)
* Update a few parity-common dependencies

* cleanup

* cleanup

* revert update of ethereum/tests

* better reporting of network rlp errors

* Use rlp 0.3.0-beta.1

* fix util function get_dummy_blocks

* Already a Vec

* encode_list returns vec already

* Address grumble

* No need for betas

* Fix double spaces
2018-10-09 22:07:25 +02:00
Marek Kotewicz
ebaa43fa4c ethcore-io retries failed work steal (#9651)
* ethcore-io uses newer version of crossbeam && retries failed work steal

* ethcore-io non-mio service uses newer crossbeam
2018-09-29 21:25:16 +01:00
Niklas Adolfsson
47848769ff
refactor(fetch) : light use only one DNS thread (#9647)
* refactor(fetch) : light use only one `DNS` thread

* grumbles(fetch) : pass number of threads directly
2018-09-28 14:26:38 +01:00
Andronik Ordian
c4af7464e5 fix(network): don't disconnect reserved peers (#9608)
The priority of && and || was borked.
2018-09-25 10:59:21 +01:00
Marek Kotewicz
5a1dc3eb8a
fix failing node-table tests on mac os, closes #9632 (#9633) 2018-09-24 21:51:16 +01:00
Nicolas Gotchac
753fd4bda3 Improve P2P discovery (#9526)
* Add `target` to Rust traces

* network-devp2p: Don't remove discovery peer in main sync

* network-p2p: Refresh discovery more often

* Update Peer discovery protocol

* Run discovery more often when not enough nodes connected

* Start the first discovery early

* Update fast discovery rate

* Fix tests

* Fix `ping` tests

* Fixing remote Node address ; adding PingPong round

* Fix tests: update new +1 PingPong round

* Increase slow Discovery rate
Check in flight FindNode before pings

* Add `deprecated` to deprecated_echo_hash

* Refactor `discovery_round` branching
2018-09-14 22:18:03 +02:00
Marek Kotewicz
0c3b70f2fb update ethabi-derive, serde, serde_json, serde_derive, syn && quote (#9553) 2018-09-14 03:37:28 +08:00
Afri Schoedon
69667317c1
Bump master to 2.2.0 (#9517)
* parity-version: bump master to 2.2.0

* ci: update branch version references

* docker: release master to latest

* deps: bump fs-swap to 0.2.4
2018-09-12 11:32:05 +02:00
cheme
98220442b4 Update patricia trie to 0.2.2 (#9525)
* Update patricia trie to 0.2.2 crates. Default dependencies on minor
version only.

* Putting back ethereum tests to the right commit
2018-09-11 16:20:26 +02:00
Nicolas Gotchac
baf5be09dc Fix Snapshot restoration failure on Windows (#9491)
* Close Blooms DB files before DB restoration

* PR Grumbles I

* PR Grumble

* Grumble
2018-09-10 17:21:57 +02:00
Wei Tang
44531e3009
light: give free credits for reserved peers (#9448)
* light: give free credits for reserved peers

* Fix ethcore-light tests

* Test free_flow_params
2018-09-10 19:45:49 +08:00
Afri Schoedon
2177a0179e
parity: print correct keys path on startup (#9501) 2018-09-09 00:43:24 +02:00
Tomasz Drwięga
61bd47ccc1 Bad blocks RPC + reporting (#9433)
* Bad blocks RPC.

* Return bad blocks via RPC.

* Fix test.

* More verbose bad block message.

* Expose via CLI.

* Remove stray whitespace.

* Remove stray newline.

* Fix tests.
2018-09-08 04:04:28 +02:00
David
72fd1fa58d
Fetch parity-common crates from crates.io (#9410)
* Fetch `parity-common` crates from crates.io

* Add doc tests from `patricia-trie` to `patricia-trie-ethereum`
Fix/update a few deps

* [ethkey] upgrade ethereum-types

* [whisper] update deps

* [network] deps

* [network-devp2p] deps

* [journaldb] deps

* [fastmap] deps

* [miner] deps and test fixes

* [machine] deps

* [json] deps

* [hw] deps

* [ethash] deps

* [registrar] deps

* Update a few more dependencies with new ethabi-*

* [updater] Update deps

* deps

* [ethcore] Update deps

* Use new parity-snappy and parity-rocksdb crates

* Updated submodules

* Use parity-snappy 0.1

* Use kvdb-rocksdb 0.1.2

* Don't use latest ethereum/tests

* Fix merge conflicts errors

* Remove superseeded comment

* Address grumbles: add newlines, add/remove spaces
2018-09-04 20:13:51 +02:00
michaelr524
51eac1926f Fixed typo (#9467) 2018-09-04 15:47:33 +01:00
André Silva
c0eb30b604
use kvdb-* and parity-snappy crates from crates.io (#9441)
* use kvdb-* and parity-snappy crates from crates.io

* update rocksdb-sys and snappy-sys
2018-09-03 17:40:11 +01:00
Afri Schoedon
c658b46fe1
Random small cleanups (#9423)
* clean up toml files

* update the parity ethereum toolchain docs

* update contribution guide and issue templates

* update desktop and service files

* build clib examples with 8 threads

* update header templates

* replace parity technologies with parity ethereum logo
2018-08-30 19:57:27 +02:00
Andronik Ordian
491ce61a76 Revert "Use std::sync::Condvar (#1732)" (#9392)
* Revert "Use std::sync::Condvar (#1732)"

This reverts commit c65ee93542.

* verification_queue: remove redundant mutexes
2018-08-22 16:01:07 +02:00
Nick Sanders
139a2b7b0d Replace std::env::home_dir() with home crate impl. (#9293)
* Import the `home` crate in `util/dir`.

* Replace uses of `env::home_dir()` with `home::home_dir()`.
  * `home` uses a 'correct' impl. on windows and the stdlib impl.
    of `::home_dir` otherwise.

* Reexport `home::home_dir` from `util/dir`.

* Bump `util/dir` to 0.1.2.
2018-08-21 15:30:24 +02:00
Niklas Adolfsson
8703449dfe network-devp2p Fix some clippy errors/warnings (#9378)
* fix some clippy warnings

* Remove `shallow-copy` of Node's

* Make `NonReservedPeerMode` Copy and pass-by-value
2018-08-21 12:55:31 +03:00
Niklas Adolfsson
18a8d2f67f Fix typos in network-devp2p (#9371) 2018-08-17 17:04:03 +03:00
Pierre Krieger
1564fae011 Allow setting the panic hook with parity-clib (#9292)
* Allow setting the panic hook with parity-clib

* Make all FFI functions unsafe

* Fix comment

* Fix concern
2018-08-10 11:06:30 +02:00
Tomasz Drwięga
30e40079ca Prevent blockchain & miner racing when accessing pending block. (#9310)
* Prevent blockchain & miner racing when accessing pending block.

* Fix unavailability of pending block during reseal.
2018-08-10 11:00:55 +02:00
Nick Sanders
e590874a81 Update log -> 0.4, env_logger -> 0.5. (#9294)
* Rename a few types & methods.

* Change `(Log)Builder::format` (closure) arg.
2018-08-10 00:04:10 +01:00
David
e2095d4a5d Move ethereum-specific H256FastMap type to own crate (#9307)
* Add a `fastmap` crate that provides the H256FastMap specialized HashMap

* Use `fastmap` instead of `plain_hasher`

* Update submodules for Reasons™

* Submodule update
2018-08-09 09:51:48 +02:00
Pierre Krieger
25604dc577 Avoid using $HOME if not necessary (#9273)
* Avoid using $HOME if not necessary

* Fix concerns and issues
2018-08-03 09:58:59 +02:00
Tomasz Drwięga
a809621f63 Increase the number of sessions. (#9203) 2018-07-30 11:19:47 +02:00
Dong Zhou
5737c21340 fix typo (#9232) 2018-07-27 18:56:21 +08:00
Max Kaye
faf8e9ec6a Update "This is a bug. Please report it at:" link (#9191) 2018-07-23 09:18:49 +01:00
Marek Kotewicz
f826ac35e3
Removed redundant struct bounds and unnecessary data copying (#9096)
* Removed redundant struct bounds and unnecessary data copying

* Updated docs, removed redundant bindings
2018-07-15 11:01:47 +02:00
Afri Schoedon
e339cde790 parity-version: bump nightly version to 2.1 (#9095) 2018-07-13 11:44:31 +01:00
Pierre Krieger
acae643a4a Revert "Replace std::env::home_dir with dirs::home_dir (#9077)" (#9097)
* Revert "Replace `std::env::home_dir` with `dirs::home_dir` (#9077)"

This reverts commit 7e779327eb.

* Restore some of the changes

* Update parity-common
2018-07-12 13:45:02 +02:00
Jim Posen
01f825b0e1 Multiple improvements to discovery ping handling (#8771)
* discovery: Only add nodes to routing table after receiving pong.

Previously the discovery algorithm would add nodes to the routing table
before confirming that the endpoint is participating in the protocol. This
now tracks in-flight pings and adds to the routing table only after receiving
a response.

* discovery: Refactor packet creation into its own function.

This function is useful inside unit tests.

* discovery: Additional testing for new add_node behavior.

* discovery: Track expiration of pings to non-yet-in-bucket nodes.

Now that we may ping nodes before adding to a k-bucket, the timeout tracking
must be separate from BucketEntry.

* discovery: Verify echo hash on pong packets.

Stores packet hash with in-flight requests and matches with pong response.

* discovery: Track timeouts on FIND_NODE requests.

* discovery: Retry failed pings with exponential backoff.

UDP packets may get dropped, so instead of immediately booting nodes that fail
to respond to a ping, retry 4 times with exponential backoff.

* !fixup Use slice instead of Vec for request_backoff.
2018-07-11 21:22:06 +02:00
Matthew Martin
796637b31a Add separate database directory for light client (#8927) (#9064)
* Add seperate default DB path for light client (#8927)

* Improve readability
2018-07-11 16:17:35 +02:00
Afri Schoedon
484ecfaf47
Parity Ethereum 2.0.0 (#9052)
* parity-version: major bump to 2.0.0 🎉

* parity-ethereum: rename crate 🌵

* ethcore: only accept service transactions from parity-ethereum nodes

* parity: fix --identity tests

* rpc: fix sync provider in tests

* rpc: fix parity_net_peers test

* ethcore-sync: accept service transactions from parity and parity-ethereum

* ethcore-sync: fix indentation

* ethcore-sync: split the ifs to reduce code redundancy

* ethcore-sync: fix syntax

* Fix building ethcore

* update cargo.lock

* parity-version: major bump to 2.0.0 tada

* fix merge
2018-07-11 13:35:10 +02:00
Pierre Krieger
494eb4ab6b Remove the dapps system (#9017)
* Remove the dapps system from Parity

* Move node-health outside of dapps

* Fix set dapps list test

* Update Cargo.lock

* Deprecate options

* Add _legacy_ prefixes in Dapps

* Fix tests

* Fix deprecatedness of dapps-path
2018-07-11 12:19:54 +02:00
Afri Schoedon
da5de4a6ff db: remove wal disabling / fast-and-loose option. (#8963)
* parity: highlight --fast-and-loose is not recommended.

* parity: remove fast-and-loose option, ref #1765

* db: remove db wal from options, it's always enabled

* db: remove wal from rocksdb helpers

* cli: fix wallet import test

* ethcore: fix client config tests

* parity: proper deprecated handling for fast-and-loose

* ethcore-client: fix config

* parity: mark fast-and-loose removed

* parity: fix test_find_deprecated

* parity: fix type for fast-and-loose flag

* lock file
2018-07-10 17:33:25 +02:00
David
c7f608ec74
Delete crates from parity-ethereum and fetch them from parity-common instead (#9083)
Use crates from parity-common: hashdb, keccak-hash, kvdb, kvdb-memorydb, kvdb-rocksdb, memorydb, parity-bytes, parity-crypto, path, patricia_trie, plain_hasher, rlp, target, test-support, trie-standardmap, triehash
2018-07-10 14:59:19 +02:00
Niklas Adolfsson
7e779327eb Replace std::env::home_dir with dirs::home_dir (#9077)
`std::env::home_dir` is deprecated but will probably take a while until
it is deprecated on stable. For more info see https://github.com/rust-lang/rust/pull/51656
2018-07-09 16:48:33 +02:00
André Silva
ca6edcaf71 fetch: replace futures-timer with tokio-timer (#9066)
* fetch: replace futures-timer with tokio-timer

Currently the coverage build fails because `futures-timer` fails to compile with
`-C link-dead-code`. This issue has been reported to `futures-timer`
(https://github.com/alexcrichton/futures-timer/issues/2) but has remained unsolved
for months. It should be fixed by rustc eventually
(https://github.com/rust-lang/rust/issues/45629).

* ci: only include local paths in coverage

* ci: exclude target from coverage
2018-07-09 09:59:05 +01:00
Marek Kotewicz
8d171a37f8 remove util-error (#9054)
* remove util-error

* fixed grumbles
2018-07-06 15:09:39 +02:00
Marek Kotewicz
802d684994 reduce number of constraints for triedb types (#9043)
* NodeHandle does not require Hasher

* Node does not require Hasher

* change name of the template typo from I to O
2018-07-05 17:15:03 +02:00
Wei Tang
e3e2fcc285 bump parking_lot to 0.6 (#9013)
* Bump parking_lot to 0.6

* Bump parity-wasm to 0.31 so it gets rid of parking_lot

ref https://github.com/paritytech/parity-wasm/pull/206

* Update jsonrpc versions

* Update wasmi and pwasm-utils version

* Fix compile

* Update jsonrpc crates
2018-07-03 17:31:08 +02:00
Tomasz Drwięga
78e001284f Recently rejected cache for transaction queue (#9005)
* Store recently rejected transactions.

* Don't cache AlreadyImported rejections.

* Make the size of transaction verification queue dependent on pool size.

* Add a test for recently rejected.

* Fix logging for recently rejected.

* Make rejection cache smaller.

* obsolete test removed

* obsolete test removed

* Construct cache with_capacity.
2018-07-02 18:00:06 +01:00
David
9caa868603
Make HashDB generic (#8739)
The `patricia_trie` crate is generic over the hasher (by way of HashDB) and node encoding scheme. Adds a new `patricia_trie_ethereum` crate with concrete impls for Keccak/RLP.
2018-07-02 18:50:05 +02:00
Wei Tang
a1a002f4da Attempt to graceful shutdown in case of panics (#8999)
* Handle graceful shutdown with unwinding

* Fix a race condition

* Avoid double exit deadlock

* typo: fix docs

* Fix ethkey cli compilation

* Fix all other cases panic_hook::set -> panic_hook::set_abort

* struct fields do not need to be public

* Add comments on why exiting AtomicBool is needed
2018-07-02 11:53:50 +02:00
Marek Kotewicz
5ef41ed53e simplify kvdb error types (#8924) 2018-07-02 10:04:48 +01:00
Wei Tang
ac3a706f0d Preserve the current abort behavior (#8995) 2018-06-27 22:31:20 +02:00
Niklas Adolfsson
1a16f335fa Disable hardware-wallets on platforms that don't support libusb (#8464)
* disable hardware-wallets that don't support libusb

* address grumbles

* nits

* Refactor to get rid off as much annotations asap

* Might consume slight more memory than pure conditional compilation
flags

* formatting nits

* Enable libusb for android

* Tested by it compiling succesfully with `cargo build --target=armv7--linux-androideabi`
* The binary is ~66 MB

```bash
$ size
size target/armv7-linux-androideabi/release/parity
text    	data     	bss     	dec     	hex 		filename
50676230        416200   	31456 		51123886        30c16ae 	target/armv7-linux-androideabi/release/parity
```

* Move all `fake-hardware-wallet` to its own crate

* Removes some conditional compilation flags
* Introduces `fake-hardware-wallet` crate

* return error if no hardware wallets are found
2018-06-26 09:03:38 +02:00
David
4145be863b Bump error-chain and quick_error versions (#8972)
* Update error-chain to 0.12 to silence warnings

* Bump quick_error crate to 1.2.2  to silence linter warnings
2018-06-25 14:20:44 +02:00
Toralf Wittner
41348dead4 Add type for passwords. (#8920)
* Add type for passwords.

* Fix test.

* Simplify `Drop` impls of `Password` and `Memzero`.

* Spaces to tabs.

* Custom `Drop` impl for `Password`.
2018-06-22 15:09:15 +02:00
Niklas Adolfsson
0cd1de769b Eliminate some more transmute() (#8879)
* eliminate some more transmute()

* Address `review comments`

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

* Fix IpAddresses nits

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

* remove needless lifetime annotation
2018-06-22 12:51:53 +01:00
Marek Kotewicz
458afcd230 new blooms database (#8712)
* new blooms database

* fixed conflict in Cargo.lock

* removed bloomchain

* cleanup in progress

* all tests passing in trace db with new blooms-db

* added trace_blooms to BlockChainDB interface, fixed db flushing

* BlockChainDB no longer exposes RwLock in the interface

* automatically flush blooms-db after every insert

* blooms-db uses io::BufReader to read files, wrap blooms-db into Mutex, cause fs::File is just a shared file handle

* fix json_tests

* blooms-db can filter multiple possibilities at the same time

* removed enum trace/db.rs CacheId

* lint fixes

* fixed tests

* kvdb-rocksdb uses fs-swap crate

* update Cargo.lock

* use fs::rename

* fixed failing test on linux

* fix tests

* use fs_swap

* fixed failing test on linux

* cleanup after swap

* fix tests

* fixed osx permissions

* simplify parity database opening functions

* added migration to blooms-db

* address @niklasad1 grumbles

* fix license and authors field of blooms-db Cargo.toml

* restore blooms-db after snapshot
2018-06-20 15:13:07 +02:00
Marek Kotewicz
4ef71f8a82 cleanup nibbleslice (#8915) 2018-06-18 12:13:11 +02:00
Afri Schoedon
10fc74eb81
network-devp2p: downgrade logging to debug, add target (#8784)
* network-devp2p: downgrade logging to debug, add target

* network-devp2p: rename s/datagramm/datagram
2018-06-11 10:03:16 +02:00
Jim Posen
13bc922e54 devp2p: Move UDP socket handling from Discovery to Host. (#8790)
* devp2p: Move UDP socket handling from Discovery to Host.

* devp2p: Fix bug with potentially incorrect UDP registration.

This works right now because the Host handler happens to be the first one
registered on the IoService.

* devp2p: Use 0-initialized memory buffer instead of unsafe.

* Remove send_queue field from public interface of Discovery.

* Rename Datagramm to Datagram.

sed -i 's/Datagramm/Datagram/g' util/network-devp2p/src/discovery.rs util/network-devp2p/src/host.rs
sed -i 's/datagramm/datagram/g' util/network-devp2p/src/discovery.rs util/network-devp2p/src/host.rs

* Include target in log statements.
2018-06-08 16:31:48 +02:00