* Make `decl_error!` errors usable
This pr implements support for returning errors of different pallets in
a pallet. These errors need to be declared with `decl_error!`.
The pr changes the following:
- Each dispatchable function now returns a `DispatchResult` which is an
alias for `Result<(), DispatchError>`.
- `DispatchError` is an enum that has 4 variants:
- `Other`: For storing string error messages
- `CannotLookup`: Variant that is returned when something returns a
`sp_runtime::LookupError`
- `BadOrigin`: Variant that is returned for any kind of bad origin
- `Module`: The error of a specific module. Contains the `index`,
`error` and the `message`. The index is the index of the module in
`construct_runtime!`. `error` is the index of the error in the error
enum declared by `decl_error!`. `message` is the message to the error
variant (this will not be encoded).
- `construct_runtime!` now creates a new struct `ModuleToIndex`. This
struct implements the trait `ModuleToIndex`.
- `frame_system::Trait` has a new associated type: `ModuleToIndex` that
expects the `ModuleToIndex` generated by `construct_runtime!`.
- All error strings returned in any module are being converted now to `DispatchError`.
- `BadOrigin` is the default error returned by any type that implements `EnsureOrigin`.
* Fix frame system benchmarks
* Add `swap` and `decode_len` to `DoubleMap`
* Add tests to `swap` and `decode_len` for `DoubleMap` (WIP)
* Address review comments
* Remove function that is not in scope
* fix test
* better naming
* Adding script for rename, could be applicable for nodes on top of it, too
* add stderr and gitlab ci features
* apply script
* fix now minor details in expected stderr
* Update the Cargo.lock
* fix name: sc-transaction -> sc-tracing
* fix rename in script, too
* define slashing spans
* tests and pruning for slashing-spans record
* validators get slashed before nominators
* apply slash to nominators as well
* chill and end slashing spans
* actually perform slashes
* integration (tests failing)
* prune metadata
* fix compilation
* some tests for slashing and metadata garbage collection
* correctly pass session index to slash handler
* test span-max property for nominators and validators
* test that slashes are summed correctly
* reward value computation
* implement rewarding
* add comment about rewards
* do not adjust slash fraction in offences module
* fix offences tests
* remove unused new_offenders field
* update runtime version
* fix up some docs
* fix some CI failures
* remove no-std incompatible vec! invocation
* try to fix span-max rounding error
* Update srml/staking/src/slashing.rs
Fix type: winow -> window
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* slashes from prior spans don't kick validator again
* more information for nominators, suppression
* ensure ledger is consistent with itself post-slash
* implement slash out of unlocking funds also
* slashing: create records to be applied after-the-fact
* queue slashes for a few eras later
* method for canceling deferred slashes
* attempt to fix test in CI
* storage migration for `Nominators`
* update node-runtime to use SlashDeferDuration
* adjust migration entry-points somewhat
* fix migration compilation
* add manual Vec import to migration
* enable migrations feature in node-runtime
* bump runtime version
* update to latest master crate renames
* update to use ensure-origin
* Apply suggestions from code review
use `ensure!`
Co-Authored-By: Gavin Wood <gavin@parity.io>
* fix multi-slash removal
* initialize storage version to current in genesis
* add test for version initialization
* Implement all storage after prefix
* fix test, bump version and fix doc
* bump metadata version
* Update frame/support/procedural/src/storage/storage_struct.rs
* Remove superflous errors from the system module
* Rename and document InclusionOutcome
* Rename InclusionError
* Remove unused inclusion errors.
I left the enumeration though since other elements might be used some day.
* Rename and document DispatchOutcome
* Apply suggestions from code review
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
* TransactionValidityError instead of InclusionError
* Rename InclusionOutcome to ApplyExtrinsicResult
* Update docs.
* Update lib.rs
should be → is
* Bump the block builder API version.
* Fix the should_return_runtime_version test
* Clean the evidence
* Publish the dispatch info in extrinsic events
Place the DispatchInfo (which contains weight information about the
extrinsic that is otherwise difficult to determine) in the dispatch
result value.
* Runtime bump.
* Fix build
* Fix tests
* Fix build?
* /paint to /palette
* rename paint to palette
* rename the modules in palette to be pallets
* update Structure.adoc
* bump impl
* fix CI directory
* Update docs/Structure.adoc
Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org>
* Adding first rough ouline of the repository structure
* Remove old CI stuff
* add title
* formatting fixes
* move node-exits job's script to scripts dir
* Move docs into subdir
* move to bin
* move maintainence scripts, configs and helpers into its own dir
* add .local to ignore
* move core->client
* start up 'test' area
* move test client
* move test runtime
* make test move compile
* Add dependencies rule enforcement.
* Fix indexing.
* Update docs to reflect latest changes
* Moving /srml->/paint
* update docs
* move client/sr-* -> primitives/
* clean old readme
* remove old broken code in rhd
* update lock
* Step 1.
* starting to untangle client
* Fix after merge.
* start splitting out client interfaces
* move children and blockchain interfaces
* Move trie and state-machine to primitives.
* Fix WASM builds.
* fixing broken imports
* more interface moves
* move backend and light to interfaces
* move CallExecutor
* move cli off client
* moving around more interfaces
* re-add consensus crates into the mix
* fix subkey path
* relieve client from executor
* starting to pull out client from grandpa
* move is_decendent_of out of client
* grandpa still depends on client directly
* lemme tests pass
* rename srml->paint
* Make it compile.
* rename interfaces->client-api
* Move keyring to primitives.
* fixup libp2p dep
* fix broken use
* allow dependency enforcement to fail
* move fork-tree
* Moving wasm-builder
* make env
* move build-script-utils
* fixup broken crate depdencies and names
* fix imports for authority discovery
* fix typo
* update cargo.lock
* fixing imports
* Fix paths and add missing crates
* re-add missing crates