Commit Graph

12279 Commits

Author SHA1 Message Date
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
Patrick Tescher
79aeb95272 Make EIP712Domain Fields Optional (#11103)
According to
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#definition-
of-domainseparator “Protocol designers only need to include the fields
that make sense for their signing domain.”
2019-10-03 22:20:20 +02:00
David
ca329078f5
EIP-712: bump version in prep for publishing (#11106)
* version 0.1.1

* lock file
2019-10-03 19:34:06 +02:00
Juan Aguilar
acc5bdfc35 move StateResult to common-types (#11121) 2019-10-03 16:52:29 +02:00
Toby Dimmick
79a17dedd0 Deduplicate registrar contract & calling logic (#11110)
* Rename RegistryInfo -> RegistryInfoDeprecated

* Add BlockId parameter to Registrar::get_address and RegistrarClient::call_contract

* Remove RegistrarClient::Call (use async for now); add RegistrarClient::get_address

* Remove Registrar type in favour of naked trait

* Use CallContract trait bound instead of separate call_contract method

* Make RegistrarClient::get_address and URLHint::resolve synchronous

* RegistrarClient::get_address: return check if address is zero

* Modify RegistryInfo::registry_address to take &str

* return Result from RegistryInfo::registry_address

* Replace RegistryInfo with RegistrarClient

- Modifed RegistrarClient::registrar_address to return Option
- Removed BlockChainClient::registrar_address

* Fix other build configs

* Fix unit test builds

* Remove local RegistrarClient type from run::execute_impl

* Remove registrar.json from ethcore

* Formatting/line breaks

* Update RegistrarClient docs, remove explicit lifetime

* Weak ref to ethcore client from hash fetch client

* Fix unit tests
2019-10-03 15:15:25 +02:00
Juan Aguilar
0c0f965354 Refactor return type of BlockChainClient::code #7098 (#11102)
* fix: refactor return type of `BlockChainClient::code`

* Add TODO move to `common-types`

Co-Authored-By: David <dvdplm@gmail.com>
2019-10-03 13:21:26 +02:00
Denis S. Soldatov aka General-Beck
0bd2979c04
Switching sccache from local to Redis (#10971)
* Switching cache from local to Radis

* sccache -s won't work. All the images are taken from own registry

* new images addresses

* statisticss after stop sccache server
sccache CC&CXX
2019-10-02 23:01:20 +03:00
Seun LanLege
f24bff5998
SIMD Implementation for EIP-152 (#11056)
* simd implementation

* adds benchmarks

* Update util/EIP-152/src/avx.rs

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

* enable avx 😅

* better benchmark, docs

* rename avx to avx2, compile on android

* fix android again

* remove ifunc, code formatting

* license

* nits

* docs, nits

* fix test
2019-10-02 14:32:21 +01:00
Juan Aguilar
ad633de6d9 Fix deprecated trait objects without an explicit dyn (#11112) 2019-10-02 10:55:31 +02:00
Andronik Ordian
d243b15ae0 [spec] fix rinkeby spec (#11108) 2019-10-02 10:52:25 +02:00
David
fcd042a487
Update to latest jsonrpc (#11111)
* Update to latest jsonrpc

* Fix percent_encoding not re-exported from url anymore
2019-10-02 10:25:51 +02:00
Denis Pisarev
1b1b44bb20
use images from our registry (#11105) 2019-10-01 13:58:12 +02:00
Seun LanLege
8471b91002
Correct EIP-712 encoding (#11092)
* support encoding custom array types as fields

* new line

* removed expect

* Update util/EIP-712/src/encode.rs

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

* bump lunarity

* update cargo lock

* nits

* nits
2019-09-30 22:16:30 +01:00
Andronik Ordian
4979c62bb5
[CI] check evmbin build (#11096) 2019-09-27 23:29:25 +02:00
David
2b8b8851ab Update kvdb, kvdb-rocksdb and h2 (#11091)
* Update a few dependencies

Updates two dependencies: `kvdb-rocksdb` and `h2`. Brings in `parking_lot 0.9` which is unintended but possibly fine.

* Bump parking_lot to 0.9
Bump kvdb-memorydb to 0.2 (from git atm)

* New kvdb-memorydb is not breaking

* Remove [patch]
2019-09-27 23:29:14 +02:00
David Forstenlechner
7c5fd042f3 [client]: Fix for incorrectly dropped consensus messages (#11082) (#11086)
Fixes a race condition causing the currently_queued counter to underflow and consensus messages getting dropped incorrectly as a consequence.
2019-09-25 19:45:49 +02:00
David
d9201aa6f2
Update JSON tests to d4f86ecf4aa7c (#11054)
* new ethereum consensus tests, #10908

* Update JSON tests to 725dbc73a

This PR reverts the controversial changes of the previous PR and skips the failing tests.

Maybe I misunderstand the suggested workaround of putting the fix under `#[cfg(test)]` but it seems odd to run different code in production than we run in tests. Instead here I suggest we skip the failing tests with the argument that we do not wish to fix this issue (at least not at this time) because it does not affect us. If I am wrong, and I likely am, I look forward to hearing why and what a better approach to updating the state tests is.

Branched off https://github.com/paritytech/parity-ethereum/pull/10923

ref #10908

* Update json test commit to 1dc9d20e97165708f7db0bbf2d1a87a6b4285827

* Fail with error message

* Handle missing r, s, v params in json tests
Light cleanup of json test runner

* Include the path to the test file

* Handle new `postState` format: string or map
Sort out tests
Missing docs

* WIP

* Include test-helpers from ethjson

* Sort out new paths

* Remove dead code

* Fix warnings stemming from code called only from macros
Skip failing tests in stRevert/ and stTransactionTest/ (too course a filter!)
Docs and light touch refactorings for readability

* Skip all failing tests

* Document the single-test-skipping madness

* Update tests to latest commit on the `develop` branch

* Rename test skipping types to reflect actual purpose

* Switch to skipping individual tests in currents.json
Add some logging to help debug skipping

* Fix rpc test by curve fitting to new json test source file

* Add refs to all issues for fixing failing&skipped json tests

* Sort out the need for Clone for tests

* [json-tests] populate state from genesis pod state (#11083)

* [json-tests] populate state from genesis pod state

* [json-tests] #11075 is resolved as well

* [json-tests] #11076 hopefully too

* [json-tests] #11077 🎉

* [json-tests] fix trailing comma

* Update ethcore/src/json_tests/chain.rs

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

* Add issue numbers to TODOs

* Apply @ordians fix for wrong state_root

* Warn on invalid RLP

* Remove the `ci-skip-tests` feature
2019-09-25 10:02:04 +02:00
Cho
7f5ac8ba7a fix(network): typo (#11088) 2019-09-25 09:54:47 +02:00
Andronik Ordian
fc22c58408
[ethash] remove manual unrolling (#11069)
* [ethash] remove unroll in calculate_dag_item

* [ethash] add keccak bench

* [ethash] remove unroll! completely

* [ethash] specify required-features for benches

* [ethcore/verification] specify required-features for benches

* [CI] simplify cargo-check-benches step
2019-09-24 11:45:28 +02:00
Talha Cross
2627288311 ethcore/res: activate Istanbul on Ropsten, Görli, Rinkeby, Kovan (#11068)
* ethcore/res: activate Istanbul on Ropsten block 6485846

* ethcore/res: activate Istanbul on Goerli block 1561651

* ethcore/res: use hex values for Istanbul specs

* ethcore/res: fix trailing comma

* ethcore/res: be pedantic about EIP-1283 in Petersburg and Istanbul test specs

* ethcore/res: activate Istanbul on Rinkeby block 5435345

* ethcore/res: activate Istanbul on Kovan block 14111141

* ethcore/res: fix kovan istanbul number to 0xd751a5
2019-09-20 15:53:35 +08:00
Niklas Adolfsson
19184e8529
[sync]: rust 2018 (#11067)
* [sync]: rust 2018

* fix(grumble): explicit use for RlpResponseResult

* fix(grumble): types -> common_types

* fix: bad rebase

* fix: wildcard import

* fix(grumble): rename crate hash to `keccak_hash`
2019-09-19 13:12:07 +02:00
Niklas Adolfsson
b6415c6196 [ethcore]: move client test types to test-helpers (#11062) 2019-09-17 15:42:22 +01:00
Niklas Adolfsson
acad59b300 [sync]: remove unused dependencies or make dev (#11061) 2019-09-16 21:56:53 +02:00
Niklas Adolfsson
0051c26acf [ethcore]: reduce re-exports (#11059)
* [ethcore]: reduce re-exports

Last piece of refactoring to close #10130 after work done by @dvdplm et. al

After this PR, we have the following re-exports from other crates in `non-testbuilds`:
- evm::VMType (client)
- ethcore_miner::local_accounts::LocalAccounts (miner)
- ethcore_miner::pool::PendingOrdering (miner)

I think the miner re-exports make sense (closely tied to the module) and `VMType` (related to module but not closely)

* fix(grumbles): remove re-export `VerifierType`
2019-09-16 17:12:21 +02:00
Andronik Ordian
bceb1d5691
[evmbin] fix time formatting (#11060) 2019-09-16 15:14:34 +02:00
joshua-mir
61a7c30ed5 Update hardcoded headers (foundation, classic, kovan, xdai, ewc, ...) (#11053)
* update hardcoded headers for foundation

* update classic headers

* update kovan headers

* formatting and xdai hardcoded headers

* ewc headers and formatting

* volta formatting and headers

* headers for poacore and sokol

* indentation

* indentation volta

* remove unnecessary space

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

* remove unnecessary space

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

* remove random typo haha
2019-09-16 12:25:52 +02:00
Andronik Ordian
0659cb8592 cargo update -p eth-secp256k1 (#11052) 2019-09-13 19:48:51 +02:00
Niklas Adolfsson
a665116eb1 ethcore: remove test-helper feat from build (#11047) 2019-09-13 11:13:41 +02:00
David
0bd2348ca1 Include test-helpers from ethjson (#11045)
Closes https://github.com/paritytech/parity-ethereum/issues/11044
2019-09-13 09:38:24 +02:00
Niklas Adolfsson
eb81168674 [ethcore]: cleanup dependencies (#11043) 2019-09-12 22:56:59 +02:00
Andronik Ordian
ad9a53f486
add more tx tests (#11038) 2019-09-12 16:38:25 +02:00
Nicolas Gotchac
5e2def1b23
Fix parallel transactions race-condition (#10995)
* WiP : clear pending txs cache & tick in Miner

* Fixed pending transactions

* Revert debugging code

* Add ToDo comment

* Remove commented-out code

* Reverse LTO setting

* WiP

* Try to seal a new block if there are pending transactions

* Try resealing only for internal imports

* Remove logging

* Use AtomicU64 instead of Mutex<BlockNumber>

* Remove TxQueue cache clear // Update AtomicUint logic

* Update comments in Miner

* Revert import of `parking_lot`

* Update `transaction-pool` dependency

* Call directly `update_sealing`

* Call `update_sealing` directly
2019-09-11 18:44:31 +02:00
Niklas Adolfsson
240ef46c72
[ethcore]: make it compile without test-helpers feature (#11036)
* [ethcore]: rustc_hex not longer `optional`

Used by `ethcore/client/client` when importing blocks

* [ethcore-types]: `DataFormat` add docs + tabify

* fix(grumbles): bump `rustc-hex = 2`
2019-09-11 17:35:50 +02:00
David
f4d14e271f Benchmarks for block verification (#11035)
* WIP

* wip

* Benchmarks for block verification

Uses real blocks from mainnet to benchmark the `verify_*` family of methods in the `verification` module.

Also exposes the `TestBlockChain` in a test helper.

* Cleanup, fix CI

* Bash syntax error

* One more try

* Fix review grumbles
	Revert unwanted changes
	Tweak CI benchmark checks
2019-09-11 14:15:19 +02:00