* Remove offline slashing logic from staking.
* Initial version of reworked offence module, can report offences
* Clean up staking example.
* Commit SlashingOffence
* Force new era on slash.
* Add offenders in the SlashingOffence trait.
* Introduce the ReportOffence trait.
* Rename `Offence`.
* Add on_before_session_ending handler.
* Move offence related stuff under sr-primitives.
* Fix cargo check.
* Import new im-online implementation.
* Adding validator count to historical session storage as it's needed for slash calculations
* Add a comment about offence.
* Add BabeEquivocationOffence
* GrandpaEquivocationOffence
* slash_fraction and fix
* current_era_start_session_index
* UnresponsivnessOffence
* Finalise OnOffenceHandler traits, and stub impl for staking.
* slash_fraction doesn't really need &self
* Note that offenders count is greater than 0
* Add a test to ensure that I got the math right
* Use FullIdentification in offences.
* Use FullIndentification.
* Hook up the offences module.
* Report unresponsive validators
* Make sure eras have the same length.
* Slashing and rewards.
* Fix compilation.
* Distribute rewards.
* Supply validators_count
* Use identificationTuple in Unresponsivness report
* Fix merge.
* Make sure we don't slash if amount is zero.
* We don't return an error from report_offence anymo
* We actually can use vec!
* Prevent division by zero if the reporters is empty
* offence_forces_new_era/nominators_also_get_slashed
* advance_session
* Fix tests.
* Update srml/staking/src/lib.rs
Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>
* slashing_performed_according_exposure
* Check that reporters receive their slice.
* Small clean-up.
* invulnerables_are_not_slashed
* Minor clean ups.
* Improve docs.
* dont_slash_if_fraction_is_zero
* Remove session dependency from offences.
* Introduce sr-staking-primitives
* Move offence under sr_staking_primitives
* rename session_index
* Resolves todos re using SessionIndex
* Fix staking tests.
* Properly scale denominator.
* Fix UnresponsivnessOffence
* Fix compilation.
* Tests for offences.
* Clean offences tests.
* Fix staking doc test.
* Bump spec version
* Fix aura tests.
* Fix node_executor
* Deposit an event on offence.
* Fix compilation of node-runtime
* Remove aura slashing logic.
* Remove HandleReport
* Update docs for timeslot.
* rename with_on_offence_fractions
* Add should_properly_count_offences
* Replace ValidatorIdByIndex with CurrentElectedSet
ValidatorIdByIndex was querying the current_elected set in each call, doing loading (even though its from cache), deserializing and cloning of element.
Instead of this it is more efficient to use `CurrentElectedSet`. As a small bonus, the invariant became a little bit easier: now we just rely on the fact that `keys` and `current_elected` set are of the same length rather than relying on the fact that `validator_id_by_index` would work similar to `<[T]>::get`.
* Clarify babe equivocation
* Fix offences.
* Rename validators_count to validator_set_count
* Fix squaring.
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
* Docs for CurrentElectedSet.
* Don't punish only invulnerables
* Use `get/insert` instead of `mutate`.
* Fix compilation
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
* Update srml/offences/src/lib.rs
Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>
* Update srml/im-online/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update srml/im-online/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update srml/im-online/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update srml/babe/src/lib.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Update core/sr-staking-primitives/src/offence.rs
Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
* Add aura todo.
* Allow multiple reports for single offence report.
* Fix slash_fraction calculation.
* Fix typos.
* Fix compilation and tests.
* Fix staking tests.
* Update srml/im-online/src/lib.rs
Co-Authored-By: Logan Saether <x@logansaether.com>
* Fix doc on time_slot
* Allow slashing only on current era (#3411)
* only slash in current era
* prune journal for last era
* comment own_slash
* emit an event when old slashing events are discarded
* Pave the way for pruning
* Address issues.
* Try to refactor collect_offence_reports
* Other fixes.
* More fixes.
* 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
* Refactor `parse_and_execute`
Adds a new function named `parse_and_prepare`, which prepares the environment and parses the command.
Contrary to `parse_and_execute`, `parse_and_prepare` returns a struct that permis the user to execute the command, as opposed to execute it itself.
`parse_and_execute` has been modified to use `parse_and_prepare` internally.
* Embed dispatch functions directly into run()
After the previous commit, we now have a lot of functions whose only one is to call other functions. And these other functions are called only from one location.
Let's merge these two for clarity.
* Deprecate parse_and_execute and replace it in node and node-template
* Apply suggestions from code review
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Scale trait and move to u32 blocknumbers.
* Fixes
* Cleanups
* Update node/runtime/src/lib.rs
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
* Fix up some of the factory stuff.
* Update core/sr-primitives/src/traits.rs
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
* Move Nonce/Index to u32 (#3361)
* Force a non-borked version of upstream crate
* Line lengths and runtime version bump
* Implement `is_validator` for offchain-workers
* Introduce `--no-validator` flag
* Don't run babe/grandpa/im-online when `--no-validator` is given
* Fixes compilation
* Bump spec version
* Improve error handling in executor
* Add missing extern function
* Revert making error public
* Remove `--no-validator` CLI
* Remove generic from sign()
* Remove mandatory RuntimeGenesis trait req
* Remove requirement from Configuration
* Relax trait bounds of core/cli
* Move method
* The config field is no longer public
* Remove Components from bounds of functions
* Implement DerefMut for LightComponents
* Implement Executor for Full/LightComponents
* Fix bad merge
* Fix forgotten config()
* Fix build
* 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.
* Reorg test
* Fixed informant misreporting reorgs
* Update cache when reorg is caused by applying finality
* Test for finality reorg
* Simplified test
* Typo
Co-Authored-By: André Silva <andre.beat@gmail.com>
* 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.
* 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
* Silence known deprecation warnings
1. Prefixes known instances of usages of client.backend and client.import_lock with `#[allow(deprecated)]` to silence the warnings. 2. Remove file-global `#![allow(deprecated)]` used in these cases. Both to prevent us overlooking externally caused deprecation messages.
* fixing missing ;
* fix missing test cases
* move deprecated markers to make CI happy
* move deprecated markers to make CI happy
* attempt to fix the test
* bumping impl_version of node runtime
* Minor cleanup
* 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