Commit Graph

2687 Commits

Author SHA1 Message Date
cheme 05391f7e04 State machine call proof backend (#3945)
* drafting a proof extraction at the hashdb level (to include everything
for the 'call' proof case).

* use full proof by default (replace previous proof recorder).

* fix warnings.

* Cache value not found in proof recorder.

* Remove need or internal backend struct.

* fix type.

* doc
2019-11-12 16:57:37 +01:00
Nikolay Volf 61e43218e5 Randomized tests on storage cache (#4070)
* randomized tests

* destroy clones

* remove commented

* fixes

* add finalization fork
2019-11-12 16:57:21 +01:00
Arkadiy Paronyan 95d1bf0e41 Sensible limits for known blocks and extrinsics (#4094) 2019-11-12 16:57:03 +01:00
Kian Paimani efedac734d Weight annotation for block hooks. (#4058)
* Initial version that works with proper tests.

* get rid of todos and grumbles and such.

* Cleanup and fix line-width

* fix test runtime test
2019-11-12 14:42:38 +01:00
Demi Obenour ab1b98fee5 Bump dependencies with cargo update (#4087)
This lets us drop a couple old dependencies, which is nice.
2019-11-12 14:04:09 +01:00
Arkadiy Paronyan d40abed4a5 Fix sync stalling on moving head (best block) prior to the tip of the chain sometimes (#4091)
* Work around finalization woes

* Fixed check_block

* Added a test
2019-11-12 13:54:11 +01:00
Gavin Wood c91d42712a Do nothing for zero imbalances (#4089) 2019-11-12 09:42:32 +01:00
Weiliang Li bff16d906d update tiny-keccak (#4093)
* update tiny-keccak

* fix

* Update Cargo.toml

* update Cargo.lock

* remove keccak-hasher
2019-11-12 09:35:46 +01:00
Gavin Wood f1427d51f8 EVM should store contracts' balances in an account. (#4090) 2019-11-12 09:34:08 +01:00
Bastian Köcher 5504b4b2dc Fix runtime interface docs and remove accidentally added file (#4092) 2019-11-12 00:25:13 +01:00
Bastian Köcher 2ecffa1cd0 Refactor sr-api to not depend on client anymore (#4086)
* Refactor sr-api to not depend on client anymore

* Fix benches

* Apply suggestions from code review

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

* Apply suggestions from code review
2019-11-11 16:26:49 +01:00
Max Inden e26d1a0b3e [WIP] .gitlab-ci.yml: Fix a check for polkadot to work on forked repos v2 (#4078)
* Fix a check for polkadot to work on forked repos.

* .gitlab-ci.yml: Add `git diff` for CI debugging

* More future proof and less redundant.

* .gitlab-ci.yml: Improve comments and refactor sed command

* .gitlab-ci.yml: Remove two commas in a row

* .gitlab-ci.yml: Ensure to match branch statements at the end

* .gitlab-ci.yml: Reference concrete commit

When one does not specify the concrete commit, cargo-update tries to
checkout 'master' in the Substrate repository.

* .gitlab-ci.yml: Remove 'git diff' debug line
2019-11-11 14:49:15 +01:00
Talha Cross daa0e0e91b core/consensus: fix console output for slot duration (#4085) 2019-11-11 13:31:38 +01:00
Arkadiy Paronyan 59ec4cb071 Don't request old obsolete blocks (#4084) 2019-11-11 11:34:53 +01:00
Arkadiy Paronyan a62dcd5a13 Cleanup filtered messages (#4082) 2019-11-11 11:34:23 +01:00
Tomasz Drwięga 57ab3aeb82 Typed chain state queries over rpc. (#4079)
* Create typed client helpers for querying chain state storage items declared by
'decl_storage!'.

* Update substrate-rpc-custom functions to use async await syntax.

* The implementation of substrate-rpc-custom was a bit verbose and repetitive.
This commit makes the implementation simpler by intruducing a struct which
represents query for a typed value in storage. The new struct is called
StorageQuery. A StorageQuery wraps a raw StorageKey but is not directy
constructable. To construct a StorageQuery, the user must supply an
implementation of a srml_support::storage::generator trait such as
StorageValue or StorageMap.

A type implementing one of the generator traits can be aquired by:
A) marking a storage item as pub within a call to decl_storage (recommended)
or B) implementing one of the generator types manually.

While option B may sometimes me necessary, it's not recommended because
separate manual implementaions may lose sync with the original definition.

* drop unused dependency

* fmt

* Remove unnecessary pub from Authorities field in test-runtime storage
declaration.

This field was added to support a test in an earlier commit. The
test no longer relies on test-runtime so the change can be reverted.

* Move it to srml as support extension.

* Fix long lines.

* Fix.
2019-11-11 02:01:15 +01:00
Arkadiy Paronyan bb0736cdba Allow ancient fork download after ancestry search (#4080) 2019-11-11 01:23:41 +01:00
Kian Paimani ed5d31a22b Remove Self vote from phragmen (#4081)
* first draft of everything that works

* Some test fixes
2019-11-11 00:41:44 +01:00
Bastian Köcher b691cfe093 Substrate runtime interface 2.0 (#4057)
* Adds first version of traits for generating the host functions

* First steps of the procedural macro

* Implements generation of the host extern functions

* Prefix ext host function with snake case trait name

* Implement host functions implementation on the host

* Change `HostFunctions` interface

* Implement `HostFunctions` for tuples

* Make `WasmExecutor` generic over the host functions

* Begin to add a test and make it compile

* Make the test succeed

* Add test to ensure that host functions are not found

* It's alive! Make the `set_storage` test work

* Add test for mutable references

* Code cleanup and documentation etc

* Add marker trait for types that should be passed as SCALE encoded

* Inherit the visibility from the trait and more improvements

* More impls and move them into their own file

* Code simplification by dropping one trait

* Give it a better name

* Implement traits for arrays

* Refactor code to support pass by codec/inner

* Docs

* Implement pass by inner for some crypto types and add a test

* Implement exchangeable function support

* Rewrite sr-io with as runtime interface

* Start reworking after master merge

* Adds `PassByCodec` derive

* Adds `PassByInner` derive

* Fix compilation errors

* More implementations

* Implement runtime interface traits for `str`

* Make `sr-io` compile again

* Fix more compilation errors

* More progress on getting stuff back to compile

* More compilation fixes

* Fix warnings

* Remove le conversions

* Add support for `wasm_only` interfaces

* Implement `Allocator` interface

* Improve error message

* Move `WasmAllocator` to `sr-io` and more clean ups

* Use correct function signature for wasm functions

* Store the host functions with the Wasm runtime

* Docs update

* Fix compilation after master merge

* Remove `sr-io/without_std`

* Make `srml-support` tests run again

* More compilation error fixes

* Use correct doc syntax

* Fix test-runtime

* Fix compilation

* Catch native panics when executing the wasm runtime

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.

* Fix compilation

* Don't panic in a panic

* Move `sr-sandbox` to new runtime interface

* Fixes tests after sandbox changes

* Make sure we detect invalid utf8

* Fixes after master merge

* Adds pass by enum strategy

* Fix wasmtime integration

* Some macro structure clean up

* Rework and test exchangebale host functions

* PassBy derive macros documentation

* Docs for `runtime_interface` macro

* Support wild card argument names

* Adds ui tests

* Make sure that we are backwards compatible to the old runtime interfaces

* Documentation

* Fixes after latest master merge

* Make `wasmtime` happy

* Make `full_crypto` work

* Make the new interface versionable

* Rename `Sanboxing` to `Sandbox`

* Don't finalize in test while importing

* Fix Performance regression

* Fix test
2019-11-10 21:59:30 +01:00
André Silva f4c1c83667 srml-timestamp: define max timestamp drift in millis (#4077)
* srml-timestamp: define max timestamp drift in millis

* srml-timestamp: suffix MAX_TIMESTAMP_DRIFT with unit
2019-11-10 19:49:55 +01:00
Arkadiy Paronyan 7349a3a217 Don't search for authority set change block if delay is zero (#4076) 2019-11-10 19:09:36 +01:00
Arkadiy Paronyan c58a9b7f05 Don't update common block on ancient block import (#4073) 2019-11-10 13:35:15 +01:00
Tomasz Drwięga f5f4c2d480 Change max width to 100. (#4072) 2019-11-10 13:01:44 +01:00
Pierre Krieger 401e213aa2 Add a --no-private-ipv4 CLI option (#4042)
* Add a --no-private-ipv4 CLI option

* Fix tests

* Fix tests
2019-11-10 11:14:36 +01:00
Arkadiy Paronyan 9defa6a281 Further fix for common block update (#4071) 2019-11-09 15:46:43 +01:00
Pierre Krieger f90fd34f81 Pass startup_time to telemetry (#4069) 2019-11-09 13:58:00 +01:00
Tomasz Drwięga b5469c6e0c Additional logging for the transaction pool. (#4068)
* Additional logging for the pool.

* Long line.
2019-11-09 13:22:21 +01:00
Arkadiy Paronyan 4e54dfac14 Improved cache documentation (#4067) 2019-11-09 12:36:47 +01:00
Bastian Köcher 38ac53434c Fix the ui tests (#4066) 2019-11-09 10:34:17 +01:00
André Silva 94a5fcd9a6 grandpa: remove the periodic block announcer (#4062)
* grandpa: remove the periodic block announcer

* grandpa: remove periodic block announcer test
2019-11-09 09:11:24 +01:00
Arkadiy Paronyan 4b8578e7e4 Fix sync downloading ancient chains (#4060)
* Update best block on announcement

* Added a test
2019-11-09 09:11:13 +01:00
Joshy Orndorff 1789ed732f Fix minor comment typo "do" -> "do not" (#4054) 2019-11-08 21:37:38 +01:00
Arkadiy Paronyan 2cd3b2bce1 Batch gossip messages (#4055) 2019-11-08 21:34:45 +01:00
Tomasz Drwięga c3f6e5bd40 Introduce thread pool for transaction validation. (#4051) 2019-11-08 21:34:30 +01:00
André Silva a8ce80b72d grandpa: progressively increase target gossip peers (#4050)
* grandpa: stricter gossip message filtering

* gossip: remove filtered message on send_message

* gossip: add test for tracking of broadcast attempts

* grandpa: only restrict gossip if we're connected to more than 5 authorities

* grandpa: add test for progressive gossip

* grandpa: add test for gossip filtering on local non-authority node

* grandpa: fix doc

* gossip, grandpa: tabify

* grandpa: relax filtering logic for global messages
2019-11-08 20:08:14 +01:00
thiolliere 77407e1694 fix inmemory (#4049) 2019-11-08 14:07:51 +01:00
Demi Obenour 5a26696432 Remove dependencies on OpenSSL (#4036)
* Remove dependency on hyper-tls

This removes one of the dependencies on native-tls, and thus on OpenSSL.
I will remove the other in a separate commit.

* Remove the `HttpClient` enum

It only had one variant.

* Apply suggestions from code review

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
2019-11-08 13:29:03 +01:00
Arkadiy Paronyan dfded93411 Increase parallel downloads to 5 (#4045)
* Increase parallel downloads to 5

* CLI param
2019-11-08 11:24:46 +01:00
B YI 2125b87cae fix two typos (#4048) 2019-11-08 09:27:33 +01:00
Weiliang Li 63a1a5b7f8 clean node/cli/Cargo.toml (#4046)
* clean node/cli/Cargo.toml

* minor fix

* clean node/runtime/Cargo.toml
2019-11-08 08:54:45 +01:00
Jim Posen d9c2ac5fd7 Correctly serialize code in chain spec as hex (#4025)
* Correctly serialize code in chain spec as hex.

Due to a bug, the runtime code was previously serialized as a JSON
array of numbers, pretty printed one byte per line.

* Remove panic in macro and whitelist attribute types for storage
genesis config lines.

* Use syn::Error to enforce whitelisted attributes on genesis config.

* Blacklist genesis extra config line attributes instead of whitelist.
2019-11-07 18:40:04 +01:00
Arkadiy Paronyan cca9ab436c Allow import withouth state verification (#4031)
* Allow import without state verification

* Explicit None

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>
2019-11-07 15:25:41 +01:00
Jim Posen 021f3a3f06 grandpa: Use storage proofs for Grandpa authorities (#3985) 2019-11-07 14:31:17 +01:00
Gavin Wood bb6b3db57e Refactor out MaxPossibleReward, fix staking arithmetic (#4041)
* Refactor out MaxPossibleReward, fix staking arithmetic

* Fix rounding error in test
2019-11-07 12:34:13 +01:00
Tomasz Drwięga dcee91412c Check polkadot compilation. (#3980)
* Check polkadot compilation.

* Fix git grep.

* Make sure to update properly. Use commit hash instead.
2019-11-07 12:05:22 +01:00
Nikolay Volf 745b68bfa9 Improve auto-docs a little. (#4032) 2019-11-07 12:04:56 +01:00
Arkadiy Paronyan 8de6279300 Ban incoming invalid transactions (#4037) 2019-11-07 12:03:23 +01:00
Ashley 3a7b1b9da5 Add ExistenceRequirement to Currency trait (#4000)
* Added a public transfer_some function and a private transfer_inner fn

* Move transfer_some to the end of the module impl to fix failing contracts test

* Change whitespace

* Remove needless change to transfer logic

* Fix error

* Update srml/balances/src/lib.rs

Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Improve documentation and add test

* Update srml/balances/src/lib.rs

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

* Switch to changing Currency trait instead
2019-11-07 12:01:47 +01:00
Arkadiy Paronyan e73436d818 Decrease peer reputation on bad transactions (#4035)
* Decrease reputation on bad transactions

* Don't punish on duplicate transactions
2019-11-07 12:00:14 +01:00
Yuanchao Sun 9515d34aee Also replace paths in [build-dependencies] (#4039)
* Also replace paths in [build-dependencies]

* Update scripts/node-template-release/src/main.rs

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

* Slightly reduce memory usage

* Update scripts/node-template-release/src/main.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-11-07 11:48:30 +01:00