Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Prometheus metrics for RPC calls #7088

Merged
merged 17 commits into from
Sep 18, 2020
Merged

Prometheus metrics for RPC calls #7088

merged 17 commits into from
Sep 18, 2020

Conversation

grbIzl
Copy link
Contributor

@grbIzl grbIzl commented Sep 11, 2020

Middleware with Prometheus counter added for RPC calls over HTTP and WS.

Attempt to analyze https://github.com/paritytech/stakingops-issues/issues/34

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Sep 11, 2020
Copy link
Contributor

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introducing the concept of a middleware sounds good to me. I am not particularly familiar with the RPC code, thus leaving room for others to review. I can dive deeper into it in case no one else has time.

client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
@grbIzl grbIzl added the B0-silent Changes should not be mentioned in any release notes label Sep 11, 2020
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a okay "addition", however what do you expect to find by this?

How should the total number of RPC requests help you to find this bug?

client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
@grbIzl grbIzl added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Sep 11, 2020
@grbIzl
Copy link
Contributor Author

grbIzl commented Sep 11, 2020

@bkchr right now 0.8.23 build, deployed on rpc node, shows very low memory footprint. Previously we saw, that the highest consumers of the memory were rpc handlers. So without metrics it's difficult to say, it was fixed in 0.8.23 (i don't see in the changelog PRs, that could do that) or it's just the lower traffic.

Copy link
Contributor

@seunlanlege seunlanlege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks solid

client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
client/rpc-servers/Cargo.toml Outdated Show resolved Hide resolved
client/rpc-servers/src/lib.rs Outdated Show resolved Hide resolved

