diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9063ac88a3d..e2cb77606d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,13 @@ test-linux: tags: - rust-stable +test-audit: + stage: test + script: + - scripts/gitlab/cargo-audit.sh + tags: + - rust-stable + build-linux: stage: build only: *releaseable_branches @@ -104,25 +111,18 @@ publish-awss3: tags: - shell -docs-jsonrpc: - stage: optional +publish-docs: + stage: publish only: - tags except: - nightly cache: {} script: - - scripts/gitlab/docs-jsonrpc.sh + - scripts/gitlab/publish-docs.sh tags: - shell -cargo-audit: - stage: optional - script: - - scripts/gitlab/cargo-audit.sh - tags: - - rust-stable - build-android: stage: optional image: parity/rust-android:gitlab-ci @@ -132,6 +132,7 @@ build-android: - scripts/gitlab/build-unix.sh tags: - rust-arm + allow_failure: true test-beta: stage: optional @@ -141,6 +142,7 @@ test-beta: - scripts/gitlab/test-all.sh beta tags: - rust-beta + allow_failure: true test-nightly: stage: optional diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f93fa90dc..c1d47c282c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,863 +1,154 @@ -## Parity-Ethereum [v2.1.3](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.3) (2018-10-16) +## Parity-Ethereum [v2.2.1](https://github.com/paritytech/parity-ethereum/releases/tag/v2.2.1) (2018-11-15) -Parity-Ethereum 2.1.3-stable is a release that fixes a consensus issue with the recent Constantinople release. Upgrading is mandatory whatever network you are connected to that plans enabling EIP-1283, e.g., Ropsten, Kovan, Ethereum. +Parity-Ethereum 2.2.1-beta is the first v2.2 release, and might introduce features that break previous work flows, among others: -The full list of included changes: - -- Beta release 2.1.3 backports ([#9749](https://github.com/paritytech/parity-ethereum/pull/9749)) - - Parity-version: mark 2.1.3 beta as critical - - Use signed 256-bit integer for sstore gas refund substate ([#9746](https://github.com/paritytech/parity-ethereum/pull/9746)) - - Add --force to cargo audit install script ([#9735](https://github.com/paritytech/parity-ethereum/pull/9735)) - - Heads ref not present for branches beta and stable ([#9741](https://github.com/paritytech/parity-ethereum/pull/9741)) - - Aura: fix panic on extra_info with unsealed block ([#9755](https://github.com/paritytech/parity-ethereum/pull/9755)) - -## Parity-Ethereum [v2.1.2](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.2) (2018-10-12) - -Parity-Ethereum 2.1.2-beta is a release that introduces **Constantinople** to the Ethereum client. Upgrading is strongly recommended. - -![europe-1803495_1280](https://user-images.githubusercontent.com/15729797/46785767-15f1e280-cd33-11e8-862a-458edfd73ecf.png) - -The following hardforks are supported by this release: - -- Ropsten testnet block `4_230_000` on October 14, 2018 (Constantinople) -- POA core mainnet block `5_329_160` on October 22, 2018 (CORE HF 2) -- Kovan testnet block `9_200_000` on October 25, 2018 (Constantinople, KIP-{4,6}) - -Running one of these networks, an upgrade to 2.0.7 or 2.1.2 is mandatory. More details can be found in Changelog below. - -Please note, the following deprecations in our distribution of binaries: - -- `arm*` targets are no longer served by parity, please consider (cross-)compiling from source yourself. -- `i*86` targets are no longer served by parity, please consider upgrading your operating system. -- Snapcraft is no longer maintained. please use binaries directly or your distro's repositories. - -The full list of included changes: - -- More backports for 2.1.2 ([#9733](https://github.com/paritytech/parity-ethereum/pull/9733)) - - Produce portable binaries ([#9725](https://github.com/paritytech/parity-ethereum/pull/9725)) - - HF in POA Core (2018-10-22) ([#9724](https://github.com/paritytech/parity-ethereum/pull/9724)) - - Use static call and apparent value transfer for block reward contract code ([#9603](https://github.com/paritytech/parity-ethereum/pull/9603)) - - Verify block syncing responses against requests ([#9670](https://github.com/paritytech/parity-ethereum/pull/9670)) - - Fix ancient blocks sync ([#9531](https://github.com/paritytech/parity-ethereum/pull/9531)) - - Add hardcoded headers ([#9730](https://github.com/paritytech/parity-ethereum/pull/9730)) - - Gitlab ci: releasable_branches: change variables condition to schedule ([#9729](https://github.com/paritytech/parity-ethereum/pull/9729)) -- Backports for beta 2.1.2 ([#9649](https://github.com/paritytech/parity-ethereum/pull/9649)) - - Parity-version: bump beta to 2.1.2 - - Ethcore: fix detection of major import ([#9552](https://github.com/paritytech/parity-ethereum/pull/9552)) - - Hardfork the testnets ([#9562](https://github.com/paritytech/parity-ethereum/pull/9562)) - - Docs(rpc): push the branch along with tags ([#9578](https://github.com/paritytech/parity-ethereum/pull/9578)) - - Remove snapcraft clean ([#9585](https://github.com/paritytech/parity-ethereum/pull/9585)) - - Fix (light/provider) : Make `read_only executions` only read-only ([#9591](https://github.com/paritytech/parity-ethereum/pull/9591)) - - Ci: fix regex 🙄 ([#9597](https://github.com/paritytech/parity-ethereum/pull/9597)) - - Docs(rpc): annotate tag with the provided message ([#9601](https://github.com/paritytech/parity-ethereum/pull/9601)) - - Update ropsten bootnodes ([#9602](https://github.com/paritytech/parity-ethereum/pull/9602)) - - HF in POA Sokol (2018-09-19) ([#9607](https://github.com/paritytech/parity-ethereum/pull/9607)) - - Fix(network): don't disconnect reserved peers ([#9608](https://github.com/paritytech/parity-ethereum/pull/9608)) - - Fix failing node-table tests on mac os ([#9633](https://github.com/paritytech/parity-ethereum/pull/9633)) - - Fix bad-block reporting no reason ([#9638](https://github.com/paritytech/parity-ethereum/pull/9638)) - - Ethcore-io retries failed work steal ([#9651](https://github.com/paritytech/parity-ethereum/pull/9651)) - - Remove master from releasable branches ([#9655](https://github.com/paritytech/parity-ethereum/pull/9655)) - - Test fix for windows cache name... ([#9658](https://github.com/paritytech/parity-ethereum/pull/9658)) - - Fix(light_fetch): avoid race with BlockNumber::Latest ([#9665](https://github.com/paritytech/parity-ethereum/pull/9665)) - - Calculate sha3 instead of sha256 for push-release. ([#9673](https://github.com/paritytech/parity-ethereum/pull/9673)) - - Ci: fix push script ([#9679](https://github.com/paritytech/parity-ethereum/pull/9679)) - - CI: Remove unnecessary pipes ([#9681](https://github.com/paritytech/parity-ethereum/pull/9681)) - - Don't hash the init_code of CREATE. ([#9688](https://github.com/paritytech/parity-ethereum/pull/9688)) - - Docker: run parity as normal user ([#9689](https://github.com/paritytech/parity-ethereum/pull/9689)) - - CI: Skip docs job for master and nightly ([#9693](https://github.com/paritytech/parity-ethereum/pull/9693)) - - Implement CREATE2 gas changes and fix some potential overflowing ([#9694](https://github.com/paritytech/parity-ethereum/pull/9694)) - - Make instantSeal engine backwards compatible ([#9700](https://github.com/paritytech/parity-ethereum/pull/9700)) - - Ethcore: delay ropsten hardfork ([#9704](https://github.com/paritytech/parity-ethereum/pull/9704)) - -## Parity-Ethereum [v2.1.1](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.1) (2018-09-20) - -Parity-Ethereum 2.1.1-beta is a release that does not improve performance and stability; no changes were made. - -The full list of included changes: - -- Backports for 2.1.1 beta ([#9599](https://github.com/paritytech/parity-ethereum/pull/9599)) - - Parity: bump version to 2.1.1 beta - - Ci: fix regex roll_eyes - - Docs(rpc): annotate tag with the provided message - -## Parity-Ethereum [v2.1.0](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.0) (2018-09-19) - -Parity-Ethereum 2.1.0-beta is released! Look at this! - -Important notices: - -- This release moves the 2.1 track of Parity-Ethereum to beta. -- This release contains a low-severity issue with the web-sockets ports. [#9545](https://github.com/paritytech/parity-ethereum/pull/9545) -- This release resolves a potential network fragmentation issue. [#9526](https://github.com/paritytech/parity-ethereum/pull/9526) -- With this release, all versions of Parity Ethereum 1.x prior to 2.0 reached end of life. -- Users are urged to upgrade to 2.0.5-stable or 2.1.0-beta. - -Further changes worth highlighting: - -- Generalized `blockReward` and `difficultyBombDelays` config ([#9480](https://github.com/paritytech/parity-ethereum/pull/9480)): This removes `eip649*` parameters from chain specs and allows `blockReward` to accept `multi`. Please review your chain-specs! -- Implement EIP234 `block_hash` for `eth_getLogs` ([#9256](https://github.com/paritytech/parity-ethereum/pull/9256)): If `block_hash` and `from_block`/`to_block` present, return error. This also changes `eth_getLogs` to return error if any of `block_hash`/`from_block`/`to_block` cannot be found. -- The default `gas_floor_target` was increased to `8_000_000`, the default `gas_cap` to `10_000_000`. -- Light clients provide the actual account for `eth_coinbase` RPC ([#9383](https://github.com/paritytech/parity-ethereum/pull/9383)). Note, this behavior is different from the full client where we return the `0x0` address if no accounts are found! -- Light servers give free credits for reserved peers ([#9448](https://github.com/paritytech/parity-ethereum/pull/9448)): When connecting to a reserved peers in light client, assign free credits to them. This fixes the scenario where a home server is running a full node, and another light client connects to the full node as a reserved peer. -- Multi-threaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)): to speed up the generation of snapshots on disk, this can be parallelized now. By default N/2 CPU cores are being used. Use `--snapshot-threads` flag to customize the number of threads. -- Remove all dapp permissions related settings ([#9120](https://github.com/paritytech/parity-ethereum/pull/9120)). This completely removes dapp permission settings from `AccountProvider` and JSON-RPC: In JSON-RPC, all available accounts are returned, regardless of the origin; previously we return accounts based on dapps policy. It's not possible to set a "default account" (as for dapps) any more; this is now always the first account in the available account list. -- Remove unused `--tx_queue_gas` parameter ([#9153](https://github.com/paritytech/parity-ethereum/pull/9153)). Please use `parity --help` to learn about available transaction queue strategies. +- Prevent zero network ID ([#9763](https://github.com/paritytech/parity-ethereum/pull/9763)) and drop support for Olympic testnet ([#9801](https://github.com/paritytech/parity-ethereum/pull/9801)): The Olympic test net is dead for years and never used a chain ID but network ID zero. Parity Ethereum is now preventing the network ID to be zero, thus Olympic support is dropped. Make sure to chose positive non-zero network IDs in future. +- Multithreaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)): adds a CLI argument `--snapshot-threads` which specifies the number of threads. This helps improving the performance of full nodes that wish to provide warp-snapshots for the network. The gain in performance comes with a slight drawback in increased snapshot size. +- Expose config max-round-blocks-to-import ([#9439](https://github.com/paritytech/parity-ethereum/pull/9439)): Parity Ethereum imports blocks in rounds. If at the end of any round, the queue is not empty, we consider it to be _importing_ and won't notify pubsub. On large re-orgs (10+ blocks), this is possible. The default `max_round_blocks_to_import` is increased to 12 and configurable via the `--max-round-blocks-to-import` CLI flag. With unstable network conditions, it is advised to increase the number. This shouldn't have any noticeable performance impact unless the number is set to really large. +- Increase Gas-floor-target and Gas Cap ([#9564](https://github.com/paritytech/parity-ethereum/pull/9564)): the default values for gas floor target are `8_000_000` and gas cap `10_000_000`, similar to Geth 1.8.15+. +- Produce portable binaries ([#9725](https://github.com/paritytech/parity-ethereum/pull/9725)): we now produce portable binaries, but it may incur some performance degradation. For ultimate performance it's now better to compile Parity Ethereum from source with `PORTABLE=OFF` environment variable. +- RPC: `parity_allTransactionHashes` ([#9745](https://github.com/paritytech/parity-ethereum/pull/9745)): Get all pending transactions from the queue with the high performant `parity_allTransactionHashes` RPC method. +- Support `eth_chainId` RPC method ([#9783](https://github.com/paritytech/parity-ethereum/pull/9783)): implements EIP-695 to get the chainID via RPC. +- AuRa: finalize blocks ([#9692](https://github.com/paritytech/parity-ethereum/pull/9692)): The AuRa engine was updated to emit ancestry actions to finalize blocks. The full client stores block finality in the database, the engine builds finality from an ancestry of `ExtendedHeader`; `is_epoch_end` was updated to take a vec of recently finalized headers; `is_epoch_end_light` was added which maintains the previous interface and is used by the light client since the client itself doesn't track finality. The full list of included changes: -- Add snapcraft package image ([#9583](https://github.com/paritytech/parity-ethereum/pull/9583)) - - Add snapcraft package image - - Update .gitlab-ci.yml - - Remove snapcraft clean -- Backports for 2.1.0 beta ([#9518](https://github.com/paritytech/parity-ethereum/pull/9518)) - - Parity-version: mark 2.1.0 track beta - - Ci: update branch version references - - Docker: release master to latest - - Fix checkpointing when creating contract failed ([#9514](https://github.com/paritytech/parity-ethereum/pull/9514)) - - Ci: fix json docs generation ([#9515](https://github.com/paritytech/parity-ethereum/pull/9515)) - - Fix typo in version string ([#9516](https://github.com/paritytech/parity-ethereum/pull/9516)) - - Update patricia trie to 0.2.2 crates. Default dependencies on minor version only. - - Putting back ethereum tests to the right commit - - Enable all Constantinople hard fork changes in constantinople_test.json ([#9505](https://github.com/paritytech/parity-ethereum/pull/9505)) - - Enable all Constantinople hard fork changes in constantinople_test.json - - Address grumbles - - Remove EIP-210 activation - - 8m -> 5m - - Temporarily add back eip210 transition so we can get test passed - - Add eip210_test and remove eip210 transition from const_test - - In create memory calculation is the same for create2 because the additional parameter was popped before. ([#9522](https://github.com/paritytech/parity-ethereum/pull/9522)) - - Deps: bump fs-swap and kvdb-rocksdb - - Multithreaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)) - - Add Progress to Snapshot Secondary chunks creation - - Use half of CPUs to multithread snapshot creation - - Use env var to define number of threads - - Info to debug logs - - Add Snapshot threads as CLI option - - Randomize chunks per thread - - Remove randomness, add debugging - - Add warning - - Add tracing - - Use parity-common fix seek branch - - Fix log - - Fix tests - - Fix tests - - Pr Grumbles - - Pr Grumble II - - Update Cargo.lock - - Pr Grumbles - - Default snapshot threads to half number of CPUs - - Fix default snapshot threads // min 1 - - Correct before_script for nightly build versions ([#9543](https://github.com/paritytech/parity-ethereum/pull/9543)) - - Fix gitlab array of strings syntax error - - Get proper commit id - - Avoid colon in stings - - Remove initial token for WS. ([#9545](https://github.com/paritytech/parity-ethereum/pull/9545)) - - Version: mark release critical - - Ci: fix rpc docs generation 2 ([#9550](https://github.com/paritytech/parity-ethereum/pull/9550)) - - Improve P2P discovery ([#9526](https://github.com/paritytech/parity-ethereum/pull/9526)) - - Add `target` to Rust traces - - Network-devp2p: Don't remove discovery peer in main sync - - Network-p2p: Refresh discovery more often - - Update Peer discovery protocol - - Run discovery more often when not enough nodes connected - - Start the first discovery early - - Update fast discovery rate - - Fix tests - - Fix `ping` tests - - Fixing remote Node address ; adding PingPong round - - Fix tests: update new +1 PingPong round - - Increase slow Discovery rate - - Check in flight FindNode before pings - - Add `deprecated` to deprecated_echo_hash - - Refactor `discovery_round` branching - - Net_version caches network_id to avoid redundant acquire of sync read lock ([#9544](https://github.com/paritytech/parity-ethereum/pull/9544)) - - Net_version caches network_id to avoid redundant acquire of sync read lock, [#8746](https://github.com/paritytech/parity-ethereum/issues/8746) - - Use lower_hex display formatting for net_peerCount rpc method - - Increase Gas-floor-target and Gas Cap ([#9564](https://github.com/paritytech/parity-ethereum/pull/9564)) - - Gas-floor-target increased to 8M by default - - Gas-cap increased to 10M by default - - Revert to old parity-tokio-ipc. - - Downgrade named pipes. -- Fix checkpointing when creating contract failed ([#9514](https://github.com/paritytech/parity-ethereum/pull/9514)) -- Ci: fix json docs generation ([#9515](https://github.com/paritytech/parity-ethereum/pull/9515)) -- Update state tests execution model ([#9440](https://github.com/paritytech/parity-ethereum/pull/9440)) - - Update & fix JSON state tests. - - Update tests to be able to run ethtest at 021fe3d410773024cd5f0387e62db6e6ec800f32. - - Touch user in state - - Adjust transaction tests to new json format - - Switch to same commit for submodule ethereum/test as geth (next includes constantinople changes). - - Added test `json_tests::trie::generic::TrieTests_trieanyorder` and a few difficulty tests. - - Remove trietestnextprev as it would require to parse differently and implement it. - - Support new (shitty) format of transaction tests. - - Ignore junk in ethereum/tests repo. - - Ignore incorrect test. - - Update to a later commit - - Move block number to a constant. - - Fix ZK2 test - touched account should also be cleared. - - Fix conflict resolution -- Upload will fail if a file with the same hash is already up ([#9479](https://github.com/paritytech/parity-ethereum/pull/9479)) - - Upload will fail if a file with the same hash is already up - - Compose version string for nightly releases -- Fix Snapshot restoration failure on Windows ([#9491](https://github.com/paritytech/parity-ethereum/pull/9491)) - - Close Blooms DB files before DB restoration -- Don't error when Snapshot is aborted ([#9492](https://github.com/paritytech/parity-ethereum/pull/9492)) -- Light: give free credits for reserved peers ([#9448](https://github.com/paritytech/parity-ethereum/pull/9448)) - - Light: give free credits for reserved peers - - Fix ethcore-light tests - - Test free_flow_params -- Parity: print correct keys path on startup ([#9501](https://github.com/paritytech/parity-ethereum/pull/9501)) -- Generalized blockReward and difficultyBombDelays config ([#9480](https://github.com/paritytech/parity-ethereum/pull/9480)) - - Implement multi blockReward - - Implement difficultyBombDelays - - Fix json crate compile - - Json keys can only be string -- Rpc(debug_getBadBlocks): fix test ([#9502](https://github.com/paritytech/parity-ethereum/pull/9502)) -- Bad blocks RPC + reporting ([#9433](https://github.com/paritytech/parity-ethereum/pull/9433)) - - Bad blocks RPC. - - Return bad blocks via RPC. - - Fix test. - - More verbose bad block message. - - Expose via CLI. - - Remove stray whitespace. - - Remove stray newline. - - Fix tests. -- Eip 1283: Net gas metering for SSTORE without dirty maps ([#9319](https://github.com/paritytech/parity-ethereum/pull/9319)) - - Implement last_checkpoint_storage_at - - Add reverted_storage_at for externalities - - Sstore_clears_count -> sstore_clears_refund - - Implement eip1283 for evm - - Add eip1283Transition params - - Evm: fix tests - - Jsontests: fix test - - Return checkpoint index when creating - - Comply with spec Version II - - Fix docs - - Fix jsontests feature compile - - Address grumbles - - Fix no-checkpoint-entry case - - Remove unnecessary expect - - Add test for State::checkpoint_storage_at - - Add executive level test for eip1283 - - Hard-code transaction_checkpoint_index to 0 - - Fix jsontests - - Add tests for checkpoint discard/revert - - Require checkpoint to be empty for kill_account and commit - - Get code coverage - - Use saturating_add/saturating_sub - - Fix issues in insert_cache - - Clear the state again - - Fix original_storage_at - - Early return for empty RLP trie storage - - Update comments - - Fix borrow_mut issue - - Simplify checkpoint_storage_at if branches - - Better commenting for gas handling code - - Address naming grumbles - - More tests - - Fix an issue in overwrite_with - - Add another test - - Fix comment - - Remove unnecessary bracket - - Move orig to inner if - - Remove test coverage for this PR - - Add tests for executive original value - - Add warn! for an unreachable cause -- Light `clippy(fy)` ([#9473](https://github.com/paritytech/parity-ethereum/pull/9473)) - - Wasm tests - - `clippyfy` light-client - - Revert inefficient change `collect_ready()` -- Aura: don't report skipped primaries when empty steps are enabled ([#9435](https://github.com/paritytech/parity-ethereum/pull/9435)) -- Support millisecond timestamp for instant seal engine ([#9469](https://github.com/paritytech/parity-ethereum/pull/9469)) - - Support millisecond timestamp for instant seal engine - - Forgot to checkin instant_seal mod - - Fix instant seal config - - Fix json crate compile - - Fix private_spec.json - - Option -> bool -- Ethcore: don't validate difficulty when ignoring seal check ([#9470](https://github.com/paritytech/parity-ethereum/pull/9470)) - - Ethcore: don't validate difficulty when ignoring seal check - - Ethcore: fix block verification test - - Ethcore: document skipped verifications when check_seal is disabled -- [light/jsonrpc] Provide the actual account for `eth_coinbase` RPC and unify error handling for light and full client ([#9383](https://github.com/paritytech/parity-ethereum/pull/9383)) - - Provide the actual `account` for eth_coinbase - - The previous implementation always provided the `zero address` on `eth_coinbase` RPC. Now, instead the actual address is returned on success or an error when no account(s) is found! - - Full client `eth_coinbase` return err - - In the full-client return an error when no account is found instead of returning the `zero address` - - Remove needless blocks on single import - - Remove needless `static` lifetime on const - - Fix `rpc_eth_author` test -- Add a Java interface ([#9346](https://github.com/paritytech/parity-ethereum/pull/9346)) - - Add a Java interface - - Use system ABI - - Forgot exception - - Fix param for parity_rpc - - Address concerns -- Fetch `parity-common` crates from crates.io ([#9410](https://github.com/paritytech/parity-ethereum/pull/9410)) - - Fetch `parity-common` crates from crates.io - - Add doc tests from `patricia-trie` to `patricia-trie-ethereum` - - Fix/update a few deps - - [ethkey] upgrade ethereum-types - - [whisper] update deps - - [network] deps - - [network-devp2p] deps - - [journaldb] deps - - [fastmap] deps - - [miner] deps and test fixes - - [machine] deps - - [json] deps - - [hw] deps - - [ethash] deps - - [registrar] deps - - Update a few more dependencies with new ethabi-* - - [updater] Update deps - - Deps - - [ethcore] Update deps - - Use new parity-snappy and parity-rocksdb crates - - Updated submodules - - Use parity-snappy 0.1 - - Use kvdb-rocksdb 0.1.2 - - Don't use latest ethereum/tests - - Fix merge conflicts errors - - Remove superseeded comment - - Address grumbles: add newlines, add/remove spaces -- Fixed typo ([#9467](https://github.com/paritytech/parity-ethereum/pull/9467)) -- Fix light client deadlock ([#9385](https://github.com/paritytech/parity-ethereum/pull/9385)) - - This PR is fixing deadlock for [#8918](https://github.com/paritytech/parity-ethereum/issues/8918) - - It avoids some recursive calls on light_sync by making state check optional for Informant. - - The current behavior is to display the information when informant checks if block is major version. - - This change a bit the informant behavior, but not on most cases. - - To remember where and how this kind of deadlock are likely to happen (not seen with Parkinglot deadlock detection because it uses std condvar), I am adding a description of the deadlock. - - Also, for the reviewers there may be better solution than modifying the informant. -- Fix docs of address_hash ([#9463](https://github.com/paritytech/parity-ethereum/pull/9463)) -- Fix typo in bash script ([#9462](https://github.com/paritytech/parity-ethereum/pull/9462)) -- Fix a bug in evmbin initial_gas display ([#9457](https://github.com/paritytech/parity-ethereum/pull/9457)) -- Evmbin: escape newlines in json errors ([#9458](https://github.com/paritytech/parity-ethereum/pull/9458)) -- Use kvdb-* and parity-snappy crates from crates.io ([#9441](https://github.com/paritytech/parity-ethereum/pull/9441)) - - Use kvdb-* and parity-snappy crates from crates.io - - Update rocksdb-sys and snappy-sys -- Add EIP-1014 transition config flag ([#9268](https://github.com/paritytech/parity-ethereum/pull/9268)) - - Add EIP-1014 transition config flag - - Remove EIP-86 configs - - Change CREATE2 opcode index to 0xf5 - - Move salt to the last item in the stack - - Change sendersaltandaddress scheme to comply with current EIP-1014 - - Fix json configs - - Fix create2 test - - Fix deprecated comments -- Add tags for runner selection of build-linux jobs ([#9451](https://github.com/paritytech/parity-ethereum/pull/9451)) -- Remove unused BlockStatus::Pending ([#9447](https://github.com/paritytech/parity-ethereum/pull/9447)) - - Pending case never instantiated, and only ever matched together with Unknown -- Ci: only include local paths in coverage script (except target) ([#9437](https://github.com/paritytech/parity-ethereum/pull/9437)) -- Add POA Networks: Core and Sokol ([#9413](https://github.com/paritytech/parity-ethereum/pull/9413)) - - Ethcore: add poa network and sokol chainspecs - - Rpc: simplify chain spec docs - - Cli: rearrange networks by main/test and size/range - - Parity: don't blacklist 0x00a328 on sokol testnet - - Parity: add sokol and poanet to params and clean up a bit, add tests - - Ethcore: add the poa networks and clean up a bit - - Ethcore: fix path to poacore chain spec - - Parity: rename poa networks to poacore and poasokol - - Parity: fix configuration tests - - Parity: fix parameter tests - - Ethcore: rename POA Core and POA Sokol -- Docker: install missing dependencies in arm target dockerfiles ([#9436](https://github.com/paritytech/parity-ethereum/pull/9436)) -- Random small cleanups ([#9423](https://github.com/paritytech/parity-ethereum/pull/9423)) - - Clean up toml files - - Update the parity ethereum toolchain docs - - Update contribution guide and issue templates - - Update desktop and service files - - Build clib examples with 8 threads - - Update header templates - - Replace parity technologies with parity ethereum logo -- Evmbin: Fix gas_used issue in state root mismatch and handle output better ([#9418](https://github.com/paritytech/parity-ethereum/pull/9418)) - - Fix gas used in staterootmismatch, and print full state root hash - - Write trace info for stdjson to stderr - - Fix tests - - Remove struct trait bound -- Update hardcoded sync ([#9421](https://github.com/paritytech/parity-ethereum/pull/9421)) - - Update foundation hardcoded header to block 6219777 - - Update ropsten hardcoded header to block 3917825 - - Update kovan hardcoded header to block 8511489 -- Add block reward contract config to ethash and allow off-chain contracts ([#9312](https://github.com/paritytech/parity-ethereum/pull/9312)) - - This adds block reward contract config to ethash. A new config `blockRewardContractCode` is also added to both Aura and ethash. When specified, it will execute the code directly and overrides any `blockRewardContractAddress` config. Having this `blockRewardContractCode` config allows chains to deploy hard fork by simply replacing the current config value, without the need from us to support any `multi` block reward scheme. -- Private packets verification and queue refactoring ([#8715](https://github.com/paritytech/parity-ethereum/pull/8715)) - - Verify private transaction before propagating - - Private transactions queue reworked with tx pool queue direct usage - - Styling fixed - - Prevent resending private packets to the sender - - Process signed private transaction packets via io queue - - Test fixed - - Build and test fixed after merge - - Comments after review fixed - - Signed transaction taken from verified - - Fix after merge - - Pool scoring generalized in order to use externally - - Lib refactored according to the review comments - - Ready state refactored - - Redundant bound and copying removed - - Fixed build after the merge - - Forgotten case reworked - - Review comments fixed - - Logging reworked, target added - - Fix after merge -- Update tobalaba.json ([#9419](https://github.com/paritytech/parity-ethereum/pull/9419)) -- Docs: add parity ethereum logo to readme ([#9415](https://github.com/paritytech/parity-ethereum/pull/9415)) - - Docs: add parity ethereum logo - - Docs: add logo to readme - - Docs: align logo center - - Docs: remove separators from readme - - Docs: restructure readme - - Docs: check spelling and grammar in readme - - Docs: clarify readme - - Docs: improve readme significantly -- Build: update rocksdb crate ([#9414](https://github.com/paritytech/parity-ethereum/pull/9414)) -- Updating the CI system ([#8765](https://github.com/paritytech/parity-ethereum/pull/8765)) - - Updating the CI system with the publication of releases and binary files on github - - Add missed scripts - - Chmod +x scripts - - Fix download link for github - - Rebuilding CI scripts - - Small fixes - - Update submodule wasm tests - - Ci: fix merge leftovers - - Ci: remove gitlab-next from ci triggers - - Ci: fix git add in docs script - - Ci: use nightly instead of master for publish triggers - - Ci: remove sleep from gitlab config - - Ci: replace ':' with '-' in gitlab targets - - Ci: fix recursive copy in docs script -- Better support for eth_getLogs in light mode ([#9186](https://github.com/paritytech/parity-ethereum/pull/9186)) - - Light client on-demand request for headers range. - - Cache headers in HeaderWithAncestors response. - - Also fulfills request locally if all headers are in cache. - - Lightfetch::logs fetches missing headers on demand. - - Lightfetch::logs limit the number of headers requested at a time. - - Lightfetch::logs refactor header fetching logic. - - Enforce limit on header range length in light client logs request. - - Fix light request tests after struct change. - - Respond to review comments. -- Add update docs script to CI ([#9219](https://github.com/paritytech/parity-ethereum/pull/9219)) - - Add update docs script to CI - - Added a script to CI that will use the jsonrpc tool to update rpc documentation then commit and push those to the wiki repo. - - Fix gitlab ci lint - - Only apply jsonrpc docs update on tags - - Update gitlab-rpc-docs.sh - - Copy correct parity repo to jsonrpc folder - - Copy correct parity repo to jsonrpc folder before attempting to build docs since the CI runner clones the repo as parity and not parity-ethereum. - - Fix JSONRPC docs CI job - - Update remote config in wiki repo before pushing changes using a github token for authentication. Add message to wiki tag when pushing changes. Use project directory to correctly copy parity code base into the jsonrpc repo for doc generation. - - Fix set_remote_wiki function call in CI -- `gasleft` extern implemented for WASM runtime (kip-6) ([#9357](https://github.com/paritytech/parity-ethereum/pull/9357)) - - Wasm gasleft extern added - - Wasm_gasleft_activation_transition -> kip4_transition - - Use kip-6 switch - - Gasleft_panic -> gasleft_fail rename - - Call_msg_gasleft test added and gas_left agustments because this paritytech/wasm-tests#52 - - Change .. to _ - - Fix comment for the have_gasleft param - - Update tests (paritytech/wasm-tests-0edbf86) -- Block view! removal in progress ([#9397](https://github.com/paritytech/parity-ethereum/pull/9397)) -- Prevent sync restart if import queue full ([#9381](https://github.com/paritytech/parity-ethereum/pull/9381)) -- Nonroot CentOS Docker image ([#9280](https://github.com/paritytech/parity-ethereum/pull/9280)) - - Updates CentOS Docker image build process - - Rename build.Dockerfile -- Ethcore: kovan: delay activation of strict score validation ([#9406](https://github.com/paritytech/parity-ethereum/pull/9406)) -- Revert "Use std::sync::Condvar ([#1732](https://github.com/paritytech/parity-ethereum/pull/1732))" ([#9392](https://github.com/paritytech/parity-ethereum/pull/9392)) - - Revert "Use std::sync::Condvar ([#1732](https://github.com/paritytech/parity-ethereum/pull/1732))" - - This reverts commit c65ee93. - - Verification_queue: remove redundant mutexes -- Replace `std::env::home_dir()` with `home` crate impl. ([#9293](https://github.com/paritytech/parity-ethereum/pull/9293)) - - Import the `home` crate in `util/dir`. - - Replace uses of `env::home_dir()` with `home::home_dir()`. - - `home` uses a 'correct' impl. on windows and the stdlib impl. of `::home_dir` otherwise. - - Reexport `home::home_dir` from `util/dir`. - - Bump `util/dir` to 0.1.2. - - Docs: restore readme ([#9391](https://github.com/paritytech/parity-ethereum/pull/9391)) - - Replace `Duration::new()` w/ `Duration::from_nanos` ([#9387](https://github.com/paritytech/parity-ethereum/pull/9387)) -- Delete Dockerfile ([#9386](https://github.com/paritytech/parity-ethereum/pull/9386)) -- Network-devp2p `Fix some clippy errors/warnings` ([#9378](https://github.com/paritytech/parity-ethereum/pull/9378)) - - Fix some clippy warnings - - Remove `shallow-copy` of Node's - - Make `NonReservedPeerMode` Copy and pass-by-value -- Allow calling contracts in genesis state. ([#9375](https://github.com/paritytech/parity-ethereum/pull/9375)) -- Make `Capabilities struct` Copy ([#9372](https://github.com/paritytech/parity-ethereum/pull/9372)) -- Light client "Enable more logs for light client `on_demand`" ([#9374](https://github.com/paritytech/parity-ethereum/pull/9374)) - - Enable more logs for light client `on_demand` - - Remove extra whitespace - - Fix indentation -- Better logging when mining own transactions. ([#9363](https://github.com/paritytech/parity-ethereum/pull/9363)) -- Fix typos in `network-devp2p` ([#9371](https://github.com/paritytech/parity-ethereum/pull/9371)) -- Light client `Provide default nonce in transactions when it´s missing` ([#9370](https://github.com/paritytech/parity-ethereum/pull/9370)) - - Provide `default_nonce` in tx`s when it´s missing - - When `nonce` is missing in a `EthTransaction` will cause it to fall in these cases provide `default_nonce` value instead! - - Changed http:// to https:// on Yasm link ([#9369](https://github.com/paritytech/parity-ethereum/pull/9369)) - - Changed http:// to https:// on Yasm link in README.md - - Provide `default_nonce` in tx`s when it´s missing - - When `nonce` is missing in a `EthTransaction` will cause it to fall in these cases provide `default_nonce` value instead! - - Address grumbles -- Changed http:// to https:// on Yasm link ([#9369](https://github.com/paritytech/parity-ethereum/pull/9369)) - - Changed http:// to https:// on Yasm link in README.md -- Fix no line breaks in logs ([#9355](https://github.com/paritytech/parity-ethereum/pull/9355)) -- Lower the max size of transaction packet to prevent going oversize. ([#9308](https://github.com/paritytech/parity-ethereum/pull/9308)) - - Lower the max size of transaction packet to prevent going oversize. - - Log RLP size. -- Remove prepare_trace_output and make sure prepare_trace_call and trace*call are balanced ([#9353](https://github.com/paritytech/parity-ethereum/pull/9353)) - - This refactors `prepare_trace_output` to instead directly take the reference of return values, so that it's simpler and we save a stack item. This should also fixes [the issue]([#9236](https://github.com/paritytech/parity-ethereum/pull/9236) (comment)) udoprog is facing. Replaces [#9236](https://github.com/paritytech/parity-ethereum/issues/9236) -- More details in logs returned by light client ([#9324](https://github.com/paritytech/parity-ethereum/pull/9324)) - - Log details for light logs. - - Create Log directly. -- Expose UnorderedIterator. ([#9347](https://github.com/paritytech/parity-ethereum/pull/9347)) -- Light client logs should include 'from_block' when querying logs ([#9331](https://github.com/paritytech/parity-ethereum/pull/9331)) - - Fix PubSub for logs when using light client: - - Prior to this fix the pubsub process did send a query for each new block header (and for each subs: there is something to optimize here) by setting from and to of the filter at this block number; but there was a bug in the code that fetch logs : it was non inclusive for its start bound, meaning that with start bound = end bound we never query any block (and attached logs). - - Option iter instead of once. - - Use of bloom existing function to check if a bloom contains another. - - Makes from block header checking explicit -- Remove pass-by-reference return data value from executive ([#9211](https://github.com/paritytech/parity-ethereum/pull/9211)) - - Remove pass-by-reference return data value from executive - - Fix tests - - Fix a missing test output - - Typo: wasm_activation_test - - Tracing change in output - - Json_tests: fix compile - - Typo: 0..32 -> ..32 to keep it consistent with other occurance - - Fix tests -- Allow single opcode stepping for EVM ([#9051](https://github.com/paritytech/parity-ethereum/pull/9051)) - - Feed in ActionParams on VM creation - - Fix ethcore after Vm interface change - - Move informant inside Interpreter struct - - Move do_trace to Interpreter struct - - Move all remaining exec variables to Interpreter struct - - Refactor VM to allow single opcode step - - Fix all EVM tests - - Fix all wasm tests - - Fix wasm runner tests - - Fix a check case where code length is zero - - Fix jsontests compile - - Fix cargo lock - - Use match instead of expect - - Use cheaper check reader.len() == 0 for the initial special case - - Get rid of try_and_done! macro by using Result<(), ReturnType> - - Use Never instead of () - - Fix parity-bytes path - - Bypass gasometer lifetime problem by borrow only for a instance - - Typo: missing { - - Fix ethcore test compile - - Fix evm tests -- Fix load share ([#9321](https://github.com/paritytech/parity-ethereum/pull/9321)) - - Fix(light_sync): calculate `load_share` properly - - Refactor(api.rs): extract `light_params` fn, add test - - Style(api.rs): add trailing commas -- Implement EIP234 block_hash for eth_getLogs ([#9256](https://github.com/paritytech/parity-ethereum/pull/9256)) - - Implement EIP234 - - Make filter conversion returns error if both blockHash and from/toBlock is found - - This also changes PollFilter to store the EthFilter type, instead of the jsonrpc one, saving repeated conversion. - - Return error if block filtering target is not found in eth_getLogs - - Use the old behavior (unwrap_or_default) for anywhere else. - - Fix test: secret_store - - Fix weird indentation - - Make client log filter return error in case a block cannot be found - - Return blockId error in rpc - - Test_client: allow return error on logs - - Add a mocked test for eth_getLogs error - - Fix: should return error if from_block/to_block greater than best block number - - Add notes on pending - - Add comment for UNSUPPORTED_REQUEST - - Address grumbles - - Return err if from > to -- Ethcore: fix pow difficulty validation ([#9328](https://github.com/paritytech/parity-ethereum/pull/9328)) - - Ethcore: fix pow difficulty validation - - Ethcore: validate difficulty is not zero - - Ethcore: add issue link to regression test - - Ethcore: fix tests - - Ethcore: move difficulty_to_boundary to ethash crate - - Ethcore: reuse difficulty_to_boundary and boundary_to_difficulty - - Ethcore: fix grumbles in difficulty_to_boundary_aux -- Ethcore/sync `Make view macro only visible to test` ([#9316](https://github.com/paritytech/parity-ethereum/pull/9316)) - - Remove needless macro import - - Enable ethcore/macros in tests -- Allow setting the panic hook with parity-clib ([#9292](https://github.com/paritytech/parity-ethereum/pull/9292)) - - Allow setting the panic hook with parity-clib - - Make all FFI functions unsafe - - Fix comment - - Fix concern -- Prevent blockchain & miner racing when accessing pending block. ([#9310](https://github.com/paritytech/parity-ethereum/pull/9310)) - - Prevent blockchain & miner racing when accessing pending block. - - Fix unavailability of pending block during reseal. -- Docker alpine: use multi-stage concept ([#9269](https://github.com/paritytech/parity-ethereum/pull/9269)) - - Docker alpine: use multi-stage concept - - Docker alpine: create config directory -- Update `log` -> 0.4, `env_logger` -> 0.5. ([#9294](https://github.com/paritytech/parity-ethereum/pull/9294)) - - Rename a few types & methods. - - Change `(Log)Builder::format` (closure) arg. -- Update tobalaba.json ([#9313](https://github.com/paritytech/parity-ethereum/pull/9313)) -- Allow tx pool to be Send ([#9315](https://github.com/paritytech/parity-ethereum/pull/9315)) -- Fix codecov.io badge in README ([#9327](https://github.com/paritytech/parity-ethereum/pull/9327)) -- Move ethereum-specific H256FastMap type to own crate ([#9307](https://github.com/paritytech/parity-ethereum/pull/9307)) - - Add a `fastmap` crate that provides the H256FastMap specialized HashMap - - Use `fastmap` instead of `plain_hasher` - - Update submodules for Reasons™ - - Submodule update -- Ethcore sync decodes rlp less often ([#9264](https://github.com/paritytech/parity-ethereum/pull/9264)) - - Deserialize block only once during verification - - Ethcore-sync uses Unverified - - Ethcore-sync uses Unverified - - Fixed build error - - Removed Block::is_good - - Applied review suggestions - - Ethcore-sync deserializes headers and blocks only once -- Ethcore: add transition flag for transaction permission contract ([#9275](https://github.com/paritytech/parity-ethereum/pull/9275)) - - Ethcore: add transition flag for transaction permission contract - - Ethcore: fix transaction permission contract tests -- Remove all dapp permissions related settings ([#9120](https://github.com/paritytech/parity-ethereum/pull/9120)) - - Completely remove all dapps struct from rpc - - Remove unused pub use - - Remove dapp policy/permission func in ethcore - - Remove all dapps settings from rpc - - Fix rpc tests - - Use both origin and user_agent - - Address grumbles - - Address grumbles - - Fix tests -- Improve return data truncate logic ([#9254](https://github.com/paritytech/parity-ethereum/pull/9254)) - - Improve return data truncate logic - - Fix: size -> offset + size -- Update wasm-tests hash ([#9295](https://github.com/paritytech/parity-ethereum/pull/9295)) -- Implement KIP4: create2 for wasm ([#9277](https://github.com/paritytech/parity-ethereum/pull/9277)) - - Basic implementation for kip4 - - Add KIP-4 config flags - - Typo: docs fix - - Fix args offset - - Add tests for create2 - - Tests: evm - - Update wasm-tests and fix all gas costs - - Update wasm-tests - - Update wasm-tests and fix gas costs -- Fix loop start value ([#9285](https://github.com/paritytech/parity-ethereum/pull/9285)) -- Avoid using $HOME if not necessary ([#9273](https://github.com/paritytech/parity-ethereum/pull/9273)) - - Avoid using $HOME if not necessary - - Fix concerns and issues -- Fix path to parity.h ([#9274](https://github.com/paritytech/parity-ethereum/pull/9274)) - - Fix path to parity.h - - Fix other paths as well -- Propagate transactions for next 4 blocks. ([#9265](https://github.com/paritytech/parity-ethereum/pull/9265)) - - Closes [#9255](https://github.com/paritytech/parity-ethereum/issues/9255) - - This PR also removes the limit of max 64 transactions per packet, currently we only attempt to prevent the packet size to go over 8MB. This will only be the case for super-large transactions or high-block-gas-limit chains. Patching this is important only for chains that have blocks that can fit more than 4k transactions (over 86M block gas limit) For mainnet, we should actually see a tiny bit faster propagation since instead of computing 4k pending set, we only need `4 * 8M / 21k = 1523` transactions. Running some tests on `dekompile` node right now, to check how it performs in the wild. -- Decode block rlp less often ([#9252](https://github.com/paritytech/parity-ethereum/pull/9252)) - - Removed 4 redundant rlp deserializations - - Avoid 1 redundant block data copy -- Fix eternalities tests can_create (missing parameter) ([#9270](https://github.com/paritytech/parity-ethereum/pull/9270)) -- Update ref to `parity-common` and update `seek` behaviour ([#9257](https://github.com/paritytech/parity-ethereum/pull/9257)) - - Update ref to `parity-common` and update `seek` behaviour - - Remove reference to `ng-fix-triedb-seek` branch -- Comply EIP-86 with the new definition ([#9140](https://github.com/paritytech/parity-ethereum/pull/9140)) - - Comply EIP-86 with the new CREATE2 opcode - - Fix rpc compile - - Fix interpreter CREATE/CREATE2 stack pop difference - - Add unreachable! to fix compile - - Fix instruction_info - - Fix gas check due to new stack item - - Add new tests in executive - - Fix have_create2 comment - - Remove all unused references of eip86_transition and block_number -- Check if synced when using eth_getWork ([#9193](https://github.com/paritytech/parity-ethereum/pull/9193)) ([#9210](https://github.com/paritytech/parity-ethereum/pull/9210)) - - Check if synced when using eth_getWork ([#9193](https://github.com/paritytech/parity-ethereum/pull/9193)) - - Don't use fn syncing - - Fix identation - - Fix typo - - Don't check for warping - - Rpc: avoid calling queue_info twice on eth_getWork -- Removed client error ([#9253](https://github.com/paritytech/parity-ethereum/pull/9253)) -- Implement EIP-1052 (EXTCODEHASH) and fix several issues in state account cache ([#9234](https://github.com/paritytech/parity-ethereum/pull/9234)) - - Implement EIP-1052 and fix several issues related to account cache - - Fix jsontests - - Merge two matches together - - Avoid making unnecessary Arc - - Address grumbles -- Improve Tracer documentation ([#9237](https://github.com/paritytech/parity-ethereum/pull/9237)) -- Update Dockerfile ([#9242](https://github.com/paritytech/parity-ethereum/pull/9242)) - - Update Dockerfile - - Fix Docker build - - Fix dockerfile paths: parity -> parity-ethereum ([#9248](https://github.com/paritytech/parity-ethereum/pull/9248)) -- Block cleanup ([#9117](https://github.com/paritytech/parity-ethereum/pull/9117)) - - Blockchain insert expects owned block instead of block reference - - Reduce a number of times a block is deserialized - - Removed cached uncle_bytes from block - - Removed is_finalized from OpenBlock - - Removed unused parity_machine::WithMetadata trait - - Removed commented out code - - Remove unused metadata from block - - Remove unused metadata from block - - Blockdetails extras may have at most 5 elements -- Increase the number of sessions. ([#9203](https://github.com/paritytech/parity-ethereum/pull/9203)) -- Add changelog for 1.11.8 stable and 2.0.1 beta ([#9230](https://github.com/paritytech/parity-ethereum/pull/9230)) - - Docs: add changelog for 1.11.8 stable - - Docs: add changelog for 2.0.1 beta -- Fix typo ([#9232](https://github.com/paritytech/parity-ethereum/pull/9232)) -- Fix potential as_usize overflow when casting from U256 in miner ([#9221](https://github.com/paritytech/parity-ethereum/pull/9221)) -- Allow old blocks from peers with lower difficulty ([#9226](https://github.com/paritytech/parity-ethereum/pull/9226)) - - Previously we only allow downloading of old blocks if the peer difficulty was greater than our syncing difficulty. This change allows downloading of blocks from peers where the difficulty is greater then the last downloaded old block. -- Removes duplicate libudev-dev from Dockerfile ([#9220](https://github.com/paritytech/parity-ethereum/pull/9220)) -- Snap: remove ssl dependencies from snapcraft definition ([#9222](https://github.com/paritytech/parity-ethereum/pull/9222)) -- Remove ssl from dockerfiles, closes [#8880](https://github.com/paritytech/parity-ethereum/issues/8880) ([#9195](https://github.com/paritytech/parity-ethereum/pull/9195)) -- Insert PROOF messages for some cases in blockchain ([#9141](https://github.com/paritytech/parity-ethereum/pull/9141)) - - Insert PROOF messages for some cases in blockchain - - Break expect to its own line to avoid things being too long - - Be more specific for all low-level database error cases - - Fix BranchBecomingCanonChain expect - - Ethcore: fix typo in expect proof message -- [chain] Add more bootnodes ([#9174](https://github.com/paritytech/parity-ethereum/pull/9174)) - - For ETC, ELLA, EXP, Morden, MUSIC -- Ethcore: update bn version ([#9217](https://github.com/paritytech/parity-ethereum/pull/9217)) -- Deserialize block only once during verification ([#9161](https://github.com/paritytech/parity-ethereum/pull/9161)) -- Simple build instruction fix ([#9215](https://github.com/paritytech/parity-ethereum/pull/9215)) - - Changed `parity` dir name into `parity-ethereum` -- Added --tx-queue-no-early-reject flag to disable early tx queue rejects ([#9143](https://github.com/paritytech/parity-ethereum/pull/9143)) - - Added --tx-queue-no-early-reject flag to disable early tx queue rejects because of low gas price - - Fixed failing tests, clarified comments and simplified no_early_reject field name. - - Added test case for the --tx-queue-no-early-reject flag -- Avoid schedule copying in nested call/create ([#9190](https://github.com/paritytech/parity-ethereum/pull/9190)) - - Avoid schedule copying in nested call/create - - Fix tests - - Fix test: wrong Schedule used - - Fix private-tx test - - Fix jsontests compilation -- Ethcore: add builtin benchmarks based on geth ([#9179](https://github.com/paritytech/parity-ethereum/pull/9179)) - - Ethcore: add geth benchmarks for all builtins - - Ethcore: remove old builtin benchmarks -- Rpc: fix is_major_importing sync state condition ([#9112](https://github.com/paritytech/parity-ethereum/pull/9112)) - - Rpc: fix is_major_importing sync state condition - - Rpc: fix informant printout when waiting for peers -- Docs: update repository links ([#9159](https://github.com/paritytech/parity-ethereum/pull/9159)) - - Docs: update repository links - - Docs: update repository links in contribution guide -- Parity: fix UserDefaults json parser ([#9189](https://github.com/paritytech/parity-ethereum/pull/9189)) - - Parity: fix UserDefaults json parser - - Parity: use serde_derive for UserDefaults - - Parity: support deserialization of old UserDefault json format - - Parity: make UserDefaults serde backwards compatible - - Parity: tabify indentation in UserDefaults -- Update "This is a bug. Please report it at:" link ([#9191](https://github.com/paritytech/parity-ethereum/pull/9191)) -- Docker: update hub dockerfile ([#9173](https://github.com/paritytech/parity-ethereum/pull/9173)) - - Update Dockerfile for hub - - Update to Ubuntu Xenial 16.04 - - Fix cmake version - - Docker: fix tab indentation in hub dockerfile -- Ci: update version strings for snaps ([#9160](https://github.com/paritytech/parity-ethereum/pull/9160)) -- Ethcore: add missing builtins benchmarks ([#9170](https://github.com/paritytech/parity-ethereum/pull/9170)) - - Ethcore: add modexp benchmarks - - Ethcore: add_bn_128_add benchmark -- Fix bugfix hard fork logic ([#9138](https://github.com/paritytech/parity-ethereum/pull/9138)) - - Fix bugfix hard fork logic - - Remove dustProtectionTransition from bugfix category - - Eip-168 is not enabled by default - - Remove unnecessary 'static -- Be more graceful on Aura difficulty validation ([#9164](https://github.com/paritytech/parity-ethereum/pull/9164)) - - Be more graceful on Aura difficulty validation - - Test: rejects_step_backwards - - Test: proposer_switching - - Test: rejects_future_block - - Test: reports_skipped - - Test: verify_empty_seal_steps -- Handle SyncHandler errors properly ([#9151](https://github.com/paritytech/parity-ethereum/pull/9151)) - - Handle SyncHandler errors properly, closes [#9150](https://github.com/paritytech/parity-ethereum/issues/9150) - - Applied review suggestions -- Remove node-health ([#9119](https://github.com/paritytech/parity-ethereum/pull/9119)) - - Remove node-health - - Remove ntp_servers - - Add --ntp-servers as legacy instead of removing it - - Add --ntp-servers to deprecated args - - Remove unused stuff - - Remove _legacy_ntp_servers -- Remove unused tx_queue_gas parameter. ([#9153](https://github.com/paritytech/parity-ethereum/pull/9153)) -- Changelogs for 1.11.7-stable and 2.0.0-beta ([#9105](https://github.com/paritytech/parity-ethereum/pull/9105)) - - Docs: mark 1.10 as end-of-life - - Docs: move changelog for 1.11 - - Docs: Add changelog for 1.11.7-stable - - Docs: add changelog for 2.0.0-beta - - Docs: add release notes for 2.0.0 beta - - Docs: fix links in changelog - - Docs: Update changelog for 1.11.7-stable - - Docs: Update changelog for 2.0.0-beta - - Docs: address Tbaut's comments for the 2.0.0-beta changelog - - Docs: add note regarding txqueue changes as recommended by tomusdrw -- Disable per-sender limit for local transactions. ([#9148](https://github.com/paritytech/parity-ethereum/pull/9148)) - - Disable per-sender limit for local transactions. - - Add a missing new line. -- Parity: fix logging cli parameter example ([#9154](https://github.com/paritytech/parity-ethereum/pull/9154)) -- Be more specific for `-l` CLI arguments ([#9149](https://github.com/paritytech/parity-ethereum/pull/9149)) - - Update mod.rs -- Receipt constructor `Allocate less stack for blooms` ([#9146](https://github.com/paritytech/parity-ethereum/pull/9146)) - - Allocate less stack in `Receipt ctor` - - Ethcore: use accrue_bloom when computing transaction receipt -- `evm bench` fix broken dependencies ([#9134](https://github.com/paritytech/parity-ethereum/pull/9134)) - - `evm bench` use valid dependencies - - Benchmarks of the `evm` used stale versions of a couple a crates that this commit fixes! - - Fix warnings -- Update snapcraft.yaml ([#9132](https://github.com/paritytech/parity-ethereum/pull/9132)) -- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity-ethereum/pull/9135)) -- Unify engine error to reject blocks ([#9085](https://github.com/paritytech/parity-ethereum/pull/9085)) - - Reject if Engine::on_close_block returns error - - Unify open block behaviors - - Fix tests in ethcore - - Fix Aura tests - - Fix RPC test - - Print a warning if open block failed - - Print the actual error when closing the block - - Update comments for prepare_pending_block - - Add BlockPreparationStatus to distingish three different state after prepare_pending_block -- Fix `todo` in `ethcore/types::Receipt` constructor ([#9086](https://github.com/paritytech/parity-ethereum/pull/9086)) - - Remove needless mutable variable and assignment -- Completely remove all dapps struct from rpc ([#9107](https://github.com/paritytech/parity-ethereum/pull/9107)) - - Completely remove all dapps struct from rpc - - Remove unused pub use -- Removed redundant struct bounds and unnecessary data copying ([#9096](https://github.com/paritytech/parity-ethereum/pull/9096)) - - Removed redundant struct bounds and unnecessary data copying - - Updated docs, removed redundant bindings -- Insert ETC (classic) hardcoded headers until block 6170625 ([#9121](https://github.com/paritytech/parity-ethereum/pull/9121)) -- Make sure to produce full blocks. ([#9115](https://github.com/paritytech/parity-ethereum/pull/9115)) -- Update light client hardcoded headers ([#9098](https://github.com/paritytech/parity-ethereum/pull/9098)) - - Insert Kovan hardcoded headers until 7690241 - - Insert Kovan hardcoded headers until block 7690241 - - Insert Ropsten hardcoded headers until 3612673 - - Insert Mainnet hardcoded headers until block 5941249 -- Parity-version: bump nightly version to 2.1 ([#9095](https://github.com/paritytech/parity-ethereum/pull/9095)) -- Fix work-notify. ([#9104](https://github.com/paritytech/parity-ethereum/pull/9104)) -- Update snappy ([#9082](https://github.com/paritytech/parity-ethereum/pull/9082)) -- Offload cull to IoWorker. ([#9099](https://github.com/paritytech/parity-ethereum/pull/9099)) -- Docker: add cmake dependency ([#9111](https://github.com/paritytech/parity-ethereum/pull/9111)) -- Update hidapi, fixes [#7542](https://github.com/paritytech/parity-ethereum/issues/7542) ([#9108](https://github.com/paritytech/parity-ethereum/pull/9108)) -- Update README.md ([#9084](https://github.com/paritytech/parity-ethereum/pull/9084)) - - Update README.md - - Rename parity client - - Docs: remove UI stuff from readme. - - Docs: add changelog link to readme -- Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))" ([#9097](https://github.com/paritytech/parity-ethereum/pull/9097)) - - Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))" - - This reverts commit 7e77932. - - Restore some of the changes - - Update parity-common -- Multiple improvements to discovery ping handling ([#8771](https://github.com/paritytech/parity-ethereum/pull/8771)) - - Discovery: Only add nodes to routing table after receiving pong. - - Previously the discovery algorithm would add nodes to the routing table before confirming that the endpoint is participating in the protocol. This now tracks in-flight pings and adds to the routing table only after receiving a response. - - Discovery: Refactor packet creation into its own function. - - This function is useful inside unit tests. - - Discovery: Additional testing for new add_node behavior. - - Discovery: Track expiration of pings to non-yet-in-bucket nodes. - - Now that we may ping nodes before adding to a k-bucket, the timeout tracking must be separate from BucketEntry. - - Discovery: Verify echo hash on pong packets. - - Stores packet hash with in-flight requests and matches with pong response. - - Discovery: Track timeouts on FIND_NODE requests. - - Discovery: Retry failed pings with exponential backoff. - - Udp packets may get dropped, so instead of immediately booting nodes that fail to respond to a ping, retry 4 times with exponential backoff. - - !fixup Use slice instead of Vec for request_backoff. -- Add separate database directory for light client ([#8927](https://github.com/paritytech/parity-ethereum/pull/8927)) ([#9064](https://github.com/paritytech/parity-ethereum/pull/9064)) - - Add seperate default DB path for light client ([#8927](https://github.com/paritytech/parity-ethereum/pull/8927)) - - Improve readability +- Backport to parity 2.2.1 beta ([#9905](https://github.com/paritytech/parity-ethereum/pull/9905)) + - Bump version to 2.2.1 + - Fix: Intermittent failing CI due to addr in use ([#9885](https://github.com/paritytech/parity-ethereum/pull/9885)) + - Fix Parity not closing on Ctrl-C ([#9886](https://github.com/paritytech/parity-ethereum/pull/9886)) + - Fix json tracer overflow ([#9873](https://github.com/paritytech/parity-ethereum/pull/9873)) + - Fix docker script ([#9854](https://github.com/paritytech/parity-ethereum/pull/9854)) + - Add hardcoded headers for light client ([#9907](https://github.com/paritytech/parity-ethereum/pull/9907)) + - Gitlab-ci: make android release build succeed ([#9743](https://github.com/paritytech/parity-ethereum/pull/9743)) + - Allow to seal work on latest block ([#9876](https://github.com/paritytech/parity-ethereum/pull/9876)) + - Remove rust-toolchain file ([#9906](https://github.com/paritytech/parity-ethereum/pull/9906)) + - Light-fetch: Differentiate between out-of-gas/manual throw and use required gas from response on failure ([#9824](https://github.com/paritytech/parity-ethereum/pull/9824)) + - Eip-712 implementation ([#9631](https://github.com/paritytech/parity-ethereum/pull/9631)) + - Eip-191 implementation ([#9701](https://github.com/paritytech/parity-ethereum/pull/9701)) + - Simplify cargo audit ([#9918](https://github.com/paritytech/parity-ethereum/pull/9918)) + - Fix performance issue importing Kovan blocks ([#9914](https://github.com/paritytech/parity-ethereum/pull/9914)) + - Ci: nuke the gitlab caches ([#9855](https://github.com/paritytech/parity-ethereum/pull/9855)) +- Backports to parity beta 2.2.0 ([#9820](https://github.com/paritytech/parity-ethereum/pull/9820)) + - Ci: remove failing tests for android, windows, and macos ([#9788](https://github.com/paritytech/parity-ethereum/pull/9788)) + - Implement NoProof for json tests and update tests reference ([#9814](https://github.com/paritytech/parity-ethereum/pull/9814)) + - Move state root verification before gas used ([#9841](https://github.com/paritytech/parity-ethereum/pull/9841)) + - Classic.json Bootnode Update ([#9828](https://github.com/paritytech/parity-ethereum/pull/9828)) +- Rpc: parity_allTransactionHashes ([#9745](https://github.com/paritytech/parity-ethereum/pull/9745)) +- Revert "prevent zero networkID ([#9763](https://github.com/paritytech/parity-ethereum/pull/9763))" ([#9815](https://github.com/paritytech/parity-ethereum/pull/9815)) +- Allow zero chain id in EIP155 signing process ([#9792](https://github.com/paritytech/parity-ethereum/pull/9792)) +- Add readiness check for docker container ([#9804](https://github.com/paritytech/parity-ethereum/pull/9804)) +- Insert dev account before unlocking ([#9813](https://github.com/paritytech/parity-ethereum/pull/9813)) +- Removed "rustup" & added new runner tag ([#9731](https://github.com/paritytech/parity-ethereum/pull/9731)) +- Expose config max-round-blocks-to-import ([#9439](https://github.com/paritytech/parity-ethereum/pull/9439)) +- Aura: finalize blocks ([#9692](https://github.com/paritytech/parity-ethereum/pull/9692)) +- Sync: retry different peer after empty subchain heads response ([#9753](https://github.com/paritytech/parity-ethereum/pull/9753)) +- Fix(light-rpc/parity) : Remove unused client ([#9802](https://github.com/paritytech/parity-ethereum/pull/9802)) +- Drops support for olympic testnet, closes [#9800](https://github.com/paritytech/parity-ethereum/issues/9800) ([#9801](https://github.com/paritytech/parity-ethereum/pull/9801)) +- Replace `tokio_core` with `tokio` (`ring` -> 0.13) ([#9657](https://github.com/paritytech/parity-ethereum/pull/9657)) +- Support eth_chainId RPC method ([#9783](https://github.com/paritytech/parity-ethereum/pull/9783)) +- Ethcore: bump ropsten forkblock checkpoint ([#9775](https://github.com/paritytech/parity-ethereum/pull/9775)) +- Docs: changelogs for 2.0.8 and 2.1.3 ([#9758](https://github.com/paritytech/parity-ethereum/pull/9758)) +- Prevent zero networkID ([#9763](https://github.com/paritytech/parity-ethereum/pull/9763)) +- Skip seal fields count check when --no-seal-check is used ([#9757](https://github.com/paritytech/parity-ethereum/pull/9757)) +- Aura: fix panic on extra_info with unsealed block ([#9755](https://github.com/paritytech/parity-ethereum/pull/9755)) +- Docs: update changelogs ([#9742](https://github.com/paritytech/parity-ethereum/pull/9742)) +- Removed extra assert in generation_session_is_removed_when_succeeded ([#9738](https://github.com/paritytech/parity-ethereum/pull/9738)) +- Make checkpoint_storage_at use plain loop instead of recursion ([#9734](https://github.com/paritytech/parity-ethereum/pull/9734)) +- Use signed 256-bit integer for sstore gas refund substate ([#9746](https://github.com/paritytech/parity-ethereum/pull/9746)) +- Heads ref not present for branches beta and stable ([#9741](https://github.com/paritytech/parity-ethereum/pull/9741)) +- Add Callisto support ([#9534](https://github.com/paritytech/parity-ethereum/pull/9534)) +- Add --force to cargo audit install script ([#9735](https://github.com/paritytech/parity-ethereum/pull/9735)) +- Remove unused expired value from Handshake ([#9732](https://github.com/paritytech/parity-ethereum/pull/9732)) +- Add hardcoded headers ([#9730](https://github.com/paritytech/parity-ethereum/pull/9730)) +- Produce portable binaries ([#9725](https://github.com/paritytech/parity-ethereum/pull/9725)) +- Gitlab ci: releasable_branches: change variables condition to schedule ([#9729](https://github.com/paritytech/parity-ethereum/pull/9729)) +- Update a few parity-common dependencies ([#9663](https://github.com/paritytech/parity-ethereum/pull/9663)) +- Hf in POA Core (2018-10-22) ([#9724](https://github.com/paritytech/parity-ethereum/pull/9724)) +- Schedule nightly builds ([#9717](https://github.com/paritytech/parity-ethereum/pull/9717)) +- Fix ancient blocks sync ([#9531](https://github.com/paritytech/parity-ethereum/pull/9531)) +- Ci: Skip docs job for nightly ([#9693](https://github.com/paritytech/parity-ethereum/pull/9693)) +- Fix (light/provider) : Make `read_only executions` read-only ([#9591](https://github.com/paritytech/parity-ethereum/pull/9591)) +- Ethcore: fix detection of major import ([#9552](https://github.com/paritytech/parity-ethereum/pull/9552)) +- Return 0 on error ([#9705](https://github.com/paritytech/parity-ethereum/pull/9705)) +- Ethcore: delay ropsten hardfork ([#9704](https://github.com/paritytech/parity-ethereum/pull/9704)) +- Make instantSeal engine backwards compatible, closes [#9696](https://github.com/paritytech/parity-ethereum/issues/9696) ([#9700](https://github.com/paritytech/parity-ethereum/pull/9700)) +- Implement CREATE2 gas changes and fix some potential overflowing ([#9694](https://github.com/paritytech/parity-ethereum/pull/9694)) +- Don't hash the init_code of CREATE. ([#9688](https://github.com/paritytech/parity-ethereum/pull/9688)) +- Ethcore: minor optimization of modexp by using LR exponentiation ([#9697](https://github.com/paritytech/parity-ethereum/pull/9697)) +- Removed redundant clone before each block import ([#9683](https://github.com/paritytech/parity-ethereum/pull/9683)) +- Add Foundation Bootnodes ([#9666](https://github.com/paritytech/parity-ethereum/pull/9666)) +- Docker: run as parity user ([#9689](https://github.com/paritytech/parity-ethereum/pull/9689)) +- Ethcore: mcip3 block reward contract ([#9605](https://github.com/paritytech/parity-ethereum/pull/9605)) +- Verify block syncing responses against requests ([#9670](https://github.com/paritytech/parity-ethereum/pull/9670)) +- Add a new RPC `parity_submitWorkDetail` similar `eth_submitWork` but return block hash ([#9404](https://github.com/paritytech/parity-ethereum/pull/9404)) +- Resumable EVM and heap-allocated callstack ([#9360](https://github.com/paritytech/parity-ethereum/pull/9360)) +- Update parity-wordlist library ([#9682](https://github.com/paritytech/parity-ethereum/pull/9682)) +- Ci: Remove unnecessary pipes ([#9681](https://github.com/paritytech/parity-ethereum/pull/9681)) +- Test.sh: use cargo --target for platforms other than linux, win or mac ([#9650](https://github.com/paritytech/parity-ethereum/pull/9650)) +- Ci: fix push script ([#9679](https://github.com/paritytech/parity-ethereum/pull/9679)) +- Hardfork the testnets ([#9562](https://github.com/paritytech/parity-ethereum/pull/9562)) +- Calculate sha3 instead of sha256 for push-release. ([#9673](https://github.com/paritytech/parity-ethereum/pull/9673)) +- Ethcore-io retries failed work steal ([#9651](https://github.com/paritytech/parity-ethereum/pull/9651)) +- Fix(light_fetch): avoid race with BlockNumber::Latest ([#9665](https://github.com/paritytech/parity-ethereum/pull/9665)) +- Test fix for windows cache name... ([#9658](https://github.com/paritytech/parity-ethereum/pull/9658)) +- Refactor(fetch) : light use only one `DNS` thread ([#9647](https://github.com/paritytech/parity-ethereum/pull/9647)) +- Ethereum libfuzzer integration small change ([#9547](https://github.com/paritytech/parity-ethereum/pull/9547)) +- Cli: remove reference to --no-ui in --unlock flag help ([#9616](https://github.com/paritytech/parity-ethereum/pull/9616)) +- Remove master from releasable branches ([#9655](https://github.com/paritytech/parity-ethereum/pull/9655)) +- Ethcore/VerificationQueue don't spawn up extra `worker-threads` when explictly specified not to ([#9620](https://github.com/paritytech/parity-ethereum/pull/9620)) +- Rpc: parity_getBlockReceipts ([#9527](https://github.com/paritytech/parity-ethereum/pull/9527)) +- Remove unused dependencies ([#9589](https://github.com/paritytech/parity-ethereum/pull/9589)) +- Ignore key_server_cluster randomly failing tests ([#9639](https://github.com/paritytech/parity-ethereum/pull/9639)) +- Ethcore: handle vm exception when estimating gas ([#9615](https://github.com/paritytech/parity-ethereum/pull/9615)) +- Fix bad-block reporting no reason ([#9638](https://github.com/paritytech/parity-ethereum/pull/9638)) +- Use static call and apparent value transfer for block reward contract code ([#9603](https://github.com/paritytech/parity-ethereum/pull/9603)) +- Hf in POA Sokol (2018-09-19) ([#9607](https://github.com/paritytech/parity-ethereum/pull/9607)) +- Bump smallvec to 0.6 in ethcore-light, ethstore and whisper ([#9588](https://github.com/paritytech/parity-ethereum/pull/9588)) +- Add constantinople conf to EvmTestClient. ([#9570](https://github.com/paritytech/parity-ethereum/pull/9570)) +- Fix(network): don't disconnect reserved peers ([#9608](https://github.com/paritytech/parity-ethereum/pull/9608)) +- Fix failing node-table tests on mac os, closes [#9632](https://github.com/paritytech/parity-ethereum/issues/9632) ([#9633](https://github.com/paritytech/parity-ethereum/pull/9633)) +- Update ropsten.json ([#9602](https://github.com/paritytech/parity-ethereum/pull/9602)) +- Simplify ethcore errors by removing BlockImportError ([#9593](https://github.com/paritytech/parity-ethereum/pull/9593)) +- Fix windows compilation, replaces [#9561](https://github.com/paritytech/parity-ethereum/issues/9561) ([#9621](https://github.com/paritytech/parity-ethereum/pull/9621)) +- Master: rpc-docs set github token ([#9610](https://github.com/paritytech/parity-ethereum/pull/9610)) +- Docs: add changelogs for 1.11.10, 1.11.11, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.1.0, and 2.1.1 ([#9554](https://github.com/paritytech/parity-ethereum/pull/9554)) +- Docs(rpc): annotate tag with the provided message ([#9601](https://github.com/paritytech/parity-ethereum/pull/9601)) +- Ci: fix regex roll_eyes ([#9597](https://github.com/paritytech/parity-ethereum/pull/9597)) +- Remove snapcraft clean ([#9585](https://github.com/paritytech/parity-ethereum/pull/9585)) +- Add snapcraft package image (master) ([#9584](https://github.com/paritytech/parity-ethereum/pull/9584)) +- Docs(rpc): push the branch along with tags ([#9578](https://github.com/paritytech/parity-ethereum/pull/9578)) +- Fix typo for jsonrpc-threads flag ([#9574](https://github.com/paritytech/parity-ethereum/pull/9574)) +- Fix informant compile ([#9571](https://github.com/paritytech/parity-ethereum/pull/9571)) +- Added ropsten bootnodes ([#9569](https://github.com/paritytech/parity-ethereum/pull/9569)) +- Increase Gas-floor-target and Gas Cap ([#9564](https://github.com/paritytech/parity-ethereum/pull/9564)) +- While working on the platform tests make them non-breaking ([#9563](https://github.com/paritytech/parity-ethereum/pull/9563)) +- Improve P2P discovery ([#9526](https://github.com/paritytech/parity-ethereum/pull/9526)) +- Move dockerfile for android build container to scripts repo ([#9560](https://github.com/paritytech/parity-ethereum/pull/9560)) +- Simultaneous platform tests WIP ([#9557](https://github.com/paritytech/parity-ethereum/pull/9557)) +- Update ethabi-derive, serde, serde_json, serde_derive, syn && quote ([#9553](https://github.com/paritytech/parity-ethereum/pull/9553)) +- Ci: fix rpc docs generation 2 ([#9550](https://github.com/paritytech/parity-ethereum/pull/9550)) +- Ci: always run build pipelines for win, mac, linux, and android ([#9537](https://github.com/paritytech/parity-ethereum/pull/9537)) +- Multithreaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)) +- New ethabi ([#9511](https://github.com/paritytech/parity-ethereum/pull/9511)) +- Remove initial token for WS. ([#9545](https://github.com/paritytech/parity-ethereum/pull/9545)) +- Net_version caches network_id to avoid redundant aquire of sync readlock ([#9544](https://github.com/paritytech/parity-ethereum/pull/9544)) +- Correct before_script for nightly build versions ([#9543](https://github.com/paritytech/parity-ethereum/pull/9543)) +- Deps: bump kvdb-rocksdb to 0.1.4 ([#9539](https://github.com/paritytech/parity-ethereum/pull/9539)) +- State: test when contract creation fails, old storage values should re-appear ([#9532](https://github.com/paritytech/parity-ethereum/pull/9532)) +- Allow dropping light client RPC query with no results ([#9318](https://github.com/paritytech/parity-ethereum/pull/9318)) +- Bump master to 2.2.0 ([#9517](https://github.com/paritytech/parity-ethereum/pull/9517)) +- Enable all Constantinople hard fork changes in constantinople_test.json ([#9505](https://github.com/paritytech/parity-ethereum/pull/9505)) +- [Light] Validate `account balance` before importing transactions ([#9417](https://github.com/paritytech/parity-ethereum/pull/9417)) +- In create memory calculation is the same for create2 because the additional parameter was popped before. ([#9522](https://github.com/paritytech/parity-ethereum/pull/9522)) +- Update patricia trie to 0.2.2 ([#9525](https://github.com/paritytech/parity-ethereum/pull/9525)) +- Replace hardcoded JSON with serde json! macro ([#9489](https://github.com/paritytech/parity-ethereum/pull/9489)) +- Fix typo in version string ([#9516](https://github.com/paritytech/parity-ethereum/pull/9516)) ## Previous releases -- [CHANGELOG-2.0](docs/CHANGELOG-2.0.md) (_stable_) +- [CHANGELOG-2.1](docs/CHANGELOG-2.1.md) (_stable_) +- [CHANGELOG-2.0](docs/CHANGELOG-2.0.md) (EOL: 2018-11-15) - [CHANGELOG-1.11](docs/CHANGELOG-1.11.md) (EOL: 2018-09-19) - [CHANGELOG-1.10](docs/CHANGELOG-1.10.md) (EOL: 2018-07-18) - [CHANGELOG-1.9](docs/CHANGELOG-1.9.md) (EOL: 2018-05-09) diff --git a/Cargo.lock b/Cargo.lock index 15b621d12f9..4a7c03391a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,7 +210,6 @@ name = "chainspec" version = "0.1.0" dependencies = [ "ethjson 0.1.0", - "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -498,7 +497,6 @@ dependencies = [ "ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -686,6 +684,8 @@ dependencies = [ "rlp_compress 0.1.0", "rlp_derive 0.1.0", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "stats 0.1.0", "stop-guard 0.1.0", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -919,6 +919,7 @@ dependencies = [ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-runtime 0.1.0", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3231,14 +3232,6 @@ dependencies = [ "syn 0.15.11 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "serde_ignored" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "serde_json" version = "1.0.32" @@ -4442,7 +4435,6 @@ dependencies = [ "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" -"checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" "checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" "checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" "checksum sha1 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "171698ce4ec7cbb93babeb3190021b4d72e96ccb98e33d277ae4ea959d6f2d9e" diff --git a/chainspec/Cargo.toml b/chainspec/Cargo.toml index 780fcdff446..8739ca7dcba 100644 --- a/chainspec/Cargo.toml +++ b/chainspec/Cargo.toml @@ -6,4 +6,3 @@ authors = ["Marek Kotewicz "] [dependencies] ethjson = { path = "../json" } serde_json = "1.0" -serde_ignored = "0.0.4" diff --git a/chainspec/src/main.rs b/chainspec/src/main.rs index 708d74b503d..43f9c805754 100644 --- a/chainspec/src/main.rs +++ b/chainspec/src/main.rs @@ -15,10 +15,8 @@ // along with Parity. If not, see . extern crate serde_json; -extern crate serde_ignored; extern crate ethjson; -use std::collections::BTreeSet; use std::{fs, env, process}; use ethjson::spec::Spec; @@ -41,24 +39,11 @@ fn main() { Err(_) => quit(&format!("{} could not be opened", path)), }; - let mut unused = BTreeSet::new(); - let mut deserializer = serde_json::Deserializer::from_reader(file); - - let spec: Result = serde_ignored::deserialize(&mut deserializer, |field| { - unused.insert(field.to_string()); - }); + let spec: Result = serde_json::from_reader(file); if let Err(err) = spec { quit(&format!("{} {}", path, err.to_string())); } - if !unused.is_empty() { - let err = unused.into_iter() - .map(|field| format!("{} unexpected field `{}`", path, field)) - .collect::>() - .join("\n"); - quit(&err); - } - println!("{} is valid", path); } diff --git a/docs/CHANGELOG-2.0.md b/docs/CHANGELOG-2.0.md index 451312b37b6..e0e6b0c380f 100644 --- a/docs/CHANGELOG-2.0.md +++ b/docs/CHANGELOG-2.0.md @@ -1,3 +1,26 @@ +Note: Parity 2.0 reached End-of-Life on 2018-11-15 (EOL). + +## Parity-Ethereum [v2.0.9](https://github.com/paritytech/parity-ethereum/releases/tag/v2.0.9) (2018-10-29) + +Parity-Ethereum 2.0.9-stable is a bug-fix release to improve performance and stability. + +The full list of included changes: + +- Backports: parity stable 2.0.9 ([#9786](https://github.com/paritytech/parity-ethereum/pull/9786)) + - Version: bump parity stable to 2.0.9 + - Ethcore: bump ropsten forkblock checkpoint ([#9775](https://github.com/paritytech/parity-ethereum/pull/9775)) + - Ethcore: handle vm exception when estimating gas ([#9615](https://github.com/paritytech/parity-ethereum/pull/9615)) + - Update jsonrpc-core to a1b2bb742ce16d1168669ffb13ffe856e8131228 ([#9780](https://github.com/paritytech/parity-ethereum/pull/9780)) + - Removed "rustup" & added new runner tag ([#9731](https://github.com/paritytech/parity-ethereum/pull/9731)) + - Removed "rustup" & added new runner tag + - Exchanged tag "rust-windows" with "windows" + - Revert windows tag change + - Allow zero chain id in EIP155 signing process ([#9792](https://github.com/paritytech/parity-ethereum/pull/9792)) + - Allow zero chain id in EIP155 signing process + - Rename test + - Fix test failure + - Insert dev account before unlocking ([#9813](https://github.com/paritytech/parity-ethereum/pull/9813)) + ## Parity-Ethereum [v2.0.8](https://github.com/paritytech/parity-ethereum/releases/tag/v2.0.8) (2018-10-16) Parity-Ethereum 2.0.8-stable is a release that fixes a consensus issue with the recent Constantinople release. Upgrading is mandatory whatever network you are connected to that plans enabling EIP-1283, e.g., Ropsten, Kovan, Ethereum. diff --git a/docs/CHANGELOG-2.1.md b/docs/CHANGELOG-2.1.md new file mode 100644 index 00000000000..865b7f278ab --- /dev/null +++ b/docs/CHANGELOG-2.1.md @@ -0,0 +1,902 @@ +## Parity-Ethereum [v2.1.6](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.6) (2018-11-15) + +Parity-Ethereum 2.1.6-stable is a release that improves performance and stability. + +The full list of included changes: +- Backport to parity 2.1.6-stable ([#9904](https://github.com/paritytech/parity-ethereum/pull/9904)) + - Bump version to 2.1.6 + - Fix: Intermittent failing CI due to addr in use ([#9885](https://github.com/paritytech/parity-ethereum/pull/9885)) + - Add hardcoded headers for light client ([#9907](https://github.com/paritytech/parity-ethereum/pull/9907)) + - Gitlab-ci: make android release build succeed ([#9743](https://github.com/paritytech/parity-ethereum/pull/9743)) + - Light-fetch: Differentiate between out-of-gas/manual throw and use required gas from response on failure ([#9824](https://github.com/paritytech/parity-ethereum/pull/9824)) + - Remove rust-toolchain file ([#9906](https://github.com/paritytech/parity-ethereum/pull/9906)) + - Simplify cargo audit ([#9918](https://github.com/paritytech/parity-ethereum/pull/9918)) + - Ci: nuke the gitlab caches ([#9855](https://github.com/paritytech/parity-ethereum/pull/9855)) + +- Backports to parity stable 2.1.5 (not released) ([#9821](https://github.com/paritytech/parity-ethereum/pull/9821)) + - Ci: remove failing tests for android, windows, and macos ([#9788](https://github.com/paritytech/parity-ethereum/pull/9788)) + - Move state root verification before gas used ([#9841](https://github.com/paritytech/parity-ethereum/pull/9841)) + - Classic.json Bootnode Update ([#9828](https://github.com/paritytech/parity-ethereum/pull/9828)) + +## Parity-Ethereum [v2.1.4](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.4) (2018-10-29) + +Parity-Ethereum 2.1.4-beta is a release that improves performance and stability. + +The full list of included changes: + +- Backports: parity beta 2.1.4 ([#9787](https://github.com/paritytech/parity-ethereum/pull/9787)) + - Version: bump parity beta to 2.1.4 + - Ethcore: bump ropsten forkblock checkpoint ([#9775](https://github.com/paritytech/parity-ethereum/pull/9775)) + - Ethcore: handle vm exception when estimating gas ([#9615](https://github.com/paritytech/parity-ethereum/pull/9615)) + - Removed "rustup" & added new runner tag ([#9731](https://github.com/paritytech/parity-ethereum/pull/9731)) + - Removed "rustup" & added new runner tag + - Exchanged tag "rust-windows" with "windows" + - Revert windows tag change + - Sync: retry different peer after empty subchain heads response ([#9753](https://github.com/paritytech/parity-ethereum/pull/9753)) + - If no subchain heads then try a different peer + - Add log when useless chain head + - Restrict ChainHead useless peer to ancient blocks + - Sync: replace `limit_reorg` with `block_set` condition + - Update jsonrpc-core to a1b2bb742ce16d1168669ffb13ffe856e8131228 ([#9780](https://github.com/paritytech/parity-ethereum/pull/9780)) + - Allow zero chain id in EIP155 signing process ([#9792](https://github.com/paritytech/parity-ethereum/pull/9792)) + - Allow zero chain id in EIP155 signing process + - Rename test + - Fix test failure + - Insert dev account before unlocking ([#9813](https://github.com/paritytech/parity-ethereum/pull/9813)) + +## Parity-Ethereum [v2.1.3](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.3) (2018-10-16) + +Parity-Ethereum 2.1.3-stable is a release that fixes a consensus issue with the recent Constantinople release. Upgrading is mandatory whatever network you are connected to that plans enabling EIP-1283, e.g., Ropsten, Kovan, Ethereum. + +The full list of included changes: + +- Beta release 2.1.3 backports ([#9749](https://github.com/paritytech/parity-ethereum/pull/9749)) + - Parity-version: mark 2.1.3 beta as critical + - Use signed 256-bit integer for sstore gas refund substate ([#9746](https://github.com/paritytech/parity-ethereum/pull/9746)) + - Add --force to cargo audit install script ([#9735](https://github.com/paritytech/parity-ethereum/pull/9735)) + - Heads ref not present for branches beta and stable ([#9741](https://github.com/paritytech/parity-ethereum/pull/9741)) + - Aura: fix panic on extra_info with unsealed block ([#9755](https://github.com/paritytech/parity-ethereum/pull/9755)) + +## Parity-Ethereum [v2.1.2](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.2) (2018-10-12) + +Parity-Ethereum 2.1.2-beta is a release that introduces **Constantinople** to the Ethereum client. Upgrading is strongly recommended. + +![europe-1803495_1280](https://user-images.githubusercontent.com/15729797/46785767-15f1e280-cd33-11e8-862a-458edfd73ecf.png) + +The following hardforks are supported by this release: + +- Ropsten testnet block `4_230_000` on October 14, 2018 (Constantinople) +- POA core mainnet block `5_329_160` on October 22, 2018 (CORE HF 2) +- Kovan testnet block `9_200_000` on October 25, 2018 (Constantinople, KIP-{4,6}) + +Running one of these networks, an upgrade to 2.0.7 or 2.1.2 is mandatory. More details can be found in Changelog below. + +Please note, the following deprecations in our distribution of binaries: + +- `arm*` targets are no longer served by parity, please consider (cross-)compiling from source yourself. +- `i*86` targets are no longer served by parity, please consider upgrading your operating system. +- Snapcraft is no longer maintained. please use binaries directly or your distro's repositories. + +The full list of included changes: + +- More backports for 2.1.2 ([#9733](https://github.com/paritytech/parity-ethereum/pull/9733)) + - Produce portable binaries ([#9725](https://github.com/paritytech/parity-ethereum/pull/9725)) + - HF in POA Core (2018-10-22) ([#9724](https://github.com/paritytech/parity-ethereum/pull/9724)) + - Use static call and apparent value transfer for block reward contract code ([#9603](https://github.com/paritytech/parity-ethereum/pull/9603)) + - Verify block syncing responses against requests ([#9670](https://github.com/paritytech/parity-ethereum/pull/9670)) + - Fix ancient blocks sync ([#9531](https://github.com/paritytech/parity-ethereum/pull/9531)) + - Add hardcoded headers ([#9730](https://github.com/paritytech/parity-ethereum/pull/9730)) + - Gitlab ci: releasable_branches: change variables condition to schedule ([#9729](https://github.com/paritytech/parity-ethereum/pull/9729)) +- Backports for beta 2.1.2 ([#9649](https://github.com/paritytech/parity-ethereum/pull/9649)) + - Parity-version: bump beta to 2.1.2 + - Ethcore: fix detection of major import ([#9552](https://github.com/paritytech/parity-ethereum/pull/9552)) + - Hardfork the testnets ([#9562](https://github.com/paritytech/parity-ethereum/pull/9562)) + - Docs(rpc): push the branch along with tags ([#9578](https://github.com/paritytech/parity-ethereum/pull/9578)) + - Remove snapcraft clean ([#9585](https://github.com/paritytech/parity-ethereum/pull/9585)) + - Fix (light/provider) : Make `read_only executions` only read-only ([#9591](https://github.com/paritytech/parity-ethereum/pull/9591)) + - Ci: fix regex 🙄 ([#9597](https://github.com/paritytech/parity-ethereum/pull/9597)) + - Docs(rpc): annotate tag with the provided message ([#9601](https://github.com/paritytech/parity-ethereum/pull/9601)) + - Update ropsten bootnodes ([#9602](https://github.com/paritytech/parity-ethereum/pull/9602)) + - HF in POA Sokol (2018-09-19) ([#9607](https://github.com/paritytech/parity-ethereum/pull/9607)) + - Fix(network): don't disconnect reserved peers ([#9608](https://github.com/paritytech/parity-ethereum/pull/9608)) + - Fix failing node-table tests on mac os ([#9633](https://github.com/paritytech/parity-ethereum/pull/9633)) + - Fix bad-block reporting no reason ([#9638](https://github.com/paritytech/parity-ethereum/pull/9638)) + - Ethcore-io retries failed work steal ([#9651](https://github.com/paritytech/parity-ethereum/pull/9651)) + - Remove master from releasable branches ([#9655](https://github.com/paritytech/parity-ethereum/pull/9655)) + - Test fix for windows cache name... ([#9658](https://github.com/paritytech/parity-ethereum/pull/9658)) + - Fix(light_fetch): avoid race with BlockNumber::Latest ([#9665](https://github.com/paritytech/parity-ethereum/pull/9665)) + - Calculate sha3 instead of sha256 for push-release. ([#9673](https://github.com/paritytech/parity-ethereum/pull/9673)) + - Ci: fix push script ([#9679](https://github.com/paritytech/parity-ethereum/pull/9679)) + - CI: Remove unnecessary pipes ([#9681](https://github.com/paritytech/parity-ethereum/pull/9681)) + - Don't hash the init_code of CREATE. ([#9688](https://github.com/paritytech/parity-ethereum/pull/9688)) + - Docker: run parity as normal user ([#9689](https://github.com/paritytech/parity-ethereum/pull/9689)) + - CI: Skip docs job for master and nightly ([#9693](https://github.com/paritytech/parity-ethereum/pull/9693)) + - Implement CREATE2 gas changes and fix some potential overflowing ([#9694](https://github.com/paritytech/parity-ethereum/pull/9694)) + - Make instantSeal engine backwards compatible ([#9700](https://github.com/paritytech/parity-ethereum/pull/9700)) + - Ethcore: delay ropsten hardfork ([#9704](https://github.com/paritytech/parity-ethereum/pull/9704)) + +## Parity-Ethereum [v2.1.1](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.1) (2018-09-20) + +Parity-Ethereum 2.1.1-beta is a release that does not improve performance and stability; no changes were made. + +The full list of included changes: + +- Backports for 2.1.1 beta ([#9599](https://github.com/paritytech/parity-ethereum/pull/9599)) + - Parity: bump version to 2.1.1 beta + - Ci: fix regex roll_eyes + - Docs(rpc): annotate tag with the provided message + +## Parity-Ethereum [v2.1.0](https://github.com/paritytech/parity-ethereum/releases/tag/v2.1.0) (2018-09-19) + +Parity-Ethereum 2.1.0-beta is released! Look at this! + +Important notices: + +- This release moves the 2.1 track of Parity-Ethereum to beta. +- This release contains a low-severity issue with the web-sockets ports. [#9545](https://github.com/paritytech/parity-ethereum/pull/9545) +- This release resolves a potential network fragmentation issue. [#9526](https://github.com/paritytech/parity-ethereum/pull/9526) +- With this release, all versions of Parity Ethereum 1.x prior to 2.0 reached end of life. +- Users are urged to upgrade to 2.0.5-stable or 2.1.0-beta. + +Further changes worth highlighting: + +- Generalized `blockReward` and `difficultyBombDelays` config ([#9480](https://github.com/paritytech/parity-ethereum/pull/9480)): This removes `eip649*` parameters from chain specs and allows `blockReward` to accept `multi`. Please review your chain-specs! +- Implement EIP234 `block_hash` for `eth_getLogs` ([#9256](https://github.com/paritytech/parity-ethereum/pull/9256)): If `block_hash` and `from_block`/`to_block` present, return error. This also changes `eth_getLogs` to return error if any of `block_hash`/`from_block`/`to_block` cannot be found. +- The default `gas_floor_target` was increased to `8_000_000`, the default `gas_cap` to `10_000_000`. +- Light clients provide the actual account for `eth_coinbase` RPC ([#9383](https://github.com/paritytech/parity-ethereum/pull/9383)). Note, this behavior is different from the full client where we return the `0x0` address if no accounts are found! +- Light servers give free credits for reserved peers ([#9448](https://github.com/paritytech/parity-ethereum/pull/9448)): When connecting to a reserved peers in light client, assign free credits to them. This fixes the scenario where a home server is running a full node, and another light client connects to the full node as a reserved peer. +- Multi-threaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)): to speed up the generation of snapshots on disk, this can be parallelized now. By default N/2 CPU cores are being used. Use `--snapshot-threads` flag to customize the number of threads. +- Remove all dapp permissions related settings ([#9120](https://github.com/paritytech/parity-ethereum/pull/9120)). This completely removes dapp permission settings from `AccountProvider` and JSON-RPC: In JSON-RPC, all available accounts are returned, regardless of the origin; previously we return accounts based on dapps policy. It's not possible to set a "default account" (as for dapps) any more; this is now always the first account in the available account list. +- Remove unused `--tx_queue_gas` parameter ([#9153](https://github.com/paritytech/parity-ethereum/pull/9153)). Please use `parity --help` to learn about available transaction queue strategies. + +The full list of included changes: + +- Add snapcraft package image ([#9583](https://github.com/paritytech/parity-ethereum/pull/9583)) + - Add snapcraft package image + - Update .gitlab-ci.yml + - Remove snapcraft clean +- Backports for 2.1.0 beta ([#9518](https://github.com/paritytech/parity-ethereum/pull/9518)) + - Parity-version: mark 2.1.0 track beta + - Ci: update branch version references + - Docker: release master to latest + - Fix checkpointing when creating contract failed ([#9514](https://github.com/paritytech/parity-ethereum/pull/9514)) + - Ci: fix json docs generation ([#9515](https://github.com/paritytech/parity-ethereum/pull/9515)) + - Fix typo in version string ([#9516](https://github.com/paritytech/parity-ethereum/pull/9516)) + - Update patricia trie to 0.2.2 crates. Default dependencies on minor version only. + - Putting back ethereum tests to the right commit + - Enable all Constantinople hard fork changes in constantinople_test.json ([#9505](https://github.com/paritytech/parity-ethereum/pull/9505)) + - Enable all Constantinople hard fork changes in constantinople_test.json + - Address grumbles + - Remove EIP-210 activation + - 8m -> 5m + - Temporarily add back eip210 transition so we can get test passed + - Add eip210_test and remove eip210 transition from const_test + - In create memory calculation is the same for create2 because the additional parameter was popped before. ([#9522](https://github.com/paritytech/parity-ethereum/pull/9522)) + - Deps: bump fs-swap and kvdb-rocksdb + - Multithreaded snapshot creation ([#9239](https://github.com/paritytech/parity-ethereum/pull/9239)) + - Add Progress to Snapshot Secondary chunks creation + - Use half of CPUs to multithread snapshot creation + - Use env var to define number of threads + - Info to debug logs + - Add Snapshot threads as CLI option + - Randomize chunks per thread + - Remove randomness, add debugging + - Add warning + - Add tracing + - Use parity-common fix seek branch + - Fix log + - Fix tests + - Fix tests + - Pr Grumbles + - Pr Grumble II + - Update Cargo.lock + - Pr Grumbles + - Default snapshot threads to half number of CPUs + - Fix default snapshot threads // min 1 + - Correct before_script for nightly build versions ([#9543](https://github.com/paritytech/parity-ethereum/pull/9543)) + - Fix gitlab array of strings syntax error + - Get proper commit id + - Avoid colon in stings + - Remove initial token for WS. ([#9545](https://github.com/paritytech/parity-ethereum/pull/9545)) + - Version: mark release critical + - Ci: fix rpc docs generation 2 ([#9550](https://github.com/paritytech/parity-ethereum/pull/9550)) + - Improve P2P discovery ([#9526](https://github.com/paritytech/parity-ethereum/pull/9526)) + - Add `target` to Rust traces + - Network-devp2p: Don't remove discovery peer in main sync + - Network-p2p: Refresh discovery more often + - Update Peer discovery protocol + - Run discovery more often when not enough nodes connected + - Start the first discovery early + - Update fast discovery rate + - Fix tests + - Fix `ping` tests + - Fixing remote Node address ; adding PingPong round + - Fix tests: update new +1 PingPong round + - Increase slow Discovery rate + - Check in flight FindNode before pings + - Add `deprecated` to deprecated_echo_hash + - Refactor `discovery_round` branching + - Net_version caches network_id to avoid redundant acquire of sync read lock ([#9544](https://github.com/paritytech/parity-ethereum/pull/9544)) + - Net_version caches network_id to avoid redundant acquire of sync read lock, [#8746](https://github.com/paritytech/parity-ethereum/issues/8746) + - Use lower_hex display formatting for net_peerCount rpc method + - Increase Gas-floor-target and Gas Cap ([#9564](https://github.com/paritytech/parity-ethereum/pull/9564)) + - Gas-floor-target increased to 8M by default + - Gas-cap increased to 10M by default + - Revert to old parity-tokio-ipc. + - Downgrade named pipes. +- Fix checkpointing when creating contract failed ([#9514](https://github.com/paritytech/parity-ethereum/pull/9514)) +- Ci: fix json docs generation ([#9515](https://github.com/paritytech/parity-ethereum/pull/9515)) +- Update state tests execution model ([#9440](https://github.com/paritytech/parity-ethereum/pull/9440)) + - Update & fix JSON state tests. + - Update tests to be able to run ethtest at 021fe3d410773024cd5f0387e62db6e6ec800f32. + - Touch user in state + - Adjust transaction tests to new json format + - Switch to same commit for submodule ethereum/test as geth (next includes constantinople changes). + - Added test `json_tests::trie::generic::TrieTests_trieanyorder` and a few difficulty tests. + - Remove trietestnextprev as it would require to parse differently and implement it. + - Support new (shitty) format of transaction tests. + - Ignore junk in ethereum/tests repo. + - Ignore incorrect test. + - Update to a later commit + - Move block number to a constant. + - Fix ZK2 test - touched account should also be cleared. + - Fix conflict resolution +- Upload will fail if a file with the same hash is already up ([#9479](https://github.com/paritytech/parity-ethereum/pull/9479)) + - Upload will fail if a file with the same hash is already up + - Compose version string for nightly releases +- Fix Snapshot restoration failure on Windows ([#9491](https://github.com/paritytech/parity-ethereum/pull/9491)) + - Close Blooms DB files before DB restoration +- Don't error when Snapshot is aborted ([#9492](https://github.com/paritytech/parity-ethereum/pull/9492)) +- Light: give free credits for reserved peers ([#9448](https://github.com/paritytech/parity-ethereum/pull/9448)) + - Light: give free credits for reserved peers + - Fix ethcore-light tests + - Test free_flow_params +- Parity: print correct keys path on startup ([#9501](https://github.com/paritytech/parity-ethereum/pull/9501)) +- Generalized blockReward and difficultyBombDelays config ([#9480](https://github.com/paritytech/parity-ethereum/pull/9480)) + - Implement multi blockReward + - Implement difficultyBombDelays + - Fix json crate compile + - Json keys can only be string +- Rpc(debug_getBadBlocks): fix test ([#9502](https://github.com/paritytech/parity-ethereum/pull/9502)) +- Bad blocks RPC + reporting ([#9433](https://github.com/paritytech/parity-ethereum/pull/9433)) + - Bad blocks RPC. + - Return bad blocks via RPC. + - Fix test. + - More verbose bad block message. + - Expose via CLI. + - Remove stray whitespace. + - Remove stray newline. + - Fix tests. +- Eip 1283: Net gas metering for SSTORE without dirty maps ([#9319](https://github.com/paritytech/parity-ethereum/pull/9319)) + - Implement last_checkpoint_storage_at + - Add reverted_storage_at for externalities + - Sstore_clears_count -> sstore_clears_refund + - Implement eip1283 for evm + - Add eip1283Transition params + - Evm: fix tests + - Jsontests: fix test + - Return checkpoint index when creating + - Comply with spec Version II + - Fix docs + - Fix jsontests feature compile + - Address grumbles + - Fix no-checkpoint-entry case + - Remove unnecessary expect + - Add test for State::checkpoint_storage_at + - Add executive level test for eip1283 + - Hard-code transaction_checkpoint_index to 0 + - Fix jsontests + - Add tests for checkpoint discard/revert + - Require checkpoint to be empty for kill_account and commit + - Get code coverage + - Use saturating_add/saturating_sub + - Fix issues in insert_cache + - Clear the state again + - Fix original_storage_at + - Early return for empty RLP trie storage + - Update comments + - Fix borrow_mut issue + - Simplify checkpoint_storage_at if branches + - Better commenting for gas handling code + - Address naming grumbles + - More tests + - Fix an issue in overwrite_with + - Add another test + - Fix comment + - Remove unnecessary bracket + - Move orig to inner if + - Remove test coverage for this PR + - Add tests for executive original value + - Add warn! for an unreachable cause +- Light `clippy(fy)` ([#9473](https://github.com/paritytech/parity-ethereum/pull/9473)) + - Wasm tests + - `clippyfy` light-client + - Revert inefficient change `collect_ready()` +- Aura: don't report skipped primaries when empty steps are enabled ([#9435](https://github.com/paritytech/parity-ethereum/pull/9435)) +- Support millisecond timestamp for instant seal engine ([#9469](https://github.com/paritytech/parity-ethereum/pull/9469)) + - Support millisecond timestamp for instant seal engine + - Forgot to checkin instant_seal mod + - Fix instant seal config + - Fix json crate compile + - Fix private_spec.json + - Option -> bool +- Ethcore: don't validate difficulty when ignoring seal check ([#9470](https://github.com/paritytech/parity-ethereum/pull/9470)) + - Ethcore: don't validate difficulty when ignoring seal check + - Ethcore: fix block verification test + - Ethcore: document skipped verifications when check_seal is disabled +- [light/jsonrpc] Provide the actual account for `eth_coinbase` RPC and unify error handling for light and full client ([#9383](https://github.com/paritytech/parity-ethereum/pull/9383)) + - Provide the actual `account` for eth_coinbase + - The previous implementation always provided the `zero address` on `eth_coinbase` RPC. Now, instead the actual address is returned on success or an error when no account(s) is found! + - Full client `eth_coinbase` return err + - In the full-client return an error when no account is found instead of returning the `zero address` + - Remove needless blocks on single import + - Remove needless `static` lifetime on const + - Fix `rpc_eth_author` test +- Add a Java interface ([#9346](https://github.com/paritytech/parity-ethereum/pull/9346)) + - Add a Java interface + - Use system ABI + - Forgot exception + - Fix param for parity_rpc + - Address concerns +- Fetch `parity-common` crates from crates.io ([#9410](https://github.com/paritytech/parity-ethereum/pull/9410)) + - Fetch `parity-common` crates from crates.io + - Add doc tests from `patricia-trie` to `patricia-trie-ethereum` + - Fix/update a few deps + - [ethkey] upgrade ethereum-types + - [whisper] update deps + - [network] deps + - [network-devp2p] deps + - [journaldb] deps + - [fastmap] deps + - [miner] deps and test fixes + - [machine] deps + - [json] deps + - [hw] deps + - [ethash] deps + - [registrar] deps + - Update a few more dependencies with new ethabi-* + - [updater] Update deps + - Deps + - [ethcore] Update deps + - Use new parity-snappy and parity-rocksdb crates + - Updated submodules + - Use parity-snappy 0.1 + - Use kvdb-rocksdb 0.1.2 + - Don't use latest ethereum/tests + - Fix merge conflicts errors + - Remove superseeded comment + - Address grumbles: add newlines, add/remove spaces +- Fixed typo ([#9467](https://github.com/paritytech/parity-ethereum/pull/9467)) +- Fix light client deadlock ([#9385](https://github.com/paritytech/parity-ethereum/pull/9385)) + - This PR is fixing deadlock for [#8918](https://github.com/paritytech/parity-ethereum/issues/8918) + - It avoids some recursive calls on light_sync by making state check optional for Informant. + - The current behavior is to display the information when informant checks if block is major version. + - This change a bit the informant behavior, but not on most cases. + - To remember where and how this kind of deadlock are likely to happen (not seen with Parkinglot deadlock detection because it uses std condvar), I am adding a description of the deadlock. + - Also, for the reviewers there may be better solution than modifying the informant. +- Fix docs of address_hash ([#9463](https://github.com/paritytech/parity-ethereum/pull/9463)) +- Fix typo in bash script ([#9462](https://github.com/paritytech/parity-ethereum/pull/9462)) +- Fix a bug in evmbin initial_gas display ([#9457](https://github.com/paritytech/parity-ethereum/pull/9457)) +- Evmbin: escape newlines in json errors ([#9458](https://github.com/paritytech/parity-ethereum/pull/9458)) +- Use kvdb-* and parity-snappy crates from crates.io ([#9441](https://github.com/paritytech/parity-ethereum/pull/9441)) + - Use kvdb-* and parity-snappy crates from crates.io + - Update rocksdb-sys and snappy-sys +- Add EIP-1014 transition config flag ([#9268](https://github.com/paritytech/parity-ethereum/pull/9268)) + - Add EIP-1014 transition config flag + - Remove EIP-86 configs + - Change CREATE2 opcode index to 0xf5 + - Move salt to the last item in the stack + - Change sendersaltandaddress scheme to comply with current EIP-1014 + - Fix json configs + - Fix create2 test + - Fix deprecated comments +- Add tags for runner selection of build-linux jobs ([#9451](https://github.com/paritytech/parity-ethereum/pull/9451)) +- Remove unused BlockStatus::Pending ([#9447](https://github.com/paritytech/parity-ethereum/pull/9447)) + - Pending case never instantiated, and only ever matched together with Unknown +- Ci: only include local paths in coverage script (except target) ([#9437](https://github.com/paritytech/parity-ethereum/pull/9437)) +- Add POA Networks: Core and Sokol ([#9413](https://github.com/paritytech/parity-ethereum/pull/9413)) + - Ethcore: add poa network and sokol chainspecs + - Rpc: simplify chain spec docs + - Cli: rearrange networks by main/test and size/range + - Parity: don't blacklist 0x00a328 on sokol testnet + - Parity: add sokol and poanet to params and clean up a bit, add tests + - Ethcore: add the poa networks and clean up a bit + - Ethcore: fix path to poacore chain spec + - Parity: rename poa networks to poacore and poasokol + - Parity: fix configuration tests + - Parity: fix parameter tests + - Ethcore: rename POA Core and POA Sokol +- Docker: install missing dependencies in arm target dockerfiles ([#9436](https://github.com/paritytech/parity-ethereum/pull/9436)) +- Random small cleanups ([#9423](https://github.com/paritytech/parity-ethereum/pull/9423)) + - Clean up toml files + - Update the parity ethereum toolchain docs + - Update contribution guide and issue templates + - Update desktop and service files + - Build clib examples with 8 threads + - Update header templates + - Replace parity technologies with parity ethereum logo +- Evmbin: Fix gas_used issue in state root mismatch and handle output better ([#9418](https://github.com/paritytech/parity-ethereum/pull/9418)) + - Fix gas used in staterootmismatch, and print full state root hash + - Write trace info for stdjson to stderr + - Fix tests + - Remove struct trait bound +- Update hardcoded sync ([#9421](https://github.com/paritytech/parity-ethereum/pull/9421)) + - Update foundation hardcoded header to block 6219777 + - Update ropsten hardcoded header to block 3917825 + - Update kovan hardcoded header to block 8511489 +- Add block reward contract config to ethash and allow off-chain contracts ([#9312](https://github.com/paritytech/parity-ethereum/pull/9312)) + - This adds block reward contract config to ethash. A new config `blockRewardContractCode` is also added to both Aura and ethash. When specified, it will execute the code directly and overrides any `blockRewardContractAddress` config. Having this `blockRewardContractCode` config allows chains to deploy hard fork by simply replacing the current config value, without the need from us to support any `multi` block reward scheme. +- Private packets verification and queue refactoring ([#8715](https://github.com/paritytech/parity-ethereum/pull/8715)) + - Verify private transaction before propagating + - Private transactions queue reworked with tx pool queue direct usage + - Styling fixed + - Prevent resending private packets to the sender + - Process signed private transaction packets via io queue + - Test fixed + - Build and test fixed after merge + - Comments after review fixed + - Signed transaction taken from verified + - Fix after merge + - Pool scoring generalized in order to use externally + - Lib refactored according to the review comments + - Ready state refactored + - Redundant bound and copying removed + - Fixed build after the merge + - Forgotten case reworked + - Review comments fixed + - Logging reworked, target added + - Fix after merge +- Update tobalaba.json ([#9419](https://github.com/paritytech/parity-ethereum/pull/9419)) +- Docs: add parity ethereum logo to readme ([#9415](https://github.com/paritytech/parity-ethereum/pull/9415)) + - Docs: add parity ethereum logo + - Docs: add logo to readme + - Docs: align logo center + - Docs: remove separators from readme + - Docs: restructure readme + - Docs: check spelling and grammar in readme + - Docs: clarify readme + - Docs: improve readme significantly +- Build: update rocksdb crate ([#9414](https://github.com/paritytech/parity-ethereum/pull/9414)) +- Updating the CI system ([#8765](https://github.com/paritytech/parity-ethereum/pull/8765)) + - Updating the CI system with the publication of releases and binary files on github + - Add missed scripts + - Chmod +x scripts + - Fix download link for github + - Rebuilding CI scripts + - Small fixes + - Update submodule wasm tests + - Ci: fix merge leftovers + - Ci: remove gitlab-next from ci triggers + - Ci: fix git add in docs script + - Ci: use nightly instead of master for publish triggers + - Ci: remove sleep from gitlab config + - Ci: replace ':' with '-' in gitlab targets + - Ci: fix recursive copy in docs script +- Better support for eth_getLogs in light mode ([#9186](https://github.com/paritytech/parity-ethereum/pull/9186)) + - Light client on-demand request for headers range. + - Cache headers in HeaderWithAncestors response. + - Also fulfills request locally if all headers are in cache. + - Lightfetch::logs fetches missing headers on demand. + - Lightfetch::logs limit the number of headers requested at a time. + - Lightfetch::logs refactor header fetching logic. + - Enforce limit on header range length in light client logs request. + - Fix light request tests after struct change. + - Respond to review comments. +- Add update docs script to CI ([#9219](https://github.com/paritytech/parity-ethereum/pull/9219)) + - Add update docs script to CI + - Added a script to CI that will use the jsonrpc tool to update rpc documentation then commit and push those to the wiki repo. + - Fix gitlab ci lint + - Only apply jsonrpc docs update on tags + - Update gitlab-rpc-docs.sh + - Copy correct parity repo to jsonrpc folder + - Copy correct parity repo to jsonrpc folder before attempting to build docs since the CI runner clones the repo as parity and not parity-ethereum. + - Fix JSONRPC docs CI job + - Update remote config in wiki repo before pushing changes using a github token for authentication. Add message to wiki tag when pushing changes. Use project directory to correctly copy parity code base into the jsonrpc repo for doc generation. + - Fix set_remote_wiki function call in CI +- `gasleft` extern implemented for WASM runtime (kip-6) ([#9357](https://github.com/paritytech/parity-ethereum/pull/9357)) + - Wasm gasleft extern added + - Wasm_gasleft_activation_transition -> kip4_transition + - Use kip-6 switch + - Gasleft_panic -> gasleft_fail rename + - Call_msg_gasleft test added and gas_left agustments because this paritytech/wasm-tests#52 + - Change .. to _ + - Fix comment for the have_gasleft param + - Update tests (paritytech/wasm-tests-0edbf86) +- Block view! removal in progress ([#9397](https://github.com/paritytech/parity-ethereum/pull/9397)) +- Prevent sync restart if import queue full ([#9381](https://github.com/paritytech/parity-ethereum/pull/9381)) +- Nonroot CentOS Docker image ([#9280](https://github.com/paritytech/parity-ethereum/pull/9280)) + - Updates CentOS Docker image build process + - Rename build.Dockerfile +- Ethcore: kovan: delay activation of strict score validation ([#9406](https://github.com/paritytech/parity-ethereum/pull/9406)) +- Revert "Use std::sync::Condvar ([#1732](https://github.com/paritytech/parity-ethereum/pull/1732))" ([#9392](https://github.com/paritytech/parity-ethereum/pull/9392)) + - Revert "Use std::sync::Condvar ([#1732](https://github.com/paritytech/parity-ethereum/pull/1732))" + - This reverts commit c65ee93. + - Verification_queue: remove redundant mutexes +- Replace `std::env::home_dir()` with `home` crate impl. ([#9293](https://github.com/paritytech/parity-ethereum/pull/9293)) + - Import the `home` crate in `util/dir`. + - Replace uses of `env::home_dir()` with `home::home_dir()`. + - `home` uses a 'correct' impl. on windows and the stdlib impl. of `::home_dir` otherwise. + - Reexport `home::home_dir` from `util/dir`. + - Bump `util/dir` to 0.1.2. + - Docs: restore readme ([#9391](https://github.com/paritytech/parity-ethereum/pull/9391)) + - Replace `Duration::new()` w/ `Duration::from_nanos` ([#9387](https://github.com/paritytech/parity-ethereum/pull/9387)) +- Delete Dockerfile ([#9386](https://github.com/paritytech/parity-ethereum/pull/9386)) +- Network-devp2p `Fix some clippy errors/warnings` ([#9378](https://github.com/paritytech/parity-ethereum/pull/9378)) + - Fix some clippy warnings + - Remove `shallow-copy` of Node's + - Make `NonReservedPeerMode` Copy and pass-by-value +- Allow calling contracts in genesis state. ([#9375](https://github.com/paritytech/parity-ethereum/pull/9375)) +- Make `Capabilities struct` Copy ([#9372](https://github.com/paritytech/parity-ethereum/pull/9372)) +- Light client "Enable more logs for light client `on_demand`" ([#9374](https://github.com/paritytech/parity-ethereum/pull/9374)) + - Enable more logs for light client `on_demand` + - Remove extra whitespace + - Fix indentation +- Better logging when mining own transactions. ([#9363](https://github.com/paritytech/parity-ethereum/pull/9363)) +- Fix typos in `network-devp2p` ([#9371](https://github.com/paritytech/parity-ethereum/pull/9371)) +- Light client `Provide default nonce in transactions when it´s missing` ([#9370](https://github.com/paritytech/parity-ethereum/pull/9370)) + - Provide `default_nonce` in tx`s when it´s missing + - When `nonce` is missing in a `EthTransaction` will cause it to fall in these cases provide `default_nonce` value instead! + - Changed http:// to https:// on Yasm link ([#9369](https://github.com/paritytech/parity-ethereum/pull/9369)) + - Changed http:// to https:// on Yasm link in README.md + - Provide `default_nonce` in tx`s when it´s missing + - When `nonce` is missing in a `EthTransaction` will cause it to fall in these cases provide `default_nonce` value instead! + - Address grumbles +- Changed http:// to https:// on Yasm link ([#9369](https://github.com/paritytech/parity-ethereum/pull/9369)) + - Changed http:// to https:// on Yasm link in README.md +- Fix no line breaks in logs ([#9355](https://github.com/paritytech/parity-ethereum/pull/9355)) +- Lower the max size of transaction packet to prevent going oversize. ([#9308](https://github.com/paritytech/parity-ethereum/pull/9308)) + - Lower the max size of transaction packet to prevent going oversize. + - Log RLP size. +- Remove prepare_trace_output and make sure prepare_trace_call and trace*call are balanced ([#9353](https://github.com/paritytech/parity-ethereum/pull/9353)) + - This refactors `prepare_trace_output` to instead directly take the reference of return values, so that it's simpler and we save a stack item. This should also fixes [the issue]([#9236](https://github.com/paritytech/parity-ethereum/pull/9236) (comment)) udoprog is facing. Replaces [#9236](https://github.com/paritytech/parity-ethereum/issues/9236) +- More details in logs returned by light client ([#9324](https://github.com/paritytech/parity-ethereum/pull/9324)) + - Log details for light logs. + - Create Log directly. +- Expose UnorderedIterator. ([#9347](https://github.com/paritytech/parity-ethereum/pull/9347)) +- Light client logs should include 'from_block' when querying logs ([#9331](https://github.com/paritytech/parity-ethereum/pull/9331)) + - Fix PubSub for logs when using light client: + - Prior to this fix the pubsub process did send a query for each new block header (and for each subs: there is something to optimize here) by setting from and to of the filter at this block number; but there was a bug in the code that fetch logs : it was non inclusive for its start bound, meaning that with start bound = end bound we never query any block (and attached logs). + - Option iter instead of once. + - Use of bloom existing function to check if a bloom contains another. + - Makes from block header checking explicit +- Remove pass-by-reference return data value from executive ([#9211](https://github.com/paritytech/parity-ethereum/pull/9211)) + - Remove pass-by-reference return data value from executive + - Fix tests + - Fix a missing test output + - Typo: wasm_activation_test + - Tracing change in output + - Json_tests: fix compile + - Typo: 0..32 -> ..32 to keep it consistent with other occurance + - Fix tests +- Allow single opcode stepping for EVM ([#9051](https://github.com/paritytech/parity-ethereum/pull/9051)) + - Feed in ActionParams on VM creation + - Fix ethcore after Vm interface change + - Move informant inside Interpreter struct + - Move do_trace to Interpreter struct + - Move all remaining exec variables to Interpreter struct + - Refactor VM to allow single opcode step + - Fix all EVM tests + - Fix all wasm tests + - Fix wasm runner tests + - Fix a check case where code length is zero + - Fix jsontests compile + - Fix cargo lock + - Use match instead of expect + - Use cheaper check reader.len() == 0 for the initial special case + - Get rid of try_and_done! macro by using Result<(), ReturnType> + - Use Never instead of () + - Fix parity-bytes path + - Bypass gasometer lifetime problem by borrow only for a instance + - Typo: missing { + - Fix ethcore test compile + - Fix evm tests +- Fix load share ([#9321](https://github.com/paritytech/parity-ethereum/pull/9321)) + - Fix(light_sync): calculate `load_share` properly + - Refactor(api.rs): extract `light_params` fn, add test + - Style(api.rs): add trailing commas +- Implement EIP234 block_hash for eth_getLogs ([#9256](https://github.com/paritytech/parity-ethereum/pull/9256)) + - Implement EIP234 + - Make filter conversion returns error if both blockHash and from/toBlock is found + - This also changes PollFilter to store the EthFilter type, instead of the jsonrpc one, saving repeated conversion. + - Return error if block filtering target is not found in eth_getLogs + - Use the old behavior (unwrap_or_default) for anywhere else. + - Fix test: secret_store + - Fix weird indentation + - Make client log filter return error in case a block cannot be found + - Return blockId error in rpc + - Test_client: allow return error on logs + - Add a mocked test for eth_getLogs error + - Fix: should return error if from_block/to_block greater than best block number + - Add notes on pending + - Add comment for UNSUPPORTED_REQUEST + - Address grumbles + - Return err if from > to +- Ethcore: fix pow difficulty validation ([#9328](https://github.com/paritytech/parity-ethereum/pull/9328)) + - Ethcore: fix pow difficulty validation + - Ethcore: validate difficulty is not zero + - Ethcore: add issue link to regression test + - Ethcore: fix tests + - Ethcore: move difficulty_to_boundary to ethash crate + - Ethcore: reuse difficulty_to_boundary and boundary_to_difficulty + - Ethcore: fix grumbles in difficulty_to_boundary_aux +- Ethcore/sync `Make view macro only visible to test` ([#9316](https://github.com/paritytech/parity-ethereum/pull/9316)) + - Remove needless macro import + - Enable ethcore/macros in tests +- Allow setting the panic hook with parity-clib ([#9292](https://github.com/paritytech/parity-ethereum/pull/9292)) + - Allow setting the panic hook with parity-clib + - Make all FFI functions unsafe + - Fix comment + - Fix concern +- Prevent blockchain & miner racing when accessing pending block. ([#9310](https://github.com/paritytech/parity-ethereum/pull/9310)) + - Prevent blockchain & miner racing when accessing pending block. + - Fix unavailability of pending block during reseal. +- Docker alpine: use multi-stage concept ([#9269](https://github.com/paritytech/parity-ethereum/pull/9269)) + - Docker alpine: use multi-stage concept + - Docker alpine: create config directory +- Update `log` -> 0.4, `env_logger` -> 0.5. ([#9294](https://github.com/paritytech/parity-ethereum/pull/9294)) + - Rename a few types & methods. + - Change `(Log)Builder::format` (closure) arg. +- Update tobalaba.json ([#9313](https://github.com/paritytech/parity-ethereum/pull/9313)) +- Allow tx pool to be Send ([#9315](https://github.com/paritytech/parity-ethereum/pull/9315)) +- Fix codecov.io badge in README ([#9327](https://github.com/paritytech/parity-ethereum/pull/9327)) +- Move ethereum-specific H256FastMap type to own crate ([#9307](https://github.com/paritytech/parity-ethereum/pull/9307)) + - Add a `fastmap` crate that provides the H256FastMap specialized HashMap + - Use `fastmap` instead of `plain_hasher` + - Update submodules for Reasons™ + - Submodule update +- Ethcore sync decodes rlp less often ([#9264](https://github.com/paritytech/parity-ethereum/pull/9264)) + - Deserialize block only once during verification + - Ethcore-sync uses Unverified + - Ethcore-sync uses Unverified + - Fixed build error + - Removed Block::is_good + - Applied review suggestions + - Ethcore-sync deserializes headers and blocks only once +- Ethcore: add transition flag for transaction permission contract ([#9275](https://github.com/paritytech/parity-ethereum/pull/9275)) + - Ethcore: add transition flag for transaction permission contract + - Ethcore: fix transaction permission contract tests +- Remove all dapp permissions related settings ([#9120](https://github.com/paritytech/parity-ethereum/pull/9120)) + - Completely remove all dapps struct from rpc + - Remove unused pub use + - Remove dapp policy/permission func in ethcore + - Remove all dapps settings from rpc + - Fix rpc tests + - Use both origin and user_agent + - Address grumbles + - Address grumbles + - Fix tests +- Improve return data truncate logic ([#9254](https://github.com/paritytech/parity-ethereum/pull/9254)) + - Improve return data truncate logic + - Fix: size -> offset + size +- Update wasm-tests hash ([#9295](https://github.com/paritytech/parity-ethereum/pull/9295)) +- Implement KIP4: create2 for wasm ([#9277](https://github.com/paritytech/parity-ethereum/pull/9277)) + - Basic implementation for kip4 + - Add KIP-4 config flags + - Typo: docs fix + - Fix args offset + - Add tests for create2 + - Tests: evm + - Update wasm-tests and fix all gas costs + - Update wasm-tests + - Update wasm-tests and fix gas costs +- Fix loop start value ([#9285](https://github.com/paritytech/parity-ethereum/pull/9285)) +- Avoid using $HOME if not necessary ([#9273](https://github.com/paritytech/parity-ethereum/pull/9273)) + - Avoid using $HOME if not necessary + - Fix concerns and issues +- Fix path to parity.h ([#9274](https://github.com/paritytech/parity-ethereum/pull/9274)) + - Fix path to parity.h + - Fix other paths as well +- Propagate transactions for next 4 blocks. ([#9265](https://github.com/paritytech/parity-ethereum/pull/9265)) + - Closes [#9255](https://github.com/paritytech/parity-ethereum/issues/9255) + - This PR also removes the limit of max 64 transactions per packet, currently we only attempt to prevent the packet size to go over 8MB. This will only be the case for super-large transactions or high-block-gas-limit chains. Patching this is important only for chains that have blocks that can fit more than 4k transactions (over 86M block gas limit) For mainnet, we should actually see a tiny bit faster propagation since instead of computing 4k pending set, we only need `4 * 8M / 21k = 1523` transactions. Running some tests on `dekompile` node right now, to check how it performs in the wild. +- Decode block rlp less often ([#9252](https://github.com/paritytech/parity-ethereum/pull/9252)) + - Removed 4 redundant rlp deserializations + - Avoid 1 redundant block data copy +- Fix eternalities tests can_create (missing parameter) ([#9270](https://github.com/paritytech/parity-ethereum/pull/9270)) +- Update ref to `parity-common` and update `seek` behaviour ([#9257](https://github.com/paritytech/parity-ethereum/pull/9257)) + - Update ref to `parity-common` and update `seek` behaviour + - Remove reference to `ng-fix-triedb-seek` branch +- Comply EIP-86 with the new definition ([#9140](https://github.com/paritytech/parity-ethereum/pull/9140)) + - Comply EIP-86 with the new CREATE2 opcode + - Fix rpc compile + - Fix interpreter CREATE/CREATE2 stack pop difference + - Add unreachable! to fix compile + - Fix instruction_info + - Fix gas check due to new stack item + - Add new tests in executive + - Fix have_create2 comment + - Remove all unused references of eip86_transition and block_number +- Check if synced when using eth_getWork ([#9193](https://github.com/paritytech/parity-ethereum/pull/9193)) ([#9210](https://github.com/paritytech/parity-ethereum/pull/9210)) + - Check if synced when using eth_getWork ([#9193](https://github.com/paritytech/parity-ethereum/pull/9193)) + - Don't use fn syncing + - Fix identation + - Fix typo + - Don't check for warping + - Rpc: avoid calling queue_info twice on eth_getWork +- Removed client error ([#9253](https://github.com/paritytech/parity-ethereum/pull/9253)) +- Implement EIP-1052 (EXTCODEHASH) and fix several issues in state account cache ([#9234](https://github.com/paritytech/parity-ethereum/pull/9234)) + - Implement EIP-1052 and fix several issues related to account cache + - Fix jsontests + - Merge two matches together + - Avoid making unnecessary Arc + - Address grumbles +- Improve Tracer documentation ([#9237](https://github.com/paritytech/parity-ethereum/pull/9237)) +- Update Dockerfile ([#9242](https://github.com/paritytech/parity-ethereum/pull/9242)) + - Update Dockerfile + - Fix Docker build + - Fix dockerfile paths: parity -> parity-ethereum ([#9248](https://github.com/paritytech/parity-ethereum/pull/9248)) +- Block cleanup ([#9117](https://github.com/paritytech/parity-ethereum/pull/9117)) + - Blockchain insert expects owned block instead of block reference + - Reduce a number of times a block is deserialized + - Removed cached uncle_bytes from block + - Removed is_finalized from OpenBlock + - Removed unused parity_machine::WithMetadata trait + - Removed commented out code + - Remove unused metadata from block + - Remove unused metadata from block + - Blockdetails extras may have at most 5 elements +- Increase the number of sessions. ([#9203](https://github.com/paritytech/parity-ethereum/pull/9203)) +- Add changelog for 1.11.8 stable and 2.0.1 beta ([#9230](https://github.com/paritytech/parity-ethereum/pull/9230)) + - Docs: add changelog for 1.11.8 stable + - Docs: add changelog for 2.0.1 beta +- Fix typo ([#9232](https://github.com/paritytech/parity-ethereum/pull/9232)) +- Fix potential as_usize overflow when casting from U256 in miner ([#9221](https://github.com/paritytech/parity-ethereum/pull/9221)) +- Allow old blocks from peers with lower difficulty ([#9226](https://github.com/paritytech/parity-ethereum/pull/9226)) + - Previously we only allow downloading of old blocks if the peer difficulty was greater than our syncing difficulty. This change allows downloading of blocks from peers where the difficulty is greater then the last downloaded old block. +- Removes duplicate libudev-dev from Dockerfile ([#9220](https://github.com/paritytech/parity-ethereum/pull/9220)) +- Snap: remove ssl dependencies from snapcraft definition ([#9222](https://github.com/paritytech/parity-ethereum/pull/9222)) +- Remove ssl from dockerfiles, closes [#8880](https://github.com/paritytech/parity-ethereum/issues/8880) ([#9195](https://github.com/paritytech/parity-ethereum/pull/9195)) +- Insert PROOF messages for some cases in blockchain ([#9141](https://github.com/paritytech/parity-ethereum/pull/9141)) + - Insert PROOF messages for some cases in blockchain + - Break expect to its own line to avoid things being too long + - Be more specific for all low-level database error cases + - Fix BranchBecomingCanonChain expect + - Ethcore: fix typo in expect proof message +- [chain] Add more bootnodes ([#9174](https://github.com/paritytech/parity-ethereum/pull/9174)) + - For ETC, ELLA, EXP, Morden, MUSIC +- Ethcore: update bn version ([#9217](https://github.com/paritytech/parity-ethereum/pull/9217)) +- Deserialize block only once during verification ([#9161](https://github.com/paritytech/parity-ethereum/pull/9161)) +- Simple build instruction fix ([#9215](https://github.com/paritytech/parity-ethereum/pull/9215)) + - Changed `parity` dir name into `parity-ethereum` +- Added --tx-queue-no-early-reject flag to disable early tx queue rejects ([#9143](https://github.com/paritytech/parity-ethereum/pull/9143)) + - Added --tx-queue-no-early-reject flag to disable early tx queue rejects because of low gas price + - Fixed failing tests, clarified comments and simplified no_early_reject field name. + - Added test case for the --tx-queue-no-early-reject flag +- Avoid schedule copying in nested call/create ([#9190](https://github.com/paritytech/parity-ethereum/pull/9190)) + - Avoid schedule copying in nested call/create + - Fix tests + - Fix test: wrong Schedule used + - Fix private-tx test + - Fix jsontests compilation +- Ethcore: add builtin benchmarks based on geth ([#9179](https://github.com/paritytech/parity-ethereum/pull/9179)) + - Ethcore: add geth benchmarks for all builtins + - Ethcore: remove old builtin benchmarks +- Rpc: fix is_major_importing sync state condition ([#9112](https://github.com/paritytech/parity-ethereum/pull/9112)) + - Rpc: fix is_major_importing sync state condition + - Rpc: fix informant printout when waiting for peers +- Docs: update repository links ([#9159](https://github.com/paritytech/parity-ethereum/pull/9159)) + - Docs: update repository links + - Docs: update repository links in contribution guide +- Parity: fix UserDefaults json parser ([#9189](https://github.com/paritytech/parity-ethereum/pull/9189)) + - Parity: fix UserDefaults json parser + - Parity: use serde_derive for UserDefaults + - Parity: support deserialization of old UserDefault json format + - Parity: make UserDefaults serde backwards compatible + - Parity: tabify indentation in UserDefaults +- Update "This is a bug. Please report it at:" link ([#9191](https://github.com/paritytech/parity-ethereum/pull/9191)) +- Docker: update hub dockerfile ([#9173](https://github.com/paritytech/parity-ethereum/pull/9173)) + - Update Dockerfile for hub + - Update to Ubuntu Xenial 16.04 + - Fix cmake version + - Docker: fix tab indentation in hub dockerfile +- Ci: update version strings for snaps ([#9160](https://github.com/paritytech/parity-ethereum/pull/9160)) +- Ethcore: add missing builtins benchmarks ([#9170](https://github.com/paritytech/parity-ethereum/pull/9170)) + - Ethcore: add modexp benchmarks + - Ethcore: add_bn_128_add benchmark +- Fix bugfix hard fork logic ([#9138](https://github.com/paritytech/parity-ethereum/pull/9138)) + - Fix bugfix hard fork logic + - Remove dustProtectionTransition from bugfix category + - Eip-168 is not enabled by default + - Remove unnecessary 'static +- Be more graceful on Aura difficulty validation ([#9164](https://github.com/paritytech/parity-ethereum/pull/9164)) + - Be more graceful on Aura difficulty validation + - Test: rejects_step_backwards + - Test: proposer_switching + - Test: rejects_future_block + - Test: reports_skipped + - Test: verify_empty_seal_steps +- Handle SyncHandler errors properly ([#9151](https://github.com/paritytech/parity-ethereum/pull/9151)) + - Handle SyncHandler errors properly, closes [#9150](https://github.com/paritytech/parity-ethereum/issues/9150) + - Applied review suggestions +- Remove node-health ([#9119](https://github.com/paritytech/parity-ethereum/pull/9119)) + - Remove node-health + - Remove ntp_servers + - Add --ntp-servers as legacy instead of removing it + - Add --ntp-servers to deprecated args + - Remove unused stuff + - Remove _legacy_ntp_servers +- Remove unused tx_queue_gas parameter. ([#9153](https://github.com/paritytech/parity-ethereum/pull/9153)) +- Changelogs for 1.11.7-stable and 2.0.0-beta ([#9105](https://github.com/paritytech/parity-ethereum/pull/9105)) + - Docs: mark 1.10 as end-of-life + - Docs: move changelog for 1.11 + - Docs: Add changelog for 1.11.7-stable + - Docs: add changelog for 2.0.0-beta + - Docs: add release notes for 2.0.0 beta + - Docs: fix links in changelog + - Docs: Update changelog for 1.11.7-stable + - Docs: Update changelog for 2.0.0-beta + - Docs: address Tbaut's comments for the 2.0.0-beta changelog + - Docs: add note regarding txqueue changes as recommended by tomusdrw +- Disable per-sender limit for local transactions. ([#9148](https://github.com/paritytech/parity-ethereum/pull/9148)) + - Disable per-sender limit for local transactions. + - Add a missing new line. +- Parity: fix logging cli parameter example ([#9154](https://github.com/paritytech/parity-ethereum/pull/9154)) +- Be more specific for `-l` CLI arguments ([#9149](https://github.com/paritytech/parity-ethereum/pull/9149)) + - Update mod.rs +- Receipt constructor `Allocate less stack for blooms` ([#9146](https://github.com/paritytech/parity-ethereum/pull/9146)) + - Allocate less stack in `Receipt ctor` + - Ethcore: use accrue_bloom when computing transaction receipt +- `evm bench` fix broken dependencies ([#9134](https://github.com/paritytech/parity-ethereum/pull/9134)) + - `evm bench` use valid dependencies + - Benchmarks of the `evm` used stale versions of a couple a crates that this commit fixes! + - Fix warnings +- Update snapcraft.yaml ([#9132](https://github.com/paritytech/parity-ethereum/pull/9132)) +- Fix verification in ethcore-sync collect_blocks ([#9135](https://github.com/paritytech/parity-ethereum/pull/9135)) +- Unify engine error to reject blocks ([#9085](https://github.com/paritytech/parity-ethereum/pull/9085)) + - Reject if Engine::on_close_block returns error + - Unify open block behaviors + - Fix tests in ethcore + - Fix Aura tests + - Fix RPC test + - Print a warning if open block failed + - Print the actual error when closing the block + - Update comments for prepare_pending_block + - Add BlockPreparationStatus to distingish three different state after prepare_pending_block +- Fix `todo` in `ethcore/types::Receipt` constructor ([#9086](https://github.com/paritytech/parity-ethereum/pull/9086)) + - Remove needless mutable variable and assignment +- Completely remove all dapps struct from rpc ([#9107](https://github.com/paritytech/parity-ethereum/pull/9107)) + - Completely remove all dapps struct from rpc + - Remove unused pub use +- Removed redundant struct bounds and unnecessary data copying ([#9096](https://github.com/paritytech/parity-ethereum/pull/9096)) + - Removed redundant struct bounds and unnecessary data copying + - Updated docs, removed redundant bindings +- Insert ETC (classic) hardcoded headers until block 6170625 ([#9121](https://github.com/paritytech/parity-ethereum/pull/9121)) +- Make sure to produce full blocks. ([#9115](https://github.com/paritytech/parity-ethereum/pull/9115)) +- Update light client hardcoded headers ([#9098](https://github.com/paritytech/parity-ethereum/pull/9098)) + - Insert Kovan hardcoded headers until 7690241 + - Insert Kovan hardcoded headers until block 7690241 + - Insert Ropsten hardcoded headers until 3612673 + - Insert Mainnet hardcoded headers until block 5941249 +- Parity-version: bump nightly version to 2.1 ([#9095](https://github.com/paritytech/parity-ethereum/pull/9095)) +- Fix work-notify. ([#9104](https://github.com/paritytech/parity-ethereum/pull/9104)) +- Update snappy ([#9082](https://github.com/paritytech/parity-ethereum/pull/9082)) +- Offload cull to IoWorker. ([#9099](https://github.com/paritytech/parity-ethereum/pull/9099)) +- Docker: add cmake dependency ([#9111](https://github.com/paritytech/parity-ethereum/pull/9111)) +- Update hidapi, fixes [#7542](https://github.com/paritytech/parity-ethereum/issues/7542) ([#9108](https://github.com/paritytech/parity-ethereum/pull/9108)) +- Update README.md ([#9084](https://github.com/paritytech/parity-ethereum/pull/9084)) + - Update README.md + - Rename parity client + - Docs: remove UI stuff from readme. + - Docs: add changelog link to readme +- Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))" ([#9097](https://github.com/paritytech/parity-ethereum/pull/9097)) + - Revert "Replace `std::env::home_dir` with `dirs::home_dir` ([#9077](https://github.com/paritytech/parity-ethereum/pull/9077))" + - This reverts commit 7e77932. + - Restore some of the changes + - Update parity-common +- Multiple improvements to discovery ping handling ([#8771](https://github.com/paritytech/parity-ethereum/pull/8771)) + - Discovery: Only add nodes to routing table after receiving pong. + - Previously the discovery algorithm would add nodes to the routing table before confirming that the endpoint is participating in the protocol. This now tracks in-flight pings and adds to the routing table only after receiving a response. + - Discovery: Refactor packet creation into its own function. + - This function is useful inside unit tests. + - Discovery: Additional testing for new add_node behavior. + - Discovery: Track expiration of pings to non-yet-in-bucket nodes. + - Now that we may ping nodes before adding to a k-bucket, the timeout tracking must be separate from BucketEntry. + - Discovery: Verify echo hash on pong packets. + - Stores packet hash with in-flight requests and matches with pong response. + - Discovery: Track timeouts on FIND_NODE requests. + - Discovery: Retry failed pings with exponential backoff. + - Udp packets may get dropped, so instead of immediately booting nodes that fail to respond to a ping, retry 4 times with exponential backoff. + - !fixup Use slice instead of Vec for request_backoff. +- Add separate database directory for light client ([#8927](https://github.com/paritytech/parity-ethereum/pull/8927)) ([#9064](https://github.com/paritytech/parity-ethereum/pull/9064)) + - Add seperate default DB path for light client ([#8927](https://github.com/paritytech/parity-ethereum/pull/8927)) + - Improve readability diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 0e3ea23a7cc..fc034a79635 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -67,6 +67,8 @@ unexpected = { path = "../util/unexpected" } journaldb = { path = "../util/journaldb" } keccak-hasher = { path = "../util/keccak-hasher" } kvdb-rocksdb = "0.1.3" +serde = "1.0" +serde_derive = "1.0" tempdir = {version="0.3", optional = true} [target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))'.dependencies] @@ -103,13 +105,15 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"] # EVM debug traces are printed. slow-blocks = [] # Run JSON consensus tests. -json-tests = ["ethcore-transaction/json-tests", "test-helpers", "tempdir"] +json-tests = ["ethcore-transaction/json-tests", "test-helpers", "tempdir", "to-pod-full"] # Skip JSON consensus tests with pending issues. ci-skip-issue = [] # Run memory/cpu heavy tests. test-heavy = [] # Compile test helpers test-helpers = ["tempdir"] +# Enables slow 'to-pod-full' method for use in tests and evmbin. +to-pod-full = [] [[bench]] name = "builtin" diff --git a/ethcore/res/ethereum/byzantium_test.json b/ethcore/res/ethereum/byzantium_test.json index 4bc9565bccb..9fdde9d13e5 100644 --- a/ethcore/res/ethereum/byzantium_test.json +++ b/ethcore/res/ethereum/byzantium_test.json @@ -28,7 +28,6 @@ "eip160Transition": "0x0", "eip161abcTransition": "0x0", "eip161dTransition": "0x0", - "eip98Transition": "0xffffffffffffffff", "eip140Transition": "0x0", "eip211Transition": "0x0", "eip214Transition": "0x0", diff --git a/ethcore/res/ethereum/callisto.json b/ethcore/res/ethereum/callisto.json index b347717c573..3513e8bb761 100644 --- a/ethcore/res/ethereum/callisto.json +++ b/ethcore/res/ethereum/callisto.json @@ -32,7 +32,6 @@ "eip161abcTransition": 10, "eip161dTransition": 10, "eip155Transition": 10, - "eip98Transition": "0xffffffffffffffff", "eip140Transition": 20, "eip211Transition": 20, "eip214Transition": 20, diff --git a/ethcore/res/ethereum/classic.json b/ethcore/res/ethereum/classic.json index a5b6dba8cd2..203b9b101e6 100644 --- a/ethcore/res/ethereum/classic.json +++ b/ethcore/res/ethereum/classic.json @@ -30,8 +30,7 @@ "eip160Transition": 3000000, "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip155Transition": 3000000, - "eip98Transition": "0x7fffffffffffff" + "eip155Transition": 3000000 }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/constantinople_test.json b/ethcore/res/ethereum/constantinople_test.json index 97a4bca90f3..b6db5cddb9b 100644 --- a/ethcore/res/ethereum/constantinople_test.json +++ b/ethcore/res/ethereum/constantinople_test.json @@ -24,7 +24,6 @@ "networkID" : "0x1", "maxCodeSize": 24576, "maxCodeSizeTransition": "0x0", - "eip98Transition": "0xffffffffffffffff", "eip150Transition": "0x0", "eip160Transition": "0x0", "eip161abcTransition": "0x0", diff --git a/ethcore/res/ethereum/easthub.json b/ethcore/res/ethereum/easthub.json index bcc34a78273..51de695cd1b 100644 --- a/ethcore/res/ethereum/easthub.json +++ b/ethcore/res/ethereum/easthub.json @@ -26,8 +26,7 @@ "eip160Transition": "0x0", "eip155Transition": "0x0", "eip161abcTransition": "0x7fffffffffffffff", - "eip161dTransition": "0x7fffffffffffffff", - "eip98Transition": "0x7fffffffffffff" + "eip161dTransition": "0x7fffffffffffffff" }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/eip150_test.json b/ethcore/res/ethereum/eip150_test.json index 32f6401ff87..34b0338fa8b 100644 --- a/ethcore/res/ethereum/eip150_test.json +++ b/ethcore/res/ethereum/eip150_test.json @@ -22,7 +22,6 @@ "eip160Transition": "0x7fffffffffffffff", "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip98Transition": "0x7fffffffffffffff", "eip155Transition": "0x7fffffffffffffff", "maxCodeSize": 24576, "maxCodeSizeTransition": "0x7fffffffffffffff" diff --git a/ethcore/res/ethereum/eip161_test.json b/ethcore/res/ethereum/eip161_test.json index b64b6b0470e..c593db7356e 100644 --- a/ethcore/res/ethereum/eip161_test.json +++ b/ethcore/res/ethereum/eip161_test.json @@ -22,7 +22,6 @@ "eip160Transition": "0x0", "eip161abcTransition": "0x0", "eip161dTransition": "0x0", - "eip98Transition": "0x7fffffffffffffff", "eip155Transition": "0x0", "maxCodeSize": 24576, "maxCodeSizeTransition": "0x0" diff --git a/ethcore/res/ethereum/eip210_test.json b/ethcore/res/ethereum/eip210_test.json index 9733e5d87ef..adf7f2964ec 100644 --- a/ethcore/res/ethereum/eip210_test.json +++ b/ethcore/res/ethereum/eip210_test.json @@ -20,7 +20,6 @@ "networkID" : "0x1", "maxCodeSize": 24576, "maxCodeSizeTransition": "0x0", - "eip98Transition": "0xffffffffffffffff", "eip150Transition": "0x0", "eip160Transition": "0x0", "eip161abcTransition": "0x0", diff --git a/ethcore/res/ethereum/ellaism.json b/ethcore/res/ethereum/ellaism.json index 7b3c8dd5ca2..946b340f933 100644 --- a/ethcore/res/ethereum/ellaism.json +++ b/ethcore/res/ethereum/ellaism.json @@ -28,7 +28,6 @@ "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", "eip155Transition": "0x0", - "eip98Transition": "0x7fffffffffffff", "wasmActivationTransition": 2000000, "eip140Transition": 2000000, "eip211Transition": 2000000, diff --git a/ethcore/res/ethereum/expanse.json b/ethcore/res/ethereum/expanse.json index 4c108d4de10..073d8fe4836 100644 --- a/ethcore/res/ethereum/expanse.json +++ b/ethcore/res/ethereum/expanse.json @@ -41,7 +41,6 @@ "eip160Transition": "0x927C0", "eip161abcTransition": "0x927C0", "eip161dTransition": "0x927C0", - "eip98Transition": "0x7fffffffffffff", "eip155Transition": "0x927C0", "eip140Transition": "0xC3500", "eip211Transition": "0xC3500", diff --git a/ethcore/res/ethereum/foundation.json b/ethcore/res/ethereum/foundation.json index e14d7e0862c..acf41d3ed7b 100644 --- a/ethcore/res/ethereum/foundation.json +++ b/ethcore/res/ethereum/foundation.json @@ -153,7 +153,6 @@ "eip161abcTransition": 2675000, "eip161dTransition": 2675000, "eip155Transition": 2675000, - "eip98Transition": "0x7fffffffffffff", "maxCodeSize": 24576, "maxCodeSizeTransition": 2675000, "eip140Transition": 4370000, diff --git a/ethcore/res/ethereum/frontier_like_test.json b/ethcore/res/ethereum/frontier_like_test.json index 3596217cb99..a71f19d82dc 100644 --- a/ethcore/res/ethereum/frontier_like_test.json +++ b/ethcore/res/ethereum/frontier_like_test.json @@ -142,7 +142,6 @@ "eip160Transition": "0x7fffffffffffffff", "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip98Transition": "0x7fffffffffffff", "eip155Transition": "0x7fffffffffffffff" }, "genesis": { diff --git a/ethcore/res/ethereum/frontier_test.json b/ethcore/res/ethereum/frontier_test.json index b01ae9ef010..7ee81346795 100644 --- a/ethcore/res/ethereum/frontier_test.json +++ b/ethcore/res/ethereum/frontier_test.json @@ -22,7 +22,6 @@ "eip160Transition": "0x7fffffffffffffff", "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip98Transition": "0x7fffffffffffff", "eip155Transition": "0x7fffffffffffffff" }, "genesis": { diff --git a/ethcore/res/ethereum/homestead_test.json b/ethcore/res/ethereum/homestead_test.json index 2dc521b9af6..766e4fd2296 100644 --- a/ethcore/res/ethereum/homestead_test.json +++ b/ethcore/res/ethereum/homestead_test.json @@ -18,7 +18,6 @@ "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x1", - "eip98Transition": "0x7fffffffffffff", "eip155Transition": "0x7fffffffffffffff", "eip150Transition": "0x7fffffffffffffff", "eip160Transition": "0x7fffffffffffffff", diff --git a/ethcore/res/ethereum/kovan.json b/ethcore/res/ethereum/kovan.json index 1935e4174e3..532bc88d6a1 100644 --- a/ethcore/res/ethereum/kovan.json +++ b/ethcore/res/ethereum/kovan.json @@ -39,6 +39,7 @@ "maxCodeSizeTransition": 6600000, "validateChainIdTransition": 1000000, "validateReceiptsTransition" : 1000000, + "eip98Transition": 0, "eip140Transition": 5067000, "eip211Transition": 5067000, "eip214Transition": 5067000, diff --git a/ethcore/res/ethereum/kovan_wasm_test.json b/ethcore/res/ethereum/kovan_wasm_test.json index 9be03a76908..a4e19b5dd72 100644 --- a/ethcore/res/ethereum/kovan_wasm_test.json +++ b/ethcore/res/ethereum/kovan_wasm_test.json @@ -35,6 +35,7 @@ "forkBlock": 4297256, "forkCanonHash": "0x0a66d93c2f727dca618fabaf70c39b37018c73d78b939d8b11efbbd09034778f", "validateReceiptsTransition" : 1000000, + "eip98Transition": 0, "eip155Transition": 1000000, "validateChainIdTransition": 1000000, "eip140Transition": 5067000, diff --git a/ethcore/res/ethereum/mcip3_test.json b/ethcore/res/ethereum/mcip3_test.json index 9f7a99347d3..4fafcb09d74 100644 --- a/ethcore/res/ethereum/mcip3_test.json +++ b/ethcore/res/ethereum/mcip3_test.json @@ -27,7 +27,6 @@ "eip160Transition":"0x7fffffffffffff", "eip161abcTransition":"0x7fffffffffffff", "eip161dTransition":"0x7fffffffffffff", - "eip98Transition":"0x7fffffffffffff", "eip140Transition":"0x7fffffffffffff", "eip155Transition":"0x7fffffffffffff", "eip211Transition":"0x7fffffffffffff", diff --git a/ethcore/res/ethereum/mix.json b/ethcore/res/ethereum/mix.json index fbe70f05ee4..7cdffdda273 100644 --- a/ethcore/res/ethereum/mix.json +++ b/ethcore/res/ethereum/mix.json @@ -44,8 +44,7 @@ "eip140Transition": 3000000, "eip211Transition": 3000000, "eip214Transition": 3000000, - "eip658Transition": 3000000, - "eip98Transition": "0x7fffffffffffff" + "eip658Transition": 3000000 }, "nodes": [ "enode://aeb6070deb50efeb41c5e4283a6a3b08ff701fef90e3522161c145f30df2852af3dfc51ba74591f7c9d96b11ca4c3c2b354bf58dd243f2d877f6eecc2373fd1d@139.162.15.124:30313", diff --git a/ethcore/res/ethereum/morden.json b/ethcore/res/ethereum/morden.json index 5617335554d..f388baa1797 100644 --- a/ethcore/res/ethereum/morden.json +++ b/ethcore/res/ethereum/morden.json @@ -30,8 +30,7 @@ "eip160Transition": 1915000, "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip155Transition": 1915000, - "eip98Transition": "0x7fffffffffffff" + "eip155Transition": 1915000 }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/musicoin.json b/ethcore/res/ethereum/musicoin.json index 3367377eb7f..109432e58fd 100644 --- a/ethcore/res/ethereum/musicoin.json +++ b/ethcore/res/ethereum/musicoin.json @@ -31,7 +31,6 @@ "eip160Transition":"0x21e88e", "eip161abcTransition":"0x21e88e", "eip161dTransition":"0x21e88e", - "eip98Transition":"0x7fffffffffffff", "eip140Transition":"0x21e88e", "eip155Transition":"0x21e88e", "eip211Transition":"0x21e88e", diff --git a/ethcore/res/ethereum/ropsten.json b/ethcore/res/ethereum/ropsten.json index 86926a7c0a6..f21463b1f31 100644 --- a/ethcore/res/ethereum/ropsten.json +++ b/ethcore/res/ethereum/ropsten.json @@ -37,7 +37,6 @@ "eip161abcTransition": 10, "eip161dTransition": 10, "eip155Transition": 10, - "eip98Transition": "0x7fffffffffffff", "eip140Transition": 1700000, "eip211Transition": 1700000, "eip214Transition": 1700000, diff --git a/ethcore/res/ethereum/social.json b/ethcore/res/ethereum/social.json index bbc77359bd6..0768c239f78 100644 --- a/ethcore/res/ethereum/social.json +++ b/ethcore/res/ethereum/social.json @@ -26,8 +26,7 @@ "eip160Transition": "0x0", "eip161abcTransition": "0x7fffffffffffffff", "eip161dTransition": "0x7fffffffffffffff", - "eip155Transition": "0x0", - "eip98Transition": "0x7fffffffffffff" + "eip155Transition": "0x0" }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/tobalaba.json b/ethcore/res/ethereum/tobalaba.json index 52abba113fd..5dfaada0318 100644 --- a/ethcore/res/ethereum/tobalaba.json +++ b/ethcore/res/ethereum/tobalaba.json @@ -16,6 +16,7 @@ "gasLimitBoundDivisor": "0x400", "minGasLimit": "0x1388", "networkID": "0x62121", + "eip98Transition": 0, "wasmActivationTransition": 7250000, "eip140Transition": 7250000, "eip211Transition": 7250000, diff --git a/ethcore/src/blockchain/blockchain.rs b/ethcore/src/blockchain/blockchain.rs index e5af6420861..4286dc41482 100644 --- a/ethcore/src/blockchain/blockchain.rs +++ b/ethcore/src/blockchain/blockchain.rs @@ -1187,8 +1187,8 @@ impl BlockChain { let mut pending_block_details = self.pending_block_details.write(); let mut pending_write_txs = self.pending_transaction_addresses.write(); - let mut best_ancient_block = self.best_ancient_block.write(); let mut best_block = self.best_block.write(); + let mut best_ancient_block = self.best_ancient_block.write(); let mut write_block_details = self.block_details.write(); let mut write_hashes = self.block_hashes.write(); let mut write_txs = self.transaction_addresses.write(); diff --git a/ethcore/src/client/evm_test_client.rs b/ethcore/src/client/evm_test_client.rs index 20a04613ab4..67e18724488 100644 --- a/ethcore/src/client/evm_test_client.rs +++ b/ethcore/src/client/evm_test_client.rs @@ -66,6 +66,11 @@ use ethjson::spec::ForkSpec; pub struct EvmTestClient<'a> { state: state::State, spec: &'a spec::Spec, + dump_state: fn(&state::State) -> Option, +} + +fn no_dump_state(_: &state::State) -> Option { + None } impl<'a> fmt::Debug for EvmTestClient<'a> { @@ -92,32 +97,51 @@ impl<'a> EvmTestClient<'a> { } } + /// Change default function for dump state (default does not dump) + pub fn set_dump_state_fn(&mut self, dump_state: fn(&state::State) -> Option) { + self.dump_state = dump_state; + } + /// Creates new EVM test client with in-memory DB initialized with genesis of given Spec. - pub fn new(spec: &'a spec::Spec) -> Result { - let factories = Self::factories(); + /// Takes a `TrieSpec` to set the type of trie. + pub fn new_with_trie(spec: &'a spec::Spec, trie_spec: trie::TrieSpec) -> Result { + let factories = Self::factories(trie_spec); let state = Self::state_from_spec(spec, &factories)?; Ok(EvmTestClient { state, spec, + dump_state: no_dump_state, }) } - /// Creates new EVM test client with in-memory DB initialized with given PodState. - pub fn from_pod_state(spec: &'a spec::Spec, pod_state: pod_state::PodState) -> Result { - let factories = Self::factories(); + /// Creates new EVM test client with an in-memory DB initialized with genesis of given chain Spec. + pub fn new(spec: &'a spec::Spec) -> Result { + Self::new_with_trie(spec, trie::TrieSpec::Secure) + } + + /// Creates new EVM test client with an in-memory DB initialized with given PodState. + /// Takes a `TrieSpec` to set the type of trie. + pub fn from_pod_state_with_trie(spec: &'a spec::Spec, pod_state: pod_state::PodState, trie_spec: trie::TrieSpec) -> Result { + let factories = Self::factories(trie_spec); let state = Self::state_from_pod(spec, &factories, pod_state)?; Ok(EvmTestClient { state, spec, + dump_state: no_dump_state, }) } - fn factories() -> Factories { + /// Creates new EVM test client with an in-memory DB initialized with given PodState. + pub fn from_pod_state(spec: &'a spec::Spec, pod_state: pod_state::PodState) -> Result { + Self::from_pod_state_with_trie(spec, pod_state, trie::TrieSpec::Secure) + } + + fn factories(trie_spec: trie::TrieSpec) -> Factories { Factories { vm: factory::VmFactory::new(VMType::Interpreter, 5 * 1024), - trie: trie::TrieFactory::new(trie::TrieSpec::Secure), + trie: trie::TrieFactory::new(trie_spec), accountdb: Default::default(), } } @@ -223,6 +247,7 @@ impl<'a> EvmTestClient<'a> { return TransactResult::Err { state_root: *self.state.root(), error: error.into(), + end_state: (self.dump_state)(&self.state), }; } @@ -247,12 +272,17 @@ impl<'a> EvmTestClient<'a> { &None, false ).ok(); + self.state.commit().ok(); + let state_root = *self.state.root(); + + let end_state = (self.dump_state)(&self.state); + match result { Ok(result) => { TransactResult::Ok { - state_root: *self.state.root(), + state_root, gas_left: initial_gas - result.receipt.gas_used, outcome: result.receipt.outcome, output: result.output, @@ -263,12 +293,14 @@ impl<'a> EvmTestClient<'a> { Some(executive::contract_address(scheme, &transaction.sender(), &transaction.nonce, &transaction.data).0) } else { None - } + }, + end_state, } }, Err(error) => TransactResult::Err { - state_root: *self.state.root(), + state_root, error, + end_state, }, } } @@ -295,6 +327,8 @@ pub enum TransactResult { logs: Vec, /// outcome outcome: receipt::TransactionOutcome, + /// end state if needed + end_state: Option, }, /// Transaction failed to run Err { @@ -302,5 +336,7 @@ pub enum TransactResult { state_root: H256, /// Execution error error: ::error::Error, + /// end state if needed + end_state: Option, }, } diff --git a/ethcore/src/json_tests/state.rs b/ethcore/src/json_tests/state.rs index f402a7b37aa..733e268028f 100644 --- a/ethcore/src/json_tests/state.rs +++ b/ethcore/src/json_tests/state.rs @@ -95,7 +95,7 @@ pub fn json_chain_test(json_data: &[u8], start_stop_ho flushln!("{} fail", info); failed.push(name.clone()); }, - Ok(TransactResult::Err { state_root, ref error }) if state_root != post_root => { + Ok(TransactResult::Err { state_root, ref error, .. }) if state_root != post_root => { println!("{} !!! State mismatch (got: {}, expect: {}", info, state_root, post_root); println!("{} !!! Execution error: {:?}", info, error); flushln!("{} fail", info); diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index 9a0315220fa..b3d77cbfa92 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -109,6 +109,7 @@ extern crate vm; extern crate wasm; extern crate memory_cache; extern crate journaldb; +extern crate serde; #[cfg(any(test, feature = "json-tests", feature = "test-helpers"))] extern crate tempdir; @@ -134,6 +135,8 @@ extern crate macros; extern crate rlp_derive; #[macro_use] extern crate trace_time; +#[macro_use] +extern crate serde_derive; #[cfg_attr(test, macro_use)] extern crate evm; @@ -187,3 +190,4 @@ pub use types::*; pub use executive::contract_address; pub use evm::CreateContractAddress; pub use blockchain::{BlockChainDB, BlockChainDBHandler}; +pub use trie::TrieSpec; diff --git a/ethcore/src/pod_account.rs b/ethcore/src/pod_account.rs index db5d0660c24..c4d05cca5cd 100644 --- a/ethcore/src/pod_account.rs +++ b/ethcore/src/pod_account.rs @@ -32,8 +32,10 @@ use state::Account; use ethjson; use types::account_diff::*; use rlp::{self, RlpStream}; +use serde::Serializer; +use rustc_hex::ToHex; -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] /// An account, expressed as Plain-Old-Data (hence the name). /// Does not have a DB overlay cache, code hash or anything like that. pub struct PodAccount { @@ -41,12 +43,19 @@ pub struct PodAccount { pub balance: U256, /// The nonce of the account. pub nonce: U256, + #[serde(serialize_with="opt_bytes_to_hex")] /// The code of the account or `None` in the special case that it is unknown. pub code: Option, /// The storage of the account. pub storage: BTreeMap, } +fn opt_bytes_to_hex(opt_bytes: &Option, serializer: S) -> Result + where S: Serializer +{ + serializer.collect_str(&format_args!("0x{}",opt_bytes.as_ref().map_or("".to_string(), |b|b.to_hex()))) +} + impl PodAccount { /// Convert Account to a PodAccount. /// NOTE: This will silently fail unless the account is fully cached. diff --git a/ethcore/src/pod_state.rs b/ethcore/src/pod_state.rs index 406abffb7cc..76d6495c55d 100644 --- a/ethcore/src/pod_state.rs +++ b/ethcore/src/pod_state.rs @@ -26,8 +26,8 @@ use types::state_diff::StateDiff; use ethjson; /// State of all accounts in the system expressed in Plain Old Data. -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub struct PodState (BTreeMap); +#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize)] +pub struct PodState(BTreeMap); impl PodState { /// Contruct a new object from the `m`. diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index 00ef71459aa..d2678564edf 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -250,7 +250,10 @@ impl From for CommonParams { eip160_transition: p.eip160_transition.map_or(0, Into::into), eip161abc_transition: p.eip161abc_transition.map_or(0, Into::into), eip161d_transition: p.eip161d_transition.map_or(0, Into::into), - eip98_transition: p.eip98_transition.map_or(0, Into::into), + eip98_transition: p.eip98_transition.map_or_else( + BlockNumber::max_value, + Into::into, + ), eip155_transition: p.eip155_transition.map_or(0, Into::into), validate_receipts_transition: p.validate_receipts_transition.map_or(0, Into::into), validate_chain_id_transition: p.validate_chain_id_transition.map_or(0, Into::into), diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index 274366b6d30..91254787759 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -624,7 +624,7 @@ mod tests { assert!(raw.len() > compact_vec.len()); let again_raw = decompress(&compact_vec, snapshot_swapper()); assert_eq!(raw, again_raw.into_vec()); - } + } #[test] fn storage_at() { diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index acb668ac7b2..e6a96a0e85d 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -947,20 +947,78 @@ impl State { } /// Populate a PodAccount map from this state. - pub fn to_pod(&self) -> PodState { + fn to_pod_cache(&self) -> PodState { assert!(self.checkpoints.borrow().is_empty()); - // TODO: handle database rather than just the cache. - // will need fat db. PodState::from(self.cache.borrow().iter().fold(BTreeMap::new(), |mut m, (add, opt)| { if let Some(ref acc) = opt.account { - m.insert(add.clone(), PodAccount::from_account(acc)); + m.insert(*add, PodAccount::from_account(acc)); } m })) } + #[cfg(feature="to-pod-full")] + /// Populate a PodAccount map from this state. + /// Warning this is not for real time use. + /// Use of this method requires FatDB mode to be able + /// to iterate on accounts. + pub fn to_pod_full(&self) -> Result { + + assert!(self.checkpoints.borrow().is_empty()); + assert!(self.factories.trie.is_fat()); + + let mut result = BTreeMap::new(); + + let trie = self.factories.trie.readonly(self.db.as_hashdb(), &self.root)?; + + // put trie in cache + for item in trie.iter()? { + if let Ok((addr, _dbval)) = item { + let address = Address::from_slice(&addr); + let _ = self.require(&address, true); + } + } + + // Resolve missing part + for (add, opt) in self.cache.borrow().iter() { + if let Some(ref acc) = opt.account { + let pod_account = self.account_to_pod_account(acc, add)?; + result.insert(add.clone(), pod_account); + } + } + + Ok(PodState::from(result)) + } + + /// Create a PodAccount from an account. + /// Differs from existing method by including all storage + /// values of the account to the PodAccount. + /// This function is only intended for use in small tests or with fresh accounts. + /// It requires FatDB. + #[cfg(feature="to-pod-full")] + fn account_to_pod_account(&self, account: &Account, address: &Address) -> Result { + let mut pod_storage = BTreeMap::new(); + let addr_hash = account.address_hash(address); + let accountdb = self.factories.accountdb.readonly(self.db.as_hashdb(), addr_hash); + let root = account.base_storage_root(); + + let trie = self.factories.trie.readonly(accountdb.as_hashdb(), &root)?; + for o_kv in trie.iter()? { + if let Ok((key, val)) = o_kv { + pod_storage.insert(key[..].into(), U256::from(&val[..]).into()); + } + } + + let mut pod_account = PodAccount::from_account(&account); + // cached one first + pod_storage.append(&mut pod_account.storage); + pod_account.storage = pod_storage; + Ok(pod_account) + } + + /// Populate a PodAccount map from this state, with another state as the account and storage query. - pub fn to_pod_diff(&mut self, query: &State) -> TrieResult { + fn to_pod_diff(&mut self, query: &State) -> TrieResult { assert!(self.checkpoints.borrow().is_empty()); // Merge PodAccount::to_pod for cache of self and `query`. @@ -1015,7 +1073,7 @@ impl State { /// Returns a `StateDiff` describing the difference from `orig` to `self`. /// Consumes self. pub fn diff_from(&self, mut orig: State) -> TrieResult { - let pod_state_post = self.to_pod(); + let pod_state_post = self.to_pod_cache(); let pod_state_pre = orig.to_pod_diff(self)?; Ok(pod_state::diff_pod(&pod_state_pre, &pod_state_post)) } @@ -1535,7 +1593,7 @@ mod tests { } #[test] - fn should_not_trace_callcode() { + fn should_trace_callcode_properly() { init_log(); let mut state = get_temp_state(); @@ -1577,7 +1635,7 @@ mod tests { subtraces: 0, action: trace::Action::Call(trace::Call { from: 0xa.into(), - to: 0xa.into(), + to: 0xb.into(), value: 0.into(), gas: 4096.into(), input: vec![], @@ -2593,12 +2651,12 @@ mod tests { assert_eq!(diff_map.len(), 1); assert!(diff_map.get(&a).is_some()); assert_eq!(diff_map.get(&a), - pod_account::diff_pod(Some(&PodAccount { - balance: U256::from(100), - nonce: U256::zero(), - code: Some(Default::default()), - storage: Default::default() - }), None).as_ref()); + pod_account::diff_pod(Some(&PodAccount { + balance: U256::from(100), + nonce: U256::zero(), + code: Some(Default::default()), + storage: Default::default() + }), None).as_ref()); } #[test] @@ -2624,18 +2682,64 @@ mod tests { assert_eq!(diff_map.len(), 1); assert!(diff_map.get(&a).is_some()); assert_eq!(diff_map.get(&a), - pod_account::diff_pod(Some(&PodAccount { - balance: U256::zero(), - nonce: U256::zero(), - code: Some(Default::default()), - storage: vec![(H256::from(&U256::from(1u64)), H256::from(&U256::from(20u64)))] - .into_iter().collect(), - }), Some(&PodAccount { - balance: U256::zero(), - nonce: U256::zero(), - code: Some(Default::default()), - storage: vec![(H256::from(&U256::from(1u64)), H256::from(&U256::from(100u64)))] - .into_iter().collect(), - })).as_ref()); + pod_account::diff_pod(Some(&PodAccount { + balance: U256::zero(), + nonce: U256::zero(), + code: Some(Default::default()), + storage: vec![(H256::from(&U256::from(1u64)), H256::from(&U256::from(20u64)))] + .into_iter().collect(), + }), Some(&PodAccount { + balance: U256::zero(), + nonce: U256::zero(), + code: Some(Default::default()), + storage: vec![(H256::from(&U256::from(1u64)), H256::from(&U256::from(100u64)))] + .into_iter().collect(), + })).as_ref()); + } + + #[cfg(feature="to-pod-full")] + #[test] + fn should_get_full_pod_storage_values() { + use trie::{TrieFactory, TrieSpec}; + + let a = 10.into(); + let db = get_temp_state_db(); + + let factories = Factories { + vm: Default::default(), + trie: TrieFactory::new(TrieSpec::Fat), + accountdb: Default::default(), + }; + + let get_pod_state_val = |pod_state : &PodState, ak, k| { + pod_state.get().get(ak).unwrap().storage.get(&k).unwrap().clone() + }; + + let storage_address = H256::from(&U256::from(1u64)); + + let (root, db) = { + let mut state = State::new(db, U256::from(0), factories.clone()); + state.set_storage(&a, storage_address.clone(), H256::from(&U256::from(20u64))).unwrap(); + let dump = state.to_pod_full().unwrap(); + assert_eq!(get_pod_state_val(&dump, &a, storage_address.clone()), H256::from(&U256::from(20u64))); + state.commit().unwrap(); + let dump = state.to_pod_full().unwrap(); + assert_eq!(get_pod_state_val(&dump, &a, storage_address.clone()), H256::from(&U256::from(20u64))); + state.drop() + }; + + let mut state = State::from_existing(db, root, U256::from(0u8), factories).unwrap(); + let dump = state.to_pod_full().unwrap(); + assert_eq!(get_pod_state_val(&dump, &a, storage_address.clone()), H256::from(&U256::from(20u64))); + state.set_storage(&a, storage_address.clone(), H256::from(&U256::from(21u64))).unwrap(); + let dump = state.to_pod_full().unwrap(); + assert_eq!(get_pod_state_val(&dump, &a, storage_address.clone()), H256::from(&U256::from(21u64))); + state.commit().unwrap(); + state.set_storage(&a, storage_address.clone(), H256::from(&U256::from(0u64))).unwrap(); + let dump = state.to_pod_full().unwrap(); + assert_eq!(get_pod_state_val(&dump, &a, storage_address.clone()), H256::from(&U256::from(0u64))); + + } + } diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index 1f6a77f2c29..87e14f4dfeb 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -96,6 +96,7 @@ pub trait VMTracer: Send { /// Consumes self and returns the VM trace. fn drain(self) -> Option; + } /// `DbExtras` provides an interface to query extra data which is not stored in tracesdb, diff --git a/ethcore/src/trace/types/trace.rs b/ethcore/src/trace/types/trace.rs index 1dde16e23ba..446fffb3af0 100644 --- a/ethcore/src/trace/types/trace.rs +++ b/ethcore/src/trace/types/trace.rs @@ -71,7 +71,7 @@ pub struct Call { impl From for Call { fn from(p: ActionParams) -> Self { match p.call_type { - CallType::DelegateCall => Call { + CallType::DelegateCall | CallType::CallCode => Call { from: p.address, to: p.code_address, value: p.value.value(), diff --git a/ethcore/sync/src/light_sync/mod.rs b/ethcore/sync/src/light_sync/mod.rs index b4000c0822a..cda250f12ea 100644 --- a/ethcore/sync/src/light_sync/mod.rs +++ b/ethcore/sync/src/light_sync/mod.rs @@ -34,6 +34,7 @@ use std::collections::{HashMap, HashSet}; use std::mem; +use std::ops::Deref; use std::sync::Arc; use std::time::{Instant, Duration}; @@ -213,6 +214,44 @@ enum SyncState { Rounds(SyncRound), } +/// A wrapper around the SyncState that makes sure to +/// update the giving reference to `is_idle` +#[derive(Debug)] +struct SyncStateWrapper { + state: SyncState, +} + +impl SyncStateWrapper { + /// Create a new wrapper for SyncState::Idle + pub fn idle() -> Self { + SyncStateWrapper { + state: SyncState::Idle, + } + } + + /// Set the new state's value, making sure `is_idle` gets updated + pub fn set(&mut self, state: SyncState, is_idle_handle: &mut bool) { + *is_idle_handle = match state { + SyncState::Idle => true, + _ => false, + }; + self.state = state; + } + + /// Returns the internal state's value + pub fn into_inner(self) -> SyncState { + self.state + } +} + +impl Deref for SyncStateWrapper { + type Target = SyncState; + + fn deref(&self) -> &SyncState { + &self.state + } +} + struct ResponseCtx<'a> { peer: PeerId, req_id: ReqId, @@ -235,7 +274,9 @@ pub struct LightSync { pending_reqs: Mutex>, // requests from this handler client: Arc, rng: Mutex, - state: Mutex, + state: Mutex, + // We duplicate this state tracking to avoid deadlocks in `is_major_importing`. + is_idle: Mutex, } #[derive(Debug, Clone)] @@ -309,16 +350,17 @@ impl Handler for LightSync { if new_best.is_none() { debug!(target: "sync", "No peers remain. Reverting to idle"); - *self.state.lock() = SyncState::Idle; + self.set_state(&mut self.state.lock(), SyncState::Idle); } else { let mut state = self.state.lock(); - *state = match mem::replace(&mut *state, SyncState::Idle) { + let next_state = match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Idle => SyncState::Idle, SyncState::AncestorSearch(search) => SyncState::AncestorSearch(search.requests_abandoned(unfulfilled)), SyncState::Rounds(round) => SyncState::Rounds(round.requests_abandoned(unfulfilled)), }; + self.set_state(&mut state, next_state); } self.maintain_sync(ctx.as_basic()); @@ -390,12 +432,13 @@ impl Handler for LightSync { data: headers, }; - *state = match mem::replace(&mut *state, SyncState::Idle) { + let next_state = match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Idle => SyncState::Idle, SyncState::AncestorSearch(search) => SyncState::AncestorSearch(search.process_response(&ctx, &*self.client)), SyncState::Rounds(round) => SyncState::Rounds(round.process_response(&ctx)), }; + self.set_state(&mut state, next_state); } self.maintain_sync(ctx.as_basic()); @@ -408,12 +451,18 @@ impl Handler for LightSync { // private helpers impl LightSync { + /// Sets the LightSync's state, and update + /// `is_idle` + fn set_state(&self, state: &mut SyncStateWrapper, next_state: SyncState) { + state.set(next_state, &mut self.is_idle.lock()); + } + // Begins a search for the common ancestor and our best block. // does not lock state, instead has a mutable reference to it passed. - fn begin_search(&self, state: &mut SyncState) { + fn begin_search(&self, state: &mut SyncStateWrapper) { if let None = *self.best_seen.lock() { // no peers. - *state = SyncState::Idle; + self.set_state(state, SyncState::Idle); return; } @@ -422,7 +471,8 @@ impl LightSync { trace!(target: "sync", "Beginning search for common ancestor from {:?}", (chain_info.best_block_number, chain_info.best_block_hash)); - *state = SyncState::AncestorSearch(AncestorSearch::begin(chain_info.best_block_number)); + let next_state = SyncState::AncestorSearch(AncestorSearch::begin(chain_info.best_block_number)); + self.set_state(state, next_state); } // handles request dispatch, block import, state machine transitions, and timeouts. @@ -435,7 +485,7 @@ impl LightSync { let chain_info = client.chain_info(); let mut state = self.state.lock(); - debug!(target: "sync", "Maintaining sync ({:?})", &*state); + debug!(target: "sync", "Maintaining sync ({:?})", **state); // drain any pending blocks into the queue. { @@ -445,11 +495,12 @@ impl LightSync { loop { if client.queue_info().is_full() { break } - *state = match mem::replace(&mut *state, SyncState::Idle) { + let next_state = match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Rounds(round) => SyncState::Rounds(round.drain(&mut sink, Some(DRAIN_AMOUNT))), other => other, }; + self.set_state(&mut state, next_state); if sink.is_empty() { break } trace!(target: "sync", "Drained {} headers to import", sink.len()); @@ -483,15 +534,15 @@ impl LightSync { let network_score = other.as_ref().map(|target| target.head_td); trace!(target: "sync", "No target to sync to. Network score: {:?}, Local score: {:?}", network_score, best_td); - *state = SyncState::Idle; + self.set_state(&mut state, SyncState::Idle); return; } }; - match mem::replace(&mut *state, SyncState::Idle) { + match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Rounds(SyncRound::Abort(reason, remaining)) => { if remaining.len() > 0 { - *state = SyncState::Rounds(SyncRound::Abort(reason, remaining)); + self.set_state(&mut state, SyncState::Rounds(SyncRound::Abort(reason, remaining))); return; } @@ -505,7 +556,7 @@ impl LightSync { AbortReason::NoResponses => {} AbortReason::TargetReached => { debug!(target: "sync", "Sync target reached. Going idle"); - *state = SyncState::Idle; + self.set_state(&mut state, SyncState::Idle); return; } } @@ -514,15 +565,15 @@ impl LightSync { self.begin_search(&mut state); } SyncState::AncestorSearch(AncestorSearch::FoundCommon(num, hash)) => { - *state = SyncState::Rounds(SyncRound::begin((num, hash), sync_target)); + self.set_state(&mut state, SyncState::Rounds(SyncRound::begin((num, hash), sync_target))); } SyncState::AncestorSearch(AncestorSearch::Genesis) => { // Same here. let g_hash = chain_info.genesis_hash; - *state = SyncState::Rounds(SyncRound::begin((0, g_hash), sync_target)); + self.set_state(&mut state, SyncState::Rounds(SyncRound::begin((0, g_hash), sync_target))); } SyncState::Idle => self.begin_search(&mut state), - other => *state = other, // restore displaced state. + other => self.set_state(&mut state, other), // restore displaced state. } } @@ -543,12 +594,13 @@ impl LightSync { } drop(pending_reqs); - *state = match mem::replace(&mut *state, SyncState::Idle) { + let next_state = match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Idle => SyncState::Idle, SyncState::AncestorSearch(search) => SyncState::AncestorSearch(search.requests_abandoned(&unfulfilled)), SyncState::Rounds(round) => SyncState::Rounds(round.requests_abandoned(&unfulfilled)), }; + self.set_state(&mut state, next_state); } } @@ -605,34 +657,14 @@ impl LightSync { None }; - *state = match mem::replace(&mut *state, SyncState::Idle) { + let next_state = match mem::replace(&mut *state, SyncStateWrapper::idle()).into_inner() { SyncState::Rounds(round) => SyncState::Rounds(round.dispatch_requests(dispatcher)), SyncState::AncestorSearch(search) => SyncState::AncestorSearch(search.dispatch_request(dispatcher)), other => other, }; - } - } - - fn is_major_importing_do_wait(&self, wait: bool) -> bool { - const EMPTY_QUEUE: usize = 3; - - if self.client.as_light_client().queue_info().unverified_queue_size > EMPTY_QUEUE { - return true; - } - let mg_state = if wait { - self.state.lock() - } else { - if let Some(mg_state) = self.state.try_lock() { - mg_state - } else { - return false; - } - }; - match *mg_state { - SyncState::Idle => false, - _ => true, + self.set_state(&mut state, next_state); } } } @@ -651,7 +683,8 @@ impl LightSync { pending_reqs: Mutex::new(HashMap::new()), client: client, rng: Mutex::new(OsRng::new()?), - state: Mutex::new(SyncState::Idle), + state: Mutex::new(SyncStateWrapper::idle()), + is_idle: Mutex::new(true), }) } } @@ -666,9 +699,6 @@ pub trait SyncInfo { /// Whether major sync is underway. fn is_major_importing(&self) -> bool; - - /// Whether major sync is underway, skipping some synchronization. - fn is_major_importing_no_sync(&self) -> bool; } impl SyncInfo for LightSync { @@ -681,11 +711,13 @@ impl SyncInfo for LightSync { } fn is_major_importing(&self) -> bool { - self.is_major_importing_do_wait(true) - } + const EMPTY_QUEUE: usize = 3; + + let queue_info = self.client.as_light_client().queue_info(); + let is_verifying = queue_info.unverified_queue_size + queue_info.verified_queue_size > EMPTY_QUEUE; + let is_syncing = !*self.is_idle.lock(); - fn is_major_importing_no_sync(&self) -> bool { - self.is_major_importing_do_wait(false) + is_verifying || is_syncing } } diff --git a/ethcore/wasm/run/src/runner.rs b/ethcore/wasm/run/src/runner.rs index b2695fc8ec2..b04ec29a482 100644 --- a/ethcore/wasm/run/src/runner.rs +++ b/ethcore/wasm/run/src/runner.rs @@ -66,7 +66,7 @@ impl Fail { } impl fmt::Display for Fail { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use self::Fail::*; match *self { Return { ref expected, ref actual } => diff --git a/evmbin/Cargo.toml b/evmbin/Cargo.toml index 03c6e492a2a..b75890f61e6 100644 --- a/evmbin/Cargo.toml +++ b/evmbin/Cargo.toml @@ -11,7 +11,7 @@ path = "./src/main.rs" [dependencies] docopt = "1.0" env_logger = "0.5" -ethcore = { path = "../ethcore", features = ["test-helpers", "json-tests"] } +ethcore = { path = "../ethcore", features = ["test-helpers", "json-tests", "to-pod-full"] } ethjson = { path = "../json" } parity-bytes = "0.1" ethcore-transaction = { path = "../ethcore/transaction" } diff --git a/evmbin/README.md b/evmbin/README.md index 585be422840..49e76176137 100644 --- a/evmbin/README.md +++ b/evmbin/README.md @@ -9,7 +9,7 @@ EVM implementation for Parity. Copyright 2015-2018 Parity Technologies (UK) Ltd. Usage: - parity-evm state-test [--json --std-json --only NAME --chain CHAIN] + parity-evm state-test [--json --std-json --std-dump-json --only NAME --chain CHAIN --std-out-only --std-err-only] parity-evm stats [options] parity-evm stats-jsontests-vm parity-evm [options] @@ -36,6 +36,11 @@ State test options: General options: --json Display verbose results in JSON. --std-json Display results in standardized JSON format. + --std-err-only With --std-json redirect to err output only. + --std-out-only With --std-json redirect to out output only. + --std-dump-json Display results in standardized JSON format + with additional state dump. +Display result state dump in standardized JSON format. --chain CHAIN Chain spec file path. -h, --help Display this message and exit. ``` diff --git a/evmbin/src/display/json.rs b/evmbin/src/display/json.rs index 9b1b7b10e37..09d0a78f83b 100644 --- a/evmbin/src/display/json.rs +++ b/evmbin/src/display/json.rs @@ -74,6 +74,8 @@ impl Informant { } impl vm::Informant for Informant { + type Sink = (); + fn before_test(&mut self, name: &str, action: &str) { println!("{}", json!({"action": action, "test": name})); } @@ -82,7 +84,9 @@ impl vm::Informant for Informant { self.gas_used = gas; } - fn finish(result: vm::RunResult) { + fn clone_sink(&self) -> Self::Sink { () } + + fn finish(result: vm::RunResult, _sink: &mut Self::Sink) { match result { Ok(success) => { for trace in success.traces.unwrap_or_else(Vec::new) { diff --git a/evmbin/src/display/simple.rs b/evmbin/src/display/simple.rs index 5cb53d4c2b9..9bfe86f0751 100644 --- a/evmbin/src/display/simple.rs +++ b/evmbin/src/display/simple.rs @@ -27,11 +27,16 @@ use info as vm; pub struct Informant; impl vm::Informant for Informant { + + type Sink = (); + fn before_test(&mut self, name: &str, action: &str) { println!("Test: {} ({})", name, action); } - fn finish(result: vm::RunResult) { + fn clone_sink(&self) -> Self::Sink { () } + + fn finish(result: vm::RunResult, _sink: &mut Self::Sink) { match result { Ok(success) => { println!("Output: 0x{}", success.output.to_hex()); diff --git a/evmbin/src/display/std_json.rs b/evmbin/src/display/std_json.rs index 43b7fede1b9..87f515e8ea4 100644 --- a/evmbin/src/display/std_json.rs +++ b/evmbin/src/display/std_json.rs @@ -21,7 +21,7 @@ use std::io; use ethereum_types::{H256, U256}; use bytes::ToPretty; -use ethcore::trace; +use ethcore::{trace, pod_state}; use display; use info as vm; @@ -52,7 +52,7 @@ impl Writer for io::Stderr { } /// JSON formatting informant. -pub struct Informant { +pub struct Informant { code: Vec, instruction: u8, depth: usize, @@ -64,13 +64,28 @@ pub struct Informant { out_sink: Out, } -impl Default for Informant { +impl Default for Informant { fn default() -> Self { Self::new(io::stderr(), io::stdout()) } } +impl Informant { + /// std json informant using out only. + pub fn out_only() -> Self { + Self::new(io::stdout(), io::stdout()) + } +} + +impl Informant { + /// std json informant using err only. + pub fn err_only() -> Self { + Self::new(io::stderr(), io::stderr()) + } +} + impl Informant { + pub fn new(trace_sink: Trace, out_sink: Out) -> Self { Informant { code: Default::default(), @@ -91,9 +106,24 @@ impl Informant { Self::with_informant_in_depth(informant.subinfos.last_mut().expect("prepare/done_trace are not balanced"), depth - 1, f); } } + + fn dump_state_into(trace_sink: &mut Trace, root: H256, end_state: &Option) { + if let Some(ref end_state) = end_state { + let dump_data = json!({ + "root": root, + "accounts": end_state, + }); + writeln!(trace_sink, "{}", dump_data).expect("The sink must be writeable."); + } + } + + } impl vm::Informant for Informant { + + type Sink = (Trace, Out); + fn before_test(&mut self, name: &str, action: &str) { let out_data = json!({ "action": action, @@ -105,23 +135,26 @@ impl vm::Informant for Informant { fn set_gas(&mut self, _gas: U256) {} - fn finish(result: vm::RunResult<::Output>) { - let mut trace_sink = Trace::default(); - let mut out_sink = Out::default(); + fn clone_sink(&self) -> Self::Sink { + (self.trace_sink.clone(), self.out_sink.clone()) + } + fn finish(result: vm::RunResult<::Output>, (ref mut trace_sink, ref mut out_sink): &mut Self::Sink) { match result { Ok(success) => { let trace_data = json!({"stateRoot": success.state_root}); - writeln!(&mut trace_sink, "{}", trace_data) + writeln!(trace_sink, "{}", trace_data) .expect("The sink must be writeable."); + Self::dump_state_into(trace_sink, success.state_root, &success.end_state); + let out_data = json!({ "output": format!("0x{}", success.output.to_hex()), "gasUsed": format!("{:#x}", success.gas_used), "time": display::as_micros(&success.time), }); - writeln!(&mut out_sink, "{}", out_data).expect("The sink must be writeable."); + writeln!(out_sink, "{}", out_data).expect("The sink must be writeable."); }, Err(failure) => { let out_data = json!({ @@ -130,7 +163,9 @@ impl vm::Informant for Informant { "time": display::as_micros(&failure.time), }); - writeln!(&mut out_sink, "{}", out_data).expect("The sink must be writeable."); + Self::dump_state_into(trace_sink, failure.state_root, &failure.end_state); + + writeln!(out_sink, "{}", out_data).expect("The sink must be writeable."); }, } } @@ -200,6 +235,7 @@ impl trace::VMTracer for Informant { } fn drain(self) -> Option { None } + } #[cfg(test)] diff --git a/evmbin/src/info.rs b/evmbin/src/info.rs index dfb97e76001..67df1d28464 100644 --- a/evmbin/src/info.rs +++ b/evmbin/src/info.rs @@ -19,19 +19,23 @@ use std::time::{Instant, Duration}; use ethereum_types::{H256, U256}; use ethcore::client::{self, EvmTestClient, EvmTestError, TransactResult}; -use ethcore::{trace, spec, pod_state}; +use ethcore::{state, state_db, trace, spec, pod_state, TrieSpec}; use ethjson; use transaction; use vm::ActionParams; /// VM execution informant pub trait Informant: trace::VMTracer { + /// Sink to use with finish + type Sink; /// Display a single run init message fn before_test(&mut self, test: &str, action: &str); /// Set initial gas. fn set_gas(&mut self, _gas: U256) {} + /// Clone sink. + fn clone_sink(&self) -> Self::Sink; /// Display final result. - fn finish(result: RunResult); + fn finish(result: RunResult, &mut Self::Sink); } /// Execution finished correctly @@ -47,11 +51,15 @@ pub struct Success { pub time: Duration, /// Traces pub traces: Option, + /// Optional end state dump + pub end_state: Option, } /// Execution failed #[derive(Debug)] pub struct Failure { + /// State root + pub state_root: H256, /// Used gas pub gas_used: U256, /// Internal error @@ -60,6 +68,8 @@ pub struct Failure { pub time: Duration, /// Traces pub traces: Option, + /// Optional end state dump + pub end_state: Option, } /// EVM Execution result @@ -70,6 +80,7 @@ pub fn run_action( spec: &spec::Spec, mut params: ActionParams, mut informant: T, + trie_spec: TrieSpec, ) -> RunResult { informant.set_gas(params.gas); @@ -80,12 +91,12 @@ pub fn run_action( params.code_hash = None; } } - run(spec, params.gas, spec.genesis_state(), |mut client| { + run(spec, trie_spec, params.gas, spec.genesis_state(), |mut client| { let result = match client.call(params, &mut trace::NoopTracer, &mut informant) { - Ok(r) => (Ok((0.into(), r.return_data.to_vec())), Some(r.gas_left)), + Ok(r) => (Ok(r.return_data.to_vec()), Some(r.gas_left)), Err(err) => (Err(err), None), }; - (result.0, result.1, informant.drain()) + (result.0, 0.into(), None, result.1, informant.drain()) }) } @@ -99,6 +110,7 @@ pub fn run_transaction( env_info: &client::EnvInfo, transaction: transaction::SignedTransaction, mut informant: T, + trie_spec: TrieSpec, ) { let spec_name = format!("{:?}", spec).to_lowercase(); let spec = match EvmTestClient::spec_from_json(spec) { @@ -114,64 +126,82 @@ pub fn run_transaction( informant.set_gas(env_info.gas_limit); - let result = run(&spec, transaction.gas, pre_state, |mut client| { + let mut sink = informant.clone_sink(); + let result = run(&spec, trie_spec, transaction.gas, pre_state, |mut client| { let result = client.transact(env_info, transaction, trace::NoopTracer, informant); match result { - TransactResult::Ok { state_root, gas_left, .. } if state_root != post_root => { - (Err(EvmTestError::PostCondition(format!( - "State root mismatch (got: 0x{:x}, expected: 0x{:x})", - state_root, - post_root, - ))), Some(gas_left), None) + TransactResult::Ok { state_root, gas_left, output, vm_trace, end_state, .. } => { + if state_root != post_root { + (Err(EvmTestError::PostCondition(format!( + "State root mismatch (got: {:#x}, expected: {:#x})", + state_root, + post_root, + ))), state_root, end_state, Some(gas_left), None) + } else { + (Ok(output), state_root, end_state, Some(gas_left), vm_trace) + } }, - TransactResult::Ok { state_root, gas_left, output, vm_trace, .. } => { - (Ok((state_root, output)), Some(gas_left), vm_trace) - }, - TransactResult::Err { error, .. } => { + TransactResult::Err { state_root, error, end_state } => { (Err(EvmTestError::PostCondition(format!( "Unexpected execution error: {:?}", error - ))), None, None) + ))), state_root, end_state, None, None) }, } }); - T::finish(result) + T::finish(result, &mut sink) +} + +fn dump_state(state: &state::State) -> Option { + state.to_pod_full().ok() } /// Execute VM with given `ActionParams` pub fn run<'a, F, X>( spec: &'a spec::Spec, + trie_spec: TrieSpec, initial_gas: U256, pre_state: &'a pod_state::PodState, run: F, ) -> RunResult where - F: FnOnce(EvmTestClient) -> (Result<(H256, Vec), EvmTestError>, Option, Option), + F: FnOnce(EvmTestClient) -> (Result, EvmTestError>, H256, Option, Option, Option), { - let test_client = EvmTestClient::from_pod_state(spec, pre_state.clone()) + let do_dump = trie_spec == TrieSpec::Fat; + + let mut test_client = EvmTestClient::from_pod_state_with_trie(spec, pre_state.clone(), trie_spec) .map_err(|error| Failure { gas_used: 0.into(), error, time: Duration::from_secs(0), traces: None, + state_root: H256::default(), + end_state: None, })?; + if do_dump { + test_client.set_dump_state_fn(dump_state); + } + let start = Instant::now(); let result = run(test_client); let time = start.elapsed(); match result { - (Ok((state_root, output)), gas_left, traces) => Ok(Success { + (Ok(output), state_root, end_state, gas_left, traces) => Ok(Success { state_root, gas_used: gas_left.map(|gas_left| initial_gas - gas_left).unwrap_or(initial_gas), output, time, traces, + end_state, }), - (Err(error), gas_left, traces) => Err(Failure { + (Err(error), state_root, end_state, gas_left, traces) => Err(Failure { gas_used: gas_left.map(|gas_left| initial_gas - gas_left).unwrap_or(initial_gas), error, time, traces, + state_root, + end_state, }), } } @@ -200,7 +230,7 @@ pub mod tests { let tempdir = TempDir::new("").unwrap(); let spec = ::ethcore::ethereum::new_foundation(&tempdir.path()); - let result = run_action(&spec, params, informant); + let result = run_action(&spec, params, informant, TrieSpec::Secure); match result { Ok(Success { traces, .. }) => { compare(traces, expected) @@ -221,7 +251,7 @@ pub mod tests { params.gas = 0xffff.into(); let spec = ::ethcore::ethereum::load(None, include_bytes!("../res/testchain.json")); - let _result = run_action(&spec, params, inf); + let _result = run_action(&spec, params, inf, TrieSpec::Secure); assert_eq!( &String::from_utf8_lossy(&**res.lock().unwrap()), diff --git a/evmbin/src/main.rs b/evmbin/src/main.rs index ded5c321ce1..41bfbe1bd3e 100644 --- a/evmbin/src/main.rs +++ b/evmbin/src/main.rs @@ -49,7 +49,7 @@ use docopt::Docopt; use rustc_hex::FromHex; use ethereum_types::{U256, Address}; use bytes::Bytes; -use ethcore::{spec, json_tests}; +use ethcore::{spec, json_tests, TrieSpec}; use vm::{ActionParams, CallType}; mod info; @@ -62,7 +62,7 @@ EVM implementation for Parity. Copyright 2015-2018 Parity Technologies (UK) Ltd. Usage: - parity-evm state-test [--json --std-json --only NAME --chain CHAIN] + parity-evm state-test [--json --std-json --std-dump-json --only NAME --chain CHAIN --std-out-only --std-err-only] parity-evm stats [options] parity-evm stats-jsontests-vm parity-evm [options] @@ -89,6 +89,11 @@ State test options: General options: --json Display verbose results in JSON. --std-json Display results in standardized JSON format. + --std-err-only With --std-json redirect to err output only. + --std-out-only With --std-json redirect to out output only. + --std-dump-json Display results in standardized JSON format + with additional state dump. +Display result state dump in standardized JSON format. --chain CHAIN Chain spec file path. -h, --help Display this message and exit. "#; @@ -105,8 +110,14 @@ fn main() { run_stats_jsontests_vm(args) } else if args.flag_json { run_call(args, display::json::Informant::default()) - } else if args.flag_std_json { - run_call(args, display::std_json::Informant::default()) + } else if args.flag_std_dump_json || args.flag_std_json { + if args.flag_std_err_only { + run_call(args, display::std_json::Informant::err_only()) + } else if args.flag_std_out_only { + run_call(args, display::std_json::Informant::out_only()) + } else { + run_call(args, display::std_json::Informant::default()) + }; } else { run_call(args, display::simple::Informant::default()) } @@ -179,15 +190,23 @@ fn run_state_test(args: Args) { let post_root = state.hash.into(); let transaction = multitransaction.select(&state.indexes).into(); + let trie_spec = if args.flag_std_dump_json { + TrieSpec::Fat + } else { + TrieSpec::Secure + }; if args.flag_json { - let i = display::json::Informant::default(); - info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, i) - } else if args.flag_std_json { - let i = display::std_json::Informant::default(); - info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, i) + info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, display::json::Informant::default(), trie_spec) + } else if args.flag_std_dump_json || args.flag_std_json { + if args.flag_std_err_only { + info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, display::std_json::Informant::err_only(), trie_spec) + } else if args.flag_std_out_only { + info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, display::std_json::Informant::out_only(), trie_spec) + } else { + info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, display::std_json::Informant::default(), trie_spec) + } } else { - let i = display::simple::Informant::default(); - info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, i) + info::run_transaction(&name, idx, &spec, &pre, post_root, &env_info, transaction, display::simple::Informant::default(), trie_spec) } } } @@ -218,8 +237,13 @@ fn run_call(args: Args, informant: T) { params.code = code.map(Arc::new); params.data = data; - let result = info::run_action(&spec, params, informant); - T::finish(result); + let mut sink = informant.clone_sink(); + let result = if args.flag_std_dump_json { + info::run_action(&spec, params, informant, TrieSpec::Fat) + } else { + info::run_action(&spec, params, informant, TrieSpec::Secure) + }; + T::finish(result, &mut sink); } #[derive(Debug, Deserialize)] @@ -238,6 +262,9 @@ struct Args { flag_chain: Option, flag_json: bool, flag_std_json: bool, + flag_std_dump_json: bool, + flag_std_err_only: bool, + flag_std_out_only: bool, } impl Args { @@ -285,7 +312,7 @@ impl Args { pub fn spec(&self) -> Result { Ok(match self.flag_chain { - Some(ref filename) => { + Some(ref filename) => { let file = fs::File::open(filename).map_err(|e| format!("{}", e))?; spec::Spec::load(&::std::env::temp_dir(), file)? }, @@ -324,17 +351,21 @@ mod tests { "parity-evm", "--json", "--std-json", + "--std-dump-json", "--gas", "1", "--gas-price", "2", "--from", "0000000000000000000000000000000000000003", "--to", "0000000000000000000000000000000000000004", "--code", "05", "--input", "06", - "--chain", "./testfile", + "--chain", "./testfile", "--std-err-only", "--std-out-only" ]); assert_eq!(args.flag_json, true); assert_eq!(args.flag_std_json, true); + assert_eq!(args.flag_std_dump_json, true); + assert_eq!(args.flag_std_err_only, true); + assert_eq!(args.flag_std_out_only, true); assert_eq!(args.gas(), Ok(1.into())); assert_eq!(args.gas_price(), Ok(2.into())); assert_eq!(args.from(), Ok(3.into())); @@ -353,13 +384,15 @@ mod tests { "--chain", "homestead", "--only=add11", "--json", - "--std-json" + "--std-json", + "--std-dump-json" ]); assert_eq!(args.cmd_state_test, true); assert!(args.arg_file.is_some()); assert_eq!(args.flag_json, true); assert_eq!(args.flag_std_json, true); + assert_eq!(args.flag_std_dump_json, true); assert_eq!(args.flag_chain, Some("homestead".to_owned())); assert_eq!(args.flag_only, Some("add11".to_owned())); } diff --git a/json/src/spec/account.rs b/json/src/spec/account.rs index acc6d96b589..9a593db0cb2 100644 --- a/json/src/spec/account.rs +++ b/json/src/spec/account.rs @@ -23,6 +23,7 @@ use spec::builtin::Builtin; /// Spec account. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Account { /// Builtin contract. pub builtin: Option, diff --git a/json/src/spec/authority_round.rs b/json/src/spec/authority_round.rs index ee7463530dd..2ee38c49c0f 100644 --- a/json/src/spec/authority_round.rs +++ b/json/src/spec/authority_round.rs @@ -23,6 +23,7 @@ use super::ValidatorSet; /// Authority params deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct AuthorityRoundParams { /// Block duration, in seconds. @@ -59,6 +60,7 @@ pub struct AuthorityRoundParams { /// Authority engine deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct AuthorityRound { /// Ethash params. pub params: AuthorityRoundParams, diff --git a/json/src/spec/basic_authority.rs b/json/src/spec/basic_authority.rs index 18566363262..1d2b963600e 100644 --- a/json/src/spec/basic_authority.rs +++ b/json/src/spec/basic_authority.rs @@ -21,6 +21,7 @@ use super::ValidatorSet; /// Authority params deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct BasicAuthorityParams { /// Block duration. @@ -31,6 +32,7 @@ pub struct BasicAuthorityParams { /// Authority engine deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct BasicAuthority { /// Ethash params. pub params: BasicAuthorityParams, diff --git a/json/src/spec/builtin.rs b/json/src/spec/builtin.rs index f7cb28b0e98..38da42f1d60 100644 --- a/json/src/spec/builtin.rs +++ b/json/src/spec/builtin.rs @@ -20,6 +20,7 @@ use uint::Uint; /// Linear pricing. #[derive(Debug, PartialEq, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct Linear { /// Base price. pub base: usize, @@ -29,6 +30,7 @@ pub struct Linear { /// Pricing for modular exponentiation. #[derive(Debug, PartialEq, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct Modexp { /// Price divisor. pub divisor: usize, @@ -36,6 +38,7 @@ pub struct Modexp { /// Pricing for alt_bn128_pairing. #[derive(Debug, PartialEq, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct AltBn128Pairing { /// Base price. pub base: usize, @@ -45,6 +48,7 @@ pub struct AltBn128Pairing { /// Pricing variants. #[derive(Debug, PartialEq, Deserialize, Clone)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "snake_case")] pub enum Pricing { /// Linear pricing. @@ -57,6 +61,7 @@ pub enum Pricing { /// Spec builtin. #[derive(Debug, PartialEq, Deserialize, Clone)] +#[serde(deny_unknown_fields)] pub struct Builtin { /// Builtin name. pub name: String, diff --git a/json/src/spec/engine.rs b/json/src/spec/engine.rs index 42e5763c8b6..3ff7c34582b 100644 --- a/json/src/spec/engine.rs +++ b/json/src/spec/engine.rs @@ -20,6 +20,7 @@ use super::{Ethash, BasicAuthority, AuthorityRound, Tendermint, NullEngine, Inst /// Engine deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub enum Engine { /// Null engine. @@ -85,7 +86,6 @@ mod tests { "minimumDifficulty": "0x020000", "difficultyBoundDivisor": "0x0800", "durationLimit": "0x0d", - "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", "homesteadTransition" : "0x", "daoHardforkTransition": "0xffffffffffffffff", "daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000", diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index c4869358c0a..fc61c3e8dd8 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -23,6 +23,7 @@ use hash::Address; /// Deserializable doppelganger of block rewards for EthashParams #[derive(Clone, Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(untagged)] pub enum BlockReward { Single(Uint), @@ -31,6 +32,7 @@ pub enum BlockReward { /// Deserializable doppelganger of EthashParams. #[derive(Clone, Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct EthashParams { /// See main EthashParams docs. @@ -97,6 +99,7 @@ pub struct EthashParams { /// Ethash engine deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Ethash { /// Ethash params. pub params: EthashParams, diff --git a/json/src/spec/genesis.rs b/json/src/spec/genesis.rs index d41777defdb..3cbfd060c10 100644 --- a/json/src/spec/genesis.rs +++ b/json/src/spec/genesis.rs @@ -23,6 +23,7 @@ use spec::Seal; /// Spec genesis. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct Genesis { /// Seal. @@ -64,7 +65,6 @@ mod tests { #[test] fn genesis_deserialization() { let s = r#"{ - "nonce": "0x0000000000000042", "difficulty": "0x400000000", "seal": { "ethereum": { diff --git a/json/src/spec/hardcoded_sync.rs b/json/src/spec/hardcoded_sync.rs index 40ffe0735ab..078e0e76a6f 100644 --- a/json/src/spec/hardcoded_sync.rs +++ b/json/src/spec/hardcoded_sync.rs @@ -21,6 +21,7 @@ use uint::Uint; /// Spec hardcoded sync. #[derive(Debug, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct HardcodedSync { /// Hexadecimal of the RLP encoding of the header of the block to start synchronization from. diff --git a/json/src/spec/instant_seal.rs b/json/src/spec/instant_seal.rs index 9ac10c1b8e7..c15da8db4ee 100644 --- a/json/src/spec/instant_seal.rs +++ b/json/src/spec/instant_seal.rs @@ -18,6 +18,7 @@ /// Instant seal engine params deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct InstantSealParams { /// Whether to enable millisecond timestamp. @@ -27,6 +28,7 @@ pub struct InstantSealParams { /// Instant seal engine descriptor. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct InstantSeal { /// Instant seal parameters. pub params: InstantSealParams, diff --git a/json/src/spec/null_engine.rs b/json/src/spec/null_engine.rs index 520e9f19716..946d1882d79 100644 --- a/json/src/spec/null_engine.rs +++ b/json/src/spec/null_engine.rs @@ -20,6 +20,7 @@ use uint::Uint; /// Authority params deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct NullEngineParams { /// Block reward. @@ -28,6 +29,7 @@ pub struct NullEngineParams { /// Null engine descriptor #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct NullEngine { /// Ethash params. pub params: NullEngineParams, diff --git a/json/src/spec/params.rs b/json/src/spec/params.rs index 602c8e7bc41..139e74b0f24 100644 --- a/json/src/spec/params.rs +++ b/json/src/spec/params.rs @@ -22,6 +22,7 @@ use bytes::Bytes; /// Spec params. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct Params { /// Account start nonce, defaults to 0. diff --git a/json/src/spec/seal.rs b/json/src/spec/seal.rs index 608a7fa7f58..69c9077255e 100644 --- a/json/src/spec/seal.rs +++ b/json/src/spec/seal.rs @@ -22,6 +22,7 @@ use bytes::Bytes; /// Ethereum seal. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct Ethereum { /// Seal nonce. @@ -32,6 +33,7 @@ pub struct Ethereum { /// AuthorityRound seal. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct AuthorityRoundSeal { /// Seal step. pub step: Uint, @@ -41,6 +43,7 @@ pub struct AuthorityRoundSeal { /// Tendermint seal. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct TendermintSeal { /// Seal round. pub round: Uint, @@ -52,6 +55,7 @@ pub struct TendermintSeal { /// Seal variants. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub enum Seal { /// Ethereum seal. diff --git a/json/src/spec/spec.rs b/json/src/spec/spec.rs index 21eefeeb203..9a5589d84f0 100644 --- a/json/src/spec/spec.rs +++ b/json/src/spec/spec.rs @@ -38,6 +38,7 @@ pub enum ForkSpec { /// Spec deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct Spec { /// Spec name. @@ -70,6 +71,71 @@ mod tests { use serde_json; use spec::spec::Spec; + #[test] + fn should_error_on_unknown_fields() { + let s = r#"{ + "name": "Morden", + "dataDir": "morden", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "homesteadTransition" : "0x", + "daoHardforkTransition": "0xffffffffffffffff", + "daoHardforkBeneficiary": "0x0000000000000000000000000000000000000000", + "daoHardforkAccounts": [] + } + } + }, + "params": { + "accountStartNonce": "0x0100000", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID" : "0x2", + "forkBlock": "0xffffffffffffffff", + "forkCanonHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "gasLimitBoundDivisor": "0x20", + "unknownField": "0x0" + }, + "genesis": { + "seal": { + "ethereum": { + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x00006d6f7264656e" + } + }, + "difficulty": "0x20000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x", + "gasLimit": "0x2fefd8" + }, + "nodes": [ + "enode://b1217cbaa440e35ed471157123fe468e19e8b5ad5bedb4b1fdbcbdab6fb2f5ed3e95dd9c24a22a79fdb2352204cea207df27d92bfd21bfd41545e8b16f637499@104.44.138.37:30303" + ], + "accounts": { + "0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, + "0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, + "0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, + "0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, + "102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" } + }, + "hardcodedSync": { + "header": "f901f9a0d405da4e66f1445d455195229624e133f5baafe72b5cf7b3c36c12c8146e98b7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a05fb2b4bfdef7b314451cb138a534d225c922fc0e5fbe25e451142732c3e25c25a088d2ec6b9860aae1a2c3b299f72b6a5d70d7f7ba4722c78f2c49ba96273c2158a007c6fdfa8eea7e86b81f5b0fc0f78f90cc19f4aa60d323151e0cac660199e9a1b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefba82524d84568e932a80a0a0349d8c3df71f1a48a9df7d03fd5f14aeee7d91332c009ecaff0a71ead405bd88ab4e252a7e8c2a23", + "totalDifficulty": "0x400000000", + "CHTs": [ + "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", + "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544" + ] + } + }"#; + let result: Result = serde_json::from_str(s); + assert!(result.is_err()); + } + #[test] fn spec_deserialization() { let s = r#"{ @@ -90,7 +156,6 @@ mod tests { }, "params": { "accountStartNonce": "0x0100000", - "homesteadTransition": "0x789b0", "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x2", diff --git a/json/src/spec/state.rs b/json/src/spec/state.rs index d15ad540ce4..6227750e1f7 100644 --- a/json/src/spec/state.rs +++ b/json/src/spec/state.rs @@ -23,6 +23,7 @@ use spec::{Account, Builtin}; /// Blockchain test state deserializer. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct State(BTreeMap); impl State { diff --git a/json/src/spec/tendermint.rs b/json/src/spec/tendermint.rs index f2f321935b7..4cea89edfac 100644 --- a/json/src/spec/tendermint.rs +++ b/json/src/spec/tendermint.rs @@ -21,6 +21,7 @@ use super::ValidatorSet; /// Tendermint params deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub struct TendermintParams { /// Valid validators. @@ -39,6 +40,7 @@ pub struct TendermintParams { /// Tendermint engine deserialization. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Tendermint { /// Ethash params. pub params: TendermintParams, diff --git a/json/src/spec/validator_set.rs b/json/src/spec/validator_set.rs index 7c80ee7541e..babbb8a4760 100644 --- a/json/src/spec/validator_set.rs +++ b/json/src/spec/validator_set.rs @@ -22,6 +22,7 @@ use hash::Address; /// Different ways of specifying validators. #[derive(Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] #[serde(rename_all = "camelCase")] pub enum ValidatorSet { /// A simple list of authorities. diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index cc7e1d4ce71..6168d943229 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -463,6 +463,10 @@ usage! { ["API and Console Options – HTTP JSON-RPC"] + FLAG flag_jsonrpc_allow_missing_blocks: (bool) = false, or |c: &Config| c.rpc.as_ref()?.allow_missing_blocks.clone(), + "--jsonrpc-allow-missing-blocks", + "RPC calls will return 'null' instead of an error if ancient block sync is still in progress and the block information requested could not be found", + FLAG flag_no_jsonrpc: (bool) = false, or |c: &Config| c.rpc.as_ref()?.disable.clone(), "--no-jsonrpc", "Disable the HTTP JSON-RPC API server.", @@ -1230,6 +1234,7 @@ struct Rpc { keep_alive: Option, experimental_rpcs: Option, poll_lifetime: Option, + allow_missing_blocks: Option, } #[derive(Default, Debug, PartialEq, Deserialize)] @@ -1697,6 +1702,7 @@ mod tests { arg_jsonrpc_threads: 4, arg_jsonrpc_max_payload: None, arg_poll_lifetime: 60u32, + flag_jsonrpc_allow_missing_blocks: false, // WS flag_no_ws: false, @@ -1973,6 +1979,7 @@ mod tests { keep_alive: None, experimental_rpcs: None, poll_lifetime: None, + allow_missing_blocks: None }), ipc: Some(Ipc { disable: None, diff --git a/parity/cli/tests/config.full.toml b/parity/cli/tests/config.full.toml index 8bf97cac6e1..7d3184a77c3 100644 --- a/parity/cli/tests/config.full.toml +++ b/parity/cli/tests/config.full.toml @@ -64,6 +64,7 @@ interface = "local" cors = ["null"] apis = ["web3", "eth", "net", "parity", "traces", "rpc", "secretstore"] hosts = ["none"] +allow_missing_blocks = false [websockets] disable = false diff --git a/parity/configuration.rs b/parity/configuration.rs index 6bc90ec5629..93f207c15c8 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -370,6 +370,7 @@ impl Configuration { miner_extras: self.miner_extras()?, stratum: self.stratum_options()?, update_policy: update_policy, + allow_missing_blocks: self.args.flag_jsonrpc_allow_missing_blocks, mode: mode, tracing: tracing, fat_db: fat_db, @@ -1390,6 +1391,7 @@ mod tests { let args = vec!["parity"]; let conf = parse(&args); let mut expected = RunCmd { + allow_missing_blocks: false, cache_config: Default::default(), dirs: Default::default(), spec: Default::default(), diff --git a/parity/informant.rs b/parity/informant.rs index 9059786175a..8cc37813ce2 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -184,7 +184,7 @@ impl InformantData for LightNodeInformantData { fn executes_transactions(&self) -> bool { false } fn is_major_importing(&self) -> bool { - self.sync.is_major_importing_no_sync() + self.sync.is_major_importing() } fn report(&self) -> Report { @@ -256,16 +256,13 @@ impl Informant { } pub fn tick(&self) { - let elapsed = self.last_tick.read().elapsed(); - if elapsed < Duration::from_secs(5) { - return; - } + let now = Instant::now(); + let elapsed = now.duration_since(*self.last_tick.read()); let (client_report, full_report) = { let mut last_report = self.last_report.lock(); let full_report = self.target.report(); let diffed = full_report.client_report.clone() - &*last_report; - *last_report = full_report.client_report.clone(); (diffed, full_report) }; @@ -289,7 +286,8 @@ impl Informant { return; } - *self.last_tick.write() = Instant::now(); + *self.last_tick.write() = now; + *self.last_report.lock() = full_report.client_report.clone(); let paint = |c: Style, t: String| match self.with_color && atty::is(atty::Stream::Stdout) { true => format!("{}", c.paint(t)), @@ -306,7 +304,7 @@ impl Informant { format!("{} blk/s {} tx/s {} Mgas/s", paint(Yellow.bold(), format!("{:7.2}", (client_report.blocks_imported * 1000) as f64 / elapsed.as_milliseconds() as f64)), paint(Yellow.bold(), format!("{:6.1}", (client_report.transactions_applied * 1000) as f64 / elapsed.as_milliseconds() as f64)), - paint(Yellow.bold(), format!("{:4}", (client_report.gas_processed / (elapsed.as_milliseconds() * 1000)).low_u64())) + paint(Yellow.bold(), format!("{:6.1}", (client_report.gas_processed / 1000).low_u64() as f64 / elapsed.as_milliseconds() as f64)) ) } else { format!("{} hdr/s", diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 8acbae7c33f..660ec66289f 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -21,24 +21,24 @@ use std::sync::{Arc, Weak}; pub use parity_rpc::signer::SignerService; -use ethcore_service::PrivateTxService; use ethcore::account_provider::AccountProvider; use ethcore::client::Client; use ethcore::miner::Miner; use ethcore::snapshot::SnapshotService; use ethcore_logger::RotatingLogger; -use sync::{ManageNetwork, SyncProvider, LightSync}; +use ethcore_private_tx::Provider as PrivateTransactionManager; +use ethcore_service::PrivateTxService; use hash_fetch::fetch::Client as FetchClient; use jsonrpc_core::{self as core, MetaIoHandler}; use light::client::LightChainClient; -use light::{TransactionQueue as LightTransactionQueue, Cache as LightDataCache}; +use light::{Cache as LightDataCache, TransactionQueue as LightTransactionQueue}; use miner::external::ExternalMiner; -use parity_runtime::Executor; use parity_rpc::dispatch::{FullDispatcher, LightDispatcher}; use parity_rpc::informant::{ActivityNotifier, ClientNotifier}; -use parity_rpc::{Metadata, NetworkSettings, Host}; +use parity_rpc::{Host, Metadata, NetworkSettings}; +use parity_runtime::Executor; use parking_lot::{Mutex, RwLock}; -use ethcore_private_tx::Provider as PrivateTransactionManager; +use sync::{LightSync, ManageNetwork, SyncProvider}; use updater::Updater; #[derive(Debug, PartialEq, Clone, Eq, Hash)] @@ -106,7 +106,7 @@ impl FromStr for Api { "signer" => Ok(Signer), "traces" => Ok(Traces), "web3" => Ok(Web3), - api => Err(format!("Unknown api: {}", api)) + api => Err(format!("Unknown api: {}", api)), } } } @@ -149,20 +149,20 @@ impl FromStr for ApiSet { match api { "all" => { apis.extend(ApiSet::All.list_apis()); - }, + } "safe" => { // Safe APIs are those that are safe even in UnsafeContext. apis.extend(ApiSet::UnsafeContext.list_apis()); - }, + } // Remove the API api if api.starts_with("-") => { let api = api[1..].parse()?; apis.remove(&api); - }, + } api => { let api = api.parse()?; apis.insert(api); - }, + } } } @@ -205,11 +205,9 @@ pub trait Dependencies { fn activity_notifier(&self) -> Self::Notifier; /// Extend the given I/O handler with endpoints for each API. - fn extend_with_set( - &self, - handler: &mut MetaIoHandler, - apis: &HashSet, - ) where S: core::Middleware; + fn extend_with_set(&self, handler: &mut MetaIoHandler, apis: &HashSet) + where + S: core::Middleware; } /// RPC dependencies for a full node. @@ -235,6 +233,7 @@ pub struct FullDependencies { pub whisper_rpc: Option<::whisper::RpcFactory>, pub gas_price_percentile: usize, pub poll_lifetime: u32, + pub allow_missing_blocks: bool, } impl FullDependencies { @@ -243,24 +242,39 @@ impl FullDependencies { handler: &mut MetaIoHandler, apis: &HashSet, for_generic_pubsub: bool, - ) where S: core::Middleware { + ) where + S: core::Middleware, + { use parity_rpc::v1::*; macro_rules! add_signing_methods { - ($namespace:ident, $handler:expr, $deps:expr, $nonces:expr) => { - { - let deps = &$deps; - let dispatcher = FullDispatcher::new(deps.client.clone(), deps.miner.clone(), $nonces, deps.gas_price_percentile); - if deps.signer_service.is_enabled() { - $handler.extend_with($namespace::to_delegate(SigningQueueClient::new(&deps.signer_service, dispatcher, deps.executor.clone(), &deps.secret_store))) - } else { - $handler.extend_with($namespace::to_delegate(SigningUnsafeClient::new(&deps.secret_store, dispatcher))) - } + ($namespace:ident, $handler:expr, $deps:expr, $nonces:expr) => {{ + let deps = &$deps; + let dispatcher = FullDispatcher::new( + deps.client.clone(), + deps.miner.clone(), + $nonces, + deps.gas_price_percentile, + ); + if deps.signer_service.is_enabled() { + $handler.extend_with($namespace::to_delegate(SigningQueueClient::new( + &deps.signer_service, + dispatcher, + deps.executor.clone(), + &deps.secret_store, + ))) + } else { + $handler.extend_with($namespace::to_delegate(SigningUnsafeClient::new( + &deps.secret_store, + dispatcher, + ))) } - } + }}; } - let nonces = Arc::new(Mutex::new(dispatch::Reservations::new(self.executor.clone()))); + let nonces = Arc::new(Mutex::new(dispatch::Reservations::new( + self.executor.clone(), + ))); let dispatcher = FullDispatcher::new( self.client.clone(), self.miner.clone(), @@ -271,13 +285,13 @@ impl FullDependencies { match *api { Api::Debug => { handler.extend_with(DebugClient::new(self.client.clone()).to_delegate()); - }, + } Api::Web3 => { handler.extend_with(Web3Client::new().to_delegate()); - }, + } Api::Net => { handler.extend_with(NetClient::new(&self.sync).to_delegate()); - }, + } Api::Eth => { let client = EthClient::new( &self.client, @@ -291,91 +305,119 @@ impl FullDependencies { allow_pending_receipt_query: !self.geth_compatibility, send_block_number_in_get_work: !self.geth_compatibility, gas_price_percentile: self.gas_price_percentile, + allow_missing_blocks: self.allow_missing_blocks, allow_experimental_rpcs: self.experimental_rpcs, } ); handler.extend_with(client.to_delegate()); if !for_generic_pubsub { - let filter_client = EthFilterClient::new(self.client.clone(), self.miner.clone(), self.poll_lifetime); + let filter_client = EthFilterClient::new( + self.client.clone(), + self.miner.clone(), + self.poll_lifetime, + ); handler.extend_with(filter_client.to_delegate()); add_signing_methods!(EthSigning, handler, self, nonces.clone()); } - }, + } Api::EthPubSub => { if !for_generic_pubsub { - let client = EthPubSubClient::new(self.client.clone(), self.executor.clone()); + let client = + EthPubSubClient::new(self.client.clone(), self.executor.clone()); let h = client.handler(); - self.miner.add_transactions_listener(Box::new(move |hashes| if let Some(h) = h.upgrade() { - h.notify_new_transactions(hashes); - })); + self.miner + .add_transactions_listener(Box::new(move |hashes| { + if let Some(h) = h.upgrade() { + h.notify_new_transactions(hashes); + } + })); if let Some(h) = client.handler().upgrade() { self.client.add_notify(h); } handler.extend_with(client.to_delegate()); } - }, + } Api::Personal => { - handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility, self.experimental_rpcs).to_delegate()); - }, + handler.extend_with( + PersonalClient::new( + &self.secret_store, + dispatcher.clone(), + self.geth_compatibility, + self.experimental_rpcs, + ).to_delegate(), + ); + } Api::Signer => { - handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.executor.clone()).to_delegate()); - }, + handler.extend_with( + SignerClient::new( + &self.secret_store, + dispatcher.clone(), + &self.signer_service, + self.executor.clone(), + ).to_delegate(), + ); + } Api::Parity => { let signer = match self.signer_service.is_enabled() { true => Some(self.signer_service.clone()), false => None, }; - handler.extend_with(ParityClient::new( - self.client.clone(), - self.miner.clone(), - self.sync.clone(), - self.updater.clone(), - self.net_service.clone(), - self.secret_store.clone(), - self.logger.clone(), - self.settings.clone(), - signer, - self.ws_address.clone(), - self.snapshot.clone().into(), - ).to_delegate()); + handler.extend_with( + ParityClient::new( + self.client.clone(), + self.miner.clone(), + self.sync.clone(), + self.updater.clone(), + self.net_service.clone(), + self.secret_store.clone(), + self.logger.clone(), + self.settings.clone(), + signer, + self.ws_address.clone(), + self.snapshot.clone().into(), + ).to_delegate(), + ); if !for_generic_pubsub { add_signing_methods!(ParitySigning, handler, self, nonces.clone()); } - }, + } Api::ParityPubSub => { if !for_generic_pubsub { let mut rpc = MetaIoHandler::default(); - let apis = ApiSet::List(apis.clone()).retain(ApiSet::PubSub).list_apis(); + let apis = ApiSet::List(apis.clone()) + .retain(ApiSet::PubSub) + .list_apis(); self.extend_api(&mut rpc, &apis, true); - handler.extend_with(PubSubClient::new(rpc, self.executor.clone()).to_delegate()); + handler.extend_with( + PubSubClient::new(rpc, self.executor.clone()).to_delegate(), + ); } - }, + } Api::ParityAccounts => { - handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate()); - }, - Api::ParitySet => { - handler.extend_with(ParitySetClient::new( + handler + .extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate()); + } + Api::ParitySet => handler.extend_with( + ParitySetClient::new( &self.client, &self.miner, &self.updater, &self.net_service, self.fetch.clone(), - ).to_delegate()) - }, - Api::Traces => { - handler.extend_with(TracesClient::new(&self.client).to_delegate()) - }, + ).to_delegate(), + ), + Api::Traces => handler.extend_with(TracesClient::new(&self.client).to_delegate()), Api::Rpc => { let modules = to_modules(&apis); handler.extend_with(RpcClient::new(modules).to_delegate()); - }, + } Api::SecretStore => { handler.extend_with(SecretStoreClient::new(&self.secret_store).to_delegate()); - }, + } Api::Whisper => { if let Some(ref whisper_rpc) = self.whisper_rpc { let whisper = whisper_rpc.make_handler(self.net.clone()); @@ -386,15 +428,18 @@ impl FullDependencies { if !for_generic_pubsub { if let Some(ref whisper_rpc) = self.whisper_rpc { let whisper = whisper_rpc.make_handler(self.net.clone()); - handler.extend_with( - ::parity_whisper::rpc::WhisperPubSub::to_delegate(whisper) - ); + handler.extend_with(::parity_whisper::rpc::WhisperPubSub::to_delegate( + whisper, + )); } } - }, + } Api::Private => { - handler.extend_with(PrivateClient::new(self.private_tx_service.as_ref().map(|p| p.provider())).to_delegate()); - }, + handler.extend_with( + PrivateClient::new(self.private_tx_service.as_ref().map(|p| p.provider())) + .to_delegate(), + ); + } } } } @@ -409,11 +454,10 @@ impl Dependencies for FullDependencies { } } - fn extend_with_set( - &self, - handler: &mut MetaIoHandler, - apis: &HashSet, - ) where S: core::Middleware { + fn extend_with_set(&self, handler: &mut MetaIoHandler, apis: &HashSet) + where + S: core::Middleware, + { self.extend_api(handler, apis, false) } } @@ -463,40 +507,44 @@ impl LightDependencies { self.on_demand.clone(), self.cache.clone(), self.transaction_queue.clone(), - Arc::new(Mutex::new(dispatch::Reservations::new(self.executor.clone()))), + Arc::new(Mutex::new(dispatch::Reservations::new( + self.executor.clone(), + ))), self.gas_price_percentile, ); macro_rules! add_signing_methods { - ($namespace:ident, $handler:expr, $deps:expr) => { - { - let deps = &$deps; - let dispatcher = dispatcher.clone(); - let secret_store = deps.secret_store.clone(); - if deps.signer_service.is_enabled() { - $handler.extend_with($namespace::to_delegate( - SigningQueueClient::new(&deps.signer_service, dispatcher, deps.executor.clone(), &secret_store) - )) - } else { - $handler.extend_with( - $namespace::to_delegate(SigningUnsafeClient::new(&secret_store, dispatcher)) - ) + ($namespace:ident, $handler:expr, $deps:expr) => {{ + let deps = &$deps; + let dispatcher = dispatcher.clone(); + let secret_store = deps.secret_store.clone(); + if deps.signer_service.is_enabled() { + $handler.extend_with($namespace::to_delegate(SigningQueueClient::new( + &deps.signer_service, + dispatcher, + deps.executor.clone(), + &secret_store, + ))) + } else { + $handler.extend_with($namespace::to_delegate(SigningUnsafeClient::new( + &secret_store, + dispatcher, + ))) } - } - } + }}; } for api in apis { match *api { Api::Debug => { warn!(target: "rpc", "Debug API is not available in light client mode.") - }, + } Api::Web3 => { handler.extend_with(Web3Client::new().to_delegate()); - }, + } Api::Net => { handler.extend_with(light::NetClient::new(self.sync.clone()).to_delegate()); - }, + } Api::Eth => { let client = light::EthClient::new( self.sync.clone(), @@ -514,7 +562,7 @@ impl LightDependencies { handler.extend_with(EthFilter::to_delegate(client)); add_signing_methods!(EthSigning, handler, self); } - }, + } Api::EthPubSub => { let client = EthPubSubClient::light( self.client.clone(), @@ -526,77 +574,98 @@ impl LightDependencies { ); self.client.add_listener(client.handler() as Weak<_>); let h = client.handler(); - self.transaction_queue.write().add_listener(Box::new(move |transactions| { - if let Some(h) = h.upgrade() { - h.notify_new_transactions(transactions); - } - })); + self.transaction_queue + .write() + .add_listener(Box::new(move |transactions| { + if let Some(h) = h.upgrade() { + h.notify_new_transactions(transactions); + } + })); handler.extend_with(EthPubSub::to_delegate(client)); - }, + } Api::Personal => { - handler.extend_with(PersonalClient::new(&self.secret_store, dispatcher.clone(), self.geth_compatibility, self.experimental_rpcs).to_delegate()); - }, + handler.extend_with( + PersonalClient::new( + &self.secret_store, + dispatcher.clone(), + self.geth_compatibility, + self.experimental_rpcs, + ).to_delegate(), + ); + } Api::Signer => { - handler.extend_with(SignerClient::new(&self.secret_store, dispatcher.clone(), &self.signer_service, self.executor.clone()).to_delegate()); - }, + handler.extend_with( + SignerClient::new( + &self.secret_store, + dispatcher.clone(), + &self.signer_service, + self.executor.clone(), + ).to_delegate(), + ); + } Api::Parity => { let signer = match self.signer_service.is_enabled() { true => Some(self.signer_service.clone()), false => None, }; - handler.extend_with(light::ParityClient::new( - Arc::new(dispatcher.clone()), - self.secret_store.clone(), - self.logger.clone(), - self.settings.clone(), - signer, - self.ws_address.clone(), - self.gas_price_percentile, - ).to_delegate()); + handler.extend_with( + light::ParityClient::new( + Arc::new(dispatcher.clone()), + self.secret_store.clone(), + self.logger.clone(), + self.settings.clone(), + signer, + self.ws_address.clone(), + self.gas_price_percentile, + ).to_delegate(), + ); if !for_generic_pubsub { add_signing_methods!(ParitySigning, handler, self); } - }, + } Api::ParityPubSub => { if !for_generic_pubsub { let mut rpc = MetaIoHandler::default(); - let apis = ApiSet::List(apis.clone()).retain(ApiSet::PubSub).list_apis(); + let apis = ApiSet::List(apis.clone()) + .retain(ApiSet::PubSub) + .list_apis(); self.extend_api(&mut rpc, &apis, true); - handler.extend_with(PubSubClient::new(rpc, self.executor.clone()).to_delegate()); + handler.extend_with( + PubSubClient::new(rpc, self.executor.clone()).to_delegate(), + ); } - }, + } Api::ParityAccounts => { - handler.extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate()); - }, - Api::ParitySet => { - handler.extend_with(light::ParitySetClient::new( - self.sync.clone(), - self.fetch.clone(), - ).to_delegate()) - }, - Api::Traces => { - handler.extend_with(light::TracesClient.to_delegate()) - }, + handler + .extend_with(ParityAccountsClient::new(&self.secret_store).to_delegate()); + } + Api::ParitySet => handler.extend_with( + light::ParitySetClient::new(self.sync.clone(), self.fetch.clone()) + .to_delegate(), + ), + Api::Traces => handler.extend_with(light::TracesClient.to_delegate()), Api::Rpc => { let modules = to_modules(&apis); handler.extend_with(RpcClient::new(modules).to_delegate()); - }, + } Api::SecretStore => { handler.extend_with(SecretStoreClient::new(&self.secret_store).to_delegate()); - }, + } Api::Whisper => { if let Some(ref whisper_rpc) = self.whisper_rpc { let whisper = whisper_rpc.make_handler(self.net.clone()); handler.extend_with(::parity_whisper::rpc::Whisper::to_delegate(whisper)); } - }, + } Api::WhisperPubSub => { if let Some(ref whisper_rpc) = self.whisper_rpc { let whisper = whisper_rpc.make_handler(self.net.clone()); - handler.extend_with(::parity_whisper::rpc::WhisperPubSub::to_delegate(whisper)); + handler.extend_with(::parity_whisper::rpc::WhisperPubSub::to_delegate( + whisper, + )); } - }, + } Api::Private => { if let Some(ref tx_manager) = self.private_tx_service { let private_tx_service = Some(tx_manager.clone()); @@ -611,13 +680,14 @@ impl LightDependencies { impl Dependencies for LightDependencies { type Notifier = LightClientNotifier; - fn activity_notifier(&self) -> Self::Notifier { LightClientNotifier } + fn activity_notifier(&self) -> Self::Notifier { + LightClientNotifier + } - fn extend_with_set( - &self, - handler: &mut MetaIoHandler, - apis: &HashSet, - ) where S: core::Middleware { + fn extend_with_set(&self, handler: &mut MetaIoHandler, apis: &HashSet) + where + S: core::Middleware, + { self.extend_api(handler, apis, false) } } @@ -639,7 +709,10 @@ impl ApiSet { Api::Whisper, Api::WhisperPubSub, Api::Private, - ].into_iter().cloned().collect(); + ] + .into_iter() + .cloned() + .collect(); match *self { ApiSet::List(ref apis) => apis.clone(), @@ -647,13 +720,13 @@ impl ApiSet { public_list.insert(Api::Traces); public_list.insert(Api::ParityPubSub); public_list - }, + } ApiSet::IpcContext => { public_list.insert(Api::Traces); public_list.insert(Api::ParityPubSub); public_list.insert(Api::ParityAccounts); public_list - }, + } ApiSet::SafeContext => { public_list.insert(Api::Debug); public_list.insert(Api::Traces); @@ -663,7 +736,7 @@ impl ApiSet { public_list.insert(Api::Signer); public_list.insert(Api::SecretStore); public_list - }, + } ApiSet::All => { public_list.insert(Api::Debug); public_list.insert(Api::Traces); @@ -674,14 +747,17 @@ impl ApiSet { public_list.insert(Api::Personal); public_list.insert(Api::SecretStore); public_list - }, + } ApiSet::PubSub => [ Api::Eth, Api::Parity, Api::ParityAccounts, Api::ParitySet, Api::Traces, - ].into_iter().cloned().collect() + ] + .into_iter() + .cloned() + .collect(), } } } @@ -718,15 +794,29 @@ mod test { #[test] fn test_api_set_parsing() { - assert_eq!(ApiSet::List(vec![Api::Web3, Api::Eth].into_iter().collect()), "web3,eth".parse().unwrap()); + assert_eq!( + ApiSet::List(vec![Api::Web3, Api::Eth].into_iter().collect()), + "web3,eth".parse().unwrap() + ); } #[test] fn test_api_set_unsafe_context() { let expected = vec![ // make sure this list contains only SAFE methods - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::Whisper, Api::WhisperPubSub, Api::Private, - ].into_iter().collect(); + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::Whisper, + Api::WhisperPubSub, + Api::Private, + ].into_iter() + .collect(); assert_eq!(ApiSet::UnsafeContext.list_apis(), expected); } @@ -734,10 +824,21 @@ mod test { fn test_api_set_ipc_context() { let expected = vec![ // safe - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::Whisper, Api::WhisperPubSub, Api::Private, + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::Whisper, + Api::WhisperPubSub, + Api::Private, // semi-safe - Api::ParityAccounts - ].into_iter().collect(); + Api::ParityAccounts, + ].into_iter() + .collect(); assert_eq!(ApiSet::IpcContext.list_apis(), expected); } @@ -745,41 +846,106 @@ mod test { fn test_api_set_safe_context() { let expected = vec![ // safe - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::SecretStore, Api::Whisper, Api::WhisperPubSub, Api::Private, + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::SecretStore, + Api::Whisper, + Api::WhisperPubSub, + Api::Private, // semi-safe Api::ParityAccounts, // Unsafe - Api::ParitySet, Api::Signer, Api::Debug - ].into_iter().collect(); + Api::ParitySet, + Api::Signer, + Api::Debug, + ].into_iter() + .collect(); assert_eq!(ApiSet::SafeContext.list_apis(), expected); } #[test] fn test_all_apis() { - assert_eq!("all".parse::().unwrap(), ApiSet::List(vec![ - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::SecretStore, Api::Whisper, Api::WhisperPubSub, - Api::ParityAccounts, - Api::ParitySet, Api::Signer, - Api::Personal, - Api::Private, - Api::Debug, - ].into_iter().collect())); + assert_eq!( + "all".parse::().unwrap(), + ApiSet::List( + vec![ + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::SecretStore, + Api::Whisper, + Api::WhisperPubSub, + Api::ParityAccounts, + Api::ParitySet, + Api::Signer, + Api::Personal, + Api::Private, + Api::Debug, + ].into_iter() + .collect() + ) + ); } #[test] fn test_all_without_personal_apis() { - assert_eq!("personal,all,-personal".parse::().unwrap(), ApiSet::List(vec![ - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::SecretStore, Api::Whisper, Api::WhisperPubSub, - Api::ParityAccounts, - Api::ParitySet, Api::Signer, - Api::Private, Api::Debug, - ].into_iter().collect())); + assert_eq!( + "personal,all,-personal".parse::().unwrap(), + ApiSet::List( + vec![ + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::SecretStore, + Api::Whisper, + Api::WhisperPubSub, + Api::ParityAccounts, + Api::ParitySet, + Api::Signer, + Api::Private, + Api::Debug, + ].into_iter() + .collect() + ) + ); } #[test] fn test_safe_parsing() { - assert_eq!("safe".parse::().unwrap(), ApiSet::List(vec![ - Api::Web3, Api::Net, Api::Eth, Api::EthPubSub, Api::Parity, Api::ParityPubSub, Api::Traces, Api::Rpc, Api::Whisper, Api::WhisperPubSub, Api::Private, - ].into_iter().collect())); + assert_eq!( + "safe".parse::().unwrap(), + ApiSet::List( + vec![ + Api::Web3, + Api::Net, + Api::Eth, + Api::EthPubSub, + Api::Parity, + Api::ParityPubSub, + Api::Traces, + Api::Rpc, + Api::Whisper, + Api::WhisperPubSub, + Api::Private, + ].into_iter() + .collect() + ) + ); } } diff --git a/parity/run.rs b/parity/run.rs index 7ee0250d6bd..4d5d371b49b 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -127,6 +127,7 @@ pub struct RunCmd { pub stratum: Option, pub snapshot_conf: SnapshotConfiguration, pub check_seal: bool, + pub allow_missing_blocks: bool, pub download_old_blocks: bool, pub verifier_settings: VerifierSettings, pub serve_light: bool, @@ -717,6 +718,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: private_tx_service: Some(private_tx_service.clone()), gas_price_percentile: cmd.gas_price_percentile, poll_lifetime: cmd.poll_lifetime, + allow_missing_blocks: cmd.allow_missing_blocks, }); let dependencies = rpc::Dependencies { @@ -739,7 +741,7 @@ fn execute_impl(cmd: RunCmd, logger: Arc, on_client_rq: account_provider: account_provider, accounts_passwords: &passwords, }; - let secretstore_key_server = secretstore::start(cmd.secretstore_conf.clone(), secretstore_deps)?; + let secretstore_key_server = secretstore::start(cmd.secretstore_conf.clone(), secretstore_deps, runtime.executor())?; // the ipfs server let ipfs_server = ipfs::start_server(cmd.ipfs_conf.clone(), client.clone())?; diff --git a/parity/secretstore.rs b/parity/secretstore.rs index 1e322e3ba86..80a3c76f8d9 100644 --- a/parity/secretstore.rs +++ b/parity/secretstore.rs @@ -24,6 +24,7 @@ use ethcore::miner::Miner; use ethkey::{Secret, Public}; use sync::SyncProvider; use ethereum_types::Address; +use parity_runtime::Executor; /// This node secret key. #[derive(Debug, PartialEq, Clone)] @@ -100,14 +101,14 @@ pub struct Dependencies<'a> { #[cfg(not(feature = "secretstore"))] mod server { - use super::{Configuration, Dependencies}; + use super::{Configuration, Dependencies, Executor}; /// Noop key server implementation pub struct KeyServer; impl KeyServer { /// Create new noop key server - pub fn new(_conf: Configuration, _deps: Dependencies) -> Result { + pub fn new(_conf: Configuration, _deps: Dependencies, _executor: Executor) -> Result { Ok(KeyServer) } } @@ -120,7 +121,7 @@ mod server { use ethkey::KeyPair; use ansi_term::Colour::{Red, White}; use db; - use super::{Configuration, Dependencies, NodeSecretKey, ContractAddress}; + use super::{Configuration, Dependencies, NodeSecretKey, ContractAddress, Executor}; fn into_service_contract_address(address: ContractAddress) -> ethcore_secretstore::ContractAddress { match address { @@ -136,7 +137,7 @@ mod server { impl KeyServer { /// Create new key server - pub fn new(mut conf: Configuration, deps: Dependencies) -> Result { + pub fn new(mut conf: Configuration, deps: Dependencies, executor: Executor) -> Result { let self_secret: Arc = match conf.self_secret.take() { Some(NodeSecretKey::Plain(secret)) => Arc::new(ethcore_secretstore::PlainNodeKeyPair::new( KeyPair::from_secret(secret).map_err(|e| format!("invalid secret: {}", e))?)), @@ -179,7 +180,6 @@ mod server { service_contract_doc_sretr_address: conf.service_contract_doc_sretr_address.map(into_service_contract_address), acl_check_contract_address: conf.acl_check_contract_address.map(into_service_contract_address), cluster_config: ethcore_secretstore::ClusterConfiguration { - threads: 4, listener_address: ethcore_secretstore::NodeAddress { address: conf.interface.clone(), port: conf.port, @@ -198,7 +198,7 @@ mod server { cconf.cluster_config.nodes.insert(self_secret.public().clone(), cconf.cluster_config.listener_address.clone()); let db = db::open_secretstore_db(&conf.data_path)?; - let key_server = ethcore_secretstore::start(deps.client, deps.sync, deps.miner, self_secret, cconf, db) + let key_server = ethcore_secretstore::start(deps.client, deps.sync, deps.miner, self_secret, cconf, db, executor) .map_err(|e| format!("Error starting KeyServer {}: {}", key_server_name, e))?; Ok(KeyServer { @@ -238,11 +238,11 @@ impl Default for Configuration { } /// Start secret store-related functionality -pub fn start(conf: Configuration, deps: Dependencies) -> Result, String> { +pub fn start(conf: Configuration, deps: Dependencies, executor: Executor) -> Result, String> { if !conf.enabled { return Ok(None); } - KeyServer::new(conf, deps) + KeyServer::new(conf, deps, executor) .map(|s| Some(s)) } diff --git a/rpc/src/v1/helpers/errors.rs b/rpc/src/v1/helpers/errors.rs index b1e11f58007..d4bfff74274 100644 --- a/rpc/src/v1/helpers/errors.rs +++ b/rpc/src/v1/helpers/errors.rs @@ -18,15 +18,18 @@ use std::fmt; -use ethcore::account_provider::{SignError as AccountError}; +use ethcore::account_provider::SignError as AccountError; use ethcore::error::{Error as EthcoreError, ErrorKind, CallError}; use ethcore::client::BlockId; -use jsonrpc_core::{futures, Error, ErrorCode, Value}; +use jsonrpc_core::{futures, Result as RpcResult, Error, ErrorCode, Value}; use rlp::DecoderError; use transaction::Error as TransactionError; use ethcore_private_tx::Error as PrivateTransactionError; use vm::Error as VMError; use light::on_demand::error::{Error as OnDemandError, ErrorKind as OnDemandErrorKind}; +use ethcore::client::BlockChainClient; +use ethcore::blockchain_info::BlockChainInfo; +use v1::types::BlockNumber; mod codes { // NOTE [ToDr] Codes from [-32099, -32000] @@ -208,6 +211,60 @@ pub fn cannot_submit_work(err: EthcoreError) -> Error { } } +pub fn unavailable_block() -> Error { + Error { + code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST), + message: "Ancient block sync is still in progress".into(), + data: None, + } +} + +pub fn check_block_number_existence<'a, T, C>( + client: &'a C, + num: BlockNumber, + allow_missing_blocks: bool, +) -> + impl Fn(Option) -> RpcResult> + 'a + where C: BlockChainClient, +{ + move |response| { + if response.is_none() { + if let BlockNumber::Num(block_number) = num { + // tried to fetch block number and got nothing even though the block number is + // less than the latest block number + if block_number < client.chain_info().best_block_number && !allow_missing_blocks { + return Err(unavailable_block()); + } + } + } + Ok(response) + } +} + +pub fn check_block_gap<'a, T, C>( + client: &'a C, + allow_missing_blocks: bool, +) -> impl Fn(Option) -> RpcResult> + 'a + where C: BlockChainClient, +{ + move |response| { + if response.is_none() && !allow_missing_blocks { + let BlockChainInfo { ancient_block_hash, .. } = client.chain_info(); + // block information was requested, but unfortunately we couldn't find it and there + // are gaps in the database ethcore/src/blockchain/blockchain.rs + if ancient_block_hash.is_some() { + return Err(Error { + code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST), + message: "Block information is incomplete while ancient block sync is still in progress, before \ + it's finished we can't determine the existence of requested item.".into(), + data: None, + }) + } + } + Ok(response) + } +} + pub fn not_enough_data() -> Error { Error { code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST), @@ -328,22 +385,22 @@ pub fn transaction_message(error: &TransactionError) -> String { Old => "Transaction nonce is too low. Try incrementing the nonce.".into(), TooCheapToReplace => { "Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.".into() - }, + } LimitReached => { "There are too many transactions in the queue. Your transaction was dropped due to limit. Try increasing the fee.".into() - }, + } InsufficientGas { minimal, got } => { format!("Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: {}, got: {}). Try increasing supplied gas.", minimal, got) - }, + } InsufficientGasPrice { minimal, got } => { format!("Transaction gas price is too low. It does not satisfy your node's minimal gas price (minimal: {}, got: {}). Try increasing the gas price.", minimal, got) - }, + } InsufficientBalance { balance, cost } => { format!("Insufficient funds. The account you tried to send transaction from does not have enough funds. Required {} and got: {}.", cost, balance) - }, + } GasLimitExceeded { limit, got } => { format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got) - }, + } InvalidSignature(ref sig) => format!("Invalid signature: {}", sig), InvalidChainId => "Invalid chain id.".into(), InvalidGasLimit(_) => "Supplied gas is beyond limit.".into(), @@ -382,7 +439,6 @@ pub fn decode>(error: T) -> Error { message: "decoding error".into(), data: None, } - } } diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index 82174560029..3a2e5804091 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -65,6 +65,9 @@ pub struct EthClientOptions { pub send_block_number_in_get_work: bool, /// Gas Price Percentile used as default gas price. pub gas_price_percentile: usize, + /// Return 'null' instead of an error if ancient block sync is still in + /// progress and the block information requested could not be found. + pub allow_missing_blocks: bool, /// Enable Experimental RPC-Calls pub allow_experimental_rpcs: bool, } @@ -86,6 +89,7 @@ impl Default for EthClientOptions { allow_pending_receipt_query: true, send_block_number_in_get_work: true, gas_price_percentile: 50, + allow_missing_blocks: false, allow_experimental_rpcs: false, } } @@ -645,30 +649,51 @@ impl Eth for EthClient< } fn block_transaction_count_by_hash(&self, hash: RpcH256) -> BoxFuture> { - Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) - .map(|block| block.transactions_count().into()))) + let trx_count = self.client.block(BlockId::Hash(hash.into())) + .map(|block| block.transactions_count().into()); + let result = Ok(trx_count) + .and_then(errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn block_transaction_count_by_number(&self, num: BlockNumber) -> BoxFuture> { - Box::new(future::ok(match num { + Box::new(future::done(match num { BlockNumber::Pending => - Some(self.miner.pending_transaction_hashes(&*self.client).len().into()), - _ => - self.client.block(block_number_to_id(num)).map(|block| block.transactions_count().into()) + Ok(Some(self.miner.pending_transaction_hashes(&*self.client).len().into())), + _ => { + let trx_count = self.client.block(block_number_to_id(num.clone())) + .map(|block| block.transactions_count().into()); + Ok(trx_count) + .and_then(errors::check_block_number_existence( + &*self.client, + num, + self.options.allow_missing_blocks + )) + } })) } fn block_uncles_count_by_hash(&self, hash: RpcH256) -> BoxFuture> { - Box::new(future::ok(self.client.block(BlockId::Hash(hash.into())) - .map(|block| block.uncles_count().into()))) + let uncle_count = self.client.block(BlockId::Hash(hash.into())) + .map(|block| block.uncles_count().into()); + let result = Ok(uncle_count) + .and_then(errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn block_uncles_count_by_number(&self, num: BlockNumber) -> BoxFuture> { - Box::new(future::ok(match num { - BlockNumber::Pending => Some(0.into()), - _ => self.client.block(block_number_to_id(num)) - .map(|block| block.uncles_count().into() - ), + Box::new(future::done(match num { + BlockNumber::Pending => Ok(Some(0.into())), + _ => { + let uncles_count = self.client.block(block_number_to_id(num.clone())) + .map(|block| block.uncles_count().into()); + Ok(uncles_count) + .and_then(errors::check_block_number_existence( + &*self.client, + num, + self.options.allow_missing_blocks + )) + } })) } @@ -687,11 +712,15 @@ impl Eth for EthClient< } fn block_by_hash(&self, hash: RpcH256, include_txs: bool) -> BoxFuture> { - Box::new(future::done(self.rich_block(BlockId::Hash(hash.into()).into(), include_txs))) + let result = self.rich_block(BlockId::Hash(hash.into()).into(), include_txs) + .and_then(errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn block_by_number(&self, num: BlockNumber, include_txs: bool) -> BoxFuture> { - Box::new(future::done(self.rich_block(num.into(), include_txs))) + let result = self.rich_block(num.clone().into(), include_txs).and_then( + errors::check_block_number_existence(&*self.client, num, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn transaction_by_hash(&self, hash: RpcH256) -> BoxFuture> { @@ -700,13 +729,16 @@ impl Eth for EthClient< self.miner.transaction(&hash) .map(|t| Transaction::from_pending(t.pending().clone())) }); - - Box::new(future::ok(tx)) + let result = Ok(tx).and_then( + errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn transaction_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture> { let id = PendingTransactionId::Location(PendingOrBlock::Block(BlockId::Hash(hash.into())), index.value()); - Box::new(future::done(self.transaction(id))) + let result = self.transaction(id).and_then( + errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture> { @@ -718,7 +750,9 @@ impl Eth for EthClient< }; let transaction_id = PendingTransactionId::Location(block_id, index.value()); - Box::new(future::done(self.transaction(transaction_id))) + let result = self.transaction(transaction_id).and_then( + errors::check_block_number_existence(&*self.client, num, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn transaction_receipt(&self, hash: RpcH256) -> BoxFuture> { @@ -732,14 +766,17 @@ impl Eth for EthClient< } let receipt = self.client.transaction_receipt(TransactionId::Hash(hash)); - Box::new(future::ok(receipt.map(Into::into))) + let result = Ok(receipt.map(Into::into)) + .and_then(errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn uncle_by_block_hash_and_index(&self, hash: RpcH256, index: Index) -> BoxFuture> { - Box::new(future::done(self.uncle(PendingUncleId { + let result = self.uncle(PendingUncleId { id: PendingOrBlock::Block(BlockId::Hash(hash.into())), position: index.value() - }))) + }).and_then(errors::check_block_gap(&*self.client, self.options.allow_missing_blocks)); + Box::new(future::done(result)) } fn uncle_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture> { @@ -751,7 +788,14 @@ impl Eth for EthClient< BlockNumber::Pending => PendingUncleId { id: PendingOrBlock::Pending, position: index.value() }, }; - Box::new(future::done(self.uncle(id))) + let result = self.uncle(id) + .and_then(errors::check_block_number_existence( + &*self.client, + num, + self.options.allow_missing_blocks + )); + + Box::new(future::done(result)) } fn compilers(&self) -> Result> { diff --git a/rpc/src/v1/tests/eth.rs b/rpc/src/v1/tests/eth.rs index b0c599aa892..6892f991271 100644 --- a/rpc/src/v1/tests/eth.rs +++ b/rpc/src/v1/tests/eth.rs @@ -146,6 +146,7 @@ impl EthTester { send_block_number_in_get_work: true, gas_price_percentile: 50, allow_experimental_rpcs: true, + allow_missing_blocks: false }, ); @@ -217,7 +218,7 @@ fn eth_get_proof() { }"#; let res_latest = r#","address":"0xaaaf5374fce5edbc8e2a8697c15331677e6ebaaa","balance":"0x9","codeHash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","nonce":"0x0","storageHash":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","storageProof":[]},"id":1}"#.to_owned(); - assert!(tester.handler.handle_request_sync(req_latest).unwrap().to_string().ends_with(res_latest.as_str())); + assert!(tester.handler.handle_request_sync(req_latest).unwrap().to_string().ends_with(res_latest.as_str())); // non-existant account let req_new_acc = r#"{ @@ -228,7 +229,7 @@ fn eth_get_proof() { }"#; let res_new_acc = r#","address":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","balance":"0x0","codeHash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","nonce":"0x0","storageHash":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","storageProof":[]},"id":3}"#.to_owned(); - assert!(tester.handler.handle_request_sync(req_new_acc).unwrap().to_string().ends_with(res_new_acc.as_str())); + assert!(tester.handler.handle_request_sync(req_new_acc).unwrap().to_string().ends_with(res_new_acc.as_str())); } #[test] @@ -276,6 +277,7 @@ const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{ "params": { "minimumDifficulty": "0x020000", "difficultyBoundDivisor": "0x0800", + "blockReward": "0x4563918244F40000", "durationLimit": "0x0d", "homesteadTransition": "0xffffffffffffffff", "daoHardforkTransition": "0xffffffffffffffff", @@ -286,7 +288,6 @@ const TRANSACTION_COUNT_SPEC: &'static [u8] = br#"{ }, "params": { "gasLimitBoundDivisor": "0x0400", - "blockReward": "0x4563918244F40000", "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", "accountStartNonce": "0x00", "maximumExtraDataSize": "0x20", @@ -324,6 +325,7 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{ "params": { "minimumDifficulty": "0x020000", "difficultyBoundDivisor": "0x0800", + "blockReward": "0x4563918244F40000", "durationLimit": "0x0d", "homesteadTransition": "0xffffffffffffffff", "daoHardforkTransition": "0xffffffffffffffff", @@ -334,7 +336,6 @@ const POSITIVE_NONCE_SPEC: &'static [u8] = br#"{ }, "params": { "gasLimitBoundDivisor": "0x0400", - "blockReward": "0x4563918244F40000", "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", "accountStartNonce": "0x0100", "maximumExtraDataSize": "0x20", diff --git a/scripts/docker/hub/Dockerfile b/scripts/docker/hub/Dockerfile index 1ac92e71bf4..d40a662111f 100644 --- a/scripts/docker/hub/Dockerfile +++ b/scripts/docker/hub/Dockerfile @@ -18,14 +18,9 @@ RUN rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* RUN groupadd -g 1000 parity \ && useradd -m -u 1000 -g parity -s /bin/sh parity -USER parity - -WORKDIR /home/parity - -ENV PATH "~/bin:${PATH}" #add TARGET to docker image -COPY artifacts/x86_64-unknown-linux-gnu/$TARGET ./bin/$TARGET +COPY artifacts/x86_64-unknown-linux-gnu/$TARGET /bin/$TARGET # Build a shell script because the ENTRYPOINT command doesn't like using ENV RUN echo "#!/bin/bash \n ${TARGET} \$@" > ./entrypoint.sh @@ -33,6 +28,9 @@ RUN chmod +x ./entrypoint.sh COPY scripts/docker/hub/check_sync.sh /check_sync.sh +# switch to user parity here +USER parity + # setup ENTRYPOINT EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp ENTRYPOINT ["./entrypoint.sh"] diff --git a/scripts/gitlab/docs-jsonrpc.sh b/scripts/gitlab/publish-docs.sh similarity index 100% rename from scripts/gitlab/docs-jsonrpc.sh rename to scripts/gitlab/publish-docs.sh diff --git a/secret_store/Cargo.toml b/secret_store/Cargo.toml index 15ce83e5361..ee379acc587 100644 --- a/secret_store/Cargo.toml +++ b/secret_store/Cargo.toml @@ -17,6 +17,7 @@ futures = "0.1" rustc-hex = "1.0" tiny-keccak = "1.4" tokio = "~0.1.11" +parity-runtime = { path = "../util/runtime" } tokio-io = "0.1" tokio-service = "0.1" url = "1.0" diff --git a/secret_store/src/key_server.rs b/secret_store/src/key_server.rs index ea88f46b9c4..93baba111a4 100644 --- a/secret_store/src/key_server.rs +++ b/secret_store/src/key_server.rs @@ -15,14 +15,11 @@ // along with Parity. If not, see . use std::collections::BTreeSet; -use std::thread; use std::sync::Arc; -use std::sync::mpsc; -use futures::{self, Future}; use parking_lot::Mutex; -use tokio::runtime; use crypto::DEFAULT_MAC; use ethkey::crypto; +use parity_runtime::Executor; use super::acl_storage::AclStorage; use super::key_storage::KeyStorage; use super::key_server_set::KeyServerSet; @@ -39,16 +36,16 @@ pub struct KeyServerImpl { /// Secret store key server data. pub struct KeyServerCore { - close: Option>, - handle: Option>, cluster: Arc, } impl KeyServerImpl { /// Create new key server instance - pub fn new(config: &ClusterConfiguration, key_server_set: Arc, self_key_pair: Arc, acl_storage: Arc, key_storage: Arc) -> Result { + pub fn new(config: &ClusterConfiguration, key_server_set: Arc, self_key_pair: Arc, + acl_storage: Arc, key_storage: Arc, executor: Executor) -> Result + { Ok(KeyServerImpl { - data: Arc::new(Mutex::new(KeyServerCore::new(config, key_server_set, self_key_pair, acl_storage, key_storage)?)), + data: Arc::new(Mutex::new(KeyServerCore::new(config, key_server_set, self_key_pair, acl_storage, key_storage, executor)?)), }) } @@ -175,9 +172,10 @@ impl MessageSigner for KeyServerImpl { } impl KeyServerCore { - pub fn new(config: &ClusterConfiguration, key_server_set: Arc, self_key_pair: Arc, acl_storage: Arc, key_storage: Arc) -> Result { + pub fn new(config: &ClusterConfiguration, key_server_set: Arc, self_key_pair: Arc, + acl_storage: Arc, key_storage: Arc, executor: Executor) -> Result + { let config = NetClusterConfiguration { - threads: config.threads, self_key_pair: self_key_pair.clone(), listen_address: (config.listener_address.address.clone(), config.listener_address.port), key_server_set: key_server_set, @@ -188,45 +186,16 @@ impl KeyServerCore { auto_migrate_enabled: config.auto_migrate_enabled, }; - let (stop, stopped) = futures::oneshot(); - let (tx, rx) = mpsc::channel(); - let handle = thread::Builder::new().name("KeyServerLoop".into()).spawn(move || { - let runtime_res = runtime::Builder::new() - .core_threads(config.threads) - .build(); - - let mut el = match runtime_res { - Ok(el) => el, - Err(e) => { - tx.send(Err(Error::Internal(format!("error initializing event loop: {}", e)))).expect("Rx is blocking upper thread."); - return; - }, - }; - - let cluster = ClusterCore::new(el.executor(), config); - let cluster_client = cluster.and_then(|c| c.run().map(|_| c.client())); - tx.send(cluster_client.map_err(Into::into)).expect("Rx is blocking upper thread."); - let _ = el.block_on(futures::empty().select(stopped)); - - trace!(target: "secretstore_net", "{}: KeyServerLoop thread stopped", self_key_pair.public()); - }).map_err(|e| Error::Internal(format!("{}", e)))?; - let cluster = rx.recv().map_err(|e| Error::Internal(format!("error initializing event loop: {}", e)))??; + let cluster = ClusterCore::new(executor, config) + .and_then(|c| c.run().map(|_| c.client())) + .map_err(|err| Error::from(err))?; Ok(KeyServerCore { - close: Some(stop), - handle: Some(handle), - cluster: cluster, + cluster, }) } } -impl Drop for KeyServerCore { - fn drop(&mut self) { - self.close.take().map(|v| v.send(())); - self.handle.take().map(|h| h.join()); - } -} - #[cfg(test)] pub mod tests { use std::collections::BTreeSet; @@ -243,6 +212,7 @@ pub mod tests { use key_server_set::tests::MapKeyServerSet; use key_server_cluster::math; use ethereum_types::{H256, H520}; + use parity_runtime::Runtime; use types::{Error, Public, ClusterConfiguration, NodeAddress, RequestSignature, ServerKeyId, EncryptedDocumentKey, EncryptedDocumentKeyShadow, MessageHash, EncryptedMessageSignature, Requester, NodeId}; @@ -294,10 +264,9 @@ pub mod tests { } } - fn make_key_servers(start_port: u16, num_nodes: usize) -> (Vec, Vec>) { + fn make_key_servers(start_port: u16, num_nodes: usize) -> (Vec, Vec>, Runtime) { let key_pairs: Vec<_> = (0..num_nodes).map(|_| Random.generate().unwrap()).collect(); let configs: Vec<_> = (0..num_nodes).map(|i| ClusterConfiguration { - threads: 1, listener_address: NodeAddress { address: "127.0.0.1".into(), port: start_port + (i as u16), @@ -316,11 +285,12 @@ pub mod tests { .map(|(k, a)| (k.clone(), format!("{}:{}", a.address, a.port).parse().unwrap())) .collect(); let key_storages = (0..num_nodes).map(|_| Arc::new(DummyKeyStorage::default())).collect::>(); + let runtime = Runtime::with_thread_count(4); let key_servers: Vec<_> = configs.into_iter().enumerate().map(|(i, cfg)| KeyServerImpl::new(&cfg, Arc::new(MapKeyServerSet::new(false, key_servers_set.clone())), Arc::new(PlainNodeKeyPair::new(key_pairs[i].clone())), Arc::new(DummyAclStorage::default()), - key_storages[i].clone()).unwrap() + key_storages[i].clone(), runtime.executor()).unwrap() ).collect(); // wait until connections are established. It is fast => do not bother with events here @@ -350,13 +320,13 @@ pub mod tests { } } - (key_servers, key_storages) + (key_servers, key_storages, runtime) } #[test] fn document_key_generation_and_retrievement_works_over_network_with_single_node() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6070, 1); + let (key_servers, _, runtime) = make_key_servers(6070, 1); // generate document key let threshold = 0; @@ -372,12 +342,13 @@ pub mod tests { let retrieved_key = crypto::ecies::decrypt(&secret, &DEFAULT_MAC, &retrieved_key).unwrap(); assert_eq!(retrieved_key, generated_key); } + drop(runtime); } #[test] fn document_key_generation_and_retrievement_works_over_network_with_3_nodes() { //::logger::init_log(); - let (key_servers, key_storages) = make_key_servers(6080, 3); + let (key_servers, key_storages, runtime) = make_key_servers(6080, 3); let test_cases = [0, 1, 2]; for threshold in &test_cases { @@ -399,12 +370,13 @@ pub mod tests { assert!(key_share.encrypted_point.is_some()); } } + drop(runtime); } #[test] fn server_key_generation_and_storing_document_key_works_over_network_with_3_nodes() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6090, 3); + let (key_servers, _, runtime) = make_key_servers(6090, 3); let test_cases = [0, 1, 2]; for threshold in &test_cases { @@ -430,12 +402,13 @@ pub mod tests { assert_eq!(retrieved_key, generated_key); } } + drop(runtime); } #[test] fn server_key_generation_and_message_signing_works_over_network_with_3_nodes() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6100, 3); + let (key_servers, _, runtime) = make_key_servers(6100, 3); let test_cases = [0, 1, 2]; for threshold in &test_cases { @@ -455,12 +428,13 @@ pub mod tests { // check signature assert_eq!(math::verify_schnorr_signature(&server_public, &(signature_c, signature_s), &message_hash), Ok(true)); } + drop(runtime); } #[test] fn decryption_session_is_delegated_when_node_does_not_have_key_share() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6110, 3); + let (key_servers, _, runtime) = make_key_servers(6110, 3); // generate document key let threshold = 0; @@ -477,12 +451,13 @@ pub mod tests { let retrieved_key = key_servers[0].restore_document_key(&document, &signature.into()).unwrap(); let retrieved_key = crypto::ecies::decrypt(&secret, &DEFAULT_MAC, &retrieved_key).unwrap(); assert_eq!(retrieved_key, generated_key); + drop(runtime); } #[test] fn schnorr_signing_session_is_delegated_when_node_does_not_have_key_share() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6114, 3); + let (key_servers, _, runtime) = make_key_servers(6114, 3); let threshold = 1; // generate server key @@ -503,12 +478,13 @@ pub mod tests { // check signature assert_eq!(math::verify_schnorr_signature(&server_public, &(signature_c, signature_s), &message_hash), Ok(true)); + drop(runtime); } #[test] fn ecdsa_signing_session_is_delegated_when_node_does_not_have_key_share() { //::logger::init_log(); - let (key_servers, _) = make_key_servers(6117, 4); + let (key_servers, _, runtime) = make_key_servers(6117, 4); let threshold = 1; // generate server key @@ -528,6 +504,7 @@ pub mod tests { // check signature assert!(verify_public(&server_public, &signature.into(), &message_hash).unwrap()); + drop(runtime); } #[test] diff --git a/secret_store/src/key_server_cluster/client_sessions/generation_session.rs b/secret_store/src/key_server_cluster/client_sessions/generation_session.rs index 2368635df06..8984f61fff7 100644 --- a/secret_store/src/key_server_cluster/client_sessions/generation_session.rs +++ b/secret_store/src/key_server_cluster/client_sessions/generation_session.rs @@ -1367,12 +1367,12 @@ pub mod tests { let clusters_clone = clusters.clone(); // establish connections - loop_until(&mut core, CONN_TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&core.executor(), CONN_TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // run session to completion let session_id = SessionId::default(); let session = clusters[0].client().new_generation_session(session_id, Default::default(), Default::default(), threshold).unwrap(); - loop_until(&mut core, SESSION_TIMEOUT, move || session.joint_public_and_secret().is_some()); + loop_until(&core.executor(), SESSION_TIMEOUT, move || session.joint_public_and_secret().is_some()); } } diff --git a/secret_store/src/key_server_cluster/cluster.rs b/secret_store/src/key_server_cluster/cluster.rs index 9607d9173c5..61fb2bcecd7 100644 --- a/secret_store/src/key_server_cluster/cluster.rs +++ b/secret_store/src/key_server_cluster/cluster.rs @@ -24,11 +24,11 @@ use std::net::{SocketAddr, IpAddr}; use futures::{future, Future, Stream}; use parking_lot::{Mutex, RwLock}; use tokio_io::IoFuture; -use tokio::runtime::TaskExecutor; use tokio::timer::{Interval, timeout::Error as TimeoutError}; use tokio::net::{TcpListener, TcpStream}; use ethkey::{Public, KeyPair, Signature, Random, Generator}; use ethereum_types::{Address, H256}; +use parity_runtime::Executor; use key_server_cluster::{Error, NodeId, SessionId, Requester, AclStorage, KeyStorage, KeyServerSet, NodeKeyPair}; use key_server_cluster::cluster_sessions::{ClusterSession, AdminSession, ClusterSessions, SessionIdWithSubSession, ClusterSessionsContainer, SERVERS_SET_CHANGE_SESSION_ID, create_cluster_view, AdminSessionCreationData, ClusterSessionsListener}; @@ -121,8 +121,6 @@ pub trait Cluster: Send + Sync { /// Cluster initialization parameters. #[derive(Clone)] pub struct ClusterConfiguration { - /// Number of threads reserved by cluster. - pub threads: usize, /// Allow connecting to 'higher' nodes. pub allow_connecting_to_higher_nodes: bool, /// KeyPair this node holds. @@ -175,14 +173,14 @@ pub struct ClusterData { /// Cluster configuration. pub config: ClusterConfiguration, /// Handle to the event loop. - pub executor: TaskExecutor, + pub executor: Executor, /// KeyPair this node holds. pub self_key_pair: Arc, /// Connections data. pub connections: ClusterConnections, /// Active sessions data. pub sessions: ClusterSessions, - /// Shutdown flag: + /// A shutdown flag. pub is_shutdown: Arc, } @@ -235,7 +233,7 @@ pub struct Connection { } impl ClusterCore { - pub fn new(executor: TaskExecutor, config: ClusterConfiguration) -> Result, Error> { + pub fn new(executor: Executor, config: ClusterConfiguration) -> Result, Error> { let listen_address = make_socket_address(&config.listen_address.0, config.listen_address.1)?; let connections = ClusterConnections::new(&config)?; let servers_set_change_creator_connector = connections.connector.clone(); @@ -790,7 +788,7 @@ impl ClusterConnections { } impl ClusterData { - pub fn new(executor: &TaskExecutor, config: ClusterConfiguration, connections: ClusterConnections, sessions: ClusterSessions) -> Arc { + pub fn new(executor: &Executor, config: ClusterConfiguration, connections: ClusterConnections, sessions: ClusterSessions) -> Arc { Arc::new(ClusterData { executor: executor.clone(), self_key_pair: config.self_key_pair.clone(), @@ -807,12 +805,6 @@ impl ClusterData { } /// Spawns a future on the runtime. - // - // TODO: Consider implementing a more graceful shutdown process using an - // `AtomicBool`, etc. which would prevent tasks from being spawned after a - // shutdown signal is given. (Recursive calls, in - // `process_connection_messages` for example, appear to continue - // indefinitely.) pub fn spawn(&self, f: F) where F: Future + Send + 'static { if self.is_shutdown.load(Ordering::Acquire) == false { if let Err(err) = future::Executor::execute(&self.executor, Box::new(f)) { @@ -1139,9 +1131,12 @@ pub mod tests { use std::collections::{BTreeSet, VecDeque}; use parking_lot::RwLock; use tokio::{ - runtime::{Runtime, Builder as RuntimeBuilder}, prelude::{future, Future}, }; + use parity_runtime::{ + futures::sync::oneshot, + Runtime, Executor, + }; use ethereum_types::{Address, H256}; use ethkey::{Random, Generator, Public, Signature, sign}; use key_server_cluster::{NodeId, SessionId, Requester, Error, DummyAclStorage, DummyKeyStorage, @@ -1263,16 +1258,18 @@ pub mod tests { } } - /// Loops until `predicate` returns `true` or `timeout` has elapsed. - pub fn loop_until(runtime: &mut Runtime, timeout: Duration, predicate: F) + /// Blocks the calling thread, looping until `predicate` returns `true` or + /// `timeout` has elapsed. + pub fn loop_until(executor: &Executor, timeout: Duration, predicate: F) where F: Send + 'static + Fn() -> bool { use futures::Stream; use tokio::timer::Interval; let start = Instant::now(); + let (complete_tx, complete_rx) = oneshot::channel(); - runtime.block_on(Interval::new_interval(Duration::from_millis(1)) + executor.spawn(Interval::new_interval(Duration::from_millis(1)) .and_then(move |_| { if Instant::now() - start > timeout { panic!("no result in {:?}", timeout); @@ -1282,8 +1279,13 @@ pub mod tests { }) .take_while(move |_| future::ok(!predicate())) .for_each(|_| Ok(())) - .then(|_| future::ok::<(), ()>(())) - ).unwrap(); + .then(|_| { + complete_tx.send(()).expect("receiver dropped"); + future::ok::<(), ()>(()) + }) + ); + + complete_rx.wait().unwrap(); } pub fn all_connections_established(cluster: &Arc) -> bool { @@ -1295,7 +1297,6 @@ pub mod tests { pub fn make_clusters(runtime: &Runtime, ports_begin: u16, num_nodes: usize) -> Vec> { let key_pairs: Vec<_> = (0..num_nodes).map(|_| Random.generate().unwrap()).collect(); let cluster_params: Vec<_> = (0..num_nodes).map(|i| ClusterConfiguration { - threads: 1, self_key_pair: Arc::new(PlainNodeKeyPair::new(key_pairs[i].clone())), listen_address: ("127.0.0.1".to_owned(), ports_begin + i as u16), key_server_set: Arc::new(MapKeyServerSet::new(false, key_pairs.iter().enumerate() @@ -1331,21 +1332,17 @@ pub mod tests { /// Returns a new runtime with a static number of threads. pub fn new_runtime() -> Runtime { - RuntimeBuilder::new() - .core_threads(4) - .build() - .expect("Unable to create tokio runtime") + Runtime::with_thread_count(4) } #[test] fn cluster_connects_to_other_nodes() { - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6010, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } #[test] @@ -1359,17 +1356,16 @@ pub mod tests { _ => panic!("unexpected success"), } shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } #[test] fn error_in_generation_session_broadcasted_to_all_other_nodes() { //::logger::init_log(); - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6016, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // ask one of nodes to produce faulty generation sessions clusters[1].client().make_faulty_generation_sessions(); @@ -1378,7 +1374,7 @@ pub mod tests { let session = clusters[0].client().new_generation_session(SessionId::default(), Default::default(), Default::default(), 1).unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || session_clone.joint_public_and_secret().is_some() + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.joint_public_and_secret().is_some() && clusters_clone[0].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_err()); @@ -1389,24 +1385,22 @@ pub mod tests { let clusters_clone = clusters.clone(); // wait for both session completion && session removal (session completion event is fired // before session is removed from its own container by cluster) - loop_until(&mut runtime, TIMEOUT, move || session_clone.joint_public_and_secret().is_some() + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.joint_public_and_secret().is_some() && clusters_clone[i].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_err()); } } shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } #[test] fn generation_session_completion_signalled_if_failed_on_master() { //::logger::init_log(); - let mut runtime = new_runtime(); - + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6025, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // ask one of nodes to produce faulty generation sessions clusters[0].client().make_faulty_generation_sessions(); @@ -1415,7 +1409,7 @@ pub mod tests { let session = clusters[0].client().new_generation_session(SessionId::default(), Default::default(), Default::default(), 1).unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || session_clone.joint_public_and_secret().is_some() + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.joint_public_and_secret().is_some() && clusters_clone[0].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_err()); @@ -1426,29 +1420,28 @@ pub mod tests { let clusters_clone = clusters.clone(); // wait for both session completion && session removal (session completion event is fired // before session is removed from its own container by cluster) - loop_until(&mut runtime, TIMEOUT, move || session_clone.joint_public_and_secret().is_some() + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.joint_public_and_secret().is_some() && clusters_clone[i].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_err()); } } shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } #[test] fn generation_session_is_removed_when_succeeded() { //::logger::init_log(); - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6019, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // start && wait for generation session to complete let session = clusters[0].client().new_generation_session(SessionId::default(), Default::default(), Default::default(), 1).unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished + loop_until(&runtime.executor(), TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished || session_clone.state() == GenerationSessionState::Failed) && clusters_clone[0].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_ok()); @@ -1462,22 +1455,21 @@ pub mod tests { // AND check that it is actually removed from cluster sessions let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished + loop_until(&runtime.executor(), TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished || session_clone.state() == GenerationSessionState::Failed) && clusters_clone[i].client().generation_session(&SessionId::default()).is_none()); } } shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } #[test] fn sessions_are_removed_when_initialization_fails() { - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6022, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // generation session { @@ -1506,7 +1498,6 @@ pub mod tests { assert!(clusters[0].data.sessions.negotiation_sessions.is_empty()); } shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } // test ignored because of @@ -1516,17 +1507,17 @@ pub mod tests { #[ignore] fn schnorr_signing_session_completes_if_node_does_not_have_a_share() { //::logger::init_log(); - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6028, 3); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // start && wait for generation session to complete let session = clusters[0].client().new_generation_session(SessionId::default(), Default::default(), Default::default(), 1).unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished + loop_until(&runtime.executor(), TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished || session_clone.state() == GenerationSessionState::Failed) && clusters_clone[0].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_ok()); @@ -1542,7 +1533,7 @@ pub mod tests { let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || session_clone.is_finished() && (0..3).all(|i| + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.is_finished() && (0..3).all(|i| clusters_clone[i].data.sessions.schnorr_signing_sessions.is_empty())); session0.wait().unwrap(); @@ -1553,7 +1544,7 @@ pub mod tests { let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || session_clone.is_finished() && (0..3).all(|i| + loop_until(&runtime.executor(), TIMEOUT, move || session_clone.is_finished() && (0..3).all(|i| clusters_clone[i].data.sessions.schnorr_signing_sessions.is_empty())); session2.wait().unwrap(); @@ -1566,10 +1557,9 @@ pub mod tests { let session = clusters[0].data.sessions.schnorr_signing_sessions.first().unwrap(); let session = session.clone(); - loop_until(&mut runtime, TIMEOUT, move || session.is_finished()); + loop_until(&runtime.executor(), TIMEOUT, move || session.is_finished()); session1.wait().unwrap_err(); shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } // test ignored because of @@ -1579,17 +1569,17 @@ pub mod tests { #[ignore] fn ecdsa_signing_session_completes_if_node_does_not_have_a_share() { //::logger::init_log(); - let mut runtime = new_runtime(); + let runtime = new_runtime(); let clusters = make_clusters(&runtime, 6041, 4); run_clusters(&clusters); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); + loop_until(&runtime.executor(), TIMEOUT, move || clusters_clone.iter().all(all_connections_established)); // start && wait for generation session to complete let session = clusters[0].client().new_generation_session(SessionId::default(), Default::default(), Default::default(), 1).unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished + loop_until(&runtime.executor(), TIMEOUT, move || (session_clone.state() == GenerationSessionState::Finished || session_clone.state() == GenerationSessionState::Failed) && clusters_clone[0].client().generation_session(&SessionId::default()).is_none()); assert!(session.joint_public_and_secret().unwrap().is_ok()); @@ -1605,7 +1595,7 @@ pub mod tests { let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, Duration::from_millis(1000), move || session_clone.is_finished() && (0..3).all(|i| + loop_until(&runtime.executor(), Duration::from_millis(1000), move || session_clone.is_finished() && (0..3).all(|i| clusters_clone[i].data.sessions.ecdsa_signing_sessions.is_empty())); session0.wait().unwrap(); @@ -1615,7 +1605,7 @@ pub mod tests { let session = clusters[2].data.sessions.ecdsa_signing_sessions.first().unwrap(); let session_clone = session.clone(); let clusters_clone = clusters.clone(); - loop_until(&mut runtime, Duration::from_millis(1000), move || session_clone.is_finished() && (0..3).all(|i| + loop_until(&runtime.executor(), Duration::from_millis(1000), move || session_clone.is_finished() && (0..3).all(|i| clusters_clone[i].data.sessions.ecdsa_signing_sessions.is_empty())); session2.wait().unwrap(); @@ -1626,9 +1616,8 @@ pub mod tests { let signature = sign(Random.generate().unwrap().secret(), &Default::default()).unwrap(); let session1 = clusters[0].client().new_ecdsa_signing_session(Default::default(), signature.into(), None, H256::random()).unwrap(); let session = clusters[0].data.sessions.ecdsa_signing_sessions.first().unwrap(); - loop_until(&mut runtime, Duration::from_millis(1000), move || session.is_finished()); + loop_until(&runtime.executor(), Duration::from_millis(1000), move || session.is_finished()); session1.wait().unwrap_err(); shutdown_clusters(&clusters); - runtime.shutdown_now().wait().unwrap(); } } diff --git a/secret_store/src/key_server_cluster/cluster_sessions.rs b/secret_store/src/key_server_cluster/cluster_sessions.rs index b34485638e6..d068c25b93a 100644 --- a/secret_store/src/key_server_cluster/cluster_sessions.rs +++ b/secret_store/src/key_server_cluster/cluster_sessions.rs @@ -582,7 +582,6 @@ mod tests { pub fn make_cluster_sessions() -> ClusterSessions { let key_pair = Random.generate().unwrap(); let config = ClusterConfiguration { - threads: 1, self_key_pair: Arc::new(PlainNodeKeyPair::new(key_pair.clone())), listen_address: ("127.0.0.1".to_owned(), 100_u16), key_server_set: Arc::new(MapKeyServerSet::new(false, vec![(key_pair.public().clone(), format!("127.0.0.1:{}", 100).parse().unwrap())].into_iter().collect())), diff --git a/secret_store/src/lib.rs b/secret_store/src/lib.rs index ddd8f6d448d..1acbde38096 100644 --- a/secret_store/src/lib.rs +++ b/secret_store/src/lib.rs @@ -33,6 +33,7 @@ extern crate serde; extern crate serde_json; extern crate tiny_keccak; extern crate tokio; +extern crate parity_runtime; extern crate tokio_io; extern crate tokio_service; extern crate url; @@ -72,6 +73,7 @@ use kvdb::KeyValueDB; use ethcore::client::Client; use ethcore::miner::Miner; use sync::SyncProvider; +use parity_runtime::Executor; pub use types::{ServerKeyId, EncryptedDocumentKey, RequestSignature, Public, Error, NodeAddress, ContractAddress, ServiceConfiguration, ClusterConfiguration}; @@ -79,7 +81,9 @@ pub use traits::{NodeKeyPair, KeyServer}; pub use self::node_key_pair::{PlainNodeKeyPair, KeyStoreNodeKeyPair}; /// Start new key server instance -pub fn start(client: Arc, sync: Arc, miner: Arc, self_key_pair: Arc, mut config: ServiceConfiguration, db: Arc) -> Result, Error> { +pub fn start(client: Arc, sync: Arc, miner: Arc, self_key_pair: Arc, mut config: ServiceConfiguration, + db: Arc, executor: Executor) -> Result, Error> +{ let trusted_client = trusted_client::TrustedClient::new(self_key_pair.clone(), client.clone(), sync, miner); let acl_storage: Arc = match config.acl_check_contract_address.take() { Some(acl_check_contract_address) => acl_storage::OnChainAclStorage::new(trusted_client.clone(), acl_check_contract_address)?, @@ -89,13 +93,14 @@ pub fn start(client: Arc, sync: Arc, miner: Arc, se let key_server_set = key_server_set::OnChainKeyServerSet::new(trusted_client.clone(), config.cluster_config.key_server_set_contract_address.take(), self_key_pair.clone(), config.cluster_config.auto_migrate_enabled, config.cluster_config.nodes.clone())?; let key_storage = Arc::new(key_storage::PersistentKeyStorage::new(db)?); - let key_server = Arc::new(key_server::KeyServerImpl::new(&config.cluster_config, key_server_set.clone(), self_key_pair.clone(), acl_storage.clone(), key_storage.clone())?); + let key_server = Arc::new(key_server::KeyServerImpl::new(&config.cluster_config, key_server_set.clone(), self_key_pair.clone(), + acl_storage.clone(), key_storage.clone(), executor.clone())?); let cluster = key_server.cluster(); let key_server: Arc = key_server; // prepare HTTP listener let http_listener = match config.listener_address { - Some(listener_address) => Some(listener::http_listener::KeyServerHttpListener::start(listener_address, Arc::downgrade(&key_server))?), + Some(listener_address) => Some(listener::http_listener::KeyServerHttpListener::start(listener_address, Arc::downgrade(&key_server), executor)?), None => None, }; diff --git a/secret_store/src/listener/http_listener.rs b/secret_store/src/listener/http_listener.rs index 9877a42411e..fdaac861b55 100644 --- a/secret_store/src/listener/http_listener.rs +++ b/secret_store/src/listener/http_listener.rs @@ -26,7 +26,7 @@ use serde::Serialize; use serde_json; use tokio; use tokio::net::TcpListener; -use tokio::runtime::{Runtime, Builder as RuntimeBuilder}; +use parity_runtime::Executor; use futures::{future, Future, Stream}; use url::percent_encoding::percent_decode; @@ -46,7 +46,7 @@ use types::{Error, Public, MessageHash, NodeAddress, RequestSignature, ServerKey /// To change servers set: POST /admin/servers_set_change/{old_signature}/{new_signature} + BODY: json array of hex-encoded nodes ids pub struct KeyServerHttpListener { - _runtime: Runtime, + _executor: Executor, _handler: Arc, } @@ -86,15 +86,11 @@ struct KeyServerSharedHttpHandler { impl KeyServerHttpListener { /// Start KeyServer http listener - pub fn start(listener_address: NodeAddress, key_server: Weak) -> Result { + pub fn start(listener_address: NodeAddress, key_server: Weak, executor: Executor) -> Result { let shared_handler = Arc::new(KeyServerSharedHttpHandler { key_server: key_server, }); - let mut runtime = RuntimeBuilder::new() - // TODO: Add config option/arg? - .core_threads(2) - .build()?; let listener_address = format!("{}:{}", listener_address.address, listener_address.port).parse()?; let listener = TcpListener::bind(&listener_address)?; @@ -113,10 +109,10 @@ impl KeyServerHttpListener { tokio::spawn(serve) }); - runtime.spawn(server); + executor.spawn(server); let listener = KeyServerHttpListener { - _runtime: runtime, + _executor: executor, _handler: shared_handler, }; @@ -419,13 +415,16 @@ mod tests { use traits::KeyServer; use key_server::tests::DummyKeyServer; use types::NodeAddress; + use parity_runtime::Runtime; use super::{parse_request, Request, KeyServerHttpListener}; #[test] fn http_listener_successfully_drops() { let key_server: Arc = Arc::new(DummyKeyServer::default()); let address = NodeAddress { address: "127.0.0.1".into(), port: 9000 }; - let listener = KeyServerHttpListener::start(address, Arc::downgrade(&key_server)).unwrap(); + let runtime = Runtime::with_thread_count(1); + let listener = KeyServerHttpListener::start(address, Arc::downgrade(&key_server), + runtime.executor()).unwrap(); drop(listener); } diff --git a/secret_store/src/types/all.rs b/secret_store/src/types/all.rs index feca4141f08..bf05b538d5b 100644 --- a/secret_store/src/types/all.rs +++ b/secret_store/src/types/all.rs @@ -75,8 +75,6 @@ pub struct ServiceConfiguration { /// Key server cluster configuration #[derive(Debug)] pub struct ClusterConfiguration { - /// Number of threads reserved by cluster. - pub threads: usize, /// This node address. pub listener_address: NodeAddress, /// All cluster nodes addresses. diff --git a/util/EIP-712/Cargo.toml b/util/EIP-712/Cargo.toml index 308df98d8ad..aaee48bccd5 100644 --- a/util/EIP-712/Cargo.toml +++ b/util/EIP-712/Cargo.toml @@ -12,7 +12,6 @@ keccak-hash = "0.1" ethereum-types = "0.4" failure = "0.1" itertools = "0.7" -failure_derive = "0.1" lazy_static = "1.1" toolshed = "0.4" regex = "1.0" diff --git a/util/EIP-712/src/lib.rs b/util/EIP-712/src/lib.rs index 206b685104c..b881a45e390 100644 --- a/util/EIP-712/src/lib.rs +++ b/util/EIP-712/src/lib.rs @@ -172,8 +172,6 @@ extern crate validator; #[macro_use] extern crate validator_derive; #[macro_use] -extern crate failure_derive; -#[macro_use] extern crate serde_derive; #[macro_use] extern crate lazy_static; diff --git a/util/runtime/src/lib.rs b/util/runtime/src/lib.rs index aa7b6e73c42..97bed9b130c 100644 --- a/util/runtime/src/lib.rs +++ b/util/runtime/src/lib.rs @@ -16,8 +16,8 @@ //! Tokio Runtime wrapper. -extern crate futures; -extern crate tokio; +pub extern crate futures; +pub extern crate tokio; use std::{fmt, thread}; use std::sync::mpsc; @@ -222,6 +222,24 @@ impl Executor { } } +impl + Send + 'static> future::Executor for Executor { + fn execute(&self, future: F) -> Result<(), future::ExecuteError> { + match self.inner { + Mode::Tokio(ref executor) => executor.execute(future), + Mode::Sync => { + let _= future.wait(); + Ok(()) + }, + Mode::ThreadPerFuture => { + thread::spawn(move || { + let _= future.wait(); + }); + Ok(()) + }, + } + } +} + /// A handle to a runtime. Dropping the handle will cause runtime to shutdown. pub struct RuntimeHandle { close: Option>,