Skip to content

Commit

Permalink
Apply patch for a parachains inclusion pallet benchmarks (#567)
Browse files Browse the repository at this point in the history
## Description

Addressing @ordian's
[comment](#522 (review)):
> Previously, the weight of `enact_candidate` was included in the weight
of availability bitfields, but this was a bug, because the number of
bitfields depends on number of validators, whereas number of enacted
candidates depends on the number of cores. This was later (accidentally)
fixed, but the `enact_candidate` weight was unaccounted for.
[paritytech/polkadot-sdk#5270](paritytech/polkadot-sdk#5270)
was supposed to fix that.
> 
> The base weight of `enact_candidate` still looks excessive and it was
fixed in
[paritytech/polkadot-sdk#5526](paritytech/polkadot-sdk#5526),
but looks like it didn't make into the same release.
> 
> That being said, even with 1.5ms of enactment weight per candidate,
this shouldn't be a blocker to scale to 200 parachains weight-wise. So
I'm fine with having these excessive weights for now.

Addressing @bkontur's
[comment](#522 (comment)):
> @ordian The next patch, **stable2409-4**, is planned for this week. I
have backported your fix here:
[paritytech/polkadot-sdk#7145](paritytech/polkadot-sdk#7145).
Once it is released, I will re-run the benchmarks for this within
another PR.


## Weights diff

### Kusama

`--method asymptotic` does not work:
```
subweight compare commits          --path-pattern "./relay/kusama/**/weights/**/*.rs"          --format markdown --no-color           --change added changed          --method asymptotic --ignore-errors --strip-path-prefix="relay/kusama/src/weights/"          remotes/polkadot-fellows/main          origin/bko-patch-parachains-inclusion
```
| File | Extrinsic | Old | New | Change [%] |

|---------------------------------|-----------------|-----|-----|------------|
| runtime_parachains_inclusion.rs | enact_candidate | - | - | ERROR |

but `--method base` works:
```
subweight compare commits          --path-pattern "./relay/kusama/**/weights/**/*.rs"          --format markdown --no-color           --change added changed          --method base --ignore-errors --strip-path-prefix="relay/kusama/src/weights/"          remotes/polkadot-fellows/main          origin/bko-patch-parachains-inclusion
```
| File | Extrinsic | Old | New | Change [%] |

|---------------------------------|-----------------|--------|----------|------------|
| runtime_parachains_inclusion.rs | enact_candidate | 2.97ms | 939.10us
| -68.35 |

### Polkadot

`--method asymptotic` does not work:
```
subweight compare commits          --path-pattern "./relay/polkadot/**/weights/**/*.rs"          --format markdown --no-color           --change added changed          --method asymptotic --ignore-errors --strip-path-prefix="relay/polkadot/src/weights/"          remotes/polkadot-fellows/main          origin/bko-patch-parachains-inclusion
```
| File | Extrinsic | Old | New | Change [%] |

|---------------------------------|-----------------|-----|-----|------------|
| runtime_parachains_inclusion.rs | enact_candidate | - | - | ERROR |

but `--method base` works:
```
subweight compare commits          --path-pattern "./relay/polkadot/**/weights/**/*.rs"          --format markdown --no-color           --change added changed          --method base --ignore-errors --strip-path-prefix="relay/polkadot/src/weights/"          remotes/polkadot-fellows/main          origin/bko-patch-parachains-inclusion
```
| File | Extrinsic | Old | New | Change [%] |

|---------------------------------|-----------------|--------|----------|------------|
| runtime_parachains_inclusion.rs | enact_candidate | 2.92ms | 974.24us
| -66.60 |


<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [X] Does not require a CHANGELOG entry

---------

Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
  • Loading branch information
bkontur and fellowship-merge-bot[bot] authored Jan 30, 2025
1 parent 9223c43 commit ffc67cb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 51 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ polkadot-system-emulated-network = { path = "integration-tests/emulated/networks
primitive-types = { version = "0.12.2", default-features = false }
frame-metadata-hash-extension = { version = "0.6.0", default-features = false }
remote-externalities = { version = "0.46.0", package = "frame-remote-externalities" }
runtime-parachains = { version = "17.0.1", default-features = false, package = "polkadot-runtime-parachains" }
runtime-parachains = { version = "17.0.2", default-features = false, package = "polkadot-runtime-parachains" }
sc-chain-spec = { version = "38.0.0" }
sc-network = { version = "0.45.1" }
scale-info = { version = "2.10.0", default-features = false }
Expand Down
52 changes: 28 additions & 24 deletions relay/kusama/src/weights/runtime_parachains_inclusion.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 28 additions & 24 deletions relay/polkadot/src/weights/runtime_parachains_inclusion.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ffc67cb

Please sign in to comment.