impl RpcMetrics {
fn register(r: &Registry, transport_prefix: &str) -> Result<Self, PrometheusError> {
let collector_name = format!("{}_rpc_calls_total", transport_prefix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding transport_prefix as part of the metric name implies that you only want to aggregate metrics of the same transport prefix. Say you ever want to compare metrics across transport handlers. One would prefer a label, e.g. transport_handler instead, as PromQL, the Prometheus query language, allows you to aggregate across labels, but not (at least not without pain) across metric names.

Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Please correct me, if I'm mistaken) So you suggest adding a common label "transport_handler" for all collectors for these middlewares?

Copy link
Contributor

@mxinden mxinden Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I would suggest keeping the metric name the same across handlers (e.g. rpc_calls_total) but add a label (e.g. transport_handler) to differentiate between handlers.

With this structure you could e.g. count all requests ever made on a machine (instance) via sum(rpc_calls_total) by (instance).

Is that a good explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is. But it seems to be not possible )) Prometheus doesn't allow registration of metrics with the same name. It was the main reason, why I introduced the prefix_name - to distinguish metrics from different handlers. It's pretty dumb actually, because I can only register, unregister or collect data from the metric. But I cannot receive the access to the already registered metric.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prometheus doesn't allow registration of metrics with the same name.

Yes, that is by design. Instead of creating the RpcMetrics struct in RpcMiddleware::new I would create it in start_rpc_servers and pass a clone of it to each RpcMiddleware::new invocation.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try and see, how it will look (it's a little bit more complicated, because handler is created in 2 places, not in 1, so i need to create an instance of metrics "higher")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@gnunicorn
Copy link
Contributor

@grbIzl think you probably want to merge master.

@grbIzl grbIzl added C1-low PR touches the given topic and has a low impact on builders. A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Sep 16, 2020
@grbIzl grbIzl requested a review from mxinden September 17, 2020 13:37
Copy link
Contributor

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me from the metrics side. Thanks for bearing with me. Not sure my review is worth much in regards to the general RPC logic, as I have not been involved in that in the past.

client/rpc-servers/src/middleware.rs Outdated Show resolved Hide resolved
client/rpc-servers/Cargo.toml Outdated Show resolved Hide resolved
@grbIzl grbIzl merged commit 394cd14 into master Sep 18, 2020
@grbIzl grbIzl deleted the RPCMetrics branch September 18, 2020 13:15
bkchr pushed a commit that referenced this pull request Sep 18, 2020
* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters
bkchr added a commit that referenced this pull request Oct 2, 2020
* Split block announce processing into two parts

This pull requests splits the block announce processing into two parts.
Into a phase that is called pre-validation that will be async and call
the block announce validator and into a second phase that processes the
result of the pre-validation.

The important change here is that the pre-validation phase is async.
This will be required by Cumulus/parachains. When a parachain announces
a block, it adds the candidate message send by the relay chain as extra
data into the block announcement. To verify this candidate message, the
relay chain parent is required that was used when building this message.
Now it can happen that we first receive the block announcement before
fully importing the relay chain block and this leads to the parachain
block not being imported. By making the pre-validation async, we will be
able to wait for the relay chain block to be imported to verify the
candidate message.

* Apply suggestions from code review

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* client/authority-discovery: Append PeerId to Multiaddr at most once (#6933)

* client/authority-discovery/worker: Extract address getter

* client/authority-discovery: Test for no duplicate p2p components

* client/authority-discovery: Append PeerId to Multiaddr at most once

When collecting the addresses to be published for the local node,
`addresses_to_publish` adds the local nodes `PeerId` to each
`Multiaddr`. Before doing so, ensure the `Multiaddr` does not already
contain one.

* client/authority-discovery: Remove explicit return

* expose Deposit (#6943)

* Add a `LightSyncState` field to the chain spec (#6894)

* Reset code, almost ready for PR

* Improved build_hardcoded_spec

* Fix line widths

* Fix tests

* Fix sc-service-test

* Suggestions from code review

* Rename to LightSyncState

* It's not syncing :^(

* It syncs!

* Remove rpc call

* Convert spaces to tabs

* Moved sc-service things to export_sync_state.rs

* Fix tests

* Wait for syncing with network_status_sinks

* Remove sc-network from node-template

* Apply suggestions from code review

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

* Various changes, split the flag up into 2 pieces to make testing easier.

* Update client/cli/src/commands/build_spec_cmd.rs

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

* Revert a lot of changes

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

* Dynamically generate CHT roots on a full client (#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments

* Enable verification logic when executing benchmarks (#6929)

* Add `--verify` flag to benchmark execution

* make it so `--verify` can be used for getting the actual benchmarks

* undo manual testing

* oops

* use benchmark config struct

* verify is default on, docs update

* remove clone

* improve formatting

* fix test

* bump impl for ci

* grandpa: always create and send justification if there are any subscribers (#6935)

* grandpa: use bytes type for justification rpc notification

* grandpa: always create justification if there are rpc subscribers

* grandpa: wording

* grandpa: replace notify_justification macro with function

* grandpa: prefer Option<&T> over &Option<T>

* .maintain/monitoring/alerting-rules: Add fd alert (#6946)

Alert on high file descriptor allocation.

* Fix benchmark read/write key tracker for keys in child storages. (#6905)

* WIP: read child trie and write child trie

* add test

* refactor a bit + improve log

* better naming

* trigger CI

* Revert "trigger CI"

This reverts commit d0aadae.

* client/authority-discovery: Limit number of addresses per authority (#6947)

* client/authority-discovery: Test addresses per authority limit

* client/authority-discovery: Limit number of addresses per authority

* ⛓ ✨Add ShiftNrg Network SS58 address type (#6942)

* update tracing attribute (#6950)

* Fix unwraps and other issues with benchmarks (#6957)

* Fix unwraps and other issues with benchmarks

* undo changes to contracts pallet

* Remove implementation of `Randomness for ()` (#6959)

* Fix staking fuzzer. (#6954)

* Enforce that ProtocolId is a string (#6953)

* Enforce that ProtocolId is a string

* Fix test

* Support Staking Payout to Any Account (#6832)

* Support staking payout to any account

* fix offences benchmarks

* Better prime election. (#6939)

* Better prime election.

* improve docs

* more sensible variable names

* link to Borda count wiki

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* babe: fix report_equivocation weight (#6936)

* babe: fix report_equivocation weight

* node: bump spec_version

* babe: fix floor in report_equivocation weight calculation

Co-authored-by: Gavin Wood <gavin@parity.io>

* grandpa: fix floor in report_equivocation weight calculation

* babe, grandpa: add test for weight_for::report_equivocation

Co-authored-by: Gavin Wood <gavin@parity.io>

* fix bench db wipe (#6965)

* Implement request-responses protocols (#6634)

* Implement request-responses protocols

* Add tests

* Fix sc-cli

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix naming

* Fix other issues

* Other naming fix

* Fix error logging

* Max sizes to u64

* Don't kill connections on refusal to process

* Adjust comment

Co-authored-by: Max Inden <mail@max-inden.de>

* add generated weight info for pallet-collective (#6789)

* add benchmark for disapprove_proposal

* use generated WeightInfo for pallet-collective weights

* order collective benchmark params alphabetically to get a consistent ordering

* address review comments

* remove default impl of WeightInfo for ()

* remove comments about weight changes

* add default weights

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* whitelist voter account in benchmark

* update weights

* MaxMembers configurable

* remove base weight comment

* add weight to technical collective

* another DB whitelist optimization

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* client/*: Treat protocol name as str and not [u8] (#6967)

* client/*: Treat protocol name as str and not [u8]

Notification protocol names are in practice always valid utf8 strings.
Instead of treating them as such in the type system, thus far they were
casted to a [u8] at creation time.

With this commit protocol names are instead treated as valid utf8
strings throughout the codebase and passed as `Cow<'static, str>`
instead of `Cow<'static, [u8]>`. Among other things this eliminates the
need for string casting when logging.

* client/network: Don't allocate when protocol name is borrowed

* update kvdb-rocksdb to 0.9.1 and rocksdb to 6.11.4 (#6963)

* Use AsyncReadExt::read_exact, not just read (#6977)

* client/cli/src/config: Warn on low file descriptor limit (#6956)

* client/cli/src/config: Warn on low file descriptor limit

Substrate sets the soft file descriptor limit to the hard limit at
startup. In the case of the latter being low already (< 10_000) a
Substrate node under high demand might run into issues e.g. when opening
up new TCP connections or persisting data to the database.

With this commit a warn message is printed to stderr.

* client/cli/Cargo.toml: Update to fdlimit 0.2.0

* Update substrate bip39 version. (#6955)

* update bip39 version

* and lock

* Inverting events set and changed in nicks pallet (#6989)

Fixing #6988

* Silence the error about non-registered protocols (#6987)

* Silence the error about non-registered protocols

* Silence the other two locations as well

* Change browser-demo build.sh to use python 3 again (#6992)

* fix pallet-evm features (#6995)

* Move subcommands from sc-cli to nodes (#6948)

* ci: deploy alerting rules: fix run on changes (#6998)

* ci: deploy alerting rules: fix run on changes

Co-authored-by: Max Inden <mail@max-inden.de>

* *: Update to Prometheus v0.10.0 (#6964)

* *: Update to Prometheus v0.10.0-rc.1

* *: Update to Prometheus v0.10.0

* Ensure that handshake is sent back even in case of back-pressure (#6979)

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>

* frame/authority-discovery: Have authorities() return both current and next (#6788)

* frame/authority-discovery: Have authorities() return both current and next

Authority address lookups on the DHT happen periodically (every 10
mintues) and are rather slow (~10 seconds).

In order to smooth the transition period between two sessions, have the
runtime module return both the current as well as the next authority
set. Thereby the client authority module will:

1. Publish its addresses one session in advance.

2. Prefetch the addresses of authorities of the next session in advance.

* frame/authority-discovery: Deduplicate authority ids

* frame/authority-discovery: Don't dedup on_genesis authorities

* frame/authority-discovery: Remove mut and sort on comparison in tests

* frame/authority-discovery: Use BTreeSet for deduplication

* Stop sending messages on legacy substream altogether (#6975)

* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* manual seal is now consensus agnostic (#7010)

* manual seal is now consensus agnostic

* pr grumbles

* grandpa: report metrics on prevotes and precommits cast (#6970)

* grandpa: report metrics on prevotes and precommits cast

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix compact npos solution edge count calculation (#7021)

This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this: 
```rust

struct Compact {
  votes1: ... ,
  votes2: ..., 
  ...,
  votes16: ...,
}
```

I already will fix this in #7007, but since it might take a while, this one can go in asap and make it to the very next runtime.

* Refactor & detach network metrics. (#6986)

* Refactor sc-network/service metrics.

  1. Aggregate sc-network metrics into a submodule, introducing
  two more sourced metrics to avoid duplicate atomics.

  2. Decouple periodic sc-service network metrics from other
  metrics, so that they can be updated independently.

* Update client/service/src/metrics.rs

* Update client/service/src/metrics.rs

* Node template complete import pipeline (#7014)

* Use complete import pipeline

* Line length

Co-authored-by: Dan Forbes <dan@danforbes.dev>

* client/authority-discovery: Throttle DHT requests (#7018)

* client/authority-discovery: Throttle DHT requests

Instead of passing one DHT query for each authority down to the network
every query interval, only pass MAX_IN_FLIGHT_LOOKUPS at a given point
in time, triggering new ones when previous ones return.

* client/authority-discovery/worker/test: Fix wrong constant

* Update Nicks docs to clarify that it is not production-ready (#6990)

* Ignore wasm_gc for debug build. (#6962)

* Ignore gc for debug build.

* alternate implementation

* Update utils/wasm-builder/src/lib.rs

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

* fix

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

* Make `--file` optional for `generate-node-key` (#7043)

This pr makes the `--file` argument optional to `generate-node-key`.
If the argument is not given, the secret node key will be printed to
`stdout`. The public node key will always be printed to `stderr`.

* Downgrade wabt = 0.9.1 (#7042)

* Add metadata shadows to multisig pallet (#7029)

* Add metadata shadows to multisig pallet

* Update frame/multisig/src/lib.rs

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

* Fix broken link to democracy pallet. (#7026)

Old link was broken, and I put a new one.

* Revert "Fix broken link to democracy pallet. (#7026)" (#7047)

This reverts commit 008cb24.

* Update the service tasks Grafana dashboard (#7038)

* babe, grandpa: waive fees on valid equivocation report (#6981)

* babe: waive fees on report_equivocation

* grandpa: waive fees on report_equivocation

* babe: add test for fee waiving on valid equivocation report

* grandpa: add test for fee waiving on valid equivocation report

* grandpa: remove stray comment

* Clarify Nicks docs (#7049)

* Improves EVM gas price check (#7051)

* Change wabt to wat (#7050)

* Add Dock network id for address generation (#6714)

Taking 21 and 22 for testnet and mainnet

Signed-off-by: lovesh <lovesh.bond@gmail.com>

* Partial fix for transaction priority (#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (#7059)

* Decrease poll interval (#7063)

* Remove unused code (#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Rename `TRIGGER_WASM_BUILD` to `FORCE_WASM_BUILD` (#7080)

Because apparently I can not speak properly ;)

* Make decoding of `compact<perthing>` saturating instead of invalid (#7062)

* make decoding of cmopact<perthing> saturating

* fix stable build

* Update primitives/arithmetic/src/per_things.rs

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

* Update primitives/arithmetic/src/per_things.rs

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

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

* state_machine no_std witness externalities (#6934)

* checkpoint before removing CT from change trie

* before trie backend without tx

* undo

* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.

* Remove NoTransaction.

* partially address review.
dummy stats implementation for no_std.

* Remove ChangeTrieOverlay.

* modified function

* Remove witness_ext

* need noops changes root

* update from cumulus branch

* line break

* remove warning

* line break

* From review: renamings and stats active in no std (except time).

* include cache, exclude change trie cache with individual temporary bad looking
no_std check

* little test

* fuse imports and filter_map prepare_extrinsics_input_inner fold.

* put back ExtInner into Ext, awkward double proto for new function.

* Apply suggestions from code review

* Update primitives/state-machine/Cargo.toml

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

* Support hex encoded secret key for `--node-key` (#7052)

* Support hex encoded secret key for `--node-key`

Adds support for reading a hex encoded secret key when being passed as
file via `--node-key`.

* Make the key loading uniform

* Switch to `hex::decode`

* Add a `build-sync-spec` subcommand and remove the CHT roots from the light sync state. (#6999)

* Move subcommands from sc-cli to nodes

* Add --build-sync-spec subcommand

* Remove CHTs from snapshots

* Keep ProvideChtRoots

* Fix build sync spec (#7086)

* Fail docs on warnings (#5923)

* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (#7079)

* Partial fix for transaction priority (#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (#7059)

* Decrease poll interval (#7063)

* Remove unused code (#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix `storage::read` (#7084)

* Fix `storage::read`

It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.

* Fix tests

* Add fuzzer for the compact custom codec implementation from PR #6720 (#7091)

* Add fuzzer for the compact custom codec implementation introduced in PR #6720.

This commit adds a fuzzing harness for the custom compact encoding/decoding
introduced in PR #6720.

* Update primitives/npos-elections/fuzzer/src/compact.rs

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

* Update Cargo.lock: Add changes in elections-fuzzer

* Change indentation from spaces to tabs

Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add instantiable support for treasury pallet (#7058)

* add instantiable support for treasury pallet

* update treasury pallet benchmarking code to support multi-instance

* use benchmark_intance! macro; fix hard coded treasury identity string; fix over characters line width limitation error

* fix line return style

* grandpa-rpc don't share subscription manager, only executor (#7039)

* service builder: fix todo about jsonrpc Option workaround

* grandpa-rpc: only share executor instead of sub manager

* grandpa-rpc: fix compilation

* grandpa-rpc: rename to subscription_executor

* node/cli: remove another unused jsonrpc dependency

* grandpa: apply style fixes from code review

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

* pallet-collective: allow customized default vote (#6984)

* collective: add DefaultVote trait

* Fix test and node compile

* Expose the whole prime_vote

* Add test for MoreThanMajorityThenPrimeDefaultVote

* Docs fix

* Upgrade to libp2p-0.28. (#7077)

* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI

* pow: support uniform tie breaking in fork choice (#7073)

* pow: support uniform tie breaking in fork choice

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

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

* Refactor fetch seal

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

* Allow remotes to not open a legacy substream (#7075)

* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake

* Use diener for Polkadot companion prs (#7102)

* Use diener for Polkadot companion prs

* Fix script

* Use gitlab env variable

* Update .maintain/gitlab/check_polkadot_companion_build.sh

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

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

* Update ui tests for rust 1.46.0 (#7106)

* client/network: Expose number of entries per Kademlia bucket (#7104)

Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the
number of nodes per bucket per Kademlia instance instead of only per
Kademlia instance.

* Improve error output of wasm-builder when wasm ins't installed (#7105)

This improves the error message of wasm-builder when the wasm toolchain
isn't installed. Currently we print that the wasm toolchain is not
installed, but the actual problem is that there is a bug in the
packaging in rust. This will now be much easier to debug, by printing
the full error message of the compiler.

* Add ss58 address for Dark network (#6982)

Hello,
This PR adds a new ss58 address 17 for Dark network.
Thanks!

* Frame-support storage: make iterations and translate consistent (#5470)

* implementation and factorisation

* factorize test

* doc

* fix bug and improve test

* address suggestions

* fix js dependancy alert, bumping bl version (#7110)

* fix js dependancy alert, bumping bl version

* fix low severity modules

* Make `transactional` attribute less scope dependent (#7112)

* Make `transactional` attribute less scope dependent

The old implementation expected that `frame-support` wasn't imported
under a different name. Besides that the pr removes some whitespaces.

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add SS58 Registry (#7020)

* add SS58 registry

* formatting

* description -> displayName

* Update ss58-registry.json

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* make numbers literal, tokens can have different denominations

* add dock

* add dark

* add websites and tokens

* add KLP decimals

* add acala and laminar info

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Move Staking Weights to T::WeightInfo (#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Send import notification always for re-orgs (#7118)

* Send import notification always for re-orgs

This pr changes the behavior of sending import notifications. Before we
only send notifications when importing blocks on the tip of the chain or
on similar conditions. However we did not send a notification when we
for example being in a state where we import multiple blocks to catch
up. If we re-org in this process, systems like the transaction pool
would not be notified about this re-org. This means, that we would also
not resubmit transactions of these retracted blocks. This pr fixes this,
by always sending a notification on a re-org.

See
https://github.com/substrate-developer-hub/substrate-node-template/issues/82
for some context about the bug.

* Update client/service/src/client/client.rs

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

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

* WeightInfo for Vesting Pallet (#7103)

* WeightInfo for Vesting Pallet

* clean up weight docs

* Update lib.rs

* try to pipe max locks

* Update for new type

* add warning when locks > MaxLocks

* Update lib.rs

* fix compile

* remove aliasing, fix trait def

* Update

* Add benchmarking pipeline to node-template (#7122)

* Use tracing-based subscriber logging (#6825)

* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>

* Typo in error text (#7126)

* WeightInfo for ImOnline (#7128)

* Add WeightInfo, not final weights

* benchmark machine weights

* fix the new staking weight in substrate-node (#7131)

* Remove warning about deprecated PeerIds (#7132)

* Fix db initialization for light client (#7130)

* Fix db initialization for light client

* Fix cache distribution

* WeightInfo for Identity Pallet (#7107)

* update benchmarks

* add automated weights

* Update benchmarking.rs

* use underscores for file out

* update some weights

* more weights

* finish weights

* add basic verification to benchmarks

* patch benchmarks

* Update benchmarking.rs

* final weights

* update for new type

* add weightinfo to node

* Make sure we update the `Cargo.lock` in the polkadot companion (#7135)

* Tracing for wasm with bridging to native (#6916)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* make tracing codecable

* replace with global tracing

* new tracing interface

* impl TracingSubscriber in client

* implement access to global TracingSubscriber from primitives

* span for wasm

* increment towards Wasm Tracing Subscriber implementation

* increment, remove sp-tracing from runtime-interface

* increment, it compiles

* attained original functionality with new mechanism

* implement remaining TracingSubscriber functions

* remove spans from decl_module

* add handling for encoded values

* Revert "replace with global tracing"

This reverts commit 8824a60.

* Wasm Side Tracing

* tracing on wasm

* enable tracing wasm on node-runtime

* export all the macros in std

* tracing subscriber on wasm-side only

* pass spans and events over and record them

* reactivate previous code and  cleanup

* further cleaning up

* extend the span macros, activate through executive

* tracking the actual extrinsic, too

* style

* fixing tests

* spaces -> tabs

* attempting to reactivate params

* activate our tests in CI

* some passing

* tests passing

* with core lazy

* global tracer for wasm side with pass over

* fixing metadata referencing

* remove const_fn feature requirement

* reenable dispatch traces

* reset client tracing

* further cleaning up

* fixing runtime-test

* move tracing-build setup into runtime-test

* Merge DebugWriter from tracing and frame-support, move to sp-std

* remove dangling fixme

* Docs for tracing primitives

* cleaning up a bit more

* Wasm interface docs

* optimise docs.rs setup

* adding tracing flags to uncomment

* remove brace

* fixing imports

* fixing broken syntax

* add required modules

* nicer formatting

* better target management

* adding low level storage tracing events into frame

* add custom Debug impl for WasmMetadata

* cloning profiler

* adding info about cloning profiler

* using in-scope for within calls

* proper time tracing, cleaning up println

* allow to disable tracing on runtime_interface-macro

* disable tracing for wasm-tracing-interface

* simplify wasm-tracing-api

* update client to new interface

* fixing docs and tests for sp-tracing

* update integration tests

* re-activating enter_span

* dropping FIXME, it's documented

* fix formatting

* fix formatting

* fix imports

* more debug info

* inform wasm about it being disabled by returning 1

* only one tracer, but enabled multi-all support

* make trait pub again for tests

* Apply suggestions from code review

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fixing wasm doc tests for proper usage

* remove unnecessary import

* fixing formatting

* minor style fixes

* downgrading wabt

* update error message for UI

* Fix interface test

* next attempt to fix macros

* geee

* revert tracing on hashed for future PR

* remove local macros, use originals

* we are able to convert to static items

* implement more WasmValue types

* adding support to convert str, debug and encoded values

* more minor fixes

* revert unsafe 'static making

* fix indentation

* remove commented lines

* bump all them tracing versions

* cleaning up docs and info

* document new flag

* the new layered system handles span cloning better

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>

* Pallet Indices (#7137)

* pow: replace the thread-base mining loop with a future-based mining worker (#7060)

* New worker design

* Remove unused thread import

* Add back missing inherent data provider registration

* Add function to get a Cloned metadata

* Add some docs

* Derive Eq and PartialEq for MiningMetadata

* Fix cargo lock

* Fix line width

* Add docs and fix issues in UntilImportedOrTimeout

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

Co-authored-by: David <dvdplm@gmail.com>

* Add back comments

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

* Bounties (#5715)

* add some compact annotation

* implement bounties for treasury

* fix test build

* remove some duplicated code

* fix build

* add tests

* fix build

* fix tests

* rename

* merge deposit byte fee

* add comments

* refactor storage

* support sub bounty

* emit BountyBecameActive when sub bounty is created

* able to contribute bounty

* allow curator to cancel bounty

* remove bounty contribution

* implement bounty expiry

* Able to extend bounty

* fix build and update tests

* create sub bounty test

* add more tests

* add benchmarks for bounties

* fix build

* line width

* fix benchmarking test

* update trait

* fix typo

* Update lib.rs

Missing documentation on Bounties added on this change. Please check the definitions of `propose_bounty` and `create_bounty`.

* update docs

* add MaximumSubBountyDepth

* put BountyValueMinimum into storage

* rework bount depth

* split on_initialize benchmarks

* remove components from constant functions

* Update weight integration into treasury

* Update reject proposal read/writes

* fix weight calculation

* Ignore weights with 0 factor

* Remove 0 multipliers

* add some docs

* allow unused for generated code

* line width

* allow RejectOrigin to cancel a pending payout bounty

* require BountyValueMinimum > ED

* make BountyValueMinimum configurable by chain spec

* remove sub-bounty features

* update curator

* accept curator

* unassign and cancel

* fix tests

* new tests

* Update lib.rs

- Include on `Assign_curator`, `accept_curator` and `unassign_curator` on Bounties Protocol Section 
- Include curator fee and curator deposit definitions on Terminology
- Update intro.

* fix test

* update extend_bounty_expiry

* fix benchmarking

* add new benchmarking code

* add docs

* fix tests

* Update benchmarking.rs

* Make BountyValueMinimum a trait config instead of stroage value

* fix runtime build

* Update weights

* Update default_weights.rs

* update weights

* update

* update comments

* unreserve curator fee

* update tests

* update benchmarks

* fix curator deposit handling

* trigger CI

* fix benchmarking

* use append instead of mutate push

* additional noop tests

* improve fee hanlding. update event docs

* RejectOrigin to unassign

* update bounty cancel logic

* use Zero::zero() over 0.into()

* fix tests

* fix benchmarks

* proposed fixes to bounties

* fix tests

* fix benchmarks

* update weightinfo

* use closure

* fix compile

* update weights

Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update SS58 configuration for Bifrost (#7142)

* Add 6 as address type of ss58 for Bifrost Network

* Update SS58 configuration for Bifrost

* Prometheus metrics for RPC calls (#7088)

* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters

* WeightInfo for Scheduler (#7138)

* initial scheduler stuff

* integrate weightinfo

* Update pallet_scheduler.rs

* grandpa-rpc: use FinalityProofProvider to check finality for rpc (#6215)

* grandpa-rpc: use FinalityProofProvider to check finality for rpc

* grandpa-rpc: minor tidy

* grandpa-rpc: remove dyn FinalityProofProvider

* grandpa-rpc: remove unused dependencies

* node: move finality_proof_provider setup

* grandpa-rpc: print error reported by finality_proof_provider

* grandpa-rpc: add note about unnecessary encode/decode

* grandpa-rpc: dont encode/decode and use correct hash

* grandpa-rpc: set_id is optional

* grandpa-rpc: create test for prove_finality

* grandpa-rpc: set visibility back to how it was

* grandpa-rpc: remove unused dependency

* grandpa-rpc: minor tidy

* grandpa: doc strings

* grandpa-rpc: rename to prove_finality

* grandpa-rpc: use current set id if none is provided

* grandpa-rpc: remove unnecessary check in test

* node: group finality_proof_provider in rpc_setup

* grandpa: make prove_finality concrete in FinalityProofProvider

* grandpa-rpc: wrap finality output in struct and store as Bytes

* grandpa-rpc: exhaustive error codes and wrap

* grandpa-rpc: let prove_finality take a range instead of a starting point

* grandpa-rpc: fix test for changed API

* grandpa-rpc: fix line length

* grandpa: fix reviewer nits

* node/rpc: fix reviewer comments

* Make it compile

* Rework the implementation and decrease the peer reputation on invalid
block announcement

* Implement limits for block announce validation

* Remove accidentally added file

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Rename `BlockAnnounceResult` to `PollBlockAnnounceValidation`

* Always return result using the internal future

* Move the polling and make sure all validation futures are registered

* Ignore the future in the legacy stuff

* Remove leftover stuff

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Swezey <matt@swezey.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gerben van de Wiel <clshannon@protonmail.com>
Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: joshua-mir <joshua@parity.io>
Co-authored-by: Nikita Puzankov <humb1t@yandex.ru>
Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Lovesh Harchandani <lovesh@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@live.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Kerwin Zhu <pfcoder97@gmail.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Wei Tang <wei@that.world>
Co-authored-by: DarkPay <42247799+DarkPayCoin@users.noreply.github.com>
Co-authored-by: HarryHong <hong091114@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Jianping Deng <djptux@gmail.com>
Co-authored-by: Anton Gavrilov <AntonE.Gavrilov@gmail.com>
liuchengxu pushed a commit to liuchengxu/substrate that referenced this pull request Oct 5, 2020
* Split block announce processing into two parts

This pull requests splits the block announce processing into two parts.
Into a phase that is called pre-validation that will be async and call
the block announce validator and into a second phase that processes the
result of the pre-validation.

The important change here is that the pre-validation phase is async.
This will be required by Cumulus/parachains. When a parachain announces
a block, it adds the candidate message send by the relay chain as extra
data into the block announcement. To verify this candidate message, the
relay chain parent is required that was used when building this message.
Now it can happen that we first receive the block announcement before
fully importing the relay chain block and this leads to the parachain
block not being imported. By making the pre-validation async, we will be
able to wait for the relay chain block to be imported to verify the
candidate message.

* Apply suggestions from code review

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* client/authority-discovery: Append PeerId to Multiaddr at most once (paritytech#6933)

* client/authority-discovery/worker: Extract address getter

* client/authority-discovery: Test for no duplicate p2p components

* client/authority-discovery: Append PeerId to Multiaddr at most once

When collecting the addresses to be published for the local node,
`addresses_to_publish` adds the local nodes `PeerId` to each
`Multiaddr`. Before doing so, ensure the `Multiaddr` does not already
contain one.

* client/authority-discovery: Remove explicit return

* expose Deposit (paritytech#6943)

* Add a `LightSyncState` field to the chain spec (paritytech#6894)

* Reset code, almost ready for PR

* Improved build_hardcoded_spec

* Fix line widths

* Fix tests

* Fix sc-service-test

* Suggestions from code review

* Rename to LightSyncState

* It's not syncing :^(

* It syncs!

* Remove rpc call

* Convert spaces to tabs

* Moved sc-service things to export_sync_state.rs

* Fix tests

* Wait for syncing with network_status_sinks

* Remove sc-network from node-template

* Apply suggestions from code review

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

* Various changes, split the flag up into 2 pieces to make testing easier.

* Update client/cli/src/commands/build_spec_cmd.rs

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

* Revert a lot of changes

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

* Dynamically generate CHT roots on a full client (paritytech#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments

* Enable verification logic when executing benchmarks (paritytech#6929)

* Add `--verify` flag to benchmark execution

* make it so `--verify` can be used for getting the actual benchmarks

* undo manual testing

* oops

* use benchmark config struct

* verify is default on, docs update

* remove clone

* improve formatting

* fix test

* bump impl for ci

* grandpa: always create and send justification if there are any subscribers (paritytech#6935)

* grandpa: use bytes type for justification rpc notification

* grandpa: always create justification if there are rpc subscribers

* grandpa: wording

* grandpa: replace notify_justification macro with function

* grandpa: prefer Option<&T> over &Option<T>

* .maintain/monitoring/alerting-rules: Add fd alert (paritytech#6946)

Alert on high file descriptor allocation.

* Fix benchmark read/write key tracker for keys in child storages. (paritytech#6905)

* WIP: read child trie and write child trie

* add test

* refactor a bit + improve log

* better naming

* trigger CI

* Revert "trigger CI"

This reverts commit d0aadae.

* client/authority-discovery: Limit number of addresses per authority (paritytech#6947)

* client/authority-discovery: Test addresses per authority limit

* client/authority-discovery: Limit number of addresses per authority

* ⛓ ✨Add ShiftNrg Network SS58 address type (paritytech#6942)

* update tracing attribute (paritytech#6950)

* Fix unwraps and other issues with benchmarks (paritytech#6957)

* Fix unwraps and other issues with benchmarks

* undo changes to contracts pallet

* Remove implementation of `Randomness for ()` (paritytech#6959)

* Fix staking fuzzer. (paritytech#6954)

* Enforce that ProtocolId is a string (paritytech#6953)

* Enforce that ProtocolId is a string

* Fix test

* Support Staking Payout to Any Account (paritytech#6832)

* Support staking payout to any account

* fix offences benchmarks

* Better prime election. (paritytech#6939)

* Better prime election.

* improve docs

* more sensible variable names

* link to Borda count wiki

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* babe: fix report_equivocation weight (paritytech#6936)

* babe: fix report_equivocation weight

* node: bump spec_version

* babe: fix floor in report_equivocation weight calculation

Co-authored-by: Gavin Wood <gavin@parity.io>

* grandpa: fix floor in report_equivocation weight calculation

* babe, grandpa: add test for weight_for::report_equivocation

Co-authored-by: Gavin Wood <gavin@parity.io>

* fix bench db wipe (paritytech#6965)

* Implement request-responses protocols (paritytech#6634)

* Implement request-responses protocols

* Add tests

* Fix sc-cli

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix naming

* Fix other issues

* Other naming fix

* Fix error logging

* Max sizes to u64

* Don't kill connections on refusal to process

* Adjust comment

Co-authored-by: Max Inden <mail@max-inden.de>

* add generated weight info for pallet-collective (paritytech#6789)

* add benchmark for disapprove_proposal

* use generated WeightInfo for pallet-collective weights

* order collective benchmark params alphabetically to get a consistent ordering

* address review comments

* remove default impl of WeightInfo for ()

* remove comments about weight changes

* add default weights

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* whitelist voter account in benchmark

* update weights

* MaxMembers configurable

* remove base weight comment

* add weight to technical collective

* another DB whitelist optimization

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* client/*: Treat protocol name as str and not [u8] (paritytech#6967)

* client/*: Treat protocol name as str and not [u8]

Notification protocol names are in practice always valid utf8 strings.
Instead of treating them as such in the type system, thus far they were
casted to a [u8] at creation time.

With this commit protocol names are instead treated as valid utf8
strings throughout the codebase and passed as `Cow<'static, str>`
instead of `Cow<'static, [u8]>`. Among other things this eliminates the
need for string casting when logging.

* client/network: Don't allocate when protocol name is borrowed

* update kvdb-rocksdb to 0.9.1 and rocksdb to 6.11.4 (paritytech#6963)

* Use AsyncReadExt::read_exact, not just read (paritytech#6977)

* client/cli/src/config: Warn on low file descriptor limit (paritytech#6956)

* client/cli/src/config: Warn on low file descriptor limit

Substrate sets the soft file descriptor limit to the hard limit at
startup. In the case of the latter being low already (< 10_000) a
Substrate node under high demand might run into issues e.g. when opening
up new TCP connections or persisting data to the database.

With this commit a warn message is printed to stderr.

* client/cli/Cargo.toml: Update to fdlimit 0.2.0

* Update substrate bip39 version. (paritytech#6955)

* update bip39 version

* and lock

* Inverting events set and changed in nicks pallet (paritytech#6989)

Fixing paritytech#6988

* Silence the error about non-registered protocols (paritytech#6987)

* Silence the error about non-registered protocols

* Silence the other two locations as well

* Change browser-demo build.sh to use python 3 again (paritytech#6992)

* fix pallet-evm features (paritytech#6995)

* Move subcommands from sc-cli to nodes (paritytech#6948)

* ci: deploy alerting rules: fix run on changes (paritytech#6998)

* ci: deploy alerting rules: fix run on changes

Co-authored-by: Max Inden <mail@max-inden.de>

* *: Update to Prometheus v0.10.0 (paritytech#6964)

* *: Update to Prometheus v0.10.0-rc.1

* *: Update to Prometheus v0.10.0

* Ensure that handshake is sent back even in case of back-pressure (paritytech#6979)

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>

* frame/authority-discovery: Have authorities() return both current and next (paritytech#6788)

* frame/authority-discovery: Have authorities() return both current and next

Authority address lookups on the DHT happen periodically (every 10
mintues) and are rather slow (~10 seconds).

In order to smooth the transition period between two sessions, have the
runtime module return both the current as well as the next authority
set. Thereby the client authority module will:

1. Publish its addresses one session in advance.

2. Prefetch the addresses of authorities of the next session in advance.

* frame/authority-discovery: Deduplicate authority ids

* frame/authority-discovery: Don't dedup on_genesis authorities

* frame/authority-discovery: Remove mut and sort on comparison in tests

* frame/authority-discovery: Use BTreeSet for deduplication

* Stop sending messages on legacy substream altogether (paritytech#6975)

* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* manual seal is now consensus agnostic (paritytech#7010)

* manual seal is now consensus agnostic

* pr grumbles

* grandpa: report metrics on prevotes and precommits cast (paritytech#6970)

* grandpa: report metrics on prevotes and precommits cast

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix compact npos solution edge count calculation (paritytech#7021)

This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this: 
```rust

struct Compact {
  votes1: ... ,
  votes2: ..., 
  ...,
  votes16: ...,
}
```

I already will fix this in paritytech#7007, but since it might take a while, this one can go in asap and make it to the very next runtime.

* Refactor & detach network metrics. (paritytech#6986)

* Refactor sc-network/service metrics.

  1. Aggregate sc-network metrics into a submodule, introducing
  two more sourced metrics to avoid duplicate atomics.

  2. Decouple periodic sc-service network metrics from other
  metrics, so that they can be updated independently.

* Update client/service/src/metrics.rs

* Update client/service/src/metrics.rs

* Node template complete import pipeline (paritytech#7014)

* Use complete import pipeline

* Line length

Co-authored-by: Dan Forbes <dan@danforbes.dev>

* client/authority-discovery: Throttle DHT requests (paritytech#7018)

* client/authority-discovery: Throttle DHT requests

Instead of passing one DHT query for each authority down to the network
every query interval, only pass MAX_IN_FLIGHT_LOOKUPS at a given point
in time, triggering new ones when previous ones return.

* client/authority-discovery/worker/test: Fix wrong constant

* Update Nicks docs to clarify that it is not production-ready (paritytech#6990)

* Ignore wasm_gc for debug build. (paritytech#6962)

* Ignore gc for debug build.

* alternate implementation

* Update utils/wasm-builder/src/lib.rs

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

* fix

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

* Make `--file` optional for `generate-node-key` (paritytech#7043)

This pr makes the `--file` argument optional to `generate-node-key`.
If the argument is not given, the secret node key will be printed to
`stdout`. The public node key will always be printed to `stderr`.

* Downgrade wabt = 0.9.1 (paritytech#7042)

* Add metadata shadows to multisig pallet (paritytech#7029)

* Add metadata shadows to multisig pallet

* Update frame/multisig/src/lib.rs

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

* Fix broken link to democracy pallet. (paritytech#7026)

Old link was broken, and I put a new one.

* Revert "Fix broken link to democracy pallet. (paritytech#7026)" (paritytech#7047)

This reverts commit 008cb24.

* Update the service tasks Grafana dashboard (paritytech#7038)

* babe, grandpa: waive fees on valid equivocation report (paritytech#6981)

* babe: waive fees on report_equivocation

* grandpa: waive fees on report_equivocation

* babe: add test for fee waiving on valid equivocation report

* grandpa: add test for fee waiving on valid equivocation report

* grandpa: remove stray comment

* Clarify Nicks docs (paritytech#7049)

* Improves EVM gas price check (paritytech#7051)

* Change wabt to wat (paritytech#7050)

* Add Dock network id for address generation (paritytech#6714)

Taking 21 and 22 for testnet and mainnet

Signed-off-by: lovesh <lovesh.bond@gmail.com>

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Rename `TRIGGER_WASM_BUILD` to `FORCE_WASM_BUILD` (paritytech#7080)

Because apparently I can not speak properly ;)

* Make decoding of `compact<perthing>` saturating instead of invalid (paritytech#7062)

* make decoding of cmopact<perthing> saturating

* fix stable build

* Update primitives/arithmetic/src/per_things.rs

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

* Update primitives/arithmetic/src/per_things.rs

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

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

* state_machine no_std witness externalities (paritytech#6934)

* checkpoint before removing CT from change trie

* before trie backend without tx

* undo

* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.

* Remove NoTransaction.

* partially address review.
dummy stats implementation for no_std.

* Remove ChangeTrieOverlay.

* modified function

* Remove witness_ext

* need noops changes root

* update from cumulus branch

* line break

* remove warning

* line break

* From review: renamings and stats active in no std (except time).

* include cache, exclude change trie cache with individual temporary bad looking
no_std check

* little test

* fuse imports and filter_map prepare_extrinsics_input_inner fold.

* put back ExtInner into Ext, awkward double proto for new function.

* Apply suggestions from code review

* Update primitives/state-machine/Cargo.toml

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

* Support hex encoded secret key for `--node-key` (paritytech#7052)

* Support hex encoded secret key for `--node-key`

Adds support for reading a hex encoded secret key when being passed as
file via `--node-key`.

* Make the key loading uniform

* Switch to `hex::decode`

* Add a `build-sync-spec` subcommand and remove the CHT roots from the light sync state. (paritytech#6999)

* Move subcommands from sc-cli to nodes

* Add --build-sync-spec subcommand

* Remove CHTs from snapshots

* Keep ProvideChtRoots

* Fix build sync spec (paritytech#7086)

* Fail docs on warnings (paritytech#5923)

* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (paritytech#7079)

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix `storage::read` (paritytech#7084)

* Fix `storage::read`

It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.

* Fix tests

* Add fuzzer for the compact custom codec implementation from PR paritytech#6720 (paritytech#7091)

* Add fuzzer for the compact custom codec implementation introduced in PR paritytech#6720.

This commit adds a fuzzing harness for the custom compact encoding/decoding
introduced in PR paritytech#6720.

* Update primitives/npos-elections/fuzzer/src/compact.rs

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

* Update Cargo.lock: Add changes in elections-fuzzer

* Change indentation from spaces to tabs

Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add instantiable support for treasury pallet (paritytech#7058)

* add instantiable support for treasury pallet

* update treasury pallet benchmarking code to support multi-instance

* use benchmark_intance! macro; fix hard coded treasury identity string; fix over characters line width limitation error

* fix line return style

* grandpa-rpc don't share subscription manager, only executor (paritytech#7039)

* service builder: fix todo about jsonrpc Option workaround

* grandpa-rpc: only share executor instead of sub manager

* grandpa-rpc: fix compilation

* grandpa-rpc: rename to subscription_executor

* node/cli: remove another unused jsonrpc dependency

* grandpa: apply style fixes from code review

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

* pallet-collective: allow customized default vote (paritytech#6984)

* collective: add DefaultVote trait

* Fix test and node compile

* Expose the whole prime_vote

* Add test for MoreThanMajorityThenPrimeDefaultVote

* Docs fix

* Upgrade to libp2p-0.28. (paritytech#7077)

* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI

* pow: support uniform tie breaking in fork choice (paritytech#7073)

* pow: support uniform tie breaking in fork choice

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

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

* Refactor fetch seal

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

* Allow remotes to not open a legacy substream (paritytech#7075)

* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake

* Use diener for Polkadot companion prs (paritytech#7102)

* Use diener for Polkadot companion prs

* Fix script

* Use gitlab env variable

* Update .maintain/gitlab/check_polkadot_companion_build.sh

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

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

* Update ui tests for rust 1.46.0 (paritytech#7106)

* client/network: Expose number of entries per Kademlia bucket (paritytech#7104)

Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the
number of nodes per bucket per Kademlia instance instead of only per
Kademlia instance.

* Improve error output of wasm-builder when wasm ins't installed (paritytech#7105)

This improves the error message of wasm-builder when the wasm toolchain
isn't installed. Currently we print that the wasm toolchain is not
installed, but the actual problem is that there is a bug in the
packaging in rust. This will now be much easier to debug, by printing
the full error message of the compiler.

* Add ss58 address for Dark network (paritytech#6982)

Hello,
This PR adds a new ss58 address 17 for Dark network.
Thanks!

* Frame-support storage: make iterations and translate consistent (paritytech#5470)

* implementation and factorisation

* factorize test

* doc

* fix bug and improve test

* address suggestions

* fix js dependancy alert, bumping bl version (paritytech#7110)

* fix js dependancy alert, bumping bl version

* fix low severity modules

* Make `transactional` attribute less scope dependent (paritytech#7112)

* Make `transactional` attribute less scope dependent

The old implementation expected that `frame-support` wasn't imported
under a different name. Besides that the pr removes some whitespaces.

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add SS58 Registry (paritytech#7020)

* add SS58 registry

* formatting

* description -> displayName

* Update ss58-registry.json

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* make numbers literal, tokens can have different denominations

* add dock

* add dark

* add websites and tokens

* add KLP decimals

* add acala and laminar info

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Move Staking Weights to T::WeightInfo (paritytech#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Send import notification always for re-orgs (paritytech#7118)

* Send import notification always for re-orgs

This pr changes the behavior of sending import notifications. Before we
only send notifications when importing blocks on the tip of the chain or
on similar conditions. However we did not send a notification when we
for example being in a state where we import multiple blocks to catch
up. If we re-org in this process, systems like the transaction pool
would not be notified about this re-org. This means, that we would also
not resubmit transactions of these retracted blocks. This pr fixes this,
by always sending a notification on a re-org.

See
https://github.com/substrate-developer-hub/substrate-node-template/issues/82
for some context about the bug.

* Update client/service/src/client/client.rs

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

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

* WeightInfo for Vesting Pallet (paritytech#7103)

* WeightInfo for Vesting Pallet

* clean up weight docs

* Update lib.rs

* try to pipe max locks

* Update for new type

* add warning when locks > MaxLocks

* Update lib.rs

* fix compile

* remove aliasing, fix trait def

* Update

* Add benchmarking pipeline to node-template (paritytech#7122)

* Use tracing-based subscriber logging (paritytech#6825)

* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>

* Typo in error text (paritytech#7126)

* WeightInfo for ImOnline (paritytech#7128)

* Add WeightInfo, not final weights

* benchmark machine weights

* fix the new staking weight in substrate-node (paritytech#7131)

* Remove warning about deprecated PeerIds (paritytech#7132)

* Fix db initialization for light client (paritytech#7130)

* Fix db initialization for light client

* Fix cache distribution

* WeightInfo for Identity Pallet (paritytech#7107)

* update benchmarks

* add automated weights

* Update benchmarking.rs

* use underscores for file out

* update some weights

* more weights

* finish weights

* add basic verification to benchmarks

* patch benchmarks

* Update benchmarking.rs

* final weights

* update for new type

* add weightinfo to node

* Make sure we update the `Cargo.lock` in the polkadot companion (paritytech#7135)

* Tracing for wasm with bridging to native (paritytech#6916)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* make tracing codecable

* replace with global tracing

* new tracing interface

* impl TracingSubscriber in client

* implement access to global TracingSubscriber from primitives

* span for wasm

* increment towards Wasm Tracing Subscriber implementation

* increment, remove sp-tracing from runtime-interface

* increment, it compiles

* attained original functionality with new mechanism

* implement remaining TracingSubscriber functions

* remove spans from decl_module

* add handling for encoded values

* Revert "replace with global tracing"

This reverts commit 8824a60.

* Wasm Side Tracing

* tracing on wasm

* enable tracing wasm on node-runtime

* export all the macros in std

* tracing subscriber on wasm-side only

* pass spans and events over and record them

* reactivate previous code and  cleanup

* further cleaning up

* extend the span macros, activate through executive

* tracking the actual extrinsic, too

* style

* fixing tests

* spaces -> tabs

* attempting to reactivate params

* activate our tests in CI

* some passing

* tests passing

* with core lazy

* global tracer for wasm side with pass over

* fixing metadata referencing

* remove const_fn feature requirement

* reenable dispatch traces

* reset client tracing

* further cleaning up

* fixing runtime-test

* move tracing-build setup into runtime-test

* Merge DebugWriter from tracing and frame-support, move to sp-std

* remove dangling fixme

* Docs for tracing primitives

* cleaning up a bit more

* Wasm interface docs

* optimise docs.rs setup

* adding tracing flags to uncomment

* remove brace

* fixing imports

* fixing broken syntax

* add required modules

* nicer formatting

* better target management

* adding low level storage tracing events into frame

* add custom Debug impl for WasmMetadata

* cloning profiler

* adding info about cloning profiler

* using in-scope for within calls

* proper time tracing, cleaning up println

* allow to disable tracing on runtime_interface-macro

* disable tracing for wasm-tracing-interface

* simplify wasm-tracing-api

* update client to new interface

* fixing docs and tests for sp-tracing

* update integration tests

* re-activating enter_span

* dropping FIXME, it's documented

* fix formatting

* fix formatting

* fix imports

* more debug info

* inform wasm about it being disabled by returning 1

* only one tracer, but enabled multi-all support

* make trait pub again for tests

* Apply suggestions from code review

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fixing wasm doc tests for proper usage

* remove unnecessary import

* fixing formatting

* minor style fixes

* downgrading wabt

* update error message for UI

* Fix interface test

* next attempt to fix macros

* geee

* revert tracing on hashed for future PR

* remove local macros, use originals

* we are able to convert to static items

* implement more WasmValue types

* adding support to convert str, debug and encoded values

* more minor fixes

* revert unsafe 'static making

* fix indentation

* remove commented lines

* bump all them tracing versions

* cleaning up docs and info

* document new flag

* the new layered system handles span cloning better

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>

* Pallet Indices (paritytech#7137)

* pow: replace the thread-base mining loop with a future-based mining worker (paritytech#7060)

* New worker design

* Remove unused thread import

* Add back missing inherent data provider registration

* Add function to get a Cloned metadata

* Add some docs

* Derive Eq and PartialEq for MiningMetadata

* Fix cargo lock

* Fix line width

* Add docs and fix issues in UntilImportedOrTimeout

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

Co-authored-by: David <dvdplm@gmail.com>

* Add back comments

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

* Bounties (paritytech#5715)

* add some compact annotation

* implement bounties for treasury

* fix test build

* remove some duplicated code

* fix build

* add tests

* fix build

* fix tests

* rename

* merge deposit byte fee

* add comments

* refactor storage

* support sub bounty

* emit BountyBecameActive when sub bounty is created

* able to contribute bounty

* allow curator to cancel bounty

* remove bounty contribution

* implement bounty expiry

* Able to extend bounty

* fix build and update tests

* create sub bounty test

* add more tests

* add benchmarks for bounties

* fix build

* line width

* fix benchmarking test

* update trait

* fix typo

* Update lib.rs

Missing documentation on Bounties added on this change. Please check the definitions of `propose_bounty` and `create_bounty`.

* update docs

* add MaximumSubBountyDepth

* put BountyValueMinimum into storage

* rework bount depth

* split on_initialize benchmarks

* remove components from constant functions

* Update weight integration into treasury

* Update reject proposal read/writes

* fix weight calculation

* Ignore weights with 0 factor

* Remove 0 multipliers

* add some docs

* allow unused for generated code

* line width

* allow RejectOrigin to cancel a pending payout bounty

* require BountyValueMinimum > ED

* make BountyValueMinimum configurable by chain spec

* remove sub-bounty features

* update curator

* accept curator

* unassign and cancel

* fix tests

* new tests

* Update lib.rs

- Include on `Assign_curator`, `accept_curator` and `unassign_curator` on Bounties Protocol Section 
- Include curator fee and curator deposit definitions on Terminology
- Update intro.

* fix test

* update extend_bounty_expiry

* fix benchmarking

* add new benchmarking code

* add docs

* fix tests

* Update benchmarking.rs

* Make BountyValueMinimum a trait config instead of stroage value

* fix runtime build

* Update weights

* Update default_weights.rs

* update weights

* update

* update comments

* unreserve curator fee

* update tests

* update benchmarks

* fix curator deposit handling

* trigger CI

* fix benchmarking

* use append instead of mutate push

* additional noop tests

* improve fee hanlding. update event docs

* RejectOrigin to unassign

* update bounty cancel logic

* use Zero::zero() over 0.into()

* fix tests

* fix benchmarks

* proposed fixes to bounties

* fix tests

* fix benchmarks

* update weightinfo

* use closure

* fix compile

* update weights

Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update SS58 configuration for Bifrost (paritytech#7142)

* Add 6 as address type of ss58 for Bifrost Network

* Update SS58 configuration for Bifrost

* Prometheus metrics for RPC calls (paritytech#7088)

* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters

* WeightInfo for Scheduler (paritytech#7138)

* initial scheduler stuff

* integrate weightinfo

* Update pallet_scheduler.rs

* grandpa-rpc: use FinalityProofProvider to check finality for rpc (paritytech#6215)

* grandpa-rpc: use FinalityProofProvider to check finality for rpc

* grandpa-rpc: minor tidy

* grandpa-rpc: remove dyn FinalityProofProvider

* grandpa-rpc: remove unused dependencies

* node: move finality_proof_provider setup

* grandpa-rpc: print error reported by finality_proof_provider

* grandpa-rpc: add note about unnecessary encode/decode

* grandpa-rpc: dont encode/decode and use correct hash

* grandpa-rpc: set_id is optional

* grandpa-rpc: create test for prove_finality

* grandpa-rpc: set visibility back to how it was

* grandpa-rpc: remove unused dependency

* grandpa-rpc: minor tidy

* grandpa: doc strings

* grandpa-rpc: rename to prove_finality

* grandpa-rpc: use current set id if none is provided

* grandpa-rpc: remove unnecessary check in test

* node: group finality_proof_provider in rpc_setup

* grandpa: make prove_finality concrete in FinalityProofProvider

* grandpa-rpc: wrap finality output in struct and store as Bytes

* grandpa-rpc: exhaustive error codes and wrap

* grandpa-rpc: let prove_finality take a range instead of a starting point

* grandpa-rpc: fix test for changed API

* grandpa-rpc: fix line length

* grandpa: fix reviewer nits

* node/rpc: fix reviewer comments

* Make it compile

* Rework the implementation and decrease the peer reputation on invalid
block announcement

* Implement limits for block announce validation

* Remove accidentally added file

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Rename `BlockAnnounceResult` to `PollBlockAnnounceValidation`

* Always return result using the internal future

* Move the polling and make sure all validation futures are registered

* Ignore the future in the legacy stuff

* Remove leftover stuff

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Swezey <matt@swezey.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gerben van de Wiel <clshannon@protonmail.com>
Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: joshua-mir <joshua@parity.io>
Co-authored-by: Nikita Puzankov <humb1t@yandex.ru>
Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Lovesh Harchandani <lovesh@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@live.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Kerwin Zhu <pfcoder97@gmail.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Wei Tang <wei@that.world>
Co-authored-by: DarkPay <42247799+DarkPayCoin@users.noreply.github.com>
Co-authored-by: HarryHong <hong091114@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Jianping Deng <djptux@gmail.com>
Co-authored-by: Anton Gavrilov <AntonE.Gavrilov@gmail.com>
insipx pushed a commit to insipx/substrate that referenced this pull request Nov 5, 2020
* Split block announce processing into two parts

This pull requests splits the block announce processing into two parts.
Into a phase that is called pre-validation that will be async and call
the block announce validator and into a second phase that processes the
result of the pre-validation.

The important change here is that the pre-validation phase is async.
This will be required by Cumulus/parachains. When a parachain announces
a block, it adds the candidate message send by the relay chain as extra
data into the block announcement. To verify this candidate message, the
relay chain parent is required that was used when building this message.
Now it can happen that we first receive the block announcement before
fully importing the relay chain block and this leads to the parachain
block not being imported. By making the pre-validation async, we will be
able to wait for the relay chain block to be imported to verify the
candidate message.

* Apply suggestions from code review

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* client/authority-discovery: Append PeerId to Multiaddr at most once (paritytech#6933)

* client/authority-discovery/worker: Extract address getter

* client/authority-discovery: Test for no duplicate p2p components

* client/authority-discovery: Append PeerId to Multiaddr at most once

When collecting the addresses to be published for the local node,
`addresses_to_publish` adds the local nodes `PeerId` to each
`Multiaddr`. Before doing so, ensure the `Multiaddr` does not already
contain one.

* client/authority-discovery: Remove explicit return

* expose Deposit (paritytech#6943)

* Add a `LightSyncState` field to the chain spec (paritytech#6894)

* Reset code, almost ready for PR

* Improved build_hardcoded_spec

* Fix line widths

* Fix tests

* Fix sc-service-test

* Suggestions from code review

* Rename to LightSyncState

* It's not syncing :^(

* It syncs!

* Remove rpc call

* Convert spaces to tabs

* Moved sc-service things to export_sync_state.rs

* Fix tests

* Wait for syncing with network_status_sinks

* Remove sc-network from node-template

* Apply suggestions from code review

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

* Various changes, split the flag up into 2 pieces to make testing easier.

* Update client/cli/src/commands/build_spec_cmd.rs

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

* Revert a lot of changes

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

* Dynamically generate CHT roots on a full client (paritytech#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments

* Enable verification logic when executing benchmarks (paritytech#6929)

* Add `--verify` flag to benchmark execution

* make it so `--verify` can be used for getting the actual benchmarks

* undo manual testing

* oops

* use benchmark config struct

* verify is default on, docs update

* remove clone

* improve formatting

* fix test

* bump impl for ci

* grandpa: always create and send justification if there are any subscribers (paritytech#6935)

* grandpa: use bytes type for justification rpc notification

* grandpa: always create justification if there are rpc subscribers

* grandpa: wording

* grandpa: replace notify_justification macro with function

* grandpa: prefer Option<&T> over &Option<T>

* .maintain/monitoring/alerting-rules: Add fd alert (paritytech#6946)

Alert on high file descriptor allocation.

* Fix benchmark read/write key tracker for keys in child storages. (paritytech#6905)

* WIP: read child trie and write child trie

* add test

* refactor a bit + improve log

* better naming

* trigger CI

* Revert "trigger CI"

This reverts commit d0aadae.

* client/authority-discovery: Limit number of addresses per authority (paritytech#6947)

* client/authority-discovery: Test addresses per authority limit

* client/authority-discovery: Limit number of addresses per authority

* ⛓ ✨Add ShiftNrg Network SS58 address type (paritytech#6942)

* update tracing attribute (paritytech#6950)

* Fix unwraps and other issues with benchmarks (paritytech#6957)

* Fix unwraps and other issues with benchmarks

* undo changes to contracts pallet

* Remove implementation of `Randomness for ()` (paritytech#6959)

* Fix staking fuzzer. (paritytech#6954)

* Enforce that ProtocolId is a string (paritytech#6953)

* Enforce that ProtocolId is a string

* Fix test

* Support Staking Payout to Any Account (paritytech#6832)

* Support staking payout to any account

* fix offences benchmarks

* Better prime election. (paritytech#6939)

* Better prime election.

* improve docs

* more sensible variable names

* link to Borda count wiki

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* babe: fix report_equivocation weight (paritytech#6936)

* babe: fix report_equivocation weight

* node: bump spec_version

* babe: fix floor in report_equivocation weight calculation

Co-authored-by: Gavin Wood <gavin@parity.io>

* grandpa: fix floor in report_equivocation weight calculation

* babe, grandpa: add test for weight_for::report_equivocation

Co-authored-by: Gavin Wood <gavin@parity.io>

* fix bench db wipe (paritytech#6965)

* Implement request-responses protocols (paritytech#6634)

* Implement request-responses protocols

* Add tests

* Fix sc-cli

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix naming

* Fix other issues

* Other naming fix

* Fix error logging

* Max sizes to u64

* Don't kill connections on refusal to process

* Adjust comment

Co-authored-by: Max Inden <mail@max-inden.de>

* add generated weight info for pallet-collective (paritytech#6789)

* add benchmark for disapprove_proposal

* use generated WeightInfo for pallet-collective weights

* order collective benchmark params alphabetically to get a consistent ordering

* address review comments

* remove default impl of WeightInfo for ()

* remove comments about weight changes

* add default weights

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* whitelist voter account in benchmark

* update weights

* MaxMembers configurable

* remove base weight comment

* add weight to technical collective

* another DB whitelist optimization

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* client/*: Treat protocol name as str and not [u8] (paritytech#6967)

* client/*: Treat protocol name as str and not [u8]

Notification protocol names are in practice always valid utf8 strings.
Instead of treating them as such in the type system, thus far they were
casted to a [u8] at creation time.

With this commit protocol names are instead treated as valid utf8
strings throughout the codebase and passed as `Cow<'static, str>`
instead of `Cow<'static, [u8]>`. Among other things this eliminates the
need for string casting when logging.

* client/network: Don't allocate when protocol name is borrowed

* update kvdb-rocksdb to 0.9.1 and rocksdb to 6.11.4 (paritytech#6963)

* Use AsyncReadExt::read_exact, not just read (paritytech#6977)

* client/cli/src/config: Warn on low file descriptor limit (paritytech#6956)

* client/cli/src/config: Warn on low file descriptor limit

Substrate sets the soft file descriptor limit to the hard limit at
startup. In the case of the latter being low already (< 10_000) a
Substrate node under high demand might run into issues e.g. when opening
up new TCP connections or persisting data to the database.

With this commit a warn message is printed to stderr.

* client/cli/Cargo.toml: Update to fdlimit 0.2.0

* Update substrate bip39 version. (paritytech#6955)

* update bip39 version

* and lock

* Inverting events set and changed in nicks pallet (paritytech#6989)

Fixing paritytech#6988

* Silence the error about non-registered protocols (paritytech#6987)

* Silence the error about non-registered protocols

* Silence the other two locations as well

* Change browser-demo build.sh to use python 3 again (paritytech#6992)

* fix pallet-evm features (paritytech#6995)

* Move subcommands from sc-cli to nodes (paritytech#6948)

* ci: deploy alerting rules: fix run on changes (paritytech#6998)

* ci: deploy alerting rules: fix run on changes

Co-authored-by: Max Inden <mail@max-inden.de>

* *: Update to Prometheus v0.10.0 (paritytech#6964)

* *: Update to Prometheus v0.10.0-rc.1

* *: Update to Prometheus v0.10.0

* Ensure that handshake is sent back even in case of back-pressure (paritytech#6979)

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>

* frame/authority-discovery: Have authorities() return both current and next (paritytech#6788)

* frame/authority-discovery: Have authorities() return both current and next

Authority address lookups on the DHT happen periodically (every 10
mintues) and are rather slow (~10 seconds).

In order to smooth the transition period between two sessions, have the
runtime module return both the current as well as the next authority
set. Thereby the client authority module will:

1. Publish its addresses one session in advance.

2. Prefetch the addresses of authorities of the next session in advance.

* frame/authority-discovery: Deduplicate authority ids

* frame/authority-discovery: Don't dedup on_genesis authorities

* frame/authority-discovery: Remove mut and sort on comparison in tests

* frame/authority-discovery: Use BTreeSet for deduplication

* Stop sending messages on legacy substream altogether (paritytech#6975)

* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* manual seal is now consensus agnostic (paritytech#7010)

* manual seal is now consensus agnostic

* pr grumbles

* grandpa: report metrics on prevotes and precommits cast (paritytech#6970)

* grandpa: report metrics on prevotes and precommits cast

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix compact npos solution edge count calculation (paritytech#7021)

This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this: 
```rust

struct Compact {
  votes1: ... ,
  votes2: ..., 
  ...,
  votes16: ...,
}
```

I already will fix this in paritytech#7007, but since it might take a while, this one can go in asap and make it to the very next runtime.

* Refactor & detach network metrics. (paritytech#6986)

* Refactor sc-network/service metrics.

  1. Aggregate sc-network metrics into a submodule, introducing
  two more sourced metrics to avoid duplicate atomics.

  2. Decouple periodic sc-service network metrics from other
  metrics, so that they can be updated independently.

* Update client/service/src/metrics.rs

* Update client/service/src/metrics.rs

* Node template complete import pipeline (paritytech#7014)

* Use complete import pipeline

* Line length

Co-authored-by: Dan Forbes <dan@danforbes.dev>

* client/authority-discovery: Throttle DHT requests (paritytech#7018)

* client/authority-discovery: Throttle DHT requests

Instead of passing one DHT query for each authority down to the network
every query interval, only pass MAX_IN_FLIGHT_LOOKUPS at a given point
in time, triggering new ones when previous ones return.

* client/authority-discovery/worker/test: Fix wrong constant

* Update Nicks docs to clarify that it is not production-ready (paritytech#6990)

* Ignore wasm_gc for debug build. (paritytech#6962)

* Ignore gc for debug build.

* alternate implementation

* Update utils/wasm-builder/src/lib.rs

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

* fix

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

* Make `--file` optional for `generate-node-key` (paritytech#7043)

This pr makes the `--file` argument optional to `generate-node-key`.
If the argument is not given, the secret node key will be printed to
`stdout`. The public node key will always be printed to `stderr`.

* Downgrade wabt = 0.9.1 (paritytech#7042)

* Add metadata shadows to multisig pallet (paritytech#7029)

* Add metadata shadows to multisig pallet

* Update frame/multisig/src/lib.rs

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

* Fix broken link to democracy pallet. (paritytech#7026)

Old link was broken, and I put a new one.

* Revert "Fix broken link to democracy pallet. (paritytech#7026)" (paritytech#7047)

This reverts commit 008cb24.

* Update the service tasks Grafana dashboard (paritytech#7038)

* babe, grandpa: waive fees on valid equivocation report (paritytech#6981)

* babe: waive fees on report_equivocation

* grandpa: waive fees on report_equivocation

* babe: add test for fee waiving on valid equivocation report

* grandpa: add test for fee waiving on valid equivocation report

* grandpa: remove stray comment

* Clarify Nicks docs (paritytech#7049)

* Improves EVM gas price check (paritytech#7051)

* Change wabt to wat (paritytech#7050)

* Add Dock network id for address generation (paritytech#6714)

Taking 21 and 22 for testnet and mainnet

Signed-off-by: lovesh <lovesh.bond@gmail.com>

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Rename `TRIGGER_WASM_BUILD` to `FORCE_WASM_BUILD` (paritytech#7080)

Because apparently I can not speak properly ;)

* Make decoding of `compact<perthing>` saturating instead of invalid (paritytech#7062)

* make decoding of cmopact<perthing> saturating

* fix stable build

* Update primitives/arithmetic/src/per_things.rs

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

* Update primitives/arithmetic/src/per_things.rs

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

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

* state_machine no_std witness externalities (paritytech#6934)

* checkpoint before removing CT from change trie

* before trie backend without tx

* undo

* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.

* Remove NoTransaction.

* partially address review.
dummy stats implementation for no_std.

* Remove ChangeTrieOverlay.

* modified function

* Remove witness_ext

* need noops changes root

* update from cumulus branch

* line break

* remove warning

* line break

* From review: renamings and stats active in no std (except time).

* include cache, exclude change trie cache with individual temporary bad looking
no_std check

* little test

* fuse imports and filter_map prepare_extrinsics_input_inner fold.

* put back ExtInner into Ext, awkward double proto for new function.

* Apply suggestions from code review

* Update primitives/state-machine/Cargo.toml

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

* Support hex encoded secret key for `--node-key` (paritytech#7052)

* Support hex encoded secret key for `--node-key`

Adds support for reading a hex encoded secret key when being passed as
file via `--node-key`.

* Make the key loading uniform

* Switch to `hex::decode`

* Add a `build-sync-spec` subcommand and remove the CHT roots from the light sync state. (paritytech#6999)

* Move subcommands from sc-cli to nodes

* Add --build-sync-spec subcommand

* Remove CHTs from snapshots

* Keep ProvideChtRoots

* Fix build sync spec (paritytech#7086)

* Fail docs on warnings (paritytech#5923)

* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (paritytech#7079)

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix `storage::read` (paritytech#7084)

* Fix `storage::read`

It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.

* Fix tests

* Add fuzzer for the compact custom codec implementation from PR paritytech#6720 (paritytech#7091)

* Add fuzzer for the compact custom codec implementation introduced in PR paritytech#6720.

This commit adds a fuzzing harness for the custom compact encoding/decoding
introduced in PR paritytech#6720.

* Update primitives/npos-elections/fuzzer/src/compact.rs

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

* Update Cargo.lock: Add changes in elections-fuzzer

* Change indentation from spaces to tabs

Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add instantiable support for treasury pallet (paritytech#7058)

* add instantiable support for treasury pallet

* update treasury pallet benchmarking code to support multi-instance

* use benchmark_intance! macro; fix hard coded treasury identity string; fix over characters line width limitation error

* fix line return style

* grandpa-rpc don't share subscription manager, only executor (paritytech#7039)

* service builder: fix todo about jsonrpc Option workaround

* grandpa-rpc: only share executor instead of sub manager

* grandpa-rpc: fix compilation

* grandpa-rpc: rename to subscription_executor

* node/cli: remove another unused jsonrpc dependency

* grandpa: apply style fixes from code review

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

* pallet-collective: allow customized default vote (paritytech#6984)

* collective: add DefaultVote trait

* Fix test and node compile

* Expose the whole prime_vote

* Add test for MoreThanMajorityThenPrimeDefaultVote

* Docs fix

* Upgrade to libp2p-0.28. (paritytech#7077)

* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI

* pow: support uniform tie breaking in fork choice (paritytech#7073)

* pow: support uniform tie breaking in fork choice

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

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

* Refactor fetch seal

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

* Allow remotes to not open a legacy substream (paritytech#7075)

* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake

* Use diener for Polkadot companion prs (paritytech#7102)

* Use diener for Polkadot companion prs

* Fix script

* Use gitlab env variable

* Update .maintain/gitlab/check_polkadot_companion_build.sh

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

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

* Update ui tests for rust 1.46.0 (paritytech#7106)

* client/network: Expose number of entries per Kademlia bucket (paritytech#7104)

Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the
number of nodes per bucket per Kademlia instance instead of only per
Kademlia instance.

* Improve error output of wasm-builder when wasm ins't installed (paritytech#7105)

This improves the error message of wasm-builder when the wasm toolchain
isn't installed. Currently we print that the wasm toolchain is not
installed, but the actual problem is that there is a bug in the
packaging in rust. This will now be much easier to debug, by printing
the full error message of the compiler.

* Add ss58 address for Dark network (paritytech#6982)

Hello,
This PR adds a new ss58 address 17 for Dark network.
Thanks!

* Frame-support storage: make iterations and translate consistent (paritytech#5470)

* implementation and factorisation

* factorize test

* doc

* fix bug and improve test

* address suggestions

* fix js dependancy alert, bumping bl version (paritytech#7110)

* fix js dependancy alert, bumping bl version

* fix low severity modules

* Make `transactional` attribute less scope dependent (paritytech#7112)

* Make `transactional` attribute less scope dependent

The old implementation expected that `frame-support` wasn't imported
under a different name. Besides that the pr removes some whitespaces.

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add SS58 Registry (paritytech#7020)

* add SS58 registry

* formatting

* description -> displayName

* Update ss58-registry.json

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* make numbers literal, tokens can have different denominations

* add dock

* add dark

* add websites and tokens

* add KLP decimals

* add acala and laminar info

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Move Staking Weights to T::WeightInfo (paritytech#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Send import notification always for re-orgs (paritytech#7118)

* Send import notification always for re-orgs

This pr changes the behavior of sending import notifications. Before we
only send notifications when importing blocks on the tip of the chain or
on similar conditions. However we did not send a notification when we
for example being in a state where we import multiple blocks to catch
up. If we re-org in this process, systems like the transaction pool
would not be notified about this re-org. This means, that we would also
not resubmit transactions of these retracted blocks. This pr fixes this,
by always sending a notification on a re-org.

See
https://github.com/substrate-developer-hub/substrate-node-template/issues/82
for some context about the bug.

* Update client/service/src/client/client.rs

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

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

* WeightInfo for Vesting Pallet (paritytech#7103)

* WeightInfo for Vesting Pallet

* clean up weight docs

* Update lib.rs

* try to pipe max locks

* Update for new type

* add warning when locks > MaxLocks

* Update lib.rs

* fix compile

* remove aliasing, fix trait def

* Update

* Add benchmarking pipeline to node-template (paritytech#7122)

* Use tracing-based subscriber logging (paritytech#6825)

* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>

* Typo in error text (paritytech#7126)

* WeightInfo for ImOnline (paritytech#7128)

* Add WeightInfo, not final weights

* benchmark machine weights

* fix the new staking weight in substrate-node (paritytech#7131)

* Remove warning about deprecated PeerIds (paritytech#7132)

* Fix db initialization for light client (paritytech#7130)

* Fix db initialization for light client

* Fix cache distribution

* WeightInfo for Identity Pallet (paritytech#7107)

* update benchmarks

* add automated weights

* Update benchmarking.rs

* use underscores for file out

* update some weights

* more weights

* finish weights

* add basic verification to benchmarks

* patch benchmarks

* Update benchmarking.rs

* final weights

* update for new type

* add weightinfo to node

* Make sure we update the `Cargo.lock` in the polkadot companion (paritytech#7135)

* Tracing for wasm with bridging to native (paritytech#6916)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* make tracing codecable

* replace with global tracing

* new tracing interface

* impl TracingSubscriber in client

* implement access to global TracingSubscriber from primitives

* span for wasm

* increment towards Wasm Tracing Subscriber implementation

* increment, remove sp-tracing from runtime-interface

* increment, it compiles

* attained original functionality with new mechanism

* implement remaining TracingSubscriber functions

* remove spans from decl_module

* add handling for encoded values

* Revert "replace with global tracing"

This reverts commit 8824a60.

* Wasm Side Tracing

* tracing on wasm

* enable tracing wasm on node-runtime

* export all the macros in std

* tracing subscriber on wasm-side only

* pass spans and events over and record them

* reactivate previous code and  cleanup

* further cleaning up

* extend the span macros, activate through executive

* tracking the actual extrinsic, too

* style

* fixing tests

* spaces -> tabs

* attempting to reactivate params

* activate our tests in CI

* some passing

* tests passing

* with core lazy

* global tracer for wasm side with pass over

* fixing metadata referencing

* remove const_fn feature requirement

* reenable dispatch traces

* reset client tracing

* further cleaning up

* fixing runtime-test

* move tracing-build setup into runtime-test

* Merge DebugWriter from tracing and frame-support, move to sp-std

* remove dangling fixme

* Docs for tracing primitives

* cleaning up a bit more

* Wasm interface docs

* optimise docs.rs setup

* adding tracing flags to uncomment

* remove brace

* fixing imports

* fixing broken syntax

* add required modules

* nicer formatting

* better target management

* adding low level storage tracing events into frame

* add custom Debug impl for WasmMetadata

* cloning profiler

* adding info about cloning profiler

* using in-scope for within calls

* proper time tracing, cleaning up println

* allow to disable tracing on runtime_interface-macro

* disable tracing for wasm-tracing-interface

* simplify wasm-tracing-api

* update client to new interface

* fixing docs and tests for sp-tracing

* update integration tests

* re-activating enter_span

* dropping FIXME, it's documented

* fix formatting

* fix formatting

* fix imports

* more debug info

* inform wasm about it being disabled by returning 1

* only one tracer, but enabled multi-all support

* make trait pub again for tests

* Apply suggestions from code review

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fixing wasm doc tests for proper usage

* remove unnecessary import

* fixing formatting

* minor style fixes

* downgrading wabt

* update error message for UI

* Fix interface test

* next attempt to fix macros

* geee

* revert tracing on hashed for future PR

* remove local macros, use originals

* we are able to convert to static items

* implement more WasmValue types

* adding support to convert str, debug and encoded values

* more minor fixes

* revert unsafe 'static making

* fix indentation

* remove commented lines

* bump all them tracing versions

* cleaning up docs and info

* document new flag

* the new layered system handles span cloning better

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>

* Pallet Indices (paritytech#7137)

* pow: replace the thread-base mining loop with a future-based mining worker (paritytech#7060)

* New worker design

* Remove unused thread import

* Add back missing inherent data provider registration

* Add function to get a Cloned metadata

* Add some docs

* Derive Eq and PartialEq for MiningMetadata

* Fix cargo lock

* Fix line width

* Add docs and fix issues in UntilImportedOrTimeout

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

Co-authored-by: David <dvdplm@gmail.com>

* Add back comments

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

* Bounties (paritytech#5715)

* add some compact annotation

* implement bounties for treasury

* fix test build

* remove some duplicated code

* fix build

* add tests

* fix build

* fix tests

* rename

* merge deposit byte fee

* add comments

* refactor storage

* support sub bounty

* emit BountyBecameActive when sub bounty is created

* able to contribute bounty

* allow curator to cancel bounty

* remove bounty contribution

* implement bounty expiry

* Able to extend bounty

* fix build and update tests

* create sub bounty test

* add more tests

* add benchmarks for bounties

* fix build

* line width

* fix benchmarking test

* update trait

* fix typo

* Update lib.rs

Missing documentation on Bounties added on this change. Please check the definitions of `propose_bounty` and `create_bounty`.

* update docs

* add MaximumSubBountyDepth

* put BountyValueMinimum into storage

* rework bount depth

* split on_initialize benchmarks

* remove components from constant functions

* Update weight integration into treasury

* Update reject proposal read/writes

* fix weight calculation

* Ignore weights with 0 factor

* Remove 0 multipliers

* add some docs

* allow unused for generated code

* line width

* allow RejectOrigin to cancel a pending payout bounty

* require BountyValueMinimum > ED

* make BountyValueMinimum configurable by chain spec

* remove sub-bounty features

* update curator

* accept curator

* unassign and cancel

* fix tests

* new tests

* Update lib.rs

- Include on `Assign_curator`, `accept_curator` and `unassign_curator` on Bounties Protocol Section 
- Include curator fee and curator deposit definitions on Terminology
- Update intro.

* fix test

* update extend_bounty_expiry

* fix benchmarking

* add new benchmarking code

* add docs

* fix tests

* Update benchmarking.rs

* Make BountyValueMinimum a trait config instead of stroage value

* fix runtime build

* Update weights

* Update default_weights.rs

* update weights

* update

* update comments

* unreserve curator fee

* update tests

* update benchmarks

* fix curator deposit handling

* trigger CI

* fix benchmarking

* use append instead of mutate push

* additional noop tests

* improve fee hanlding. update event docs

* RejectOrigin to unassign

* update bounty cancel logic

* use Zero::zero() over 0.into()

* fix tests

* fix benchmarks

* proposed fixes to bounties

* fix tests

* fix benchmarks

* update weightinfo

* use closure

* fix compile

* update weights

Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update SS58 configuration for Bifrost (paritytech#7142)

* Add 6 as address type of ss58 for Bifrost Network

* Update SS58 configuration for Bifrost

* Prometheus metrics for RPC calls (paritytech#7088)

* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters

* WeightInfo for Scheduler (paritytech#7138)

* initial scheduler stuff

* integrate weightinfo

* Update pallet_scheduler.rs

* grandpa-rpc: use FinalityProofProvider to check finality for rpc (paritytech#6215)

* grandpa-rpc: use FinalityProofProvider to check finality for rpc

* grandpa-rpc: minor tidy

* grandpa-rpc: remove dyn FinalityProofProvider

* grandpa-rpc: remove unused dependencies

* node: move finality_proof_provider setup

* grandpa-rpc: print error reported by finality_proof_provider

* grandpa-rpc: add note about unnecessary encode/decode

* grandpa-rpc: dont encode/decode and use correct hash

* grandpa-rpc: set_id is optional

* grandpa-rpc: create test for prove_finality

* grandpa-rpc: set visibility back to how it was

* grandpa-rpc: remove unused dependency

* grandpa-rpc: minor tidy

* grandpa: doc strings

* grandpa-rpc: rename to prove_finality

* grandpa-rpc: use current set id if none is provided

* grandpa-rpc: remove unnecessary check in test

* node: group finality_proof_provider in rpc_setup

* grandpa: make prove_finality concrete in FinalityProofProvider

* grandpa-rpc: wrap finality output in struct and store as Bytes

* grandpa-rpc: exhaustive error codes and wrap

* grandpa-rpc: let prove_finality take a range instead of a starting point

* grandpa-rpc: fix test for changed API

* grandpa-rpc: fix line length

* grandpa: fix reviewer nits

* node/rpc: fix reviewer comments

* Make it compile

* Rework the implementation and decrease the peer reputation on invalid
block announcement

* Implement limits for block announce validation

* Remove accidentally added file

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Rename `BlockAnnounceResult` to `PollBlockAnnounceValidation`

* Always return result using the internal future

* Move the polling and make sure all validation futures are registered

* Ignore the future in the legacy stuff

* Remove leftover stuff

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Swezey <matt@swezey.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gerben van de Wiel <clshannon@protonmail.com>
Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: joshua-mir <joshua@parity.io>
Co-authored-by: Nikita Puzankov <humb1t@yandex.ru>
Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Lovesh Harchandani <lovesh@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@live.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Kerwin Zhu <pfcoder97@gmail.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Wei Tang <wei@that.world>
Co-authored-by: DarkPay <42247799+DarkPayCoin@users.noreply.github.com>
Co-authored-by: HarryHong <hong091114@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Jianping Deng <djptux@gmail.com>
Co-authored-by: Anton Gavrilov <AntonE.Gavrilov@gmail.com>
insipx pushed a commit to insipx/substrate that referenced this pull request Nov 5, 2020
* Split block announce processing into two parts

This pull requests splits the block announce processing into two parts.
Into a phase that is called pre-validation that will be async and call
the block announce validator and into a second phase that processes the
result of the pre-validation.

The important change here is that the pre-validation phase is async.
This will be required by Cumulus/parachains. When a parachain announces
a block, it adds the candidate message send by the relay chain as extra
data into the block announcement. To verify this candidate message, the
relay chain parent is required that was used when building this message.
Now it can happen that we first receive the block announcement before
fully importing the relay chain block and this leads to the parachain
block not being imported. By making the pre-validation async, we will be
able to wait for the relay chain block to be imported to verify the
candidate message.

* Apply suggestions from code review

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* client/authority-discovery: Append PeerId to Multiaddr at most once (paritytech#6933)

* client/authority-discovery/worker: Extract address getter

* client/authority-discovery: Test for no duplicate p2p components

* client/authority-discovery: Append PeerId to Multiaddr at most once

When collecting the addresses to be published for the local node,
`addresses_to_publish` adds the local nodes `PeerId` to each
`Multiaddr`. Before doing so, ensure the `Multiaddr` does not already
contain one.

* client/authority-discovery: Remove explicit return

* expose Deposit (paritytech#6943)

* Add a `LightSyncState` field to the chain spec (paritytech#6894)

* Reset code, almost ready for PR

* Improved build_hardcoded_spec

* Fix line widths

* Fix tests

* Fix sc-service-test

* Suggestions from code review

* Rename to LightSyncState

* It's not syncing :^(

* It syncs!

* Remove rpc call

* Convert spaces to tabs

* Moved sc-service things to export_sync_state.rs

* Fix tests

* Wait for syncing with network_status_sinks

* Remove sc-network from node-template

* Apply suggestions from code review

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

* Various changes, split the flag up into 2 pieces to make testing easier.

* Update client/cli/src/commands/build_spec_cmd.rs

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

* Revert a lot of changes

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

* Dynamically generate CHT roots on a full client (paritytech#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments

* Enable verification logic when executing benchmarks (paritytech#6929)

* Add `--verify` flag to benchmark execution

* make it so `--verify` can be used for getting the actual benchmarks

* undo manual testing

* oops

* use benchmark config struct

* verify is default on, docs update

* remove clone

* improve formatting

* fix test

* bump impl for ci

* grandpa: always create and send justification if there are any subscribers (paritytech#6935)

* grandpa: use bytes type for justification rpc notification

* grandpa: always create justification if there are rpc subscribers

* grandpa: wording

* grandpa: replace notify_justification macro with function

* grandpa: prefer Option<&T> over &Option<T>

* .maintain/monitoring/alerting-rules: Add fd alert (paritytech#6946)

Alert on high file descriptor allocation.

* Fix benchmark read/write key tracker for keys in child storages. (paritytech#6905)

* WIP: read child trie and write child trie

* add test

* refactor a bit + improve log

* better naming

* trigger CI

* Revert "trigger CI"

This reverts commit d0aadae.

* client/authority-discovery: Limit number of addresses per authority (paritytech#6947)

* client/authority-discovery: Test addresses per authority limit

* client/authority-discovery: Limit number of addresses per authority

* ⛓ ✨Add ShiftNrg Network SS58 address type (paritytech#6942)

* update tracing attribute (paritytech#6950)

* Fix unwraps and other issues with benchmarks (paritytech#6957)

* Fix unwraps and other issues with benchmarks

* undo changes to contracts pallet

* Remove implementation of `Randomness for ()` (paritytech#6959)

* Fix staking fuzzer. (paritytech#6954)

* Enforce that ProtocolId is a string (paritytech#6953)

* Enforce that ProtocolId is a string

* Fix test

* Support Staking Payout to Any Account (paritytech#6832)

* Support staking payout to any account

* fix offences benchmarks

* Better prime election. (paritytech#6939)

* Better prime election.

* improve docs

* more sensible variable names

* link to Borda count wiki

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* babe: fix report_equivocation weight (paritytech#6936)

* babe: fix report_equivocation weight

* node: bump spec_version

* babe: fix floor in report_equivocation weight calculation

Co-authored-by: Gavin Wood <gavin@parity.io>

* grandpa: fix floor in report_equivocation weight calculation

* babe, grandpa: add test for weight_for::report_equivocation

Co-authored-by: Gavin Wood <gavin@parity.io>

* fix bench db wipe (paritytech#6965)

* Implement request-responses protocols (paritytech#6634)

* Implement request-responses protocols

* Add tests

* Fix sc-cli

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix naming

* Fix other issues

* Other naming fix

* Fix error logging

* Max sizes to u64

* Don't kill connections on refusal to process

* Adjust comment

Co-authored-by: Max Inden <mail@max-inden.de>

* add generated weight info for pallet-collective (paritytech#6789)

* add benchmark for disapprove_proposal

* use generated WeightInfo for pallet-collective weights

* order collective benchmark params alphabetically to get a consistent ordering

* address review comments

* remove default impl of WeightInfo for ()

* remove comments about weight changes

* add default weights

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* whitelist voter account in benchmark

* update weights

* MaxMembers configurable

* remove base weight comment

* add weight to technical collective

* another DB whitelist optimization

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* client/*: Treat protocol name as str and not [u8] (paritytech#6967)

* client/*: Treat protocol name as str and not [u8]

Notification protocol names are in practice always valid utf8 strings.
Instead of treating them as such in the type system, thus far they were
casted to a [u8] at creation time.

With this commit protocol names are instead treated as valid utf8
strings throughout the codebase and passed as `Cow<'static, str>`
instead of `Cow<'static, [u8]>`. Among other things this eliminates the
need for string casting when logging.

* client/network: Don't allocate when protocol name is borrowed

* update kvdb-rocksdb to 0.9.1 and rocksdb to 6.11.4 (paritytech#6963)

* Use AsyncReadExt::read_exact, not just read (paritytech#6977)

* client/cli/src/config: Warn on low file descriptor limit (paritytech#6956)

* client/cli/src/config: Warn on low file descriptor limit

Substrate sets the soft file descriptor limit to the hard limit at
startup. In the case of the latter being low already (< 10_000) a
Substrate node under high demand might run into issues e.g. when opening
up new TCP connections or persisting data to the database.

With this commit a warn message is printed to stderr.

* client/cli/Cargo.toml: Update to fdlimit 0.2.0

* Update substrate bip39 version. (paritytech#6955)

* update bip39 version

* and lock

* Inverting events set and changed in nicks pallet (paritytech#6989)

Fixing paritytech#6988

* Silence the error about non-registered protocols (paritytech#6987)

* Silence the error about non-registered protocols

* Silence the other two locations as well

* Change browser-demo build.sh to use python 3 again (paritytech#6992)

* fix pallet-evm features (paritytech#6995)

* Move subcommands from sc-cli to nodes (paritytech#6948)

* ci: deploy alerting rules: fix run on changes (paritytech#6998)

* ci: deploy alerting rules: fix run on changes

Co-authored-by: Max Inden <mail@max-inden.de>

* *: Update to Prometheus v0.10.0 (paritytech#6964)

* *: Update to Prometheus v0.10.0-rc.1

* *: Update to Prometheus v0.10.0

* Ensure that handshake is sent back even in case of back-pressure (paritytech#6979)

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>

* frame/authority-discovery: Have authorities() return both current and next (paritytech#6788)

* frame/authority-discovery: Have authorities() return both current and next

Authority address lookups on the DHT happen periodically (every 10
mintues) and are rather slow (~10 seconds).

In order to smooth the transition period between two sessions, have the
runtime module return both the current as well as the next authority
set. Thereby the client authority module will:

1. Publish its addresses one session in advance.

2. Prefetch the addresses of authorities of the next session in advance.

* frame/authority-discovery: Deduplicate authority ids

* frame/authority-discovery: Don't dedup on_genesis authorities

* frame/authority-discovery: Remove mut and sort on comparison in tests

* frame/authority-discovery: Use BTreeSet for deduplication

* Stop sending messages on legacy substream altogether (paritytech#6975)

* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* manual seal is now consensus agnostic (paritytech#7010)

* manual seal is now consensus agnostic

* pr grumbles

* grandpa: report metrics on prevotes and precommits cast (paritytech#6970)

* grandpa: report metrics on prevotes and precommits cast

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix compact npos solution edge count calculation (paritytech#7021)

This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this:
```rust

struct Compact {
  votes1: ... ,
  votes2: ...,
  ...,
  votes16: ...,
}
```

I already will fix this in paritytech#7007, but since it might take a while, this one can go in asap and make it to the very next runtime.

* Refactor & detach network metrics. (paritytech#6986)

* Refactor sc-network/service metrics.

  1. Aggregate sc-network metrics into a submodule, introducing
  two more sourced metrics to avoid duplicate atomics.

  2. Decouple periodic sc-service network metrics from other
  metrics, so that they can be updated independently.

* Update client/service/src/metrics.rs

* Update client/service/src/metrics.rs

* Node template complete import pipeline (paritytech#7014)

* Use complete import pipeline

* Line length

Co-authored-by: Dan Forbes <dan@danforbes.dev>

* client/authority-discovery: Throttle DHT requests (paritytech#7018)

* client/authority-discovery: Throttle DHT requests

Instead of passing one DHT query for each authority down to the network
every query interval, only pass MAX_IN_FLIGHT_LOOKUPS at a given point
in time, triggering new ones when previous ones return.

* client/authority-discovery/worker/test: Fix wrong constant

* Update Nicks docs to clarify that it is not production-ready (paritytech#6990)

* Ignore wasm_gc for debug build. (paritytech#6962)

* Ignore gc for debug build.

* alternate implementation

* Update utils/wasm-builder/src/lib.rs

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

* fix

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

* Make `--file` optional for `generate-node-key` (paritytech#7043)

This pr makes the `--file` argument optional to `generate-node-key`.
If the argument is not given, the secret node key will be printed to
`stdout`. The public node key will always be printed to `stderr`.

* Downgrade wabt = 0.9.1 (paritytech#7042)

* Add metadata shadows to multisig pallet (paritytech#7029)

* Add metadata shadows to multisig pallet

* Update frame/multisig/src/lib.rs

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

* Fix broken link to democracy pallet. (paritytech#7026)

Old link was broken, and I put a new one.

* Revert "Fix broken link to democracy pallet. (paritytech#7026)" (paritytech#7047)

This reverts commit 008cb24.

* Update the service tasks Grafana dashboard (paritytech#7038)

* babe, grandpa: waive fees on valid equivocation report (paritytech#6981)

* babe: waive fees on report_equivocation

* grandpa: waive fees on report_equivocation

* babe: add test for fee waiving on valid equivocation report

* grandpa: add test for fee waiving on valid equivocation report

* grandpa: remove stray comment

* Clarify Nicks docs (paritytech#7049)

* Improves EVM gas price check (paritytech#7051)

* Change wabt to wat (paritytech#7050)

* Add Dock network id for address generation (paritytech#6714)

Taking 21 and 22 for testnet and mainnet

Signed-off-by: lovesh <lovesh.bond@gmail.com>

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Rename `TRIGGER_WASM_BUILD` to `FORCE_WASM_BUILD` (paritytech#7080)

Because apparently I can not speak properly ;)

* Make decoding of `compact<perthing>` saturating instead of invalid (paritytech#7062)

* make decoding of cmopact<perthing> saturating

* fix stable build

* Update primitives/arithmetic/src/per_things.rs

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

* Update primitives/arithmetic/src/per_things.rs

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

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

* state_machine no_std witness externalities (paritytech#6934)

* checkpoint before removing CT from change trie

* before trie backend without tx

* undo

* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.

* Remove NoTransaction.

* partially address review.
dummy stats implementation for no_std.

* Remove ChangeTrieOverlay.

* modified function

* Remove witness_ext

* need noops changes root

* update from cumulus branch

* line break

* remove warning

* line break

* From review: renamings and stats active in no std (except time).

* include cache, exclude change trie cache with individual temporary bad looking
no_std check

* little test

* fuse imports and filter_map prepare_extrinsics_input_inner fold.

* put back ExtInner into Ext, awkward double proto for new function.

* Apply suggestions from code review

* Update primitives/state-machine/Cargo.toml

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

* Support hex encoded secret key for `--node-key` (paritytech#7052)

* Support hex encoded secret key for `--node-key`

Adds support for reading a hex encoded secret key when being passed as
file via `--node-key`.

* Make the key loading uniform

* Switch to `hex::decode`

* Add a `build-sync-spec` subcommand and remove the CHT roots from the light sync state. (paritytech#6999)

* Move subcommands from sc-cli to nodes

* Add --build-sync-spec subcommand

* Remove CHTs from snapshots

* Keep ProvideChtRoots

* Fix build sync spec (paritytech#7086)

* Fail docs on warnings (paritytech#5923)

* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (paritytech#7079)

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix `storage::read` (paritytech#7084)

* Fix `storage::read`

It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.

* Fix tests

* Add fuzzer for the compact custom codec implementation from PR paritytech#6720 (paritytech#7091)

* Add fuzzer for the compact custom codec implementation introduced in PR paritytech#6720.

This commit adds a fuzzing harness for the custom compact encoding/decoding
introduced in PR paritytech#6720.

* Update primitives/npos-elections/fuzzer/src/compact.rs

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

* Update Cargo.lock: Add changes in elections-fuzzer

* Change indentation from spaces to tabs

Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add instantiable support for treasury pallet (paritytech#7058)

* add instantiable support for treasury pallet

* update treasury pallet benchmarking code to support multi-instance

* use benchmark_intance! macro; fix hard coded treasury identity string; fix over characters line width limitation error

* fix line return style

* grandpa-rpc don't share subscription manager, only executor (paritytech#7039)

* service builder: fix todo about jsonrpc Option workaround

* grandpa-rpc: only share executor instead of sub manager

* grandpa-rpc: fix compilation

* grandpa-rpc: rename to subscription_executor

* node/cli: remove another unused jsonrpc dependency

* grandpa: apply style fixes from code review

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

* pallet-collective: allow customized default vote (paritytech#6984)

* collective: add DefaultVote trait

* Fix test and node compile

* Expose the whole prime_vote

* Add test for MoreThanMajorityThenPrimeDefaultVote

* Docs fix

* Upgrade to libp2p-0.28. (paritytech#7077)

* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI

* pow: support uniform tie breaking in fork choice (paritytech#7073)

* pow: support uniform tie breaking in fork choice

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

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

* Refactor fetch seal

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

* Allow remotes to not open a legacy substream (paritytech#7075)

* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake

* Use diener for Polkadot companion prs (paritytech#7102)

* Use diener for Polkadot companion prs

* Fix script

* Use gitlab env variable

* Update .maintain/gitlab/check_polkadot_companion_build.sh

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

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

* Update ui tests for rust 1.46.0 (paritytech#7106)

* client/network: Expose number of entries per Kademlia bucket (paritytech#7104)

Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the
number of nodes per bucket per Kademlia instance instead of only per
Kademlia instance.

* Improve error output of wasm-builder when wasm ins't installed (paritytech#7105)

This improves the error message of wasm-builder when the wasm toolchain
isn't installed. Currently we print that the wasm toolchain is not
installed, but the actual problem is that there is a bug in the
packaging in rust. This will now be much easier to debug, by printing
the full error message of the compiler.

* Add ss58 address for Dark network (paritytech#6982)

Hello,
This PR adds a new ss58 address 17 for Dark network.
Thanks!

* Frame-support storage: make iterations and translate consistent (paritytech#5470)

* implementation and factorisation

* factorize test

* doc

* fix bug and improve test

* address suggestions

* fix js dependancy alert, bumping bl version (paritytech#7110)

* fix js dependancy alert, bumping bl version

* fix low severity modules

* Make `transactional` attribute less scope dependent (paritytech#7112)

* Make `transactional` attribute less scope dependent

The old implementation expected that `frame-support` wasn't imported
under a different name. Besides that the pr removes some whitespaces.

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add SS58 Registry (paritytech#7020)

* add SS58 registry

* formatting

* description -> displayName

* Update ss58-registry.json

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* make numbers literal, tokens can have different denominations

* add dock

* add dark

* add websites and tokens

* add KLP decimals

* add acala and laminar info

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Move Staking Weights to T::WeightInfo (paritytech#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Send import notification always for re-orgs (paritytech#7118)

* Send import notification always for re-orgs

This pr changes the behavior of sending import notifications. Before we
only send notifications when importing blocks on the tip of the chain or
on similar conditions. However we did not send a notification when we
for example being in a state where we import multiple blocks to catch
up. If we re-org in this process, systems like the transaction pool
would not be notified about this re-org. This means, that we would also
not resubmit transactions of these retracted blocks. This pr fixes this,
by always sending a notification on a re-org.

See
https://github.com/substrate-developer-hub/substrate-node-template/issues/82
for some context about the bug.

* Update client/service/src/client/client.rs

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

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

* WeightInfo for Vesting Pallet (paritytech#7103)

* WeightInfo for Vesting Pallet

* clean up weight docs

* Update lib.rs

* try to pipe max locks

* Update for new type

* add warning when locks > MaxLocks

* Update lib.rs

* fix compile

* remove aliasing, fix trait def

* Update

* Add benchmarking pipeline to node-template (paritytech#7122)

* Use tracing-based subscriber logging (paritytech#6825)

* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>

* Typo in error text (paritytech#7126)

* WeightInfo for ImOnline (paritytech#7128)

* Add WeightInfo, not final weights

* benchmark machine weights

* fix the new staking weight in substrate-node (paritytech#7131)

* Remove warning about deprecated PeerIds (paritytech#7132)

* Fix db initialization for light client (paritytech#7130)

* Fix db initialization for light client

* Fix cache distribution

* WeightInfo for Identity Pallet (paritytech#7107)

* update benchmarks

* add automated weights

* Update benchmarking.rs

* use underscores for file out

* update some weights

* more weights

* finish weights

* add basic verification to benchmarks

* patch benchmarks

* Update benchmarking.rs

* final weights

* update for new type

* add weightinfo to node

* Make sure we update the `Cargo.lock` in the polkadot companion (paritytech#7135)

* Tracing for wasm with bridging to native (paritytech#6916)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* make tracing codecable

* replace with global tracing

* new tracing interface

* impl TracingSubscriber in client

* implement access to global TracingSubscriber from primitives

* span for wasm

* increment towards Wasm Tracing Subscriber implementation

* increment, remove sp-tracing from runtime-interface

* increment, it compiles

* attained original functionality with new mechanism

* implement remaining TracingSubscriber functions

* remove spans from decl_module

* add handling for encoded values

* Revert "replace with global tracing"

This reverts commit 8824a60.

* Wasm Side Tracing

* tracing on wasm

* enable tracing wasm on node-runtime

* export all the macros in std

* tracing subscriber on wasm-side only

* pass spans and events over and record them

* reactivate previous code and  cleanup

* further cleaning up

* extend the span macros, activate through executive

* tracking the actual extrinsic, too

* style

* fixing tests

* spaces -> tabs

* attempting to reactivate params

* activate our tests in CI

* some passing

* tests passing

* with core lazy

* global tracer for wasm side with pass over

* fixing metadata referencing

* remove const_fn feature requirement

* reenable dispatch traces

* reset client tracing

* further cleaning up

* fixing runtime-test

* move tracing-build setup into runtime-test

* Merge DebugWriter from tracing and frame-support, move to sp-std

* remove dangling fixme

* Docs for tracing primitives

* cleaning up a bit more

* Wasm interface docs

* optimise docs.rs setup

* adding tracing flags to uncomment

* remove brace

* fixing imports

* fixing broken syntax

* add required modules

* nicer formatting

* better target management

* adding low level storage tracing events into frame

* add custom Debug impl for WasmMetadata

* cloning profiler

* adding info about cloning profiler

* using in-scope for within calls

* proper time tracing, cleaning up println

* allow to disable tracing on runtime_interface-macro

* disable tracing for wasm-tracing-interface

* simplify wasm-tracing-api

* update client to new interface

* fixing docs and tests for sp-tracing

* update integration tests

* re-activating enter_span

* dropping FIXME, it's documented

* fix formatting

* fix formatting

* fix imports

* more debug info

* inform wasm about it being disabled by returning 1

* only one tracer, but enabled multi-all support

* make trait pub again for tests

* Apply suggestions from code review

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fixing wasm doc tests for proper usage

* remove unnecessary import

* fixing formatting

* minor style fixes

* downgrading wabt

* update error message for UI

* Fix interface test

* next attempt to fix macros

* geee

* revert tracing on hashed for future PR

* remove local macros, use originals

* we are able to convert to static items

* implement more WasmValue types

* adding support to convert str, debug and encoded values

* more minor fixes

* revert unsafe 'static making

* fix indentation

* remove commented lines

* bump all them tracing versions

* cleaning up docs and info

* document new flag

* the new layered system handles span cloning better

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>

* Pallet Indices (paritytech#7137)

* pow: replace the thread-base mining loop with a future-based mining worker (paritytech#7060)

* New worker design

* Remove unused thread import

* Add back missing inherent data provider registration

* Add function to get a Cloned metadata

* Add some docs

* Derive Eq and PartialEq for MiningMetadata

* Fix cargo lock

* Fix line width

* Add docs and fix issues in UntilImportedOrTimeout

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

Co-authored-by: David <dvdplm@gmail.com>

* Add back comments

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

* Bounties (paritytech#5715)

* add some compact annotation

* implement bounties for treasury

* fix test build

* remove some duplicated code

* fix build

* add tests

* fix build

* fix tests

* rename

* merge deposit byte fee

* add comments

* refactor storage

* support sub bounty

* emit BountyBecameActive when sub bounty is created

* able to contribute bounty

* allow curator to cancel bounty

* remove bounty contribution

* implement bounty expiry

* Able to extend bounty

* fix build and update tests

* create sub bounty test

* add more tests

* add benchmarks for bounties

* fix build

* line width

* fix benchmarking test

* update trait

* fix typo

* Update lib.rs

Missing documentation on Bounties added on this change. Please check the definitions of `propose_bounty` and `create_bounty`.

* update docs

* add MaximumSubBountyDepth

* put BountyValueMinimum into storage

* rework bount depth

* split on_initialize benchmarks

* remove components from constant functions

* Update weight integration into treasury

* Update reject proposal read/writes

* fix weight calculation

* Ignore weights with 0 factor

* Remove 0 multipliers

* add some docs

* allow unused for generated code

* line width

* allow RejectOrigin to cancel a pending payout bounty

* require BountyValueMinimum > ED

* make BountyValueMinimum configurable by chain spec

* remove sub-bounty features

* update curator

* accept curator

* unassign and cancel

* fix tests

* new tests

* Update lib.rs

- Include on `Assign_curator`, `accept_curator` and `unassign_curator` on Bounties Protocol Section
- Include curator fee and curator deposit definitions on Terminology
- Update intro.

* fix test

* update extend_bounty_expiry

* fix benchmarking

* add new benchmarking code

* add docs

* fix tests

* Update benchmarking.rs

* Make BountyValueMinimum a trait config instead of stroage value

* fix runtime build

* Update weights

* Update default_weights.rs

* update weights

* update

* update comments

* unreserve curator fee

* update tests

* update benchmarks

* fix curator deposit handling

* trigger CI

* fix benchmarking

* use append instead of mutate push

* additional noop tests

* improve fee hanlding. update event docs

* RejectOrigin to unassign

* update bounty cancel logic

* use Zero::zero() over 0.into()

* fix tests

* fix benchmarks

* proposed fixes to bounties

* fix tests

* fix benchmarks

* update weightinfo

* use closure

* fix compile

* update weights

Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update SS58 configuration for Bifrost (paritytech#7142)

* Add 6 as address type of ss58 for Bifrost Network

* Update SS58 configuration for Bifrost

* Prometheus metrics for RPC calls (paritytech#7088)

* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters

* WeightInfo for Scheduler (paritytech#7138)

* initial scheduler stuff

* integrate weightinfo

* Update pallet_scheduler.rs

* grandpa-rpc: use FinalityProofProvider to check finality for rpc (paritytech#6215)

* grandpa-rpc: use FinalityProofProvider to check finality for rpc

* grandpa-rpc: minor tidy

* grandpa-rpc: remove dyn FinalityProofProvider

* grandpa-rpc: remove unused dependencies

* node: move finality_proof_provider setup

* grandpa-rpc: print error reported by finality_proof_provider

* grandpa-rpc: add note about unnecessary encode/decode

* grandpa-rpc: dont encode/decode and use correct hash

* grandpa-rpc: set_id is optional

* grandpa-rpc: create test for prove_finality

* grandpa-rpc: set visibility back to how it was

* grandpa-rpc: remove unused dependency

* grandpa-rpc: minor tidy

* grandpa: doc strings

* grandpa-rpc: rename to prove_finality

* grandpa-rpc: use current set id if none is provided

* grandpa-rpc: remove unnecessary check in test

* node: group finality_proof_provider in rpc_setup

* grandpa: make prove_finality concrete in FinalityProofProvider

* grandpa-rpc: wrap finality output in struct and store as Bytes

* grandpa-rpc: exhaustive error codes and wrap

* grandpa-rpc: let prove_finality take a range instead of a starting point

* grandpa-rpc: fix test for changed API

* grandpa-rpc: fix line length

* grandpa: fix reviewer nits

* node/rpc: fix reviewer comments

* Make it compile

* Rework the implementation and decrease the peer reputation on invalid
block announcement

* Implement limits for block announce validation

* Remove accidentally added file

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Rename `BlockAnnounceResult` to `PollBlockAnnounceValidation`

* Always return result using the internal future

* Move the polling and make sure all validation futures are registered

* Ignore the future in the legacy stuff

* Remove leftover stuff

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Swezey <matt@swezey.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gerben van de Wiel <clshannon@protonmail.com>
Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: joshua-mir <joshua@parity.io>
Co-authored-by: Nikita Puzankov <humb1t@yandex.ru>
Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Lovesh Harchandani <lovesh@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@live.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Kerwin Zhu <pfcoder97@gmail.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Wei Tang <wei@that.world>
Co-authored-by: DarkPay <42247799+DarkPayCoin@users.noreply.github.com>
Co-authored-by: HarryHong <hong091114@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Jianping Deng <djptux@gmail.com>
Co-authored-by: Anton Gavrilov <AntonE.Gavrilov@gmail.com>
insipx pushed a commit to insipx/substrate that referenced this pull request Nov 9, 2020
* Split block announce processing into two parts

This pull requests splits the block announce processing into two parts.
Into a phase that is called pre-validation that will be async and call
the block announce validator and into a second phase that processes the
result of the pre-validation.

The important change here is that the pre-validation phase is async.
This will be required by Cumulus/parachains. When a parachain announces
a block, it adds the candidate message send by the relay chain as extra
data into the block announcement. To verify this candidate message, the
relay chain parent is required that was used when building this message.
Now it can happen that we first receive the block announcement before
fully importing the relay chain block and this leads to the parachain
block not being imported. By making the pre-validation async, we will be
able to wait for the relay chain block to be imported to verify the
candidate message.

* Apply suggestions from code review

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* client/authority-discovery: Append PeerId to Multiaddr at most once (paritytech#6933)

* client/authority-discovery/worker: Extract address getter

* client/authority-discovery: Test for no duplicate p2p components

* client/authority-discovery: Append PeerId to Multiaddr at most once

When collecting the addresses to be published for the local node,
`addresses_to_publish` adds the local nodes `PeerId` to each
`Multiaddr`. Before doing so, ensure the `Multiaddr` does not already
contain one.

* client/authority-discovery: Remove explicit return

* expose Deposit (paritytech#6943)

* Add a `LightSyncState` field to the chain spec (paritytech#6894)

* Reset code, almost ready for PR

* Improved build_hardcoded_spec

* Fix line widths

* Fix tests

* Fix sc-service-test

* Suggestions from code review

* Rename to LightSyncState

* It's not syncing :^(

* It syncs!

* Remove rpc call

* Convert spaces to tabs

* Moved sc-service things to export_sync_state.rs

* Fix tests

* Wait for syncing with network_status_sinks

* Remove sc-network from node-template

* Apply suggestions from code review

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

* Various changes, split the flag up into 2 pieces to make testing easier.

* Update client/cli/src/commands/build_spec_cmd.rs

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

* Revert a lot of changes

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

* Dynamically generate CHT roots on a full client (paritytech#6944)

* Generate CHT roots on a full client

* add changes_trie_root function

* Add a test

* Line widths

* Fix sc-service-test

* Clarify comments

* Revert comments

* Enable verification logic when executing benchmarks (paritytech#6929)

* Add `--verify` flag to benchmark execution

* make it so `--verify` can be used for getting the actual benchmarks

* undo manual testing

* oops

* use benchmark config struct

* verify is default on, docs update

* remove clone

* improve formatting

* fix test

* bump impl for ci

* grandpa: always create and send justification if there are any subscribers (paritytech#6935)

* grandpa: use bytes type for justification rpc notification

* grandpa: always create justification if there are rpc subscribers

* grandpa: wording

* grandpa: replace notify_justification macro with function

* grandpa: prefer Option<&T> over &Option<T>

* .maintain/monitoring/alerting-rules: Add fd alert (paritytech#6946)

Alert on high file descriptor allocation.

* Fix benchmark read/write key tracker for keys in child storages. (paritytech#6905)

* WIP: read child trie and write child trie

* add test

* refactor a bit + improve log

* better naming

* trigger CI

* Revert "trigger CI"

This reverts commit d0aadae.

* client/authority-discovery: Limit number of addresses per authority (paritytech#6947)

* client/authority-discovery: Test addresses per authority limit

* client/authority-discovery: Limit number of addresses per authority

* ⛓ ✨Add ShiftNrg Network SS58 address type (paritytech#6942)

* update tracing attribute (paritytech#6950)

* Fix unwraps and other issues with benchmarks (paritytech#6957)

* Fix unwraps and other issues with benchmarks

* undo changes to contracts pallet

* Remove implementation of `Randomness for ()` (paritytech#6959)

* Fix staking fuzzer. (paritytech#6954)

* Enforce that ProtocolId is a string (paritytech#6953)

* Enforce that ProtocolId is a string

* Fix test

* Support Staking Payout to Any Account (paritytech#6832)

* Support staking payout to any account

* fix offences benchmarks

* Better prime election. (paritytech#6939)

* Better prime election.

* improve docs

* more sensible variable names

* link to Borda count wiki

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* babe: fix report_equivocation weight (paritytech#6936)

* babe: fix report_equivocation weight

* node: bump spec_version

* babe: fix floor in report_equivocation weight calculation

Co-authored-by: Gavin Wood <gavin@parity.io>

* grandpa: fix floor in report_equivocation weight calculation

* babe, grandpa: add test for weight_for::report_equivocation

Co-authored-by: Gavin Wood <gavin@parity.io>

* fix bench db wipe (paritytech#6965)

* Implement request-responses protocols (paritytech#6634)

* Implement request-responses protocols

* Add tests

* Fix sc-cli

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix naming

* Fix other issues

* Other naming fix

* Fix error logging

* Max sizes to u64

* Don't kill connections on refusal to process

* Adjust comment

Co-authored-by: Max Inden <mail@max-inden.de>

* add generated weight info for pallet-collective (paritytech#6789)

* add benchmark for disapprove_proposal

* use generated WeightInfo for pallet-collective weights

* order collective benchmark params alphabetically to get a consistent ordering

* address review comments

* remove default impl of WeightInfo for ()

* remove comments about weight changes

* add default weights

* Apply suggestions from code review

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* whitelist voter account in benchmark

* update weights

* MaxMembers configurable

* remove base weight comment

* add weight to technical collective

* another DB whitelist optimization

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* client/*: Treat protocol name as str and not [u8] (paritytech#6967)

* client/*: Treat protocol name as str and not [u8]

Notification protocol names are in practice always valid utf8 strings.
Instead of treating them as such in the type system, thus far they were
casted to a [u8] at creation time.

With this commit protocol names are instead treated as valid utf8
strings throughout the codebase and passed as `Cow<'static, str>`
instead of `Cow<'static, [u8]>`. Among other things this eliminates the
need for string casting when logging.

* client/network: Don't allocate when protocol name is borrowed

* update kvdb-rocksdb to 0.9.1 and rocksdb to 6.11.4 (paritytech#6963)

* Use AsyncReadExt::read_exact, not just read (paritytech#6977)

* client/cli/src/config: Warn on low file descriptor limit (paritytech#6956)

* client/cli/src/config: Warn on low file descriptor limit

Substrate sets the soft file descriptor limit to the hard limit at
startup. In the case of the latter being low already (< 10_000) a
Substrate node under high demand might run into issues e.g. when opening
up new TCP connections or persisting data to the database.

With this commit a warn message is printed to stderr.

* client/cli/Cargo.toml: Update to fdlimit 0.2.0

* Update substrate bip39 version. (paritytech#6955)

* update bip39 version

* and lock

* Inverting events set and changed in nicks pallet (paritytech#6989)

Fixing paritytech#6988

* Silence the error about non-registered protocols (paritytech#6987)

* Silence the error about non-registered protocols

* Silence the other two locations as well

* Change browser-demo build.sh to use python 3 again (paritytech#6992)

* fix pallet-evm features (paritytech#6995)

* Move subcommands from sc-cli to nodes (paritytech#6948)

* ci: deploy alerting rules: fix run on changes (paritytech#6998)

* ci: deploy alerting rules: fix run on changes

Co-authored-by: Max Inden <mail@max-inden.de>

* *: Update to Prometheus v0.10.0 (paritytech#6964)

* *: Update to Prometheus v0.10.0-rc.1

* *: Update to Prometheus v0.10.0

* Ensure that handshake is sent back even in case of back-pressure (paritytech#6979)

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

Co-authored-by: Max Inden <mail@max-inden.de>

* frame/authority-discovery: Have authorities() return both current and next (paritytech#6788)

* frame/authority-discovery: Have authorities() return both current and next

Authority address lookups on the DHT happen periodically (every 10
mintues) and are rather slow (~10 seconds).

In order to smooth the transition period between two sessions, have the
runtime module return both the current as well as the next authority
set. Thereby the client authority module will:

1. Publish its addresses one session in advance.

2. Prefetch the addresses of authorities of the next session in advance.

* frame/authority-discovery: Deduplicate authority ids

* frame/authority-discovery: Don't dedup on_genesis authorities

* frame/authority-discovery: Remove mut and sort on comparison in tests

* frame/authority-discovery: Use BTreeSet for deduplication

* Stop sending messages on legacy substream altogether (paritytech#6975)

* Stop sending messages on legacy substream altogether

* Ensure that handshake is sent back even in case of back-pressure

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Also process OpenRequest and Closed

* Also process OpenRequest and Closed

* Fix bad merge

* God I'm so lost with all these merges

* Immediately return Closed

* Add warning for sending on non-registered protocol

* Register GrandPa protocol in tests

* Update client/network/src/protocol/generic_proto/handler/group.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* manual seal is now consensus agnostic (paritytech#7010)

* manual seal is now consensus agnostic

* pr grumbles

* grandpa: report metrics on prevotes and precommits cast (paritytech#6970)

* grandpa: report metrics on prevotes and precommits cast

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Update client/finality-grandpa/src/environment.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>

* Fix compact npos solution edge count calculation (paritytech#7021)

This edge count is used for weighing, and it is somewhat trivial to review and verify that the current implementation was ignoring `votes16` field of the struct. As reminder, the struct is like this:
```rust

struct Compact {
  votes1: ... ,
  votes2: ...,
  ...,
  votes16: ...,
}
```

I already will fix this in paritytech#7007, but since it might take a while, this one can go in asap and make it to the very next runtime.

* Refactor & detach network metrics. (paritytech#6986)

* Refactor sc-network/service metrics.

  1. Aggregate sc-network metrics into a submodule, introducing
  two more sourced metrics to avoid duplicate atomics.

  2. Decouple periodic sc-service network metrics from other
  metrics, so that they can be updated independently.

* Update client/service/src/metrics.rs

* Update client/service/src/metrics.rs

* Node template complete import pipeline (paritytech#7014)

* Use complete import pipeline

* Line length

Co-authored-by: Dan Forbes <dan@danforbes.dev>

* client/authority-discovery: Throttle DHT requests (paritytech#7018)

* client/authority-discovery: Throttle DHT requests

Instead of passing one DHT query for each authority down to the network
every query interval, only pass MAX_IN_FLIGHT_LOOKUPS at a given point
in time, triggering new ones when previous ones return.

* client/authority-discovery/worker/test: Fix wrong constant

* Update Nicks docs to clarify that it is not production-ready (paritytech#6990)

* Ignore wasm_gc for debug build. (paritytech#6962)

* Ignore gc for debug build.

* alternate implementation

* Update utils/wasm-builder/src/lib.rs

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

* fix

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

* Make `--file` optional for `generate-node-key` (paritytech#7043)

This pr makes the `--file` argument optional to `generate-node-key`.
If the argument is not given, the secret node key will be printed to
`stdout`. The public node key will always be printed to `stderr`.

* Downgrade wabt = 0.9.1 (paritytech#7042)

* Add metadata shadows to multisig pallet (paritytech#7029)

* Add metadata shadows to multisig pallet

* Update frame/multisig/src/lib.rs

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

* Fix broken link to democracy pallet. (paritytech#7026)

Old link was broken, and I put a new one.

* Revert "Fix broken link to democracy pallet. (paritytech#7026)" (paritytech#7047)

This reverts commit 008cb24.

* Update the service tasks Grafana dashboard (paritytech#7038)

* babe, grandpa: waive fees on valid equivocation report (paritytech#6981)

* babe: waive fees on report_equivocation

* grandpa: waive fees on report_equivocation

* babe: add test for fee waiving on valid equivocation report

* grandpa: add test for fee waiving on valid equivocation report

* grandpa: remove stray comment

* Clarify Nicks docs (paritytech#7049)

* Improves EVM gas price check (paritytech#7051)

* Change wabt to wat (paritytech#7050)

* Add Dock network id for address generation (paritytech#6714)

Taking 21 and 22 for testnet and mainnet

Signed-off-by: lovesh <lovesh.bond@gmail.com>

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Rename `TRIGGER_WASM_BUILD` to `FORCE_WASM_BUILD` (paritytech#7080)

Because apparently I can not speak properly ;)

* Make decoding of `compact<perthing>` saturating instead of invalid (paritytech#7062)

* make decoding of cmopact<perthing> saturating

* fix stable build

* Update primitives/arithmetic/src/per_things.rs

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

* Update primitives/arithmetic/src/per_things.rs

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

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

* state_machine no_std witness externalities (paritytech#6934)

* checkpoint before removing CT from change trie

* before trie backend without tx

* undo

* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.

* Remove NoTransaction.

* partially address review.
dummy stats implementation for no_std.

* Remove ChangeTrieOverlay.

* modified function

* Remove witness_ext

* need noops changes root

* update from cumulus branch

* line break

* remove warning

* line break

* From review: renamings and stats active in no std (except time).

* include cache, exclude change trie cache with individual temporary bad looking
no_std check

* little test

* fuse imports and filter_map prepare_extrinsics_input_inner fold.

* put back ExtInner into Ext, awkward double proto for new function.

* Apply suggestions from code review

* Update primitives/state-machine/Cargo.toml

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

* Support hex encoded secret key for `--node-key` (paritytech#7052)

* Support hex encoded secret key for `--node-key`

Adds support for reading a hex encoded secret key when being passed as
file via `--node-key`.

* Make the key loading uniform

* Switch to `hex::decode`

* Add a `build-sync-spec` subcommand and remove the CHT roots from the light sync state. (paritytech#6999)

* Move subcommands from sc-cli to nodes

* Add --build-sync-spec subcommand

* Remove CHTs from snapshots

* Keep ProvideChtRoots

* Fix build sync spec (paritytech#7086)

* Fail docs on warnings (paritytech#5923)

* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (paritytech#7079)

* Partial fix for transaction priority (paritytech#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (paritytech#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (paritytech#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (paritytech#7059)

* Decrease poll interval (paritytech#7063)

* Remove unused code (paritytech#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (paritytech#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (paritytech#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (paritytech#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

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

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

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

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix `storage::read` (paritytech#7084)

* Fix `storage::read`

It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.

* Fix tests

* Add fuzzer for the compact custom codec implementation from PR paritytech#6720 (paritytech#7091)

* Add fuzzer for the compact custom codec implementation introduced in PR paritytech#6720.

This commit adds a fuzzing harness for the custom compact encoding/decoding
introduced in PR paritytech#6720.

* Update primitives/npos-elections/fuzzer/src/compact.rs

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

* Update Cargo.lock: Add changes in elections-fuzzer

* Change indentation from spaces to tabs

Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add instantiable support for treasury pallet (paritytech#7058)

* add instantiable support for treasury pallet

* update treasury pallet benchmarking code to support multi-instance

* use benchmark_intance! macro; fix hard coded treasury identity string; fix over characters line width limitation error

* fix line return style

* grandpa-rpc don't share subscription manager, only executor (paritytech#7039)

* service builder: fix todo about jsonrpc Option workaround

* grandpa-rpc: only share executor instead of sub manager

* grandpa-rpc: fix compilation

* grandpa-rpc: rename to subscription_executor

* node/cli: remove another unused jsonrpc dependency

* grandpa: apply style fixes from code review

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

* pallet-collective: allow customized default vote (paritytech#6984)

* collective: add DefaultVote trait

* Fix test and node compile

* Expose the whole prime_vote

* Add test for MoreThanMajorityThenPrimeDefaultVote

* Docs fix

* Upgrade to libp2p-0.28. (paritytech#7077)

* Upgrade to libp2p-0.28

* Clean up test imports.

* CI

* CI

* CI?

* CI once more.

* One more.

* CI

* CI

* CI

* pow: support uniform tie breaking in fork choice (paritytech#7073)

* pow: support uniform tie breaking in fork choice

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

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

* Refactor fetch seal

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

* Allow remotes to not open a legacy substream (paritytech#7075)

* Allow remotes to not open a legacy substream

* Misc fixes

* Special case first protocol as the one bearing the handshake

* Use diener for Polkadot companion prs (paritytech#7102)

* Use diener for Polkadot companion prs

* Fix script

* Use gitlab env variable

* Update .maintain/gitlab/check_polkadot_companion_build.sh

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

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

* Update ui tests for rust 1.46.0 (paritytech#7106)

* client/network: Expose number of entries per Kademlia bucket (paritytech#7104)

Extend `sub_libp2p_kbuckets_num_nodes` Prometheus metric to expose the
number of nodes per bucket per Kademlia instance instead of only per
Kademlia instance.

* Improve error output of wasm-builder when wasm ins't installed (paritytech#7105)

This improves the error message of wasm-builder when the wasm toolchain
isn't installed. Currently we print that the wasm toolchain is not
installed, but the actual problem is that there is a bug in the
packaging in rust. This will now be much easier to debug, by printing
the full error message of the compiler.

* Add ss58 address for Dark network (paritytech#6982)

Hello,
This PR adds a new ss58 address 17 for Dark network.
Thanks!

* Frame-support storage: make iterations and translate consistent (paritytech#5470)

* implementation and factorisation

* factorize test

* doc

* fix bug and improve test

* address suggestions

* fix js dependancy alert, bumping bl version (paritytech#7110)

* fix js dependancy alert, bumping bl version

* fix low severity modules

* Make `transactional` attribute less scope dependent (paritytech#7112)

* Make `transactional` attribute less scope dependent

The old implementation expected that `frame-support` wasn't imported
under a different name. Besides that the pr removes some whitespaces.

* Update frame/support/procedural/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add SS58 Registry (paritytech#7020)

* add SS58 registry

* formatting

* description -> displayName

* Update ss58-registry.json

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* make numbers literal, tokens can have different denominations

* add dock

* add dark

* add websites and tokens

* add KLP decimals

* add acala and laminar info

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Move Staking Weights to T::WeightInfo (paritytech#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Send import notification always for re-orgs (paritytech#7118)

* Send import notification always for re-orgs

This pr changes the behavior of sending import notifications. Before we
only send notifications when importing blocks on the tip of the chain or
on similar conditions. However we did not send a notification when we
for example being in a state where we import multiple blocks to catch
up. If we re-org in this process, systems like the transaction pool
would not be notified about this re-org. This means, that we would also
not resubmit transactions of these retracted blocks. This pr fixes this,
by always sending a notification on a re-org.

See
https://github.com/substrate-developer-hub/substrate-node-template/issues/82
for some context about the bug.

* Update client/service/src/client/client.rs

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

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

* WeightInfo for Vesting Pallet (paritytech#7103)

* WeightInfo for Vesting Pallet

* clean up weight docs

* Update lib.rs

* try to pipe max locks

* Update for new type

* add warning when locks > MaxLocks

* Update lib.rs

* fix compile

* remove aliasing, fix trait def

* Update

* Add benchmarking pipeline to node-template (paritytech#7122)

* Use tracing-based subscriber logging (paritytech#6825)

* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>

* Typo in error text (paritytech#7126)

* WeightInfo for ImOnline (paritytech#7128)

* Add WeightInfo, not final weights

* benchmark machine weights

* fix the new staking weight in substrate-node (paritytech#7131)

* Remove warning about deprecated PeerIds (paritytech#7132)

* Fix db initialization for light client (paritytech#7130)

* Fix db initialization for light client

* Fix cache distribution

* WeightInfo for Identity Pallet (paritytech#7107)

* update benchmarks

* add automated weights

* Update benchmarking.rs

* use underscores for file out

* update some weights

* more weights

* finish weights

* add basic verification to benchmarks

* patch benchmarks

* Update benchmarking.rs

* final weights

* update for new type

* add weightinfo to node

* Make sure we update the `Cargo.lock` in the polkadot companion (paritytech#7135)

* Tracing for wasm with bridging to native (paritytech#6916)

* implement events handling, implement parent_id for spans & events

* add events to sp_io::storage

* update test

* add tests

* adjust limit

* let tracing crate handle parent_ids

* re-enable current-id tracking

* add test for threads with CurrentSpan

* fix log level

* remove redundant check for non wasm traces

* remove duplicate definition in test

* Adding conditional events API

* prefer explicit parent_id over current,

enhance test

* limit changes to client::tracing event implementation

* remove From impl due to fallback required on parent_id

* make tracing codecable

* replace with global tracing

* new tracing interface

* impl TracingSubscriber in client

* implement access to global TracingSubscriber from primitives

* span for wasm

* increment towards Wasm Tracing Subscriber implementation

* increment, remove sp-tracing from runtime-interface

* increment, it compiles

* attained original functionality with new mechanism

* implement remaining TracingSubscriber functions

* remove spans from decl_module

* add handling for encoded values

* Revert "replace with global tracing"

This reverts commit 8824a60.

* Wasm Side Tracing

* tracing on wasm

* enable tracing wasm on node-runtime

* export all the macros in std

* tracing subscriber on wasm-side only

* pass spans and events over and record them

* reactivate previous code and  cleanup

* further cleaning up

* extend the span macros, activate through executive

* tracking the actual extrinsic, too

* style

* fixing tests

* spaces -> tabs

* attempting to reactivate params

* activate our tests in CI

* some passing

* tests passing

* with core lazy

* global tracer for wasm side with pass over

* fixing metadata referencing

* remove const_fn feature requirement

* reenable dispatch traces

* reset client tracing

* further cleaning up

* fixing runtime-test

* move tracing-build setup into runtime-test

* Merge DebugWriter from tracing and frame-support, move to sp-std

* remove dangling fixme

* Docs for tracing primitives

* cleaning up a bit more

* Wasm interface docs

* optimise docs.rs setup

* adding tracing flags to uncomment

* remove brace

* fixing imports

* fixing broken syntax

* add required modules

* nicer formatting

* better target management

* adding low level storage tracing events into frame

* add custom Debug impl for WasmMetadata

* cloning profiler

* adding info about cloning profiler

* using in-scope for within calls

* proper time tracing, cleaning up println

* allow to disable tracing on runtime_interface-macro

* disable tracing for wasm-tracing-interface

* simplify wasm-tracing-api

* update client to new interface

* fixing docs and tests for sp-tracing

* update integration tests

* re-activating enter_span

* dropping FIXME, it's documented

* fix formatting

* fix formatting

* fix imports

* more debug info

* inform wasm about it being disabled by returning 1

* only one tracer, but enabled multi-all support

* make trait pub again for tests

* Apply suggestions from code review

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* fixing wasm doc tests for proper usage

* remove unnecessary import

* fixing formatting

* minor style fixes

* downgrading wabt

* update error message for UI

* Fix interface test

* next attempt to fix macros

* geee

* revert tracing on hashed for future PR

* remove local macros, use originals

* we are able to convert to static items

* implement more WasmValue types

* adding support to convert str, debug and encoded values

* more minor fixes

* revert unsafe 'static making

* fix indentation

* remove commented lines

* bump all them tracing versions

* cleaning up docs and info

* document new flag

* the new layered system handles span cloning better

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>

* Pallet Indices (paritytech#7137)

* pow: replace the thread-base mining loop with a future-based mining worker (paritytech#7060)

* New worker design

* Remove unused thread import

* Add back missing inherent data provider registration

* Add function to get a Cloned metadata

* Add some docs

* Derive Eq and PartialEq for MiningMetadata

* Fix cargo lock

* Fix line width

* Add docs and fix issues in UntilImportedOrTimeout

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

Co-authored-by: David <dvdplm@gmail.com>

* Add back comments

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

* Bounties (paritytech#5715)

* add some compact annotation

* implement bounties for treasury

* fix test build

* remove some duplicated code

* fix build

* add tests

* fix build

* fix tests

* rename

* merge deposit byte fee

* add comments

* refactor storage

* support sub bounty

* emit BountyBecameActive when sub bounty is created

* able to contribute bounty

* allow curator to cancel bounty

* remove bounty contribution

* implement bounty expiry

* Able to extend bounty

* fix build and update tests

* create sub bounty test

* add more tests

* add benchmarks for bounties

* fix build

* line width

* fix benchmarking test

* update trait

* fix typo

* Update lib.rs

Missing documentation on Bounties added on this change. Please check the definitions of `propose_bounty` and `create_bounty`.

* update docs

* add MaximumSubBountyDepth

* put BountyValueMinimum into storage

* rework bount depth

* split on_initialize benchmarks

* remove components from constant functions

* Update weight integration into treasury

* Update reject proposal read/writes

* fix weight calculation

* Ignore weights with 0 factor

* Remove 0 multipliers

* add some docs

* allow unused for generated code

* line width

* allow RejectOrigin to cancel a pending payout bounty

* require BountyValueMinimum > ED

* make BountyValueMinimum configurable by chain spec

* remove sub-bounty features

* update curator

* accept curator

* unassign and cancel

* fix tests

* new tests

* Update lib.rs

- Include on `Assign_curator`, `accept_curator` and `unassign_curator` on Bounties Protocol Section
- Include curator fee and curator deposit definitions on Terminology
- Update intro.

* fix test

* update extend_bounty_expiry

* fix benchmarking

* add new benchmarking code

* add docs

* fix tests

* Update benchmarking.rs

* Make BountyValueMinimum a trait config instead of stroage value

* fix runtime build

* Update weights

* Update default_weights.rs

* update weights

* update

* update comments

* unreserve curator fee

* update tests

* update benchmarks

* fix curator deposit handling

* trigger CI

* fix benchmarking

* use append instead of mutate push

* additional noop tests

* improve fee hanlding. update event docs

* RejectOrigin to unassign

* update bounty cancel logic

* use Zero::zero() over 0.into()

* fix tests

* fix benchmarks

* proposed fixes to bounties

* fix tests

* fix benchmarks

* update weightinfo

* use closure

* fix compile

* update weights

Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update SS58 configuration for Bifrost (paritytech#7142)

* Add 6 as address type of ss58 for Bifrost Network

* Update SS58 configuration for Bifrost

* Prometheus metrics for RPC calls (paritytech#7088)

* WS and HTTP middlewares added

* Prometheus endpoint added

* Counters renamed

* Proper style for inc

* Metrics initialization re-written

* Rework to handler middleware

* Introduce transport prefix for metrics

* String shortened

* Commented code removed, new line inserted

* One more string shortened

* Wasm build fixed

* Wasm build fixed once again

* Rework to shared metrics

* Added collectors label

* Tilde removed from cargo

* Switch to owned metrics in parameters

* WeightInfo for Scheduler (paritytech#7138)

* initial scheduler stuff

* integrate weightinfo

* Update pallet_scheduler.rs

* grandpa-rpc: use FinalityProofProvider to check finality for rpc (paritytech#6215)

* grandpa-rpc: use FinalityProofProvider to check finality for rpc

* grandpa-rpc: minor tidy

* grandpa-rpc: remove dyn FinalityProofProvider

* grandpa-rpc: remove unused dependencies

* node: move finality_proof_provider setup

* grandpa-rpc: print error reported by finality_proof_provider

* grandpa-rpc: add note about unnecessary encode/decode

* grandpa-rpc: dont encode/decode and use correct hash

* grandpa-rpc: set_id is optional

* grandpa-rpc: create test for prove_finality

* grandpa-rpc: set visibility back to how it was

* grandpa-rpc: remove unused dependency

* grandpa-rpc: minor tidy

* grandpa: doc strings

* grandpa-rpc: rename to prove_finality

* grandpa-rpc: use current set id if none is provided

* grandpa-rpc: remove unnecessary check in test

* node: group finality_proof_provider in rpc_setup

* grandpa: make prove_finality concrete in FinalityProofProvider

* grandpa-rpc: wrap finality output in struct and store as Bytes

* grandpa-rpc: exhaustive error codes and wrap

* grandpa-rpc: let prove_finality take a range instead of a starting point

* grandpa-rpc: fix test for changed API

* grandpa-rpc: fix line length

* grandpa: fix reviewer nits

* node/rpc: fix reviewer comments

* Make it compile

* Rework the implementation and decrease the peer reputation on invalid
block announcement

* Implement limits for block announce validation

* Remove accidentally added file

* Apply suggestions from code review

Co-authored-by: Max Inden <mail@max-inden.de>

* Rename `BlockAnnounceResult` to `PollBlockAnnounceValidation`

* Always return result using the internal future

* Move the polling and make sure all validation futures are registered

* Ignore the future in the legacy stuff

* Remove leftover stuff

* Update client/network/src/protocol/sync.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Swezey <matt@swezey.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Gerben van de Wiel <clshannon@protonmail.com>
Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
Co-authored-by: Seun Lanlege <seunlanlege@gmail.com>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: joshua-mir <joshua@parity.io>
Co-authored-by: Nikita Puzankov <humb1t@yandex.ru>
Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Lovesh Harchandani <lovesh@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@live.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Kerwin Zhu <pfcoder97@gmail.com>
Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com>
Co-authored-by: Wei Tang <wei@that.world>
Co-authored-by: DarkPay <42247799+DarkPayCoin@users.noreply.github.com>
Co-authored-by: HarryHong <hong091114@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
Co-authored-by: Bruno Škvorc <bruno@skvorc.me>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Matt Rutherford <mattrutherford@users.noreply.github.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: RRTTI <raul@ost.com>
Co-authored-by: Jianping Deng <djptux@gmail.com>
Co-authored-by: Anton Gavrilov <AntonE.Gavrilov@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants