Previously one would create a sender and receiver channel pair, pass the
sender to the `build_network_future` through the service builder and
funnel network events returned from polling the network service into the
sender to be consumed by the authority discovery module owning the
receiver.
With recent changes it is now possible to register an `event_stream`
with the network service directly, thus one does not need to make the
detour through the `build_network_future`.
* client/authority-discovery: Limit number of connections to authorities
Instead of connecting to all sentry nodes of all authorities, with this
patch the authority discovery module does the following:
- Choose one sentry node per authority at random.
- Choose MAX_NUM_AUTHORITY_CONN out of the above at random.
The module uses randomness to prevent hot spots, e.g. all nodes trying
to connect to a single node. If the authority discovery module would
choose the nodes to connect to at random on each new address that it
learns of, the node would go through a lot of connection churn. Instead
it creates a random seed at start up and uses this seed for its RNG on
each update cycle.
* client/authority-discovery: Extract address cache into own module
* client/authority-discovery/src/addr_cache: Add basic unit tests
* client/authority-discovery: Replace unwrap with expect on [u8] cmp
* .maintain/sentry-node/docker-compose.yml: Prefix endpoint flags
* client/authority-discovery/src/addr_cache: Use sort_unstable and cmp
* client/authority-discovery: Use BTreeMap in addr_cache for sorted iter
To reduce connection churn it is preferrable to have `get_subset` of the
`addr_cache` to return the same result on repeated calls. `get_subset`
iterates a map. To make the process of iteration deterministic, use a
`BTreeMap` instead of a `HashMap`.
* Fix cli for structopt 0.3.7 and pin to that version
This is just some hotfix to make everything compile. In the future it
will require another pr to not depend on internals of StructOpt, but
that will probably also require some additions to StructOpt itself. To
not break the code again with another StructOpt, this also pins the
StructOpt version.
* Fix benches
* Fix for fix
* Clean imports in wasmi_execution
* Replace `interpret_runtime_api_result` with `pointer_and_len_from_u64`.
* Extract sc-executor-common crate
* Extract `sc-executor-wasmi` into its own crate
* Extract `sc-executor-wasmtime` into its own crate.
* Add missing headers.
* Clean and docs
* Docs for sc-executor-wasmi
* Expand a comment about sandboxing
* Fix assert_matches
* Rename (un)pack_ptr_and_len and move them into util module
* Remove wasmtime errors in sc-executor-common
The finality-grandpa module needs two sets of functionalities from the
network:
1. Everything gossip related, e.g. event_stream, write_notification, ...
2. The ability to set a fork sync request for a specific block hash.
Instead of embedding (2) inside of (1) this patch extracts (2) from (1)
having finality-grandpa depend on a `Network` that fulfills the
`network_gossip::Network` trait and that can set block sync requests.
On the one hand this improves the overall structure splitting things
that don't logically belong together. On the other hand it does
reintroduce a lot of trait bounds within finality-grandpa.
* RPC forwarders for adding reserved peers
* implement service side of reserved-peer RPCs
* Clean up unnecessary format! invocation
Co-Authored-By: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* add some tests for the new RPC methods
* remove redundant `data` field
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* clean up cargo.toml syntax
* bumping versions to 2.0
* bump networking to 0.8
* move consensus down to 0.8
* bump consensus pallets to 0.8.0, too
* Upping babe and aura pallets
* add remaining, missing version definitions
* missed some
* In progress, runtime io must switch to future proof root +
child_specific (unique id) + u32 type.
* Switch interface, sr-io seems ok, rpc could use similar interface to
sr-io, genesis json broken if there is child trie in existing encoding
genesis.
* test from previous implementation.
* fix proving test.
* Restore Keyspacedb from other branch, only apply to child trie.
* Removing unneeded child_info from child root (child info are stored
if things changed, otherwhise the root does not change).
* Switch rpc to use same format as ext: more future proof.
* use root from child info for trie backend essence.
* Breaking long lines.
* Update doc and clean pr a bit.
* fix error type
* Restore removed doc on merge and update sr-io doc.
* Switch child storage api to use directly unique id, if managed id
where to be put in place, the api will change at this time.
* Clean deprecated host interface from child.
* Removing assertion on child info (can fail depending on root
memoization).
* merging child info in the overlay when possible.
* child iteration by prefix using child_info.
* Using ChainInfo in frame support. ChainInfo gets redesign to avoid
buffers allocation on every calls.
* Add length of root to the data of child info.
* comments
* Encode compact.
* Remove child info with root.
* Fix try_update condition.
* Comment Ext child root caching.
* Replace tuples by struct with field
* remove StorageTuple alias.
* Fix doc tests, and remove StorageOverlay and ChildStorageOverlay
aliases.
* take test-client off sp-consensus
* use test primitives rather than test client in authority discovery tests
* move runtime-interface tests
* don't forget to remove the dev-dependency
* remove more unneeded dev deps
* add changes_trie_config to test prrimitives
* Separate network crates from its integration tests
* Fix up consensus crates for networking test changes
* remove unnecessary dependencies
* remove unused addition
* remove unnecessary dev-dependencies
* fixing finality grandpa tests
* removing unnecessary executor dependencies