Gavin Wood
a6891951fb
Referenda and Conviction Voting pallets ( #10195 )
...
* Initial draft of new referendum state machine.
* Docs
* Fixes
* Fixes
* Add conviction-voting pallet
* Basic build
* Building
* Some TODOs
* Tests building
* Add missing file
* Basic lifecycle test
* Add couple of tests
* Another test
* More tests
* Fixes
* Fixes
* Formatting
* Fixes
* Tests
* Fixes
* Fixes
* More tests
* Formatting
* First few benchmarks
* First few benchmarks
* Defered queue servicing
* More testing
* Benchmarks
* Fiddly benchmark
* Final nudge benchmarks
* Formatting
* Formatting
* Finished up benchmarks
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_referenda --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/referenda/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Events finished
* Missing file
* No GenesisConfig for Referenda
* Formatting
* Docs
* Docs
* Docs
* Per-class conviction voting
* New test & mock utils
* More tests
* Tests
* Tests finished 🎉
* Benchmarking stuff
* Fixes
* Test harness
* Test harness
* Benchmarks for Conviction=Voting
* Benchmarking pipeline complete
* Docs
* Formatting
* Remove unneeded warning
* Fix UI tests
* cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_conviction_voting --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/conviction-voting/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Docs
* Update frame/conviction-voting/src/vote.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* update sp-runtime version
* MEL Fixes for Referenda and Conviction Voting (#10725 )
* free maxencodedlen
* more maxencodedlen
* more MEL
* more mel
* disable storage info
* More Referenda Patches (#10760 )
* basic fixes
* fix benchmarking
* fix license
* prevent panic in curve math
* fmt
* bump crate versions
* Update mock.rs
Co-authored-by: Parity Bot <admin@parity.io >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2022-02-06 12:51:12 +01:00
Bastian Köcher
f3662b4bba
Happy new year 2022 ( #10573 )
2022-01-03 09:22:14 +01:00
Guillaume Thiolliere
20c9afcdc1
Better error for when origin filter prevent the call to be dispatched ( #10134 )
...
* better error
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* remove unused
* fix error
* fmt
* fix tests
* fmt
* Update frame/contracts/src/exec.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* fix typo
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2021-11-02 14:20:00 +00:00
Andrew Jones
49b6dfd2e5
Enrich metadata with type information ( #8615 )
...
* Cargo.lock after merge
* Restore scale-info feature
* Fully qualify TypeInfo derive
* Skip PendingSwap T
* Add missing skip_type_params attr
* metadata docs features
* Reduce pallet event attribute to struct
* Cargo.lock
* Update frame/balances/src/tests_composite.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Line widths check
* Cargo.lock
* Add scale-info/std
* Update frame/system/src/lib.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Use `skip_type_params` to remove `TypeInfo` requirements on checks
* Revert "Remove unused Call metadata stuff"
This reverts commit 41311f85
* Skip BalanceSwapAction type parameter
* Remove unused event metadata macro
* Update frame-metadata
* Update primitives/npos-elections/compact/src/codec.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Manual TypeInfo for Header
* Remove TypeInfo requirement for consts in BoundedVec etc.
* Another TypeInfo bound removed
* review: fix indentation
* TypeInfo impls for Identity types
* Add some todos to add custom TypeInfo impls
* Update frame/support/procedural/src/pallet/expand/pallet_struct.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Add some todos to add custom TypeInfo impls
* Add a test for manual Data TypeInfo impl
* Add custom TypeInfo impl for Vote
* Era custom TypeInfo crimes
* Revert finality-grandpa version to 0.14.z
* review: renamed module to pallet_constants_metadata
* New line at end of file
* Add missing scale-info/std
* Update frame/support/src/storage/types/mod.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Remove StorageEntryType::Map unused flag
* Add missing scale-info dependency after merge
* SignedExtension::AdditionalSigned metadata
* Update frame-metadata, use abbreviated docs and args fields
* Update frame/example/Cargo.toml
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Add scale_info/std and remove unused scale-info dependency
* Remove scale-info dependency
* Remove treasury pallet::metadata
* Remove redundant Event test
* Add back scale-info as dev dependency
* fix error metadata when no error defined in decl_module
* Add Module3 to tests
* Fix metadata test
* Add docs feature to frame-support test
* WIP fixing pallet metadata test
* Remove redundant FunctionMetadata, FunctionArgumentMetadata as per https://github.com/paritytech/frame-metadata/pull/20
* Use main branch of frame-metadata
* Use patch of scale-info for latest changes
* Use latest patched scale-info
* Manual TypeInfo for DigestItem
* Manual TypeInfo for DigestItem
* Update scale-info
* Skip __Ignore variants for Error, depends on https://github.com/paritytech/scale-info/pull/117
* Named fields for FRAME v2 pallet Call variants
* Named fields for FRAME v1 pallet Call variants
* Add missing scale-info dependency
* WIP expand benchmark call variant
* fix benchmark with new function
create a new function for each variant of a pallet call.
This function is called by benchmarking macro in order not to break call
creation with unnamed argument
* fix tests
* more fix
* Fix staking tests
* Fix offchain workers calls
* Cherry pick rustfmt.toml from master
* cargo +nightly-2021-06-22 fmt --all
* Update to new call variant structs
* More call variant struct updates
* Remove unused import
* More call variant structs
* More call variant structs
* Even more call variant structs
* Mooar variant structs
* Evermore variant structs
* Call variant structs ad infinitum
* Fmt
* More call variants
* Last call variant
* Call variants all done?
* Fix SS58Prefix type
* Potential workaround for BitFlags<IdentityFields> TypeInfo
* Enable docs capturing for Call, Event, and Error types
* Fix IdentityFields TypeInfo
* Remove metadata-docs feature
* Add capture_docs = true for legacy Call, Event and Error types
* Fmt
* Fix metadata test type
* Update benchmarks with call struct variants
* Fmt
* More test fixes
* Fmt
* Fix benches
* Use latest capture_docs attr
* Latest scale_info
* Fmt
* review: change &Vec to &[]
* Remove pallet metadata attr
* review: remove commented out test code
* review: skip_type_params trailing comma suggestion
* Update to scale-info 0.10.0
* Update construct_runtime ui tests, different because of metadata TypeInfo impls
* Add some TypeInfo derives for UI tests
* Update storage ensure span ui stderrs
* Update call argument bound ui tests
Possibly changed because change from tuple to struct variants?
* Add scale-info dev dependency
* Update to latest finality-grandpa release
* review: missing newline
* review: missing scale-info/std
* review: remove duplicate scale-info/std
* review: remove fully qualified TypeInfo
* review: add missing scale-info/std
* review: remove unnecessary imports.
* Fmt
* Use crates.io RC version of frame-metadata
* Remove scale-info/std because it is a dev dependency
* Add missing scale_info dev-dependency for test
* Delete empty metadata folder
* Fix sp_std import
* review: improve manual UncheckedExtrinsic TypeInfo impl
* review: use full scale-info for dev-dependency
* Remove DefaultByteGetter impl
* review: derive TypeInfo for generic header
* Fmt
* Update primitives/runtime/src/generic/unchecked_extrinsic.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Update primitives/runtime/src/generic/unchecked_extrinsic.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Update bin/node/executor/Cargo.toml
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/identity/src/types.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* Remove redundant derive
* Simplify scale-info dependency
* Strip underscore prefix from call variant struct names
* Another underscore field
* More underscore fields
* Another underscore field
* Update to frame-metadata 14.0.0-rc.2 with combined StorageEntryType::Map
* Fmt
* Revert weights formatting
* Fix up some tests
* Fix up some tests for StorageEntryTypeMetadata
* scale-info dev dependency
* Fix test error
* Add missing TypeInfo derives
* Add back missing scale-info dependency
* Add back missing scale-info dependency
* Fix npos compact impls
* Cargo.lock
* Fmt
* Fix errors
* Fmt
* Fix renamed raw_solution field
* Fix error
* Fmt
* Fix some benchmarks
* Fmt
* Stray R
* Fix
* Add missing TypeInfos
* ui test fix
* Fix line widths
* Revert "ui test fix"
This reverts commit 2d15ec058a216e3f92d713f1174603a2bb1eac65.
* Upgrade to scale-info 0.11.0
* Revert "Upgrade to scale-info 0.11.0"
This reverts commit 047bb179085a0059c36cd20ab405f55cf0867e28.
* Add Runtime type
* Update to scale-info 0.12
* Update to scale-info 1.0
* Update frame-metadata to version 14.0.0
* Patch finality-grandpa until release available
* Fix metadata tests
* Fix metadata tests
* Fmt
* Remove patched finality-grandpa
* Fix tests, use scale_info imports
* Fix pallet tests
* Add BlockNumber TypeInfo bound
* ui test fix
* Cargo.lock
* Remove pallet metadata
* Cargo.lock
* Add missing scale-info dependency
* Remove pallet event metadata
* Fix error
* Fix collective errors
* Semicolol
* Fmt
* Remove another metadata attribute
* Add new variant to custom digest TypeInfo
* Fmt
* Cargo.lock from master
* Remove comma lol
* Fix example call error
* Fix example call error properly
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
2021-09-15 11:40:41 +00:00
Gavin Wood
bdda3ed612
Remove Filter and use Contains instead ( #9514 )
...
* Remove Filter and use Contains instead
* Fixes
* Formatting
* Update docs/Upgrading-2.0-to-3.0.md
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Typo
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2021-08-07 19:26:40 +00:00
Bastian Köcher
7b56ab15b4
Run cargo fmt on the whole code base ( #9394 )
...
* Run cargo fmt on the whole code base
* Second run
* Add CI check
* Fix compilation
* More unnecessary braces
* Handle weights
* Use --all
* Use correct attributes...
* Fix UI tests
* AHHHHHHHHH
* 🤦
* Docs
* Fix compilation
* 🤷
* Please stop
* 🤦 x 2
* More
* make rustfmt.toml consistent with polkadot
Co-authored-by: André Silva <andrerfosilva@gmail.com >
2021-07-21 14:32:32 +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
Bastian Köcher
e3e651f72c
Happy new year ( #7814 )
...
* Happy new year
Updates the copyright years and fixes wrong license headers.
* Fix the template
* Split HEADER into HEADER-APACHE & HEADER-GPL
2021-01-04 09:03:13 +00:00
Guillaume Thiolliere
1cbfc9257f
Rename pallet trait Trait to Config ( #7599 )
...
* rename Trait to Config
* add test asserting using Trait is still valid.
* fix ui tests
2020-11-30 14:34:54 +00:00
Bastian Köcher
ed1d0fa815
Implements pallet versioning ( #7208 )
...
* Start
* Make macro work
* Rename `ModuleToIndex` to `PalletRuntimeSetup`
Besides the renaming it also adds support getting the name of a pallet
as configured in the runtime.
* Rename it to `PalletInfo`
* Remove accidentally added files
* Some work
* Make everything compile
* Adds a test and fixes some bugs
* Implement ordering for `PalletVersion`
* Apply suggestions from code review
* Review feedback
* Update frame/support/src/dispatch.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
* Fix compilation
* Fix test
* Fix doc test
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com >
2020-10-21 19:05:52 +02:00
Guillaume Thiolliere
98951b33a9
Allow pallet in construct_runtime to have fixed index ( #6969 )
...
* implement index for pallet + some tests
* add test and doc
* remove deprecated and document behavior
* update internal doc
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* address review
* use index for all module, break construct_runtime
* fix line length
* implement migration helper funciton in scheduler
* fix start at index 0
* Update frame/scheduler/src/lib.rs
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/support/procedural/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* bump frame-metadata crate
* factorize
* avoid some unwrap and remove nightly join
* Update frame/support/src/event.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* fix test
* add test and improve error message
* factorize test
* keep iterator, and use slice instead of vec
* refactor to avoid to have expects
* small refactor
* Test something
* Make sure we update the `Cargo.lock`
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
* return 2 error
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
* Update frame/scheduler/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* fix typo
* Revert "fix typo"
This reverts commit f2de8f2db34e8ac72bc9c34437c60dca3fa4ac22.
* Revert "Update frame/scheduler/src/lib.rs"
This reverts commit 6feb4605c6f784b64591e229de7a6fec6dbffb4b.
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Bastian Köcher <git@kchr.de >
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2020-09-22 14:54:03 +00:00
Bastian Köcher
86594727d9
Rename ModuleToIndex to PalletRuntimeSetup ( #7148 )
...
* Rename `ModuleToIndex` to `PalletRuntimeSetup`
Besides the renaming it also adds support getting the name of a pallet
as configured in the runtime.
* Rename it to `PalletInfo`
* Remove accidentally added files
2020-09-22 13:39:56 +00:00
Shawn Tabrizi
50568fcc19
Disambiguate BlockNumber type in decl_module ( #7061 )
...
* Disambiguate `BlockNumber` type in `decl_module`
* fix `frame-support-tests`
* fix ui tests
* fix trait order
2020-09-10 01:47:24 +02:00
Xiliang Chen
e1d0f84c67
Allow specify schedule dispatch origin ( #6387 )
...
* allow specify schedule dispatch origin
* fix tests
* use caller origin for scheduled
* fix tests
* line width
* check origin for cancel
* line width
* fix some issues for benchmarking
* fix doc test
* another way to constraint origin
* fix build issues
* fix cancel
* line width
* fix benchmarks
* bump version
* enable runtime upgrade
* add migration code and test
* Update frame/scheduler/src/lib.rs
Co-authored-by: Gavin Wood <github@gavwood.com >
* expose migration method
* add notes
* bump version
* remove on_runtime_upgrade
* fix test
Co-authored-by: Gavin Wood <github@gavwood.com >
2020-07-02 15:05:15 +02:00
Guillaume Thiolliere
6103e9854c
llow decl-module to have a where clause with trailing comma ( #6431 )
2020-06-19 16:00:06 +02:00
Guillaume Thiolliere
c2ad27271b
Introduce in-origin filtering ( #6318 )
...
* impl filter in origin
* remove IsCallable usage. Breaking: utility::batch(root, calls) no longer bypass BasicCallFilter
* rename BasicCallFilter -> BaseCallFilter
* refactor code
* Apply suggestions from code review
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* remove forgotten temporar comment
* better add suggestion in another PR
* refactor: use Clone instead of mem::replace
* fix tests
* fix tests
* fix tests
* fix benchmarks
* Make root bypass filter in utility::batch
* fix unused imports
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2020-06-15 17:05:41 +02:00
Benjamin Kampmann
be8c96adec
Relax substrate licensing scheme ( #5947 )
2020-05-15 13:21:56 +02:00
Gavin Wood
5b7512e2e4
Composite accounts ( #4820 )
...
* Basic account composition.
* Add try_mutate_exists
* De-duplicate
* Refactor away the UpdateBalanceOutcome
* Expunge final UpdateBalanceOutcome refs
* Refactor transfer
* Refactor reservable currency stuff.
* Test with the alternative setup.
* Fixes
* Test with both setups.
* Fixes
* Fix
* Fix macros
* Make indices opt-in
* Remove CreationFee, and make indices opt-in.
* Fix construct_runtime
* Fix last few bits
* Fix tests
* Update trait impls
* Don't hardcode the system event
* Make tests build and fix some stuff.
* Pointlessly bump runtime version
* Fix benchmark
* Another fix
* Whitespace
* Make indices module economically safe
* Migrations for indices.
* Fix
* Whilespace
* Trim defunct migrations
* Remove unused storage item
* More contains_key fixes
* Docs.
* Bump runtime
* Remove unneeded code
* Fix test
* Fix test
* Update frame/balances/src/lib.rs
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com >
* Fix ED logic
* Repatriate reserved logic
* Typo
* Fix typo
* Update frame/system/src/lib.rs
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com >
* Update frame/system/src/lib.rs
Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com >
* Last few fixes
* Another fix
* Build fix
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com >
Co-authored-by: Jaco Greeff <jacogr@gmail.com >
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2020-02-14 00:47:51 +00:00
Shawn Tabrizi
7efa62725e
Update copyright year ( #4532 )
2020-01-05 14:05:44 +01:00
Bastian Köcher
f02e6d680a
Make sure docs given to decl_module! are passed to the module struct ( #4526 )
2020-01-03 20:39:30 +00:00
Bastian Köcher
8e393aa5a8
Make decl_error! errors usable ( #4449 )
...
* Make `decl_error!` errors usable
This pr implements support for returning errors of different pallets in
a pallet. These errors need to be declared with `decl_error!`.
The pr changes the following:
- Each dispatchable function now returns a `DispatchResult` which is an
alias for `Result<(), DispatchError>`.
- `DispatchError` is an enum that has 4 variants:
- `Other`: For storing string error messages
- `CannotLookup`: Variant that is returned when something returns a
`sp_runtime::LookupError`
- `BadOrigin`: Variant that is returned for any kind of bad origin
- `Module`: The error of a specific module. Contains the `index`,
`error` and the `message`. The index is the index of the module in
`construct_runtime!`. `error` is the index of the error in the error
enum declared by `decl_error!`. `message` is the message to the error
variant (this will not be encoded).
- `construct_runtime!` now creates a new struct `ModuleToIndex`. This
struct implements the trait `ModuleToIndex`.
- `frame_system::Trait` has a new associated type: `ModuleToIndex` that
expects the `ModuleToIndex` generated by `construct_runtime!`.
- All error strings returned in any module are being converted now to `DispatchError`.
- `BadOrigin` is the default error returned by any type that implements `EnsureOrigin`.
* Fix frame system benchmarks
2019-12-19 14:01:52 +01:00
Tomasz Drwięga
8778ca7dc8
[big refactor] Remove crate aliasing. ( #4395 )
...
* Rename: Phase 1.
* Unify codec.
* Fixing: Phase 2
* Fixing: Phase 3.
* Fixing: Phase 4.
* Fixing: Phase 5.
* Fixing: Phase 6.
* Fixing: Phase 7.
* Fixing: Phase 8. Tests
* Fixing: Phase 9. Tests!!!
* Fixing: Phase 10. Moar tests!
* Finally done!
* More fixes.
* Rename primitives:: to sp_core::
* Apply renames in finality-grandpa.
* Fix benches.
* Fix benches 2.
* Revert node-template.
* Fix frame-system in our modules.
2019-12-16 20:36:49 +08:00
Benjamin Kampmann
927e13c13a
The crate rename ( #4223 )
...
* Adding script for rename, could be applicable for nodes on top of it, too
* add stderr and gitlab ci features
* apply script
* fix now minor details in expected stderr
* Update the Cargo.lock
* fix name: sc-transaction -> sc-tracing
* fix rename in script, too
2019-12-02 11:23:53 +01:00
Shawn Tabrizi
c9175b59ff
Rename Palette to FRAME ( #4182 )
...
* palette -> frame
* PALETTE, Palette -> FRAME
* Move folder pallete -> frame
* Update docs/Structure.adoc
Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com >
* Update docs/README.adoc
Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com >
* Update README.adoc
2019-11-22 19:21:25 +01:00