Commit Graph

2421 Commits

Author SHA1 Message Date
Bastian Köcher 5bd6e94e64 Move "wasm" allocator into its own crate (#4716)
This moves the wasm-allocator (`FreeingBumpHeapAllocator`) into its own
crate `sp-allocator`. This new crate can theoretically provide multiple
different allocators. Besides moving the allocator, this pr also makes
`FreeingBumpHeapAllocator` compile on `no_std`.
2020-01-22 18:13:17 +01:00
Robert Habermeier 21a2539a24 make NotificationStream event naming consistent (#4712) 2020-01-22 16:33:42 +01:00
Max Inden e0c6955ca9 client/authority-discovery/Cargo.toml: Update dependency (#4706)
* client/authority-discovery/Cargo.toml: Update dependency

* client/authority-discovery: Pass packet payload and addresses as slice

Starting with Bytes 0.5 `Vec<T>` does not implement `Buf`, but `&[T]`
does.
2020-01-22 14:49:28 +01:00
André Silva c1750c5c28 grandpa: filter some telemetry events on larger voter sets (#4700) 2020-01-21 22:14:44 +01:00
Nikolay Volf def8573b07 fix docs deadlinks (#4698) 2020-01-21 08:01:55 -08:00
Pierre Krieger 169a48c0c5 Pass an executor through the Configuration (#4688)
* Pass an executor through the Configuration

* Make tasks_executor mandatory

* Fix tests
2020-01-21 13:06:15 +01:00
André Silva b7a63e3b77 grandpa: reduce allocations when verifying multiple messages (#4693) 2020-01-21 11:45:36 +00:00
Bastian Köcher 85aa632278 Make debug builds more usable (#4683)
* Make debug builds more usable

This pr makes debug builds more usable in terms of `cargo run -- --dev`.

1. `--dev` activates `--execution native`, iff `--execution` is not
given or no sub `--execution-*` is given.
2. It was probably a mistake to compile WASM in debug for a debug build.
So, we now build the WASM binary always as `release` (if not requested
differently by the user). So, we trade compilation time for a better
debug experience.

* Make sure we only overwrite default values

* Make it work

* Apply suggestion
2020-01-21 12:33:28 +01:00
Max Inden 05838b2c65 client/finality-grandpa/communication: Add doc comment for PeerReport (#4684) 2020-01-20 17:25:56 +01:00
Robert Habermeier 47e665be2e deprecate chain_status field of network handshake (#4675)
* deprecate chain_status field of network handshake

* Update client/network/src/protocol/message.rs

remove unneeded whitespace.

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-01-20 16:00:43 +01:00
Pierre Krieger 4e0ac574e2 Move DummySpecialization to sc-network (#4680) 2020-01-20 12:57:49 +01:00
Max Inden 5f80929dce client/finality-grandpa: Reintegrate gossip validator report stream (#4661)
* client/finality-grandpa: Reintegrate gossip validator report stream

The `finality-grandpa` `GossipValidator` is called by the `GossipEngine`
in a synchronous fashion on each gossip message. Its main task is to
decide whether to gossip the given message on, or whether to drop it.

In addition it also updates the reputation of a node's peers based on
the incoming gossip messages. To do so it needs to be able to report the
reputation change which it does through an unbounded channel (in order
to stay synchronous).

Previously the receiving side of this channel would be handled by a new
task, polling the channel and forwarding the changes to a clone of the
`GossipEngine` that it would own.

Instead the receiver of the above mentioned channel is now being polled
by the `NetworkBridge` within its `Future::poll` implementation.
Reputation changes are reported through the already existing
`GossipEngine` instance within `NetworkBridge`.

For details on the overall goal, see d9837d7dd.

* client/finality-grandpa: Remove exit future from test NetworkBridges
2020-01-17 18:28:32 +01:00
Nikolay Volf ba1d446b48 add missing bits (#4660) 2020-01-17 17:22:00 +03:00
André Silva 1470b55ec7 grandpa: bump finality-grandpa crate to v0.10.3 (#4659) 2020-01-17 14:06:29 +00:00
Max Inden d9837d7dda client/finality-grandpa: Reintegrate periodic neighbor packet worker (#4631)
The `NeighborPacketWorker` within `client/finality-grandpa` does two
things:

1. It receives neighbor packets from components within
`client/finality-grandpa`, sends them down to the `GossipEngine` in
order for neighboring nodes to receive.

2. It periodically sends out the most recent neighbor packet to the
`GossipEngine`.

In order to send out packets it had a clone to a `GossipEgine` within
an atomic reference counter and a mutex. The `NeighborPacketWorker` was
then spawned onto its own asynchronous task.

Instead of running in its own task, this patch reintegrates the
`NeighborPacketWorker` into the main `client/finality-grandpa` task not
requiring the `NeighborPacketWorker` to own a clone of the
`GossipEngine`.

The greater picture

This is a tiny change within a greater refactoring. The overall goal is
to **simplify** how finality-grandpa interacts with the network and to
**reduce** the amount of **unbounded channels** within the logic.

Why no unbounded channels: Bounding channels is needed for backpressure
and proper scheduling. With unbounded channels there is no way of
telling the producer side to slow down for the consumer side to catch
up.  Rephrased, there is no way for the scheduler to know when to favour
the consumer task over the producer task on a crowded channel and the
other way round for an empty channel.

Reducing the amount of shared ownership simplifies the logic and enables
one to use async-await syntax-suggar, given that one does not need to
hold a lock across poll invocations. Using async-await enables one to
use bounded channels without complex logic.
2020-01-17 13:58:25 +01:00
Nikolay Volf 26a53ac0a4 add debug logs (#4657) 2020-01-17 11:18:38 +01:00
Stanislav Tkach 482ca522cc Add typedefs for storage types (#4654)
* Add typedefs for storage types

* Fix after merge
2020-01-17 09:20:20 +01:00
Svyatoslav Nikolsky febf29390a Allow updating configuration of changes tries (#3201)
* DigestItem::ChangesTrieSignal

* introduce changes_trie::State

* introduce config activation block

* ChangesTrieSignal::as_new_configuration

* moved well_known_cache_keys to client

* extracted DbChangesTrieStorage to separate file

* change meaning of none in blockchain cache

* changes trie config (FULL) cache draft

* eliminating const ChangesTrieConfiguration

* delay pruning

* continue elimination

* do not prune CT config from cache

* removed redundant code

* fix some TODOs

* introduce ConfigurationRange

* use Configuration range in build

* build skewed digest

* remove debug print

* extracted surface iterator

* key_changes works with skewed digests

* fix client build

* add test for NeverPrune

* fix TODO

* fixed some TODOs

* more tests

* fixing TODOs

* fixed compilation

* update runtime version

* git rid of large tuple

* too long lines

* config_activation_block -> zero

* obsolete TODO

* removed unjustified expect

* update TODOs with issue number

* new CT pruning algorithm

fixed cache + multiple blocks finalization

track CT configuraiton on light clients

support CT configuration change revert

revert CT config test

new CT pruning algorithm

fixed cache + multiple blocks finalization

track CT configuraiton on light clients

support CT configuration change revert

revert CT config test

* BlockIdOrHeader isn't really required

* removed debug leftovers + some docs

* more docs

* more post-merge fixes

* more post-merge fixes

* revertes some unnecessary changes

* reverted unnecessary changes

* fix compilation + unnecessary changes

* (restart CI)

* fix cache update when finalizing multiple blocks

* fixed tests

* collect_extrinsics -> set_collect_extrinsics

* restore lost test

* do not calculate block number twice

* Update primitives/blockchain/src/error.rs

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

* map_err -> unwrap_or

* document get_at Result

* delete abandoned file

* added weight for set_changes_trie_config

* prefer_configs -> fail_if_disabled

* Update client/api/src/backend.rs

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

* Update client/db/src/changes_tries_storage.rs

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

* CommitOperation+merge -> CommitOperations

* fixed test compilation

* merged two different CTRange structs

* lost file

* uggrade db from v0 to v1 (init CT cache + add column)

* fix after merge

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
2020-01-16 17:38:24 +01:00
Pierre Krieger 45fbf09dac Make the sync_cycle_from_offline_to_syncing_to_offline test non flaky (#4644) 2020-01-16 15:41:26 +01:00
André Silva d18fbd7940 grandpa: generic voting rule for backing off from best block (#4635)
* grandpa: generic voting rule for backing off from best block

* grandpa: fix tests
2020-01-16 14:53:45 +01:00
Bastian Köcher afc3318f21 Implement runtime version checks in set_code (#4548)
* Implement runtime version checks in `set_code`

Check that the new runtime code given to `set_code` fullfills some
requirements:

- `spec_name` matches
- `spec_version` does not decreases
- `impl_version` does not decreases
- Either `spec_version` and `impl_version` increase

* Make tests almost work

* Some fixes after master merge

* Fix tests

* Add missed file

* Make depedency check happy?

* Remove leftover `sc-executor`

* AHHHHH

* Reset debug stuff

* Remove some 'static

* More 'static

* Some docs

* Update `Cargo.lock`
2020-01-16 13:58:37 +01:00
Tomasz Drwięga 437772be9e Rename basic-authority to basic-authorship (#4640)
* Rename basic-authority to basic-authorship

* Revert weird tab.

* Fix rename.
2020-01-16 13:57:41 +01:00
Cecile Tonglet 60feeb7ad6 Getting configuration from commands (#4643)
* Expose a method that allows converting RunCmd to Configuration

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP
2020-01-16 13:57:19 +01:00
Nikolay Volf 058e98ef34 use default in-memory for commands that don't use keystore (#4634) 2020-01-16 10:08:05 +01:00
Robert Habermeier c7069de044 Make Proposer instantiation potentially async. (#4630)
* Make Proposer instantiation potentially async.

* fix node-service test

* fix basic-authority doc-test

* only block once on futures in test

* use async/await
2020-01-15 21:09:27 +01:00
Robert Habermeier 69e0cf7fe2 reset a couple of versions down from v2.0 (#4572)
* reset a couple of versions down from v0.2.0

* Unstablise browser-utils (very new) and grafana-data-source (going to be replaced with prometheus sometime)

* unmark a bunch more client crates for stabilization

* fix versions in Cargo.tomls

* Downgrade network-test

* Set frame-metadata version to `10.0.0`

* Hide and documented storage generator as internal api

* Downgrade `sp-externalities`

* Downgrade `sc-cli`

* Downgrade sc-executor et al to 0.8.0

* Downgrade sp-state-machine to 0.8.0

* Downgrade pallet-contracts et al to 0.8.0

* Downgrade sp-sandbox to 0.8.0

* downgrade pallet-evm to 0.8.0

* Downgrade pallet-staking to 0.8.0

2.0 should be implementation of lazy payout alongside all the fixes of
current module

* Downgrade node-transaction-factory to 0.8.0

* frame pallets are 2.0.0

Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
Co-authored-by: Wei Tang <accounts@that.world>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Marcio Diaz <marcio@parity.io>
2020-01-15 18:35:27 +01:00
Pierre Krieger b2ad4de5c4 Add more logging to the network (#4621) 2020-01-15 11:48:46 +01:00
André Silva 270c2a8a0c network: add logging for extra requests (#4625)
* network: add logging for extra requests

* fixed tests compilation

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
2020-01-15 11:48:33 +01:00
Tomasz Drwięga e58fafc3ef Make offchain worker calls more future proof. (#4618)
* Add warning if offchain workers version is not supported.

* Support only v2.

* Make it a warning.
2020-01-14 22:35:35 +01:00
Svyatoslav Nikolsky afba48aeba fixed panic on empty remote read request (#4619) 2020-01-14 18:49:46 +03:00
Ashley 3219be2508 Update the service to std futures (#4447)
* Switch service to futures03

* Fix tests

* Fix service test and cli

* Re-add Executor trait to SpawnTaskHandle

* Fix node-service

* Update babe

* Fix browser node

* Update aura

* Revert back to tokio-executor to fix runtime panic

* Add todo item

* Fix service tests again

* Timeout test futures

* Fix tests

* nits

* Fix service test

* Remove zstd patch

* Re-add futures01 to aura and babe tests as a dev-dep

* Change failing test to tee

* Fix node

* Upgrade tokio

* fix society

* Start switching grandpa to stable futures

* Revert "Start switching grandpa to stable futures"

This reverts commit 9c1976346237637effc07c13f7d0403daf5e71cf.

* Fix utils

* Revert substrate service test

* Revert gitlab

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2020-01-14 15:43:45 +01:00
Bastian Köcher ee5e8050c3 Take genesis_storage by ref (#4617)
Instead of having these weird implementation of `BuildStorage for
&ChainSpec` we should just take the `genesis_storage` by ref. The
`BuildStorage` trait changed some time ago to take a self ref anyway,
instead of a self value.

Also fixes warnings in frame-staking
2020-01-14 11:18:56 +01:00
Benjamin Kampmann 5946d6f7a0 Allow node to add externalities extensions (#4583)
* allow extensions to be extensible from the outside
2020-01-13 12:07:54 +01:00
Nikolay Volf 426c157076 State-db I/o metrics (#4562)
* add usage mod to sp-state-machine

* State usage tracking finalized.

* fix spaces

* add license preamble

* imporove output

* review suggestions

* update naming

* merge fixes

* Update client/db/src/light.rs

Co-Authored-By: Gavin Wood <gavin@parity.io>

Co-authored-by: Gavin Wood <github@gavwood.com>
2020-01-13 09:10:39 +01:00
Arkadiy Paronyan 062d6e4425 Fixed state pinning in state-db (#4557)
* Account for references when pinning

* Fixed pinned state issues

* Fixes
2020-01-13 08:52:11 +01:00
André Silva f1ef0a1bae fork tree: rebalance fork tree by max fork depth (#4605)
* fork-tree: rebalance fork tree by maximum branch height

* fork-tree: add docs for tree rebalancing

* fork-tree: add test

* babe: rebalance epoch changes tree on deserialization

* fork-tree: fix doc

* fork-tree: fix test
2020-01-13 08:51:48 +01:00
Bastian Köcher e8dd1205ee Add test for cli keystore path generation (#4571)
* Add test for cli keystore path generation

* Fix test
2020-01-11 18:47:26 +01:00
Nikolay Volf e00ddc5614 avoid timer in light client (#4602) 2020-01-11 18:22:40 +01:00
Nikolay Volf 08e6df0faf Refactor some tests in tx-pool (#4603)
* add test setup

* tests with setup
2020-01-11 19:22:08 +03:00
Bastian Köcher fd6b29dd2c Remove requirement on Hash = H256, make Proposer return StorageChanges and Proof (#3860)
* Extend `Proposer` to optionally generate a proof of the proposal

* Something

* Refactor sr-api to not depend on client anymore

* Fix benches

* Apply suggestions from code review

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

* Apply suggestions from code review

* Introduce new `into_storage_changes` function

* Switch to runtime api for `execute_block` and don't require `H256`
anywhere in the code

* Put the `StorageChanges` into the `Proposal`

* Move the runtime api error to its own trait

* Adds `StorageTransactionCache` to the runtime api

This requires that we add `type NodeBlock = ` to the
`impl_runtime_apis!` macro to work around some bugs in rustc :(

* Remove `type NodeBlock` and switch to a "better" hack

* Start using the transaction cache from the runtime api

* Make it compile

* Move `InMemory` to its own file

* Make all tests work again

* Return block, storage_changes and proof from Blockbuilder::bake()

* Make sure that we use/set `storage_changes` when possible

* Add test

* Fix deadlock

* Remove accidentally added folders

* Introduce `RecordProof` as argument type to be more explicit

* Update client/src/client.rs

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

* Update primitives/state-machine/src/ext.rs

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

* Integrates review feedback

* Remove `unsafe` usage

* Update client/block-builder/src/lib.rs

Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org>

* Update client/src/call_executor.rs

* Bump versions

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-01-10 10:48:32 +01:00
Tomasz Drwięga 74d6e660c6 Add documentation to SubmitSignedTransaction and actually make it work (#4200)
* Add documentation to signed transactions and actually make them work.

* Fix naming and bounds.

* Forgotten import.

* Remove warning.

* Make accounts optional, fix logic.

* Split the method to avoid confusing type error message.

* Move executor tests to integration.

* Add submit transactions tests.

* Make `submit_transaction` tests compile

* Remove a file that was accidently committed

* Add can_sign helper function.

* Fix compilation.

* Add a key to keystore.

* Fix the tests.

* Remove env_logger.

* Fix sending multiple transactions.

* Remove commented code.

* Bring back criterion.

* Remove stray debug log.

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Make sure to initialize block correctly.

* Initialize block for offchain workers.

* Add test for transaction validity.

* Fix tests.

* Review suggestions.

* Remove redundant comment.

* Make sure to use correct block number of authoring.

* Change the runtime API.

* Support both versions.

* Bump spec version, fix RPC test.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-01-10 01:46:55 +01:00
Svyatoslav Nikolsky f372fa4d72 fix race in light_peer_imports_header_from_announce (#4579) 2020-01-09 23:28:04 +01:00
Pierre Krieger bc3d283e78 Clean-ups in the network-gossip crate (#4542)
* Remove usage of sc_network::Context trait

* Remove Context::send_consensus

* Pass &mut dyn Network instead of &dyn Network

* Move Validator traits and related to separate module
2020-01-09 19:24:51 +01:00
Pierre Krieger ca997cf1e4 Update networking code to libp2p 0.14 (#4383)
* Entirely update substrate-telemetry to futures 0.3

* Add a Closed error

* Update to libp2p 0.14

* More work

* More work

* More work

* More work

* Fix warnings

* Remove unwrap()

* Work on tests fixing

* Fix network tests

* Fix external network tests

* Update libp2p and restore Yamux in discovery test

* Ignore DNS if initializatio nfails

* Restore variables ordering

* Forgot browser-utils

* Fix downfall after merge

* Fix tests
2020-01-09 19:01:23 +01:00
Arkadiy Paronyan 6e572a9477 Prioritize new blocks over old forks when syncing (#4414)
* Prioritize new blocks over old forks when syncing

* Fixed some test cases
2020-01-09 19:00:57 +01:00
Cecile Tonglet cc573bc106 Wasm executor should provide stubs for unknown externs (wasmi) (#4550)
Related to #4456
2020-01-09 11:18:14 +01:00
Bastian Köcher 189bd2349c Keystore fix default path (#4570) 2020-01-08 15:19:14 +01:00
Weiliang Li 7a9b570ee5 txpool: unify client generic name (#4565) 2020-01-08 11:46:56 +01:00
André Silva 660c882cd3 grandpa: guarantee that vote limit is never lower than vote base (#4563) 2020-01-07 23:34:54 +01:00
Nikolay Volf df4058b556 i/o stats for backend databases (#4525) 2020-01-07 21:53:03 +03:00