Commit Graph

2528 Commits

Author SHA1 Message Date
Gav Wood d2e6d8c64d Emergency build fix on previous PR. 2019-10-25 15:19:36 +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
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
André Silva 022126f906 node-template: remove unnecessary on_exit guard (#3903) 2019-10-24 14:29:09 +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
André Silva 62a238a81b node: spawn grandpa voter as essential task (#3899)
* node: spawn grandpa voter as essential task

* node: stop babe authoring task on exit

* node: remove unnecessary future boxing

* Apply suggestions from code review
2019-10-24 10:14:32 +02:00
Ryan Bell 40a1f06419 Update README.adoc (#3900) 2019-10-24 09:29:58 +02:00
Pierre Krieger a6a60d77ba Split the telemetry net status report in two (#3887)
* Split the telemetry net status report in two

* Update core/service/src/lib.rs

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

* Remove clone()

* Move code to status_sinks.rs instead

* Add basic usage for status_sinks

* Update core/service/src/status_sinks.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-23 22:05:24 +02:00
Pierre Krieger eabdcbdd4f Remove support for secp256k1 for network keys (#3897) 2019-10-23 22:05:05 +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
Bastian Köcher d82216673c Throw an error if a bootnode is registered with two different peer ids (#3891)
* Throw an error if a bootnode is registered with two different peer ids

* Rename error

* Fix compilation :(

* Review feedback
2019-10-23 17:17:12 +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
Bastian Köcher 70fd47e209 Fix srml assets compilation with std feature (#3892) 2019-10-23 09:37:41 +02:00
Weiliang Li 5a07887535 gossip: futures 03 Receiver (#3832)
* gossip: futures 03 receiver

* fix gossip test

* use tokio 01

* add comment

* Update core/finality-grandpa/src/communication/mod.rs

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

* fix format

* rename

* remove tokio 01 runtime

* minor fix

* make stable happy
2019-10-23 08:23:47 +02:00
Bastian Köcher 5123a84f13 Support disabling the addition of the default bootnode (#3888) 2019-10-22 18:54:52 +02:00
Nikolay Volf 5a40da5cba Dry out author rpc tests (#3878) 2019-10-22 15:53:20 +02:00
Arkadiy Paronyan 378ea9db2f Fail on pruning mode change (#3882) 2019-10-22 15:52:38 +02:00
André Silva d70ab136e4 cli: disable pruning on validators (#3835) 2019-10-22 15:51:59 +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
Ashley 934d7aac1c Remove sr-arithmetic/fuzzer from workspace to fix windows builds (#3872)
* Remove sr-arithmetic/fuzzer from workspace to fix windows builds

* Remove sr-arithmetic/fuzzer from check_runtime.sh
2019-10-22 13:24:58 +02:00
Nikolay Volf d739e86798 fix ambiguity about start in doc (#3864) 2019-10-22 12:02:20 +02:00
yjh 8117ba6b31 refactor map macro for more general use (#3850)
* refactor map macro for more general use

Signed-off-by: yjhmelody <465402634@qq.com>

* use $(,)?

Signed-off-by: yjhmelody <465402634@qq.com>

* Update core/primitives/src/lib.rs

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

* Update core/primitives/src/lib.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
2019-10-22 11:37:52 +02:00
Tomasz Drwięga 16a5d43807 Improve logging for offchain transaction submission. (#3871) 2019-10-22 10:29: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
Tomasz Drwięga 1111d79ac1 Fix deserialization of Bytes (#3866)
* Update impl-serde to patch RPC.

* Add test.

* Fix long line.
2019-10-22 03:09:39 +02:00
Nikolay Volf b888f7db71 Use uniform quotes (#3867) 2019-10-21 21:40:22 +01:00
CrocdileChan 60d232c727 use ThreadPool to execute spawn_worker(fn) (#3836)
* use ThreadPool to spawn_worker()

* use ThreadPool to implement spawn_worker(fn)

* use ThreadPool to implement spawn_worker(f)

* update [dependencies] threadpool and num_cpus version

*  rm 'extern crate num_cpus'

* cargo.lock update

*  merge the newest cargo.lock

* Update Cargo.lock

* use Mutex to wrap OffchainWorkers.thread_pool

* format use crate

* use parking_lot::Mutex instead of std::sync::Mutex
2019-10-21 09:25:50 +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
Caio f5162edc83 It's Clippy time (#3806)
Fix some Clippy issues
2019-10-19 13:01:51 +02:00
Andrew Dirksen 470b62366f Change manual dependency on wasm-gc executable to an automatic cargo dependency. (#3854)
Improves user experience.
2019-10-19 10:38:19 +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
André Silva 356015e450 grandpa: pluggable voting rules (#3673)
* grandpa: support pluggable custom voting rules

* grandpa: add docs to grandpa voting rule

* grandpa: make voting rule mandatory

* grandpa: add test for voting rule

* node: add GRANDPA voting rule

* grandpa: pass backend to VotingRule

* core: fix docs in SelectChain::finality_target

* grandpa: implement 3/4 of unfinalized chain restriction as voting rule

* grandpa: rename AlwaysBehindBestBlock voting rule

* grandpa: fix tests

* grandpa: remove useless test

* grandpa: extend environemnt voting rule test

* grandpa: add proofs to unreachable statements

* grandpa: fix typo

* grandpa: fix docs
2019-10-18 13:07:41 -04:00
Svyatoslav Nikolsky 35f8cd19cb Support block revert operation in blockchain cache (#3401)
* support block revert operation in cache

* #[cfg(test)] -> fn unused_sink()

* swap conditions

* post-merge fix
2019-10-18 17:32:13 +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
Arkadiy Paronyan 3963bb58ff Persist block announcements (#3826)
* Persist block announcements

* Renamed sync requests to fork targets

* Fixed pruning detection condition
2019-10-18 16:44:39 +02:00
Bastian Köcher 3437d64115 Don't make ServiceBuilder require to have a finality proof provider (#3831)
specified
2019-10-18 16:05:23 +02:00
Max Inden abaaaaffbf core/finality-grandpa: Minor refactorings (#3825)
* core/finality-grandpa: Improve code comments

* core/finality-grandpa: Rename VoteOrPrecommit to PrevoteOrPrecommit

According to the Grandpa paper [1]:

> A vote is a block hash, together with some metadata such as round
number and the type of vote, such as prevote or precommit, all signed
with a voter’s private key.

To reduce confusion this patch makes the code consistent with the
research paper.

[1] https://github.com/w3f/consensus/blob/master/pdf/grandpa.pdf

* core/finality-grandpa: Add comment for NetworkStream concept

* core/finality-grandpa: Improve round_communication doc comment

* core/finality-grandpa: Rename PrevoteOrPrecommit to Vote

* core/finality-grandpa: Represent NetworkStream state machine as enum

* core/finality-grandpa: Improve KeepTopics comment
2019-10-18 15:01:14 +01:00
h4x3rotab 31eebdf32b Fix typo (#3853)
In `core/client/src/client.rs`: "innacurate" -> "inaccurate"
2019-10-18 15:00:45 +02:00
Shawn Tabrizi c1a24fb537 Switch node template to use AuRa (#3790)
* Stuck on service

* Make service compile

* Remove Grandpa dependency

* Update node-template/runtime/Cargo.toml

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

* Fix build

* Update crypto import

* Update node-template/src/service.rs

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

* Update node-template/src/service.rs

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

* Update node-template/src/service.rs

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

* Update node-template/src/service.rs

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

* Update node-template/runtime/src/lib.rs

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

* Fix macro dependency

* Trying to add grandpa back

* Update node-template/src/chain_spec.rs

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

* Update node-template/src/chain_spec.rs

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

* Update node-template/src/chain_spec.rs

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

* Update node-template/src/service.rs

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

* Update node-template/src/service.rs

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

* Unused import

* Use grandpa block import
2019-10-18 11:58:31 +01:00
Xiliang Chen bf1786b628 remove unused file (#3851) 2019-10-18 12:58:04 +02:00