Commit Graph

3619 Commits

Author SHA1 Message Date
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
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
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
Niklas Adolfsson
a665116eb1 ethcore: remove test-helper feat from build (#11047) 2019-09-13 11:13:41 +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
David
48629c2bd4
Move snapshot related traits to their proper place (#11012)
* Move snapshot to own crate
Sort out imports

* WIP cargo toml

* Make snapshotting generic over the client
Sort out tests

* Sort out types from blockchain and client

* Sort out sync

* Sort out imports and generics

* Sort out main binary

* Fix sync test-helpers

* Sort out import for secret-store

* Sort out more imports

* Fix easy todos

* cleanup

* Move SnapshotClient and SnapshotWriter to their proper places
Sort out the circular dependency between snapshot and ethcore by moving all snapshot tests to own crate, snapshot-tests

* cleanup

* Cleanup

* fix merge issues

* Update ethcore/snapshot/snapshot-tests/Cargo.toml

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

* Sort out botched merge

* Ensure snapshot-tests run

* Docs

* Fix grumbles
2019-09-10 22:44:33 +02:00
Niklas Adolfsson
d311bebaee cleanup json crate (#11027)
* [json]: cleanup

write something here....

* nit: commit new/moved files

* nit: remove needless features

* nits

* fix(grumbles): use explicit import `DifficultyTest`

* fix(grumbles): remove needless type hints

* fix(grumble): docs `from -> used by`

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

* fix(grumbles): use explicit `imports`

* fix(grumble): merge `tx` and `tx_with_signing_info`

* fix(grumbles): resolve introduced `TODO's`
2019-09-10 20:46:50 +02:00
Andronik Ordian
fc9a2933af
[spec] add istanbul test spec (#11033)
* [spec] add istanbul test spec (wip)

* [spec] fix trailing comma

* [spec] add blake2_f precompiled

* [spec] specify eip1283ReenableTransition

* [spec] update istanbul spec to new blake2 pricing spec
2019-09-10 18:28:21 +02:00
Andronik Ordian
feb87c901e
[json-spec] make blake2 pricing spec more readable (#11034)
* [json-spec] make blake2 pricing spec more readable

* [ethcore] fix compilation
2019-09-10 17:52:04 +02:00
David
d8d7abc848 Add blake2_f precompile (#11017)
* feat: implement eip1108

* doc nit: price per point pair

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

* fix: test-build

* fix: update chain specs

* fix: basic_authority.json chain spec

* fix: change `eip_transition == 0x7fffffffffffff`

* Merge na-eip1108

* Pre-compile plumbing

* Use type alias instead of struct

* Extract the data from incoming EVM call and forward it to blake2_f

* Fetch parity-common from git for now

* Fix broken cost impl
Add remaining test vectors

* cleanup

* Trailing comma in json spec

* Update ethcore/builtin/src/lib.rs

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

* Update ethcore/builtin/src/lib.rs

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

* Rename pricer to be Blake2-specific
Return a cost of u32::MAX if conversion fails
Fix docs and todos

* Fix error handling in cost()

* fix chainspec

* EIP-152 crate

* Update ethcore/builtin/src/lib.rs

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

* Address grumbles

* Update ethcore/builtin/src/lib.rs

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

* Switch tests to use hex!

* remove parity-crypto from git

* Sort out the SIGMA

* Prefer arrays to vecs

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

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

* Update json/src/spec/builtin.rs

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

* Update json/src/spec/builtin.rs

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

* Review feedback

* Do not change chainspecs yet

* Do not assume endianess: precompile output is LE
2019-09-10 00:26:45 +02:00
Seun LanLege
80f0e4b58f Add new line after writing block to hex file. (#10984)
* add new line after writing block to hex file.

* refactor for testability

* correct import

* better error reporting, code formatting

* multiline imports

* docs

* better docs, move type to common types, merge ImportBlocks and ExportBlocks

* tabs over spaces

* correct test imports

* Apply suggestions from code review

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

* correct typo

* fixed test import
2019-09-09 13:46:05 +02:00
Niklas Adolfsson
53e590f54b fix: remove unused error-chain (#11028) 2019-09-09 09:55:06 +02:00
Niklas Adolfsson
a4969ca498 fix: remove needless use of itertools (#11029)
* Remove needless use of `itertools` in `ethcore-light`
* Replace `itertools:🔁:call` with `std::iter::repeat_with`
2019-09-08 14:30:54 +02:00
Toby Dimmick
680807e601 Convert std::test benchmarks to use Criterion (#10999)
* Convert std::test benches to Criterion

* Required feature for ethash benches

* gitlab-ci: Check all bench targets

* check ethash benches

* evmbin/benches/mod.rs: Update bench sample command

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

* Upgrade to criterion 0.3
2019-09-05 19:28:01 +02:00
Atkins
a89bbfe366 Fix block detail updating (#11015)
* Add finality parameter to `null engine`

* Add testcase for finalization marking in `ethcore` client

* Add double cache read for db

* Prevent lost update of block details

* Read with pending update for block details in batch
2019-09-05 19:27:05 +02:00
Andronik Ordian
44c00b1f74 [trace] introduce trace failed to Ext (#11019)
* [trace] add trace_failed to Ext, manage stack of trace data

* [evm] call trace_failed only if self.do_trace

* [evm] add a comment about do_trace set to true

* [vm] improve the doc in trace_prepare_execute

* [trace] add the bounds check back
2019-09-05 16:11:51 +02:00
Niklas Adolfsson
8c286125e6
[private-tx] remove unused rand (#11024) 2019-09-05 13:26:28 +02:00
David
d193ddde19
Extract snapshot to own crate (#11010)
* Move snapshot to own crate
Sort out imports

* WIP cargo toml

* Make snapshotting generic over the client
Sort out tests

* Sort out types from blockchain and client

* Sort out sync

* Sort out imports and generics

* Sort out main binary

* Fix sync test-helpers

* Sort out import for secret-store

* Sort out more imports

* Fix easy todos

* cleanup

* Cleanup

* remove unneded workspace member

* cleanup

* Sort out test-helpers dependency on account-db

* Update ethcore/client-traits/src/lib.rs

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

* Update ethcore/snapshot/Cargo.toml
2019-09-03 11:29:25 +02:00
Niklas Adolfsson
a9cb572238 EIP 1108: Reduce alt_bn128 precompile gas costs (#11008)
* feat: implement eip1108

* doc nit: price per point pair

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

* fix: test-build

* fix: update chain specs

* fix: basic_authority.json chain spec

* fix: change `eip_transition == 0x7fffffffffffff`

* add issue link to `TODO`
2019-09-02 11:38:27 +02:00
Wei Tang
00124b5a4b
Implement EIP-1283 reenable transition, EIP-1706 and EIP-2200 (#10191)
* Add reentry protection for EIP-1283

* typo: should use <=

* Put things behind flag eip1706

* Fix compile

* Fix missing config in json and add eip1283_reenable_transition
2019-08-29 21:31:52 +02:00
David
dabfa2c663 EIP 1884 Re-pricing of trie-size dependent operations (#10992)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* Extract the Clique engine to own crate

* Extract NullEngine and the block_reward module from ethcore

* Extract InstantSeal engine to own crate

* Extract remaining engines

* Extract executive_state to own crate so it can be used by engine crates

* Remove snapshot stuff from the engine crate

* Put snapshot traits back in ethcore

* cleanup

* Remove stuff from ethcore

* Don't use itertools

* itertools in aura is legit-ish

* More post-merge fixes

* Re-export less types in client

* cleanup

* Extract spec to own crate

* Put back the test-helpers from basic-authority

* Fix ethcore benchmarks

* Reduce the public api of ethcore/verification

* WIP

* Add Cargo.toml

* Fix compilation outside ethcore

* Audit uses of import_verified_blocks() and remove unneeded calls
Cleanup

* cleanup

* Remove unused imports from ethcore

* Cleanup

* remove double semi-colons

* Add missing generic param

* More missing generics

* Update ethcore/block-reward/Cargo.toml

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

* Update ethcore/engines/basic-authority/Cargo.toml

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

* Update ethcore/engines/ethash/Cargo.toml

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

* Update ethcore/engines/clique/src/lib.rs

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

* signers is already a ref

* Add an EngineType enum to tighten up Engine.name()

* Add CHAINID opcode

* Introduce Snapshotting enum to distinguish the type of snapshots a chain uses

* Rename supports_warp to snapshot_mode

* Missing import

* Add chain_id wherever we instantiate EnvInfo

* more missing chain_id

* Tell serde to ignore the chain_id field on Env

* Update ethcore/src/snapshot/consensus/mod.rs

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

* Use the chain_id from the machine by adding chain_id() to the Ext trait

* cleanup

* add missing impl
cleanup

* missing import

* Fix import

* Add transition marker for EIP 1344

* double semi

* Fix merge problem

* cleanup

* reprice SLOAD to 800 gas

* Reprice BALANCE and EXTCODEHASH

* Add SELFBALANCE opcode

* Add test for SELFBALANCE
Use InstructionParams.address as the self-address

* Use easier to read values in test

* merge conflict error

* Fix a few warnings

* Update ethcore/vm/src/schedule.rs

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

* more merge fallout
2019-08-29 13:19:55 +02:00
phahulin
3420c2bac0 xDai chain support and nodes list update (#10989)
* Update bootnodes list for known networks

* Add XDai chain

* Rename xdai chain in config

* Fix missing comma
2019-08-29 09:33:33 +02:00
Andronik Ordian
4f12d7ad12 [trace] check mem diff within range (#11002) 2019-08-28 18:24:06 +02:00
David
5ce249ac64 EIP-1344 Add CHAINID op-code (#10983)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* Extract the Clique engine to own crate

* Extract NullEngine and the block_reward module from ethcore

* Extract InstantSeal engine to own crate

* Extract remaining engines

* Extract executive_state to own crate so it can be used by engine crates

* Remove snapshot stuff from the engine crate

* Put snapshot traits back in ethcore

* cleanup

* Remove stuff from ethcore

* Don't use itertools

* itertools in aura is legit-ish

* More post-merge fixes

* Re-export less types in client

* cleanup

* Extract spec to own crate

* Put back the test-helpers from basic-authority

* Fix ethcore benchmarks

* Reduce the public api of ethcore/verification

* WIP

* Add Cargo.toml

* Fix compilation outside ethcore

* Audit uses of import_verified_blocks() and remove unneeded calls
Cleanup

* cleanup

* Remove unused imports from ethcore

* Cleanup

* remove double semi-colons

* Add missing generic param

* More missing generics

* Update ethcore/block-reward/Cargo.toml

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

* Update ethcore/engines/basic-authority/Cargo.toml

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

* Update ethcore/engines/ethash/Cargo.toml

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

* Update ethcore/engines/clique/src/lib.rs

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

* signers is already a ref

* Add an EngineType enum to tighten up Engine.name()

* Add CHAINID opcode

* Introduce Snapshotting enum to distinguish the type of snapshots a chain uses

* Rename supports_warp to snapshot_mode

* Missing import

* Add chain_id wherever we instantiate EnvInfo

* more missing chain_id

* Tell serde to ignore the chain_id field on Env

* Update ethcore/src/snapshot/consensus/mod.rs

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

* Use the chain_id from the machine by adding chain_id() to the Ext trait

* cleanup

* add missing impl
cleanup

* missing import

* Fix import

* Add transition marker for EIP 1344

* double semi

* Fix merge problem

* cleanup

* merge conflict error

* Fix a few warnings

* Update ethcore/vm/src/schedule.rs

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

* more merge fallout
2019-08-28 16:15:50 +02:00
David
cd26526868
Make ClientIoMessage generic over the Client (#10981)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* Extract the Clique engine to own crate

* Extract NullEngine and the block_reward module from ethcore

* Extract InstantSeal engine to own crate

* Extract remaining engines

* Extract executive_state to own crate so it can be used by engine crates

* Remove snapshot stuff from the engine crate

* Put snapshot traits back in ethcore

* cleanup

* Remove stuff from ethcore

* Don't use itertools

* itertools in aura is legit-ish

* More post-merge fixes

* Re-export less types in client

* cleanup

* Extract spec to own crate

* Put back the test-helpers from basic-authority

* Fix ethcore benchmarks

* Reduce the public api of ethcore/verification

* WIP

* Add Cargo.toml

* Fix compilation outside ethcore

* Audit uses of import_verified_blocks() and remove unneeded calls
Cleanup

* cleanup

* Remove unused imports from ethcore

* Cleanup

* remove double semi-colons

* Add missing generic param

* More missing generics

* Update ethcore/block-reward/Cargo.toml

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

* Update ethcore/engines/basic-authority/Cargo.toml

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

* Update ethcore/engines/ethash/Cargo.toml

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

* Update ethcore/engines/clique/src/lib.rs

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

* signers is already a ref

* Add an EngineType enum to tighten up Engine.name()

* Introduce Snapshotting enum to distinguish the type of snapshots a chain uses

* Rename supports_warp to snapshot_mode

* Missing import

* Update ethcore/src/snapshot/consensus/mod.rs

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

* missing import

* Fix import

* double semi

* Fix merge problem

* cleanup

* Parametrise `ClientIoMessage` with `()` for the light client

* Add impl Tick for ()

* Address review feedback

* Move ClientIoMessage to common-types

* remove superseeded fixme

* fix merge conflict errors
2019-08-28 10:09:42 +02:00
Niklas Adolfsson
dab2a6bd4b fix compile warnings (#10993)
* fix warnings

* fix: failing build, use `spec` as dev-dependency
2019-08-27 17:29:33 +02:00
David
fbf425c4e2 Extract spec to own crate (#10978)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* Extract the Clique engine to own crate

* Extract NullEngine and the block_reward module from ethcore

* Extract InstantSeal engine to own crate

* Extract remaining engines

* Extract executive_state to own crate so it can be used by engine crates

* Remove snapshot stuff from the engine crate

* Put snapshot traits back in ethcore

* cleanup

* Remove stuff from ethcore

* Don't use itertools

* itertools in aura is legit-ish

* More post-merge fixes

* Re-export less types in client

* cleanup

* Extract spec to own crate

* Put back the test-helpers from basic-authority

* Fix ethcore benchmarks

* Reduce the public api of ethcore/verification

* Update ethcore/block-reward/Cargo.toml

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

* Update ethcore/engines/basic-authority/Cargo.toml

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

* Update ethcore/engines/ethash/Cargo.toml

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

* Update ethcore/engines/clique/src/lib.rs

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

* signers is already a ref

* Add an EngineType enum to tighten up Engine.name()

* Introduce Snapshotting enum to distinguish the type of snapshots a chain uses

* Rename supports_warp to snapshot_mode

* Missing import

* Update ethcore/src/snapshot/consensus/mod.rs

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

* missing import

* Fix import

* double semi
2019-08-23 15:32:58 +02:00
David
79b671f6c7 EIP 2028: transaction gas lowered from 68 to 16 (#10987) 2019-08-23 14:13:02 +02:00
David
2af3140a26
Extract engines to own crates (#10966)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* Extract the Clique engine to own crate

* Extract NullEngine and the block_reward module from ethcore

* Extract InstantSeal engine to own crate

* Extract remaining engines

* Extract executive_state to own crate so it can be used by engine crates

* Remove snapshot stuff from the engine crate

* Put snapshot traits back in ethcore

* cleanup

* Remove stuff from ethcore

* Don't use itertools

* itertools in aura is legit-ish

* More post-merge fixes

* Re-export less types in client

* cleanup

* Update ethcore/block-reward/Cargo.toml

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

* Update ethcore/engines/basic-authority/Cargo.toml

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

* Update ethcore/engines/ethash/Cargo.toml

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

* Update ethcore/engines/clique/src/lib.rs

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

* signers is already a ref

* Add an EngineType enum to tighten up Engine.name()

* Introduce Snapshotting enum to distinguish the type of snapshots a chain uses

* Rename supports_warp to snapshot_mode

* Missing import

* Update ethcore/src/snapshot/consensus/mod.rs

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

* remove double-semicolons
2019-08-22 18:25:49 +02:00
Vladimir Komendantskiy
efb390eb60 Configuration map of block reward contract addresses (#10875)
* configuration map of block reward contract addresses

* Revert test module updates.

* re-added block reward transition map tests and docs

* review comment
2019-08-22 10:45:24 +02:00
Andreas Fackler
175051bac7 Add a 2/3 quorum option to Authority Round. (#10909)
* Add a 2/3 quorum option to Authority Round.

This prevents the "Attack of the Clones":
https://arxiv.org/pdf/1902.10244.pdf

* Make RollingFinality::remove_signers more tolerant.

* Rename parameter to two_thirds_majority_transition.
2019-08-21 14:55:51 +02:00
Anton Gavrilov
66e4410be7
Private contract migration and offchain state sync (#10748)
* Temp storage for the private state added

* Temp storage for the private state added

* Request message added

* Store and retrieve offchain state logic

* State sync cache

* Private state column added to key value db

* Private state column added to key value db

* Indexing stored states via its hash

* Works with errors changed

* Private state stored into the local db

* Access to private state db added to sync io

* Private state db file added

* Rlp packets for retrieiving private state data added

* Handling of private sync completed message

* Test code fixed

* External flag for offchain storing added

* Test for private state sync added

* Saving private state logic corrected

* Migration code corrected

* Fixes after merge with master

* Merge with head

* Additional checks for slices

* Log for private state retrieval added

* Limit time of retrieving private states

* Store required hashes for every request, mark them stale if needed

* Store requested private state hashes and check received data

* Log stale requests

* State insertion fix

* Refactoring of how logging passed to state store

* Heapsize removed, syncing hashes structure reworked

* Check state length returned by contract

* Get rid of OverlayDB

* hash-db version updated

* Test fixed

* One more test fixed
2019-08-16 14:45:52 +02:00
David
6a9de9b11e
Extract the Engine trait (#10958)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract

* Move many traits from ethcore/client/traits to client-traits crate
Initial version of extracted Engine trait

* Move snapshot related traits to the engine crate (eew)

* Move a few snapshot related types to common_types
Cleanup Executed as exported from machine crate

* fix warning

* Gradually introduce new engine crate: snapshot

* ethcore typechecks with new engine crate

* Sort out types outside ethcore

* Add an EpochVerifier to ethash and use that in Engine.epoch_verifier()
Cleanup

* Document pub members

* Sort out tests
Sort out default impls for EpochVerifier

* Add test-helpers feature and move EngineSigner impl to the right place

* Sort out tests

* Sort out tests and refactor verification types

* Fix missing traits

* More missing traits
Fix Histogram

* Fix tests and cleanup

* cleanup

* Put back needed logger import

* Don't rexport common_types from ethcore/src/client
Don't export ethcore::client::*

* Remove files no longer used
Use types from the engine crate
Explicit exports from engine::engine

* Get rid of itertools

* Move a few more traits from ethcore to client-traits: BlockChainReset, ScheduleInfo, StateClient

* Move ProvingBlockChainClient to client-traits

* Don't re-export ForkChoice and Transition from ethcore

* Address grumbles: sort imports, remove commented out code

* Fix merge resolution error

* merge failure
2019-08-15 17:59:22 +02:00
Seun LanLege
1ba4df08f9 Better error message for rpc gas price errors (#10931)
* Better error message for rpc gas price errors

* correct tests

* dedupe error variants

* fixed tests, removed spacing
2019-08-15 16:48:41 +02:00
Anton Gavrilov
fd75491103 Verify transaction against its block during import (#10954)
* Verify transaction against its block during import

* Client method for transaction verification added

* Verification methods united

* Verification sequence for transaction verifier returned
2019-08-15 16:10:39 +02:00
David
ef47426a93 [evmbin] fix compilation (#10976)
* Fix compilation error

Include the test-helpers from `machine` (used by json-tests, although I'm not sure why evmbin needs ethcore/json-tests)

* Update to edition
2019-08-15 16:06:43 +02:00
cheme
5807402a0b Update to latest trie version. (#10972)
* 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>

* Rem import braces

* switch deps to simple-codec branch (code broken)

* painfull update of trie and memdb, plus rework codec to be compatible
with simple_codec changes

* Removed useless implementation from trait.

* Remove some malloc size until update and patch triehash, seems ok
otherwhise.

* Update parity-util-mem.

* Switch to published triehash 0.8.

* Avoid redundancy in encode_partial functions.
Use better namings.

* Update util/patricia-trie-ethereum/src/rlp_node_codec.rs

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

* Update util/patricia-trie-ethereum/src/rlp_node_codec.rs

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

* Restore previous child rlp header length check.
Better comments and formatting.

* Update util/patricia-trie-ethereum/src/rlp_node_codec.rs

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

* Update util/patricia-trie-ethereum/src/rlp_node_codec.rs

Co-Authored-By: David <dvdplm@gmail.com>
2019-08-15 15:36:48 +02:00
Andreas Fackler
a23f5b8fd9 Fix ethcore/benches build. (#10964) 2019-08-13 15:27:28 +02:00
David
73f4564b66
Extract Machine from ethcore (#10949)
* Add client-traits crate
Move the BlockInfo trait to new crate

* New crate `machine`
Contains code extracted from ethcore that defines `Machine`, `Externalities` and other execution related code.

* Use new machine and client-traits crates in ethcore

* Use new crates machine and client-traits instead of ethcore where appropriate

* Fix tests

* Don't re-export so many types from ethcore::client

* Fixing more fallout from removing re-export

* fix test

* More fallout from not re-exporting types

* Add some docs

* cleanup

* import the macro edition style

* Tweak docs

* Add missing import

* remove unused ethabi_derive imports

* Use latest ethabi-contract
2019-08-13 12:33:34 +02:00
Marek Kotewicz
509fda727b removed redundant state_root function from spec, improve spec error types (#10955) 2019-08-12 16:10:46 +02:00
Adam Z. Nagy
ffc066e5a4 Add support for Energy Web Foundation's new chains (#10957)
* add(chain-support): new ewf chains support added

- volta test network
- ewc production chain

* remove(tobalaba): ewf chain tobalaba support removal

- tobalaba is deprecated so not officially supported by ewf any more
2019-08-12 13:20:12 +02:00
Marek Kotewicz
45978bc2bd unify loading spec && further spec cleanups (#10948)
* bundle_* macros for spec

* fixed failing tests

* renamed bundle.rs to chain.rs

* removed unused derives

* updated spec/chain.rs description
2019-08-07 16:52:48 +02:00
Luke Schoen
c689495826 refactor: Refactor evmbin CLI (#10742)
* docs: Add comments to run_transaction arguments

* docs: Add general state test example from github.com/ethereum/test

* docs: Add state test file used in ethjson

* refactor: Reorder CLI options. Modify CLI descriptions. See commit comments

* Reorder parity-evm CLI options
* Update descriptions for CLI options
* Change to `--chain PATH` (general) and `--chain CHAIN` (state test)
* Remove unncessary 'Display result state dump in standardized JSON format.

* refactor: Move  function to be ordered after

* refactor: Refactor run_state_test

* refactor: Modify run_stats_jsontests_vm comment to be more specific

* refactor: Refactor run_call

* refactor: Update Args struct including rustdocs

* refactor: Reorder functions in Args struct to match other orders

* tests: Update tests for evmbin

* revert unintentional changes

* comply with style guide

* docs: Info and Display Modules made public so appear in rustdocs

* docs: Rename VM to EVM

* docs: Update rustdocs

* docs: Update state-test cli command comments

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

* docs: Update chain path cli command description

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

* docs: Prefix to specify only one chain type to be provided

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

* docs: Update to be lowercase fat

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

* rename err to stderr, out to stdout

* revert to wei for gas price

* review-fix: Do not expose private modules but still show docs

View docs with:
```
cargo doc -p evmbin --document-private-items --open
```

* test: Read from file. Add initial tests for state-test CLI command

* review-fix: Change to single TODO that links to new issue to create integration tests

* refactor: Move run_transaction params into fields of a TxInput struct and make doc comments of its fields (#10769)

* Question

* refactor: Further changes for doc comments to be part of public struct

* refactor: Rename InputData to TxInput for clarity in docs

* docs: Change String to fixed length str

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

* refactor: Update evmbin/src/info.rs moving mut into fn declaration

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

* refactor: Update evmbin/src/info.rs moving mut into fn declaration part 2

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

* review-fix: Add missing docs to TxInput transaction and trie_spec

* docs: Improve grammar

* review-fix: Destructure tx_input

* WIP

* review-fix: Rename variables of InputTx

* rename `spec_from_json` to `fork_spec_from_json`
* rename `name` to `state_test_name`
* rename `spec` to `fork_spec_name`
* rename `spec_checked` to `fork_spec`

* review-fix: Rename idx to tx_index

* fix indentation

* review-fix: Add missing part of tests. Yet to fix tests and add assertions

* [evmbin] remove state-db dependency

* [evmbin] run_transaction returns bool

* [evmbin] more cleanup
2019-08-07 16:51:08 +02:00
Marek Kotewicz
46954527e7 journaldb changes (#10929)
* inject_batch && commit_batch are no longer a part of journaldb

* get rid of redundant KeyedHashDB trait

* journaldb edition 2018

* journaldb trait moved to the lib.rs file

* making journaldb more idiomatic

* fix parity_bytes reexport

* rename parity-util-mem package in Cargo.toml file
2019-08-07 01:45:10 +02:00
Seun LanLege
72279856cd Allow default block parameter to be blockHash (#10932)
* allow default block parameter to be blockHash

* requireCanonical

* block check takes precedence over canon check
2019-08-06 11:08:05 +02:00
Anton Gavrilov
13ccb9f827 Enable sealing when engine is ready (#10938) 2019-08-06 11:07:27 +02:00
Andreas Fackler
1503348782 Fix some warnings and typos. (#10941) 2019-08-06 11:07:07 +02:00
Ao Li
8e0c522931 Change the return type of step_inner function. (#10940)
* Change the return type of step_inner function.

* Fix indention.
2019-08-05 14:58:48 +02:00
Marek Kotewicz
6c7d0fef4e
get rid of hidden mutability of Spec (#10904)
* get rid of hidden mutabilityof Spec

* small cleanups

* fixed SpecHardcodedSync printing
2019-07-30 12:48:54 +02:00
Marek Kotewicz
12256a1e97
simplify BlockReward::reward implementation (#10906)
* simplify BlockReward::reward implementation

* fixed failing tests
2019-07-30 12:05:06 +02:00
Vladimir Komendantskiy
ee9bfac625 additional arithmetic EVM opcode benchmarks (#10916) 2019-07-29 15:50:57 +02:00
Marek Kotewicz
d1b28bf57e
remove verify_transaction_unordered from engine (#10891) 2019-07-21 21:15:08 +02:00
Marek Kotewicz
fa1f81b5a3 cleanup ethcore ethereum module (#10899) 2019-07-18 14:22:59 +02:00
David
1ef9d5b52f Move more types out of ethcore (#10880)
* WIP move errors, pod_account and state account to own crates

* Sort out dependencies, fix broken code and tests
Remove botched ethcore-error crate

* remove template line

* fix review feedback

* Remove test-only AccountDBMut::new

* Extract AccountDB to account-db

* Move Substate to state-account – wip

* Add lib.rs

* cleanup

* test failure

* test failure 2

* third time's the charm

* Add factories crate

* Use new factories crate

* Use factories crate

* Extract trace

* Fix tests

* Sort out parity-util-mem and parking_lot

* cleanup

* WIP port over the rest of state from ethcore

* Collect all impls for Machine

* some notes

* Rename pod-account to pod

* Move PodState to pod crate

* Use PodState from pod crate

* Fix use clause for json tests

* Sort out evmbin

* Add missing code and use PodState

* Move code that depends on Machine and Executive to own module

* Sort out cloning errors, fix ethcore to use new state crate

* Do without funky From impls

* Fix ethcore tests

* Fixes around the project to use new state crate

* Add back the more specific impls of StateOrBlock From conversions

* Move execute to freestanding function and remove it from trait
Sort out the error handling in executive_state by moving the result types from state to ethcore
Undo the verbose code added to work around the StateOrBlock From conversions

* cleanup

* Fix "error: enum variants on type aliases are experimental"

* Bring back the state tests
Fix whitespace

* remove ethcore/state/mod.rs

* cleanup

* cleanup

* Cleanup state-account errors

* Fix more todos
Add module docs

* Add error.rs

* Fixup Cargo.lock

* Smaller ethcore API is fine

* Add `to-pod-full` feature to state-account
Fix evmbin

* Fix a few more test failures

* Fix RPC test build

* Baptize the new trait

* Remove resolved TODOs

* Rename state-account to account-state

* Do not re-export the trace crate

* Don't export state_db from ethcore

* Let private-tx use StateDB. :(

* Remove ethcore/src/pod_state.rs

* Inner type does not need to be pub/pub(crate)

* optimise imports

* Revert "Inner type does not need to be pub/pub(crate)"

This reverts commit 2f839f8a0f72f71334da64620f57e6dd6039f06b.

* Move DatabaseExtras to ethcore-blockchain

* Add database_extra module to ethcore-blockchain

* Remove to-pod-full feature

* cosmetics

* New crate: state-db

* Add new crate

* Move PreverifiedBlock and BlockError to types

* Sort out the merge

* Add missing `license` meta data keys

* wip

* wip client-traits

* merge conflict

* verification crate type checks

* Move impls for CommonParams to common_types
Fix misc stuff in ethcore

* Fix tests

* Implement VerifyingEngine for all engines except Ethash
Temporarily sort out error handling
Move more types to common_types

* Split Engine in two and move code around

* cleanup

* verification: don't rexport common_types

* Use error from common_types

* Consolidate error types

* VerifyingEngine use Errors from common_types

* verification: Use error type from common_types

* SnapshotError moved to common_types

* Move more code from Engne to VerifyingEngine
Add a VerifyingClient trait: BlockInfo + CallContract
Whitespace

* Add MAX_UNCLE_AGE const

* Port over remaining code from ethcore/verification

* Use errors from common_types

* Fix the confusing "io" naming

* Move more types into common_types

* Add todos

* Experiment with Engine trait outside ethcore

* Hook up types from common_types in ethcore
Don't use verification crate
Don't use client-traits crate

* Revert to impl Engine for Arc<Ethash> and add note to explain why
Revert moving ClientIoMessage to common_types
Fix build

* Remove ClientIoMessage from common_types

* Cleanup

* More cleanup

* Sort error handling changes in the rest of parity

* Remove unused code

* Remove WIP types

* Cleanup todos not tackled here

* remove cruft

* Fix some whitespace and a merge error

* ethcore tests

* test failures

* Restore Engine impls to master to make review a bit easier

* cleanup

* whitespace

* applied review suggestions

* types does not depend on rustc-hex

* ethash engine moved to engine module

* applied review suggestion
2019-07-18 12:27:08 +02:00
Marek Kotewicz
7f707fa524
return block nonce when engine is clique (#10892)
* return block nonce when engine is clique, closes #10534

* Apply suggestions from code review

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2019-07-16 12:52:29 +02:00
Marek Kotewicz
c62e97d3c4 TransactionQueue::import accepts iterator (#10889) 2019-07-16 12:46:13 +02:00
Marek Kotewicz
27d1c2d7d1 rename is_pruned to is_prunable (#10888) 2019-07-16 12:45:24 +02:00
Marek Kotewicz
e3665ed9e3 simplify create_address_scheme (#10890)
* simplify create_address_scheme

* fix compilation errors
2019-07-16 12:43:46 +02:00
David
14e7641835 Move DatabaseExtras back to trace (#10868)
* Move DatabaseExtras back to trace
Add a new BlockChainWithExtras newtype to ethcore
Impl DatabaseExtras for BlockChainWithExtras

* Avoid double Arcs
Impl From for BlockChainWithExtras for convenient instantiation
Change TraceDB::new to take a T: DatabaseExtras (instead of an Arc)

* Use local type for BlockNumber and reduce dependencies

* Update ethcore/src/client/client.rs

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

* Update ethcore/src/client/client.rs

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

* Revert "Update ethcore/src/client/client.rs"

This reverts commit cbf8a251d4acaff8b29e999aedcdaac473ddf300.

* Revert "Update ethcore/src/client/client.rs"

This reverts commit 2518873b3139e832fa57c11793624bf1bfe48d05.

* address grumbles

* Be explicit about using the BlockProvider provided block_hash()
2019-07-14 18:35:43 +02:00
Marek Kotewicz
cfe826fae9
whisper is no longer a part of parity-ethereum repo (#10855)
* whisper is no longer a part of parity-ethereum repo

* fix failing tests

* update whisper help with the link to the new repo

* Removed AttachedProtocols

* updated whisper info in README.md files

* Update parity/deprecated.rs

Co-Authored-By: Andronik Ordian <write@reusable.software>
2019-07-12 14:15:30 +02:00
Marek Kotewicz
34cdeac2a6 Move the substate module into ethcore/executive (#10867)
* substate is not a part of account-state

* fn cleanup_mode is a part of executive.rs

* test_cleanup_mode
2019-07-10 11:55:37 +03:00
David
f53c3e582c Run cargo fix on a few of the worst offenders (#10854)
* Run cargo fix on `vm`

* Run cargo fix on ethcore-db

* Run cargo fix on evm

* Run cargo fix on ethcore-light

* Run cargo fix on journaldb

* Run cargo fix on wasm

* Missing docs

* Run cargo fix on ethcore-sync
2019-07-09 09:04:20 +01:00
Marek Kotewicz
fdc7b0fdaa removed redundant fork choice abstraction (#10849) 2019-07-09 04:27:33 +02:00
David
0f337171bf Extract state-db from ethcore (#10858)
* WIP move errors, pod_account and state account to own crates

* Sort out dependencies, fix broken code and tests
Remove botched ethcore-error crate

* remove template line

* fix review feedback

* Remove test-only AccountDBMut::new

* Extract AccountDB to account-db

* Move Substate to state-account – wip

* Add lib.rs

* cleanup

* test failure

* test failure 2

* third time's the charm

* Add factories crate

* Use new factories crate

* Use factories crate

* Extract trace

* Fix tests

* Sort out parity-util-mem and parking_lot

* cleanup

* WIP port over the rest of state from ethcore

* Collect all impls for Machine

* some notes

* Rename pod-account to pod

* Move PodState to pod crate

* Use PodState from pod crate

* Fix use clause for json tests

* Sort out evmbin

* Add missing code and use PodState

* Move code that depends on Machine and Executive to own module

* Sort out cloning errors, fix ethcore to use new state crate

* Do without funky From impls

* Fix ethcore tests

* Fixes around the project to use new state crate

* Add back the more specific impls of StateOrBlock From conversions

* Move execute to freestanding function and remove it from trait
Sort out the error handling in executive_state by moving the result types from state to ethcore
Undo the verbose code added to work around the StateOrBlock From conversions

* cleanup

* Fix "error: enum variants on type aliases are experimental"

* Bring back the state tests
Fix whitespace

* remove ethcore/state/mod.rs

* cleanup

* cleanup

* Cleanup state-account errors

* Fix more todos
Add module docs

* Add error.rs

* Fixup Cargo.lock

* Smaller ethcore API is fine

* Add `to-pod-full` feature to state-account
Fix evmbin

* Fix a few more test failures

* Fix RPC test build

* Baptize the new trait

* Remove resolved TODOs

* Rename state-account to account-state

* Do not re-export the trace crate

* Don't export state_db from ethcore

* Let private-tx use StateDB. :(

* Remove ethcore/src/pod_state.rs

* Inner type does not need to be pub/pub(crate)

* optimise imports

* Revert "Inner type does not need to be pub/pub(crate)"

This reverts commit 2f839f8a0f72f71334da64620f57e6dd6039f06b.

* Move DatabaseExtras to ethcore-blockchain

* Add database_extra module to ethcore-blockchain

* Remove to-pod-full feature

* cosmetics

* New crate: state-db

* Add new crate

* Sort out the merge

* Fix unclean merge

* Add license
2019-07-08 22:01:47 +01:00
Nicolas Gotchac
073d242d1e Fix fork choice (#10837)
* Fix fork choice:
`is_from_route_finalized` check before switching to parent

* Add tests for `tree_route` with finalization

* Fix Cargo dependencies

* Add comment on `tree_route` for finalization.
Refactor a test.

* Fix compilation error

* Checkout Cargo.lock from master
2019-07-08 19:21:06 +02:00
David
44cc442d12
Move more code into state-account (#10840)
* WIP move errors, pod_account and state account to own crates

* Sort out dependencies, fix broken code and tests
Remove botched ethcore-error crate

* remove template line

* fix review feedback

* Remove test-only AccountDBMut::new

* Extract AccountDB to account-db

* Move Substate to state-account – wip

* Add lib.rs

* cleanup

* test failure

* test failure 2

* third time's the charm

* Add factories crate

* Use new factories crate

* Use factories crate

* Extract trace

* Fix tests

* Sort out parity-util-mem and parking_lot

* cleanup

* WIP port over the rest of state from ethcore

* Collect all impls for Machine

* some notes

* Rename pod-account to pod

* Move PodState to pod crate

* Use PodState from pod crate

* Fix use clause for json tests

* Sort out evmbin

* Add missing code and use PodState

* Move code that depends on Machine and Executive to own module

* Sort out cloning errors, fix ethcore to use new state crate

* Do without funky From impls

* Fix ethcore tests

* Fixes around the project to use new state crate

* Add back the more specific impls of StateOrBlock From conversions

* Move execute to freestanding function and remove it from trait
Sort out the error handling in executive_state by moving the result types from state to ethcore
Undo the verbose code added to work around the StateOrBlock From conversions

* cleanup

* Fix "error: enum variants on type aliases are experimental"

* Bring back the state tests
Fix whitespace

* remove ethcore/state/mod.rs

* cleanup

* cleanup

* Cleanup state-account errors

* Fix more todos
Add module docs

* Add error.rs

* Fixup Cargo.lock

* Smaller ethcore API is fine

* Add `to-pod-full` feature to state-account
Fix evmbin

* Fix a few more test failures

* Fix RPC test build

* Baptize the new trait

* Remove resolved TODOs

* Rename state-account to account-state

* Do not re-export the trace crate

* Don't export state_db from ethcore

* Let private-tx use StateDB. :(

* Remove ethcore/src/pod_state.rs

* Inner type does not need to be pub/pub(crate)

* optimise imports

* Revert "Inner type does not need to be pub/pub(crate)"

This reverts commit 2f839f8a0f72f71334da64620f57e6dd6039f06b.

* Move DatabaseExtras to ethcore-blockchain

* Add database_extra module to ethcore-blockchain

* Remove to-pod-full feature

* Sort out the merge

* sort imports

* address grumbles

* rename crate

* address more grumbles
2019-07-08 18:17:48 +02:00
Wei Tang
141f6a047e EIP-1702: Generalized Account Versioning Scheme (#10771)
* EIP-1702: Generalized Account Versioning Scheme

* Fix pWASM's `create` and `create2` contract creation version

* Update ethcore/src/snapshot/account.rs

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

* Update ethcore/src/factory.rs

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

* Add pWasm frontend config

* Add snapshot testing with version

* Fix merge conflict
2019-07-08 12:03:27 +02:00
Marek Kotewicz
fe7bc545bf
ethcore-builtin (#10850)
* ethcore-builtin

* rename ethcore-builtin Impl to Implementation
2019-07-07 16:59:30 +02:00
Marek Kotewicz
c4c5d79a0f removed QueueError type (#10852) 2019-07-06 20:40:56 +02:00
Marek Kotewicz
a6e96b052e
bump crossbeam (#10848) 2019-07-06 16:16:53 +02:00
Marek Kotewicz
86ef490a94 removed unused trait PrivateNotify and unused Error types (#10847) 2019-07-05 19:14:01 +02:00
Marek Kotewicz
b97bf81adf make fn submit_seal more idiomatic (#10843)
* make fn submit_seal more idiomatic

* applied review suggestions
2019-07-05 18:58:45 +02:00
Marek Kotewicz
d5584a01c7
update parking-lot to 0.8 (#10845) 2019-07-05 15:19:38 +02:00
David
de906d4afd
Improve logging and cleanup in miner around block sealing (#10745)
* Stop breaking out of loop if a non-canonical hash is found

* include expected hash in log msg

* More logging

* Scope

* Syntax

* Log in blank RollingFinality
Escalate bad proposer to warning

* Check validator set size: warn if 1 or even number

* More readable code

* Use SimpleList::new

* Extensive logging on unexpected non-canonical hash

* Wording

* wip

* Update ethcore/blockchain/src/blockchain.rs

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

* Improved logging, address grumbles

* Update ethcore/src/engines/validator_set/simple_list.rs

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>

* Report benign misbehaviour iff currently a validator

* Report malicious behaviour iff we're a validator

* Escalate to warning and fix wording

* Test reporting behaviour
Don't require node to be part of the validator set to report malicious behaviour

* Include missing parent hash in MissingParent error

* Update ethcore/src/engines/validator_set/simple_list.rs

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>

* docs

* remove unneeded into()
Move check for parent_step == step for clarity&efficiency
Remove dead code for Seal::Proposal

* typo

* Wording

* naming

* WIP

* cleanup

* cosmetics

* cosmetics and one less lvar

* spelling

* Better loggin when a block is already in chain

* More logging

* On second thought non-validators are allowed to report

* cleanup

* remove dead code

* Keep track of the hash of the last imported block

* Let it lock

* Serialize access to block sealing

* Take a lock while sealing a block

* Cleanup

* whitespace
2019-07-04 18:03:22 +02:00
David
fafb534cd3
Extract AccountDB to account-db (#10839)
* WIP move errors, pod_account and state account to own crates

* Sort out dependencies, fix broken code and tests
Remove botched ethcore-error crate

* remove template line

* fix review feedback

* Remove test-only AccountDBMut::new

* Extract AccountDB to account-db

* test failure

* test failure 2

* third time's the charm
2019-07-04 17:50:31 +02:00
David
9f96fa0a73 Extricate PodAccount and state Account to own crates (#10838)
* WIP move errors, pod_account and state account to own crates

* Sort out dependencies, fix broken code and tests
Remove botched ethcore-error crate

* remove template line

* fix review feedback

* Remove test-only AccountDBMut::new
2019-07-04 15:20:44 +02:00
David
582a4ea339
Break circular dependency between Client and Engine (part 1) (#10833)
* First draft: pass the parent block header to on_close_block

* typos and cleanup

* whitespace

* Store parent in ClosedBlock as well so it can be reopen()'d

* Don't pass parent when reopening a block

* Remove the unused ancestry param
2019-07-04 13:43:20 +02:00
Marek Kotewicz
8d24b4e804 idiomatic changes to PodState (#10834) 2019-07-03 10:57:50 +02:00
David
b4af8df535
When updating the client or when called from RPC, sleep should mean sleep (#10814)
Closes https://github.com/paritytech/parity-ethereum/issues/10687

`sleep()` is called from several places but when called from `disable()` or through the `setMode` RPC, we should ignore queue contents and go to sleep.
2019-07-02 21:26:26 +02:00
Marek Kotewicz
9d9e2b43f2 ethcore does not use byteorder (#10829) 2019-07-02 09:06:27 +02:00
David
5dc5be1e58
Better logging when backfilling ancient blocks fail (#10796)
* Better logging when backfilling ancient blocks fail
Print total blocks imported, closes #10792

* `finalize()` doesn't need Engine
Pull out call to migrated_blocks() from replace_client_db()

* More logs

* Clarify that the percentage may be misleading

* Remove replace_client_db() and replace with a straight call to restore_db()

* Include the parent_hash in UnlinkedAncientBlockChain errors

* Add a new RestorationStatus varian: Finalizing (as it can take a loooong while)
Call abort_restore() when restoration fails

* Add missing cases for new variant

* typos

* Typo and derive Debug

* Do not attempt to salvage existing blocks unless they form a complete chain back to genesis

* Fix test

* Revert "Fix test"

This reverts commit f027d4b4cb7b6c23fceec528c1711886ba9cfe4e.

* Fix test again

* Update comment

* Be careful about locks

* fix test failure

* Do not defer returning an error when the chain is broken

* Review feedback

* no hex formatting for Option
2019-07-01 14:41:45 +02:00
Marek Kotewicz
8fc504eb1a removed additional_params method (#10818) 2019-06-29 09:31:15 +02:00
Mohammad Rezaei
c1b3d5fe1a Add Constantinople eips to the dev (instant_seal) config (#10809)
Without EIP-1283
Fixes #10753
2019-06-28 16:17:33 +02:00
Marek Kotewicz
e53bf9a95e removed redundant fmt::Display implementations (#10806)
* removed redundant fmt::Display implementations for Account and State Diff

* bring back is_full() method

* fix failing test
2019-06-28 14:58:27 +02:00
Fabio Lama
3f61f2d8d9 Add filtering capability to parity_pendingTransactions (issue 8269) (#10506)
* expand parameters for pending_transactions()

* move ready_transactions content into filtered method

* apply filter based on tx_hash, sender or receiver

* call filtered transactions from RPC interface

* attempt at testing...

* replace parameters with _ on light client

* addes some comments

* removed uncompleted tests in miner.rs

* attempt at testing, needs more work...

* Formatting for ready_transactions_filtered

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

* Use map_or instead of if-let

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

* additional map_or replacement

* change receiver type to Option<Option<Address>>

* remove faulty MiningService tests, test RPC later

* remove tx hash from pending transaction filtering

* as_unsigned() method for SignedTransaction

* implement Deserialize for FilterOptions

* implement Validate for MapAccess type

* additional formatting

* directly name cover in pattern matching

* test valid vull deserialization

* test valid sender operators

* test valid receiver operators

* test valid gas operators

* test valid gas price operators

* test valid value operators

* test valid nonce operators

* additional tsets for defaults, unknown filter types, unknown operators and some renames

* move filter_options to ethcore to avoid package cycling

* adjusted function/method parameters for FilterOptions

* implement filter for sender and receiver

* implement filter for gas

* implement filter for gas price, tx value and nonce

* improve filtering implementation; use common function, use combinators

* improved documentation for FilterOptions

* small documentation adjustments

* remove warnings

* replace FilterOperator::ContractCreation with FilterOperator::Eq(None)

* implement validate_receiver

* make small changes like renames, preamble

* cleanup code according to suggestions, add docs

* small improvements like formatting and newline
2019-06-28 09:27:59 +01:00
Marek Kotewicz
7f02a08741 removed EthEngine alias (#10805) 2019-06-28 10:18:18 +02:00
Anton Gavrilov
59f0eb7e6b Do not drop the peer with None difficulty (#10772)
* Treat peer with None difficulty as legit

* Temporarily enable release binary build - REMOVE BEFORE MERGE
2019-06-27 17:45:21 +02:00
Marek Kotewicz
afe14b42e2 ethcore-light uses bincode 1.1 (#10798) 2019-06-27 14:19:56 +02:00
Andreas Fackler
62832c93b0 Fix a few typos and unused warnings. (#10803) 2019-06-27 14:17:24 +02:00
Marek Kotewicz
1887080990 updated project to ansi_term 0.11 (#10799) 2019-06-27 13:34:40 +02:00
felix
edc38c2cee added new ropsten-bootnode and removed old one (#10794) 2019-06-27 18:10:00 +08:00
Marek Kotewicz
4489ca0a38 Cleanup unused vm dependencies (#10787) 2019-06-26 14:17:17 +02:00
Marek Kotewicz
3a2c173fe1 Removed redundant ethcore-service error type (#10788) 2019-06-26 14:16:58 +02:00
Marek Kotewicz
9c051ab756 Removed machine abstraction from ethcore (#10791) 2019-06-26 14:16:05 +02:00
David
825c7990f2
Log validator set changes in EpochManager (#10734)
* Stop breaking out of loop if a non-canonical hash is found

* include expected hash in log msg

* More logging

* Scope

* Syntax

* Log in blank RollingFinality
Escalate bad proposer to warning

* Check validator set size: warn if 1 or even number

* More readable code

* Use SimpleList::new

* Extensive logging on unexpected non-canonical hash

* Wording

* wip

* Update ethcore/blockchain/src/blockchain.rs

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

* Improved logging, address grumbles

* Update ethcore/src/engines/validator_set/simple_list.rs

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>

* Report benign misbehaviour iff currently a validator

* Report malicious behaviour iff we're a validator

* Escalate to warning and fix wording

* Test reporting behaviour
Don't require node to be part of the validator set to report malicious behaviour

* Include missing parent hash in MissingParent error

* Update ethcore/src/engines/validator_set/simple_list.rs

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>

* cleanup

* On second thought non-validators are allowed to report

* cleanup

* remove dead code
2019-06-25 13:15:00 +02:00
Wei Tang
d743df549b Treat empty account the same as non-exist accounts in EIP-1052 (#10775) 2019-06-25 09:14:16 +02:00
Luke Schoen
6022c47b53 docs: Update Readme with TOC, Contributor Guideline. Update Cargo package descriptions (#10652)
* docs: Update Readme with TOC, Contributor Guide and License sections

* docs: Simplify package descriptions in Readme

* docs: Fix typos

* docs: Update Cargo package configs adding missing descriptions

* fix: Remove machine since was accidental from diff branch. Fix contribting indentation.

* fix: Fix formatting

* remove details snippet since not code and formats badly

* review-fix: Remove duplicate description

* fix dot point formatting

* fix: Add missing description to vm package

* fix: Remove duplicate Code of Conduct and Contributor guidelines

* docs: Update Contributing for consistency with other repos

* docs: Update Readme to link to existing Code of Conduct and Contributor guidelines in .github folder

* refactor: Add missing space

* fix: Fix links to be markdown format

* review-fix: Update CONTRIBUTING.md to link to Parity Ethereum Style Guide

* docs: Fix type in .github/CONTRIBUTING.md

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

* docs: Fix typo in .github/CONTRIBUTING.md

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

* docs: Rephrase parity-clib/Cargo.toml

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

* review-fix: Fix whole paragraph

* review-fix: Add comment to prevent direct pushes to master branch

* review-fix: Change some rules to recommendations

* Update .github/CONTRIBUTING.md

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

* review-fix: Replace feature reduction with breaking changes dot point

* review-fix: Rephrase what to do when reviewing PR

* review-fix: Update parity-rpc package description and module rustdocs

* docs: Add missing fullstop

* review-fix: Update rustdoc section to show all packages first as default

* review-fix: Rename Parity Util to Parity Core Libraries

* review-fix: Rename readme too for the C bindings name change

* review-fix: Remove some docs since we do not teach the reader Rust

* review-fix: Wrap Parity Ethereum specific packages in a details section

* review-fix: Separate tools that are in this repo vs those that are not

* review-fix: Add link to ethabi on crates.io

* review-fix: Remove unnecessary extra line talking about pushing to master

* review-fix: Remove useless summary of parts of the rust book documentation section

* docs: Update .github/CONTRIBUTING.md to specify two reviewers required

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

* docs: Update README.md with simplification

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

* docs: Update README.md renaming to Test Runner instead of just Run

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

* review-fix: Remove hardware wallet from docs

* review-fix: Remove veto PR section of contributor doc

* review-fix: Change to test generator title
2019-06-25 08:15:13 +02:00
Wei Tang
02eb046774
Move Engine::register_client to be before other I/O handler registration (#10767) 2019-06-24 15:10:42 +02:00
David
f2dd032884
Print warnings when using dangerous settings for ValidatorSet (#10733)
* Stop breaking out of loop if a non-canonical hash is found

* include expected hash in log msg

* More logging

* Scope

* Syntax

* Log in blank RollingFinality
Escalate bad proposer to warning

* Check validator set size: warn if 1 or even number

* More readable code

* Use SimpleList::new

* Extensive logging on unexpected non-canonical hash

* Wording

* Update ethcore/blockchain/src/blockchain.rs

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

* Improved logging, address grumbles

* Update ethcore/src/engines/validator_set/simple_list.rs

Co-Authored-By: Luke Schoen <ltfschoen@users.noreply.github.com>
2019-06-24 14:50:11 +02:00
Talha Cross
55c046cb88 ethcore/res: activate atlantis classic hf on block 8772000 (#10766) 2019-06-21 19:38:53 +02:00
Seun LanLege
213e007a4b Updated Bn128PairingImpl to use optimized batch pairing (#10765)
* Bn128PairingImpl uses pairing_batch method in bn

* updated Cargo.lock
2019-06-20 23:16:11 +02:00
Niklas Adolfsson
78d0a8696f fix: aura don't add SystemTime::now() (#10720)
This commit does the following:
- Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp
- Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform
depedent
- remove `#[cfg(not(time_checked_add))]` conditional compilation
2019-06-20 09:00:50 +02:00
David
4ee217ba7c Remove unused code (#10762) 2019-06-19 15:08:21 +01:00
cheme
6fc5014b4d
Remove calls to heapsize (#10432)
* update memorydb trait
* use malloc_size_of instead of heapsize_of
* use jemalloc as default allocator for parity client.
2019-06-19 13:54:05 +02:00
David
d2120ded56 Add a way to signal shutdown to snapshotting threads (#10744)
* Add a way to signal shutdown to snapshotting threads

* Pass Progress to fat_rlps() so we can abort from there too.

* Checking for abort in a single spot

* Remove nightly-only weak/strong counts

* fix warning

* Fix tests

* Add dummy impl to abort snapshots

* Add another dummy impl for TestSnapshotService

* Remove debugging code

* Return error instead of the odd Ok(())
Switch to AtomicU64
2019-06-19 10:13:09 +02:00
David
20248c443b
Use fewer threads for snapshotting (#10752)
* Use fewer threads for snapshotting

When taking a snapshot the current default number of threads is equal to half the number of **logical** CPUs in the system. On HT enabled CPUs this value seems a bit high, e.g. 6 snapshotting threads on a 6/12 core/hyperthread CPU. Maybe a better default value is half the number of physical cores?

* fix test
2019-06-17 11:12:48 +02:00
Andrew Jones
bf55db4c7e Die error_chain, die (#10747)
* Replace error chain for network error

* Fix usages and add manual From impls

* OnDemand Error and remove remaining dependencies

* Die error_chain, die.

* DIE

* Hasta la vista, baby
2019-06-17 08:44:59 +02:00
David
dbdb57a8c0
Fix deprectation warnings on nightly (#10746)
* Run `cargo fix` on ethcore

* Add note about funky import needed-but-not-needed

* Fix benches

* cargo fix blockchain
2019-06-14 18:48:35 +02:00
Talha Cross
bf4fa658f3
ethcore: enable ECIP-1054 for classic (#10731)
* config: enable atlantis on ethereum classic

* config: enable atlantis on morden classic

* config: enable atlantis on morden classic

* config: enable atlantis on kotti classic

* ethcore: move kotti fork block to 0xAEF49

* ethcore: move morden fork block to 0x4829BA

* ethcore: move classic fork block to 0x81B320

* remove trailing comma

* remove trailing comma

* fix chainspec

* ethcore: move classic fork block to 0x7fffffffffffffff
2019-06-11 19:55:05 +02:00
David
5da8da68cc
Stop breaking out of loop if a non-canonical hash is found (#10729)
* Stop breaking out of loop if a non-canonical hash is found

* include expected hash in log msg

* More logging

* Scope

* Syntax

* Log in blank RollingFinality
Escalate bad proposer to warning

* More readable code

* Extensive logging on unexpected non-canonical hash

* Wording
2019-06-10 18:58:14 +02:00
David
083dcc369b
Refactor Clique stepping (#10691)
* Use Drop to shutdown stepper thread
Make period == 0 an error and remove the Option from step_service

* Remove StepService

Remove StepService and spawn the stepping thread in `Clique::new()`. Don't store the thread handle and instead trust the `AtomicBool` to signal shutdown time.
Don't check for `period > 0`: we assume a valid chainspec file.

* Don't shutdown the stepper thread at all, just let it run until exit
Also: fix a few warnings and tests

* Put kvdb_memorydb back

* Warn&exit when engine is dropped
Don't sleep too long!

* Don't delay stepping thread

* Better formatting
2019-06-10 12:10:26 +02:00
Sfxdx
faf6f1f9ea Merge Notifier and TransactionsPoolNotifier (#10591)
* Merge `Notifier` and `TransactionsPoolNotifier`

* fix tests
2019-06-04 12:35:33 +01:00
Andronik Ordian
dae5d75dd6 Upgrade ethereum types (#10670)
* cargo upgrade "ethereum-types" --all --allow-prerelease

* [ethash] fix compilation errors

* [ethkey] fix compilation errors

* [journaldb] fix compilation errors

* [dir] fix compilation errors

* [ethabi] update to 0.7

* wip

* [eip-712] fix compilation errors

* [ethjson] fix compilation errors

* [Cargo.toml] add TODO to remove patches

* [ethstore] fix compilation errors

* use patched keccak-hash with new primitive-types

* wip

* [ethcore-network-devp2p] fix compilation errors

* [vm] fix compilation errors

* [common-types, evm, wasm] fix compilation errors

* [ethcore-db] Require AsRef instead of Deref for keys

* [ethcore-blockchain] fix some compilation errors

* [blooms-db] fix compilation errors

Thanks a lot @dvdplm :)

* we don't need no rlp ethereum feature

* [ethcore] fix some compilation errors

* [parity-ipfs-api] fix compilation error

* [ethcore-light] fix compilation errors

* [Cargo.lock] update parity-common

* [ethcore-private-tx] fix some compilation errors

* wip

* [ethcore-private-tx] fix compilation errors

* [parity-updater] fix compilation errors

* [parity-rpc] fix compilation errors

* [parity-bin] fix other compilation errors

* update to new ethereum-types

* update keccak-hash

* [fastmap] fix compilation in tests

* [blooms-db] fix compilation in tests

* [common-types] fix compilation in tests

* [triehash-ethereum] fix compilation in tests

* [ethkey] fix compilation in tests

* [pwasm-run-test] fix compilation errors

* [wasm] fix compilation errors

* [ethjson] fix compilation in tests

* [eip-712] fix compilation in tests

* [ethcore-blockchain] fix compilation in tests

* [ethstore] fix compilation in tests

* [ethstore-accounts] fix compilation in tests

* [parity-hash-fetch] fix compilation in tests

* [parity-whisper] fix compilation in tests

* [ethcore-miner] fix compilation in tests

* [ethcore-network-devp2p] fix compilation in tests

* [*] upgrade rand to 0.6

* [evm] get rid of num-bigint conversions

* [ethcore] downgrade trie-standardmap and criterion

* [ethcore] fix some warnings

* [ethcore] fix compilation in tests

* [evmbin] fix compilation in tests

* [updater] fix compilation in tests

* [ethash] fix compilation in tests

* [ethcore-secretstore] fix compilation in tests

* [ethcore-sync] fix compilation in tests

* [parity-rpc] fix compilation in tests

* [ethcore] finally fix compilation in tests

FUCK YEAH!!!

* [ethstore] lazy_static is unused

* [ethcore] fix test

* fix up bad merge

* [Cargo.toml] remove unused patches

* [*] replace some git dependencies with crates.io

* [Cargo.toml] remove unused lazy_static

* [*] clean up

* [ethcore] fix transaction_filter_deprecated test

* [private-tx] fix serialization tests

* fix more serialization tests

* [ethkey] fix smoky test

* [rpc] fix tests, please?

* [ethcore] remove commented out code

* Apply suggestions from code review

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

* [ethstore] remove unused dev-dependency

* [ethcore] remove resolved TODO

* [*] resolve keccak-hash TODO

* [*] s/Address::default()/Address::zero()

* [rpc] remove Subscribers::new_test

* [rpc] remove EthPubSubClient::new_test

* [ethcore] use trie-standardmap from crates.io

* [dir] fix db_root_path

* [ethcore] simplify snapshot::tests::helpers::fill_storage

* Apply suggestions from code review

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

* [ethcore-secretstore] resolve TODO in serialization

* [ethcore-network-devp2p] resolve TODO in save_key

* [Cargo.lock] update triehash

* [*] use ethabi from crates.io

* [ethkey] use secp256k1 from master branch

* [Cargo.lock] update eth-secp256k1
2019-06-03 15:36:21 +02:00
Lazaridis
33d3bfae8b introduce MissingParent Error, fixes #10699 (#10700) 2019-05-31 14:53:17 +02:00
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
Andreas Fackler
bf242552f3 Add SealingState; don't prepare block when not ready. (#10529) 2019-05-24 10:30:31 +02:00
David
752031a657
Fix compiler warning (that will become an error) (#10683)
* Remove annoying compiler warnings

* Fix compiler warning (that will become an error)

Fixes https://github.com/paritytech/parity-ethereum/issues/10648

I'm not sure this fix is Good™ but rustc seems happy enough.

There's a deeper issue which may or may not be related to this: the Engine is not shutdown properly and the `StepService` thread keeps running indefinitely after Ctrl-C (so `update_sealing()` is called repeatedly for 300sec). I don't think this is related to Clique as I've seen this happen on mainnet as well, but I wonder if the effects of it are worse for a PoA network where the node can create new blocks all on its own?

* Use saturating_sub

* WIP

* Fix warning, second attempt

The idea here is to avoid using `Arc::get_mut()` (which does not work: fails every time here) and instead trust `drop()` to do the right thing.

This is a conservative change. I think this can be reformed further, e.g. by `impl Drop for StepService` and halt the thread there, or even skip `join()`ing the thread entirely and trust the `AtomicBool` to signal shutdown. I also have doubts abut the `Option<StepService>`: seems a bit much to have an `Option` there and it makes things cumbersome.
2019-05-23 17:37:12 +02:00
David
26d1303034 Don't panic if extra_data is longer than VANITY_LENGTH (#10682)
* Don't panic if extra_data is longer than VANITY_LENGTH

Seems like `extra_data().len()` can be longer than 32 (was 39 here) so this fixes that panic.

* Update ethcore/src/engines/clique/mod.rs
2019-05-22 12:35:17 +02:00
David
c31ffab22e Remove annoying compiler warnings (#10679) 2019-05-21 16:12:49 +01:00
Seun LanLege
21a27fee9f Reset blockchain properly (#10669)
* delete BlockDetails from COL_EXTRA

* better proofs

* added tests

* PR suggestions
2019-05-21 13:52:48 +02:00
David
10c121a299
Remove support for hardware wallets (#10678)
* Remove support for hardware wallets

* Remove rpcs relative hardware support

* Remove libudev
2019-05-21 10:46:57 +02:00
Anton Gavrilov
5a581c1c90 Trivial journal for private transactions (#10056)
* Journal for private txs added

* Tests after adding logging to private tx fixed

* Logs getter and tests added

* Time and amount limit for logs added

* RPC method for log retrieving added

* Correct path name and time validation implemented

* References for parameters added, redundant cloning reworked

* References for parameters added, redundant cloning reworked

* Work with json moved to the separate struct

* Serialization test added

* Fixed build after the merge with head

* Documentation for methods fixed, redundant field removed

* Fixed error usages

* Timestamp trait implemented for std struct

* Commented code removed

* Remove timestamp source, rework serialization test

* u64 replaced with SystemTime

* Path made mandatory for logging

* Source of monotonic time added

* into_system_time method renamed

* Initialize time source by max from current system time and max creation time from already saved logs

* Redundant conversions removed, code a little bit reworked according to review comments

* One more redundant conversion removed, rpc call simplified
2019-05-14 11:21:21 +02:00
Niklas Adolfsson
87699f8de0
fix(compilation warnings) (#10649) 2019-05-13 15:10:25 +02:00
Uxío
de91a5532d Fix rinkeby petersburg fork (#10632) 2019-05-09 15:28:30 +02:00
varasev
e04a2f926a Update kovan.json to switch validator set to POA Consensus Contracts (#10628) 2019-05-07 11:16:21 +02:00
Andrew Jones
98b89c8e4f [ethcore] remove error_chain (#10616)
* Derive Display for BlockError

* Convert error_chain errors

* Convert ethcore usages of errors

* Fix remaining compile errors in ethcore

* Fix other crates

* Fix tests compilation

* Implement error for Snapshot error

* Remove redundant into
2019-05-06 15:06:20 +02:00
Hernando Castano
b30b54e446 Remove unused import (#10615) 2019-04-29 16:08:58 +02:00
Andronik Ordian
4723ea69a1 evm: add some mulmod benches (#10600)
* evm: add blockhash_mulmod bench

* evm: use num-bigint for mod ops
2019-04-29 12:09:23 +02:00
jwasinger
64fd64fd6b Clique: zero-fill extradata when the supplied value is less than 32 bytes in length (#10605) 2019-04-29 10:12:22 +02:00
phahulin
28eb05f032 Constantinople HF on POA Core (#10606)
* Constantinople HF on POA Core

Plan Constantinople/St.Petersfork HF on POA Core network at block 8582254.
Original PR in POA repository: https://github.com/poanetwork/poa-chain-spec/pull/110

* Remove extra empty line
2019-04-26 12:05:04 +02:00
Talha Cross
c5fa7aab43 update bootnodes (#10595)
* config: update goerli bootnodes

* config: update kotti bootnodes
2019-04-17 11:56:24 +02:00
IntegralTeam
944bf6a59e Watch transactions pool (#10558)
adds `parity_watchTransactionsPool`
2019-04-12 12:36:49 +01:00
Andrew Plaza
9e2b2b361c fix issue with compilation when 'slow-blocks' feature enabled (#10585)
change call to a `header()` function to the field `header`
2019-04-11 11:02:39 +01:00
Talha Cross
08f0573fb5
Reject crazy timestamps instead of truncating. (#10574) 2019-04-08 11:32:51 +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
Seun LanLege
fba63de974 RPC: Implements eth_subscribe("syncing") (#10311)
* implement eth_subscibe syncing

* fix imports

* add is_major_syncing to SyncProvider

* add eth_subscribe(syncing) support for light clients

* tests

* fix TestSyncClient

* correct LightFetch impl

* added currentBlock, startingBlock, highestBlock to PubSubSyncStatus

* fixed tests

* fix PR grumbles

* improve code style

* is_syncing -> syncing

* code style

* use ethereum types
2019-04-02 17:13:55 +02:00
Andrew Jones
d9673b0d6b tx-pool: check transaction readiness before replacing (#10526)
* Update to vanilla tx pool error

* Prevent a non ready tx replacing a ready tx

* Make tests compile

* Test ready tx not replaced by future tx

* Transaction indirection

* Use StateReadiness to calculate Ready in `should_replace`

* Test existing txs from same sender are used to compute Readiness

* private-tx: Wire up ShouldReplace

* Revert "Use StateReadiness to calculate Ready in `should_replace`"

This reverts commit af9e69c8

* Make replace generic so it works with private-tx

* Rename Replace and add missing docs

* ShouldReplace no longer mutable

* tx-pool: update to transaction-pool 2.0 from crates.io

* tx-pool: generic error type alias

* Exit early for first unmatching nonce

* Fix private-tx test, use existing write lock

* Use read lock for pool scoring
2019-04-01 10:48:51 +02:00
Thibaut Sardan
ec56b1f09d Update light client harcoded headers (#10547)
* kovan #10643457

* ropsten #5296129

* foundation #7460865

* classic #7747585

* indentation

* morden #3973121
2019-03-31 11:46:36 +02:00
Vladyslav Lupashevskyi
7b2afdfc8c Implement caching for service transactions checker (#10088)
* Tx permission contract improvement

* Take in account zero gas price certification when doing transact_contract

* DRY in ServiceTransactionChecker

* Fix typos and regroup mod

* Introduce CertifiedAddressesCache

* Introduce refresh_cache for CertifiedAddressesCache

* Add CertifiedAddressesCache read and write on checking

* Refresh CertifiedAddressesCache on new imported block

* Separate ChainInfo trait and fix errors after merge

* Do not fire an error when service txes contract does not exist

* WIP: Shared certified addresses cache between miner and client + use HashMap instead of BTreeMap

* Refactor refresh_cache for ServiceTransactionChecker

* Refresh cache fixes

* Add cache read in check_address + log when cache is used + improve code

* Remove ChainInfo from ServiceTransaction dependencies

* DRY ServiceTransactionChecker

* Fix Client and Miner in tests

* Fix node_filter test

* Fix Client::new in add_peer_with_private_config

* WIP: Separated ChainNotify from ethcore trait and implemented ChainNotify for ServiceTransactionChecker

* Fix watcher test

* Revert "Merge branch 'master' into master"

This reverts commit 4e7371dc109d022efe3087defc33d827998ce648, reversing
changes made to bffd73e5fd58a516bbf404281b51cf26422e181e.

* Revert "Fix watcher test"

This reverts commit bffd73e5fd58a516bbf404281b51cf26422e181e.

* Revert "WIP: Separated ChainNotify from ethcore trait and implemented ChainNotify for ServiceTransactionChecker"

This reverts commit 6e73d1e61fa15dc10ffd4fab63df29eabe9c3b3a.

* Revert "Fix Client::new in add_peer_with_private_config"

This reverts commit ec610a30bee95588d58b79edcc9e43c2ff90f1ad.

* Revert "Fix node_filter test"

This reverts commit 06a4b2de86317c902f579e912b40de0b0fbf6d78.

* Revert "Fix Client and Miner in tests"

This reverts commit 51bbad330ea6e7bdfc1516208cc8705d5d11516d.

* Implement ServiceTransactionChecker in miner and delegate it to client + revert unnecessary changes

* Merge master

* Code improvements

* Merge branch 'master' of https://github.com/paritytech/parity-ethereum

# Conflicts:
#	Cargo.lock
#	ethcore/private-tx/src/lib.rs
#	ethcore/src/miner/miner.rs
#	ethcore/src/miner/pool_client.rs
2019-03-31 10:39:38 +02:00
jwasinger
8840a293dd clique: make state backfill time measurement more accurate (#10551) 2019-03-30 20:28:32 +01:00