- Aug 15, 2024
-
-
Kian Paimani authored
..without needing to provide your own `newtype` around it. This will allow `type Reason = u8` to be used as `FreezeReason` and `HoldReason`, which I think is a nice simplification if one doens't want to deal with the complications. At the same time, it is a bit of an anti-pattern. Putting it out there to check people's vibes.
-
- Aug 14, 2024
-
-
Muharem Ismailov authored
Make ticket non-optional and add ensure_successful method to Consideration trait. Reverts the optional return ticket type for the new function introduced in [polkadot-sdk/4596](https://github.com/paritytech/polkadot-sdk/pull/4596) and adds a helper `ensure_successful` function for the runtime benchmarks. Since the existing FRAME pallet represents zero cost with a zero balance rather than `None` in an option, maintaining the ticket type as a non-optional balance is beneficial for backward compatibility and helps avoid unnecessary migrations.
-
- Aug 06, 2024
-
-
Oliver Tale-Yazdi authored
Test currently failing, therefore improving to include a file from the same crate to not trip up the caching. R0 silent since this is only modifying unpublished crates. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Dónal Murray <donal.murray@parity.io>
-
- Jul 29, 2024
-
-
Przemek Rzad authored
An attempt to improve [the docs](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/index.html) by applying various corrections: - grammar/stylistics, - formatting, - broken links, - broken markdown table, - outdated vscode setting name, - typos, - consistency, - etc. Part of https://github.com/paritytech/eng-automation/issues/10
-
- Jul 26, 2024
-
-
Kian Paimani authored
A bit of a controversial move, but a good preparation for even further reducing the traffic on outdated content of `substrate.io`. Current status: <img width="728" alt="Screenshot 2024-07-15 at 11 32 48" src="https://github.com/user-attachments/assets/df33b164-0ce7-4ac4-bc97-a64485f12571"> Previously, I was in favor of changing the domain of the rust-docs to something like `polkadot-sdk.parity.io` or similar, but I think the current format is pretty standard and has a higher chance of staying put over the course of time: `<org-name>.github.io/<repo-name>` -> `https://paritytech.github.io/polkadot-sdk/` part of https://github.com/paritytech/eng-automation/issues/10
-
thiolliere authored
Fix warnings for rust 1.80
-
Shawn Tabrizi authored
We may want to construct a `Footprint` by taking the `max_encoded_len` of a type, without having to construct the type. This impl allows easy access to that. --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <>
-
- Jul 24, 2024
-
-
thiolliere authored
pallet macro: do not generate try-runtime related code when frame-support doesn't have try-runtime. (#5099) Status: Ready for review Fix https://github.com/paritytech/polkadot-sdk/issues/5092 Introduce a new macro in frame-support which discard content if `try-runtime` is not enabled. Use this macro inside `frame-support-procedural` to generate code only when `frame-support` is compiled with `try-runtime`. --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Jul 23, 2024
-
-
Muharem Ismailov authored
Make `on_unbalanceds` work with `fungibles` `imbalances`. The `fungibles` `imbalances` cannot be handled by the default implementation of `on_unbalanceds` from the `OnUnbalanced` trait. This is because the `fungibles` `imbalances` types do not implement the `Imbalance` trait (and cannot with its current semantics). The `on_unbalanceds` function requires only the `merge` function for the imbalance type. In this PR, we provide the `TryMerge` trait, which can be implemented by all imbalance types and make `OnUnbalanced` require it instead `Imbalance`. ### Migration for `OnUnbalanced` trait implementations: In case if you have a custom implementation of `on_unbalanceds` trait function, remove it's `<B>` type argument. ### Migration for custom imbalance types: If you have your own imbalance types implementations, implement the `TryMerge` trait for it introduced with this update. The applicability of the `on_unbalanceds` function to fungibles imbalances is useful in cases like - [link](https://github.com/paritytech/polkadot-sdk/blob/3a8e675e /substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs#L267) from https://github.com/paritytech/polkadot-sdk/pull/4488. --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
- Jul 22, 2024
-
-
gupnik authored
This PR fixes the documentation for FRAME Macros when pointed from `polkadot_sdk_docs` crate. This is achieved by referring to the examples in the `procedural` crate, embedded via `docify`. --------- Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com>
-
- Jul 15, 2024
-
-
Jun Jiang authored
This should remove nearly all usage of `sp-std` except: - bridge and bridge-hubs - a few of frames re-export `sp-std`, keep them for now - there is a usage of `sp_std::Writer`, I don't have an idea how to move it Please review proc-macro carefully. I'm not sure I'm doing it the right way. Note: need `/bot fmt` --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <>
-
- Jul 12, 2024
-
-
Bastian Köcher authored
This improves logging in the xcm-executor to have better debugability when executing a XCM message.
-
- Jul 10, 2024
-
-
Kian Paimani authored
Explains one of the annoying parts of FRAME storage that we have seen multiple times in PBA everyone gets stuck on. I have not updated the other two templates for now, and only reflected it in the parachain template. That can happen in a follow-up. - [x] Update possible answers in SE about the same topic. --------- Co-authored-by:
Serban Iorga <serban@parity.io> Co-authored-by: command-bot <>
-
- Jul 06, 2024
-
-
Tomás Senovilla Polo authored
Hi! In the course of a talk with @shawntabrizi in Singapore, we realized the documentation related to freeze balances' a little bit confusing. It stated that a frozen amount is released at some specified block number, which isn't true in general. This PR fixes that typo and further specifies that the frozen balance may exceed the available balance, according to what we learned at the PBA. This feature was not specified in the documentation AFAIK. This is the first time I submit something to the polkadot SDK repo, so please feel free to rephrase the docs I added in case I messed up! --------- Co-authored-by:
Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: command-bot <>
-
- Jul 03, 2024
-
-
gupnik authored
This PR fixes the unused warnings in `frame-support-procedural` crate, raised by the latest stable rust release.
-
- Jun 26, 2024
-
-
Muharem Ismailov authored
Introduce migration type to remove data associated with a specific storage of a pallet. Based on existing `RemovePallet` migration type. Required for https://github.com/paritytech/polkadot-sdk/pull/3820 --------- Co-authored-by:
Liam Aharon <liam.aharon@hotmail.com> Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com>
-
- Jun 25, 2024
-
-
gupnik authored
Fixes https://github.com/paritytech/polkadot-sdk/issues/4723. Also, closes https://github.com/paritytech/polkadot-sdk/issues/4622 As stated in the linked issue, this PR adds the ability to use a real rust type for pallet alias in the new `runtime` macro: ```rust #[runtime::pallet_index(0)] pub type System = frame_system::Pallet<Runtime>; ``` Please note that the current syntax still continues to be supported. CC: @shawntabrizi @Kianenigma --------- Co-authored-by: command-bot <> Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Jun 24, 2024
-
-
Oliver Tale-Yazdi authored
After preparing in https://github.com/paritytech/polkadot-sdk/pull/4633, we can lift also all internal dependencies up to the workspace. This does not actually change anything, but uses `workspace = true` for all dependencies. You can check it with: ```bash git checkout -q $(git merge-base oty-lift-all-deps origin/master) cargo tree -e features > master.out git checkout -q oty-lift-all-deps cargo tree -e features > new.out diff master.out new.out ``` It did not yet lift 100% of dependencies, some inside of `target.*` or some that had conflicting aliases introduced recently. But i will do these together in a follow-up with CI checks. Can be reproduced with [zepter](https://github.com/ggwpez/zepter/): `zepter transpose d lift-to-workspace "regex:.*" --version-resolver highest --skip-package "polkadot-sdk" --ignore-errors --fix`. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
- Jun 22, 2024
-
-
Muharem Ismailov authored
`Consideration` trait generic over `Footprint` and indicates zero cost for a give footprint. `Consideration` trait is generic over `Footprint` (currently defined over the type with the same name). This makes it possible to setup a custom footprint (e.g. current number of proposals in the storage). `Consideration::new` and `Consideration::update` return an `Option<Self>` instead `Self`, this make it possible to indicate a no cost for a specific footprint (e.g. if current number of proposals in the storage < max_proposal_count / 2 then no cost). These cases need to be handled for https://github.com/paritytech/polkadot-sdk/pull/3151
-
- Jun 21, 2024
-
-
Pablo Andrés Dorado Suárez authored
Closes #3342 cc/ @liamaharon TODO: - [x] Improve docs. - [x] Define public interface (See #3342). In case we define public calls to the pallet implementation: - Implement public calls. - Benchmarks. polkadot address: 12gMhxHw8QjEwLQvnqsmMVY1z5gFa54vND74aMUbhhwN6mJR --------- Co-authored-by: command-bot <> Co-authored-by:
Liam Aharon <liam.aharon@hotmail.com>
-
- Jun 13, 2024
-
-
Branislav Kontur authored
This PR aligns the settings for `MaxFreezes`, `RuntimeFreezeReason`, and `FreezeIdentifier`. #### Future work and improvements https://github.com/paritytech/polkadot-sdk/issues/2997 (remove `MaxFreezes` and `FreezeIdentifier`)
-
Kian Paimani authored
After using this tutorial in PBA, there was a few areas to improve it. Moreover, I have: - Improve `your_first_pallet`, link it in README, improve the parent `guide` section. - Updated the templates page, in light of recent efforts related to in https://github.com/paritytech/polkadot-sdk/issues/3155 - Added small ref docs about metadata, completed the one about native runtime, added one about host functions. - Remove a lot of unfinished stuff from sdk-docs - update diagram for `Hooks`
-
- Jun 08, 2024
-
-
Alexandru Vasile authored
Small refactoring PR to improve the readability of the proc macros. - small improvement in docs - use new `let Some(..) else` expression - removed extra indentations by early returns Discovered during metadata v16 poc, extracted from: https://github.com/paritytech/polkadot-sdk/pull/4358 --------- Signed-off-by:
Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <> Co-authored-by:
gupnik <mail.guptanikhil@gmail.com>
-
- Jun 05, 2024
-
-
Oliver Tale-Yazdi authored
Inherited workspace dependencies cannot be renamed by the crate using them (see [1](https://github.com/rust-lang/cargo/issues/12546), [2](https://stackoverflow.com/questions/76792343/can-inherited-dependencies-in-rust-be-aliased-in-the-cargo-toml-file)). Since we want to use inherited workspace dependencies everywhere, we first need to unify all aliases that we use for a dependency throughout the workspace. The umbrella crate is currently excluded from this procedure, since it should be able to export the crates by their original name without much hassle. For example: one crate may alias `parity-scale-codec` to `codec`, while another crate does not alias it at all. After this change, all crates have to use `codec` as name. The problematic combinations were: - conflicting aliases: most crates aliases as `A` but some use `B`. - missing alias: most of the crates alias a dep but some dont. - superfluous alias: most crates dont alias a dep but some do. The script that i used first determines whether most crates opted to alias a dependency or not. From that info it decides whether to use an alias or not. If it decided to use an alias, the most common one is used everywhere. To reproduce, i used [this](https://github.com/ggwpez/substrate-scripts/blob/master/uniform-crate-alias.py) python script in combination with [this](https://github.com/ggwpez/zepter/blob/38ad10585fe98a5a86c1d2369738bc763a77057b/renames.json) error output from Zepter. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Jun 02, 2024
-
-
gupnik authored
Fixes https://github.com/paritytech/polkadot-sdk/issues/4552 --------- Co-authored-by: command-bot <> Co-authored-by:
Bastian Köcher <info@kchr.de>
-
- May 29, 2024
-
-
gupnik authored
Step in https://github.com/paritytech/polkadot-sdk/issues/3688 Now that the `runtime` macro (Construct Runtime V2) has been successfully deployed on Westend, this PR moves it out of the experimental feature flag and makes it generally available for runtime devs. --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com>
-
- May 24, 2024
-
-
Oliver Tale-Yazdi authored
# Umbrella Crate The Polkadot-SDK "umbrella" is a crate that re-exports all other published crates. This makes it possible to have a very small `Cargo.toml` file that only has one dependency, the umbrella crate. This helps with selecting the right combination of crate versions, since otherwise 3rd party tools are needed to select a compatible set of versions. ## Features The umbrella crate supports no-std builds and can therefore be used in the runtime and node. There are two main features: `runtime` and `node`. The `runtime` feature enables all `no-std` crates, while the `node` feature enables all `std` crates. It should be used like any other crate in the repo, with `default-features = false`. For more fine-grained control, additionally, each crate can be enabled selectively. The umbrella exposes one feature per dependency. For example, if you only want to use the `frame-support` crate, you can enable the `frame-support` feature. The umbrella exposes a few more general features: - `tuples-96`: Needs to be enabled for runtimes that have more than 64 pallets. - `serde`: Specifically enable `serde` en/decoding support. - `experimental`: Experimental enable experimental features - should not yet used in production. - `with-tracing`: Enable tracing support. - `try-runtime`, `runtime-benchmarks` and `std`: These follow the standard conventions. - `runtime`: As described above, enable all `no-std` crates. - `node`: As described above, enable all `std` crates. - There does *not* exist a dedicated docs feature. To generate docs, enable the `runtime` and `node` feature. For docs.rs the manifest contains specific configuration to make it show up all re-exports. There is a specific `zepter` check in place to ensure that the features of the umbrella are correctly configured. This check is run in CI and locally when running `zepter`. ## Generation The umbrella crate needs to be updated every time when a new crate is added or removed from the workspace. It is checked in CI by calling its generation script. The generation script is located in `./scripts/generate-umbrella.py` and needs dependency `cargo_workspace`. Example: `python3 scripts/generate-umbrella.py --sdk . --version 1.9.0` ## Usage > Note: You can see a live example in the `staging-node-cli` and `kitchensink-runtime` crates. The umbrella crate can be added to your runtime crate like this: `polkadot-sdk = { path = "../../../../umbrella", features = ["runtime"], default-features = false}` or for a node: `polkadot-sdk = { path = "../../../../umbrella", features = ["node"], default-features = false }` In the code, it is then possible to bring all dependencies into scope via: `use polkadot_sdk::*;` ### Known Issues The only known issue so far is the fact that the `use` statement brings the dependencies only into the outer module scope - not the global crate scope. For example, the following code would need to be adjusted: ```rust use polkadot_sdk::*; mod foo { // This does sadly not compile: frame_support::parameter_types! { } // Instead, we need to do this (or add an equivalent `use` statement): polkadot_sdk::frame_support::parameter_types! { } } ``` Apart from this, no issues are known. There could be some bugs with how macros locate their own re-exports. Please compile issues that arise from using this crate. ## Dependencies The umbrella crate re-exports all published crates, with a few exceptions: - Runtime crates like `rococo-runtime` etc are not exported. This otherwise leads to very weird compile errors and should not be needed anyway. - Example and fuzzing crates are not exported. This is currently detected by checking the name of the crate for these magic words. In the future, it will utilize custom metadata, as it is done in the `rococo-runtime` crate. - The umbrella crate itself. Should be obvious :) ## Follow Ups - [ ] Re-writing the generator in Rust - the python script is at its limit. - [ ] Using custom metadata to exclude some crates instead of filtering by names. - [ ] Finding a way to setting the version properly. Currently its locked in the CI script. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
Branislav Kontur authored
Attempt to avoid specifying `BlockHashCount` for different `mocking::{MockBlock, MockBlockU32, MockBlockU128}` (#4543) While doing some migration/rebase I came in to the situation, where I needed to change `mocking::MockBlock` to `mocking::MockBlockU32`: ``` #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl frame_system::Config for TestRuntime { type Block = frame_system::mocking::MockBlockU32<TestRuntime>; type AccountData = pallet_balances::AccountData<ThisChainBalance>; } ``` But actual `TestDefaultConfig` for `frame_system` is using `ConstU64` for `type BlockHashCount = frame_support::traits::ConstU64<10>;` [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/system/src/lib.rs#L303). Because of this, it force me to specify and add override for `type BlockHashCount = ConstU32<10>`. This PR tries to fix this with `TestBlockHashCount` implementation for `TestDefaultConfig` which supports `u32`, `u64` and `u128` as a `BlockNumber`. ### How to simulate error Just by removing `type BlockHashCount = ConstU32<250>;` [here](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/multisig/src/tests.rs#L44) ``` :~/parity/olkadot-sdk$ cargo test -p pallet-multisig Compiling pallet-multisig v28.0.0 (/home/bparity/parity/aaa/polkadot-sdk/substrate/frame/multisig) error[E0277]: the trait bound `ConstU64<10>: frame_support::traits::Get<u32>` is not satisfied --> substrate/frame/multisig/src/tests.rs:41:1 | 41 | #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_support::traits::Get<u32>` is not implemented for `ConstU64<10>` | = help: the following other types implement trait `frame_support::traits::Get<T>`: <ConstU64<T> as frame_support::traits::Get<u64>> <ConstU64<T> as frame_support::traits::Get<std::option::Option<u64>>> note: required by a bound in `frame_system::Config::BlockHashCount` --> /home/bparity/parity/aaa/polkadot-sdk/substrate/frame/system/src/lib.rs:535:24 | 535 | type BlockHashCount: Get<BlockNumberFor<Self>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Config::BlockHashCount` = note: this error originates in the attribute macro `derive_impl` which comes from the expansion of the macro `frame_support::macro_magic::forward_tokens_verbatim` (in Nightly builds, run with -Z macro-backtrace for more info) For more information about this error, try `rustc --explain E0277`. error: could not compile `pallet-multisig` (lib test) due to 1 previous error ``` ## For reviewers: (If there is a better solution, please let me know!) The first commit contains actual attempt to fix the problem: https://github.com/paritytech/polkadot-sdk/commit/3c5499e5 . The second commit is just removal of `BlockHashCount` from all other places where not needed by default. Closes: https://github.com/paritytech/polkadot-sdk/issues/1657 --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- May 15, 2024
-
-
Alexandru Gheorghe authored
This bump of versions: https://github.com/paritytech/polkadot-sdk/pull/4409/files#diff-13ee4b2252c9e516a0547f2891aa2105c3ca71c6d7a1e682c69be97998dfc87eR11936 reintroduced a dependency to proc-macro-crate 2.0.0 which is suffering from: https://github.com/bkchr/proc-macro-crate/pull/42 this, so bump parity-scale-codec to a newer version to eliminate the bad proc-macro-crate 2.0.0 dependency. --------- Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io> Co-authored-by: command-bot <>
-
- May 13, 2024
-
-
Tsvetomir Dimitrov authored
This PR bumps `proc-macro-crate` to the latest version. In order to test a runtime from https://github.com/polkadot-fellows/runtimes/ with the latest version of polkadot-sdk one needs to use `cargo vendor` to extract all runtime dependencies, patch them by hand and then build the runtime. However at the moment 'vendored' builds fail due to https://github.com/bkchr/proc-macro-crate/issues/48. To fix this `proc-macro-crate` should be updated to version `3.0.1` or higher. --------- Co-authored-by: command-bot <>
-
- May 10, 2024
-
-
gupnik authored
-
- May 08, 2024
-
-
Dino Pačandi authored
Adds an additional extrinsic call to the `pallet-balances` to _burn_ tokens. Depending on the `keep_alive` flag, the call might or might not reap the account. Required modification of the _fungible's_ `Mutate` trait, `burn_from` function to allow the `Preservation` argument. **TODO** - [x] run benchmarks & update weights - [x] make sure prdoc is required & properly formatted Related issue: https://github.com/paritytech/polkadot-sdk/issues/3943 --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
-
- May 06, 2024
-
-
Jun Jiang authored
Split from #4374 This PR helps to reduce dependencies and align versions, which would help to move them to workspace dep
-
- Apr 30, 2024
-
-
gupnik authored
This PR makes a few improvements in the docs for the minimal template. --------- Co-authored-by:
Kian Paimani <5588131+kianenigma@users.noreply.github.com>
-
- Apr 26, 2024
-
-
thiolliere authored
Currently we discard errors content We should at least log it. Code now is more similar to what is written in try_on_runtime_upgrade. label should be R0 --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Liam Aharon <liam.aharon@hotmail.com> Co-authored-by:
Javier Bullrich <javier@bullrich.dev>
-
- Apr 25, 2024
-
-
Oliver Tale-Yazdi authored
Changes: - Add new error variant `ProcessMessageError::StackLimitReached` and treat XCM error `ExceedsStackLimit` as such. --------- Signed-off-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Branislav Kontur <bkontur@gmail.com>
-
- Apr 24, 2024
-
-
gupnik authored
This PR updates the `validate_unsigned` hook for `frame_system` to allow valid tasks to be submitted as unsigned transactions. It also updates the task example to be able to submit such transactions via an off-chain worker. --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Apr 20, 2024
-
-
thiolliere authored
Generated type is not camel case this generate some warnings from IDE label should be R0
-
- Apr 18, 2024
-
-
Alexander Samusev authored
cc https://github.com/paritytech/ci_cd/issues/974 --------- Co-authored-by: command-bot <> Co-authored-by:
Bastian Köcher <info@kchr.de>
-
- Apr 17, 2024
-
-
thiolliere authored
Improve doc: * the pallet macro is actually referring to 2 places, for the module and for the struct placeholder but doesn't really clarify it (I should have named the latter just `pallet_struct` or something but it is a bit late) * The doc of `with_default` is a bit confusing too IMO. CC @Kianenigma --------- Co-authored-by:
Liam Aharon <liam.aharon@hotmail.com>
-