Commit Graph

168 Commits

Author SHA1 Message Date
Alexander Theißen 80accdbf7c Include post dispatch corrected weight in extrinsic events (#6024)
* 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>
2020-05-18 18:44:29 +02:00
Wei Tang cd0ffec1fe Refactor EVM operations to module functions (#6056)
* Refactor EVM operations to module functions

* Bump impl version
2020-05-18 18:42:56 +02:00
Nikolay Volf d5411969ac fix whitespace (#6062) 2020-05-18 13:51:28 +02:00
Kian Paimani 7a8d59199e Benchmarks for elections-phragmen pallet (#5845)
* 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>
2020-05-15 14:07:12 +02:00
thiolliere 1dbd761192 Democracy weight (#5828) 2020-05-15 13:25:43 +02:00
Benjamin Kampmann be8c96adec Relax substrate licensing scheme (#5947) 2020-05-15 13:21:56 +02:00
Demi Obenour ddea306044 Add ‘transaction_version’ to the signed transaction (#5979)
* 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>
2020-05-15 00:01:56 +02:00
Alexander Popiak 9057d713d9 Collective weights (#5802) 2020-05-14 17:20:03 +02:00
joe petrowski b718c45dbd Change BlockHashCount Parameter in Node/Node Template (#5990)
* change BlockHashCount param

* fix test and lock
2020-05-13 10:46:39 +02:00
Shawn Tabrizi 6013522ab0 Split Operational and Normal weight (#5954)
* 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>
2020-05-12 12:18:32 +02:00
Shawn Tabrizi b0d17b02ea Update System Weights (#5888)
* 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>
2020-05-07 14:33:33 +02:00
Shawn Tabrizi d8b7520a90 Extend Schedule Pallet for Root Scheduling/Canceling (#5907)
* Add root dispatch to scheduler

* Move encode operation upwards

* fix benchmark

* extend extrinsics

* add some clarifying comments

* start to add benchmarking

* finish weights

* remove double encode

* bump spec

* Update weights

* more accurate weights

* bump base weight
2020-05-07 11:47:23 +02:00
André Silva fbd2ac8f3b grandpa: report equivocations (#3868)
* session: runtime api for generating session membership proofs

* grandpa: add runtime api for creating equivocation report txs

* grandpa: submit signed equivocation report transactions

* grandpa: use proper equivocation report type

* grandpa: report equivocations

* grandpa: validate equivocation proof

* grandpa: update to finality-grandpa 0.9.1

* grandpa: fix encoding of session membership proof

* grandpa: initialize set id session mapping for genesis session

* grandpa: fix bug in set_id session validation

* fix compilation

* cleanup from merge conflicts

* cleanup crate tomls

* grandpa: refactor equivocation handling to separate trait

* node-template: fix compilation

* fix test compilation

* bump finality-grandpa to v0.10.2

* rpc: fix runtime version test

* CHERRY-PICK #4200: Add documentation to SubmitSignedTransaction and actually make it work

Squashed commit of the following:

commit 4f2cb0b1c588a06f2f3b478bb4b28b5cb29d54b9
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Tue Dec 3 16:29:33 2019 +0100

    Split the method to avoid confusing type error message.

commit c5bf24eeaaf902add89ed1b046b22c4a4aaeb2cd
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Tue Dec 3 16:19:55 2019 +0100

    Make accounts optional, fix logic.

commit 97db1ef556e023cf6847e5ffdb036c0e3ea6fb0a
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Tue Dec 3 10:06:20 2019 +0100

    Remove warning.

commit 535f5c116d1a2e826eaf90c3f7e6798e443d61d8
Merge: 516257217 0f1a5f651
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Tue Dec 3 07:08:05 2019 +0100

    Merge branch 'master' into td-signed-transactions

commit 516257217bac89fcebd083712f4ea68b7b23b55a
Merge: ac98248c6 2e68c80c2
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Mon Dec 2 13:57:25 2019 +0100

    Merge branch 'master' into td-signed-transactions

commit ac98248c6c56cff381130645a82a13d29933cf83
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Mon Nov 25 17:34:52 2019 +0100

    Forgotten import.

commit 67a3c19031506c28e31c6bc4a90fff62d467dd58
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Mon Nov 25 17:32:10 2019 +0100

    Fix naming and bounds.

commit 93e768ea9df97a4629fca1f9bc4b108fdb33f876
Author: Tomasz Drwięga <tomasz@parity.io>
Date:   Mon Nov 25 17:01:05 2019 +0100

    Add documentation to signed transactions and actually make them work.

* grandpa: skip block initialization on report submission method

* primitives: allow transaction pool access by default for offchain calls

* grandpa: unused parameters

* grandpa: remove unused method

* grandpa: enable equivocation reporting

* grandpa: add workaround for parameter encoding

* grandpa: fix localized_payload calls in tests

* fix submit_report_equivocation_extrinsic in runtimes

* node: fix submit transaction test compilation

* node: bump spec_version

* rpc: fix api version test

* grandpa: allow custom equivocation offence type

* grandpa: add test for authorities::next_change_height

* grandpa: cleanup report_equivocation function

* node: move reporting app crypto to node-primitives

* grandpa: move equivocation traits to own module

* grandpa: rename app-crypto crate import

* grandpa: export equivocation types

* node: bump spec_version

* grandpa: rename EquivocationReport to EquivocationProof

* grandpa: add missing docs to primitives

* grandpa: add missing docs to equivocation

* node: fix compilation

* grandpa: add missing docs to pallet

* node: bump spec_version

* fix whitespace

* grandpa: return error on offence reporting

* grandpa: expose session and validator count in proofs through traits

* grandpa: use strong key in module KeyOwnerProofSystem

* grandpa: move key ownership proof to grandpa runtime api

* grandpa: remove unnecessary cloning when checking equivocation proof

* grandpa: make report_equivocation a method in Environment

* support: implement KeyOwnerProofSystem for ()

* grandpa: move KeyOwnerProofSystem to module trait

* test-utils: fix runtime compilation

* grandpa: fix test compilation

* grandpa: fix test compilation after merge

* grandpa: simplify transaction submission types

* grandpa: validate equivocation report in signed extension

* client: fix test

* node: use ValidateEquivocationReport signed extension

* grandpa: expose key ownership proof under opaque type

* grandpa: better docs on key ownership proofs

* grandpa: add note about signed extension

* grandpa: add ValidateEquivocationReport::new

* grandpa: remove skip_initialize_block from runtime api

* grandpa: use new offchain transaction submission API

* grandpa: take set_id in generate_key_ownership_proof

* grandpa: update to finality-grandpa v0.12.2

* grandpa: cleanup usages of AuthoritySet::current

* grandpa: fix test

* grandpa: add mocking utilities for equivocation reporting

* grandpa: add test for equivocation reporting

* grandpa: move SetIdSession initialization

* grandpa: add more tests

* node: enable historical session manager

* node: bump spec_version

* node: use strong key types in KeyOwnerProofSystem definitions

* grandpa: export GrandpaEquivocationOffence type
2020-05-06 17:25:51 +01:00
Shawn Tabrizi 8df33e50af Refactor weight constants, Update to remove redundant overhead (#5884)
* 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
2020-05-04 19:52:53 +02:00
Wei Tang a00a4ca551 Correct BABE randomness by calculating InOut bytes directly in pallet (#5876)
* vrf: remove Raw* types

* babe: remove Raw* types

* pallet-babe: switch representation of RawVRFOutput to Randomness

* pallet-babe: calculate inout within the pallet

* Remove make_transcript duplication

* Bump spec version

* Fix frame tests

* and_then -> map

* Always enable u64_backend

* Fix nostd compile

* fix import: should not use std

* Remove unused definition of RawVRFOutput

* Remove unused import of RuntimeDebug

Co-authored-by: Gavin Wood <gavin@parity.io>
2020-05-04 19:51:47 +02:00
ddorgan 8549cf5899 Update chain spec for flaming fir 7 (#5882)
* 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.
2020-05-04 16:03:11 +01:00
Shawn Tabrizi f37927d37d node-bench no-op block import (#5869)
* 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>
2020-05-03 15:33:11 +02:00
Shawn Tabrizi b913dfebb7 New weights using i7 machine (#5848)
* i7 weights

* fix full block test

* fix merge

* fix priority
2020-05-01 14:14:43 +02:00
Shawn Tabrizi b301451c85 Frame System Benchmarking (#5834)
* Frame System Benchmarking

* Add to substrate node, avoid divide by zero errors in analysis

* reduce features

* some fixes

* copy pasta
2020-04-30 15:46:44 +02:00
Wei Tang 521f8ff427 Add support for modules to require inherent to be present (#5792)
* 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
2020-04-29 12:05:35 +02:00
Kian Paimani ee54eff488 Enable Offchain Equalise (#5683)
* Master.into()

* Remove debug stuff

* Better license

* Migrate away from SimpleDispatchInfo

* Fix test

* Revert "Migrate away from SimpleDispatchInfo"

This reverts commit dbdd27fa19948f16bd17defdc01d3dd32986df11.

* Move to offchain randomness

* Fix tests

* Fix tests more
2020-04-27 18:51:46 +02:00
Xiliang Chen fbc4e7f055 fix Fixed64 (#5784)
* fix fixed64

* improve

* bump version
2020-04-26 19:39:16 +02:00
Xiliang Chen 74bc141f4f expose constants for identity pallet (#5783)
* expose constants

* bump version
2020-04-25 15:17:53 +02:00
Shawn Tabrizi 8a33c297b4 Introduce BlockExecutionWeight and ExtrinsicBaseWeight (#5722)
* 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>
2020-04-25 05:59:54 +00:00
Wei Tang 969720c2ad babe: secondary blocks with VRF (#5501)
* babe: secondary blocks with VRF

* Fix node runtime compile

* Fix test-utils runtime interface

* Fix babe tests

* typo: v == 2

* babe: support online configuration upgrades

* Fix rpc tests

* Fix runtime version tests

* 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 docs for PrimaryAndSecondaryVRFSlots

* Add docs of `SecondaryVRF` in babe crate

* babe-primitives: Secondary -> SecondaryPlain

* babe-client: Secondary -> SecondaryPlain

* Fix migration tests

* test-utils-runtime: Secondary -> SecondaryPlain

* Fix missing name change in test-utils-runtime

* 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 babe-primitives naming changes

* Fix merge issues in babe-client

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: André Silva <andre.beat@gmail.com>
2020-04-24 16:03:03 +01:00
Alexander Popiak 8a3dcd6862 Calculate and refund weight for identity pallet (#5680)
* 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>
2020-04-24 16:46:58 +02:00
Wei Tang 770cc24c47 babe: support online configuration upgrades (#5514)
* 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>
2020-04-24 14:59:14 +01:00
emostov 8ac2bac58d Make Pallet ModuleId and LockIdentifier Configurable (#5695)
* 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>
2020-04-24 11:47:32 +02:00
Shawn Tabrizi 2fb22de02e Repair and extend some benchmarks (#5648) 2020-04-24 11:40:28 +02:00
Alexander Theißen 000c924b62 Integrate pallet_contracts gas with the weight system (#5712)
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-Authored-By: Sergei Pepyakin <sergei@parity.io>
2020-04-24 10:48:13 +02:00
Nikolay Volf ff9c88d21c Assign DB weights for node runtime (#5703) 2020-04-23 11:51:52 +02:00
Rakan Alhneiti 25751c0562 Offchain signing (#5182)
* New approach to offchain signing.

* Use in im-online

* Rewrite to use Account<T>

* DRY signing.

* Implement send_raw_unsigned_transaction

* WiP

* Expunge LocalCall

* Expunge LocalCall

* Fix compilation.

* Solve call.

* Make it compile again.

* Finalize implementation.

* Change CreateTransaction

* Clear CreateTransaction.

* Add price payload

* Send raw transaction

* Submit signed payload / unsigned transaction (WIP)

* Supertrait requirements on T::Signature

* Validate signature of payload on an unsigned transaction

* Fix encoding - part 1

* Make it compile.

* Fix compilation of unsigned validator.

* Pass price payload to the transaction

* Make block number part of the signed payload

* Send signed transaction

* Implement all_accounts, any_account

* Fix formatting

* Implement submit_transaction

* Submit signed transaction (ForAll, ForAny)

* Fix formatting

* Implement CreateSignedTransaction

* Move sign and verify to AppCrypto

* Sign transaction

* Call `use_encoded`

* Remove SubmitAndSignTransaction

* Implement runtime using new SigningTypes

* Adapt offchain example to changes

* Fix im-online pallet

* Quick fix: rename AuthorityId2

* Fix offchain example tests

* Add a comment on why keystore is required in unsigned transaction test

* Use UintAuthorityId instead of u64

* WIP

* Remove IdentifyAccount from UintAuthorityId

* Implement PublicWrapper type

* Fix im-online tests

* Fix runtime test

* Bump spec version

* Fix executor tests

* Rename ImOnlineAuthId -> ImOnlineAuthorityId and formatting

* Fix merge

* Documentation

* Revert u64 -> UintAuthorityId conversion

* Fix string errors

* Document public members in offchain module

* Introduce SubmitTransaction

* Update pallets to use SubmitTransaction

* WIP

* Use SubmitTransaction in offchain

* Use `submit_unsigned_transaction`

* Fix tests

* Update docs

* Remove SigningTypes requirement from `SendTransactionTypes`

* Fix tests

* Update frame/system/src/offchain.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/system/src/offchain.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/example-offchain-worker/src/tests.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/system/src/offchain.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/system/src/offchain.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Remove leftover from previous iterations

* Change enum to struct

* Remove public

* Move mock to node/executor/tests

* Cleanup test-helpers

* Make `application-crypto` `std` feature internal

The macros should not generate code that requires that the calling crate
has a feature with the name `std` defined.

* Revert cargo lock update

* Use TestAuthorityId from common

* Restore members of account to public

* Tidy up imports

* Fix benchmarking pallet

* Add tests demonstrating ForAll, ForAny on signer

* Move definition of AppCrypto

in example-offchain-worker
from tests to mod::crypto

* Cleanup stray comment

* Fix ValidTransaction

* Re-fix CreateSignedTransaction

* Address PR feedback

* Add can_sign method to signer

* Propagate error

* Improve documentation

* Fix vec! macro not available

* Document SendTransactiontypes

* Add some docs.

* Split signing examples

* Add tests for signing examples

* WIP can_sign - PR feedback

* WIP

* Split for_any / for_all into different calls

* Verify payload and signature in test

* Fix can_sign implementation

* Fix impl_version

* Import Box from sp_std

* Create issues for TODOs

* Ignore doctest.

* Add test directly to system. Adjust UintTypes.

* Add some tests to account filtering.

* Remove code samples and point to example offchain worker

* Fix doc links

* Fix im-online tests using signatures.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
2020-04-21 14:55:05 +02:00
Gavin Wood fd2cb9ca83 Transaction versioning in the RuntimeVersion (#5582)
* Add transaction_version

* Semantic versioning for runtimes

* Move new field to bottom

* Versioning

* Runtime versioning stuff.

* Fix test

* Adds tests and fixes bugs

* Bump runtime

Co-authored-by: Bastian Köcher <git@kchr.de>
2020-04-17 12:10:31 +02:00
Xiliang Chen 7dcff4c1e2 emit TipClosed event on success tip payout (#5656)
* emit TipClosed event on success tip payout

* test for events

* bump version
2020-04-17 10:37:00 +02:00
Nikolay Volf 372f8b2c7e Batch signature verification (#5023)
* create parallel tasks extension

* make type system happy

* basic externalities

* test for dynamic extensions

* batching test

* remove premature verify_batch

* shnschnorrkel batch

* alter test

* shnschnorrkel test

* executive batching

* some docs

* also multi/any signatgures

* error propagation

* styling

* make verification extension optional

* experimental ed25519 parallelization

* some merge fallout

* utilize task executor

* merge fallout

* utilize task executor more

* another merge fallout

* feature-gate sp-io

* arrange toml

* fix no-std

* sr25519 batching and refactoring

* add docs

* fix name

* add newline

* fix block import test

* long sr25519 test

* blocking instead of parking

* move everything in crypto

* return batch_verify to check :)

* use condvars

* use multi-threaded executor for benches

* don't call via host interface

* try no spawning

* add true

* cleanup

* straighten batching

* remove signature check from this test (?)

* remove now pointless test

* remove another now useless test

* fix warnings

* Revert "remove another now useless test"

This reverts commit bbdec24bb67ed4373072daef7c863e1a8825bd8b.

* rethink the sp-io-part

* Revert "remove now pointless test"

This reverts commit 4d553066322e65782264caa6053d4cd5538df977.

* fix wording

* add  wording

* add todo and fix

* return check and fix

* add logging in sp-io

* Update primitives/io/src/batch_verifier.rs

Co-Authored-By: cheme <emericchevalier.pro@gmail.com>

* address review and use std condvar

* account for early exit

* address reivew

* address review

* more suggestions

* add docs for batch verification

* remove unused

* more review suggestions

* move to sp-runtime

* add expects

* remove blocks

* use entry

* Update primitives/io/src/batch_verifier.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update primitives/externalities/src/extensions.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* update overlooked note

* remove stupid return

* Update primitives/io/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update primitives/io/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* fix wording

* bump spec_version

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-04-16 21:40:04 +02:00
Shawn Tabrizi 980b635c8d Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-04-16 10:43:18 +02:00
Benjamin Kampmann 3426d662f7 Switch pre-release version to dev (#5637) 2020-04-15 13:18:08 +02:00
Kian Paimani e7e7e89e71 Collection of enhancement for staking/phragmen. (#5534)
* Collection of enhancement for staking phragmen.

* Ditch signed extension

* Fix build

* Update frame/staking/src/lib.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update frame/staking/src/tests.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Fix reward limits

* Disallow payout_stakers

* Remove unused import

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2020-04-09 11:29:11 +02:00
Tomasz Drwięga 762bcbab03 Unsigned Validation best practices (#5563)
* Configurable Unsigned Priority.

* Use the new builder.

* Fix tests.

* Fix benches.

* Remove unused import.

* Rename for_pallet
2020-04-08 11:17:21 +02:00
Marcio Diaz fb9bbf306d Benchmark Offences Pallet (#5411)
* Add initial report_ofence bench.

* Remove unused imports

* Style nit

* Add nominators

* Remove logs.

* Nits.

* Add nominators param.

* Reorg, comment.

* Remove whitespaces.

* Apply review suggestion: move benchmark to own crate.

* Remove import.

* Remove line.

* Add feature flag.

* Pass can_report.

* Cleaning up.

* More cleaning
2020-04-07 11:36:57 +02:00
Gavin Wood eac1a1964e Introduce scheduler and use it for the democracy dispatch queue (#5412)
* 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>
2020-04-01 15:52:39 +02:00
Shawn Tabrizi 74b008a729 Benchmark Utility Pallet (#5384)
* Move tests

* Move around feature cfgs

* Start benchmarks

* as_multi bench

* finish

* fix tests

* Update frame/utility/src/benchmarking.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

* Update Cargo.toml

* fix test

Co-authored-by: Marcio Diaz <marcio.diaz@gmail.com>
2020-03-31 22:53:21 +02:00
Kian Paimani 63e6f81776 Fix Collective <-> Elections initialization. (#5454)
* A patch

* Fix

* Better approach.

* Fix grumbles
2020-03-31 22:40:28 +02:00
Gavin Wood b472d60a52 Batch benchmarks together with * notation. (#5436)
* 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>
2020-03-31 15:20:09 +02:00
Kian Paimani 970c5f94f2 Offchain Phragmén BREAKING. (#4517)
* 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>
2020-03-26 15:37:40 +01:00
Marcio Diaz 5a48cade1b Benchmark Democracy Pallet (#5257)
* Add origin bounds to benchmark macro.

* Add democracy benchmark.

* Fix tests

* Remove collective from frame/benchmarking, partially use EnsureOrigin.

* Remove collective stuff.

* Make previous benches compile again.

* Remove comments.

* Make prev bench to work again.

* Add remove votes.

* Add new proxy calls.

* Add runtime-benchmarks guard to EnsureOrigin and implementations.

* Refactor.

* Add missing import.

* Remove duplicated import

* Fix features.

* Add some missing features.

* Update frame/collective/Cargo.toml

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/democracy/src/benchmarking.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update frame/democracy/src/benchmarking.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Add referendums to state.

* populate vecs before call

* Update weight docs

* More fixes and weight docs

* More updates

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2020-03-26 11:18:24 +01:00
Kian Paimani a0772117ac Mandate weight annotation (#5357)
* Disallow default weight

* Fix build and test

* Fix tests

* Fix another beloved ui test.

* fix beloved trybuild tests

* fix treasury?

* Final test fix

* Fix build

* Fix another one

* Fix

* More doctest fix
2020-03-26 11:17:05 +01:00
thiolliere b0d2f4b173 Make Staking pallet using a proper Time module. (#4662)
* add new trait, still migration to make

* Apply suggestions from code review

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* implement migration

* better naming

* fix test

* no longer require DeprecatedTime

* add test

* fix version

* upgrade only from kusama

* add test

* fix test

* Update frame/timestamp/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-03-26 11:04:52 +01:00
Tomasz Drwięga 04ccb179e9 Pass transaction source to validate_transaction (#5366)
* WiP

* Support source in the runtime API.

* Finish implementation in txpool.

* Fix warning.

* Fix tests.

* Apply suggestions from code review

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-Authored-By: Nikolay Volf <nikvolf@gmail.com>

* Extra changes.

* Fix test and benches.

* fix test

* Fix test & benches again.

* Fix tests.

* Update bumpalo

* Fix doc test.

* Fix doctest.

* Fix doctest.

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
2020-03-25 14:09:23 +01:00
thiolliere 8a41ac664b on_initialize return weight consumed and default cost to default DispatchInfo instead of zero (#5382)
* frame update

* doc

* move offchain worker trait also

* fix weigh merge

* indentation

* reorder for better git diff

* comment

* fix benchmark

* remove test
2020-03-24 19:51:04 +01:00