* 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
* 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>
* 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>
* 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
* 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>
* Add support for modules to require inherent to be present
* Bump node impl version
* Allow is_inherent_required itself to return error
This handles the case if runtime fails to check the inherent data (if the
inherent data is invalid, etc).
* typo: &module -> $module
* fix: iter
* Introduce `BlockExectionWeight` and `ExtrinsicBaseWeight`
* Add new traits everywhere
* Missed one update
* fix tests
* Update `check_weight` logic
* introduce `max_extrinsic_weight` function
* fix + add tests
* format nits
* remove println
* make test a bit more clear
* Remove minimum weight
* newlines left over from find/replace
* Fix test, improve clarity
* Fix executor tests
* Extrinsic base weight same as old `MINIMUM_WEIGHT`
* fix example test
* Expose constants
* Add test for full block with operational and normal
* Initiate test environment with `BlockExecutionWeight` weight
* format nit
* Update frame/system/src/lib.rs
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Replace `TransactionBaseFee` with `ExtrinsicBaseWeight` (#5761)
* Replace `TransactionBaseFee` with `ExtrinsicBaseFee`
* Fix stuff
* Fix and make tests better
* Forgot to update this test
* Fix priority number in test
* Remove minimum weight from merge
* Fix weight in contracts
* remove `TransactionBaseFee` from contract tests
* Let `register_extra_weight_unchecked` go past `MaximumBlockWeight`
* address feedback
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* add old_registrar_count as param to estimate weight
* cast count to Weight
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
* add weight calculation for set_identity
* remove superfluous weight comment
* add detailed weight estimation for set_subs
* adjust benchmarking code to the new API
* add second parameter to set_subs benchmark
* rename o to p
* calculate weight based on benchmarks
* use try_mutate for registrars
* fix weight number typo
* update weights for set_subs + add weights for clear_identity and request_judgement
* improve naming and docs
* add weight calculation for cancel_request
* fix benchmark
* fix tests
* fix arithmetic overflow in balances triggered by tests
* add weight calcluations for more dispatchables
* add weight calculation for provide_judgement
* mark param as unused
* add MaxRegistrars associated type used for weight estimation
* check that MaxRegistrars is not exceeded
* add remaining weight calculations
* use weight refunds to use more constants in weight estimation
* adjust usage of clear_identity
* refund request_judgement weights and remove param
* refund weights for cancel_request and remove param
* add remaining refunds and remove params
* refund weight for set_subs and remove param
* make comment more specific
* add range note to benchmarking docs
* fix inconsistencies before review
* fix actual weight calculation for add_registrar
* remove duplicate balance ops weights + refund on all dispatchables
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* babe: support online configuration upgrades
* Switch to use NextConfigDescriptor instead of changing runtime interface
* Fix tests
* epoch-changes: map function that allows converting with different epoch types
* Add migration script for the epoch config change
* Fix migration tests
* Fix migration: Epoch should be EpochV0
* Update client/consensus/babe/src/lib.rs
Co-Authored-By: André Silva <123550+andresilva@users.noreply.github.com>
* Fix new epochChanges version
* Fix unused imports
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* transition treasury to configurable moduleids
* make election module id configurable
* convert runtime and pallet to accept module id config elections-phragmen
* add ModuleId to evm pallet
* change society pallet to configurable module id
* delete commented out module_id
* delete commented out code and merge in upstream master
* try and convert 4 whitespace to tab
* fix remaining space to tab conversions
* trivial cleaning
* delete comment from elections-phragrems tests
* trivial
* Update frame/elections-phragmen/src/lib.rs
* add docs for elections and elections phragmen
* make has_lock test get moduleid dynamically
* Apply suggestions from code review
Co-Authored-By: Amar Singh <asinghchrony@protonmail.com>
* make sure get is imported to evm
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
* Initial draft of the logic
* Build and tests
* Make work with new initialize infratructure.
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
* Fix test
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
* Rejig interface to make it more useful for democracy.
* Try to get democraxy module to make use of scheduler.
* Make democracy use scheduler.
* Use actual max weight for enactent
* Remove TODO
* Fix runtime build
* Minor cleanup
* Fix scheduler.
* Fix benchmarks
* Fix
* Fix
* Fix
* More bench fixes
* Fix
* Fix.
* Add more bench constants.
* Fix cancel_queued bench.
* Fix test comment.
* Update frame/scheduler/src/lib.rs
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Co-authored-by: Marcio Diaz <marcio.diaz@gmail.com>
* Batch benchmarks together with `*` notation.
* Fix short structopt conflict
* Return error if `batches` is empty
* Move fast benchmarks macro into `frame_benchmarking` (#5445)
* Move macro into `frame_benchmarking`
* Update docs
* Extra line
* Return error if `batches` is empty
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Initial skeleton for offchain phragmen
* Basic compact encoding decoding for results
* add compact files
* Bring back Self::ensure_storage_upgraded();
* Make staking use compact stuff.
* First seemingly working version of reduce, full of todos
* Everything phragmen related works again.
* Signing made easier, still issues.
* Signing from offchain compile fine 😎
* make compact work with staked asssignment
* Evaluation basics are in place.
* Move reduce into crate. Document stuff
* move reduce into no_std
* Add files
* Remove other std deps. Runtime compiles
* Seemingly it is al stable; cycle implemented but not integrated.
* Add fuzzing code.
* Cleanup reduce a bit more.
* a metric ton of tests for staking; wip 🔨
* Implement a lot more of the tests.
* wip getting the unsigned stuff to work
* A bit gleanup for unsigned debug
* Clean and finalize compact code.
* Document reduce.
* Still problems with signing
* We officaly duct taped the transaction submission stuff. 🤓
* Deadlock with keys again
* Runtime builds
* Unsigned test works 🙌
* Some cleanups
* Make all the tests compile and stuff
* Minor cleanup
* fix more merge stuff
* Most tests work again.
* a very nasty bug in reduce
* Fix all integrations
* Fix more todos
* Revamp everything and everything
* Remove bogus test
* Some review grumbles.
* Some fixes
* Fix doc test
* loop for submission
* Fix cli, keyring etc.
* some cleanup
* Fix staking tests again
* fix per-things; bring patches from benchmarking
* better score prediction
* Add fuzzer, more patches.
* Some fixes
* More docs
* Remove unused generics
* Remove max-nominator footgun
* Better fuzzer
* Disable it ❌
* Bump.
* Another round of self-review
* Refactor a lot
* More major fixes in perThing
* Add new fuzz file
* Update lock
* fix fuzzing code.
* Fix nominator retain test
* Add slashing check
* Update frame/staking/src/tests.rs
Co-Authored-By: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
* Some formatting nits
* Review comments.
* Fix cargo file
* Almost all tests work again
* Update frame/staking/src/tests.rs
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
* Fix review comments
* More review stuff
* Some nits
* Fix new staking / session / babe relation
* Update primitives/phragmen/src/lib.rs
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
* Update primitives/phragmen/src/lib.rs
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
* Update primitives/phragmen/compact/src/lib.rs
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
* Some doc updates to slashing
* Fix derive
* Remove imports
* Remove unimplemented tests
* nits
* Remove dbg
* Better fuzzing params
* Remove unused pref map
* Deferred Slashing/Offence for offchain Phragmen (#5151)
* Some boilerplate
* Add test
* One more test
* Review comments
* Fix build
* review comments
* fix more
* fix build
* Some cleanups and self-reviews
* More minor self reviews
* Final nits
* Some merge fixes.
* opt comment
* Fix build
* Fix build again.
* Update frame/staking/fuzz/fuzz_targets/submit_solution.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
* Update frame/staking/src/slashing.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
* Update frame/staking/src/offchain_election.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
* Fix review comments
* fix test
* === 🔑 Revamp without staking key.
* final round of changes.
* Fix cargo-deny
* Update frame/staking/src/lib.rs
Co-Authored-By: Gavin Wood <gavin@parity.io>
Co-authored-by: Joshy Orndorff <JoshOrndorff@users.noreply.github.com>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Gavin Wood <gavin@parity.io>