Commit Graph

354 Commits

Author SHA1 Message Date
Guillaume Thiolliere 25625a0f0c Introduce WeakBoundedVec, StorageTryAppend, and improve BoundedVec API (#8842)
* fix bounded vec doc and unsafe

* fix btree map and set and tests

* introduce weak_bounded_vec and StorageTryAppend

* fix tests and reorganize tests

* improve doc

* add doc

* Update frame/support/src/storage/weak_bounded_vec.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* fix inner doc

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
2021-05-21 09:07:00 +00:00
Keith Yeung e5954cf863 Make hooks and call attributes optional in pallet macro (#8853)
* Make #[pallet::hooks] optional

* Make #[pallet::call] optional

* Remove unused imports

* Update UI test expectations

* Update UI test expectations

* Remove unnecessary HooksDef::empty method

* Remove unnecessary CallDef::empty method

* Clarify what would happen when no call or hooks are specified in a pallet
2021-05-20 19:31:56 +00:00
Guillaume Thiolliere c48b460b2e Improve pallet macro error message by deriving codec with no bound for Call enum (#8851)
* improve span for call

* fix stderr file paths
2021-05-19 09:23:06 +00:00
Guillaume Thiolliere 0b30049417 Allow to name the generic for storages in #[pallet::storage] (#8751)
* implement named generic for storages

* fix error message on unexpected name for generic
2021-05-19 07:11:11 +00:00
KingFishDev 72a2ad4f4f fix: add Debug to token traits (#8830) 2021-05-17 17:55:19 +00:00
Guillaume Thiolliere 9bf62ef65d Allow to specify some max number of values for storages in pallet macro. (#8735)
* implement max_values + storages info

* some formatting + doc

* rename StoragesInfo -> PalletStorageInfo

* merge both StorageInfoTrait and PalletStorageInfo

I think it is more future proof. In the future some storage could make
use of multiple prefix. Like one to store how much value has been
inserted, etc...

* Update frame/support/procedural/src/storage/parse.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Update frame/support/procedural/src/storage/storage_struct.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Fix max_size using hasher information

hasher now expose `max_len` which allows to computes their maximum len.
For hasher without concatenation, it is the size of the hash part,
for hasher with concatenation, it is the size of the hash part + max
encoded len of the key.

* fix tests

* fix ui tests

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
2021-05-17 13:44:24 +00:00
Keith Yeung fcf83c0278 Use StorageNMap for Approvals in assets pallet (#8816)
* Use StorageNMap for Approvals in assets pallet

* Use EncodeLike on HashKeyPrefix trait bounds

* Add comments clarifying AccountId roles

* Properly document the keys in the Approvals storage

* Fix line width
2021-05-17 06:27:06 +00:00
Keith Yeung 033d8289f0 Implement StorageNMap (#8635)
* Implement StorageNMap

* Change copyright date to 2021

* Rewrite keys to use impl_for_tuples instead of recursion

* Implement prefix iteration on StorageNMap

* Implement EncodeLike for key arguments

* Rename KeyGenerator::Arg to KeyGenerator::KArg

* Support StorageNMap in decl_storage and #[pallet::storage] macros

* Use StorageNMap in assets pallet

* Support migrate_keys in StorageNMap

* Reduce line characters on select files

* Refactor crate imports in decl_storage macros

* Some more line char reductions and doc comment update

* Update UI test expectations

* Revert whitespace changes to untouched files

* Generate Key struct instead of a 1-tuple when only 1 pair of key and hasher is provided

* Revert formatting changes to unrelated files

* Introduce KeyGeneratorInner

* Add tests for StorageNMap in FRAMEv2 pallet macro

* Small fixes to unit tests for StorageNMap

* Bump runtime metadata version

* Remove unused import

* Update tests to use runtime metadata v13

* Introduce and use EncodeLikeTuple as a trait bound for KArg

* Add some rustdocs

* Revert usage of StorageNMap in assets pallet

* Make use of ext::PunctuatedTrailing

* Add rustdoc for final_hash

* Fix StorageNMap proc macro expansions for single key cases

* Create associated const in KeyGenerator for hasher metadata

* Refactor code according to comments from Basti

* Add module docs for generator/nmap.rs

* Re-export storage::Key as NMapKey in pallet prelude

* Seal the EncodeLikeTuple trait

* Extract sealing code out of key.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-05-14 09:44:29 +00:00
Shaun Wang 2a38b23062 Add arithmetic dispatch errors. (#8726)
* Add arithmetic dispatch errors.

* Replace custom overflow errors.

* Replace custom underflow and division by zero errors.

* Replace overflow/underflow in token error.

* Add token and arithmetic errors in dispatch error equality test.

* Trigger CI.
2021-05-10 10:14:02 +02:00
Peter Goodspeed-Niklaus 655ebc95fb Add BoundedBTreeSet (#8750)
* Add `BoundedBTreeSet`

Part of https://github.com/paritytech/substrate/issues/8719

* fix copy-pasta errors

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-05-10 07:49:45 +00:00
Peter Goodspeed-Niklaus b689790171 Relax BoundedVec trait restrictions (#8749)
* requiring users to maintain an unchecked invariant is unsafe

* relax trait restrictions on BoundedVec<T, S>

A normal `Vec<T>` can do many things without any particular trait
bounds on `T`. This commit relaxes the bounds on `BoundedVec<T, S>`
to give it similar capabilities.
2021-05-07 20:04:16 +00:00
Peter Goodspeed-Niklaus 17a1997d18 #[derive(MaxEncodedLen)] (#8737)
* impl #[derive(MaxEncodedLen)] for structs

* impl #[derive(MaxEncodedLen)] for enums, unions

* break long comments onto multiple lines

* add doc for public item

* add examples to macro documentation

* move MaxEncodedLen macro docs, un-ignore doc-tests
2021-05-07 08:18:09 +00:00
Peter Goodspeed-Niklaus db69eb04bb Add BoundedBTreeMap to frame_support::storage (#8745)
* Add `BoundedBTreeMap` to `frame_support::storage`

Part of https://github.com/paritytech/substrate/issues/8719.

* max_encoded_len will never encode length > bound

* requiring users to maintain an unchecked invariant is unsafe

* only impl debug when std

* add some marker traits

* add tests
2021-05-06 13:54:13 +00:00
Peter Goodspeed-Niklaus a935274ef9 BoundedVec MaxEncodedLen microoptimization (#8746) 2021-05-06 11:01:42 +00:00
Guillaume Thiolliere 34e83e0be8 add test for store trait (#8711) 2021-05-04 19:57:26 +00:00
Peter Goodspeed-Niklaus 98744eb3b2 implement BoundedEncodedLen (#8720)
* implement BoundedEncodedLen

* update header

* update imports

* use impl_for_tuples instead of a custom macro

* remove redundant where clause

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

* impl for Compact<T>

* impl BoundedEncodedLen for BoundedVec (#8727)

* impl BoundedEncodedLen for bool

* explicitly implement BoundedEncodedLen for each Compact form

Turns out that u16 doesn't play nicely with the pattern; those values
take two extra bytes, where all other cases take one. :(

* rename BoundedEncodedLen -> MaxEncodedLen

* add tests of compact encoded length

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-05-04 13:57:32 +00:00
Shawn Tabrizi 5fb7658ae9 Improve BoundedVec API (#8707)
* improve bounded vec api

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/support/src/storage/bounded_vec.rs

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-05-04 09:17:52 +00:00
Bastian Köcher 2675741a09 Rework inherent data client side (#8526)
* Lol

* Yeah

* Moare

* adaasda

* Convert AURA to new pallet macro

* AURA: Switch to `CurrentSlot` instead of `LastTimestamp`

This switches AURA to use `CurrentSlot` instead of `LastTimestamp`.

* Add missing file

* Update frame/aura/src/migrations.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Remove the runtime side provide inherent code

* Use correct weight

* Add TODO

* Remove the Inherent from AURA

* 🤦

* Remove unused stuff

* Update primitives authorship

* Fix babe inherent data provider

* Fix consensus-uncles

* Fix BABE

* Do some further changes to authorship primitives... :D

* More work

* Make it compile the happy path

* Make it async!

* Take hash

* More stuff

* Hacks

* Revert "Hacks"

This reverts commit cfffad88668cfdebf632a59c4fbfada001ef8251.

* Fix

* Make `execute_block` return the final block header

* Move Aura digest stuff

* Make it possible to disable equivocation checking

* Fix fix fix

* Some refactorings

* Comment

* Fixes fixes fixes

* More cleanups

* Some love

* Better love

* Make slot duration being exposed as `Duration` to the outside

* Some slot info love

* Add `build_aura_worker` utility function

* Copy copy copy

* Some stuff

* Start fixing pow

* Fix pow

* Remove some bounds

* More work

* Make grandpa work

* Make slots use `async_trait`

* Introduce `SharedData`

* Add test and fix bugs

* Switch to `SharedData`

* Make grandpa tests working

* More Babe work

* Make grandpa work

* Introduce `SharedData`

* Add test and fix bugs

* Switch to `SharedData`

* Make grandpa tests working

* More Babe work

* Make it async

* Fix fix

* Use `async_trait` in sc-consensus-slots

This makes the code a little bit easier to read and also expresses that
there can always only be one call at a time to `on_slot`.

* Make grandpa tests compile

* More Babe tests work

* Fix network test

* Start fixing service test

* Finish service-test

* Fix sc-consensus-aura

* Fix fix fix

* More fixes

* Make everything compile *yeah*

* Make manual-seal compile

* More fixes

* Start fixing Aura

* Fix Aura tests

* Fix Babe tests

* Make everything compile

* Move code around and switch to async_trait

* Fix Babe

* Docs docs docs

* Move to FRAME

* Fix fix fix

* Make everything compile

* Last cleanups

* Fix integration test

* Change slot usage of the timestamp

* We really need to switch to `impl-trait-for-tuples`

* Update primitives/inherents/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update primitives/inherents/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update primitives/inherents/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Some extra logging

* Remove dbg!

* Update primitives/consensus/common/src/import_queue/basic_queue.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2021-05-03 14:39:25 +00:00
Gavin Wood 8c65e5df36 Put BoundedVec in pallet prelude (#8710) 2021-05-02 15:27:50 +02:00
Gavin Wood 0d65a936d2 Remove unneeded Ord bound from All, Contains supports tuples (#8691)
* Remove unneeded `Ord` bound from All

* Fixes

* Contains supports tuples
2021-04-28 18:25:00 +02:00
Gavin Wood d02c0222bc Introduce macro for building Contains impl based on a match (#8675)
* Introduce macro for building Contains impl based on a match

* Fixes
2021-04-27 14:33:59 +02:00
François Garillot 052be8bbef Simplify some Option / Result / ? operator patterns (#8653)
* Simplify some Option / Result / ? operator patterns

When those match a combinator exactly.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).

* adjust after review

* adjust post-review
2021-04-23 13:36:10 +00:00
Guillaume Thiolliere ea10494ca9 Make pallet macro generate accessor to PalletInfo information on pallet placeholder (#8630)
* generate accessor to PalletInfo information on pallet placeholder

* remove unused

* use trait, and add tests

* less verbose doc

* add PalletInfoAccess to prelude for ease usage
2021-04-19 10:09:23 +00:00
Guillaume Thiolliere bb343c7c26 fix doc and dyn (#8631) 2021-04-17 17:01:31 +02:00
Bastian Köcher c8136bd1df Remove serde requirement from FRAME macros (#8628)
* Remove `serde` requirement from FRAME macros

Currently there is some implicit requirement on `serde` being present in
the `Cargo.toml` of a pallet when `GenesisConfig` is used. This pr
removes this requirement by using the serde attribute `serde(crate = "..")`.

* build a unique reexport of serde in impl_opaque_keys, by abusing paste doc concatenation

* Optimize

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2021-04-16 12:42:37 +02:00
Kian Paimani 6bcf5f21c4 BoundedVec + Shims for Append/DecodeLength (#8556)
* prototype for shawn

* Clean and document it

* Add more docs

* Move imports

* Some changes for easier compat.

* revert exmaple pallet

* rename

* BoundedVec for AccountLocks (#8580)

* Example with balances

* Fix tests

* Make it indexable

* fix

* Fix tests

* fix test

* Fix collective as well

* Fix test

* Update frame/support/src/storage/mod.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Repot and add for value

* Add for map and double map

* Final touches.

* Update frame/support/src/storage/bounded_vec.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Add a few more tests

* Add import

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-04-16 06:06:05 +00:00
Chris D'Costa b9ed6e01b3 Change i8 to u8 on WithdrawReasons #8586 (#8591) 2021-04-13 10:10:14 +00:00
Guillaume Thiolliere a4ed9bb9b2 Ensure inherent are first (#8173)
* impl

* fix tests

* impl in execute_block

* fix tests

* add a test in frame-executive

* fix some panic warning

* use trait to get call from extrinsic

* remove unused

* fix test

* fix testing

* fix tests

* return index of extrinsic on error

* fix test

* Update primitives/inherents/src/lib.rs

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

* address comments

rename trait, and refactor

* refactor + doc improvment

* fix tests

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-04-13 09:30:13 +00:00
Bastian Köcher 6378a4ee78 Pallet macro support frame_system::Config with args (#8606) 2021-04-12 19:11:23 +00:00
Bastian Köcher 59b900bae3 Fix parameter_types! macro (#8594)
Make it work with different kinds of parameter types when
`static` is one of them.
2021-04-12 19:37:35 +02:00
Gavin Wood 29864b255c Purify Contains, add IsInVec, All and SortedMembers (#8589)
* IsInVec

* Purify `Contains`, introduce SortedMembers
2021-04-11 00:04:02 +02:00
Gavin Wood 9fa684f2a4 Backing/GetBacking: Abstraction over pluralistic origins for XCM. (#8579)
* Backing/GetBacking: Abstraction over pluralistic origins for XCM.

* Update frame/support/src/traits/misc.rs

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

* Update frame/support/src/traits/misc.rs

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-04-09 11:38:03 +02:00
Xavier Lau d6f0ce0551 ModuleId to PalletId - part of #8372 (#8477)
* `ModuleId` to `PalletId` - part of #8372

* fix doc

* move `PalletId` to `frame-support`

* fix compile

* fix tests

* `ModuleId` to `PalletId`

* subcommand `moduleid` to `palletid`
2021-04-09 09:15:40 +00:00
Gavin Wood f935dfc1a1 Allow lossless matching for Origin (#8576)
* Allow lossless matching for Origin

Without these changes, it's difficult/impossible to not lose any filters
when making fine-grained matches against origin.

* whilespace

* Apply suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
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>
2021-04-08 20:06:09 +02:00
Kian Paimani 524fc7d500 Add DefaultNoBound (#8542)
* Add DefaultNoBound

* Add tests

* Fix
2021-04-08 11:23:55 +00:00
Shawn Tabrizi d8c1a1d12b Add an INDEX to the Instance trait (#8555)
* Add an index to the Instance trait

* Update frame/support/procedural/src/storage/instance_trait.rs
2021-04-07 12:58:23 +00:00
Keith Yeung 1fdc8fa1c1 Add ChildTriePrefixIterator and methods (#8478)
* Make use of PrefixIterator underneath Storage[Key]Iterator

* Add ChildTriePrefixIterator and methods

* Add documentation on ChilTriePrefixIterator fields

* Deprecate Storage[Key]Iterator API instead of removing them

* Allow fetching for the prefix as an option for ChildTriePrefixIterator

* Rename prefix_fetch to fetch_previous_key

* fix implementation + test

* make gitdiff better

* Add test for storage_iter and storage_key_iter

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2021-04-01 14:20:43 +00:00
Gavin Wood 643d2b669f Introduce OnSetCode type into system config trait. (#8496)
* Introduce OnSetCode type into system config trait.

* Docs.

* Fixes

* Fixes
2021-04-01 12:20:24 +00:00
Kian Paimani 19f9224e5d helper macro to create storage types on the fly (#8456)
* helper macro to create storage types on the fly

* Update frame/support/src/lib.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* update lock

* fix test;

* Fix line width

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
2021-03-30 09:40:56 +00:00
Bastian Köcher 22139a3c03 Prepare UI tests for Rust 1.51 & new CI image (#8474)
* Prepare UI tests for Rust 1.51 & new CI image

* another stderr to be fixed

Co-authored-by: Denis P <denis.pisarev@parity.io>
2021-03-29 17:05:06 +02:00
Gavin Wood d0eee4f1cb Implement fungible::* for Balances (#8454)
* Reservable, Transferrable Fungible(s), plus adapters.

* Repot into new dir

* Imbalances for Fungibles

* Repot and balanced fungible.

* Clean up names and bridge-over Imbalanced.

* Repot frame_support::trait. Finally.

* Make build.

* Docs

* Good errors

* Fix tests. Implement fungible::Inspect for Balances.

* Implement additional traits for Balances.

* Revert UI test "fixes"

* Fix UI error

* Fix UI test

* More work on fungibles

* Fixes

* More work.

* Update lock

* Make fungible::reserved work for Balances

* Introduce Freezer to Assets, ready for a reserve & locks pallet. Some renaming/refactoring.

* Cleanup errors

* Imbalances working with Assets

* Test for freezer.

* Grumbles

* Grumbles

* Fixes

* Extra "side-car" data for a user's asset balance.

* Fix

* Fix test

* Fixes

* Line lengths

* Comments

* Update frame/assets/src/tests.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/support/src/traits/tokens/fungibles.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/assets/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/support/src/traits/tokens/fungible.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Introduce `transfer_reserved`

* Rename fungible Reserve -> Hold, add flag structs

* Avoid the `melted` API - its too complex and gives little help

* Repot Assets pallet

Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-03-28 20:59:34 +02:00
Gavin Wood ff5765eac3 Repot frame_support::traits; introduce some new currency stuff (#8435)
* Reservable, Transferrable Fungible(s), plus adapters.

* Repot into new dir

* Imbalances for Fungibles

* Repot and balanced fungible.

* Clean up names and bridge-over Imbalanced.

* Repot frame_support::trait. Finally.

* Make build.

* Docs

* Good errors

* Fix tests. Implement fungible::Inspect for Balances.

* Implement additional traits for Balances.

* Revert UI test "fixes"

* Fix UI error

* Fix UI test

* Fixes

* Update lock

* Grumbles

* Grumbles

* Fixes

Co-authored-by: Bastian Köcher <info@kchr.de>
2021-03-27 14:37:13 +01:00
Andrew Jones e7cd48767a Migrate pallet-sudo to pallet! (#8448)
* WIP convert sudo pallet to attribute macros

* Fix up tests and migrate mock

* Fix up genesis build

* Migrate doc comment example

* Update frame/sudo/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/sudo/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/sudo/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/sudo/src/lib.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Allow unused metadata call_functions

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-03-26 14:54:08 +00:00
Guillaume Thiolliere c529f13878 fix local variable names (#8450) 2021-03-25 10:43:20 +01:00
Falco Hirschenberger 9a72134188 Check unreserve and transfer returnvalues in debug code (#8398)
* Check `unreserve` and `transfer` returnvalues in debug code

fixes #8106

* few more

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-03-24 17:35:05 +00:00
Guillaume Thiolliere 1602f8dd2d Add tracing logic in pallet macro for hooks and dispatchables (#8305)
* span in hooks

* add span for dispatchable

* Update frame/support/src/lib.rs

* Update frame/support/src/lib.rs

Co-authored-by: David <dvdplm@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: David <dvdplm@gmail.com>
2021-03-23 15:53:46 +01:00
Gavin Wood b5b0ef592e Fungibles trait and impl for Assets pallet (#8425)
* Fungibles trait and impl for Assets pallet

* Comment & whitespace

* Fixes

* Fix up CI/CD for the new labels.

* New labels.

* Fix labels

* Fix labels

* Whitespace

* Bump impl version.

* Fix accidental change

* Fixes

* Questionable fix.

* Better benchmark
2021-03-23 14:10:36 +01:00
Shaun Wang 2e5522444a Replace 'Module' with 'Pallet' in construct_runtime macro (#8372)
* Use 'Pallet' struct in construct_runtime.

* Fix genesis and metadata macro.

* Fix 'Pallet' type alias.

* Replace 'Module' with 'Pallet' for all construct_runtime use cases.

* Replace more deprecated 'Module' struct.

* Bring back AllModules and AllPalletsWithSystem type, but deprecate them.

* Replace deprecated 'Module' struct from merge master.

* Minor fix.

* Fix UI tests.

* Revert UI override in derive_no_bound.

* Fix more deprecated 'Module' use from master branch.

* Fix more deprecated 'Module' use from master branch.
2021-03-18 08:50:08 +00:00
Gavin Wood 363db4f086 staking: Flexible generation of reward curve and associated tweaks (#8327)
* Initial abstraction

* Alter rest of APIs

* Fixes

* Some extra getters in Gilt pallet.

* Refactor Gilt to avoid u128 conversions

* Simplify and improve pow in per_things

* Add scalar division to per_things

* Renaming from_fraction -> from_float, drop _approximation

* Fixes

* Fixes

* Fixes

* Fixes

* Make stuff build

* Fixes

* Fixes

* Fixes

* Fixes

* Update .gitignore

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

* Update frame/gilt/src/lib.rs

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

* Update frame/gilt/src/mock.rs

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

* Fixes

* Fixes

* Fixes

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-03-16 12:03:58 +00:00
Shaun Wang 844e25522c Support pallet::storage conditional compilation (#8324)
* Support pallet::storage conditional compilation.

* Add docs for cfg attributes.

* Keep strong types for get cfg attrs return.

* Update frame/support/procedural/src/pallet/parse/helper.rs

* Update frame/support/procedural/src/pallet/parse/storage.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-03-16 08:51:51 +00:00