Commit Graph

2493 Commits

Author SHA1 Message Date
Tomasz Drwięga 90df6b3c6c Move offchain worker http helpers to sr-primitives. (#3733)
* Move offchain helpers to sr-primitives.

* Add some docs and fix tests.

* Refresh cargo.lock

* Bump runtime.

* Don't run offchain http example.
2019-10-02 10:03:18 +02:00
Alexandre R. Baldé 3907582457 Remove unused imports (#3737) 2019-10-02 00:10:37 +02:00
thiolliere 53e0ddee4e Use EncodeLike for storages traits (#3676)
* impl

* patch

* lock

* some refactor

* some avoided copy

* new api without ref for doublemap

* fix

* version bump

* fix

* point to incoming release

* use codec latest

* bumpd impl version

* fix unused

* fix

* Update srml/support/src/storage/mod.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-01 19:45:24 +02:00
André Silva 83d4764d46 grandpa: add identifier to UntilImported logging message (#3735)
* grandpa: add identifier to UntilImported logging

* grandpa: fix tests
2019-10-01 11:42:11 -04:00
Bastian Köcher 2f50ef55d3 Let construct_runtime! generate ALL_MODULES as nested tuples (#3732)
So, instead of:
`type ALL_MODULES = (Module1, Module2, Module3)`;
Generate it like this:
`type ALL_MODULES = ((Module1, Module2), Module3,);`

This should make `construct_runtime!` support an "unlimited" number of
modules.
2019-10-01 17:00:22 +02:00
Max Inden a7b1284fb7 srml/authority-discovery: Abstract session key type (#3698)
* srml/authority-discovery: Abstract session key type

Previously `srml/authority-discovery` dependet on the `srml/im-online`
session key type directly. With this patch `srml/authority-discovery` is
generic over the session key type it is going to use, as long as it
implements the RuntimeAppPublic trait.

With this patch one can use the `srml/authority-discovery` module
without the `srml/im-online` module.

Next to the above, this patch configures `node/runtime` to use the babe
session keys for the authority discovery module.

* srml/authority-discovery: Fix line length

* srml/authority-discovery/Cargo: Move babe to dev-dependencies

* node/runtime: Bump implementation version

* srml/authority-discovery: Add doc comment for authority discovery Trait
2019-10-01 11:28:19 +01:00
Svyatoslav Nikolsky 387c31598d Prepare for asynchronous transaction validation in tx pool (#3650)
* async txpool API

* Update core/rpc/src/author/mod.rs

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

* Update core/transaction-pool/graph/src/pool.rs

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

* Pool -> Pool + ValidatedPool

* removed lost block_on when importing xt from network

* fix grumbles

* alias for future::Executor in rpc

* removed executor from Author RPCs

* Pool + SharedValidatedPool -> Pool

* fix compilation after merge

* another fix

* another fix
2019-10-01 12:14:25 +03:00
André Silva facf31f77e srml: system: add kill_prefix (#3729)
* srml: system: add kill_prefix

* node: bump spec_version
2019-10-01 08:44:33 +02:00
Ashley c545344c60 Add an Error type to Aura (#3688)
* Add an Error type to Aura

* Add Cargo.lock

* AuRa -> Aura

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-10-01 12:42:11 +08:00
André Silva 656a3d3303 srml: im-online: fix received heartbeats pruning (#3724)
* srml: im-online: fix pruning of received heartbeats

* srml: im-online: add test for received heartbeats pruning

* srml: im-online: remove unused variables from test

* node: bump spec_version
2019-09-30 18:03:40 +02:00
Bastian Köcher f6c4c47b50 Give more information why conversion between native and runtime failed (#3720)
* Give more information why conversion between native and runtime failed

This adds the SCALE error description to the error when the conversion
between native and runtime failed.

* Fixes tests
2019-09-30 18:03:13 +02:00
Pierre Krieger 98879a2bdb Revert "core/sr-api-macros/Cargo.toml: Pin protobuf version (#3723)" (#3726)
This reverts commit 2b85a48c71.
2019-09-30 18:02:54 +02:00
Max Inden 2b85a48c71 core/sr-api-macros/Cargo.toml: Pin protobuf version (#3723)
* Cargo.toml: Pin protobuf version

The protobuf crate introduced a breaking change within its semver minor
update from 2.8.1 to 2.9.0. This commit ensures Substrate uses anything
within the 2.8 minor releases.

* Cargo.lock: Update

* core/sr-api-macros/Cargo.toml: Pin protobuf version

The protobuf crate introduced a breaking change within its semver minor
update from 2.8.1 to 2.9.0. This commit ensures Substrate uses anything
within the 2.8 minor releases.

* Revert "Cargo.toml: Pin protobuf version"

This reverts commit 4e293c741c5c4510cb1a347c444d1876d65ddb1e.

* core/sr-api-macros/Cargo.toml: Pin protobuf within dev-dependencies

* core/sr-api-macros/Cargo.toml: Add comment and link to Githu issue
2019-09-30 16:51:28 +02:00
Xiliang Chen d4650c4739 refactor contracts to use Time trait (#3717)
* refactor contracts to use Time trait

* bump version
2019-09-28 19:07:21 +02:00
Tomasz Drwięga 667ee95f5d ChainSpec extensions (#3692)
* Add some chainspec tests and make sure we validate it.

* Manual implementation of Extension + Forks definitions.

* Move chain spec to separate crate.

* Allow using ChainSpec with extensions.

* Renames.

* Implement Extension derive.

* Implement Extension for Forks.

* Support specifying fork blocks.

* make for_blocks work

* Support forks correctly.

* Add a bunch of docs.

* Make fork blocks optional.

* Add missing docs.

* Fix build.

* Use struct for check_block params.

* Fix tests?

* Clean up.
2019-09-29 01:05:36 +08:00
André Silva c555b9bf88 peerset: fix reserved nodes (#3706)
* peerset: fix handling of reserved only peering mode

* core: add cli parameter to enable reserved nodes only

* peerset: fix tests

* peerset: add test for priority only mode

* core: fix reserved only cli flag description

* peerset: extend docs on set_priority_only
2019-09-29 01:04:46 +08:00
Arkadiy Paronyan 3242d7f2b6 Explicit sync API for downloading important, possibly orphaned, forks (#3633)
* Explicit sync API

* Keep sync requests

* Don't request the finalized block we already have

* Dropping requests & docs

* Renamed a function
2019-09-28 14:02:36 +02:00
Talha Cross 5d82f453e8 docs: add security policy (#3713) 2019-09-28 19:14:49 +08:00
Sergei Pepyakin 85431e9adf Add a comment on the features. (#3714) 2019-09-28 19:14:28 +08:00
André Silva 26889679f3 cli: clean up flag descriptions (#3715) 2019-09-28 19:14:08 +08:00
thiolliere 75ed6cc04e Refactor srml-support/storage (#3702)
* refactor

* fix

* remove unused vec storages

* address comment
2019-09-27 14:39:14 +02:00
Bastian Köcher ff75e498d4 Support trailing commas in decl_module (#3712) 2019-09-27 12:08:11 +02:00
Coenen Benjamin 53a43e92aa create some vectors with initial capacities (#3701)
Signed-off-by: Benjamin Coenen <benjamin.coenen@hotmail.com>
2019-09-27 11:46:53 +02:00
Alexey 62be947877 Enable runtime_api for Substrate service (#3709)
* added new_full_concrete for service

* line width fix

* Update node/cli/src/service.rs

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

* Update node/cli/src/service.rs

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

* Update node/cli/src/service.rs

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

* replaced new_full

* empty

* added backticks to pass ci
2019-09-27 11:43:25 +02:00
Wei Tang 3864d0e4da Update libsecp256k1 dep to 0.3.0 (#3711)
* Update libsecp256k1 dep to 0.3.0

* Bump impl_version
2019-09-27 09:48:29 +02:00
Bastian Köcher ba98168b71 Make TestOffchainExt panic on unknown requests (#3710)
* Make `TestOffchainExt` panic on unknown requests

* Fix test
2019-09-26 23:02:30 +02:00
Caio 0da34de380 Pointer does not implement Display (#3707)
Instead, use `Debug` for `debug_trace!`
2019-09-26 22:21:12 +02:00
André Silva 0330f3bac6 grandpa: send authority id to telemetry when starting new voter (#3705) 2019-09-26 19:23:01 +02:00
thiolliere 55e5b21478 Improve storage doc (#3691)
* doc

* fix

* Apply suggestions from code review

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* complete suggestion
2019-09-26 11:44:52 +02:00
Ashley a2c553a0d9 Random seed API for offchain workers (#3694)
* Add random_seed impl for offchain api

* switch to rand::random
2019-09-26 09:36:58 +02:00
thiolliere 66b0e00651 Fix linkedmap instance head of (#3690) 2019-09-25 22:38:29 +02:00
Kian Paimani f277c4884a Fix Phragmen equalize loop. (#3693)
* Fix phragmen loop

* Bump.
2019-09-25 16:43:11 +02:00
Kian Paimani 1c15ca6ad1 Refactor: fixed point arithmetic for SRML. (#3456)
* Macro-ify perthings.

* Refactor fixed64

* Half-workign phragmen refactor.

* Finalize phragmen refactor.

* Fix creation of perquintill

* Fix build errors

* Line-width

* Fix more build errors.

* Line-width

* Fix offence test

* Resolve all TODOs.

* Apply suggestions from code review

Co-Authored-By: Gavin Wood <gavin@parity.io>
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Fix most of the review comments.

* Updates to multiply by rational

* Fxi build

* Fix abs issue with Fixed64

* Fix tests and improvements.

* Fix build

* Remove more tests from staking.

* Review comments.

* Add fuzzing stuff.

* Better fuzzing

* Better doc.

* Bump.

* Master.into()

* A bit more hardening.

* Final nits.

* Update lock

* Fix indent.

* Revert lock file.

* Bump.
2019-09-25 11:21:05 +02:00
Kian Paimani 87688aadaa Document how to get head of linked map. (#3679)
* Document how to get head of linked map.

* Update srml/support/procedural/src/lib.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/procedural/src/lib.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
2019-09-25 09:36:24 +02:00
Toralf Wittner 3dd5a508b4 Remove debug_assert!ion. (#3678) 2019-09-25 09:35:45 +02:00
Ashley a6329f8779 Change decl_storage! to forbid default value for Option types (#3682)
* Forbid default values for Option types in decl_storage!

* fix test errors

* bump impl_version
2019-09-25 09:34:31 +02:00
André Silva 1bf44278d3 node: update flaming fir (#3681)
* node: reduce grandpa justification period to 512 blocks

* node: update flaming fir chainspec
2019-09-24 19:47:06 +02:00
thiolliere 1835c3f9a1 Fix head not hashed (#3680)
* fix head not hashed

* bump version
2019-09-24 17:46:41 +02:00
Toralf Wittner 7611c08679 Fix invalid debug assertion. (#3663)
The current `debug_assert_eq` is clearly wrong as the code handles zero
response blocks. What should have been expressed is that we expect 0 or
1 response blocks.
2019-09-24 13:53:16 +02:00
Toralf Wittner af0d71d389 Add block announce validator. (#3346)
* Add `BlockAnnounceValidator` trait.

* Add associated data to block announcement.

* Make tests compile.

* Move validator into `sync.rs`.

* Smaller changes.

* Update core/network/src/protocol.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update core/network/src/protocol.rs

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

* Update core/network/src/test/sync.rs

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

* Formatting.

* Remove assoc. data from `BlockImportNotification`.

* Use `Option<Vec<u8>>` for associated data.

* Update core/network/src/protocol/sync.rs

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

* Fix type error.
2019-09-24 10:48:21 +02:00
Robert Habermeier 4888c253a3 fix #2177: port GRANDPA node-side code to use Consensus digests (#3669)
* fix #2177: port GRANDPA node-side code to use Consensus digests

* bump runtime version

* fix service compilation

* document change precedence rules
2019-09-24 10:45:44 +02:00
Ashley 5c39f588be Change decl_storage! to import the storage traits automatically (#3674)
* decl_storage imports needed traits

* bump impl_version

* Update srml/system/src/lib.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update srml/system/src/lib.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-09-24 10:05:15 +02:00
Ashley a7cd458544 Move best_containing from Client to blockchain::Backend (#3655)
* Move best_containing from Client to Backend

* Add comma for clearer diffs

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-09-24 07:31:06 +02:00
Ashley 1baee72d75 use pdqselect for median_algorithm selection (#3636)
* use pdqselect for median_algorithm selection instead of sorting the whole vec

* Make use of pqdselect clearer

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

* Make use of pqdselect clearer

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-09-23 22:37:53 +02:00
Michael Müller 2d6e617309 Send local GRANDPA authority id to telemetry (#3646)
* Fix indentation

There is a space between the tabs.

* Send local GRANDPA authority id to telemetry

* Update core/finality-grandpa/src/lib.rs

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

* Generalize authority_id()

* Shorten code

* Do not send unfinalized authority sets to telemetry

`update_authority_set()` is called from, among others,
import side. These updates only track a pending change
and may or may not happen, hence it's wrong to send
this set to telemetry (which would assume that this is
the current, finalized authority set).

* Send current authority set and local authority id on set change
2019-09-23 17:48:09 +02:00
Jim Posen 82e7f9e423 Decouple node-executor structures from wasmi (#3610)
* executor: Support non-Wasmi sandbox supervisor environments.

* node-executor: Tests don't reference WasmExecutor directly.

* executor: Simplify encoding of heap metadata.

* executor: Decouple allocator from wasmi::MemoryRef.
2019-09-23 17:38:51 +02:00
Robert Habermeier c200ce757b Fixing BABE epochs to change between blocks (#3583)
* always fetch epoch from runtime

* node integration tests don't test light nodes

* give stand-in full node a FULL role

* rejig babe APIs

* introduce next-epoch-descriptor type

* overhaul srml-BABE epoch logic

* ensure VRF outputs end up in the right epoch-randomness

* rewrite `do_initialize` to remove unnecessary loop

* begin accounting for next epoch in epoch function

* slots passes header to epoch_data

* pass slot_number to SlotWorker::epoch_data

* begin extracting epoch-change logic into its own module

* aux methods for block weight

* aux methods for genesis configuration

* comment-out most, refactor header-check pipeline

* mostly flesh out verifier again

* reinstantiate babe BlockImport implementation

* reinstate import-queue instantiation

* reintroduce slot-worker implementation

* reinstate pretty much all the rest

* move fork-choice logic to BlockImport

* fix some, but not all errors

* patch test-runtime

* make is_descendent of slightly more generic

* get skeleton compiling when passing is_descendent_of

* make descendent-of-builder more succinct

* restore ordering of authority_index / slot_number

* start fiddling with tests

* fix warnings

* improve initialization architecture and handle genesis

* tests use correct block-import

* fix BABE tests

* fix some compiler errors

* fix node-cli compilation

* all crates compile

* bump runtime versions and fix some warnings

* tweak fork-tree search implementation

* do backtracking search in fork-tree

* node-cli integration tests now work

* fix broken assumption in test_connectivity

* babe tests fail for the right reasons.

* test genesis epoch logic for epoch_changes

* test that epochs can change between blocks

* First BABE SRML test

* Testing infrastructure for BABE

Also includes a trivial additional test.

* Apply suggestions from code review

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

* A little more test progress

* More work on BABE testing

* Try to get the tests working

* Implement `UintAuthorityId`-based test mocks

* Fix compilation errors

* Adjust to upstream changes

* Block numbers are ignored in BABE epoch calculation

* authority_index() should ignore invalid authorities

* Fix compile error

* Add tests that session transitions happen

* Check if BABE produces logs

It currently does not.

* Fix test suite

This was really nasty, due to a type confusion that showed up as an
off-by-1 buffer error.

* Add additional tests

Most of these were derived from the current output, so they are only
useful to guard against regressions.

* Make the tests more readable

Also bump impl_version.

* Fix excessive line width

* Remove unused imports

* Update srml/babe/src/lib.rs

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

* try to fix imports

* Fix build errors in test suite

* tests did not pass

* Try to get at least one digest to be output

Currently, the code emits either no digests (if I don’t call
`Session::rotate_session()` or two digests (if I do), which is wrong.

* More tests

They still don’t work, but this should help debugging.

* fix silly error

* Don’t even try to compile a broken test

* remove broken check_epoch test and add one for genesis epoch

* Check that the length of the pre-digests is correct

* Bump `impl_version`

* use epoch_for_descendent_of even for genesis

* account for competing block 1s

* finish srml-babe docs

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

* address grumbles
2019-09-23 16:03:05 +02:00
thiolliere e6d4a76521 Refactor reward curve (#3668)
* move test in tests dir

* comment

* refactor
2019-09-23 14:11:24 +02:00
Ashley 0a469666c1 Rename more things related to contract instantiation (#3664)
* Rename more things related to contract instantiation

* rename `creator_ch`

* Fix node runtime

* fix contracts tests

* Little fix
2019-09-23 11:32:44 +02:00
Robert Habermeier e0b3564f2d improve justification docs 2019-09-23 10:28:24 +02:00