Commit Graph

826 Commits

Author SHA1 Message Date
thiolliere cf7dbe8151 Staking module: approximate fraction into perbill to avoid overflow (#2889)
* approximate fraction into perbill

* test

* fix comment

* line width

* bump impl version

* rename test for better naming

* test overflow

* Apply suggestions from code review

Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
2019-06-24 13:23:54 +02:00
Pierre Krieger e919d03331 Add ProtocolBehaviour (#2922)
* Add ProtocolBehaviour

* Fix tests

* Line widths

* Address concerns

* Apply suggestions from code review

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

* Remove TODO
2019-06-24 13:22:03 +02:00
DemiMarie-parity 48aa32bece Relative slots (#2820)
* Initial work on relative slots for BABE

* More work

* Update core/consensus/babe/src/lib.rs

`Aura` → `Babe`

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

* More work on relative slots

* Add missing field in test-runtime

* Bump `impl_version` and `authoring_version`

* Fix compile errors and warnings

* Upgrade dependencies

* Update dependencies more

* Revert some updates to dependencies

Somehow, those broke the build

* Fix compilation errors

* `Duration` → `u128` in calculations

* `slot_duration` is in milleseconds, not seconds

* Median algorithm: ignore blocks with slot_num < sl

* Fix silly compile error

* Store a duration, rather than an instant

It is more useful

* Fix compilation errors

* `INVERSE_NANO` → `NANOS_PER_SEC`

Also: `1000_000_000` → `1_000_000_000`

Suggested-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* Un-bump `authoring_version`

* Disable median algorithm when `median_required_blocks` is 0

Otherwise it would panic.

* Apply suggestions from code review

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

* Simplify panic

* Fix build error

* Create `SignedDuration` struct

for signed `Duration` values.

Suggested-by: Bastian Köcher

* Refactor median algorithm into separate function

* Add issues for FIXMEs and respond to code review

* Fix minor warnings
2019-06-22 12:21:29 -04:00
Pierre Krieger 437a6bc6b1 Move the network status reporting to the service (#2916)
* Move the network status reporting to the service

* Fix tests

* Fix build
2019-06-21 17:13:11 -04:00
Pierre Krieger 01fcdc2b1a Add documentation at the root of substrate-network (#2902)
* Add documentation at the root of substrate-network

* Apply suggestions from code review

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Grmlblbl

* Adjustments

* Link to Yamux specs
2019-06-21 14:59:57 -04:00
Pierre Krieger f45cfb0d16 Use a background task instead of a thread for the import queue (#2909)
* Use a background task instead of a thread for the import queue

* Update Cargo.locks

* Comment
2019-06-21 09:46:26 -04:00
Pierre Krieger 32a14ba2b8 The network is no longer an Option (#2920) 2019-06-20 16:03:50 +01:00
Pierre Krieger c4877bc05b Remove on_connect from TelemetryConfig (#2888) 2019-06-19 15:41:35 +02:00
Pierre Krieger 80a4cd2b0d Add support for noise (#2613) 2019-06-19 15:36:58 +02:00
Svyatoslav Nikolsky 5030097799 Do not return empty entries from state_queryStorage (#2906)
* do not return empty entries from state_queryStorage

* revert back None -> null change

* Revert "revert back None -> null change"

This reverts commit 318eb043e03b7aabbc3f176e02c15fd4595d16db.
2019-06-19 15:31:14 +02:00
Bastian Köcher 37acb90847 Remove UserError and switch to error::Error (#2899)
* Remove `UserError` and switch to `error::Error`

* More cleanup

* Update core/executor/src/error.rs

Co-Authored-By: Sergei Pepyakin <s.pepyakin@gmail.com>

* Fix typo

* Update core/executor/src/allocator.rs

Co-Authored-By: Stanislav Tkach <stanislav.tkach@gmail.com>
2019-06-19 15:08:59 +02:00
Pierre Krieger 7efc504d59 Import queue API revamp (#2856)
* ImportQueue methods are now mut

* Link methods are now mut

* Remove Arc from BasicSyncQueue

* Fix tests

* Remove BasicSyncQueue

* Change the import queue API

* Add buffered_link

* Remove obsolete tests

* Comments and style improvement pass

* Fix grandpa and comment cleanup

* Update core/consensus/common/src/import_queue.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-06-18 21:50:48 -04:00
Pierre Krieger de6d541c74 Fix the failing networking tests (#2904) 2019-06-18 21:03:38 -04:00
Fredrik Harrysson 925a90f57f Add documentation to the main sync code (#2879)
* Added some documentation and question on the main sync code

* Remove strange formatting change

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Improve comment per suggestion

* Remove comment about re-using PeerInfo, no real reason and no real consensus if it's better or worse.

* Fix redundancy in comment

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Explaining more things and fixing review comments.

* Better explanation of MAJOR_SYNC_BLOCKS
* Explains the ancestor search strategy a bit
* Corrects explanation of what a stale block is
* Adds a bit of context for `request_ancestry` function

* Revert code change to not confuse the PR
2019-06-18 21:38:13 +01:00
Pierre Krieger 4a44a07fd0 Move libp2p tests to custom_proto (#2884) 2019-06-18 10:36:42 +02:00
Toralf Wittner dc41558b6e Change network::sync::extra_requests to not send. (#2890)
* Change network::sync::extra_requests to not send.

Instead it only maintains the invariants and leaves the actual I/O part
to the parent module (i.e. `sync`).

* Update Cargo.lock.
2019-06-18 10:35:28 +02:00
mattrutherford 7eb2ff760a Remove uses of Error::description() use Display instead (#2887)
* Remove all uses of Error::description() - use Display instead
2019-06-17 22:04:29 +01:00
Pierre Krieger f7bd56d2a8 Handle RPC requests in the substrate-service (#2866)
* Rework RPC queries

* Remove SyncProvider trait

* Fix RPC tests
2019-06-15 15:44:04 +02:00
Bastian Köcher e09045bde2 Fix several warnings and remove some forbid(warnings) (#2874) 2019-06-15 10:30:04 +02:00
Gavin Wood ecf25c9289 Disable validators but don't kick them (#2870)
* Disable validators but don't kick them

* Bump runtime

* Remove stray printlns
2019-06-15 10:29:34 +02:00
Niklas Adolfsson 549b4e9fb1 fix(compile warn): &mut Trait -> dyn &mut Trait (#2872) 2019-06-15 09:01:37 +02:00
Bastian Köcher db5722adc3 Make impl_opaque_keys more scope independent (#2873) 2019-06-15 07:41:46 +02:00
Stefanie Doll 2082e9468e fixed formatting (#2864) 2019-06-14 16:34:49 +02:00
Gavin Wood bda8641892 New sessions, kill consensus module (#2802)
* Draft of new sessions

* Reintroduce tuple impls

* Move staking module to new session API

* More work on staking and grandpa.

* Use iterator to avoid cloning and tuple macro

* Make runtime build again

* Polish the OpaqueKeys devex

* Move consensus logic into system & aura.

* Fix up system module

* Get build mostly going. Stuck at service.rs

* Building again

* Update srml/staking/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Refactoring out Consensus module, AuthorityIdOf, &c.

* Refactored out DigestItem::AuthoritiesChanged. Building.

* Remove tentative code

* Remove invalid comment

* Make Seal opaque and introduce nice methods for handling opaque items.

* Start to use proper digest for Aura authorities tracking.

* Fix up grandpa, remove system::Raw/Log

* Refactor Grandpa to use new logging infrastructure.

Also make authorityid/sessionkey static. Switch over to storing
authorities in a straight Vec.

* Building again

* Tidy up some AuthorityIds

* Expunge most of the rest of the AuthorityKey confusion.

Also, de-generify Babe and re-generify Aura.

* Remove cruft

* Untangle last of the `AuthorityId`s.

* Sort out finality_tracker

* Refactor median getting

* Apply suggestions from code review

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* Session tests works

* Update core/sr-primitives/src/generic/digest.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Session tests works

* Fix for staking from @dvc94ch

* log an error

* fix test runtime build

* Some test fixes

* Staking mock update to new session api.

* Fix build.

* Move OpaqueKeys to primitives.

* Use on_initialize instead of check_rotate_session.

* Update tests to new staking api.

* fixup mock

* Fix bond_extra_and_withdraw_unbonded_works.

* Fix bond_with_little_staked_value_bounded_by_slot_stake.

* Fix bond_with_no_staked_value.

* Fix change_controller_works.

* Fix less_than_needed_candidates_works.

* Fix multi_era_reward_should_work.

* Fix nominating_and_rewards_should_work.

* Fix nominators_also_get_slashed.

* Fix phragmen_large_scale_test.

* Fix phragmen_poc_works.

* Fix phragmen_score_should_be_accurate_on_large_stakes.

* Fix phragmen_should_not_overflow.

* Fix reward_destination_works.

* Fix rewards_should_work.

* Fix sessions_and_eras_should_work.

* Fix slot_stake_is_least_staked_validator.

* Fix too_many_unbond_calls_should_not_work.

* Fix wrong_vote_is_null.

* Fix runtime.

* Fix wasm runtime build.

* Update Cargo.lock

* Fix warnings.

* Fix grandpa tests.

* Fix test-runtime build.

* Fix template node build.

* Fix stuff.

* Update Cargo.lock to fix CI

* Re-add missing AuRa logs

Runtimes are required to know about every digest they receive ― they
panic otherwise.  This re-adds support for AuRa pre-runtime digests.

* Update core/consensus/babe/src/digest.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Kill log trait and all that jazz.

* Refactor staking tests.

* Fix ci runtime wasm check.

* Line length 120.

* Make tests build again

* Remove trailing commas in function declarations

The `extern_functions!` macro doesn’t like them, perhaps due to a bug in
rustc.

* Fix type error

* Fix compilation errors

* Fix a test

* Another couple of fixes

* Fix another test

* More test fixes

* Another test fix

* Bump runtime.

* Wrap long line

* Fix build, remove redundant code.

* Issue to track TODO

* Leave the benchmark code alone.

* Fix missing `std::time::{Instant, Duration}`

* Indentation

* Aura ConsensusLog as enum
2019-06-14 16:34:34 +02:00
cheme e777038418 Add storage cache for child trie and notification internals (#2639)
* child cache, and test failing notifications

* fix tests and no listen child on top wildcard

* remove useless method

* bump impl version

* Update core/client/src/notifications.rs

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

* Update core/client/src/notifications.rs

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

* Update core/client/src/notifications.rs

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

* Update core/client/src/notifications.rs

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

* factoring notification methods to remove some redundant code.

* test child sub removal

* HStorage implementation and some type alias.

* Remove HStorage cache: does not fit

* fix removal

* Make cache use byte length (shared) instead of number of kv

* Make use of hashes cache in rpc

* applying ratio on different lru caches

* Fix format

* break a line

* Remove per element overhead of lru cache.

* typo
2019-06-14 11:25:20 +02:00
Michael Müller 5c3d1f82cd Various minor fixes (#2860)
* Make sr-api-macros benchmark work again

It broke with 4f888f34d3.

* Give better indication of import progress

* Only send consensus info when explicitly enabled

This is only necessary for validators and they can
explicitly enable it via

	--telemetry-url 'wss://telemetry.polkadot.io 1'

(or some other endpoint)

* Remove unnecessary mutable

* Fix style
2019-06-13 18:23:04 +02:00
Pierre Krieger 12bbc2ffd9 Merge network-libp2p into network (#2843)
* Move network-libp2p into network

* Merge libp2p_service into service

* Don't expose RegisteredProtocol in the API

* Extract DiscoveryBehaviour from Behaviour

* Restore libp2p tests

* Add a test for discovery

* Line width

* Remove bandwidth check

* Fix gitlab
2019-06-13 18:21:31 +02:00
Gavin Wood f4afdd2f0b Subkey supports 24-word phrases (#2827)
* Revamp crypto API and make seeds work better in subkey

* Final tweaks

* Update tests

* line spacing

* Avoid escapes in hex constants

* Fix build

* Another fix

* More fixes

* Minor nits
2019-06-13 11:06:30 +02:00
Pierre Krieger 68f4d11df3 Move the telemetry information to service (#2846)
* Move the telemetry information to service

* Proper exit
2019-06-12 21:32:52 +02:00
Pierre Krieger ce302390dd Refactoring: Remove ExtraVerification in the import queue (#2844)
* Remove ExtraVerification in the import queue

* Fix Babe

* Fix node-template
2019-06-12 14:56:31 +02:00
Kian Peymani 3496f11404 Per-transaction weight for srml (#2799)
* debug checkpoint.

* new

* Worked.

* Worked and weight propagated to executive.

* Works with some tests.

* Cleanup debug prints.

* More cleanup.

* Undo more logs.

* Undo a few more.

* Fix build.

* Allow len to be used in weight calculation.

* Remove noop function from dispath.

* Cleanup.

* Unify traits.

* Update docs and nits.

* line width

* Update core/sr-primitives/src/weights.rs

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

* Update core/sr-primitives/src/weights.rs

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

* Update core/sr-primitives/src/weights.rs

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

* Update core/sr-primitives/src/weights.rs

Co-Authored-By: Amar Singh <asinghchrony@protonmail.com>

* Update srml/example/src/lib.rs

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

* Final cleanup.

* Fix build.
2019-06-12 14:38:30 +02:00
Tomasz Drwięga 6feab51069 Remove compilation warnings. (#2835)
* Remove compilation warnings.

* Allow unused only not in tests.

* Remove unnecessary mut.

* Make CI happy.

* Revert "Make CI happy."

This reverts commit abb865fe4b9fe9af1ae3ec801da9d4305ea35765.
2019-06-11 22:42:28 +02:00
Tomasz Drwięga ad2d958248 Make test-client generic over runtime (#2824)
* Make test-client generic over runtime.

* Make sure genesis storage is constructed correctly.

* Use prelude in tests.

* Add an example of how to use test-client with node/runtime.

* Bump version.

* Rename test-clients.
2019-06-11 21:54:34 +02:00
Lio李欧 66ae3a57ff Passthru build.sh/script.sh command line arguments (#2837) 2019-06-11 16:00:27 +02:00
Robert Habermeier 67138b3103 polite-grandpa: Ensure only votes from a set's voters are propagated (#2720)
* make authorities available to gossip

* make local view optional until set

* address grumbles

* micro-optimize: encode without lock held
2019-06-09 11:38:41 +02:00
Pierre Krieger ac895023be More crate compiling for WASM-browser (#2825)
* More crate compiling for WASM-browser

* Update runtime Cargo.lock
2019-06-07 16:06:15 +02:00
Pierre Krieger 4d3396d095 Move modules around in network (#2822)
* Rename modules in protocol

* Line widths
2019-06-07 15:30:45 +02:00
DemiMarie-parity 418d4a0ce0 Add digest subtypes and update dependencies (#2734)
* Add different digest types for different parts of the code

* Add script to update dependencies

* Remove an old changelog

* `Inherent` → `PreRuntime`
2019-06-06 22:16:59 +02:00
Pierre Krieger 57afa9b440 Rewrite telemetry using libp2p (#2812)
* Rewrite telemetry using libp2p

* Update the Cargo.lock files

* Apply suggestion
2019-06-06 22:15:38 +02:00
Pierre Krieger 6130ff3f46 Don't pass the Endpoint as message (#2814) 2019-06-06 22:12:55 +02:00
Pierre Krieger f210557211 Require --locked when building runtime (#2813)
* Require --locked when building runtime

* Update locks

* Do it in a different way

* Accidentally reverted Cargo.lock

* pass on arguments in build.sh scripts
2019-06-06 15:53:22 +02:00
Pierre Krieger e18dc6d53c Update to libp2p 0.9.1 (#2804) 2019-06-06 11:50:22 +02:00
Gavin Wood b8c9558419 Fix subkey (#2798)
* Fix ed25519 crypto

* Add test

* Remove unneeded import

* Remove unneeded type

* Remove unneeded clutter
2019-06-05 19:08:28 +02:00
Svyatoslav Nikolsky fc7548ce27 Light client integration tests (#2638)
* add light nodes to test_sync && test_consensus

* forbid light2light connections

* add light nodes to test_connectivity

* fixed light2light connection penalty

* post-merge fixes

* remove best_queued from Client info
2019-06-05 17:14:42 +02:00
Pierre Krieger 67bdfc7d8e Small slots refactor (#2780)
* Deprecate SlotWorker::on_start

* start_slot_worker no longer needs an Arc

* start_slot_worker now always succeeds

* Removed on_exit parameter from start_*_worker

* Minor doc

* Fix node-template
2019-06-05 10:31:20 -04:00
Benjamin Kampmann eaa0ab014a Move import lock onto backend (#2797)
* Drop import_lock from client, move it into backend, impl default version via static mutex

* still need to allow depcretion because of client.backend

* additional docs

* Remove default impl of get_import_lock, impl on instances

* Bump parking_lot to 0.8.0 accross the board
2019-06-05 15:46:01 +02:00
Bastian Köcher 4f888f34d3 Build LongestChain with TestClientBuilder (#2792)
* Switch to `TestClientBuilder` and support generating LongestChain

* Make sure test-client works without the wasm blob

* Use `TestClientBuilder` in more places
2019-06-05 13:45:18 +02:00
Gavin Wood 22a00a3353 Sensible scheduling for referenda (#2753)
* Nonlinear locking and cleanups

* Bump runtime version

* Minor cleanup

* Fix tests

* Fix council tests

* Fix flaw in turnout counting

* Initial work on referendum schedules

* Refactor council-democracy interface.

* Fix build

* Update srml/democracy/src/lib.rs

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

* Update srml/democracy/src/lib.rs

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

* Tests compile again

* Tests!

* Update todo

* Fix build

* Ensure votes arer not double-counted on member-transitions

* Extra logic for normal council changes

* Typo

* A few grumbles addressed.
2019-06-05 12:36:28 +02:00
Pierre Krieger 89b312fe9c Revert #2745 (#2791)
* Revert #2745

* Fix error in merge resolve

* Fix compilation
2019-06-05 11:56:36 +02:00
Svyatoslav Nikolsky 012ce5878b Restore integration tests (#2620)
* restored test_consensus

* restored test_sync

* run integration tests only on CI

* use single test-thread for integration tests

* post-merge fix

* panic when integration test runs for too long

* add some traces to integration logs

* manual wait -> timeout

* post-merge fix

* post-merge fix
2019-06-05 09:16:14 +02:00