* Move Service::new to a macro
* Move function calls to macros
* Extract offchain_workers and start_rpc in separate function
In follow-up commits, we want to be able to directly call maintain_transaction_pool, offchain_workers, and start_rpc, without having to implement the Components trait.
This commit is a preliminary step: we extract the code to freestanding functions.
* Introduce an AbstractService trait
* Introduce NewService as an implementation detail of Service
* Implement traits on NewService instead
Instead of implementing AbstractService, Future, and Executor on Service, we implement them on NewService instead.
The implementations of AbstractService, Future, and Executor on Service still exist, but they just wrap to the respective implementations for NewService.
* Move components creation back to macro invocation
Instead of having multiple $build_ parameters passed to the macro, let's group them all into one.
This change is necessary for the follow-up commits, because we are going to call new_impl! only after all the components have already been built.
* Add a $block parameter to new_impl
This makes it possible to be explicit as what the generic parameter of the NewServiceis, without relying on type inference.
* Introduce the ServiceBuilder struct
Introduces a new builder-like ServiceBuilder struct that creates a NewService.
* Macro-ify import_blocks, export_blocks and revert_chain
Similar to the introduction of new_impl!, we extract the actual code into a macro, letting us get rid of the Components and Factory traits
* Add export_blocks, import_blocks and revert_chain methods on ServiceBuilder
Can be used as a replacement for the chain_ops::* methods
* Add run_with_builder
Instead of just run, adds run_with_builder to ParseAndPrepareExport/Import/Revert. This lets you run these operations with a ServiceBuilder instead of a ServiceFactory.
* Transition node and node-template to ServiceBuilder
* Transition transaction-factory to the new service factory
This is technically a breaking change, but the transaction-factory crate is only ever used from within substrate-node, which this commit updates as well.
* Remove old service factory
* Adjust the AbstractService trait to be more usable
We slightly change the trait bounds in order to make all the methods usable.
* Make substrate-service-test compile
* Fix the node-cli tests
* Remove the old API
* Remove the components module
* Fix indentation on chain_ops
* Line widths
* Fix bad line widths commit
* Line widths again 🤦
* Fix the sync test
* Apply suggestions from code review
Co-Authored-By: Gavin Wood <i@gavwood.com>
* Address some concerns
* Remove TelemetryOnConnect
* Remove informant::start
* Update jsonrpc
* Rename factory to builder
* Line widths 😩
* value ranges in consensus cache
* skip values in cache
* read epoch0 + epoch1 data from genesis in babe
* sync authorities + session validators at genesis
* removed some debug printlns
* fixed cache encoding
* Revert "skip values in cache"
This reverts commit ce451c32823aaa4b67d99ca5b58f1bf3984df4db.
* Revert "value ranges in consensus cache"
This reverts commit 9062f9434cddd14a01275ddbfcd904b04282e63b.
* get rid of cache::AUTHORITIES in Babe
* cleaning up
* cleaning up
* update spec version
* lost changes
* fixed tests
* Update node/runtime/src/lib.rs
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
* fix once-per-block condition
* fix standalone babe + temp_storage in BuildGenesis
* fix benhes compilation
* fixed comment
* re-added light nodes to integration tests
* finalize_with_ancestors from extra_requests
* post-merge fix
* aaand removed debug code
* (another one)
* fix warn in logs (do not call ForkTree::finalize twice for the same block)
* sync digest.next_authorities with actual next authorities
* more docs
* reverting all commits affecting storage
* also remove keys from babe trait
* fixed warnings
* post-merge fixes
* reverted some redundant changes
* reverted more changes
* node: exit on GRANDPA voter or BABE authoring error
* node: exit process with non-zero return code when service fails
* service: rename infallible task to essential task
* service: revert field name changes
* core: fix service testnet
* Add Call type to extensible transactions.
Cleanup some naming
* Merge Resource and BlockExhausted into just Exhausted
* Fix
* Another fix
* Call
* Some fixes
* Fix srml tests.
* Fix all tests.
* Refactor crypto so each application of it has its own type.
* Introduce new AuthorityProvider API into Aura
This will eventually allow for dynamic determination of authority
keys and avoid having to set them directly on CLI.
* Introduce authority determinator for Babe.
Experiment with modular consensus API.
* Work in progress to introduce KeyTypeId and avoid polluting API
with validator IDs
* Finish up drafting imonline
* Rework offchain workers API.
* Rework API implementation.
* Make it compile for wasm, simplify app_crypto.
* Fix compilation of im-online.
* Fix compilation of im-online.
* Fix more compilation errors.
* Make it compile.
* Fixing tests.
* Rewrite `keystore`
* Fix session tests
* Bring back `TryFrom`'s'
* Fix `srml-grandpa`
* Fix `srml-aura`
* Fix consensus babe
* More fixes
* Make service generate keys from dev_seed
* Build fixes
* Remove offchain tests
* More fixes and cleanups
* Fixes finality grandpa
* Fix `consensus-aura`
* Fix cli
* Fix `node-cli`
* Fix chain_spec builder
* Fix doc tests
* Add authority getter for grandpa.
* Test fix
* Fixes
* Make keystore accessible from the runtime
* Move app crypto to its own crate
* Update `Cargo.lock`
* Make the crypto stuff usable from the runtime
* Adds some runtime crypto tests
* Use last finalized block for grandpa authority
* Fix warning
* Adds `SessionKeys` runtime api
* Remove `FinalityPair` and `ConsensusPair`
* Minor governance tweaks to get it inline with docs.
* Make the governance be up to date with the docs.
* Build fixes.
* Generate the inital session keys
* Failing keystore is a hard error
* Make babe work again
* Fix grandpa
* Fix tests
* Disable `keystore` in consensus critical stuff
* Build fix.
* ImOnline supports multiple authorities at once.
* Update core/application-crypto/src/ed25519.rs
* Merge branch 'master' into gav-in-progress
* Remove unneeded code for now.
* Some `session` testing
* Support querying the public keys
* Cleanup offchain
* Remove warnings
* More cleanup
* Apply suggestions from code review
Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>
* More cleanups
* JSONRPC API for setting keys.
Also, rename traits::KeyStore* -> traits::BareCryptoStore*
* Bad merge
* Fix integration tests
* Fix test build
* Test fix
* Fixes
* Warnings
* Another warning
* Bump version.
* babe: add babe module trait
* babe: track current slot and epoch start slot
* babe: implement ShouldEndSession based on epochs
* babe: rename weight type to avoid ambiguities
* babe: expose epoch start slot in Epoch digest
* babe: use epoch start for validating epoch transitions
* babe: make the epoch duration a parameter type
* babe: remove unused fields from config
* node: update runtime to use babe instead of aura
* node: use babe instead of aura
* core: generate sr25519 keys from seed and add to keystore
* core: remove AuthorityKeyring
* node: remove unused primitive types related to babe crypto
* uniform babe primitives crate import name
* wrap long lines
* babe: fix find_epoch_digest
* fork-tree: fix find_node_where
* node: set babe epoch duration to "10 minutes"
* babe: cleanup import key cache if authorities don't change
* node: make integration test compile (but fail)
* node: bump spec_version
* node: fix import
* babe: don't use constants in storage fields array sizes
* babe: account for first epoch slot way in the past
* babe: signal next epoch change (not current)
* babe: calculate next epoch randomness with next epoch index
* babe: track next epoch in node
* babe: cache current epoch and authorities separately
* babe: generate valid babe vrf proofs in integration test
* babe: cleanup claim_slot
* babe: perform threshold calculation according to spec
* babe: compute relative weight in threshold
* babe: more precise threshold calculation
* babe: use floats for threshold exponent calculation
* babe: update constant c
Given the following situation: A validator 'A' is not supposed to be
connected to the public internet to protect it from e.g. a DoS attack.
Instead it connects to a sentry node 'sentry-A' which connects to the
public internet. Validator 'B' can reach validator 'A' via sentry node
'sentry-A' and vice versa.
A sentry node needs to participate in the grandpa gossip without
becoming a validator itself in order to forward these message to its
validator. This commit adds a new command line flag (`--grandpa-voter`)
forcing a node to participate in the grandpa voting process even though
no `--key` was specified. Due to the fact that it does not have a key,
it does not become a validator in the network.
In order to simulate the above situation this commit also adds a Docker
Compose file (`scripts/sentry-node/docker-compose.yml`) with further
documentation.
* SharedFinalityProofRequestBuilder -> BoxFinalityProofRequestBuilder
* SharedThings -> BoxThings
* Fix tests
* build_request_data now takes &mut self
* The other traits now also take &mut self
* More or less fix tests
* Fix tests
* Fix more tests
* Moar tests
* Don't call make_block_import multiple time
* Fix doctest
* Remove useless internal messages
* Remove NetworkService::disconnect_peer
* Remove NetworkMsg altogether
* Rename ProtocolMsg ServerToWorkerMsg
* Remove useless code
* Add example for parse_str_addr
* Move parse_str_addr and ProtocolId to config
* Don't reexport the content of config
* Rework the imports
* More reexports rework
* Add documentation
* Move finalization report to network future
* Move on_block_imported to worker
* get_value/put_value no longer locking
* local_peer_id() no longer locks
* Remove FetchFuture
* Service imports cleanup
* Produce the network state in the network task
* Merge network task and RPC network task
* Move network methods to NetworkWorker
* Remove Arc peers system from network
* add_reserved_peer now goes through the channel
* Remove Mutex around network swarm
* Remove the FnOnce alias traits
* Replace is_offline with num_connected
* Improve style of poll()
* Fix network tests
* Some doc in service module
* Remove macro export
* Minor doc changes
* Remove the synchronized() method of the import queue
* Line width
* Line widths
* Fix import queue tests
* Fix CLI tests
* Add a memory-only option for the network
* Tests cleanup
* Make grandpa/aura/babe compile
* Aura and Babe tests now passing
* More work on tests rewrite
* Attempt to fix grandpa
* Make more grandpa tests pass
* More grandpa tests work
* Work on sync tests
* More work
* light_peer_imports_header_from_announce passes
* can_sync_small_non_best_forks passes
* syncing_node_not_major_syncing_when_disconnected passes
* blocks_are_not_announced_by_light_nodes passing
* All sync tests passing 🎉
* Some TestNet cleanup
* Work on grandpa tests
* More grandpa work
* GrandPa work
* Add check about block_import
* Remove the temporarily added Sync
* Fix network tests warnings
* voter_persists_its_votes passes
* Fix imports in network tests
* Fix service tests
* Call on_block_imported 🤷
* Add shortcut
* Finish using shortcut
* Can now disable the keystore
* Fix service test
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Fix cli
* Remove dependencies on tokio
* Make service not depend on tokio
* Fix service tests
* Manually poll the import queue if failed to start
* Spawn all tasks at the end
* Remove executor from TelemetryOnConnect
* Remove TaskExecutor from offchain workers
* Remove TaskExecutor from AuthoritySetup
* Remove TaskExecutor from service
* Remove tokio dependency from RPC
* Remove finality-grandpa from WASM checks
* Fix offchain tests
* Line widths
* Fix RPC tests
* Fix service tests
* Fix bad futures polling
* Address some concerns
* Better error handling
* Is it the connectivity test that's not passing? I don't know, let's try
* Revert "Is it the connectivity test that's not passing? I don't know, let's try"
This reverts commit 28bbe51f0e2e4885fe1f901e11078604604cb212.
* Fix test
* child cache, and test failing notifications
* fix tests and no listen child on top wildcard
* remove useless method
* bump impl version
* Update core/client/src/notifications.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Update core/client/src/notifications.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Update core/client/src/notifications.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* Update core/client/src/notifications.rs
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* factoring notification methods to remove some redundant code.
* test child sub removal
* HStorage implementation and some type alias.
* Remove HStorage cache: does not fit
* fix removal
* Make cache use byte length (shared) instead of number of kv
* Make use of hashes cache in rpc
* applying ratio on different lru caches
* Fix format
* break a line
* Remove per element overhead of lru cache.
* typo
* restored test_consensus
* restored test_sync
* run integration tests only on CI
* use single test-thread for integration tests
* post-merge fix
* panic when integration test runs for too long
* add some traces to integration logs
* manual wait -> timeout
* post-merge fix
* post-merge fix
* Pass the TransactionPool explicitly
* Extract finality_proof_provider
* Remove Protocol::connected_peers
* Add note and rename function
* Fix tests
* More test fixing
* Revert the WASM locks, I guess
* Add space
* Remove space
* Start to remove the `As` bound on `SimpleArtithmetic`
This just introduces standard numeric bounds, assuming a minimum of
`u32`. Also included is a saturating from/into trait allowing ergonomic
infallible conversion when you don't care if it saturates.
* Remove As from Balances trait
* Remove As from Aura module
* Remove As from Babe module
* Expunge `As` from contract
* Council module
* Democracy
* Finality tracker
* Grandpa
* First bit of indices
* indices
* Line lengths
* session
* system
* Staking
* Square up all other uses of As.
* RHD update
* Fix build/test
* Remove As trait
* line widths
* Remove final As ref
* Update srml/staking/src/lib.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Update core/client/src/cht.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Update core/client/db/src/light.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* whitespace
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: André Silva <andre.beat@gmail.com>
* Bring back u32 check for number on CLI
* Add tty password input
* Move password from core/service to core/cli
* Fix test build error
* Password should be entered only once if it's for decoding
* Update Cargo.lock from rebuild
* Move authorities interface from Core to consensus
f
* notify all caches of block insert + create with up-to-date best_fin
* merged authorities_are_cached from light_grandpa_import2
* Add ProvideCache trait
* Create helper function for 'get_cache'
* Fix some formatting
* Bump impl version
* Resolve wasm conflicts
* Apply review comments
* Use try_for_each
* Move authorities interface from Core to consensus
f
* notify all caches of block insert + create with up-to-date best_fin
* merged authorities_are_cached from light_grandpa_import2
* Add ProvideCache trait
* Create helper function for 'get_cache'
* Fix some formatting
* Bump impl version
* Resolve wasm conflicts
* Apply review comments
* Use try_for_each
* Move authorities interface from Core to consensus
f
* notify all caches of block insert + create with up-to-date best_fin
* merged authorities_are_cached from light_grandpa_import2
* Add ProvideCache trait
* Create helper function for 'get_cache'
* Fix some formatting
* Bump impl version
* Resolve wasm conflicts
* Apply review comments
* Use try_for_each
* Increment impl_version
* Update lib.rs
* Refactor state-machine stuff.
* Fix tests.
* WiP
* WiP2
* Service support for offchain workers.
* Service support for offchain workers.
* Testing offchain worker.
* Initial version working.
* Pass side effects in call.
* Pass OffchainExt in context.
* Submit extrinsics to the pool.
* Support inherents.
* Insert to inherents pool.
* Inserting to the pool asynchronously.
* Add test to offchain worker.
* Implement convenience syntax for modules.
* Dispatching offchain worker through executive.
* Fix offchain test.
* Remove offchain worker from timestamp.
* Update Cargo.lock.
* Address review comments.
* Use latest patch version for futures.
* Add CLI parameter for offchain worker.
* Fix compilation.
* Fix test.
* Fix extrinsics format for tests.
* Fix RPC test.
* Bump spec version.
* Fix executive.
* Fix support macro.
* Address grumbles.
* Bump runtime
* Update libp2p. Add support for ed25519 node (network) keys.
* Update networking to the changes from https://github.com/libp2p/rust-libp2p/pull/972.
* Add support for using ed25519 keys for libp2p networking.
* Add support for reading libp2p secret keys from (external) files.
* Adapt to changes from https://github.com/libp2p/rust-libp2p/pull/992
* More tests.
* Cosmetics
* Deduplicate tests.
* Remove quickcheck from tests that don't use extra random inputs.
* Remove quickcheck.
* Swap new/default impls for NetworkConfiguration.
* Use libp2p-0.5.0 from crates.io.
* Post-rebase update.
* Remove unnecessary wildcard pattern.
* Combine two overlapping tests.
* fix: adds new execution strategy nativeElseWasm and replace nativeWhenPossible with it
* feat: adds cmd line params for execution strategies
* fix: uses of cmd line execution strategies
* chore: remove white spaces
* chore: remove println
* chore: remove whitespace
* fix: generating functions with context
* feat: add function to generate with_context declarations
* fix: add implementation for with_context function calls
* fix: add execution context to call_api_at function
* fix: making use of context to select strategy for block_builder
* chore: cleaning up
* fix: merging issues
* fix tests
* add wasm files
* chore: small doc for context fields
* chore: delete redundant docs
* fix: use full path for ExecutionContext
* fix: add context functions from inside fold_item_impl
* chore: remove clone
* fix: moving generative function to utils, remove unused imports
* fix: add missing full path for ExecutionContext
* fix: merge issues
* update wasm files
* fix: update to keep up with changes in master
* chore: remove unused functions, clean up
* fix test
* fix grumbles
* fix: add more tests
* fix: some refactorings
* feat: add execution strategy to call
* chore: small improvements
* fix: add message to panic
* fix tests
* Implement new inherent data
* Fixes compilation on wasm
* Fixes after rebase
* Switch back to generate inherent stuff by macro
* Update after rebase
* Apply suggestions from code review
Co-Authored-By: bkchr <bkchr@users.noreply.github.com>
* Fix compilation after rebase
* Address grumbles
* Remove `InherentDataProviders` from `Client`
* Update wasm files after rebase
* Address grumbles
* Fixes compilation after latest merge
* Last fix
* Add simple benchmark for the runtime api
* Make the executor support native calls
* Some documentation
* Hide behind `feature = "std"`
* Rework the native calls
* Make all tests compile again
* Make every parameter using the Block serialized/deserialized in the native call
* Forward `UnwindSafe` requirement
* Remove debug stuff
* Add some documentation
* Fixes warnings
* Fixes errors after master rebase
* Fixes compilation after master rebase
* Fixes compilation after rebase
* node: remove grandpa authority flags
* node: exit-guard grandpa and aura spawned futures
* node: wait for futures to stop running on shutdown
* core: run connectivity tests on same ports
* core: pass on_exit future when starting aura and grandpa
* node: add issue number to todo
* core: fix aura and grandpa tests
* core: support broadcasting consensus message to all peers
* grandpa: remove liveness oracle
* node: always start grandpa on full nodes
* core: don't check for grandpa justifications on failed block imports
* core: fix network connectivity test
* Move Roles to network::config
* Make network::config public
* Move NetworkConfig and NonReservedMode to config
* Move Params to config
* Move node_id() to NetworkManager and fix tests
* Rename Specialization to NetworkSpecialization