Commit Graph

2493 Commits

Author SHA1 Message Date
Wei Tang 642e76b738 Only submit signed extrinsics back to pool when retracting block (#3660)
* Only submit signed extrinsics back to pool when retracting block

* Fix import
2019-09-21 19:50:37 +08:00
Joshy Orndorff 210290f8ca Remove unused key types sr25 and ed25 (#3659)
* Remove unused key types sr25 and ed25.

* Restore in specific files to fix build.

* Fix runtime tests

* Fix keystore test

* Revert typo

* Move keytypes to primitives/src/testing.rs

* More missed items.

* Getting close now.

* Fix example in documentation.

* Update core/application-crypto/src/ed25519.rs

* Update core/application-crypto/src/sr25519.rs

* Bump impl version.
2019-09-21 12:48:03 +08:00
thiolliere c25d7386cf Make staking inflation curve configurable. (#3644)
* Draft for new design of NPoS rewards

* finish code

* fix test

* add tests

* improve log test

* version bump

* Update srml/staking/reward-curve/Cargo.toml

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

* u128 -> u64

* make conversion to smaller type safe

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

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-09-21 12:47:10 +08:00
Robert Habermeier 68cda2fe79 find best_containing even if best chain is shorter (#3657) 2019-09-20 17:44:19 +01:00
Hernando Castano e434dbdfc5 Use ThreadPool::spawn_ok() instead of ThreadPool::spawn() (#3656)
* Bump futures-timer to v0.3

* Bump futures-preview to v0.3.0-alpha.18

* Replace ThreadPoll::spawn() with ThreadPoll::spawn_ok()
2019-09-20 15:26:14 +02:00
Ashley c95fdd53d8 Finish off srml-contract create -> instantiate renamings (#3649)
* Finish off srml-contract create -> instantiate renamings

* bumped spec_version
2019-09-20 10:53:03 +02:00
Svyatoslav Nikolsky eba6dd73c6 Blockchain cache pruning strategy (#3395)
* blockchain cache pruning strategy

* added some internal docs to cache_pruning_strategy

* Update core/client/db/src/cache/mod.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
2019-09-20 09:49:15 +03:00
Weiliang Li d105d3f3a1 fn import_block -> fn block_import_params in SimpleSlotWorker (#3647) 2019-09-19 15:49:24 +01:00
Ashley 0ed8d40b88 srml-contract: Rename Contract::create to instantiate (#3645)
* Rename Contract::create to Contract::instantiate

* Rename some documentation items

* fixed node executor test

* bumped impl_version

* increased spec_version
2019-09-19 13:06:11 +02:00
Tomasz Drwięga 668acca9ed Force new era only if 1/3 validators is disabled. (#3533)
* Force new era only when over third validators is disabled.

* Update srml/session/src/lib.rs

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

* Update srml/staking/src/lib.rs

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

* Parametrize the threshold.

* Bump runtime version.

* Update node/runtime/src/lib.rs

* Fix build.

* Fix im-online test.
2019-09-19 18:04:48 +08:00
Kian Paimani bfe240d1b0 srml-module: Phragmen election (#3364)
* phragmen election module.

* Add new files.

* Some doc update

* Update weights.

* bump and a few nits.

* Performance improvement.

* Master.into()

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Fix build

* Some fixes.

* Fix build.

* Proper outgoing and runner-up managment.

* Bit more sensical weight values.

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

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* fix lock file

* Fix build.

* Remove runner-ups

* Some refactors.

* Add support for reporting voters.

* Fix member check.

* Remove equlize.rs

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

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

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Bring back runner ups.

* use decode_len

* Better weight values.

* Update bogus doc

* Bump.

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

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Review comments.

* One more test

* Fix tests

* Fix build

* .. and fix benchmarks.

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

* Version bump
2019-09-19 18:04:02 +08:00
Talha Cross 5585770a12 core, subkey: allow to read Polkadot, Kusama, and Dothereum address types (#3643)
* core/primitives: set dothereum address type to 4

* subkey: add dothereum to network prefix

* core/primitives: set dothereum address type to 20

* core/primitives: update comment

* core/primitives: set default address to Dothereum

* Revert "core/primitives: set default address to Dothereum"

This reverts commit 2fc95490c89390eb26f200cb314435b1e9ff83e8.

* core/primitives: allow to parse different default address types
2019-09-19 08:34:41 +02:00
Pierre Krieger 9ea3d8fc52 Remove the no_std feature from the WASM builder (#3640)
* Remove the no_std feature from the WASM builder

* Address review

* More fixing

* Address review again

* Fix missing Cargo.lock
2019-09-18 22:00:44 +02:00
Bastian Köcher 49ad0dbdff Make wasm-builder check for rust-lld (#3635)
* Make `wasm-builder` check for `rust-lld`

* Update README.adoc

Co-Authored-By: Ricardo Rius <9488369+riusricardo@users.noreply.github.com>
2019-09-18 13:52:18 +02:00
Kian Paimani b46340cf8e From<UintAuthority> for u64 (#3638)
* Add from impl for uint authority

* Undo change to cargo.
2019-09-18 13:24:08 +02:00
Ashley e9c756dced Update parity-wasm to 0.40 (#3631)
* updated direct dependencies to parity-wasm

* fixed tests and incremented impl_version of the runtime

* update wasmi to 0.5.1 in sr-sandbox, bringing all parity-wasm deps up to 0.40
2019-09-18 12:27:59 +02:00
Arkadiy Paronyan a07e567fe1 Storage tracing (#3614)
* Storage tracing

* Whitepsaces

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

* Apply suggestions from code review

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

* Update Cargo.lock
2019-09-17 20:42:15 +02:00
Bastian Köcher 2b040fe983 Properly detect debug build in slots (#3630)
`debug-assertions` can also be enabled in for release builds. This
introduces a new build-script that extracts the build type from the
`PROFILE` env variable and sets the `build_type` cfg.
2019-09-17 14:39:40 +02:00
Shawn Tabrizi 113d512300 Suggest --release compilation (#3627) 2019-09-17 13:32:52 +02:00
Tomasz Drwięga c4af4fa522 Fix missing contracts RPC on a full node. (#3622)
* Add contracts RPC to full node.

* Instantiate both RPC extensions for light & full.
2019-09-17 13:06:36 +02:00
Bastian Köcher 96c781834d Enable nice wasm panic messages by default (#3619)
By accident it was already enabled in master for quite some time. To
make sure that we don't blow up the wasm binary size, I compiled the
binary with the feature enabled and disabled. With nice panic messages
enabled, the binary size increases by 908 bytes. Given the value that
this feature brings, I think it is okay to have these panic messages
enabled by default.
2019-09-17 11:28:32 +02:00
Arkadiy Paronyan 84d0c790f3 Send block status with announcement (#3607)
* Send block status with announcement

* Fixed tests

* Whitespace

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Additional comment

* Update comment

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-09-17 11:19:46 +02:00
Weiliang Li 6679c8b051 Update mod.rs (#3625)
Add `import_notification_stream` for test client
2019-09-17 11:16:22 +02:00
Svyatoslav Nikolsky 849e824652 Fetching multiple remote values using single message (#3612)
* multiple remote values in single message

* keys_str: String ->keys_str: closure
2019-09-16 13:30:21 +03:00
Tomasz Drwięga c45a15e559 RPC call to get all RPC methods (#3613)
* Add meta rpc_methods call.

* Sort methods.

* Bump runtime.

* Change format a bit to support versioning.
2019-09-13 21:19:04 +02:00
Bastian Köcher 45d64a711c Clean up sr-io (#3609)
* Move trait `Printable` into `sr-primitives`

* Cleanup runtime io trie_root interfaces

* Remove last generic bits from sr-io interface

* Fix srml-sudo after master merge

* Fix benchmarks

* Runtime bump
2019-09-13 16:39:50 +02:00
Michael Müller 5cb8c0dc1c Fixes for allocator + factory + misc improvements (#3534)
* Clear up import/export misunderstandings

* Fetch minimum period from runtime

* Remove unnecessary comment

This variable is already fetched from the runtime
in the line below.

* Fix bug in factory

The `best_block_id` stayed the same, it was always the
genesis hash. This resulted in the factory failing after
4096 blocks, since `client/db` discards hashes (in this
case the genesis hash) after 4096 blocks from the database.

* Fix tense in error message

* Improve allocator documentation

* Fix bug in allocator

Under certain circumstances an invalid pointer was
returned: when the `ptr` was calculated as equal
to the `max_heap_size`. This is an invalid pointer
since there is no access allowed after the heap limit.

The way to provoke this was to repeatedly allocate
with sizes which were previously not allocated and
immediately deallocate right afterwards. What this
did was to increment the `bumper` with each allocation,
whilst keeping the `total_size` of the heap `0`.
If this repeated allocation/deallocation scheme resulted
in `max_heap_size == ptr` the `ptr` was still returned.

The allocator only checked if the `total_size` was
still within the `max_heap_size` limits, and not
if the resulting `ptr` was still within the valid
heap region.

This commit introduces a check to validate if the
calculated `ptr` is within the heap.

* Add test for zero byte allocation and document behavior

* Improve code readability by introducing a const

* Fix error message in test

* Apply suggestions from code review

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

* Fix code review suggestions

* Replace early return with assertion

* Remove test for zero size allocations

* Shorten test code

* Shorten comment

* Make bump() return Result

* Add comment for bump()

* Remove ambiguous comment

* Replace value with const

* Use proof for panic message

* Fix merge

* Add comment regarding minimum allocation size
2019-09-13 15:47:15 +02:00
Tomasz Drwięga b7c6bc1ed5 Fix tracking validator set in ImOnline (#3596)
* Use session::validators instead of staking::current_elected

* Basic test framework.

* Initialize validators, attempt to heartbeat.

* Use dummy crypto for im-online testing.

* Remove printlns.

* Finish test, make it invalid.

* Add reporting test.

* Finalize the test.

* Remove dumbness.

* Updates.

* Update AuRa

* Update srml/im-online/src/tests.rs

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

* Derive Ord

* Add some more tests.

* Remove stray todo.

* Bump runtime version.

* Bump impl-trait-for-tuples.

* Enforce new version of trait-for-tuples.
2019-09-13 14:55:33 +02:00
Kian Paimani a7f35680b4 Fix Staking and Democracy locking (#3606)
* Fix locking.

* Some reformattings.

* Fix build.

* Fix doc comment.

* Bump.
2019-09-13 08:52:52 +02:00
Kian Paimani a6b5d1d155 Move phragmen benchmarks out of Staking (#3588)
* Move phragmen benches to.. phragmen.

* Move some basic phragmen tests to.. phragmen.

* Line-width

* Add phragmen equ implementation as flot

* Add phragmen equ implementation as flot

* Add mock and test file.
2019-09-13 08:41:33 +02:00
Bastian Köcher 7b87cd206b Implement support for patch section in wasm-builder (#3599)
* Implement support for `patch` section in wasm-builder

* Update core/utils/wasm-builder/src/wasm_project.rs

* Support patch by path

* Go down to the actual data
2019-09-12 21:59:18 +02:00
Sergei Pepyakin 981b3c79ee Print version when panic (#3608)
* Print version when panic

* Fix tests.
2019-09-12 17:52:26 +02:00
Svyatoslav Nikolsky 634ca73e50 Make light client backend only work with locally available data (#3538)
* removing fetcher dependency from light backend

* fix compilation
2019-09-12 17:13:26 +02:00
André Silva fd924c07ed grandpa: reannounce voted blocks periodically (#3602)
* grandpa: reannounce latest voted blocks periodically

* grandpa: add test for background block announcement

* grandpa: configurable delay for background block announcer

* grandpa: nits
2019-09-12 17:12:04 +02:00
Gavin Wood d864254b7a Sudo can dispatch from an account (#3604)
* Sudo can dispatch from an account.

* Fix

* Bump runtime.

* Update srml/sudo/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-09-12 16:47:03 +02:00
Marcio Diaz a643ac6c6f Fix subkey does not verify with pubkey (#3547)
* Decode hex

* Remove log

* Some refactoring to help with testing

* Add own functions for sign and verify.

* Add sign test

* Sign-verify test

* Generate-sign-verify test for both cryptos

* Add aliases

* Print signature

* More refactoring

* Update sign-transaction as transfer

* Simplify transfer and sign-transaction

* main to top file

* rename read_input_message to read_message_from_stdin

* More refactoring

* Add read_required_parameter

* Add format seed

* More refactoring

* format code

* add print_extrinsic

* Remove 0x from print

* fix naming

* Fix readme

* Remove rustfmt

* Remove commented test

* Fix import nits
2019-09-12 15:42:35 +02:00
Sergei Pepyakin 4daac15d22 Add an RPC method for calling a contract. (#3563)
* Sketch

* Some work on docs.

* Doc improvements.

* More docs.

* Some more docs.

* Yet another comment.

* Bump impl_version.

* Accept the block hash

* Use NumberOrHex

* Update node/rpc/src/contracts.rs

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

* Move rpc/primitives
2019-09-12 13:30:10 +02:00
Xiliang Chen 294d172187 fix inconsistency in block time (#3603) 2019-09-12 10:21:21 +02:00
André Silva 32335cc5e4 grandpa: fix race condition (#3542)
* grandpa: ignore result of voter command send

* grandpa: avoid race condition on environment::finalize_block
2019-09-12 00:03:10 +01:00
Sergei Pepyakin 098d880cf9 read_storage panics (#3589)
* Add a failing test case

* Actual fix

* read_child_storage, fix wasm side

* Bump the impl version.

* Alternative (#3597)

* Update with_std.rs

* Update with_std.rs

* Update wasm_executor.rs

* Update wasm_executor.rs

* Update with_std.rs

* Update wasm_executor.rs
2019-09-11 19:37:19 +02:00
Bastian Köcher d136b8eb81 Switch to new proc-macro crate for implementing traits for tuples (#3598)
* Switch to new proc-macro crate for implementing traits for tuples

* Switch back to stable `Cargo.lock` format

* Reduce tuple number to match rusts default implementation
2019-09-11 19:10:02 +02:00
André Silva 433d752831 grandpa: use periodic neighbor packet sender (#3594) 2019-09-11 18:08:15 +02:00
Gavin Wood d908f32c30 Fixes NPoS reward, along with tests, cleanups & docs corrections (#3595)
* Minor cleanups and tests

* Add another test

* fix

* Fix tests

* Fix tests

* Update srml/staking/src/tests.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
2019-09-11 15:11:08 +02:00
Shawn Tabrizi ccc73da289 Use --release for running a Substrate dev node (#3591)
* Use `--release` for running a Substrate dev node

Otherwise users may run into block production time problems.

* Update README.adoc
2019-09-11 09:42:31 +02:00
Svyatoslav Nikolsky 010395e620 Never panic during execution proof check (#3504)
* do not panic during execution proof check

* Update core/state-machine/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Update core/state-machine/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Update core/state-machine/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* BackendTrustLevel enum

* up runtime version

* Update core/state-machine/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Update core/state-machine/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* fixed some grumbles

* Update core/state-machine/src/testing.rs

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Update core/state-machine/src/lib.rs

Co-Authored-By: Gavin Wood <gavin@parity.io>

* mov where

* spaces -> tabs (to restart build)
2019-09-11 10:27:32 +03:00
Bastian Köcher 9607afd629 Cleanup of the state-machine crate (#3524)
* Start refactoring state-machine crate

* More improvement to state-machine

* Fix tests compilation on master and remove warnings

* Fix compilation

* Apply suggestions from code review

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

* Update core/state-machine/src/basic.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Line width

* Update core/primitives/src/storage.rs

Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>

* Update core/state-machine/src/error.rs

Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>

* Review feedback
2019-09-10 17:00:00 +02:00
Tomasz Drwięga 2beeda1488 Don't initialize block for offchain workers. (#3578) 2019-09-10 16:15:32 +02:00
Bastian Köcher 1450719acc First step for generating host externals out of the function definition in sr-io (#3567)
* Adds new wrapper traits for wasm executor

* Add new crate `substrate-wasm-interface`

Thew new crate holds types and traits for the communicating between the
wasm runtime and the host.

* Rewrite externals with new macro etc

* Fix vec initialization

* Make executor tests working

* Remove unused code + warnings

* Introduce `Pointer` and `WordSize` for working with wasm

* Fix tests and compilation

* Fix compilation

* Apply suggestions from code review

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

* Review feedback

* Remove unused conversions

* Make each host function its own struct

`HostFunctions` now just returns these function structs. Each function
can be executed by using one of the function structs. The inherent host
functions are now moved to the "normal" host functions.

* Remove byteorder

* Add floating point types

* Make pointer interface more safe

* Add type alias for wasm-interface Result

* More review comments
2019-09-10 16:07:25 +02:00
Bastian Köcher 86b3f2e1a7 Augment every task spawned by Service with on_exit (#3581)
* Augment every task spawned by Service with `on_exit`

* Add CI test that the node exits
2019-09-10 12:05:54 +02:00
Benjamin Kampmann a4ba356047 Add section regarding polkadot PRs. (#3579)
* Add section regarding polkadot PRs.

* Also add the comment in the PR template

* Apply suggestions from code review

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

* Rephrase Step 1, add command
2019-09-10 10:21:46 +02:00