Commit Graph

12262 Commits

Author SHA1 Message Date
David
82c3265858
Ensure jsonrpc threading settings are sane (#11267)
* Ensure jsonrpc threading settings are sane

Starting with `jsonrpc` v14, the "server threads" setting is more important than before and the current default of 1 means the https server is effectively single-threaded. This PR proposes a new default of 4 (and ensures that crazy settings like e.g. `0` are bumped to at least `1`).

Also included: some docs, tests and cosmetics.

* Update parity/rpc.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update parity/rpc.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Remove (i.e. deprecate) `--jsonrpc-threads` command line option

* Call numbers NUM

* Don't show a default for --jsonrpc-threads (deprecated)

* Show deprecation warning when using `--jsonrpc-threads` or `processing_threads`

* Update parity/deprecated.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Fix test

* Fix tests for real
2019-11-18 19:40:48 +01:00
David
93f700d961 Return Ok(None) when the registrar contract returns empty slice (#11257) 2019-11-15 14:27:34 +01:00
David
eb565a7e2b
Add a benchmark for snapshot::account::to_fat_rlps() (#11185)
* Add a benchmark for snapshot::account::to_fat_rlps()

`to_fat_rlps()` is a hot call during snapshots. I don't think it has a perf problem per se, but better to have benchmark for it.

The data used is a piece of Ropsten data sized to the ~95% percentile of account size on that network.

* Benchmark with more chunks, including mainnet data

* whitespace

* Move `used_code` inside the benchmark iteration

* Revert "Move `used_code` inside the benchmark iteration"

This reverts commit cff33ab30acbd1c009e745f646f1cc655ee01d8c.
2019-11-15 12:27:24 +01:00
David
e194a2c6e3 Fix misc compile warnings (#11258) 2019-11-14 00:01:21 +01:00
Marek Kotewicz
db1ea1dcd8 simplify verification (#11249)
* simplify verifier, remove NoopVerifier

* simplify verifier by removing Verifier trait and its only implementation

* remove unused imports

* fixed verification test failing to compile
2019-11-12 15:05:49 +01:00
joshua-mir
9d55f0b4ab
update ropsten forkCanonHash, forkBlock (#11247)
value taken from https://ropsten.etherscan.io/block/6485847
2019-11-11 12:38:32 +01:00
Seun LanLege
887aa62fdb Make InstantSeal Instant again (#11186)
* Make InstantSeal Instant again

* update_sealing if there are transactions in pool after impoerting a block, some line formatting

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* InstantSeal specific behaviour

* introduce engine.should_reseal_on_update, remove InstantSealService

* remove unused code

* add force param to update_sealing

* better docc

* even better docs

* revert code changes, doc corrections, sort dep

* code optimization

* fix test

* fix bench
2019-11-10 11:41:31 +01:00
Thibaut Sardan
8adde605e9 ropsten #6631425 foundation #8798209 (#11201) 2019-11-05 12:15:24 +01:00
phahulin
5fdf6be798 Update list of bootnodes for xDai chain (#11236)
Reference PR in POA repository: https://github.com/poanetwork/poa-chain-spec/pull/127
2019-11-05 12:07:52 +01:00
Talha Cross
1b4d23fd20
ethcore/res: add mordor testnet configuration (#11200)
* ethcore/res: add mordor testnet configuration

* ethcore/spec: add mordor testnet configuration

* parity/cli: add mordor testnet configuration

* parity/config: fix tests

* ethcore/res: update mordor spec with agharta hardfork block 301243

*  ethcore/res: update kotti with agharta block 1705549

* ethcore/res: update morden with agharta block 5000381

* ethcore/res: multiple prices and activations for mordor testnet

* fix mordor spec json

* fix mordor spec json
2019-11-02 12:26:38 +01:00
Niklas Adolfsson
43dc9af03b [chain specs]: activate Istanbul on mainnet (#11228)
* [chains spec]: activate istanbul at mainnet

* Activate `Block >= 9,069,000` on the Ethereum mainnet
* Enable Blake2 compression function `F` precompile

* [chain specs]: add comments for EIP1108 activation

* [chainspec mainnet]: enable Istanbul transitions

* [chainspec mainnet]: simply configuration
2019-11-01 20:27:14 +01:00
Niklas Adolfsson
13729a0f7f [builtin]: support multiple prices and activations in chain spec (#11039)
* [builtin]: impl new builtin type

Have an enum to deserialize either a builtin of a single price or several prices

* [builtin]: style cleanup

* [builtin]: fix tests

* [builtin]: replace boxing with wrapper enum

* cleanup

* fix: make it backward compatible with old builtin

* fix: update chain specs

* fix: revert use of `type alias` on enum

The CI doesn't use the latest rust.

This commit reverts that change

* fix: builtin tests

* fix: revert use of `type alias` on enum

* [basic-authority]: update test-chainspec

* fix failing tests

* [builtin]: multi-prices add `info field`

It might be hard to read chain specs with several activations points.
This commit introduces a `info` field which may be used to write some
information about the current activation such as:

`Istanbul hardfork EIP-1108` or something similar.

* fix: bad rebase

Co-Authored-By: David <dvdplm@gmail.com>

* fix(grumbles): make it backward compatible

* grumbles: resolve `NOTE`

* revert chain specs changes

* rename test

Co-Authored-By: David <dvdplm@gmail.com>

* [builtin docs]: price -> Fixed price

Co-Authored-By: Andronik Ordian <write@reusable.software>

* [json]: address naming grumbles

InnerPricing -> PricingInner
PriceWithActivationAt -> PricingAt

* docs: revert changes for `AltBn128ConstOperations`

* [json]: usize -> u64

Use explicit types to cope with platform dependent issues for `usize`

* grumble: simplify `spec_backward_compability.json`

* docs: add issue link to `TODO`

* [builtin]: replace `match` with `map`

* [builtin]: add deprecation message `eip1108` params

* nits

* [json spec tests]: fix json indentation

* [json docs]: fix typos

* [json]: `compability layer` + deser to BTreeMap

Previously we had to match `Pricing::Single` and `PricingMulti` which this fixes.
It does by introducing a compability layer and into() implemenentation.

In addition, I switched the deserialization to `BTreeMap` instead of `Vec`.
That changes the format of the chain spec again

* [json]: rename `BuiltinCombat` -> `BuiltinCompat`

* Update ethcore/builtin/src/lib.rs

Co-Authored-By: David <dvdplm@gmail.com>

* [json builtin]: improve docs

Co-Authored-By: David <dvdplm@gmail.com>

* [json builtin]: improve docs

Co-Authored-By: David <dvdplm@gmail.com>

* chore(builtin): sort dependencies

* [json builtin]: deprecate `eip1108` params

* [machine]: add bench for calling builtin contract

* [machine]: reduce calls to `Builtin::is_active`

* [builtin]: fix nits

* [json]: revert breakage of chain specs

* [json builtin]: remove `eip1108` params

* [chain specs]: update to new format

* [machine]: revert changes

* [devp2p]: revert change

* [builtin]: doc nits
2019-10-31 17:09:08 +01:00
Anton Gavrilov
80754c3426
Insert explicit warning into the panic hook (#11225) 2019-10-31 16:17:12 +01:00
David
8c2199dd2a
Snapshot restoration overhaul (#11219)
* Comments and todos
Use `snapshot_sync` as logging target

* fix compilation

* More todos, more logs

* Fix picking snapshot peer: prefer the one with the highest block number
More docs, comments, todos

* Adjust WAIT_PEERS_TIMEOUT to be a multiple of MAINTAIN_SYNC_TIMER to try to fix snapshot startup problems
Docs, todos, comments

* Tabs

* Formatting

* Don't build new rlp::EMPTY_LIST_RLP instances

* Dial down debug logging

* Don't warn about missing hashes in the manifest: it's normal
Log client version on peer connect

* Cleanup

* Do not skip snapshots further away than 30k block from the highest block seen

Currently we look for peers that seed snapshots that are close to the highest block seen on the network (where "close" means withing 30k blocks). When a node starts up we wait for some time (5sec, increased here to 10sec) to let peers connect and if we have found a suitable peer to sync a snapshot from at the end of that delay, we start the download; if none is found and --warp-barrier is used we stall, otherwise we start a slow-sync.
When looking for a suitable snapshot, we use the highest block seen on the network to check if a peer has a snapshot that is within 30k blocks of that highest block number. This means that in a situation where all available snapshots are older than that, we will often fail to start a snapshot at all. What's worse is that the longer we delay starting a snapshot sync (to let more peers connect, in the hope of finding a good snapshot), the more likely we are to have seen a high block and thus the more likely we become to accept a snapshot.
This commit removes this comparison with the highest blocknumber criteria entirely and picks the best snapshot we find in 10sec.

* lockfile

* Add a `ChunkType::Dupe` variant so that we do not disconnect a peer if they happen to send us a duplicate chunk (just ignore the chunk and keep going)
Resolve some documentation todos, add more

* tweak log message

* Don't warp sync twice
Check if our own block is beyond the given warp barrier (can happen after we've completed a warp sync but are not quite yet synced up to the tip) and if so, don't sync.
More docs, resolve todos.
Dial down some `sync` debug level logging to trace

* Avoid iterating over all snapshot block/state hashes to find the next work item

Use a HashSet instead of a Vec and remove items from the set as chunks are processed. Calculate and store the total number of chunks in the `Snapshot`  struct instead of counting pending chunks each time.

* Address review grumbles

* Log correct number of bytes written to disk

* Revert ChunkType::Dup change

* whitespace grumble

* Cleanup debugging code

* Fix docs

* Fix import and a typo

* Fix test impl

* Use `indexmap::IndexSet` to ensure chunk hashes are accessed in order

* Revert increased SNAPSHOT_MANIFEST_TIMEOUT: 5sec should be enough
2019-10-31 16:07:21 +01:00
Louis Pérez
6b17e321df Fix docker centos build (#11226)
- Update shell script to build docker centos
  image with the new path.
  - Update REAMDE.md with build instructions.

Closes [#11224](https://github.com/paritytech/parity-ethereum/issues/11224)
2019-10-31 14:59:51 +01:00
Denis Pisarev
f743829759 retry on gitlab system failures (#11222) 2019-10-30 19:16:18 +01:00
Jonathan Brown
29c364be43 Update bootnodes. (#11203) 2019-10-29 12:43:46 +01:00
Rakan Alhneiti
6993ec9531 Use provided usd-per-eth value if an endpoint is specified (#11209)
* Fix `invalid transaction price` error message

* Setup Calibrated GasPriceConfig when usd-per-eth is an endpoint

The change will try to check if the specified value is an endpoint.
If the value of `auto` is specified, the default endpoint URL will be used
otherwise, the user-provided value will be taken as-is for an endpoint.

* Use if-let and check for usd-per-eth arg:

1. auto = use etherscan
2. value = use fixed pricer
3. endpoint = use the provided endpoint as-is

* Fix typo in to_pricce error message

* Correct whitespace indentation

* Use arg_usd_per_eth directly
2019-10-29 12:18:30 +01:00
David
0d3423cbe0
Use a lock instead of atomics for snapshot Progress (#11197)
* WIP. Typos and logging.

* Format todos

* Pause pruning while a snapshot is under way
Logs, docs and todos

* Allocate memory for the full chunk

* Name snapshotting threads

* Ensure `taking_snapshot` is set to false whenever and however `take_snapshot`returns
Rename `take_at` to `request_snapshot_at`
Cleanup

* Let "in_progress" deletion fail
Fix tests

* Just use an atomic

* Review grumbles

* Finish the sentence

* Resolve a few todos and clarify comments.

* Calculate progress rate since last update

* Lockfile

* Fix tests

* typo

* Reinstate default snapshotting frequency
Cut down on the logging noise

* Use a lock instead of atomics for snapshot Progress

* Update ethcore/types/src/snapshot.rs

Co-Authored-By: Andronik Ordian <write@reusable.software>

* Avoid truncating cast
Cleanup
2019-10-28 18:24:45 +01:00
Niklas Adolfsson
293e06e0f4
[informant]: MillisecondDuration -> as_millis() (#11211)
* [informant]: `MillisecondDuration` -> `as_millis()`

This commit removes the trait `MillisecondDuration` and
replaces it with `Duration::as_millis` instead

* [grumble]: extract `elapsed()` to variable
2019-10-28 15:03:28 +01:00
Vladimir Komendantskiy
e0e79fdee0 Step duration map configuration parameter ported from the POA Network fork (#10902)
* step duration map configuration parameter ported from POA Network fork

* step duration map refactoring

* added a test of step duration change

* refactoring of vector search; return Err instead of panicking

* removed dead code and the Config engine error variant

* doc correction

* converted triples to struct StepDurationInfo
2019-10-28 14:39:18 +01:00
David
2c97bcc1a4 Upgrade jsonrpc to latest (#11206) 2019-10-26 11:26:04 +02:00
Niklas Adolfsson
c4ca84cdf3 [export hardcoded sync]: use debug for H256 (#11204)
Fixes #11202

The `Display` implementation for `SpecHardcodedSync` used the `Display` implementation of
`ethereum_types::H256` which doesn't show the full hash which this fixes.
2019-10-25 18:12:14 +02:00
David
ffeaee778c
Pause pruning while snapshotting (#11178)
* WIP. Typos and logging.

* Format todos

* Pause pruning while a snapshot is under way
Logs, docs and todos

* Allocate memory for the full chunk

* Name snapshotting threads

* Ensure `taking_snapshot` is set to false whenever and however `take_snapshot`returns
Rename `take_at` to `request_snapshot_at`
Cleanup

* Let "in_progress" deletion fail
Fix tests

* Just use an atomic

* Review grumbles

* Finish the sentence

* Resolve a few todos and clarify comments.

* Calculate progress rate since last update

* Lockfile

* Fix tests

* typo

* Reinstate default snapshotting frequency
Cut down on the logging noise

* address grumble

* Log memory use with `journal_size()` and explain why.
2019-10-24 16:46:32 +02:00
Fabio Lama
acf7c48d7e Type annotation for next_key() matching of json filter options (#11192)
* type annotation for next_key matching of json filter options

* rpc tests for pending transactions

* mention git submodules in the readme
2019-10-23 14:20:47 +02:00
Anton Gavrilov
834585d61b
Crypto primitives removed from ethkey (#11174)
* Crypto utils removed from ethkey

* Fix ethkey lib

* Switch ethsore to new crypto

* Accounts crate fixed

* Secret store crate switched to new crypto

* Ethcore builtin fixed

* Accounts crate fixed

* Ethcore crate fixed

* Util network fixed

* Util network-devp2p fixed

* Private tx fixed

* Ethcore sync fixed

* Secret store fixed

* Rpc fixed

* Parity fixed

* Ethkey cli fixed

* Local store fixed

* Ethcore blockchain fixed

* Cargo.lock pushed; doc comment added for reversed nonce

* Ethstore tests fixed

* Ethstore cli fixed

* Miner fixed

* Snapshot tests are fixed

* Single brackets removed

* Machine fixed

* Verification fixed

* Executive state fixed

* More single brackets removed

* Update version of parity-crypto

* Use published version 0.4.2 of parity-crypto

* New test in tx_filter fixed
2019-10-23 13:03:46 +02:00
Tino Breddin
81ca599f2a Made ecrecover implementation trait public (#11188)
* Made ecrecover Implementation trait public

* Make all builtin contract types public

This ensure the API is consistent in terms of visibility.
2019-10-22 22:03:52 +02:00
Andreas Fackler
20bd1fa789 Remove unused macro_use. (#11191) 2019-10-22 15:59:58 +02:00
Niklas Adolfsson
6960d35abb [dependencies]: jsonrpc 14.0.1 (#11183)
Closing #11169
2019-10-19 14:14:25 +02:00
Niklas Adolfsson
c8b4373e13
[receipt]: add sender & receiver to RichReceipts (#11179)
* [receipts]: add `to` & `from` to `RichReceipts`

* [rpc]: add test for `pending_receipt`

* docs(common_types/receipt): add note Option field
2019-10-18 18:12:02 +02:00
Niklas Adolfsson
2d2513b35a [dependencies] bump rand 0.7 (#11022)
* network-devp2p: bump rand `0.7`

* updater: bump rand `0.7`

* hash-fetch: bump rand `0.7`

* ethcore-sync: bump rand `0.7`

* rpc: dont work yet

* [private-tx] remove unused rand

* [ethcore-snapshot] bump rand 0.7

* [engine clique]: bump rand 0.7

* [engine authority-round]: remove rand

* [ethcore-blockchain]: bump rand 0.7

* [ethcore]: bump rand 0.7

* [ethcore-light]: bump rand 0.7

* [ethstore]: bump rand 0.7

* Fix for rand usage in rpc

* [rpc]: fix test build

* [ethcore-sync]: fix test build

* [snapshot tests]: rand 0.7

* [ethkey]: bump rand 0.7

* [rpc]: resolve TODO incompatible `rand versions`

* [ethkey] use `rust-secp256k1` master branch

* fix(bad merge): ethcoore-light remove itertools

* [rpc tests]: revert rpc test changes in #11139

`#11139` makes use a different `RNG/seed`, not `H64::random_using(&mut self.rand)`

This commit reverts the changed tests (the generated id by `Subscribers::next_id`)

* [ethkey/random]: resolve introduced `TODO`
2019-10-18 15:12:16 +02:00
Andronik Ordian
3696f68626 [ethcore/builtin]: do not panic in blake2pricer on short input (#11180)
* [ethcore/builtin]: do not panic in blake2pricer on short input

* [ethcore/builtin]: add a test for blake2pricer
2019-10-18 15:10:00 +02:00
Andreas Fackler
ff697b64b3 TxPermissions ver 3: gas price & data (#11170) 2019-10-18 12:12:06 +02:00
Niklas Adolfsson
9c8b7c23d1
[ethash] chainspec validate ecip1017EraRounds non-zero (#11123)
* [ethash]: validate `ecip1017EraRounds` non-zero

When `ecip1017EraRounds` ethash will divide by zero.

This commit ensures that the chainspec deserialization fails and
gives a better error message.

* [ecip1017_eras_block_reward]: document behaviour

* nit

* docs(ethash ecip1071): resolve `TODO`
2019-10-17 14:02:41 +02:00
Boqin Qin
f99819d326 util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175) 2019-10-17 10:59:37 +02:00
Boqin Qin
6b57429d72 ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172) 2019-10-16 12:03:48 +02:00
Andreas Fackler
f59ed47b1b Aura: Report malice on sibling blocks from the same validator (#11160)
* Aura: Report malice on sibling blocks from the same validator

This was originally written by @vkomenda, then squashed for
easier rebasing on master. Cleanup of `received_step_hashes`
was moved to `verify_block_family`, since `on_prepare_block`
does not exist on master, and a unit test was added.
Original commit messages:

added the map of received block header hashes

do not return an error and remove older received block records

optimised older record removal

block hash comparison optimisation and the weak client ref fix

SIBLING_MALICE_DETECTION_PERIOD constant

review comments

using step numbers instead of block numbers

* Add docs; use map_or.

* Update step hash record comment.

Co-Authored-By: David <dvdplm@gmail.com>

* Remove hash records after 2 rounds instead of 100 steps.
2019-10-14 12:56:38 +02:00
David
aefa8d5f59
Change how RPCs eth_call and eth_estimateGas handle "Pending" (#11127)
* Change how RPCs eth_call and eth_estimateGas handle "Pending"

Before this PR we would return a rather confusing error when calling `eth_call` and `eth_estimateGas` with `"Pending"`, e.g.:

```
{"jsonrpc":"2.0","error":{"code":-32000,"message":"This request is not supported because your node is running with state pruning. Run with --pruning=archive."},"id":"e237678f6648ed12ff05a74933d06d17"}
```

In reality what is going on is that users often use `"Pending"` when they really mean `"Latest"` (e.g. MyCrypto…) and when the block in question is not actually pending. This changes our behaviour for these two RPC calls to fall back to `"Latest"` when the query with `"Pending"` fails.
Note that we already behave this way for many other RPCs:

	- eth_call (after this PR)
	- eth_estimateGas (after this PR)
	- eth_getBalance
	- eth_getCode
	- eth_getStorageAt

Closes https://github.com/paritytech/parity-ethereum/issues/10096

* Fetch jsonrpc from git

* No real need to wait for new jsonrpc

* Add tests for calling eth_call/eth_estimateGas with "Pending"

* Fix a todo, add another

* Change client.latest_state to return the best header as well so we avoid potential data races and do less work

* Impl review suggestions

* Update rpc/src/v1/impls/eth.rs

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Review grumbles

* update docs
2019-10-11 15:54:36 +02:00
David
f3015ce0c6
Cleanup stratum a bit (#11161)
* Cleanup stratum a bit

Salvage some code from https://github.com/paritytech/parity-ethereum/pull/10884 + some cleanup and typos.

* HashSet::new does not allocate before first insert

* Remove unused method push_work()
2019-10-11 11:52:09 +02:00
Niklas Adolfsson
4f25d43516
[keccak-hasher]: rust2018 (#11163) 2019-10-10 19:43:33 +02:00
David
9d313e31e6 Upgrade to jsonrpc v14 (#11151)
* Upgrade to jsonrpc v14

Contains https://github.com/paritytech/jsonrpc/pull/495 with good bugfixes to resource usage.

* Bump tokio & futures.

* Bump even further.

* Upgrade tokio to 0.1.22

* Partially revert "Bump tokio & futures."

This reverts commit 100907eb91907aa124d856d52374637256118e86.
2019-10-10 15:56:22 +01:00
Svyatoslav Nikolsky
330cdc1a4d
Secret store: fix Instant::now() related race in net_keep_alive (#11155)
* try Instant fix in SS

* proper fix + add comment

* fix compilation
2019-10-10 11:19:23 +03:00
Vladimir Komendantskiy
93fbbb9aaf RPC method for clearing the engine signer (#10920)
* RPC method parity_clearEngineSigner

Add RPC method parity_clearEngineSigner
Fixes https://github.com/poanetwork/parity-ethereum/issues/113

* corrected the return type of clear_author

* review comment responses and a rebase fix

* removed a spurrious warning

* moved clear_signer functionality to set_signer

* Merge clear_author into MinerService::set_author.

* Add trace logs to Clique::set_signer.

* Clique: Don't lock signer multiple times.
2019-10-09 14:42:51 +02:00
Andy Weiss
a404dd5415 Use TryFrom instead of From+panic for Builtin (#11140)
* Use TryFrom instead of From+panic for Builtin

* fix tests

* change expect text to be more descriptive

* fix formatting
2019-10-09 14:42:03 +02:00
Denis S. Soldatov aka General-Beck
11c447dfbe
Fix sccache statistics (#11145)
* Fix sccache statictics

* warning update for non x86_64 architectures

* sccache -s -> sccache --show-stats
2019-10-08 21:58:34 +03:00
Anton Gavrilov
f48780c29b
Update ethereum types to 0.8.0 version (#11139)
* Ethereum types updated to 0.8 version

* Fix for rand usage in rpc

* Cargo lock fixed after rebase

* TODO added
2019-10-08 14:18:44 +02:00
Niklas Adolfsson
35513b14de
[json]: add docs to hardfork specification (#11138)
* [json]: add docs to `hardfork specification`

* address grumbles
2019-10-07 15:25:03 +02:00
Toby Dimmick
63c7ae9a89 ServiceTransactionChecker::refresh_cache: allow registrar unavailable (#11126)
Return `Ok(false)` instead of `Err(...)`. Fixes regression from PR #11110.
2019-10-07 12:04:41 +02:00
David
b31bff5ce2
Fix some random typos, formatting/whitespace (#11128)
* Fix some random typos, formatting/whitespace

* Remove unecessary lifetime annotations

* Revert "Remove unecessary lifetime annotations"

This reverts commit 2357ccc3743a234e3181a79aff825370461543bf.
2019-10-04 19:54:28 +02:00
Juan Aguilar
4fd1ec643f Refactor parity_listStorageKeys with count parameter optional (#11124) 2019-10-04 14:38:57 +02:00