gupnik
cd8741c8b5
Moves all test runtimes to use derive_impl ( #2409 )
...
Step in https://github.com/paritytech/polkadot-sdk/issues/171
This PR adds `derive_impl` on all `frame_system` config impls for mock
runtimes. The overridden configs are maintained as of now to ensure
minimal changes.
---------
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2023-11-28 14:13:57 +01:00
Kian Paimani
35eb133baa
Ensure correct variant count in Runtime[Hold/Freeze]Reason ( #1900 )
...
closes https://github.com/paritytech/polkadot-sdk/issues/1882
## Breaking Changes
This PR introduces a new item to `pallet_balances::Config`:
```diff
trait Config {
++ type RuntimeFreezeReasons;
}
```
This value is only used to check it against `type MaxFreeze`. A similar
check has been added for `MaxHolds` against `RuntimeHoldReasons`, which
is already given to `pallet_balances`.
In all contexts, you should pass the real `RuntimeFreezeReasons`
generated by `construct_runtime` to `type RuntimeFreezeReasons`. Passing
`()` would also work, but it would imply that the runtime uses no
freezes at all.
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2023-10-24 12:01:04 +02:00
Juan
6a29a70a92
Replace system config Index for Nonce ( #14290 )
...
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* replace Index by Nonce
* wip
* remove index in lieu of nonce
* wip
* remove accountnonce in lieu of nonce
* add minor improvement
* rebase and merge conflicts
2023-07-14 06:56:48 +00:00
gupnik
5e7b27e98c
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber ( #14437 )
...
* Initial setup
* Adds node block
* Uses UncheckedExtrinsic and removes Where section
* Updates frame_system to use Block
* Adds deprecation warning
* Fixes pallet-timestamp
* Removes Header and BlockNumber
* Addresses review comments
* Addresses review comments
* Adds comment about compiler bug
* Removes where clause
* Refactors code
* Fixes errors in cargo check
* Fixes errors in cargo check
* Fixes warnings in cargo check
* Formatting
* Fixes construct_runtime tests
* Uses import instead of full path for BlockNumber
* Uses import instead of full path for Header
* Formatting
* Fixes construct_runtime tests
* Fixes imports in benchmarks
* Formatting
* Fixes construct_runtime tests
* Formatting
* Minor updates
* Fixes construct_runtime ui tests
* Fixes construct_runtime ui tests with 1.70
* Fixes docs
* Fixes docs
* Adds u128 mock block type
* Fixes split example
* fixes for cumulus
* ".git/.scripts/commands/fmt/fmt.sh"
* Updates new tests
* Fixes fully-qualified path in few places
* Formatting
* Update frame/examples/default-config/src/lib.rs
Co-authored-by: Juan <juangirini@gmail.com >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Juan <juangirini@gmail.com >
* ".git/.scripts/commands/fmt/fmt.sh"
* Addresses some review comments
* Fixes build
* ".git/.scripts/commands/fmt/fmt.sh"
* Update frame/democracy/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/democracy/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/support/procedural/src/construct_runtime/mod.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Addresses review comments
* Updates trait bounds
* Minor fix
* ".git/.scripts/commands/fmt/fmt.sh"
* Removes unnecessary bound
* ".git/.scripts/commands/fmt/fmt.sh"
* Updates test
* Fixes build
* Adds a bound for header
* ".git/.scripts/commands/fmt/fmt.sh"
* Removes where block
* Minor fix
* Minor fix
* Fixes tests
* ".git/.scripts/commands/update-ui/update-ui.sh" 1.70
* Updates test
* Update primitives/runtime/src/traits.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* Update primitives/runtime/src/traits.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* Updates doc
* Updates doc
---------
Co-authored-by: command-bot <>
Co-authored-by: Juan <juangirini@gmail.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-07-13 12:01:34 +00:00
Michal Kucharczyk
87d41d0a89
GenesisBuild<T,I> deprecated. BuildGenesisConfig added. (#14306 )
...
* frame::support: GenesisConfig types for Runtime enabled
* frame::support: macro generating GenesisBuild::build for RuntimeGenesisConfig
* frame: ambiguity BuildStorage vs GenesisBuild fixed
* fix
* RuntimeGenesisBuild added
* Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
* Revert "fix"
This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
* Revert "RuntimeGenesisBuild added"
This reverts commit 3c131b618138ced29c01ab8d15d8c6410c9e128b.
* Revert "Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed""
This reverts commit 2b1ecd467231eddec69f8d328039ba48a380da3d.
* Revert "Revert "fix""
This reverts commit fd7fa629adf579d83e30e6ae9fd162637fc45e30.
* Code review suggestions
* frame: BuildGenesisConfig added, BuildGenesis deprecated
* frame: some pallets updated with BuildGenesisConfig
* constuct_runtime: support for BuildGenesisConfig
* frame::support: genesis_build macro supports BuildGenesisConfig
* frame: BuildGenesisConfig added, BuildGenesis deprecated
* Cargo.lock update
* test-runtime: fixes
* Revert "fix"
This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b.
* Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"
This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293.
* self review
* doc fixed
* ui tests fixed
* fmt
* tests fixed
* genesis_build macrto fixed for non-generic GenesisConfig
* BuildGenesisConfig constraints added
* warning fixed
* some duplication removed
* fmt
* fix
* doc tests fix
* doc fix
* cleanup: remove BuildModuleGenesisStorage
* self review comments
* fix
* Update frame/treasury/src/tests.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com >
* Update frame/support/src/traits/hooks.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com >
* doc fix: GenesisBuild exposed
* ".git/.scripts/commands/fmt/fmt.sh"
* frame: more serde(skip) + cleanup
* Update frame/support/src/traits/hooks.rs
Co-authored-by: Davide Galassi <davxy@datawok.net >
* frame: phantom fields moved to the end of structs
* chain-spec: Default::default cleanup
* test-runtime: phantom at the end
* merge master fixes
* fix
* fix
* fix
* fix
* fix (facepalm)
* Update frame/support/procedural/src/pallet/expand/genesis_build.rs
Co-authored-by: Bastian Köcher <git@kchr.de >
* fmt
* fix
* fix
---------
Co-authored-by: parity-processbot <>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com >
Co-authored-by: Davide Galassi <davxy@datawok.net >
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-07-12 10:22:12 +00:00
Bastian Köcher
05da6d8e84
HoldReason: Improve usage ( #13869 )
...
* HoldReason: Improve usage
`HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums
from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the
variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason`
from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as
type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the
pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`.
* Update frame/nis/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Review comment
* Fixes
---------
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2023-05-24 21:59:34 +00:00
Gavin Wood
5d81f23f8f
Deprecate Currency; introduce holds and freezing into fungible traits ( #12951 )
...
* First reworking of fungibles API
* New API and docs
* More fungible::* API improvements
* New ref-counting logic for old API
* Missing files
* Fixes
* Use the new transfer logic
* Use fungibles for the dispatchables
* Use shelve/restore names
* Locking works with total balance.
* repotting and removal
* Separate Holds from Reserves
* Introduce freezes
* Missing files
* Tests for freezing
* Fix hold+freeze combo
* More tests
* Fee-free dispatchable for upgrading accounts
* Benchmarks and a few fixes
* Another test
* Docs and refactor to avoid blanket impls
* Repot
* Fit out ItemOf fully
* Add events to Balanced traits
* Introduced events into Hold traits
* Fix Assets pallet tests
* Assets benchmarks pass
* Missing files and fixes
* Fixes
* Fixes
* Benchmarks fixes
* Fix balance benchmarks
* Formatting
* Expose fungible sub modules
* Move NIS to fungible API
* Fix broken impl and add test
* Fix tests
* API for `transfer_and_hold`
* Use composite APIs
* Formatting
* Upgraded event
* Fixes
* Fixes
* Fixes
* Fixes
* Repot tests and some fixed
* Fix some bits
* Fix dust tests
* Rename `set_balance`
- `Balances::set_balance` becomes `Balances::force_set_balance`
- `Unbalanced::set_balance` becomes `Unbalances::write_balance`
* becomes
* Move dust handling to fungibles API
* Formatting
* Fixes and more refactoring
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Fixes
* Use reducible_balance for better correctness on fees
* Reducing hold to zero should remove entry.
* Add test
* Docs
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/regular.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
* Docs
* Docs
* Docs
* Fix NIS benchmarks
* Doc comment
* Remove post_mutation
* Fix some tests
* Fix some grumbles
* Enumify bool args to fungible(s) functions
* Fix up assets and balances
* Formatting
* Fix contracts
* Fix tests & benchmarks build
* Typify minted boolean arg
* Typify on_hold boolean arg; renames
* Fix numerous tests
* Fix dependency issue
* Privatize dangerous API mutate_account
* Fix contracts (@alext - please check this commit)
* Remove println
* Fix tests for contracts
* Fix broken rename
* Fix broken rename
* Fix broken rename
* Docs
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* remove from_ref_time
* Update frame/executive/src/lib.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/executive/src/lib.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Reenable test
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/currency.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/lottery/src/tests.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/mod.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/freeze.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungible/regular.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Update frame/support/src/traits/tokens/fungibles/hold.rs
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
* Rename UnwantedRemoval to UnwantedAccountRemoval
* Docs
* Formatting
* Update frame/balances/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update primitives/runtime/src/lib.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* handle_raw_dust oes nothing
* Formatting
* Fixes
* Grumble
* Fixes
* Add test
* Add test
* Tests for reducible_balance
* Fixes
* Fix Salary
* Fixes
* Disable broken test
* Disable nicely
* Fixes
* Fixes
* Fixes
* Rename some events
* Fix nomination pools breakage
* Add compatibility stub for transfer tx
* Reinstate a safely compatible version of Balances set_balance
* Fixes
* Grumble
* Update frame/nis/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
* disable flakey tests
* Update frame/balances/src/lib.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Grumbles
* Grumble
---------
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: command-bot <>
2023-03-18 14:47:55 +00:00
Vivek Pandya
bc53b9a03a
Remove years from copyright notes. ( #13415 )
...
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
2023-02-21 18:46:41 +00:00
Oliver Tale-Yazdi
2bc6078738
Remove unused types ( #13091 )
...
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2023-01-07 13:42:44 +00:00
Gavin Wood
1f4475eaff
OpenGov: Abstentions ( #12842 )
...
* OpenGov: Abstentions
* Tests
2022-12-05 18:15:59 +00:00
Sergej Sakac
e4b6f4a66d
BREAKING: Rename Origin ( #12258 )
...
* BREAKING: Rename Origin
* more renaming
* a bit more renaming
* fix
* more fixing
* fix in frame_support
* even more fixes
* fix
* small fix
* ...
* update .stderr
* docs
* update docs
* update docs
* docs
2022-09-20 22:13:09 +00:00
Sergej Sakac
6e8795afe6
BREAKING: Rename Call & Event ( #11981 )
...
* rename Event to RuntimeEvent
* rename Call
* rename in runtimes
* small fix
* rename Event
* small fix & rename RuntimeCall back to Call for now
* small fixes
* more renaming
* a bit more renaming
* fmt
* small fix
* commit
* prep for renaming associated types
* fix
* rename associated Event type
* rename to RuntimeEvent
* commit
* merge conflict fixes & fmt
* additional renaming
* fix.
* fix decl_event
* rename in tests
* remove warnings
* remove accidental rename
* .
* commit
* update .stderr
* fix in test
* update .stderr
* TRYBUILD=overwrite
* docs
* fmt
* small change in docs
* rename PalletEvent to Event
* rename Call to RuntimeCall
* renamed at wrong places :P
* rename Call
* rename
* rename associated type
* fix
* fix & fmt
* commit
* frame-support-test
* passing tests
* update docs
* rustdoc fix
* update .stderr
* wrong code in docs
* merge fix
* fix in error message
* update .stderr
* docs & error message
* .
* merge fix
* merge fix
* fmt
* fmt
* merge fix
* more fixing
* fmt
* remove unused
* fmt
* fix
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2022-09-12 22:03:31 +00:00
Shawn Tabrizi
30951822ba
Weight v1.5: Opaque Struct ( #12138 )
...
* initial idea
* update frame_support
* update a bunch more
* add ord
* adjust RuntimeDbWeight
* frame_system builds
* re-export
* frame_support tests pass
* frame_executive compile
* frame_executive builds
* frame_system tests passing
* pallet-utility tests pass
* fix a bunch of pallets
* more
* phragmen
* state-trie-migration
* scheduler and referenda
* pallet-election-provider-multi-phase
* aura
* staking
* more
* babe
* balances
* bunch more
* sudo
* transaction-payment
* asset-tx-payment
* last pallets
* fix alliance merge
* fix node template runtime
* fix pallet-contracts cc @athei
* fix node runtime
* fix compile on runtime-benchmarks feature
* comment
* fix frame-support-test
* fix more tests
* weight regex
* frame system works
* fix a bunch
* more
* more
* more
* more
* more
* more fixes
* update templates
* fix contracts benchmarks
* Update lib.rs
* Update lib.rs
* fix ui
* make scalar saturating mul const
* more const functions
* scalar div
* refactor using constant functions
* move impl
* fix overhead template
* use compactas
* Update lib.rs
2022-08-31 11:26:13 +00:00
Gavin Wood
7808b0c349
Several tweaks needed for Governance 2.0 ( #11124 )
...
* Add stepped curve for referenda
* Treasury SpendOrigin
* Add tests
* Better Origin Or-gating
* Reciprocal curve
* Tests for reciprical and rounding in PerThings
* Tweaks and new quad curve
* Const derivation of reciprocal curve parameters
* Remove some unneeded code
* Actually useful linear curve
* Fixes
* Provisional curves
* Rejig 'turnout' as 'support'
* Use TypedGet
* Fixes
* Enable curve's ceil to be configured
* Formatting
* Fixes
* Fixes
* Fixes
* Remove EnsureOneOf
* Fixes
* Fixes
* Fixes
* Formatting
* Fixes
* Update frame/support/src/traits/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Grumbles
* Formatting
* Fixes
* APIs of VoteTally should include class
* Fixes
* Fix overlay prefix removal result
* Second part of the overlay prefix removal fix.
* Formatting
* Fixes
* Add some tests and make clear rounding algo
* Fixes
* Formatting
* Revert questionable fix
* Introduce test for kill_prefix
* Fixes
* Formatting
* Fixes
* Fix possible overflow
* Docs
* Add benchmark test
* Formatting
* Update frame/referenda/src/types.rs
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
* Docs
* Fixes
* Use latest API in tests
* Formatting
* Whitespace
* Use latest API in tests
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com >
2022-05-31 11:12:34 +01:00
Qinxuan Chen
52967f17de
pallet-conviction-voting: make the pallet instantiable ( #11088 )
...
* pallet-conviction-voting: make the pallet instanceable
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
* Add default type param for some type alias
Signed-off-by: koushiro <koushiro.cqx@gmail.com >
2022-03-25 09:45:01 -04:00
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