Working towards migrating the `parity-bridges-common` repo inside
`polkadot-sdk`. This PR upgrades some dependencies in order to align
them with the versions used in `parity-bridges-common`
Related to
https://github.com/paritytech/parity-bridges-common/issues/2538
The first step towards
https://github.com/paritytech/polkadot-sdk/issues/3155
Brings all templates under the following structure
```
templates
| parachain
| | polkadot-launch
| | runtime --> parachain-template-runtime
| | pallets --> pallet-parachain-template
| | node --> parachain-template-node
| minimal
| | runtime --> minimal-template-runtime
| | pallets --> pallet-minimal-template
| | node --> minimal-template-node
| solochain
| | runtime --> solochain-template-runtime
| | pallets --> pallet-template (the naming is not consistent here)
| | node --> solochain-template-node
```
The only note-worthy changes in this PR are:
- More `Cargo.toml` fields are forwarded to use the one from the
workspace.
- parachain template now has weights and benchmarks
- adds a shell pallet to the minimal template
- remove a few unused deps
A list of possible follow-ups:
- [ ] Unify READMEs, create a parent README for all
- [ ] remove references to `docs.substrate.io` in templates
- [ ] make all templates use `#[derive_impl]`
- [ ] update and unify all licenses
- [ ] Remove polkadot launch, use
https://github.com/paritytech/polkadot-sdk/blob/35349df993ea2e7c4769914ef5d199e787b23d4c/cumulus/zombienet/examples/small_network.toml
instead.
Step in https://github.com/paritytech/polkadot-sdk/issues/171
This PR removes the need to specify `as [disambiguation_path]` for cases
where the trait definition resides within the same scope as default impl
path.
For example, in the following macro invocation
```rust
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
...
}
```
the trait `DefaultConfig` lies within the `frame_system` scope and
`TestDefaultConfig` impls the `DefaultConfig` trait. Using this
information, we can compute the disambiguation path internally, thus
removing the need of an explicit specification.
In cases where the trait lies outside this scope, we would still need to
specify it explicitly, but this should take care of most (if not all)
uses of `derive_impl` within FRAME's context.
Changes (partial https://github.com/paritytech/polkadot-sdk/issues/994):
- Set log to `0.4.20` everywhere
- Lift `log` to the workspace
Starting with a simpler one after seeing
https://github.com/paritytech/polkadot-sdk/pull/2065 from @jsdw.
This sets the `default-features` to `false` in the root and then
overwrites that in each create to its original value. This is necessary
since otherwise the `default` features are additive and its impossible
to disable them in the crate again once they are enabled in the
workspace.
I am using a tool to do this, so its mostly a test to see that it works
as expected.
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
We currently use a bit of a hack in `.cargo/config` to make sure that
clippy isn't too annoying by specifying the list of lints.
There is now a stable way to define lints for a workspace. The only down
side is that every crate seems to have to opt into this so there's a
*few* files modified in this PR.
Dependencies:
- [x] PR that upgrades CI to use rust 1.74 is merged.
---------
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Using taplo, fixes all our broken and inconsistent toml formatting and
adds CI to keep them tidy.
If people want we can customise the format rules as described here
https://taplo.tamasfe.dev/configuration/formatter-options.html
@ggwpez, I suggest zepter is used only for checking features are
propagated, and leave formatting for taplo to avoid duplicate work and
conflicts.
TODO
- [x] Use `exclude = [...]` syntax in taplo file to ignore zombienet
tests instead of deleting the dir
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to
crates.io as someone as squatted `xcm`. The problem with this rename is
that the `TypeInfo` includes the crate name which ultimately lands in
the metadata. The metadata is consumed by downstream users like
`polkadot-js` or people building on top of `polkadot-js`. These people
are using the entire `path` to find the type in the type registry. Thus,
their code would break as the type path would now be [`staging_xcm`,
`VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request
fixes this by renaming the path segment `staging_xcm` to `xcm`.
This requires: https://github.com/paritytech/scale-info/pull/197
---------
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Needs https://github.com/sam0x17/macro_magic/pull/13
The associated PR allows the export of tokens from macro_magic at the
specified path. This fixes the path issue in derive-impl. Now, we can
import the default config using the standard rust syntax:
```rust
use frame_system::config_preludes::TestDefaultConfig;
[derive_impl(TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::DefaultConfig for Test {
//....
}
```
* Fix std, runtime-benchmarks and try-runtime features
zepter lint propagate-feature --feature try-runtime --left-side-feature-missing=ignore --workspace --fix --feature-enables-dep="try-runtime:frame-try-runtime"
zepter lint propagate-feature --feature runtime-benchmarks --left-side-feature-missing=ignore --workspace --fix --feature-enables-dep="runtime-benchmarks:frame-benchmarking"
zepter lint propagate-feature --feature std --left-side-feature-missing=ignore --workspace --fix
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add propagate feature CI check
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Test CI by adding an error
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Use --locked
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add help msg
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Revert "Test CI by adding an error"
This reverts commit cf4ff6cc0632269b0a109e547686e5e3314b02de.
* Test CI by adding an error
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* No newline in help msg
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Revert "Test CI by adding an error"
This reverts commit 5daa06ada8e01f5bebafb9d1c76804dd79bc1006.
* Test CI by adding an error
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Revert "Test CI by adding an error"
This reverts commit ca15de5729507a564f140a10ec2e87b19516ec4c.
* Fix msg
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Revert back to master
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Re-do with Zepter v0.7.4
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update Zepter to 0.7.4
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Disable rococo try-runtime check
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* More review fixes
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
* 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
* first draft, probably won't work
* first draft, probably won't work
* good progress..
* good milestone, still a lot to do.
* EVERYTHING WORKS
* Update frame/support/procedural/src/derive_impl.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update frame/support/procedural/src/derive_impl.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* clean up + cargo fmt
* import tokens WIP
* export_tokens working with impl Trait
* WIP / notes
* use macro_magic 0.2.0's export_tokens to access foreign items
* token importing working properly using macro_magic 0.2.5
* combine_impls almost working
* successfully get foreign path via macro_magic 0.2.6
* combine_impls using implementing_type generics
* working + clean up
* more clean up
* decrease rightwards drift and add docs to combine_impls
* add support for macros to impl_item_ident in case we hit that
* add docs for impl_item_ident method
* fix no_std issues
* re-export of macro_magic working in pallets 🎉
* clean up + fully resolve no_std issue with macro_magic with v0.2.11
* remove trait item code for different trait item types since this
is now handled directly by combine_impls
* clean up
* remove dev comments
* only generate default trait if #[pallet::default_trait] is attached
* authorship and most other pallets now compiling
* compiling 🎉
* add check for more than two pallet attributes on Config trait
* remove unused import in nomination-pool
* clean up debug code
* upgrade to macro_magic v0.2.12
* add neater #[register_default_config(SomeIdent)] macro
* really just a thin wrapper around #[export_tokens]
* upgrade to macro_magic 0.3.1
* rewrite parsing to be compatible with syn 2.x, compiling 🎉
* remove unused keywords
* macro stubs for the new pallet:: macros, preliminary docs
* upgrade to macro_magic v0.3.2
* rename register_default_config => register_default_impl
* bump to macro_magic v0.3.3
* custom disambiguation_path working as 2nd arg to derive_impl
* overhaul docs
* fixes, ident-style paths shortcut working
* remove ident-style shortcut because it makes testing difficult
* add passing UI tests for derive_impl
* switch to `ForeignPath as DisambiguationPath` syntax + update docs
* add UI test for bad foreign path
* add UI test for bad disambiguation path
* add UI test for missing disambiguation path
* add UI test for attached to non impl
* fix derive_impl_attr_args_parsing test
* move tests to bottom
* fix nightly issue
* add doc notes on importing/re-exporting
* remove explicit use of macro_magic::use_attr
Co-authored-by: Bastian Köcher <git@kchr.de>
* use explicit macro_magic::use_attr
Co-authored-by: Bastian Köcher <git@kchr.de>
* remove unneeded {}
Co-authored-by: Bastian Köcher <git@kchr.de>
* remove unneeded collect
Co-authored-by: Bastian Köcher <git@kchr.de>
* add docs for TestDefaultConfig
* remove unneeded `#[export_tokens]` on `DefaultConfig`
* add docs for auto-generated `DefaultConfig`
* no need to clone
Co-authored-by: Bastian Köcher <git@kchr.de>
* clean up combine_impls + compiling again
* remove unused dependency
* simplify struct definition
Co-authored-by: Bastian Köcher <git@kchr.de>
* fix register_default_impl docs
* reduce rightward drift / refactor
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* fix derive_impl after keith's changes
* simplify disambiguation_path calculation
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* compiling again
* simplify parsing of trait item
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* rename preludes => prelude
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* fix other places where we used preludes instead of prelude
* fix indents
* simplify PalletAttr parsing
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* go back to having no_default and constant as keywords
* make it more clear that disambiguation_path is optional
* make default_trait_items just a Vec instead of Option<Vec>
* rename foreign_path => default_impl_path within substrate
* fix docs
* Change {} to ;
Co-authored-by: Bastian Köcher <git@kchr.de>
* highlight full end-to-end example with link
* add pallet-default-config-example, start by copying dev mode code
* update dev-mode specific docs
* use Person and Points instead of Dummy and Bar
* add docs to example pallet
* revert changes to pallets other than the default config example
* fix outdated references to basic example pallet
* re-order docs to be a bit more clear
* better errors for extra attributes
* add UI tests for duplicate/extra attributes on trait items
* change `#[pallet::default_config]` to option on `#[pallet::config()]`
* update UI tests
* add UI test covering missing `#[pallet::config(with_default)]` when
`#[pallet::no_default]` is used
* add note about new optional conventions
* improve docs about `DefaultConfig` and link to these from a few places
* fix doc comment
* fix old comment referencing `pallet::default_config`
* use u32 instead of u64 for block number
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* use () instead of u32 for `AccountData`
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* use ConstU32<10> for BlockHashCount instead of ConstU64<10>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* people are not dummies
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
* fix wording
Co-authored-by: Just van Stam <vstam1@users.noreply.github.com>
* Person => People and compiling again
* add docs for `prelude` module in frame_system
* update Cargo.lock
* cleaner example
* tweaks
* update docs more
* update docs more
* update docs more
* update docs more
* fix ui tests
* err
* Update frame/support/test/tests/pallet_ui.rs
* update ui tests
---------
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Sam Johnson <sam@durosoft.com>
Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Just van Stam <vstam1@users.noreply.github.com>