Commit Graph

4219 Commits

Author SHA1 Message Date
Amar Singh bf4e5d4d2c add ios to cfg gates in client/service (#6622)
* done

* sysinfo should not be not android

* add back sysinfo dep to satisfy web wasm ci
2020-07-09 21:01:49 +02:00
Bastian Köcher 5bb834cc6f Make init_logging more easily usable (#6620)
Instead of requiring the `LogRotationOpt`, it now requires an
`Option<LogRotationOpt>`. This makes it much more easy to use the
interface when someone isn't interested on the `LogRotationOpt`'s
2020-07-09 14:47:57 +00:00
Ashley 234e7d0c3d Simplify a few chain components creation APIs related to the service (#6611)
* Simplify a few chain components creation APIs related to the service

* Fix basic-authorship doc tests

* Remove DefaultQueue

* Update client/service/src/builder.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Move ExecutionExtensions comment around

* Remove unused BlakeTwo256

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2020-07-09 15:43:04 +02:00
Alexander Theißen 25de5b5c78 seal: Rework contracts API (#6573)
* Transition getter functions to not use scratch buffer

* Remove scratch buffer from ext_get_storage

* Remove scratch buffer from ext_call

* Remove scratch buffer from ext_instantiate

* Add ext_input and remove scratch buffer

* Rework error handling (changes RPC exposed data)

* ext_return passes a flags field instead of a return code
	* Flags is only for seal and not for the caller
	* flags: u32 replaced status_code: u8 in RPC exposed type
* API functions use a unified error type (ReturnCode)
* ext_transfer now traps on error to be consistent with call and instantiate

* Remove the no longer used `Dispatched` event

* Updated inline documentation

* Prevent skipping of copying the output for getter API

* Return gas_consumed from the RPC contracts call interface

* Updated COMPLEXTITY.md

* Rename ext_gas_price to ext_weight_to_fee

* Align comments with spaces

* Removed no longer used `ExecError`

* Remove possible panic in `from_typed_value`

* Use a struct as associated data for SpecialTrap::Return

* Fix nits in COMPLEXITY.md

* Renamed SpecialTrap to TrapReason

* Fix test

* Finish renaming special_trap -> trap_reason

* Remove no longer used get_runtime_storage

* fixup! Remove no longer used get_runtime_storage

* Removed tabs for comment aligment
2020-07-09 13:07:02 +00:00
Cecile Tonglet a4427f3635 Clean exit when no space left on device (#6339)
Fixes #6305
2020-07-09 14:58:29 +02:00
Pierre Krieger ef8572f10d Add an authority_discovery_known_authorities_count metric (#6614) 2020-07-09 12:32:55 +00:00
Bastian Köcher 389faaf5c8 Rename CheckEra to CheckMortality (#6619) 2020-07-09 12:28:05 +00:00
Cecile Tonglet 7e37e79317 Improved send_transaction helper to return an error in case of error (#6592) 2020-07-09 12:10:34 +02:00
Alan Sapede 20d403aebe Make evm errors public (#6598) 2020-07-09 09:51:21 +00:00
David Craven 4d209543b9 Fix build when with-kvdb-rocksdb is disabled. (#6546) 2020-07-08 22:46:53 -04:00
Shawn Tabrizi 2302898b8a Add WeightInfo to all pallets with benchmarks. (#6575)
* Start adding weight info

* More weightinfo

* finish weight info

* more fixes

* inital update of node runtime

* fix the rest of the compilation

* update balances

* add docs

* fix balances tests

* Fix more tests

* Fix compile

* Fix pallet-evm tests
2020-07-08 18:22:01 +02:00
Bastian Köcher 94cddee160 Improve transaction submission (#6599)
* Improve transaction submission

Before this pr the transaction pool validated each transaction, even if
the transaction was already known to the pool. This pr changes the
behavior to first check if we are already aware of a transaction and
thus, to only validate them if we don't know them yet. However, there is
still the possibility that a given transaction is validated multiple
times. This can happen if the transaction is added the first time, but
is not yet validated and added to the validated pool.

Besides that, this pr fixes the wrong metrics of gossiped transactions
in the network. It also moves some metrics to the transaction pool api,
to better track when a transaction actually is scheduled for validation.

* Make sure we don't submit the same transaction twice from the network concurrently

* Remove added listener call

* Feedback

* Ignore banned on resubmit
2020-07-08 17:42:42 +02:00
Max Inden faa72caf91 *: Update to libp2p v0.21.1 (#6559)
* *Cargo.toml: Update versions

* client/network/src/discovery: Adjust to Kademlia  API changes

* client/network: Adjust to one_shot.rs changes

* client/network/discovery: Log address list on trace level

* client/network/discovery: Ignore RoutablePeer and PendingRoutablePeer

* Commit Cargo.lock

* Finish update

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-07-08 14:00:30 +00:00
Pierre Krieger 8ca05879e8 Send Status message on all newly-opened legacy substreams (#6593)
* Send Status message on all newly-opened legacy substreams

* Fix tests
2020-07-08 11:44:51 +00:00
pscott 6eb2eb81c5 Add log rotation (#6564)
* Use flexi_logger; Add log rotation

* Add default rotation; Add FlexiLogger error

* Fix compilation error

* Remove logging to stdout if it's not a tty

* Fix formatting

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

* Remove needless debug statement

* Default to unlimited size for log rotation

* Add more comments about log-age option

* Remove unused variable

* Fix typo in comment

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-07-08 10:11:09 +00:00
Max Inden 62f306d972 client/network: Rename DebugInfoBehaviour to PeerInfoBehaviour (#6556)
Information retrieved via `DebugInfoBehaviour` is not only used for
debugging purposes, e.g. disconnecting from nodes not responding to
pings, using external addresses retrieved via indentify, ...

In order for the name to reflect the usage of the module this commit
renames it.
2020-07-08 09:08:47 +00:00
Bastian Köcher ce0b55ff09 Upgrade kvdb-*, trie-db and memory-db (#6584)
* Upgrade `kvdb-*`, `trie-db` and `memory-db`

The updates of `trie-db` and `memory-db` are important, as they fix the
non-deterministic build of Polkadot/Substrate.

* Change `trie-db` version

* Update test-utils/runtime/Cargo.toml

Co-authored-by: Andronik Ordian <write@reusable.software>

* Update primitives/trie/Cargo.toml

Co-authored-by: Andronik Ordian <write@reusable.software>

* Update `Cargo.lock` and `trie-bench`

* Fix UI tests

* Switch to fixed version of memory-db

Co-authored-by: Andronik Ordian <write@reusable.software>
2020-07-08 10:42:56 +02:00
Shaopeng Wang a6702b7121 decl_module! macro: use 'frame_system' instead of system as default ident (#6500)
* Use frame_system as default ident.

* Remove unused 'frame_system' to 'system' renaming.

* Fix construct_runtime_ui tests.

* Rename system to frame_system in sudo/utility pallet test.

* Bump runtime impl_version.

* Update formatting.
2020-07-07 23:06:21 +00:00
Pierre Krieger 36cf6e7dc4 Use async/await in build_network_future (#6533)
* Use async/await in build_network_future

* Address concerns

* Fix test
2020-07-07 10:32:30 +00:00
Bastian Köcher cccf57a79f Fix UI tests (#6589) 2020-07-07 11:41:55 +02:00
Shawn Tabrizi fe79b24692 Derive RuntimeDebug for Runtime (#6581) 2020-07-06 10:51:01 +00:00
Bastian Köcher ad2e832289 Don't require module name in inherents (#6576)
* Start

* Cleanup `construct_runtime!`

* Add tests

* Fix after merge

* Update the docs
2020-07-06 10:29:17 +00:00
Shawn Tabrizi 2019f70768 Benchmarks Writer CLI (#6567)
* initial mockup

* add and wipe

* track writes

* start to add to pipeline

* return all reads/writes

* Log reads and writes from bench db

* causes panic

* Allow multiple commits

* commit before ending benchmark

* doesn't work???

* fix

* Update lib.rs

* switch to struct for `BenchmarkResults`

* add to output

* fix test

* line width

* @kianenigma review

* Add Whitelist to DB Tracking in Benchmarks Pipeline (#6405)

* hardcoded whitelist

* Add whitelist to pipeline

* Remove whitelist pipeline from CLI, add to runtime

* clean-up unused db initialized whitelist

* Add regression analysis to DB Tracking (#6475)

* Add selector

* add tests

* debug formatter for easy formula

* initial idea

* use all benchmarks

* broken

* working without trait

* Make work for multiple pallets

* Fix merge issues

* writer appends to file

* implement () for balances weight trait

* update name of trait

* Weights to WeightInfo

* auto trait writer

* Heap pages are configurable

* clean out runtime changes

* more clean up

* Fix string generation

* Update comments

* Update bin/node/runtime/src/lib.rs

Co-authored-by: arkpar <arkady.paronyan@gmail.com>
2020-07-06 09:34:24 +00:00
André Silva a9c21b8b84 babe: report equivocations (#6362)
* slots: create primitives crate for consensus slots

* offences: add method to check if an offence is unknown

* babe: initial equivocation reporting implementation

* babe: organize imports

* babe: working equivocation reporting

* babe: add slot number to equivocation proof

* session: move duplicate traits to session primitives

* babe: move equivocation stuff to its own file

* offences: fix test

* session: don't have primitives depend on frame_support

* babe: use opaque type for key owner proof

* babe: cleanup client equivocation reporting

* babe: cleanup equivocation code in pallet

* babe: allow sending signed equivocation reports

* node: fix compilation

* fix test compilation

* babe: return bool on check_equivocation_proof

* babe: add test for equivocation reporting

* babe: add more tests

* babe: add test for validate unsigned

* babe: take slot number in generate_key_ownership_proof API

* babe: add benchmark for equivocation proof checking

* session: add benchmark for membership proof checking

* offences: fix babe benchmark

* babe: add weights based on benchmark results

* babe: adjust weights after benchmarking on reference hardware

* babe: reorder checks in check_and_report_equivocation
2020-07-04 12:18:13 +02:00
Wei Tang 61635e75c1 pallet-evm: return Ok(()) when EVM execution fails (#6493)
* pallet-evm: return Ok(()) when EVM execution fails

* Bump spec version

* Init test module

* Add fail_call_return_ok test

* Fix tests and use full match pattern

Co-authored-by: Gav Wood <gavin@parity.io>
2020-07-04 11:57:50 +02:00
André Silva e3ba163714 ci: fix merge on polkadot companion job (#6574) 2020-07-03 21:07:11 +02:00
Gavin Wood f744d6911e Make the encoded-Call Vec<u8> explicitly so in metadata (#6566) 2020-07-03 19:29:35 +02:00
Cecile Tonglet 9c566f54b8 Remove polkadot companion detection from branch name (#6568)
* Initial commit

Forked at: 2ddbbd7c08
Parent branch: origin/master

* Remove polkadot companion detection from branch name

Even though it was nice it was also error prone as there were no indication whatsoever on the PR
that a polkadot companion branch exists.
2020-07-03 19:16:32 +02:00
André Silva fb2fa25331 primitives: use generic Header in testing runtime (#6561)
* primitives: use generic Header in testing runtime

* frame: remove unused imports

* Remove warning

Co-authored-by: Bastian Köcher <git@kchr.de>
2020-07-03 17:07:46 +00:00
Cecile Tonglet 2ddbbd7c08 Remove polkadot companion detection from branch name (#6565)
* Initial commit

Forked at: f54614e256
Parent branch: origin/master

* Remove polkadot companion detection from branch name

Even though it was nice it was also error prone as there were no indication whatsoever on the PR
that a polkadot companion branch exists.
2020-07-03 17:29:08 +02:00
Cecile Tonglet f54614e256 New testing helpers (#6555)
* Initial commit

Forked at: 424d5c722d
Parent branch: origin/master

* Add send_transaction to RpcHandlers

* Extension trait for RpcHandlers

* Revert "Add send_transaction to RpcHandlers"

This reverts commit 03c89e13d404bae3f3123387dd50f026061bca82.

* Add an extension trait for BlockchainEvents

* Update test-utils/client/src/lib.rs

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

* Update test-utils/client/src/lib.rs

* fix

* deps fix

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-07-03 09:49:42 +00:00
Max Inden 635310c8d4 client/network: Remove unused Result returned by NetworkWorker (#6552) 2020-07-02 15:18:08 +02:00
Bastian Köcher 4f7f312be5 Move create_inherents into the block-builder (#6553)
* Move `create_inherents` into the block-builder

This moves the `create_inherents` call into the block-builder. This has
the advantage that `create_inherents` will be able to reuse the same
context that will be used when applying the extrinsics and we also save
one call to `on_initialize`. To make sure that `create_inherents` does
not modify any state, we execute it in a transaction that is
rolled-back after doing the runtime call.

* Feedback and build fix

* Update primitives/runtime/src/lib.rs

Co-authored-by: Sergei Shulepov <sergei@parity.io>

* Update client/block-builder/src/lib.rs

Co-authored-by: Sergei Shulepov <sergei@parity.io>
2020-07-02 15:17:14 +02:00
Xiliang Chen e1d0f84c67 Allow specify schedule dispatch origin (#6387)
* allow specify schedule dispatch origin

* fix tests

* use caller origin for scheduled

* fix tests

* line width

* check origin for cancel

* line width

* fix some issues for benchmarking

* fix doc test

* another way to constraint origin

* fix build issues

* fix cancel

* line width

* fix benchmarks

* bump version

* enable runtime upgrade

* add migration code and test

* Update frame/scheduler/src/lib.rs

Co-authored-by: Gavin Wood <github@gavwood.com>

* expose migration method

* add notes

* bump version

* remove on_runtime_upgrade

* fix test

Co-authored-by: Gavin Wood <github@gavwood.com>
2020-07-02 15:05:15 +02:00
pscott 540ae1c161 Update SubstrateCli to return String (#6550)
* Update SubstrateCli to return String

* Add default implementation for executable_name()

* Use display instead of PathBuf

* Get file_name in default impl of executable_name

* Remove String::from and use .into()

* Use default impl for executable_name()

* Use .as_str() and remove useless .to_string()

* Update only sp-io when running companion build

* Remove unneeded update of sp-io in CI

Co-authored-by: Cecile Tonglet <cecile@parity.io>
2020-07-02 13:34:56 +02:00
Cecile Tonglet 7b0028d75a Drop the tokio runtime before the task_manager (#6548)
* Initial commit

Forked at: ece0364170
Parent branch: origin/master

* Drop the tokio runtime before the task_manager

The tokio runtime must be dropped before the task_manager. Otherwise the objects the task_manager
keep alive are dropped before the tasks are finished.
2020-07-02 13:02:08 +02:00
Ashley 5f751e4472 Remove ServiceBuilderCommand and implement the chain ops as standalone functions instead. (#6543)
* :)

* Slight tidy

* Remove ServiceBuilderCommand

* Remove whitespace

* Keep task manager alive for check_block/import_blocks

* Pass task_manager to run_until_exit

* Make task_manager in run_until_exit and make subcommands async

* Change the async_run fn to return a future and task manager

* async_run should take a result fn

* Apply suggestions from code review

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

* Fix spaces in export_raw_state

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-07-02 12:57:56 +02:00
cheme 424d5c722d Restrict Protected to some heap types. (#6471)
* Restrict `Protected` to some heap types.

* Comment abut Protected usage.

* Remove Protected from crypto, use secrecy crate for existing uses.

* use a parse function

* fix error convert

* Rename and move secretY string function.

* std result
2020-07-01 09:59:07 +00:00
s3krit ece0364170 [CI] Add Github Action to notify devops of PRs labelled with A1-needsburnin (#6525)
* add burnin-label-notification.yml

* fix burnin-label-notification.yml

* fix burnin-label-notification.yml

* fix burnin-label-notification.yml

* fix burnin-label-notification.yml

* Update .github/workflows/burnin-label-notification.yml

Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>

Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Gav Wood <gavin@parity.io>
2020-07-01 11:33:28 +02:00
s3krit c3ee172804 Fix auto-label-issues.yml (#6536)
statements in github actions cannot use ", must use '

Co-authored-by: Gav Wood <gavin@parity.io>
2020-07-01 11:33:10 +02:00
Max Inden 585ea531a3 .maintain/monitoring/alerting-rules: Adjust transaction queue size alert (#6426)
The transaction queue size alert has been firing with a constant 10
transactions in the queue. While maybe problematic those 10 transactions
don't need to be the same across scrape intervals.

Instead of alerting with a size above 10, alert based on two things:

1. Monotonically increasing queue size

2. Upper limit queue size reached
2020-07-01 10:31:56 +02:00
David d73de3bed7 Fix mocking multiple http calls in the same function call (#6510)
* Fix mocking multiple http calls in the same function call

Fixes an issue where a function call would perform more than one http request and wait for each to complete before proceeding. The `RequestId` comes from the length of the `requests` collection in the `OffchainState` and if a request is completed before the next one starts it will be removed and the "next expected" will be off by one. This PR tries to fix that by using a request counter that tracks how many requests have been performed so that we can `remove()` items from the `expected_requests` at the right index.

I suspect that this is a sub-optimal soluton and perhaps requests and their mocks should live side by side in the same collection, e.g. in a tuple of `(PendingRequest, Option<ExpectedRequest>)`.

* Update primitives/core/src/offchain/testing.rs

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>

* Update primitives/core/src/offchain/testing.rs

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>

* Panic on overflow

* Update primitives/core/src/offchain/testing.rs

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

* Use a Deque and push/pop expected requests

* fix test

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-07-01 10:22:47 +02:00
Denis Pisarev ce02e1df84 Fix runtime benchmarks CI (#6545)
* debug (ci): ci config [skip ci]

* debug (ci): fix runtime benchmarks

* fix identity benchmarks

* fix utility benchmarks

* Revert "debug (ci): ci config [skip ci]"

This reverts commit 081b175b5e95604520c79ea4e5822b84ea35ddaa.

* change (ci): touch ci config to run CI

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Gav Wood <gavin@parity.io>
2020-07-01 09:36:12 +02:00
Wei Tang c4f6fbceac pallet-evm: customizable chain id (#6537) 2020-07-01 09:00:12 +02:00
Bastian Köcher e61f377617 Update to make cargo-deny happy (#6547)
* Update to make cargo-deny happy

* Remove cargo deny from CI

* change (ci): run cargo deny only on tags and schedules

Co-authored-by: Denis P <denis.pisarev@parity.io>
2020-07-01 08:49:51 +02:00
André Silva 4cf1b4fa7b grandpa: minor cleanups in communication module (#6371)
* grandpa: replace Result<(), ()> with Option<()>

* grandpa: replace &Option<T> with Option<&T>

* grandpa: cleanup local id and keystore usages

* grandpa: return bool on check_message_signature

* grandpa: fix erroneous log message on startup

* grandpa: fix test
2020-06-30 18:59:36 +01:00
Bastian Köcher 53be6ec510 Support synching of blocks that are not new_best (#6508)
* Start

* Remove debug println

* Add tests
2020-06-30 14:44:52 +00:00
Bastian Köcher 4fd770dcf9 Make the OnRuntimeUpgrade docs more clear (#6542) 2020-06-30 16:04:15 +02:00
Nikolay Volf 850942ae66 Block production integration benchmark (#6468)
* proposer benchmark

* update cargo.lock
2020-06-30 16:06:16 +03:00
Ashley b832e35c5e Remove the service, replacing it with a struct of individual chain components (#6352)
* WIP

* Making progress

* Almost ready

* Get service tests compiling

* Fix node screenshot

* Line widths

* Fix node cli tests

* Fix node cli warning

* ChainComponents -> ServiceComponents, fix tests

* make spawn_handle public

* Remove spawnnamed impl for taskmanager

* Move the keep alive stuff to the task manager

* Move the telemetry, base path, rpc keep_alive to the service builder

* Make the task manager keep alive an internal detail

* Rewrite the browser start_client future

* Remove run_node etc

* Revert my personal changes to browser-demo/build.sh

* use |config|

* Add a runtime_version function to SubstrateCli

* Reexport role and runtime version from sc cli

* Update Cargo.lock

* runtime_version -> native_runtime_version

* Pass chain spec to native_runtime_version for polkadot

* Fix line widths

* Traitify ServiceComponents Client
2020-06-30 11:00:42 +01:00