Commit Graph

2099 Commits

Author SHA1 Message Date
Bastian Köcher f7ff339ebd Expose instancing in metadata (#3188)
* Expose instancing in metadata

- Introduces metadata v7
- If a module is using instancing, the storage exposes the instance in
metadata
- Metadata module name is now the upper case one given to
`construct_runtime!`

* Remove obsolete macro

* Just expose one prefix

* Bump spec

* Fix prefix generation
2019-07-24 21:40:34 +02:00
thiolliere 2b6f664caf Staking rate targeting and specific rewards. (#2882)
* PNPoS implementation

* wip: change staking api

* code readibility

* fix overflow

* comment

* license

* doc

* reorganize a bit

* rename to proper english + doc

* address comments

* refactor unused mock

* fix add_point

* update tests

* add not equalize to ci

* Revert "add not equalize to ci"

This reverts commit 1c61c25874b04b1cdfadd7d353b75a189a59ad35.

* bring test back

* update locks

* fix genesis config

* add authorship event handler + test

* uncouple timestamp from staking

* use on finalize instead

* remove todo

* simplify mock

* address comment

* doc

* merge test

* fmt

* remove todo todo

* move add_reward_point to regular function

* doc

* doc

* increase version

* doc and fmt

* Update srml/staking/src/inflation.rs

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

* Fix some doc typos
2019-07-25 01:25:43 +08:00
Bastian Köcher 1c346d2190 Make function get of parameter types public (#3191)
I missed this while making parameter types more flexible.
2019-07-24 18:32:44 +02:00
Roman Borschel 343f4a2a50 libp2p-next (#3076)
* Changes for the next libp2p release:

  * Updates to the Kademlia APIs.
  * Updated imports due to the extracted libp2p-swarm crate.
  * ...

Still pending at least the following:

  * rust-libp2p/#1189
  * rust-libp2p/#1191
  * rust-libp2p/#1194

* Use Quorum::One.

The previous choice was apparently arbitrary.

* Use libp2p-0.11 from crates.io. Address feedback.

* Correct imports after merge.
2019-07-24 17:32:25 +02:00
Bastian Köcher 5d58d583e3 Switch srml-session keys to decl_storage! (#3184)
* Switch `srml-session` keys to `decl_storage!`

* Expose `DEDUP_KEY_PREFIX` in constants

* Fix test

* Bump spec version
2019-07-24 16:40:04 +08:00
Pierre Krieger c8dab27f35 Report to the PSM when a severe protocol error happens (#3161) 2019-07-24 00:43:50 -04:00
Pierre Krieger 8aaf0808dd Fix mDNS not working (#3181)
* Fix mDNS not working

* Fix WASM build
2019-07-23 14:03:21 +02:00
Bastian Köcher 6e4066b62d Bkchr check all benches (#3180)
* Make sure CI checks all benchmarks

* Fix babe
2019-07-23 13:57:32 +02:00
Bastian Köcher a0bb34a584 Fix test-runtime build (#3176)
* Fix test-runtime build

* Fix build
2019-07-23 12:10:00 +02:00
Gautam Dhameja 5caeee13d0 sleep_until off-chain API (#3164)
* sleep_until Offchain API

* addressed review comments
2019-07-23 10:59:37 +02:00
Tomasz Drwięga be9e97afb2 Run each offchain worker in a separate thread. (#3169)
* Run each offchain worker in a separate thread.

* Start a thread only on supported targets.

* Flip conditions.

* Remove platform-specific code.
2019-07-23 10:59:01 +02:00
Bastian Köcher af40c36873 Export VOTER_SET_SIZE and APPROVAL_SET_SIZE in srml elections (#3173)
* Export `VOTER_SET_SIZE` and `APPROVAL_SET_SIZE` in srml elections

* Fix compilation
2019-07-23 10:51:00 +02:00
DemiMarie-parity f78a780790 BABE Epochs (#3028)
* Add `epoch` field to `SlotInfo`

* Add slot calculations

* More work on epochs in BABE

* Apply suggestions from code review

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

* Typo: `/` not `%` for division

* Delete useless `LastSlotInEpoch::put(false)`

* Bump `spec_version`

* Make test suite pass again

* Implement BABE epoch randomness signing

* Try to fix compilation

Currently causes a stack overflow in the compiler

* Fix rustc stack overflow

* Add missing `PartialEq` and `Eq` implementations

* Fix compile errors in test suite

* Another silly compile error

* Clone `epoch`

* Fix compile error in benchmarks

* Implement `clone` for `Epoch`

* Merge master

* AUTHORING TEST PASSES!!!

* Fix compilation

* Bump `spec_version`

* Fix compilation

* Fix compilation (again)

* Remove an outdated FIXME

* Fix run.sh and move it to scripts/

* Delete commented-out code

* Fix documentation

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

* Fix BABE initialization and refactor

* Respond to review

* typo

* Remove useless data in `CheckedHeader::Deferred`

* Remove `slot_number` from Epoch

It is not needed, and only served to waste space and cause confusion.

* Remove epoch from BABE digests

* Move digest.rs to primitives

* Fix incorrect warning names

* Fix compile error

* Consistent field naming for BABE digests

* More compiler error fixex

* Unbound variable

* more compile errors

* another compile error

* Fix compile errors in runtime

* another compile error

* Another compile error

* Fix wasm build

* missing import

* Fix more compile errors

* yet another compile error

* compile fix in test runtime

* Fix and simplify the BABE runtime

The BABE runtime was massively overcomplicated and also wrong.  It
assumed it needed to:

1. delay new authorities taking effect until the next epoch
2. not delay emitting `Consensus` digests to mark epoch changes

However, the first is handled by the `srml_session` crate, and the
second is flat-out incorrect: `Consensus` digests take effect
immediately.  Furthermore, `srml_babe` tried to duplicate the
functionality of `srml_session::PeriodicSession`, but did it both
clumsily and incorrectly.  Fortunately, the new code is simpler and far
more likely to be correct.

* Use `system` to get the test authorities

The genesis block used by tests defines no authorities.  Only the test
suite is affected.

* Fix test runtime impl for BabeApi::epoch() with std

* Fix compilation

* Cached authorities are in the form of an epoch

not a `Vec<AuthorityId>`.

* `slots_per_epoch` is not fixed in general

The BABE code previously assumed `slots_per_epoch` to be a constant,
but that assumption is false in general.  Furthermore, removing this
assumption also allows a lot of code to go away.

* fix compile error

* Implement epoch checker

* Fix runtime compilation

* fork-tree: add method for finding a node in the tree

* babe: register epoch transitions in fork tree and validate them

* fork-tree: add method for arbitrary pruning

* Expose the queued validator set to SRML modules

BABE needs to know not only what the current validator set is, but also
what the next validator set will be.  Expose this to clients of the
session module.

* Bump hex-literal

Hopefully this will fix the panic

* babe: prune epoch change fork tree on finality

* babe: validate epoch index on transition

* babe: persist epoch changes tree

* Fix compile error in tests

* Fix compile error in tests

* Another compile error in tests

* Fix compilation of tests

* core: move grandpa::is_descendent_of to client utils

* babe: use is_descendent_of from client utils

* babe: extract slot_number from pre_digest in import_block

* Move BABE testsuite to its own file

* Initial part of test code

* Missing `WeightMultiplierUpdate` in test-runtime

* bump `spec_version`

* Add a test that a very bogus is rejected

* Run the tests again

* Fix compiler diagnostics

* Bump `spec_version`

* Initial infrastructure for mutation testing

* Mutation testing of block import

* babe: revert epoch changes in case of block import error

* babe: fix logging target

* babe: BabeBlockImport doesn't box inner BlockImport

* babe: fix epoch check in block import

* babe: populate authorities cache on block authorship

* babe: remove unused functions

* babe: use RANDOMNESS_LENGTH const

* babe: remove unneeded config parameters

* core: revert change to hex dependency version

* cleanup gitignore

* babe: add docs to aux_schema

* babe: remove useless drops in tests

* babe: remove annoying macos smart quotes

* fork-tree: docs

* fork-tree: add tests

* babe: style

* babe: rename randomness config variable

* babe: remove randomness helper function

* babe: style fixes

* babe: add docs

* babe: fix tests

* node: bump spec_version

* babe: fix tests
2019-07-23 10:36:16 +02:00
Gavin Wood 78bc5edc14 Extensible transactions (and tips) (#3102)
* Make extrinsics extensible.

Also Remove old extrinsic types.

* Rest of mockup. Add tips.

* Fix some build issues

* Runtiem builds :)

* Substrate builds.

* Fix a doc test

* Compact encoding

* Extract out the era logic into an extension

* Weight Check signed extension. (#3115)

* Weight signed extension.

* Revert a bit + test for check era.

* Update Cargo.toml

* Update node/cli/src/factory_impl.rs

* Update node/executor/src/lib.rs

* Update node/executor/src/lib.rs

* Don't use len for weight - use data.

* Operational Transaction; second attempt (#3138)

* working poc added.

* some fixes.

* Update doc.

* Fix all tests + final logic.

* more refactoring.

* nits.

* System block limit in bytes.

* Silent the storage macro warnings.

* More logic more tests.

* Fix import.

* Refactor names.

* Fix build.

* Update srml/balances/src/lib.rs

* Final refactor.

* Bump transaction version

* Fix weight mult test.

* Fix more tests and improve doc.

* Bump.

* Make some tests work again.

* Fix subkey.

* Remove todos + bump.

* Ignore expensive test.

* Bump.
2019-07-22 19:06:49 +02:00
Bastian Köcher 4f5654b67d Document decl_storage! hashers (#3170) 2019-07-22 19:00:20 +02:00
Pierre Krieger 2e70087810 Alphabetical crates order (#3163) 2019-07-22 15:05:26 +01:00
Pierre Krieger e83d6c6f04 Add a warning if network is too slow (#3160) 2019-07-22 15:00:45 +01:00
thiolliere 08d1933105 fix doc (#3162) 2019-07-22 14:01:13 +02:00
Gautam Dhameja 4b7c9929ee Timestamp off-chain API (#3144)
* timestamp offchain api impl

* Addressed review comments

* fixed expect message

* fixed compile error

* fixed line width
2019-07-22 13:32:24 +02:00
David Craven a3d19baea3 Refactors the offchain worker api (#3150)
* Update offchain primitives.

* Update offchain worker.

* Update im-online.

* Update service.

* Update node and node-template.

* Update runtime version.

* Fix build.

* Fix offchain worker tests.

* Generalize authority_pubkey.

* Add test.

* Update lib.rs
2019-07-22 17:20:57 +08:00
Pierre Krieger 2edeef5825 ImportBlock -> BlockImportParams (#3158) 2019-07-21 18:43:02 -04:00
Amar Singh 4bbfaa9c8f docs: add srml readme, clarify comment in staking (#3151)
* add srml readme, nit on staking/lib.rs

* increase impl version, not spec version

* change back impl
2019-07-21 15:22:11 +02:00
Gavin Wood a7a4caed1a SS58 versioning (Network IDs) (#3147)
* Introduce network IDs for SS58

* Fix

* Allow numeric overrides.

* Improve docs

* String rather than str

* Comment out code that will become valid after other PR

* Fix
2019-07-20 09:24:10 +08:00
Michael Müller c70b81444a Introduce srml/im-online (#3079)
* Fix grammar and typo

* Extend network service

* Extend offchain API

* Support creating unsigned UncheckedExtrinsic

* Introduce srml/im-online

* Bump impl and spec version

* Fix web-wasm test

* Apply suggestions from code review

Remove parity-multiaddr dependency

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

* Replace transmute with from_raw_parts

* Replace PeerId.to_string() with .to_base58()

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

* Update Cargo.lock

* Bump impl and spec version (again)

It was updated in master in the meantime.

* Apply suggestions from code review

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Address comments

* Add public function is_online_in_current_session()

* Bump spec_version

* Fix doc tests

* Improve comments

* Remove superfluous line

* Name parameters consistently

* Implement comments

* Switch From to TryFrom

* Use Vec instead of HashSet

* Fix tests

* Revert me: local testing

* Fix check if already sent during session

We gossip each session, hence we need to check
if already sent in this session (not era).

* Fix typos

* Consistent terminology

* Revert "Revert me: local testing"

This reverts commit 73fbc29ff3e5ed71d99436318260b4f007e837f4.

* Introduce IsMember trait

* Implement misc comments

* Remove unused function

* Fix test

* Fix external_addresses being written

* Fix test

* Add necessary trait bound

* Do not increment version

* Update lib.rs
2019-07-20 09:19:44 +08:00
Amar Singh a757dfb222 Transaction Fee Multiplier (#2854)
* added fee calculations; need some type conversions

* cleaned up make_payment and other stuff

* rename vars to compile

* add WeightToFee type

* clean test files after new type added to balances

* fmting

* fix balance configs in tests

* more fixing mocks and tests

* more comprehensive block weight limit test

* fix compilation errors

* more srml/executive tests && started fixing node/executor tests

* new fee multiplier; still overflows :(

* perbill at the end attempt; needs to be changed

* clean fmting, rename some vars

* new PoC implementation.

* test weight_to_fee range and verify functionality

* 12 of 15 tests in node executor are passing

* 1 test failing; big_block imports are failing for wrong reasons

* Update srml/executive/src/lib.rs

Co-Authored-By: Kian Peymani <Kianenigma@users.noreply.github.com>

* Some cleanup.

* consolidate tests in runtime impls

* clean and condition executive for stateful fee range test

* remove comments to self

* Major cleanup.

* More cleanup.

* Fix lock files.

* Fix build.

* Update node-template/runtime/Cargo.toml

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Update node/executor/src/lib.rs

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Per-block update.

* nit.

* Update docs.

* Fix contracts test.

* Stateful fee update.

* Update lock files.

* Update node/runtime/src/impls.rs

* Revamped again with fixed64.

* fix cargo file.

* nits.

* Some cleanup.

* Some nits.

* Fix build.

* Bump.

* Rename to WeightMultiplier

* Update node/executor/src/lib.rs

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

* Add weight to election module mock.

* Fix build.

* finalize merge

* Update srml/system/src/lib.rs

* Bring back fees.

* Some nits.

* Code shifting for simplicity.

* Fix build + more tests.

* Update weights.rs

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

* Update lib.rs

* Fix test build
2019-07-19 14:21:05 +02:00
André Silva a313935947 srml: grandpa: Pause/resume current authority set (#3068)
* grandpa: add pause/resume signals to runtime module

* grandpa: add tests for srml pause/resume transitions

* node: bump spec_version

* Apply suggestions from code review

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

* Update core/finality-grandpa/primitives/src/lib.rs
2019-07-19 17:30:59 +08:00
Pierre Krieger 1e77717b26 Switch the network timers to new futures (#3117) 2019-07-18 18:52:19 -04:00
André Silva 991e9ae263 client: fix decode block number as u32 (#3130)
* client: fix panic on decode block number as u32

* client: add test for number_index_key

* client: add another test at client level

* client: address review grumbles
2019-07-18 15:55:14 +01:00
Kian Peymani e8a2fee6d6 Update hex-literal dependency version. (#3141)
* Update hex-literal dep version.

* Update lock file.
2019-07-18 11:28:55 +02:00
thiolliere 62f62c6c48 fix and test default instance for collective (#3135) 2019-07-17 19:00:20 +02:00
Jim Posen eea9437805 srml-contracts: Avoid unnecessary lookups during call context initialization (#3121)
* srml-contracts: Remove lookups during CallContext initialization.

* Bump node runtime impl_version.
2019-07-16 23:30:45 +03:00
Pierre Krieger 8e09338e27 Don't allow failure for more CI stages (#3125) 2019-07-16 15:33:45 +01:00
Pierre Krieger a22bb71029 Consistency with the Block trait name (#3129)
* Consistency with the Block trait name

* Line widths
2019-07-16 15:32:46 +01:00
Jim Posen 768eb1af4d Contract storage limit (#3126)
* srml-contracts: Remove hard-coded code hashes from tests.

This makes it easier to update existing and add new test Wasm modules.

* Test maximum contract storage write size.

* Implement storage value limit for contracts.

* Bump node runtime spec version.
2019-07-16 17:23:06 +03:00
Svyatoslav Nikolsky 95061beb79 Some changes tries optimizations (#2840)
* changes tries initial optimizations

* line width
2019-07-16 10:25:08 +09:00
Gavin Wood 1b5bafc8de Introduce vesting offsets (#3094)
* Introduce vesting offsets

Closes #3090

* Fix logic

* Bump impl verfsion

* Initial rewrite of vesting

* Test for liquidity with delayed vesting

* Bump Spec, Fix line width

* More line width fix

* Small nit to documentation
2019-07-16 10:22:18 +09:00
André Silva f74c2676da client: Reorg to new best when finalizing divergent branch (#2869)
* client: add tests for reorging on diverged finality

* client: mark finalized block as best if diverged from current best chain

* client: update meta on set_head

* core: add docs about SelectChain to finalize_block

* client: improve finality reorg test

* client: LongestChain doesn't return client best block

* client: LongestChain searches canonical chain
2019-07-16 08:50:22 +09:00
Pierre Krieger babfc44736 Make mDNS part of DiscoveryBehaviour (#3116)
* Make mDNS part of DiscoveryBehaviour

* Fix tests

* Address concern
2019-07-16 08:49:44 +09:00
Max Inden 515a56af4a core/network: Remove self mutability on put and get value (#3118)
Make `NetworkService.{get,put}_value` only take a self reference instead
of a mutable self reference. When retrieving `NetworkService` via
`NetworkWorker`, one only gets an immutable reference.
2019-07-16 08:49:27 +09:00
TriplEight 3b039e3e49 WIP: Subkey release. (#3123)
* should decide on publishing

* build subkey for linux

* small fixes

* wrong dir
2019-07-16 08:47:21 +09:00
André Silva ee0f3966ba node: fix hardcoded block time in integration tests (#3120) 2019-07-15 18:26:33 +02:00
Sergei Pepyakin 19ac4c0af3 Update complexity.md (#3114) 2019-07-15 17:42:22 +03:00
TriplEight 84f4d54e53 Logs will be saved to the job artifacts only in case of failure. (#3110)
* Logs will be saved to the job artifacts only in case of failure.

* Logs will be partly shown at the end in case of failure.

* expiration and parsing
2019-07-15 16:37:31 +02:00
Pierre Krieger 5bd806bd9b Improvements to the import queue (#3101)
* Remove block_imported

* Move blocks results processing to sync

* Remove methods from Link

* Better errors

* Allow cancelling the import queue

* Restore the import trace

* Fix network tests

* Line widths

* Use has_error instead

* Minor style
2019-07-14 13:22:32 +01:00
Pierre Krieger 7ae6556a02 Switch the peerset to new futures (#3108)
* Switch the peerset to new futures

* Fuse the peerset rx
2019-07-13 10:55:01 +02:00
Bastian Köcher c42d73d302 Make parameter types implementation more flexible (#3112)
* Make parameter types implementation more flexible

* Bump `impl_version`
2019-07-13 10:54:41 +02:00
Toralf Wittner 9ee79d5c5e Remove sync::Context trait. (#3105)
Instead of passing a context around to each method, thereby introducing
side-effecting I/O actions everywhere, with this PR `sync::ChainSync`
only contains state which is updated by invoking various callback
methods (`on_*`) and actionable items are returned as regular results
from method calls, often iterators yielding requests that should be
issued to peers. It is up to the caller to handle these in an
appropriate way, currently `protocol` will send those as messages.
2019-07-12 20:37:38 +02:00
Gavin Wood e4d4548121 Convert unnecessary storage item to static. (#3093)
* Convert unnecessary storage item to static.

* Polish

* 6 second blocks.

* Compile fixes

* Bump runtime

* Fix

* Another fix

* Import `srml_support::traits::Get`

* Export MinimumPeriod from `decl_module!`

* Remove `config` from Timestamp

* Clean up warnings
2019-07-11 23:03:33 +02:00
Pierre Krieger b3dc472a9b Switch the telemetry to new futures (#3100)
* Switch the telemetry to new futures

* Line widths

* Apply suggestions from code review

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

* Fix Cargo.lock
2019-07-11 18:11:55 +02:00
Pierre Krieger bf2551a854 Switch the client to new futures (#3103)
* Switch the client to new futures

* No need for compat in the client

* Fix client tests

* Address review
2019-07-11 16:58:30 +02:00