Commit Graph

2620 Commits

Author SHA1 Message Date
Tomasz Drwięga 69c4e2f7f0 Deprecate ValidateUnsigned and prevent duplicate heartbeats (#3975)
* Add pre-dispatch checks for ValidateUnsigned

* Deprecate ValidateUnsigned.

* Bump specversion.

* Fix test.
2019-11-03 10:52:08 +00:00
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
Bastian Köcher c9e4d203e7 CI test executor with wasmtime (#4005) 2019-11-03 10:43:30 +00:00
Bastian Köcher d233ad55ad Implement color output for wasm builder (#4004)
* Implement color output for wasm builder

* Fix `Cargo.lock`
2019-11-02 19:59:49 +01:00
thiolliere 5503c483b1 doc (#3995) 2019-11-02 16:09:10 +00:00
Kian Paimani 084b158031 Optional serde for phragmen support (#3994)
* Add serde to phragmen

* Update lock file

* and bump a version

* and bump a version again

* Apply suggestions from code review

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

* revert impl-tarit for tuple update

* revert session.

* Revert "revert session."

This reverts commit 98086c9db56677068db85f74320868b2c10d1c00.

* Revert "revert impl-tarit for tuple update"

This reverts commit 28a7fddee2e09c5785b19883f743065e0be8f331.
2019-11-01 22:22:37 +01:00
Benjamin Kampmann 4852763d73 expose offchain worker storage prefix (#3977)
* expose offchain worker storage prefix

* add docs

* move STORAGE_PREFIX to primitives
2019-11-01 19:32:01 +01:00
Benjamin Kampmann 2ff04d332d Move config path generation into the service config for reusability (#3978)
* Move config path generation into the service config for reusability

* Make NoCostum Default and fix tests

* Apply suggestions from code review

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

* remove function not used anymore

* Make path into an option

* remove database_path function and call it directly

* remove helper functions, use consts
2019-11-01 17:51:06 +00:00
Jim Posen 8fe64173e8 executor: Move runtime version caching out of WasmRuntime interface. (#3993)
* executor: Move runtime caching out of WasmRuntime interface.

The runtime version is now fetched and cached at a higher level, not
within the WasmRuntime trait implementations.

* executor: Require successful querying of runtime version.
2019-11-01 18:22:28 +01:00
Bastian Köcher 6193481352 Don't panic in Offchain test context, when we are already panicking (#3996) 2019-11-01 17:14:21 +01:00
Marcio Diaz 596ac7bd1f Possible fix to storage cache (#3989)
* Comment local_cache propagation

* Add test

* Deny cache when modifications are unknown

* Fix indentation
2019-11-01 15:17:38 +00:00
Caio d5f61d5217 Implement Debug for some structures (#3941)
* Implement Debug for some structures

`NetworkConfiguration`, `TransportConfig`, `NodeKeyConfig` and `Secret`.

Needs a new release of the `rust-libp2p` crate. This PR is just a
reminder.

* Explicitly separate `std` and `core`

* Add manual implementation for Secret
2019-11-01 15:28:19 +01:00
Jim Posen 8676c25ef4 Integrate Wasmtime for runtime execution (#3869)
* executor: Use non wasmi-specific execution in tests.

* executor: Move all runtime execution tests into tests file.

* executor: Use test_case macro to easily execute tests with different
Wasm execution methods.

* executor: Convert errors to strings with Display, not Debug.

* node-executor: Rewrite benchmarks with criterion.

They were not passing compilation before and criterion seems to be more
widely used in Substrate.

* executor: Begin implementation of Wasm runtime.

The implementation demonstrates the outline of the execution, but does
not link against the external host functions.

* executor: Define and implement basic FunctionExecutor.

The SandboxCapabilities::invoke is still left unimplemented.

* executor: Implement host function trampoline generation.

* executor: Instantiate and link runtime module to env module.

* executor: Provide input data during wasmtime execution.

* executor: Implement SandboxCapabilites::invoke for wasmtime executor.

* executor: Integrate and test wasmtime execution method.

* executor: Improve FunctionExecution error messages.

* Scope the unsafe blocks to be smaller.

* Rename TrampolineState to EnvState.

* Let EnvState own its own compiler instead of unsafe lifetime cast.

* Refactor out some common wasmi/wasmtime logic.

* Typos and cosmetic changes.

* More trampoline comments.

* Cargo.lock update.

* cli: CLI option for running Substrate with compiled Wasm execution.

* executor: Switch dependency from fork to official wasmtime repo.

* Quiet down cranelift logs.

* Explicitly catch panics during host calls.

We do this to ensure that panics do not cross language boundaries.

* Additional checks and clarifications in make_trampoline.

* Fixes after merge from master and panic safety for wasmtime
instantiation.
2019-11-01 13:32:14 +01:00
Weiliang Li 34bd4c335b authority-discovery: futures 03 Future (#3848)
* authority-discovery: futures 03 Future

* make ci happy

* use futures timer instead of tokio timer

* Update core/authority-discovery/src/lib.rs

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

* remove tokio 01 runtime

* trigger build

* kill futures01

* rename futures
2019-11-01 12:55:29 +01: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
Pierre Krieger 9de6dea4c3 Print warning again if polling network is too long (#3984) 2019-11-01 10:25:35 +01: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
Ashley b0a58647eb Retire storage_items! (#3950)
* Retire storage_items

* Add storage_items! tests to srml/support/tests

* Assimilate genesis config
2019-10-31 21:33:25 +01:00
thiolliere 984163e86e Improve doc for storages in srml-support (#3982)
* improve doc

* Apply suggestions from code review
2019-10-31 19:04:53 +01:00
Benjamin Kampmann 363c8989d4 and backend reference to rpc builder (#3979) 2019-10-31 15:44:52 +00:00
Pierre Krieger eb3c950cfe Remove NetworkSpecialization::on_event (#3976) 2019-10-31 15:38:53 +00:00
Pierre Krieger 4264613a96 Add the code for compiling node-cli for WASM-browser (#3974)
* Extract CLI to separate module in node/cli

* Make node/cli compile for WASM

* More work on node/cli browser

* More work on browser node

* More work

* More work

* Purge a bit the CI script

* More clean up

* Remove substrate-finality-grandpa from the CI

Its tests use tokio, which fails to compile.

* Address review

* Add rocksdb feature to the service

* Fix substrate-service WASM CI

* Apply suggestions from code review

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

* Don't WASM-compile substrate-service altogether
2019-10-31 16:34:12 +01: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
Jim Posen a167f37b91 Create opaque struct for StorageProof. (#3834)
Passing around Vec<Vec<u8>> everywhere is gross and confusing and
breaks encapsulation.
2019-10-31 11:02:29 +01:00
Gavin Wood 073040a053 Add translate API for storage values (#3947)
* Add translate item.

* fix

* doc

* fix doc

* A test added.

* Apply suggestions from code review

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

* address suggestion
2019-10-31 09:24:23 +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
Denis Pisarev e3893d5e39 retry on gitlab system failures (#3970)
* retry on gitlab system failures

* test

* 5 retries for the most popular project

* max is just 2
2019-10-30 23:19:34 +01:00
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