Commit Graph

2536 Commits

Author SHA1 Message Date
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
Kian Paimani 53e8200fb5 Update CONTRIBUTING.adoc (#3842)
* Update CONTRIBUTING.adoc

* fix typos

* Update CONTRIBUTING.adoc

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-10-18 12:41:57 +02:00
cheme d9cffa0bb5 Code redundancy between ext implementation and testing. (#3830)
* fix child_storage_hash

* extract common implementation for ext and testing

* cleaning impl.

* replace ExtBasisMut by actual Ext

* remove extbasis.

* Update tests to use Ext from test externalities.

* use Ext constructor for getting ext from TestExternalities.

* Add missing extensions from ext.

* fix wasmi test

* Fix merge error.
2019-10-18 09:52:25 +02:00
kwingram25 fddfcbacea Use Bytes for contract rpc input_data (#3841)
* Use Bytes for contract input_data

* Update srml/contracts/rpc/src/lib.rs
2019-10-18 09:28:48 +02:00
André Silva 5b9952ef1c grandpa: don't expire next round messages (#3845)
* grandpa: don't expire next round messages

* grandpa: fix test

* grandpa: first round in set is 1

* grandpa: fix test

* grandpa: update doc
2019-10-17 19:25:18 -04:00
Bastian Köcher 8051fd5445 Don't panic when we try to register 2 global loggers (#3840) 2019-10-17 17:35:41 -04: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
Bastian Köcher 1711483fb6 Make VersionInfo derive Clone (#3839) 2019-10-17 12:54:28 +02:00
Ashley 411b8f96d4 Add error types to BABE and PoW (#3827)
* Add an error type to Babe

* Add an error type to PoW

* Simplify error enum variant names

* Update core/consensus/babe/src/lib.rs

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

* Add missing newline

* Split up DataProvider into CreateInherents and CheckInherents
2019-10-17 12:34:03 +02:00
Bastian Köcher 81c400e958 Make wasmi_execution public to use it from tests (#3829)
* Make `wasmi_execution` public to use it from tests

* Make `WasmRuntime` accessible as well

* Add `call_in_wasm` instead of making stuff public

* Use `WasmRuntime`

* Move test

* More feedback
2019-10-16 21:00:31 +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
Ashley 642c8504c4 WIP: Node role RPC call (#3719)
* Add a Node Role RPC call

* Formatting

* Fix tests

* Change tests to use NodeRole::Authority so I don't forget to update the test

* Improve role checking

* return a vec instead

* fix tests
2019-10-16 11:59:25 +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
Demi Obenour 6a2afdb204 Bump dependencies, respecting semver (#3812) 2019-10-15 18:33:33 +02:00
André Silva 6c0e9fb107 chain spec builder: add generate mode for authority keys (#3811)
* core: use trait object for genesis constructor

* chain-spec-builder: use structopt

* chain-spec-builder: add new command to generate authority keys

* chain-spec-builder: use ? in main

* chain-spec-builder: fix stored and printed suri from seed

* chain-spec-builder: add comment about created keystore folders

* chain-spec-builder: simplify file write
2019-10-15 15:07:56 +01:00
Tomasz Drwięga 9fe8ee4197 Fix asynchronous transaction rejections. (#3817)
* Fix handling transaction pool errors.

* Add test.

* Review suggestions.
2019-10-15 11:16:10 +02:00