Commit Graph

3142 Commits

Author SHA1 Message Date
Pierre Krieger d04d24d047 Fix compiling substrate-chain-spec for WASM (#3971)
* Fix compiling substrate-chain-spec for WASM

* Fix tests
2019-10-30 20:54:22 +01:00
Pierre Krieger 2c2bba64a0 Allow passing a custom database when creating the Service (#3957)
* Put the DB configuration in an enum

* Allow passing a custom database to client-db

* Clean-ups in client-db

* Fix client tests

* Fix service tests

* Hopefully fix tests for good this time 😩

* Address review
2019-10-30 16:50:08 +01:00
Pierre Krieger 14e4cf9155 Remove node/src/main.rs (#3969) 2019-10-30 16:49:17 +01:00
Bastian Köcher 7627428f44 Catch native panics when executing the wasm runtime (#3953)
As with the native runtime, we now catch all native panics when we
execute the wasm runtime. The panics inside the wasm runtime were
already catched before by the wasm executor automatically, but any panic
in the host functions could bring down the node. The recent switch to
execute the native counterpart of the host function in `sr-io`, makes
this change required. The native `sr-io` functions just `panic` when
something is not provided or any other error occured.
2019-10-30 16:34:00 +01:00
Sergei Pepyakin 5486d7add2 Implement contract_getStorage RPC API (#3944) 2019-10-30 13:54:57 +01:00
Pierre Krieger 6c49ad4438 Remove the RPC helpers module (#3967) 2019-10-30 13:19:55 +01:00
Pierre Krieger b8602aa58b Fix TODO for the WASM CI build of rpc-servers (#3966) 2019-10-30 12:22:04 +01:00
Pierre Krieger 5de3393297 Make substrate-offchain compile for WASM again (#3965)
* Make substrate-offchain compile for WASM again

* Minor adjustments
2019-10-30 12:08:46 +01:00
Ashley 678ec6899c Remove deprecated Client::backend (#3951) 2019-10-29 19:26:44 -04:00
Bastian Köcher 93c1e87a36 Provide simple TestSessionHandler that works with UintAuthorityId (#3962) 2019-10-29 21:20:09 +01:00
André Silva 9ec5ba46f3 cli: fix display_role helper (#3961) 2019-10-29 20:07:11 +00:00
Max Inden 6ee284ec5e test-utils/chain-spec-builder: Add note to run builder in release mode (#3958) 2019-10-29 20:41:43 +01:00
Bastian Köcher de711ac188 Upgrade impl-serde to 0.2.3 (#3960) 2019-10-29 20:22:20 +01:00
André Silva c92eda9809 node: add sentry mode flag (#3959)
* node: add sentry mode flag

* cli: extend docs on validator and sentry modes

* service: add missing field in test Configuration

* node: Display instead of Debug when printing node role
2019-10-29 19:58:34 +01:00
André Silva dc14809804 grandpa: fix handling of catch-up requests (#3956)
* grandpa: fix handling of catch-up requests

* grandpa: fix tests

* grandpa: add test for catch-up handling when observer disabled

* grandpa: extend doc comment

* grandpa: rename existing catch up test
2019-10-29 19:15:49 +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
Kian Paimani a0e24f3aa2 Storage migration of elections-phragmen (#3948)
* Initial sotrage migration

* Fix some deps

* test added

* another dep removed

* Update srml/elections-phragmen/src/lib.rs

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

* Apply suggestions from code review

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

* a bit nicer
2019-10-29 15:46:34 +01:00
Ashley ae42db6049 Switch sr-arithmetic benchmarking to criterion (#3902)
* Change DefaultMaxDepth from 1024 to 32

* Switch sr-arithmetic benchmarking to criterion

* Update core/sr-arithmetic/Cargo.toml

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

* Update core/sr-arithmetic/benches/bench.rs

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

* Test on variable limb lengths

* Change license

* Rework division
2019-10-29 13:47:27 +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
Tomasz Drwięga 06433c9889 Fix a import+prune+replace case for multi-provides transactions. (#3939)
* Fix a import+prune+replace case for multi-provides transactions.

* Fix tests.
2019-10-28 16:06:20 +01:00
Nikolay Volf 448ce2adff Basic extrinsic pool benchmarks (#3922)
* Working bench for 50 sequental

* configured benches

* fix warnings

* Optimize and fix issues

* add preamble

* Fix benchmarks.

* fix compilation

* remove unneeded features for now
2019-10-28 16:05:52 +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
Pierre Krieger fbe9cfad46 Too many addresses for a node is now a debug! rather than warn! (#3938)
* Too many addresses for a node is now a debug! rather than warn!

* I managed to fail this change
2019-10-28 13:12:31 +01:00
Gavin Wood ec7655cc7b Tip payment is a different withdraw reason. (#3937)
* Tip payment is a different withdraw reason.

* Bump runtime version.

* Test fix.

* Fix lock type
2019-10-28 13:04:20 +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
Bastian Köcher 6beaccdae3 decl_storage! check for duplicate config()/get() (#3936)
* `decl_storage!` check for duplicate `config()`/`get()`

* Fix tests
2019-10-28 09:35:09 +01:00
kaichao bb5f406b3b Fix test description. (#3935) 2019-10-27 18:44:19 +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 d41a5ce00f Revert "Watch existing extrinsics RPC (#3873)" (#3931)
This reverts commit d149c2f719.
2019-10-27 13:19:06 +01:00
Nikolay Volf d149c2f719 Watch existing extrinsics RPC (#3873)
* Transaction pool watch intristics.

* Track extrinsic rpc methods.

* Test for pool watcher.

* Track extrinsic rpc test.

* Fix rpc naming.

* review fixes

* Update jsonrpc and use une subcription.

* Naming and dependencies.
2019-10-27 12:55:44 +01:00
Xiliang Chen f7ee9ab235 Fix node-template (#3924)
* fix node-template
Use MultiSignature to maintain compatibility with substrate-node
Reset version to 1
Remove unused const

* fix chain_spec

* line width
2019-10-27 12:54:41 +01:00
André Silva 981c3a57f9 grandpa: always try to import available block justifcation (#3928)
* grandpa: always try to import justifications in blocks

* grandpa: export useful types

* grandpa: add test for justification import on regular blocks

* grandpa: expand comment in test
2019-10-27 12:54:08 +01:00
Nikolay Volf 40fac49216 Fix missing doc comments. (#3929) 2019-10-27 12:53:52 +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 ae95d05621 Correct docs. (#3919) 2019-10-25 18:04:32 +02:00
Gav Wood 158b4b0b91 Merge branch 'master' of github.com:paritytech/substrate 2019-10-25 15:20:50 +02:00
Gav Wood d2e6d8c64d Emergency build fix on previous PR. 2019-10-25 15:19:36 +02:00
Bastian Köcher ce71b7554d Adds function to_substrate_wasm_fn_return_value (#3905)
* Adds function `to_substrate_wasm_fn_return_value`

Instead of replicating this piece of code over and over again, just move
it to a function that does it.

* Feedback

* Comment
2019-10-25 15:18:20 +02:00
Pierre Krieger 7c0592a9b6 Telemetry timeout (#3916)
* telemetry worker: add connection timeout

* restructure

* only add timeout when writing data

* don't overwrite an existing delay

* set timeout only around writing data

* address comments

* dedicated error enum

* remove whitespace

* move timeout to inside struct

* fix timeout

* remove prints

* move polling

* address comment

* Implement

* More work
2019-10-25 15:17:55 +02: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
Joshy Orndorff 44696f46c3 Change dependency name "node-template-runtime" -> "runtime" (#3910) 2019-10-25 06:25:33 +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
Max Inden 743a34bc1d core/finality-grandpa: Request block sync from network after import timeout (#3800)
* core/finality-grandpa: Pass Grandpa msg sender up to UntilImported

* core/finality-grandpa: Track senders to maybe later request blocks

* core/finality-grandpa: Make BlockStatus pub only within crate

* core/finality-grandpa: Abstract NetworkBridge with BlockSyncRequester

* core/finality-grandpa: Pass BlockSyncRequester to UntilImported

* core/finality-grandpa: Track block number of pending within UntilImported

* core/finality-grandpa: Request block sync on long wait

* core/finality-grandpa: Adjust unit tests to previous changes

* core/finality-grandpa: Fix line length

* core/finality-grandpa: Add comment explaining in & out vote combination

* core/finality-grandpa: Log after, not before, timeout expired

The UntilImported component should log whenever waiting for a specific
block to be imported surpassed a defined constant timeout. Without this
patch the code would log whenever the current time was below the
timeout.

* core/finality-grandpa: Collect senders as HashSet for deduplication

* Revert "core/finality-grandpa: Track senders to maybe later request blocks"

This reverts commit 61ac9dd715612d5fdbf7b8f00b84e450f282ade0.

* Revert "core/finality-grandpa: Pass Grandpa msg sender up to UntilImported"

This reverts commit afdc9646a6c314f99a9d19242f1878f85980e70d.

* core/network/sync: Ask for block from all peers if none provided

When requesting an explicit fork sync, try to sync from all known peers,
when no specific peers were provided.

* core/network/sync: Request specific fork sync from peers ahead or on par

When making an explicit fork sync request without specifying any peers,
make sure to only request it from the locally known peers that are
either ahead or on a par compared to the block number we are looking
for.

* grandpa: fix tests

* grandpa: fix warnings

* grandpa: add test for block sync request on until_imported

* grandpa: rename Environment field inner to client

* grandpa: fix minor nits

* grandpa: minor nits in until_imported

* grandpa: copy docs for set_sync_fork_request

* grandpa: remove stale TODO on UntilImported
2019-10-24 16:01:14 +01:00
Pierre Krieger 002057dcc5 Service builder clean-up (#3906)
* Rename NewService to Service

* Move new_impl! macro to builder module

* Inline new_impl!

* Minor cleanup

* Inline the offchain_workers() function

* Fix indentation level

* Inline start_rpc

* Remove RpcBuilder trait
2019-10-24 15:11:38 +02:00
Jaco Greeff c5bf9007df Bump transaction version (#3904) 2019-10-24 15:11:24 +02:00