diff --git a/.github/workflows/networking-benchmarks.yml b/.github/workflows/benchmarks-networking.yml
similarity index 86%
rename from .github/workflows/networking-benchmarks.yml
rename to .github/workflows/benchmarks-networking.yml
index e45ae601105d..79494b9a015c 100644
--- a/.github/workflows/networking-benchmarks.yml
+++ b/.github/workflows/benchmarks-networking.yml
@@ -17,7 +17,7 @@ jobs:
uses: ./.github/workflows/reusable-preflight.yml
build:
- timeout-minutes: 80
+ timeout-minutes: 50
needs: [preflight]
runs-on: ${{ needs.preflight.outputs.RUNNER_BENCHMARK }}
container:
@@ -27,12 +27,8 @@ jobs:
matrix:
features:
[
- {
- bench: "notifications_protocol",
- },
- {
- bench: "request_response_protocol",
- },
+ { bench: "notifications_protocol" },
+ { bench: "request_response_protocol" },
]
steps:
- name: Checkout
@@ -42,7 +38,7 @@ jobs:
id: run-benchmarks
run: |
mkdir -p ./charts
- forklift cargo bench -p sc-network --bench ${{ matrix.features.bench }} -- --output-format bencher | grep "^test" | tee ./charts/networking-bench.txt || echo "Benchmarks failed"
+ forklift cargo bench -p sc-network --bench ${{ matrix.features.bench }} -- --output-format bencher | grep "^test" | tee ./charts/${{ matrix.features.bench }}.txt || echo "Benchmarks failed"
ls -lsa ./charts
- name: Upload artifacts
@@ -69,7 +65,13 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
- name: networking-bench-${{ github.sha }}
+ name: notifications_protocol-${{ github.sha }}
+ path: ./charts
+
+ - name: Download artifacts
+ uses: actions/download-artifact@v4.1.8
+ with:
+ name: request_response_protocol-${{ github.sha }}
path: ./charts
- name: Setup git
diff --git a/.github/workflows/subsystem-benchmarks.yml b/.github/workflows/benchmarks-subsystem.yml
similarity index 100%
rename from .github/workflows/subsystem-benchmarks.yml
rename to .github/workflows/benchmarks-subsystem.yml
diff --git a/.github/workflows/reusable-preflight.yml b/.github/workflows/reusable-preflight.yml
index e1799adddcaf..8487ab107d7c 100644
--- a/.github/workflows/reusable-preflight.yml
+++ b/.github/workflows/reusable-preflight.yml
@@ -203,6 +203,7 @@ jobs:
echo $( substrate-contracts-node --version | awk 'NF' )
estuary --version
cargo-contract --version
+ taplo --version
- name: Info forklift
run: forklift version
diff --git a/.github/workflows/runtimes-matrix.json b/.github/workflows/runtimes-matrix.json
index 104e73521331..ff16b7397247 100644
--- a/.github/workflows/runtimes-matrix.json
+++ b/.github/workflows/runtimes-matrix.json
@@ -145,7 +145,7 @@
{
"name": "glutton-westend",
"package": "glutton-westend-runtime",
- "path": "cumulus/parachains/runtimes/gluttons/glutton-westend",
+ "path": "cumulus/parachains/runtimes/glutton/glutton-westend",
"header": "cumulus/file_header.txt",
"template": "cumulus/templates/xcm-bench-template.hbs",
"bench_features": "runtime-benchmarks",
diff --git a/Cargo.lock b/Cargo.lock
index 8ee01cf9e663..d90e3494ca4a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -959,11 +959,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -1095,11 +1095,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -2678,11 +2678,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -2917,11 +2917,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -3657,11 +3657,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -3964,11 +3964,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -4107,11 +4107,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -4208,11 +4208,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -5101,6 +5101,25 @@ dependencies = [
"sp-runtime 39.0.2",
]
+[[package]]
+name = "cumulus-pallet-weight-reclaim"
+version = "1.0.0"
+dependencies = [
+ "cumulus-primitives-proof-size-hostfunction 0.2.0",
+ "cumulus-primitives-storage-weight-reclaim 1.0.0",
+ "derivative",
+ "docify",
+ "frame-benchmarking 28.0.0",
+ "frame-support 28.0.0",
+ "frame-system 28.0.0",
+ "log",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-io 30.0.0",
+ "sp-runtime 31.0.1",
+ "sp-trie 29.0.0",
+]
+
[[package]]
name = "cumulus-pallet-xcm"
version = "0.7.0"
@@ -5551,10 +5570,10 @@ dependencies = [
name = "cumulus-test-client"
version = "0.1.0"
dependencies = [
+ "cumulus-pallet-weight-reclaim",
"cumulus-primitives-core 0.7.0",
"cumulus-primitives-parachain-inherent 0.7.0",
"cumulus-primitives-proof-size-hostfunction 0.2.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-test-relay-sproof-builder 0.7.0",
"cumulus-test-runtime",
"cumulus-test-service",
@@ -5616,9 +5635,9 @@ version = "0.1.0"
dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"frame-executive 28.0.0",
"frame-support 28.0.0",
"frame-system 28.0.0",
@@ -5670,8 +5689,8 @@ dependencies = [
"cumulus-client-pov-recovery",
"cumulus-client-service",
"cumulus-pallet-parachain-system 0.7.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-relay-chain-inprocess-interface",
"cumulus-relay-chain-interface",
"cumulus-relay-chain-minimal-node",
@@ -16863,11 +16882,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"enumflags2",
"frame-benchmarking 28.0.0",
@@ -16966,11 +16985,11 @@ dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
"cumulus-pallet-session-benchmarking 9.0.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"enumflags2",
"frame-benchmarking 28.0.0",
@@ -18777,6 +18796,7 @@ dependencies = [
"cumulus-pallet-parachain-system-proc-macro 0.6.0",
"cumulus-pallet-session-benchmarking 9.0.0",
"cumulus-pallet-solo-to-para 0.7.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-ping 0.7.0",
@@ -19365,8 +19385,8 @@ dependencies = [
"cumulus-client-service",
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-primitives-proof-size-hostfunction 0.2.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"docify",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
@@ -21579,12 +21599,12 @@ version = "0.6.0"
dependencies = [
"cumulus-pallet-aura-ext 0.7.0",
"cumulus-pallet-parachain-system 0.7.0",
+ "cumulus-pallet-weight-reclaim",
"cumulus-pallet-xcm 0.7.0",
"cumulus-pallet-xcmp-queue 0.7.0",
"cumulus-ping 0.7.0",
"cumulus-primitives-aura 0.7.0",
"cumulus-primitives-core 0.7.0",
- "cumulus-primitives-storage-weight-reclaim 1.0.0",
"cumulus-primitives-utility 0.7.0",
"frame-benchmarking 28.0.0",
"frame-executive 28.0.0",
diff --git a/Cargo.toml b/Cargo.toml
index 64a11a340d10..c917a8a8fead 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -83,6 +83,7 @@ members = [
"cumulus/pallets/parachain-system/proc-macro",
"cumulus/pallets/session-benchmarking",
"cumulus/pallets/solo-to-para",
+ "cumulus/pallets/weight-reclaim",
"cumulus/pallets/xcm",
"cumulus/pallets/xcmp-queue",
"cumulus/parachains/common",
@@ -717,6 +718,7 @@ cumulus-pallet-parachain-system = { path = "cumulus/pallets/parachain-system", d
cumulus-pallet-parachain-system-proc-macro = { path = "cumulus/pallets/parachain-system/proc-macro", default-features = false }
cumulus-pallet-session-benchmarking = { path = "cumulus/pallets/session-benchmarking", default-features = false }
cumulus-pallet-solo-to-para = { path = "cumulus/pallets/solo-to-para", default-features = false }
+cumulus-pallet-weight-reclaim = { path = "cumulus/pallets/weight-reclaim", default-features = false }
cumulus-pallet-xcm = { path = "cumulus/pallets/xcm", default-features = false }
cumulus-pallet-xcmp-queue = { path = "cumulus/pallets/xcmp-queue", default-features = false }
cumulus-ping = { path = "cumulus/parachains/pallets/ping", default-features = false }
diff --git a/README.md b/README.md
index 6c0dfbb2e7e4..24352cc28a1a 100644
--- a/README.md
+++ b/README.md
@@ -40,9 +40,9 @@ curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/paritytec
![Current Stable Release](https://raw.githubusercontent.com/paritytech/release-registry/main/badges/polkadot-sdk-latest.svg) ![Next Stable Release](https://raw.githubusercontent.com/paritytech/release-registry/main/badges/polkadot-sdk-next.svg)
-The Polkadot SDK is released every three months as a `stableYYMMDD` release. They are supported for
+The Polkadot SDK is released every three months as a `stableYYMM` release. They are supported for
one year with patches. See the next upcoming versions in the [Release
-Registry](https://github.com/paritytech/release-registry/).
+Registry](https://github.com/paritytech/release-registry/) and more docs in [RELEASE.md](./docs/RELEASE.md).
You can use [`psvm`](https://github.com/paritytech/psvm) to update all dependencies to a specific
version without needing to manually select the correct version for each crate.
diff --git a/bridges/SECURITY.md b/bridges/SECURITY.md
index 9f215c887654..ea19eca42cc3 100644
--- a/bridges/SECURITY.md
+++ b/bridges/SECURITY.md
@@ -13,6 +13,6 @@ If you think that your report might be eligible for the Bug Bounty Program, plea
Please check up-to-date [Parity Bug Bounty Program rules](https://www.parity.io/bug-bounty) to find out the information
about our Bug Bounty Program.
-**Warning**: This is an unified SECURITY.md file for Paritytech GitHub Organization. The presence of this file does not
+**Warning**: This is a unified SECURITY.md file for Paritytech GitHub Organization. The presence of this file does not
mean that this repository is covered by the Bug Bounty program. Please always check the Bug Bounty Program scope for
information.
diff --git a/bridges/modules/messages/README.md b/bridges/modules/messages/README.md
index a78c86802498..7d9a23b4ba14 100644
--- a/bridges/modules/messages/README.md
+++ b/bridges/modules/messages/README.md
@@ -13,7 +13,7 @@ module and the final goal is to hand message to the message dispatch mechanism.
## Overview
-Message lane is an unidirectional channel, where messages are sent from source chain to the target chain. At the same
+Message lane is a unidirectional channel, where messages are sent from source chain to the target chain. At the same
time, a single instance of messages module supports both outbound lanes and inbound lanes. So the chain where the module
is deployed (this chain), may act as a source chain for outbound messages (heading to a bridged chain) and as a target
chain for inbound messages (coming from a bridged chain).
diff --git a/cumulus/client/consensus/aura/src/equivocation_import_queue.rs b/cumulus/client/consensus/aura/src/equivocation_import_queue.rs
index 68f2d37c8748..dbd9d5ba6a6f 100644
--- a/cumulus/client/consensus/aura/src/equivocation_import_queue.rs
+++ b/cumulus/client/consensus/aura/src/equivocation_import_queue.rs
@@ -97,6 +97,7 @@ where
// This is done for example when gap syncing and it is expected that the block after the gap
// was checked/chosen properly, e.g. by warp syncing to this block using a finality proof.
if block_params.state_action.skip_execution_checks() || block_params.with_state() {
+ block_params.fork_choice = Some(ForkChoiceStrategy::Custom(block_params.with_state()));
return Ok(block_params)
}
diff --git a/cumulus/docs/overview.md b/cumulus/docs/overview.md
index 402c56042c49..82603257a871 100644
--- a/cumulus/docs/overview.md
+++ b/cumulus/docs/overview.md
@@ -70,7 +70,7 @@ A Parachain validator needs to validate a given PoVBlock, but without requiring
the Parachain. To still make it possible to validate the Parachain block, the PoVBlock contains the
witness data. The witness data is a proof that is collected while building the block. The proof will
contain all trie nodes that are read during the block production. Cumulus uses the witness data to
-reconstruct a partial trie and uses this a storage when executing the block.
+reconstruct a partial trie and uses this as storage when executing the block.
The outgoing messages are also collected at block production. These are messages from the Parachain
the block is built for to other Parachains or to the relay chain itself.
diff --git a/cumulus/docs/release.md b/cumulus/docs/release.md
deleted file mode 100644
index 8302b7b9b7fc..000000000000
--- a/cumulus/docs/release.md
+++ /dev/null
@@ -1,135 +0,0 @@
-# Releases
-
-## Versioning
-
-### Example #1
-
-```
-| Polkadot | v 0. 9.22 |
-| Client | v 0. 9.22 0 |
-| Runtime | v 9 22 0 | => 9220
-| semver | 0. 9.22 0 |
-```
-
-### Example #2
-
-```
-| Polkadot | v 0.10.42 |
-| Client | v 0.10.42 0 |
-| Runtime | v 10.42 0 | => 10420
-| semver | 0.10.42 0 |
-```
-
-### Example #3
-
-```
-| Polkadot | v 1. 2.18 |
-| Client | v 1. 2.18 0 |
-| Runtime | v 1 2 18 0 | => 102180
-| semver | 1. 2.18 0 |
-```
-
-
-This document contains information related to the releasing process and describes a few of the steps and checks that are
-performed during the release process.
-
-## Client
-
-### Burn In
-
-Ensure that Parity DevOps has run the new release on Westend and Kusama Asset Hub collators for 12h prior to publishing
-the release.
-
-### Build Artifacts
-
-Add any necessary assets to the release. They should include:
-
-- Linux binaries
- - GPG signature
- - SHA256 checksum
-- WASM binaries of the runtimes
-- Source code
-
-
-## Runtimes
-
-### Spec Version
-
-A new runtime release must bump the `spec_version`. This may follow a pattern with the client release (e.g. runtime
-v9220 corresponds to v0.9.22).
-
-### Runtime version bump between RCs
-
-The clients need to be aware of runtime changes. However, we do not want to bump the `spec_version` for every single
-release candidate. Instead, we can bump the `impl` field of the version to signal the change to the client. This applies
-only to runtimes that have been deployed.
-
-### Old Migrations Removed
-
-Previous `on_runtime_upgrade` functions from old upgrades should be removed.
-
-### New Migrations
-
-Ensure that any migrations that are required due to storage or logic changes are included in the `on_runtime_upgrade`
-function of the appropriate pallets.
-
-### Extrinsic Ordering & Storage
-
-Offline signing libraries depend on a consistent ordering of call indices and functions. Compare the metadata of the
-current and new runtimes and ensure that the `module index, call index` tuples map to the same set of functions. It also
-checks if there have been any changes in `storage`. In case of a breaking change, increase `transaction_version`.
-
-To verify the order has not changed, manually start the following
-[Github Action](https://github.com/paritytech/polkadot-sdk/cumulus/.github/workflows/release-20_extrinsic-ordering-check-from-bin.yml).
-It takes around a minute to run and will produce the report as artifact you need to manually check.
-
-To run it, in the _Run Workflow_ dropdown:
-1. **Use workflow from**: to ignore, leave `master` as default
-2. **The WebSocket url of the reference node**: - Asset Hub Polkadot: `wss://statemint-rpc.polkadot.io`
- - Asset Hub Kusama: `wss://statemine-rpc.polkadot.io`
- - Asset Hub Westend: `wss://westmint-rpc.polkadot.io`
-3. **A url to a Linux binary for the node containing the runtime to test**: Paste the URL of the latest
- release-candidate binary from the draft-release on Github. The binary has to previously be uploaded to S3 (Github url
- link to the binary is constantly changing)
- - E.g: https://releases.parity.io/cumulus/v0.9.270-rc3/polkadot-parachain
-4. **The name of the chain under test. Usually, you would pass a local chain**: - Asset Hub Polkadot:
- `asset-hub-polkadot-local`
- - Asset Hub Kusama: `asset-hub-kusama-local`
- - Asset Hub Westend: `asset-hub-westend-local`
-5. Click **Run workflow**
-
-When the workflow is done, click on it and download the zip artifact, inside you'll find an `output.txt` file. The
-things to look for in the output are lines like:
-
-- `[Identity] idx 28 -> 25 (calls 15)` - indicates the index for Identity has changed
-- `[+] Society, Recovery` - indicates the new version includes 2 additional modules/pallets.
-- If no indices have changed, every modules line should look something like `[Identity] idx 25 (calls 15)`
-
-**Note**: Adding new functions to the runtime does not constitute a breaking change as long as the indexes did not
-change.
-
-**Note**: Extrinsic function signatures changes (adding/removing & ordering arguments) are not caught by the job, so
-those changes should be reviewed "manually"
-
-### Benchmarks
-
-The Benchmarks can now be started from the CI. First find the CI pipeline from
-[here](https://gitlab.parity.io/parity/mirrors/cumulus/-/pipelines?page=1&scope=all&ref=release-parachains-v9220) and
-pick the latest. [Guide](https://github.com/paritytech/ci_cd/wiki/Benchmarks:-cumulus)
-
-### Integration Tests
-
-Until https://github.com/paritytech/ci_cd/issues/499 is done, tests will have to be run manually.
-1. Go to https://github.com/paritytech/parachains-integration-tests and check out the release branch. E.g.
-https://github.com/paritytech/parachains-integration-tests/tree/release-v9270-v0.9.27 for `release-parachains-v0.9.270`
-2. Clone `release-parachains-` branch from Cumulus
-3. `cargo build --release`
-4. Copy `./target/polkadot-parachain` to `./bin`
-5. Clone `it/release--fast-sudo` from Polkadot In case the branch does not exists (it is a manual process):
- cherry pick `paritytech/polkadot@791c8b8` and run:
- `find . -type f -name "*.toml" -print0 | xargs -0 sed -i '' -e 's/polkadot-vX.X.X/polkadot-v/g'`
-6. `cargo build --release --features fast-runtime`
-7. Copy `./target/polkadot` into `./bin` (in Cumulus)
-8. Run the tests:
- - Asset Hub Polkadot: `yarn zombienet-test -c ./examples/statemint/config.toml -t ./examples/statemint`
- - Asset Hub Kusama: `yarn zombienet-test -c ./examples/statemine/config.toml -t ./examples/statemine`
diff --git a/cumulus/pallets/weight-reclaim/Cargo.toml b/cumulus/pallets/weight-reclaim/Cargo.toml
new file mode 100644
index 000000000000..8bde6abaff6a
--- /dev/null
+++ b/cumulus/pallets/weight-reclaim/Cargo.toml
@@ -0,0 +1,63 @@
+[package]
+name = "cumulus-pallet-weight-reclaim"
+version = "1.0.0"
+authors.workspace = true
+edition.workspace = true
+license = "Apache-2.0"
+homepage.workspace = true
+repository.workspace = true
+description = "pallet and transaction extensions for accurate proof size reclaim"
+
+[lints]
+workspace = true
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
+[dependencies]
+# Substrate dependencies
+sp-io = { workspace = true }
+sp-runtime = { workspace = true }
+sp-trie = { workspace = true }
+
+cumulus-primitives-storage-weight-reclaim = { workspace = true }
+frame-benchmarking = { optional = true, workspace = true }
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+
+# Other dependencies
+codec = { features = ["derive"], workspace = true }
+derivative = { features = ["use_core"], workspace = true }
+docify = { workspace = true }
+log = { workspace = true, default-features = true }
+scale-info = { features = ["derive"], workspace = true }
+
+[dev-dependencies]
+cumulus-primitives-proof-size-hostfunction = { workspace = true }
+
+[features]
+default = ["std"]
+std = [
+ "codec/std",
+ "cumulus-primitives-proof-size-hostfunction/std",
+ "cumulus-primitives-storage-weight-reclaim/std",
+ "frame-benchmarking?/std",
+ "frame-support/std",
+ "frame-system/std",
+ "log/std",
+ "scale-info/std",
+ "sp-io/std",
+ "sp-runtime/std",
+ "sp-trie/std",
+]
+runtime-benchmarks = [
+ "frame-benchmarking/runtime-benchmarks",
+ "frame-support/runtime-benchmarks",
+ "frame-system/runtime-benchmarks",
+ "sp-runtime/runtime-benchmarks",
+]
+try-runtime = [
+ "frame-support/try-runtime",
+ "frame-system/try-runtime",
+ "sp-runtime/try-runtime",
+]
diff --git a/cumulus/pallets/weight-reclaim/src/benchmarks.rs b/cumulus/pallets/weight-reclaim/src/benchmarks.rs
new file mode 100644
index 000000000000..78bebc967d96
--- /dev/null
+++ b/cumulus/pallets/weight-reclaim/src/benchmarks.rs
@@ -0,0 +1,71 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Cumulus.
+
+// Cumulus is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Cumulus is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Cumulus. If not, see .
+
+#![cfg(feature = "runtime-benchmarks")]
+
+use super::*;
+use frame_support::pallet_prelude::{DispatchClass, Pays};
+use frame_system::RawOrigin;
+use sp_runtime::traits::{AsTransactionAuthorizedOrigin, DispatchTransaction};
+
+#[frame_benchmarking::v2::benchmarks(
+ where T: Send + Sync,
+ ::RuntimeCall:
+ Dispatchable,
+ ::RuntimeOrigin: AsTransactionAuthorizedOrigin,
+)]
+mod bench {
+ use super::*;
+ use frame_benchmarking::impl_test_function;
+
+ #[benchmark]
+ fn storage_weight_reclaim() {
+ let ext = StorageWeightReclaim::::new(());
+
+ let origin = RawOrigin::Root.into();
+ let call = T::RuntimeCall::from(frame_system::Call::remark { remark: alloc::vec![] });
+
+ let overestimate = 10_000;
+ let info = DispatchInfo {
+ call_weight: Weight::zero().add_proof_size(overestimate),
+ extension_weight: Weight::zero(),
+ class: DispatchClass::Normal,
+ pays_fee: Pays::No,
+ };
+
+ let post_info = PostDispatchInfo { actual_weight: None, pays_fee: Pays::No };
+
+ let mut block_weight = frame_system::ConsumedWeight::default();
+ block_weight.accrue(Weight::from_parts(0, overestimate), info.class);
+
+ frame_system::BlockWeight::::put(block_weight);
+
+ #[block]
+ {
+ assert!(ext.test_run(origin, &call, &info, 0, 0, |_| Ok(post_info)).unwrap().is_ok());
+ }
+
+ let final_block_proof_size =
+ frame_system::BlockWeight::::get().get(info.class).proof_size();
+
+ assert!(
+ final_block_proof_size < overestimate,
+ "The proof size measured should be less than {overestimate}"
+ );
+ }
+
+ impl_benchmark_test_suite!(Pallet, crate::tests::setup_test_ext_default(), crate::tests::Test);
+}
diff --git a/cumulus/pallets/weight-reclaim/src/lib.rs b/cumulus/pallets/weight-reclaim/src/lib.rs
new file mode 100644
index 000000000000..bd9929033af1
--- /dev/null
+++ b/cumulus/pallets/weight-reclaim/src/lib.rs
@@ -0,0 +1,311 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Cumulus.
+
+// Cumulus is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Cumulus is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Cumulus. If not, see .
+
+//! Pallet and transaction extensions to reclaim PoV proof size weight after an extrinsic has been
+//! applied.
+//!
+//! This crate provides:
+//! * [`StorageWeightReclaim`] transaction extension: it must wrap the whole transaction extension
+//! pipeline.
+//! * The pallet required for the transaction extensions weight information and benchmarks.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+extern crate alloc;
+#[cfg(not(feature = "std"))]
+use alloc::vec::Vec;
+use codec::{Decode, Encode};
+use cumulus_primitives_storage_weight_reclaim::get_proof_size;
+use derivative::Derivative;
+use frame_support::{
+ dispatch::{DispatchInfo, PostDispatchInfo},
+ pallet_prelude::Weight,
+ traits::Defensive,
+};
+use scale_info::TypeInfo;
+use sp_runtime::{
+ traits::{DispatchInfoOf, Dispatchable, Implication, PostDispatchInfoOf, TransactionExtension},
+ transaction_validity::{TransactionSource, TransactionValidityError, ValidTransaction},
+ DispatchResult,
+};
+
+#[cfg(feature = "runtime-benchmarks")]
+pub mod benchmarks;
+#[cfg(test)]
+mod tests;
+mod weights;
+
+pub use pallet::*;
+pub use weights::WeightInfo;
+
+const LOG_TARGET: &'static str = "runtime::storage_reclaim_pallet";
+
+/// Pallet to use alongside the transaction extension [`StorageWeightReclaim`], the pallet provides
+/// weight information and benchmarks.
+#[frame_support::pallet]
+pub mod pallet {
+ use super::*;
+
+ #[pallet::pallet]
+ pub struct Pallet(_);
+
+ #[pallet::config]
+ pub trait Config: frame_system::Config {
+ type WeightInfo: WeightInfo;
+ }
+}
+
+/// Storage weight reclaim mechanism.
+///
+/// This extension must wrap all the transaction extensions:
+#[doc = docify::embed!("./src/tests.rs", Tx)]
+///
+/// This extension checks the size of the node-side storage proof before and after executing a given
+/// extrinsic using the proof size host function. The difference between benchmarked and used weight
+/// is reclaimed.
+///
+/// If the benchmark was underestimating the proof size, then it is added to the block weight.
+///
+/// For the time part of the weight, it does same as system `WeightReclaim` extension, it
+/// calculates the unused weight using the post information and reclaim the unused weight.
+/// So this extension can be used as a drop-in replacement for `WeightReclaim` extension for
+/// parachains.
+#[derive(Encode, Decode, TypeInfo, Derivative)]
+#[derivative(
+ Clone(bound = "S: Clone"),
+ Eq(bound = "S: Eq"),
+ PartialEq(bound = "S: PartialEq"),
+ Default(bound = "S: Default")
+)]
+#[scale_info(skip_type_params(T))]
+pub struct StorageWeightReclaim(pub S, core::marker::PhantomData);
+
+impl StorageWeightReclaim {
+ /// Create a new `StorageWeightReclaim` instance.
+ pub fn new(s: S) -> Self {
+ Self(s, Default::default())
+ }
+}
+
+impl From for StorageWeightReclaim {
+ fn from(s: S) -> Self {
+ Self::new(s)
+ }
+}
+
+impl core::fmt::Debug for StorageWeightReclaim {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
+ #[cfg(feature = "std")]
+ let _ = write!(f, "StorageWeightReclaim<{:?}>", self.0);
+
+ #[cfg(not(feature = "std"))]
+ let _ = write!(f, "StorageWeightReclaim");
+
+ Ok(())
+ }
+}
+
+impl>
+ TransactionExtension for StorageWeightReclaim
+where
+ T::RuntimeCall: Dispatchable,
+{
+ const IDENTIFIER: &'static str = "StorageWeightReclaim