* Add BlockStream Enum and utility fn
* WIP: Modify import closure to work with BlockStream
* Fix trait bounds
* Working prototype
* Revamp block importing
* Add export_import_flow tests
* Add comments and clean code
* Add more comments in the import fn
* Add link code to import function
* Add condition when returning Ready(Ok(()) to make sure we've imported every block
* Add check for imported blocks in JSON case
* Use rest pattern
* Fix compilation error for undeclared variable
* Add polling and waker before pending
* Print read_block_count instead of count
* Simplify binary cli option with structopt
* Update test to reflect changes in CLI api
* Change Stream to take SignedBlock<B> instead of B
* Add comments to BlockStream
* Move out logic to smaller functions for clearer code
* Remove result over import_blocks return type
* Check for error in command output rather than simply checking command exit status
* Revamp export/import/revert testing
* Fix minor typos and formatting errors
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Remove unnecessary if condition in terminating condition
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Explicit error instead of returning it as a string
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Pass BlockStream to log_importing_status_updates and simplify matching arms for block stream
* Use .contains() instead of regex match
* Line break in match block; return future::ready instead of poll_fn
* Update Cargo.lock
* Add check so that queue doesn't grow too big
* Use Iterator instead of Stream
* Remove allow dead_code
* Remove outdated comments
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Return Errors instead of logging them
* Simplify match arms
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Remove check before terminating block import
* Apply suggestions from code review
* Check that queue is not full BEFORE calling
* Revert "Remove check before terminating block import"
This reverts commit 377823c0a648a3eb2e61185a257a61023067893d.
* Improve unit tests to make sure we actually import blocks
* Remove Unpin implementation for BlockIter
* Add prototype of enum for ImportStates
* Add working prototype for StateMachine
* Add comments for clearer code
* Add sleep before calling Waker when waiting for import queue
* Add Speedometer
* add dbg!(&log) for test debugging
* Fix lines with more than 100 cols
* Fix regex capture for test
* Update regexes to take to capture the whole number
* Rename Cmd to Command
Co-authored-by: Gavin Wood <gavin@parity.io>
* Actually rename Cmd to Command
* Apply suggestions from code review
Co-authored-by: Gavin Wood <gavin@parity.io>
* Fix compilation errors for tests
* Fix compilation errors from code review suggestion
* Update bin/node/cli/tests/export_import_flow.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
* Weight accounting for on_offence.
* Try to compute weight.
* Guesstimate upper bounds on db read/writes for slashing
* greater than or equal to
* add new trait
* Update mock.rs
* Add basic weight test
* one more test
* Update frame/staking/src/lib.rs
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
* Update frame/staking/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Add test for offences queue
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Emit a PaymentParameters event once per block
This contains per-block paramaters need to calculate
fees off-chain.
* Add WeightToFee trait
* Add documentation to polynomial types
* Ignore pseudo code snippet for doc tests
* Use `Mul` implementation of Perbill
* Add tests for WeightToFeePolynomial
* Revert "Emit a PaymentParameters event once per block"
This reverts commit 6c4763baff3d8179676a3c1660fe7063fd56a8ca.
Co-authored-by: Gavin Wood <gavin@parity.io>
* Only check single extrinsics weight limit in validate_transaction.
* Add missing parameter to all pallets.
* Add tests, fix default configuration.
* Bump spec version.
* Use AvailableBlockRation to calculate MaxExtrinsicWeight
* Upgrade to libp2p v0.19
* Listen on IPv6 by default
* Increase channels sizes
* Use spec-compliant noise protocol
* Show legacy PeerId
* Switch order of Noise protocols
* Switch to crates.io version
* Fix subkey's version
* Fix line width and Wasm build
* I think Wasm is fixed for real this time
* Include post dispatch corrected weight in extrinsic events
* Drop the 'Post' from ApplyExtrinsicResultWithPostInfo to make it less verbose
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Use proper Event type in pallet_system tests
* Add test that the actual weight is returned by events
* Make fn extract_actual_weight cap at pre dispatch weight
* Bump spec version
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
* Fist benchmark barely working
* Debug checkpoint
* add rest of benchmarks
* Add to runtime
* Fix build
* Update frame/elections-phragmen/src/benchmarking.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/elections-phragmen/src/benchmarking.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* major imp
* Make them run on release
* Help finish phragmen benchmarks (#5886)
* update caller, account, and member/runner-up creation
* remove stuff
* ocd
* make it work with real run
* relax the numbers a bit
* New and improved version
* Make elections-phragmen weighable and secure. (#5949)
* Make elections-phragmen weighable.
* Update frame/elections-phragmen/src/lib.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Update frame/elections-phragmen/src/lib.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Fix all tests
* Fix everything
* Add note
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Doc update
* Fix some complexity params
* Once more ready to benchmark
* ready for bench
* final tunes
* Update frame/elections-phragmen/src/lib.rs
* Fix fix
* Update frame/elections-phragmen/src/lib.rs
* Update frame/elections-phragmen/src/benchmarking.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Update frame/elections-phragmen/src/benchmarking.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Update to latest weights
* Some fixes
* Fix dual voter read from @thiolliere
* Remove todos
* review from @shawntabrizi
* Fix bench tests.
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Add ‘transaction_version’ to the signed transaction
This allows hardware wallets to know which transactions they can safely
sign. To reduce transaction size, I reduced it to a ‘u8’ from a ‘u32’.
Fixes#5951.
* Restore transaction_version to a u32
* Fix comments
`transaction_version` is not part of a tx, but is still signed.
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Fix the test suite
I had forgotten to change the production of transactions in the test
code.
* Fix benchmarks
* Improve docs for `CheckTxVersion` in `frame_system`
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Remove spurious cast
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Instead of resetting `SIGPIPE` to the system default handler, we now
handle a clap error manually and ignore any error when writing to
`stdout`/`stderr`. In this way, the node does not silently stops when it
encounters a `SIGPIPE` in normal mode and we still support piping of the
cli output.
* primitives: move reporting key type to common key types
* session: remove useless methods on MembershipProof
* grandpa: remove std special-casing when checking signatures
* grandpa: add some more docs
* grandpa: use proper error types rather than strings
* Split operational and normal weight
* Update other parts of the code
* relatively minor changes to add/fix behavior
* Limit reported block weight for fee adjustment
* fix test
* explicit match
* Move common logic out
* Update frame/system/src/lib.rs
Co-authored-by: Gavin Wood <gavin@parity.io>
* API improvement @bkchr
Co-authored-by: Gavin Wood <gavin@parity.io>
* Update system weights
* Use maximum block weight for scheduler
* Update offences to use full block
* Move weight inside if statement
* Add one read to offences `on_initialize`
* Delete factory test
* Revert "Delete factory test"
This reverts commit 8f95aacd63a028ef1b415185b45367b4140d86fd.
* Revert "Add one read to offences `on_initialize`"
This reverts commit 7df7ebc73625ed79b14086f13c247d4058ee87d6.
* Revert "Move weight inside if statement"
This reverts commit 87277d07913a7d1868eeee85ef4673f51ee4013b.
* Revert "Update offences to use full block"
This reverts commit 0bbe0ce18e9419b032157f7d37dea6481078cdc0.
* Use scheduler in Sudo
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Revert "Use scheduler in Sudo"
This reverts commit 95bd2768dfea100bdf682cf4fe6c0f46e8e1f66e.
* remove max extrinsic weight (it does nothing useful)
* fix tests
* introduce `sudo_unchecked_weight`
* bump spec version
* scheduler 80 percent of maximum
* Update `set_changes_trie_config` weight
* Update bin/node/runtime/src/lib.rs
* Update frame/democracy/src/tests.rs
* Update tests.rs
* update based on feedback
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* grandpa: wire up basic RPC call
* grandpa: make it compile against GRANDPA with expose round state
* grandpa: use shared voter state to expose RPC endpoint
* grandpa: restructure into nested structs
* grandpa: return background rounds too
* grandpa: return error when endpoint not ready
* grandpa: collect grandpa rpc deps
* grandpa: decide to use concrete AuthorityId in finality-grandpa-rpc
* grandpa: remove unncessary type annotation
* grandpa: move error code to const
* grandpa: remove unnecessary WIP comment
* grandpa: remove Id type parameter for SharedVoterState
* grandpa: update tests to add shared_voter_state in parameters
* grandpa: remove old deprecated test
* grandpa: fix getting the correct set_id
* grandpa: make SharedVoterState a struct
* grandpa: wrap shared_voter_state in rpc_setup
* grandpa: replace spaces with tabs
* grandpa: limit RwLock write attempt to 1 sec
* grandpa: add missing doc comments and remove some pub
* Apply suggestions from code review
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-Authored-By: Hernando Castano <HCastano@users.noreply.github.com>
* grandpa: update function name call after change in finality-grandpa
* grandpa: group pub use and only export voter::report
* grandpa: add missing docs
* grandpa: extract out structs used for json serialization
* grandpa: stick to u32 for fields intended for js
* grandpa: move Error type to its own file
* grandpa: group pub use better
* Apply code review suggestion
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* grandpa: use correct version of finality-granpda in rpc crate
* grandpa: add back basic rpc unit test
* grandpa: replace SharedVoterState::new() with empty()
* node: cleanup grandpa::SharedVoterState usage in macro
* grandpa: remove VoterState error variant
* grandpa: enable missing futures compat feature
* grandpa: fix typo in error variant
* grandpa: remove test_utils
* grandpa: allow mocking rpc handler components
* grandpa: rename serialized to report in rpc module
* grandpa: add proper test for RPC
* grandpa: update to finality-grandpa v0.12.1
Co-authored-by: André Silva <andre.beat@gmail.com>
Co-authored-by: Demi Obenour <demi@parity.io>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Move weight values to `frame_support`
* more accurate comment
* update balances
* vesting
* update util
* Add weight to time constants
* use weight constants in weights
* update tests
* Expose that `BasicQueue` expects blocking spawn
Up to now `BasicQueue` expected a closure that to spawn a `Future`.
This was expected to be a closure that spawns a blocking future.
However, this wasn't documented anywhere. This pr introduces a new trait
`SpawnBlocking` that exposes this requirement to the outside.
* Feedback
* Update chain spec for flaming fir 7
* Update sudo key
* Use fir7 for protocol
* Bump spec version
* Revert sudo change
* Rebuilt spec after all the changes. Flaming fir has been reset with this.
* start to try and implement noop
* txs as input
* better comment
* Add transfer reaping
* rename to avoid filter matching
* Update base weights based on results
* fix priority
* fix logic on reaping transfer
* Update bin/node/bench/src/import.rs
Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
* Update bin/node/bench/src/main.rs
Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
* add back size type (in-progress)
* bring back size type with custom
* update comment
* nit
* block type then size
* Use `transfer_keep_alive`
Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
* calculate weight for timestamp::set
* reduce db count in kill_identity weight calculation
* return weight of on_finalize in on_initialize
* add comment
* import Weight
* address review comments to update db weight count
* fix full block import test
* update weights and benchmark info to latest benchmark data
* update identity pallet weights and benchmark info
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>