Commit Graph

494 Commits

Author SHA1 Message Date
Tomasz Drwięga 45e79d617b Avoid sending heartbeat if we are already considered online. (#3981)
* Don't send a heartbeat if already online.

* Remove env_logger.

* Update lock.

* Bump runtime.

* Merge master
2019-11-03 10:51:33 +00:00
Gavin Wood 26f4084f95 Add events for im_online (#3991)
* Add AllGood event for im_online

* Another event just in case.

* Bump runtime
2019-11-01 11:07:46 +00:00
Jim Posen 8207b4fceb Revert "grandpa: Use storage proofs for Grandpa authorities (#3734)" (#3983)
This reverts commit c0a1926704.
2019-10-31 22:48:04 +00:00
Jim Posen c0a1926704 grandpa: Use storage proofs for Grandpa authorities (#3734)
* grandpa: Write Grandpa authorities to well known key.

Instead of requiring execution proofs for Grandpa authorities, this
enables much simpler storage proofs.

* grandpa: Introduce named AuthorityList type.

* grandpa: Storage migration for srml-grandpa module.

* Remove no-longer-used GrandpaApi runtime API.

* grandpa: Write AuthorityList to storage with encoding version.

We expect the AuthorityList type may change (eg. key changes). To make
upgrades smoother, include a version in the stored value.

* Bump node runtime spec version.

* Update srml/grandpa/src/lib.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-10-31 14:33:34 +01:00
André Silva 3cbc28ab59 im-online: account for block authorship (#3973)
* im-online: account for block authorship

* im-online: add test for block authorship onlineness

* im-online: cleanup

* im-online: fix test
2019-10-31 11:11:11 +01:00
Tomasz Drwięga a73334f769 Increase priority of ImOnline heartbeats (#3972)
* Make sure im-online reports are high priority.

* Bump runtime.
2019-10-30 16:19:31 -07:00
Sergei Pepyakin 5486d7add2 Implement contract_getStorage RPC API (#3944) 2019-10-30 13:54:57 +01:00
Gavin Wood 3aecf32824 More robust punishment (#3952)
* Introduce new option "always force new era".

* Take appropriate action, even for small offences.

- Deselect the offender in all circumstances
- Ensure that deselection forces a new era
- Ensure that forcing a new era works with the always-forcing.

* Bump runtime
2019-10-29 17:03:17 +01:00
Bastian Köcher 057636fd1f Remove footgun around session keys/handlers (#3949)
* Remove footgun around session keys/handlers

- `OpaqueKeys` now has an associated type `KeyTypeIdProviders`. This can
be used in the runtime as input for `SessionHandler` from the session
trait.
- `impl_opaque_keys` now works with modules and extracts the `KeyTypeId`
from the module directly.
- Added some checks to the `session` storage initialization that checks
that the `SessionHandler` and `Keys` use the same number of keys and
that the order is equal.

* Update core/sr-primitives/src/traits.rs
2019-10-29 00:58:58 +01:00
Kian Paimani 7e87dfdc07 RPC to query transaction fee + weight + info (#3876)
* initial version for testing

* New version that compiles

* optional at block parameter

* Fix some more view grumbles.

* Update srml/transaction-payment/src/lib.rs
2019-10-28 16:04:45 +01:00
Kian Paimani 9b1dd268bf Updates to elections-phragmen and some runtime docs. (#3940)
* minor changes

* Refactors for phragmen-election

* Bump.

* Fix genesis stuff

* Fix rest of the errors
2019-10-28 15:29:53 +01:00
Max Inden e110cd7ae8 *: Disable authority discovery module (#3914)
The authority discovery module enables authorities to be discoverable
and discover other authorities to improve interconnection among them. In
order to achieve this the module needs to know when the authority set
changes, thus when a session changes.

One has to register a module as a *session handler* in order for it to
be notified of changing sessions. The order and number of these *session
handlers* **MUST** correspond to the order and number of the *session
keys*.

Commit 027d887 added the authority discovery to the `SessionHandlers`.
Given that the authority discovery module piggybacks on the Babe session
keys the commit violated the above constraint.

This commit reverts most of 027d887, leaving `core/authority-discovery`
and `srml/authority-discovery` untouched.
2019-10-28 11:06:16 +01:00
Gavin Wood 580e32101e runtime: Add ability to force a name change (#3934)
* Add ability to force a name change

* Fix tests

* Bump runtime.
2019-10-27 16:20:35 +01:00
Gavin Wood c08ac2277f runtime: Expose const params for nicks module (#3932)
* Expose const params for nicks module

* Bump runtime
2019-10-27 14:36:35 +01:00
Gavin Wood 3d6127ade0 runtime: Account nicknames (#3930)
* Add Nicknames module for accounts.

* Integrate into node.

* Fix build

* Update srml/nicks/src/lib.rs

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

* Bump runtime

* Improve weight docs

* Docs.

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-27 12:53:41 +01:00
Gavin Wood a0094e72e5 Add force_unstake to staking as root operation. (#3918)
* Add force_unstake to staking as root operation.

* Bump runtime

* Tests

* Update srml/staking/src/lib.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-10-25 15:14:49 +02:00
Gavin Wood b88b6b5418 Remove MintedForSpending (now unused) (#3917) 2019-10-25 14:22:25 +02:00
Tomasz Drwięga cecf3a1438 Bring back SubmitSignedTransaction trait. (#3908)
* Bring back SubmitSignedTransaction.

* Fix long lines.

* Add missing docs.

* Update core/primitives/src/crypto.rs

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

* Update node/runtime/src/lib.rs

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

* Update core/primitives/src/crypto.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-25 12:24:58 +02:00
Jim Posen e05e624a3a support: BuildStorage methods to take self reference (#3884)
* support: BuildStorage methods to take self reference.

There is no reason to consume the GenesisConfig when using it to
initialize a new storage backend. Instead, build_storage and
assimilate_storage now operator on self references.

* Bump node runtime impl_version.
2019-10-25 11:44:57 +02:00
thiolliere d49c36428d Fix treasury kept and spend when emptied (#3880)
* Now construct_runtime must include treasury config so account is created at genesis.
* if it doesn't though it is ok, account will be created when the amount put is more than existential deposit.
2019-10-24 17:26:26 +02:00
Kian Paimani ecd1ed7b65 Better Parameterisation for Fee system (#3823)
* Better fee parameters

* Fix build

* Better runtime tests

* Price to Weight ratio as type parameter (#3856)

* Price to Weight ration as type parameter

* Kian feedback

* Some renames.

* Fix executor tests

* Getting Closer.

* Phantom Data

* Actually fix executor tests.

* Fix tests.

* Remove todo

* Fix build
2019-10-24 15:03:52 +02:00
Gavin Wood d97775542a Add SECP256k1/ECDSA support for transaction signing (#3861)
* Add SECP256k1/ECDSA support for transaction signing.

* Refactoring and fixes

* Fix for contracts

* Avoid breaking runtime host function

* Build fixes, make subkey work more generaically.

* Fix tests

* Dedpulicate a bit of code, remove unneeded code, docs

* Bump runtime version

* Fix a test and clean up some code.

* Derivation can derive seed.

* Whitespace

* Bump runtime again.

* Update core/primitives/src/crypto.rs

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

* Update core/primitives/src/ecdsa.rs

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

* Fix AppVerify
2019-10-24 10:59:09 +02:00
Kian Paimani 311be1d071 Fix phragmen election to wasm (#3898)
* Fix phragmen-election compile to wasm

* Fix chain_spec stuff

* Fix panic with no term duration
2019-10-23 22:04:42 +02:00
Ashley 968b24d849 Add an OnUnbalanced hook for contract rent payments (#3857)
* Add RentPayment trait to runtime

* clarify check

* improve proof

* Clarify further

* Simplify RentPayment::on_unbalance calling and get rid of NonZeroRentHook
2019-10-23 12:02:30 +02:00
Bastian Köcher 5e889431d3 Wasm-builder-runner unset CARGO_TARGET_DIR and release 1.0.4 (#3893)
* Wasm-builder-runner unset `CARGO_TARGET_DIR` and release 1.0.4

`CARGO_TARGET_DIR` needs to be unset or otherwise cargo deadlocks,
because cargo always holds an exclusive lock on target dir.

* Commit missing version up

* Lock file
2019-10-23 10:28:44 +02:00
Tomasz Drwięga 20a3989785 Runtime logging. (#3821)
* Implement Printable for tuples.

* Add debugging function.

* Add debug 1.

* Implement  for everything.

* RuntimeDebug derive.

* Introduce RuntimeDebug.

* Add some dummy logging.

* Replace RuntimeDebug with Debug.

* Revert "Replace RuntimeDebug with Debug."

This reverts commit bc47070a8cb30241b2b590b2fa29fd195088162f.

* Working on Debug for all.

* Fix bounds.

* Add debug utils.

* Implement runtime logging.

* Add some docs and clean up.

* Clean up derives.

* Fix custom derive impl.

* Bump runtime.

* Fix long lines.

* Fix doc test.

* Use CARGO_CFG_STD.

* Revert "Use CARGO_CFG_STD."

This reverts commit ea429566de18ed0fa052571b359eb9826a64a9f4.

* Use parse_macro_input

* Update lockfile.

* Apply review suggestions.

* Remove stray re-export.

* Add no-std impl.

* Update lockfile.
2019-10-22 14:13:44 +02:00
Robert Habermeier 5d5e71028e Explicitly declare decl_storage! getters as functions (#3870)
* parse decl_storage getters with fn keyword

* test for get in decl_storage

* update all decl_storage! getters

* bump version

* adjust missed doc line
2019-10-22 09:53:58 +02:00
Ashley 28f7814fb2 Change Contracts::DefaultMaxDepth from 1024 to 32 (#3855)
* Change DefaultMaxDepth from 1024 to 32

* bump impl and spec version
2019-10-21 15:46:23 +09:00
Bastian Köcher 222ff6fe79 Clean up the wasm-builder and release 1.0.8 (#3858) 2019-10-20 13:02:21 +02:00
Ashley 141a64cf41 Move sr-arithmetic to a new crate and add in a fuzzer (#3799)
* Split up sr_arithmetic.rs

* Add some basic fuzzing

* Add more tests

* Add printing to fuzzing

* Clean things up

* Remove arbitrary

* Remove comments

* More cleaning, fix small error that was causing a panic

* Add rational128

* Remove old random tests

* introduce panic

* fuzzing should panic properly

* Bit of cleanup

* Add a test uncovered via fuzzing that fails!

* Few small changes

* Move sr-arithmetic to its own crate

* Fix fuzzing

* Got rid of fuzzer Cargo.lock

* Added no_std

* re-export assert_eq_error_rate

* bump impl and spec version

* re add convert into

* Add an ignore to the test

* Enabled benchmarking

* Reindent

* Clean up biguint fuzzer

* Clean up biguint more

* shuffle sr-primitives/traits about

* Remove unused dependencies

* Apply clippy suggestions

* upgrade primitive-types versions

* Run tests against num-bigint

* Get rid of allocation in assert_biguints_eq

* Add an optimisation to multiply_by_rational

* rename parts_per_x -> per_things

* Change fuzzer cargo.toml

* Remove allocation from BigUint PartialEq impl

* Remove accidental indentation

* Renmove Lazy and Convert traits

* Copy assert_eq_error_rate macro back to sr-primitives

* Add documentation to fuzzers

* fix sr-primitives assert_eq_error_rate

* add cfg(test)

* Update core/sr-arithmetic/src/traits.rs

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

* Update core/sr-arithmetic/src/traits.rs

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

* Update core/sr-arithmetic/fuzzer/src/biguint.rs

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

* Allow rounding up in rational128

* Make changes to biguint.rs

* Update core/sr-arithmetic/src/traits.rs

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

* Final touches

* Convert to num_bigint::BigUint to compare

* remove unused mut

* more small changes

* shuffle sr-primitives trait imports

* more code review

* move assert_eq_error_rate to lib.rs

* Update core/sr-arithmetic/fuzzer/src/biguint.rs

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

* Get rid of S

* Simplify rational128 honggfuzz link

* Insignificantly change rational128 fuzzing code

* Slightly tidy up some of the arithmetic logic

* Get rid of sr_arithmetic again(?) and fix sr-primitives/weights

* Apply updates to sr_arithmetic.rs to crate
2019-10-19 09:36:43 +02:00
Ximin Luo b618d8f0b2 Make build work with rustc 1.37 stable and RUSTC_BOOTSTRAP=1 (#3844)
* Make build work with rustc 1.37 stable and RUSTC_BOOTSTRAP=1

* Bump versions to run CI
2019-10-18 17:15:05 +02:00
Kian Paimani 183c188111 refactor: Transaction-Payment module (#3816)
* Initial draft that compiles

* Extract payment stuff from balances

* Extract multiplier update stuff from system

* Some fixes.

* Update len-fee as well

* some review comments.

* Remove todo

* bump
2019-10-17 14:21:32 +02:00
thiolliere f4e36f0d74 Refactor decl storage (#3765)
* split implementation in multiple files:
  * transformation -> genesis_config/  getters.rs  instance_trait.rs  metadata.rs  mod.rs  store_trait.rs
  * mod.rs -> parser.rs
  * impl.rs -> storage_struct.rs
* parser is isolated into parse module, it could be improved as well but this can be done in another PR
* modules contains a defintion of decl_storage input which must be ok to work with.
* implementation change:
  * T: Trait might be more often bound to 'static (anyway we only use static one and it is needed for metadata current implementation).
  * GenesisConfig no longer requires its fields to be Clone (possible since to EncodeLike feature)
  * builder for map storages must return precise type Vec<(key, value)>
2019-10-16 15:47:46 +02:00
Tomasz Drwięga dc92631180 Move srml RPC extensions to separate crates (#3791)
* Move srml-system RPC out.

* Fix tests for system-rpc module.

* Contracts RPC moved.

* Fix rpc test.

* Clean up.

* Update lockfile.

* Bump runtime version.

* Update srml/contracts/rpc/runtime-api/src/lib.rs

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

* Bump impl version.
2019-10-16 12:40:35 +02:00
Fabio Tudone 8ef20a5534 Fix #1536: do not require to construct a block for encoding it (#3813)
* Fix #1536: do not require to construct a block for encoding it

* Bump `impl_version`

* Improve `Block::encode_from` signature and rustdoc (from review by @bkchr)
2019-10-16 10:02:12 +02:00
Gavin Wood eba7df9a7b Fix semantics of ExistenceRequirement::KeepAlive. (#3796)
* Fix semantics of ExistenceRequirement::KeepAlive.

* Bump runtime version
2019-10-11 13:59:26 +02:00
Xiliang Chen 34c7338211 Decouple randomness-collective-flip (#3792)
* Abstract Randomness trait

* bump version

* fix doc test

* simpify code a bit

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fix tests
2019-10-10 12:41:42 +02:00
Kian Paimani 21fae718c4 Multi-limb arithmetic for runtime (#3743)
* First working version of all operations.

* New and improved version of everything.

* Minor cleanup.

* Fix build

* Finalize nignum

* Some final works on refactors and tests.

* fix build

* Some review comments

* Bench, better try into and nits

* mutify the API

* rename to big_uint

* unmutify.

* Remove resize

* Apply suggestions from code review

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

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

* BEtter proof

* Fix panic doc.

* Bump.
2019-10-10 09:52:08 +02:00
Ashley 968a30685f Split off System random functions into a new Randomness module (#3699)
* split off system randomness functions into a new module

* bump spec and impl version

* Move randomness to bottom of construct_runtime calls, move initialization into on_initialize

* Update srml/randomness/Cargo.toml

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

* Update srml/randomness/src/lib.rs

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

* Update srml/randomness/src/lib.rs

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

* Update srml/randomness/Cargo.toml

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

* Improve system example

* Update Cargo.lock

* Fix randomness example

* Get rid of the stored index

* Add tests

* Add a random test

* Improve docs

* Fix executive test :^)

* Add a utility function to tests

* Update srml/randomness/Cargo.toml

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

* Update srml/randomness/src/lib.rs

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

* Update srml/randomness/src/lib.rs

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

* Change interpretation of block numbers

* rename crate

* refactor randomess module usage

* change random material len to a const

* Update srml/randomness-collective-flip/src/lib.rs

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

* Update srml/randomness-collective-flip/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-08 17:31:39 +02:00
Bastian Köcher 1a327cd894 srml-utility: Store errors as DispatchError to make the decodable (#3766) 2019-10-05 13:06:38 +02:00
Gavin Wood ac0270518c Utility module for doing stuff like batch calls (#3759)
* Implement and test batch

* Add files.

* Remove comments.

* Update srml/utility/src/lib.rs

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

* Fixes
2019-10-04 19:13:54 +02:00
Robert Habermeier b8e2f8f2d6 Decouple BABE from session (#3760) 2019-10-04 14:56:41 +02:00
Xiliang Chen 67a4bc4bdd Minor fixes (#3751)
* fix warning

* use compact for balance type

* bump version
2019-10-03 03:16:07 +02:00
DemiMarie-parity 62b97a090d Upgrade dependencies whenever “easy” (#3556)
* Update all dependencies

* Upgrade dependencies whenever “easy”

“easy” means that there are no major changes required.

* Fix build and bump paste dependency to 0.1.6

* Remove dead code

* Re-add = dependency for futures-preview

* Add missing std features for runtime-io

* Remove git dependencies

as updated versions have been published to crates.io

* try to debug bug

* For sr-io, "std" should imply "no_oom" and "no_panic_handler".

Otherwise, rustc complains (correctly) about duplicate lang items.

* Add missing "runtime-io/std" features

* Fix compilation errors

* Prevent duplicate lang items

Rust does not allow duplicate lang items.  When compiled without the
`std` feature, `sr-io` defines two lang items.  Therefore, `sr-io`
compiled without `feature = "std"` must not be linked with `std`.

However, `pwasm-utils` and `wasmi-validation` both bring in `std` unless
compiled with `default-features = "false"`.  This caused a duplicate
lang item error.  Building both with `default-features = "false"`
prevents this error.  When building with `feature = "std"`, they should
both be built with the `std` feature, so this feature needs to be
explicitly depended on.

* Bump `impl_version`

* Make tests pass

Three tests used 1 less gas than they had previously.

* Try to un-break build

* Add a Cargo.lock file

* Revert offchain code

* Revert "Revert offchain code"

This reverts commit d216d08cc6ca0344614669c1d24cde3aa5c0d4e2.

* Don’t try to send a body with a GET request

without adding a Transfer-Encoding or Content-Length header.

This has always been wrong, but hyperium/hyper#1925 hid the bug until
hyper was upgraded to 0.12.35.

* Change some more GET requests to POST requests

* Fix excess line width and remove an `extern crate`

* Delete commented-out extern crate

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

* Fix regression in Cargo.toml files

dev-dependencies need `default-features = false`, too.

* Bump parity-wasm dependency

* Bump `futures-preview`

* Apply suggestions from code review

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

* Update Cargo.lock files

* Apply suggestions from code review

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

* Update core/service/src/chain_ops.rs

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>
2019-10-02 15:23:59 -04:00
thiolliere 3bfcdeb250 Fix quantization from OnDilution in treasury (#3736)
* fix

* bump version

* remove println
2019-10-02 12:36:50 +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
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
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
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
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