Commit Graph

1179 Commits

Author SHA1 Message Date
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
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
André Silva ed449bf415 grandpa: fix until imported logging arg order (#3818) 2019-10-14 20:19:01 -04:00
Bastian Köcher e3ae647c42 Provide macro for exporting functions from wasm (#3801)
The macro generates the functions with the signature we expect for wasm
functions. This macro is useful for tests where we need to call into
wasm. Parameter passing is done by SCALE encoding the input and output
parameters.
2019-10-14 20:20:07 +02:00
André Silva 6e5fe1a557 deps: update clap and structopt (#3809) 2019-10-12 18:31:49 +01:00
yjh 625d697e26 fix comments (#3808)
Signed-off-by: yjhmelody <465402634@qq.com>
2019-10-12 11:32:29 +02:00
Caio f60bc521c3 Fix Typo (#3805)
The `chain::error::FutureResult` doc is currently referring to the wrong
structure
2019-10-12 00:16:51 +01:00
Bastian Köcher 4dbc9265ee Add execute_with to TestExternalities (#3793)
This function executes the given closure in a context where the test
externalities are set. This makes the srml tests easier to write, as the
test externalities need to be created anyway.
2019-10-10 15:01:30 +02:00
Kian Paimani 21fae718c4 Multi-limb arithmetic for runtime (#3743)
* First working version of all operations.

* New and improved version of everything.

* Minor cleanup.

* Fix build

* Finalize nignum

* Some final works on refactors and tests.

* fix build

* Some review comments

* Bench, better try into and nits

* mutify the API

* rename to big_uint

* unmutify.

* Remove resize

* Apply suggestions from code review

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

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

* BEtter proof

* Fix panic doc.

* Bump.
2019-10-10 09:52:08 +02:00
Demi Obenour 4da48dd9f5 Bump dependencies (#3787)
* Update dependencies, respecting semver

* Bump dependencies

* Don’t patch tiny-bip39 dependency
2019-10-09 12:29:28 -04:00
Bastian Köcher 8a39be474e Move Externalities into its own crate (#3775)
* Move `Externalities` into `substrate-externalities`

- `Externalities` now support generic extensions
- Split of `primtives-storage` for storage primitive types

* Move the externalities scoping into `substrate-externalities`

* Fix compilation

* Review feedback

* Adds macro for declaring extensions

* Fix benchmarks

* Introduce `ExtensionStore` trait

* Last review comments

* Implement it for `ExtensionStore`
2019-10-09 15:50:30 +02:00
André Silva 984c6ac839 babe: verify slots are strictly increasing (#3785)
* babe: re-use code to propose and import test block

* babe: add failing test for slot validation

* babe: verify slot numbers are strictly increasing
2019-10-08 21:56:22 +02:00
Weiliang Li 520009973f gossip: save sender for kept messages (#3738) 2019-10-08 16:16:24 +01:00
Jim Posen 6cebbbf8b2 Refactor NativeExecutor to support multiple Wasm execution methods (#3677)
* executor: Move definitions of externals out of wasm_executor module.

* executor: Create WasmRuntime trait.

This will be used to decouple the runtime cache from wasmi execution.

* executor: Remove WasmExecutor and move methods to wasmi_execution.

These will now be crate-internal functions and there is no need
for the struct.

* executor: Set default default_heap_pages in NativeExecutor.

* cli: CLI configuration for Wasm execution method.

* executor: Remove wasmi-specific code from wasm_runtime.

* Respond to review comments.
2019-10-08 12:57:12 +02:00
André Silva 7ecd8496a7 client: fix comparison of CachedHeaderMetadata in tree_route (#3776)
* client: fix comparison of CachedHeaderMetadata in tree_route

* client: add regression test for tree_route
2019-10-07 15:28:28 +02:00
Svyatoslav Nikolsky 32e687abe4 Fix state RPC subscriptions on light node (#3626)
* fetch all keys at once in light RPC subscriptions

* restore lost fil
2019-10-07 08:00:15 +02:00
Hernando Castano 168051c060 Make the purge-chain prompt a little nicer (#3772) 2019-10-06 15:44:32 +02:00
André Silva b181951bcc babe: prune the epoch tree on startup (#3768) 2019-10-05 10:44:07 +02:00
Marcio Diaz 65ef193ec8 Use header metadata in babe verify. (#3756)
* Use header_metadata in verify.

* Log hash in header_metadata error.

* Fix naming, error.
2019-10-05 10:43:19 +02:00
André Silva f1cdaae6de babe: small compilation fix (#3764)
* babe: fix type on find_pre_digest call

* fork-tree: optimize prune

* babe: fix test compilation
2019-10-04 19:55:03 +01:00
André Silva 49fb11a1ea babe: ancient epoch tree pruning (#3746)
* babe: prune epoch tree when importing a new epoch change

* fork-tree: fix tree pruning

* babe: actually prune epoch change fork tree

* Fix typos

* babe: add test for epoch tree pruning

* fork-tree: fix pruning of stale forks
2019-10-04 19:51:08 +02:00
Robert Habermeier b8e2f8f2d6 Decouple BABE from session (#3760) 2019-10-04 14:56:41 +02:00
Joshy Orndorff 99da0232ee Grammar (#3754) 2019-10-04 09:12:06 +02:00
Gavin Wood 251d33cb74 Split off TypeId so as not to pull in sr-io (#3740)
* Add type-id

* Builds with std now.

* Fix for cargo

* Remove unneeded stuff

* Move TypeId.
2019-10-03 12:37:37 +02:00
Wei Tang 18fa1d15ce Cumulative fixes to make working with consensus-pow easier (#3617)
* consensus-pow: add difficulty data to auxiliary

* Timestamp api

* Implement FinalityProofProvider for ()

* Add DifficultyApi

* Remove assumption that Difficulty is u128

* Use a separate trait for add instead of hard-code it as Saturating

* Some convenience functions to work with PowVerifier

* Try to fix mining unstability

* Fix generic resolution

* Unused best_header variable

* Fix hash calculation

* Remove artificial sleep

* Tweak proposer waiting time

* Revert sleep removal

The reason why it was there is because when mine_loop returns, it means an error
happened. In that case, we'd better sleep for a moment before trying again,
because immediately trying would most likely just fail.

* Pass sync oracle to mining

So that it does not mine when major syncing

* Expose build time as a parameter

Instead of hardcode it as previously 100ms.

* Update lock file

* Fix compile

* Support skipping check_inherents for ancient blocks

For PoW, older blocks are secured by the work, and can mostly be considered to
be finalized. Thus we can save both code complexity and validation time by
skipping checking inherents for them.

* Move difficulty fetch function out of loop

To make things faster

* Remove seed from mining

Each engine can use its own Rng source.

* Better comments

* Add TotalDifficulty definition for U256 and u128

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

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

* Rename TotalDifficulty::add -> increment

* Use SelectChain to fetch the best header/hash

* Update lock file
2019-10-03 11:02:20 +08:00
DemiMarie-parity 62b97a090d Upgrade dependencies whenever “easy” (#3556)
* Update all dependencies

* Upgrade dependencies whenever “easy”

“easy” means that there are no major changes required.

* Fix build and bump paste dependency to 0.1.6

* Remove dead code

* Re-add = dependency for futures-preview

* Add missing std features for runtime-io

* Remove git dependencies

as updated versions have been published to crates.io

* try to debug bug

* For sr-io, "std" should imply "no_oom" and "no_panic_handler".

Otherwise, rustc complains (correctly) about duplicate lang items.

* Add missing "runtime-io/std" features

* Fix compilation errors

* Prevent duplicate lang items

Rust does not allow duplicate lang items.  When compiled without the
`std` feature, `sr-io` defines two lang items.  Therefore, `sr-io`
compiled without `feature = "std"` must not be linked with `std`.

However, `pwasm-utils` and `wasmi-validation` both bring in `std` unless
compiled with `default-features = "false"`.  This caused a duplicate
lang item error.  Building both with `default-features = "false"`
prevents this error.  When building with `feature = "std"`, they should
both be built with the `std` feature, so this feature needs to be
explicitly depended on.

* Bump `impl_version`

* Make tests pass

Three tests used 1 less gas than they had previously.

* Try to un-break build

* Add a Cargo.lock file

* Revert offchain code

* Revert "Revert offchain code"

This reverts commit d216d08cc6ca0344614669c1d24cde3aa5c0d4e2.

* Don’t try to send a body with a GET request

without adding a Transfer-Encoding or Content-Length header.

This has always been wrong, but hyperium/hyper#1925 hid the bug until
hyper was upgraded to 0.12.35.

* Change some more GET requests to POST requests

* Fix excess line width and remove an `extern crate`

* Delete commented-out extern crate

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

* Fix regression in Cargo.toml files

dev-dependencies need `default-features = false`, too.

* Bump parity-wasm dependency

* Bump `futures-preview`

* Apply suggestions from code review

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

* Update Cargo.lock files

* Apply suggestions from code review

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

* Update core/service/src/chain_ops.rs

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>
2019-10-02 15:23:59 -04:00
Marcio Diaz f6bd58ac1f Optimize tree route to sync faster (#3665)
* Introduce HeaderMetadata and use it for tree_route. Add lowest_common_ancestor.
* Add tests.
2019-10-02 20:30:43 +02:00
DemiMarie-parity 8646cd158e BABE refactoring: split out verification (#3658)
* Refactor parts of BABE verification into separate module

* Fix silly compiler error

* Move more of the verification code to verification.rs

* Remove some unused imports

* Fix line width

* fix testsuite compile error

* Fix compile errors in tests

* Move authorship-related code to its own files

* fix compile errors in tests

* Respond to review comments by @rphmeier

* improve docs

* fix compile error

* Add missing doc comment
2019-10-02 15:51:49 +02:00
Tomasz Drwięga 90df6b3c6c Move offchain worker http helpers to sr-primitives. (#3733)
* Move offchain helpers to sr-primitives.

* Add some docs and fix tests.

* Refresh cargo.lock

* Bump runtime.

* Don't run offchain http example.
2019-10-02 10:03:18 +02:00
Alexandre R. Baldé 3907582457 Remove unused imports (#3737) 2019-10-02 00:10:37 +02:00
thiolliere 53e0ddee4e Use EncodeLike for storages traits (#3676)
* impl

* patch

* lock

* some refactor

* some avoided copy

* new api without ref for doublemap

* fix

* version bump

* fix

* point to incoming release

* use codec latest

* bumpd impl version

* fix unused

* fix

* Update srml/support/src/storage/mod.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-10-01 19:45:24 +02:00
André Silva 83d4764d46 grandpa: add identifier to UntilImported logging message (#3735)
* grandpa: add identifier to UntilImported logging

* grandpa: fix tests
2019-10-01 11:42:11 -04:00
Svyatoslav Nikolsky 387c31598d Prepare for asynchronous transaction validation in tx pool (#3650)
* async txpool API

* Update core/rpc/src/author/mod.rs

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

* Update core/transaction-pool/graph/src/pool.rs

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

* Pool -> Pool + ValidatedPool

* removed lost block_on when importing xt from network

* fix grumbles

* alias for future::Executor in rpc

* removed executor from Author RPCs

* Pool + SharedValidatedPool -> Pool

* fix compilation after merge

* another fix

* another fix
2019-10-01 12:14:25 +03:00
Ashley c545344c60 Add an Error type to Aura (#3688)
* Add an Error type to Aura

* Add Cargo.lock

* AuRa -> Aura

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-10-01 12:42:11 +08:00
Bastian Köcher f6c4c47b50 Give more information why conversion between native and runtime failed (#3720)
* Give more information why conversion between native and runtime failed

This adds the SCALE error description to the error when the conversion
between native and runtime failed.

* Fixes tests
2019-09-30 18:03:13 +02:00
Pierre Krieger 98879a2bdb Revert "core/sr-api-macros/Cargo.toml: Pin protobuf version (#3723)" (#3726)
This reverts commit 2b85a48c71.
2019-09-30 18:02:54 +02:00
Max Inden 2b85a48c71 core/sr-api-macros/Cargo.toml: Pin protobuf version (#3723)
* Cargo.toml: Pin protobuf version

The protobuf crate introduced a breaking change within its semver minor
update from 2.8.1 to 2.9.0. This commit ensures Substrate uses anything
within the 2.8 minor releases.

* Cargo.lock: Update

* core/sr-api-macros/Cargo.toml: Pin protobuf version

The protobuf crate introduced a breaking change within its semver minor
update from 2.8.1 to 2.9.0. This commit ensures Substrate uses anything
within the 2.8 minor releases.

* Revert "Cargo.toml: Pin protobuf version"

This reverts commit 4e293c741c5c4510cb1a347c444d1876d65ddb1e.

* core/sr-api-macros/Cargo.toml: Pin protobuf within dev-dependencies

* core/sr-api-macros/Cargo.toml: Add comment and link to Githu issue
2019-09-30 16:51:28 +02:00
Tomasz Drwięga 667ee95f5d ChainSpec extensions (#3692)
* Add some chainspec tests and make sure we validate it.

* Manual implementation of Extension + Forks definitions.

* Move chain spec to separate crate.

* Allow using ChainSpec with extensions.

* Renames.

* Implement Extension derive.

* Implement Extension for Forks.

* Support specifying fork blocks.

* make for_blocks work

* Support forks correctly.

* Add a bunch of docs.

* Make fork blocks optional.

* Add missing docs.

* Fix build.

* Use struct for check_block params.

* Fix tests?

* Clean up.
2019-09-29 01:05:36 +08:00
André Silva c555b9bf88 peerset: fix reserved nodes (#3706)
* peerset: fix handling of reserved only peering mode

* core: add cli parameter to enable reserved nodes only

* peerset: fix tests

* peerset: add test for priority only mode

* core: fix reserved only cli flag description

* peerset: extend docs on set_priority_only
2019-09-29 01:04:46 +08:00
Arkadiy Paronyan 3242d7f2b6 Explicit sync API for downloading important, possibly orphaned, forks (#3633)
* Explicit sync API

* Keep sync requests

* Don't request the finalized block we already have

* Dropping requests & docs

* Renamed a function
2019-09-28 14:02:36 +02:00
Sergei Pepyakin 85431e9adf Add a comment on the features. (#3714) 2019-09-28 19:14:28 +08:00
André Silva 26889679f3 cli: clean up flag descriptions (#3715) 2019-09-28 19:14:08 +08:00
Coenen Benjamin 53a43e92aa create some vectors with initial capacities (#3701)
Signed-off-by: Benjamin Coenen <benjamin.coenen@hotmail.com>
2019-09-27 11:46:53 +02:00
Alexey 62be947877 Enable runtime_api for Substrate service (#3709)
* added new_full_concrete for service

* line width fix

* Update node/cli/src/service.rs

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

* Update node/cli/src/service.rs

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

* Update node/cli/src/service.rs

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

* replaced new_full

* empty

* added backticks to pass ci
2019-09-27 11:43:25 +02:00
Wei Tang 3864d0e4da Update libsecp256k1 dep to 0.3.0 (#3711)
* Update libsecp256k1 dep to 0.3.0

* Bump impl_version
2019-09-27 09:48:29 +02:00
Bastian Köcher ba98168b71 Make TestOffchainExt panic on unknown requests (#3710)
* Make `TestOffchainExt` panic on unknown requests

* Fix test
2019-09-26 23:02:30 +02:00
Caio 0da34de380 Pointer does not implement Display (#3707)
Instead, use `Debug` for `debug_trace!`
2019-09-26 22:21:12 +02:00