- Aug 24, 2024
-
-
José Molina Colmenero authored
The `pallet-collator-selection` is not correctly using the weight for the [new_session](https://github.com/blockdeep/pallet-collator-staking/blob/main/src/benchmarking.rs#L350-L353) function. The first parameter is the removed candidates, and the second one the original number of candidates before the removal, but both values are swapped.
-
- Aug 23, 2024
-
-
Branislav Kontur authored
(Please, do not merge until SA, reverted and restored of https://github.com/paritytech/polkadot-sdk/pull/4944) Original PR with more context: https://github.com/paritytech/parity-bridges-common/pull/2211 Relates to: https://github.com/paritytech/parity-bridges-common/issues/2210 ## TODO - [x] fresh weighs for `pallet_bridge_messages` - [x] add `try_state` for `pallet_bridge_messages` which checks for unpruned messages - relates to the [comment](https://github.com/paritytech/parity-bridges-common/pull/2211#issuecomment-1643224831) - [x] ~prepare migration, that prunes leftovers, which would be pruned eventually from `on_idle` the [comment](https://github.com/paritytech/parity-bridges-common/pull/2211#issuecomment-1643224831)~ can be done also by `set_storage` / `kill_storage` or with `OnRuntimeUpgrade` implementatino when `do_try_state_for_outbound_lanes` detects problem. ## Open question - [ ] Do we really need `oldest_unpruned_nonce` afterwards? - after the runtime upgrade and when `do_try_state_for_outbound_lanes` pass, we won't need any migrations here - we won't even need `do_try_state_for_outbound_lanes` - please check comments bellow: https://github.com/paritytech/polkadot-sdk/pull/4944#discussion_r1666737961 --------- Signed-off-by:
Branislav Kontur <bkontur@gmail.com> Co-authored-by:
Serban Iorga <serban@parity.io> Co-authored-by:
Svyatoslav Nikolsky <svyatonik@gmail.com> Co-authored-by: command-bot <>
-
Nazar Mokrynskyi authored
I'm not sure if this is exactly what https://github.com/paritytech/polkadot-sdk/issues/3537 meant, but I think it should be fine to wait for relay chain before initializing parachain node fully, which removed the need for background task and extra hacks throughout the stack just to know where warp sync should start. Previously there were both `WarpSyncParams` and `WarpSyncConfig`, but there was no longer any point in having two data structures, so I simplified it to just `WarpSyncConfig`. Fixes https://github.com/paritytech/polkadot-sdk/issues/3537
-
- Aug 22, 2024
-
-
Dónal Murray authored
Add the Polkadot Coretime chain-spec to the directory with the other system chain-specs. This is the chain-spec used at genesis and for which the genesis head data was generated. It is also included in the assets for fellowship [release v1.3.0](https://github.com/polkadot-fellows/runtimes/releases/tag/v1.3.0)
-
- Aug 21, 2024
-
-
Serban Iorga authored
Related to https://github.com/paritytech/polkadot-sdk/issues/5210
-
- Aug 18, 2024
-
-
Nazar Mokrynskyi authored
There was no need for it to be `&mut self` since block import can happen concurrently for different blocks and in many cases it was `&mut Arc<dyn BlockImport>` anyway :man_shrugging: Similar in nature to https://github.com/paritytech/polkadot-sdk/pull/4844
-
- Aug 15, 2024
-
-
Przemek Rzad authored
Co-authored-by:
Bastian Köcher <git@kchr.de>
-
Bastian Köcher authored
We only want to build one block per slot for Aura on parachains. However, we still need to build on each relay chain fork, which is using the same slot. Closes: https://github.com/paritytech/polkadot-sdk/issues/5349 --------- Co-authored-by:
Davide Galassi <davxy@datawok.net> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com>
-
- Aug 14, 2024
-
-
Adrian Catangiu authored
This is mostly tests cleanup: - uses helper macro for generating teleport tests, - adds missing treasury tests, - improves naming and docs for transfer tests. - [x] does not need a PRDOC --------- Co-authored-by: command-bot <>
-
Francisco Aguirre authored
In the move from XCMv3 to XCMv4, the `AssetId` for `ForeignAssets` in `asset-hub-rococo` and `asset-hub-westend` was left as `v3::Location` to be later migrated to `v4::Location`. This is that migration PR. Because the encoding of `v3::Location` and `v4::Location` is the same, we don't need to do any data migration, the keys will still be decodable. The [original idea by Jan](https://github.com/paritytech/polkadot/pull/7236) was to make the v4 changes in v3 since the ABI (the encoding/decoding) didn't change. Corroborated the ABI is the same iterating over all storage, the code is on [another branch](https://github.com/paritytech/polkadot-sdk/blob/cisco-assert-v3-v4-encodings-equal/cumulus/parachains/runtimes/assets/migrations/src/foreign_assets_to_v4/mod.rs). We will need a data migration when we want to update from `v4::Location` to `v5::Location` because of [the accepted RFC changing the NetworkId enum](https://github.com/polkadot-fellows/RFCs/pull/108). I'll configure MBMs (Multi-Block Migrations) then and make the actual migration. Fixes https://github.com/paritytech/polkadot-sdk/issues/4128 --------- 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: command-bot <>
-
- Aug 13, 2024
-
-
Sebastian Kunert authored
This PR adds an additional defensive check to the reclaim SE. Since it can happen that we miss some storage accesses on other SEs pre-dispatch, we should double check that the bookkeeping of the runtime stays ahead of the node-side pov-size. If we discover a mismatch and the node-side pov-size is indeed higher, we should set the runtime bookkeeping to the node-side value. In cases such as #5229, we would stop including extrinsics and not run `on_idle` at least. cc @gui1117 --------- Co-authored-by: command-bot <>
-
Branislav Kontur authored
-
- Aug 12, 2024
-
-
eskimor authored
Should be safe on all production network. I noticed that Paseo needs to be updated, it is lacking behind in a couple of things. Execution environment parameters should be updated to those of Polkadot: ``` [ { MaxMemoryPages: 8,192 } { PvfExecTimeout: [ Backing 2,500 ] } { PvfExecTimeout: [ Approval 15,000 ] } ] ] ``` --------- Co-authored-by:
eskimor <eskimor@no-such-url.com>
-
jserrat authored
Closes #4242 XCM programs that deposit assets to some new (empty) account will now succeed if at least one of the deposited assets satisfies ED. Before this change, the requirement was that the _first_ asset had to satisfy ED, but assets order can be changed during reanchoring so it is not reliable. With this PR, ordering doesn't matter, any one(s) of them can satisfy ED for the whole deposit to work. Kusama address: FkB6QEo8VnV3oifugNj5NeVG3Mvq1zFbrUu4P5YwRoe5mQN --------- Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: command-bot <>
-
- Aug 09, 2024
-
-
thiolliere authored
The code do reduce or increase the weight by comparing `benchmarked_weight` and `consumed_weight`. But `benchmarked_weight` is the pre dispatch weight. not the post dispatch weight that is actually written into the block weight by `CheckWeight`. So in case the consumed weight was: `pre dispatch weight > consumed weight > post dispatch weight` then the reclaim code was reducing the block weight instead of increasing it. Might explain this issue even better https://github.com/paritytech/polkadot-sdk/issues/5229 @skunert @s0me0ne-unkn0wn
-
Adrian Catangiu authored
In the real world, not all assets are sufficient. This aligns our emulated networks to that reality. Only DOT and USDT are sufficient "by default".
-
Serban Iorga authored
Updating the BHR and BHW runtime versions as a result of the changes in https://github.com/paritytech/polkadot-sdk/pull/5074/
-
- Aug 07, 2024
-
-
Ron authored
### Context Since Rococo is now deprecated, we need another testnet to detect bleeding-edge changes to Substrate, Polkadot, & BEEFY consensus protocols that could brick the bridge. It's the mirror PR of https://github.com/Snowfork/polkadot-sdk/pull/157 which has reviewed by Snowbridge team internally. Synced with @acatangiu about that in channel https://matrix.to/#/!gxqZwOyvhLstCgPJHO:matrix.parity.io/$N0CvTfDSl3cOQLEJeZBh-wlKJUXx7EDHAuNN5HuYHY4?via=matrix.parity.io&via=parity.io&via=matrix.org --------- Co-authored-by:
Clara van Staden <claravanstaden64@gmail.com>
-
Pablo Andrés Dorado Suárez authored
Closes #4517 Polkadot address: 12gMhxHw8QjEwLQvnqsmMVY1z5gFa54vND74aMUbhhwN6mJR --------- Co-authored-by:
joe petrowski <25483142+joepetrowski@users.noreply.github.com>
-
- Aug 05, 2024
-
-
Alexandru Gheorghe authored
The errors on polkadot-parachain are not printed with their full display context(what is marked with `#[error(`) because main returns plain Result and the error will be shown in its Debug format, that's not consistent with how the polkadot binary behave and is not user friendly since it does not tell them why they got the error. Fix it by using `color_eyre` as polkadot already does it. Fixes: https://github.com/paritytech/polkadot-sdk/issues/5211 ## Output before ``` Error: NetworkKeyNotFound("/acala/data/Collator2/chains/mandala-tc9/network/secret_ed25519") ``` ## Output after ``` Error: 0: Starting an authorithy without network key in /home/alexggh/.local/share/polkadot-parachain/chains/asset-hub-kusama/network/secret_ed25519. This is not a safe operation because other authorities in the network may depend on your node having a stable identity. Otherwise these other authorities may not being able to reach you. If it is the first time running your node you could use one of the following methods: 1. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --base-path <YOUR_BASE_PATH> 2. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --file <YOUR_PATH_TO_NODE_KEY> 3. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path 4. [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts ``` --------- Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io>
-
Sergej Sakac authored
This PR adds functionality that allows tasks to enable auto-renewal. Each task eligible for renewal can enable auto-renewal. A new storage value is added to track all the cores with auto-renewal enabled and the associated task running on the core. The `BoundedVec` is sorted by `CoreIndex` to make disabling auto-renewal more efficient. Cores are renewed at the start of a new bulk sale. If auto-renewal fails(e.g. due to the sovereign account of the task not holding sufficient balance), an event will be emitted, and the renewal will continue for the other cores. The two added extrinsics are: - `enable_auto_renew`: Extrinsic for enabling auto renewal. - `disable_auto_renew`: Extrinsic for disabling auto renewal. TODOs: - [x] Write benchmarks for the newly added extrinsics. Closes: #4351 --------- Co-authored-by:
Dónal Murray <donalm@seadanda.dev>
-
- Aug 02, 2024
-
-
Francisco Aguirre authored
Added a new adapter to xcm-builder, the `SingleAssetExchangeAdapter`. This adapter makes it easy to use `pallet-asset-conversion` for configuring the `AssetExchanger` XCM config item. I also took the liberty of adding a new function to the `AssetExchange` trait, with the following signature: ```rust fn quote_exchange_price(give: &Assets, want: &Assets, maximal: bool) -> Option<Assets>; ``` The signature is meant to be fairly symmetric to that of `exchange_asset`. The way they interact can be seen in the doc comment for it in the `AssetExchange` trait. This is a breaking change but is needed for https://github.com/paritytech/polkadot-sdk/pull/5131. Another idea is to create a new trait for this but that would require setting it in the XCM config which is also breaking. Old PR: https://github.com/paritytech/polkadot-sdk/pull/4375. --------- Co-authored-by:
Adrian Catangiu <adrian@parity.io>
-
- Jul 30, 2024
-
-
Egor_P authored
This PR backports regular version bumps and reorganisation of the `prdoc` files from the stable release branch back to master
-
- Jul 29, 2024
-
-
girazoki authored
Add the possibility of injecting session-keys in genesis for non-validators. Currently all keys injected in genesis were considered as part of the initial validators set, this PR allows to inject a new vector with non-authority keys --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
dependabot[bot] authored
Bumps the known_good_semver group with 1 update: [serde_json](https://github.com/serde-rs/json). Updates `serde_json` from 1.0.120 to 1.0.121 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/serde-rs/json/releases">serde_json's releases</a>.</em></p> <blockquote> <h2>v1.0.121</h2> <ul> <li>Optimize position search in error path (<a href="https://redirect.github.com/serde-rs/json/issues/1160">#1160</a>, thanks <a href="https://github.com/purplesyringa"><code>@purplesyringa</code></a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/serde-rs/json/commit/eca2658a22cb39952783cb6914eb18242659f66a"><code>eca2658</code></a> Release 1.0.121</li> <li><a href="https://github.com/serde-rs/json/commit/b0d678cfb473386830d559b6ab255d9e21ba39c5"><code>b0d678c</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/json/issues/1160">#1160</a> from iex-rs/efficient-position</li> <li><a href="https://github.com/serde-rs/json/commit/b1edc7d13f72880fd0ac569403a409e5f7961d5f"><code>b1edc7d</code></a> Optimize position search in error path</li> <li><a href="https://github.com/serde-rs/json/commit/40dd7f5e862436f02471fe076f3486c55e472bc2"><code>40dd7f5</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/json/issues/1159">#1159</a> from iex-rs/fix-recursion</li> <li><a href="https://github.com/serde-rs/json/commit/6a306e6ee9f47f3b37088217ffe3ebe9bbb54e5a"><code>6a306e6</code></a> Move call to tri! out of check_recursion!</li> <li><a href="https://github.com/serde-rs/json/commit/3f1c6de4af28b1f6c5100da323f2bffaf7c2083f"><code>3f1c6de</code></a> Ignore byte_char_slices clippy lint in test</li> <li><a href="https://github.com/serde-rs/json/commit/3fd6f5f49dc1c732d9b1d7dfece4f02c0d440d39"><code>3fd6f5f</code></a> Merge pull request <a href="https://redirect.github.com/serde-rs/json/issues/1153">#1153</a> from dpathakj/master</li> <li><a href="https://github.com/serde-rs/json/commit/fcb5e83e44abe0f9c27c755a240a6ad56312c090"><code>fcb5e83</code></a> Correct documentation URL for Value's Index impl.</li> <li>See full diff in <a href="https://github.com/serde-rs/json/compare/v1.0.120...v1.0.121">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> --------- Signed-off-by:
dependabot[bot] <support@github.com> Co-authored-by:
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
Bastian Köcher <info@kchr.de>
-
- 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
-
Sergej Sakac authored
The problem with the current implementation is that minting will cause the region coremask to be set to `Coremask::complete` regardless of the actual coremask. This PR fixes that. More details about the nonfungible implementation can be found here: https://github.com/paritytech/polkadot-sdk/pull/3455 --------- Co-authored-by:
Dónal Murray <donalm@seadanda.dev> Co-authored-by:
Branislav Kontur <bkontur@gmail.com> Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
Joseph Zhao authored
# Description This is continue of the work to backport `emulated-integration-tests-common`, if you want to understand the full context start with reading [#4930](https://github.com/paritytech/polkadot-sdk/pull/4930)
-
- Jul 25, 2024
-
-
Dónal Murray authored
Published as part of the fellowship [v1.2.6](https://github.com/polkadot-fellows/runtimes/releases/tag/v1.2.6) release and originally intentionally left out of the repo as the hardcoded system chains will soon be removed from the `polkadot-parachain`. After a conversation in https://github.com/paritytech/polkadot-sdk/issues/5112 it was pointed out by @josepot that there should be a single authoritative source for these chainspecs. Since this is already the place for these it will serve until something more fitting can be worked out.
-
Branislav Kontur authored
This PR adds `exporter_is_compatible_with_pallet_xcm_bridge_hub_router`, which ensures that our `pallet_xcm_bridge_hub` and `pallet_xcm_bridge_hub_router` are compatible when handling `ExportMessage`. Other changes are just small nits and cosmetics which makes others stuff easier. --------- Co-authored-by:
Svyatoslav Nikolsky <svyatonik@gmail.com>
-
- Jul 24, 2024
-
-
Muharem Ismailov authored
Drop the Existential Deposit (ED) requirement for the asset amount exchangeable for the fee asset (eg. DOT/KSM) during transaction payments. This achieved by using `SwapCredit` implementation of swap, which works with imbalances and does not require a temporary balance account within the transaction payment. ### Problem Currently, every swap during transaction payment, processed with asset `A` for native asset, must be for an amount greater than the ED of a native asset if the user lacks a native asset account. Since fees are typically smaller, the current implementation necessitates additional swaps to meet the ED during `pre_dispatch`, with refunds for excess ED swap occurring during `post_dispatch`. Further details can be found [here](https://github.com/paritytech/polkadot-sdk/blob/115c2477 /substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs#L115). This setup presents an issue where a user is unable to transfer their entire balance and close the account. Instead, the user must transfer slightly less of asset `A` to ensure there is enough not only for the fee payment but also some extra to meet the ED requirement for their native account during `pre_dispatch`. In some cases during `post_dispatch`, the user will have the excess ED swapped back to asset `A`, while in other cases, it may not be sufficient to meet the ED requirement for asset `A`, leading it being left in the user's 'temporary' native asset account. --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
- Jul 23, 2024
-
-
Alexandru Vasile authored
This PR extends the metrics exposed by the peerstore with the total number of banned peers. The new metric is exposed under `substrate_sub_libp2p_peerset_num_banned_peers`. To easily extend metrics in the future, the `fn num_known_peers` is removed in favor of `fn status`. While at it, enable the metrics for litep2p: - total number of peers from peerstore (needed to debug memory consumption) - total number of banned peers from peerstore (needed to debug reputation bans and disconnects) Have added a couple of tests to validate that the number of banned peers is exposed properly. Part of: https://github.com/paritytech/polkadot-sdk/issues/4681 ### Testing Done Using [subp2p-explorer](https://github.com/lexnv/subp2p-explorer) have submitted random data on tx protocol. The peer gets banned, the num of banned peers is incremented then the peer is disconnected. cc @paritytech/networking --------- Signed-off-by:
Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by:
Dmitry Markin <dmitry@markin.tech>
-
polka.dom authored
As per #3326, removes pallet::getter macro usage from the pallet-identity. The syntax `StorageItem::<T, I>::get()` should be used instead. Also makes all storage values public cc @muraca --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <>
-
Jun Jiang authored
Now Polkadot-SDK is ansi_term free --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
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 19, 2024
-
-
Bastian Köcher authored
This pull requests adds a new CLI flag to `polkadot-parachains` `--export-pov-to-path`. This CLI flag will instruct the node to export any `PoV` that it build locally to export to the given folder. Then these `PoV` files can be validated using the introduced `cumulus-pov-validator`. The combination of export and validation can be used for debugging parachain validation issues that may happen on the relay chain.
-
Joseph Zhao authored
# Issue [Backport integration tests for claim assets to the polkadot-sdk from polkadot-fellows repo #4892](https://github.com/paritytech/polkadot-sdk/issues/4892) # Description For the first time to contribute this project, I just finished part and make sure everything is ok. - [x] backport [claim_assets test case](https://github.com/polkadot-fellows/runtimes/blob/main/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/claim_assets.rs) to the polkadot-sdk testnet integration tests - [x] backport macro [test_chain_can_claim_assets](https://github.com/polkadot-fellows/runtimes/blob/main/integration-tests/emulated/helpers/src/lib.rs#L218) from fellows repo - [ ] when merged to polkadot-sdk and released, make sure that it is propagated to the fellows repo: https://github.com/polkadot-fellows/runtimes/issues/363 - [x] backport and align other macros/test-cases from https://github.com/polkadot-fellows/runtimes/blob/8ec28f96eeb30fbba30d29006d75e1a3fa1cea1c/integration-tests/emulated/helpers/src/lib.rs#L31-L33 --------- Co-authored-by:
Zihan Zhao <josephzhao@Zihans-MacBook-Pro-3.local> Co-authored-by: command-bot <> Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com>
-
Özgün Özerk authored
Fixes #4960 Configuring `FeeManager` enforces the boundary `Into<[u8; 32]>` for the `AccountId` type. Here is how it works currently: Configuration: ```rust type FeeManager = XcmFeeManagerFromComponents< IsChildSystemParachain<primitives::Id>, XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>, >; ``` `XcmToFeeAccount` struct: ```rust /// A `HandleFee` implementation that simply deposits the fees into a specific on-chain /// `ReceiverAccount`. /// /// It reuses the `AssetTransactor` configured on the XCM executor to deposit fee assets. If /// the `AssetTransactor` returns an error while calling `deposit_asset`, then a warning will be /// logged and the fee burned. pub struct XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount>( PhantomData<(AssetTransactor, AccountId, ReceiverAccount)>, ); impl< AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 32]>, ReceiverAccount: Get<AccountId>, > HandleFee for XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount> { fn handle_fee(fee: Assets, context: Option<&XcmContext>, _reason: FeeReason) -> Assets { deposit_or_burn_fee::<AssetTransactor, _>(fee, context, ReceiverAccount::get()); Assets::new() } } ``` `deposit_or_burn_fee()` function: ```rust /// Try to deposit the given fee in the specified account. /// Burns the fee in case of a failure. pub fn deposit_or_burn_fee<AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 32]>>( fee: Assets, context: Option<&XcmContext>, receiver: AccountId, ) { let dest = AccountId32 { network: None, id: receiver.into() }.into(); for asset in fee.into_inner() { if let Err(e) = AssetTransactor::deposit_asset(&asset, &dest, context) { log::trace!( target: "xcm::fees", "`AssetTransactor::deposit_asset` returned error: {:?}. Burning fee: {:?}. \ They might be burned.", e, asset, ); } } } ``` --- In order to use **another** `AccountId` type (for example, 20 byte addresses for compatibility with Ethereum or Bitcoin), one has to duplicate the code as the following (roughly changing every `32` to `20`): ```rust /// A `HandleFee` implementation that simply deposits the fees into a specific on-chain /// `ReceiverAccount`. /// /// It reuses the `AssetTransactor` configured on the XCM executor to deposit fee assets. If /// the `AssetTransactor` returns an error while calling `deposit_asset`, then a warning will be /// logged and the fee burned. pub struct XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount>( PhantomData<(AssetTransactor, AccountId, ReceiverAccount)>, ); impl< AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 20]>, ReceiverAccount: Get<AccountId>, > HandleFee for XcmFeeToAccount<AssetTransactor, AccountId, ReceiverAccount> { fn handle_fee(fee: XcmAssets, context: Option<&XcmContext>, _reason: FeeReason) -> XcmAssets { deposit_or_burn_fee::<AssetTransactor, _>(fee, context, ReceiverAccount::get()); XcmAssets::new() } } pub fn deposit_or_burn_fee<AssetTransactor: TransactAsset, AccountId: Clone + Into<[u8; 20]>>( fee: XcmAssets, context: Option<&XcmContext>, receiver: AccountId, ) { let dest = AccountKey20 { network: None, key: receiver.into() }.into(); for asset in fee.into_inner() { if let Err(e) = AssetTransactor::deposit_asset(&asset, &dest, context) { log::trace!( target: "xcm::fees", "`AssetTransactor::deposit_asset` returned error: {:?}. Burning fee: {:?}. \ They might be burned.", e, asset, ); } } } ``` --- This results in code duplication, which can be avoided simply by relaxing the trait enforced by `XcmFeeToAccount`. In this PR, I propose to introduce a new trait called `IntoLocation` to be able to express both `Into<[u8; 32]>` and `Into<[u8; 20]>` should be accepted (and every other `AccountId` type as long as they implement this trait). Currently, `deposit_or_burn_fee()` function converts the `receiver: AccountId` to a location. I think converting an account to `Location` should not be the responsibility of `deposit_or_burn_fee()` function. This trait also decouples the conversion of `AccountId` to `Location`, from `deposit_or_burn_fee()` function. And exposes `IntoLocation` trait. Thus, allowing everyone to come up with their `AccountId` type and make it compatible for configuring `FeeManager`. --- Note 1: if there is a better file/location to put `IntoLocation`, I'm all ears Note 2: making `deposit_or_burn_fee` or `XcmToFeeAccount` generic was not possible from what I understood, due to Rust currently do not support a way to express the generic should implement either `trait A` or `trait B` (since the compiler cannot guarantee they won't overlap). In this case, they are `Into<[u8; 32]>` and `Into<[u8; 20]>`. See [this](https://github.com/rust-lang/rust/issues/20400) and [this](https://github.com/rust-lang/rfcs/pull/1672#issuecomment-262152934). Note 3: I should also submit a PR to `frontier` that implements `IntoLocation` for `AccountId20` if this PR gets accepted. ### Summary this new trait: - decouples the conversion of `AccountId` to `Location`, from `deposit_or_burn_fee()` function - makes `XcmFeeToAccount` accept every possible `AccountId` type as long as they they implement `IntoLocation` - backwards compatible - keeps the API simple and clean while making it less restrictive @franciscoaguirre and @gupnik are already aware of the issue, so tagging them here for visibility. --------- Co-authored-by:
Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by:
Branislav Kontur <bkontur@gmail.com> Co-authored-by:
Adrian Catangiu <adrian@parity.io> Co-authored-by: command-bot <>
-
- Jul 17, 2024
-
-
Tom authored
Update the stake.plus bootnode addresses --------- Co-authored-by:
Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
-
Alin Dima authored
Resolves https://github.com/paritytech/polkadot-sdk/issues/4468 Gives instructions on how to enable elastic scaling MVP to parachain teams. Still a draft because it depends on further changes we make to the slot-based collator: https://github.com/paritytech/polkadot-sdk/pull/4097 Parachains cannot use this yet because the collator was not released and no relay chain network has been configured for elastic scaling yet
-