Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Take into account size as well in weight limiting. #7369

Merged
merged 24 commits into from
Aug 1, 2023

Conversation

eskimor
Copy link
Member

@eskimor eskimor commented Jun 14, 2023

To avoid oversized blocks as well. We already have weight limiting in place, by using the proof_size component of weight to track block usage we can use all the existing logic to limit the size of the block equally as time weights.

Also get rid of randomized selection in provisioner as all production chains already support prioritized selection. This simplifies the runtime code a bit and is no longer properly supported as of the code unification (enter/create_inherent) PR.

  • Tests
  • Run benchmarks
  • Sanity check weights

@eskimor eskimor added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Jun 14, 2023
@eskimor
Copy link
Member Author

eskimor commented Jun 28, 2023

bot bench $ runtime polkadot runtime_parachains::paras_inherent
bot bench $ runtime westend runtime_parachains::paras_inherent
bot bench $ runtime rococo runtime_parachains::paras_inherent
bot bench $ runtime kusama runtime_parachains::paras_inherent

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088040 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 1-af05bab2-000e-41d7-9171-2ceb31ddc5d0 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088041 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 2-5294ff2b-c257-4417-bfb8-3ca9bc8a40b4 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088044 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 3-197b9ad5-1bc3-4c3c-b2ad-a70512112c7b to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088045 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime kusama runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 4-fc417baa-2540-4ab9-b785-9c7c78bd60ab to cancel this command or bot cancel to cancel all commands in this pull request.

@eskimor eskimor requested review from tdimitrov and slumber June 28, 2023 17:11
@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088044 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088044/artifacts/download.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime kusama runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088045 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088045/artifacts/download.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088041 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088041/artifacts/download.

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088040 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3088040/artifacts/download.

@eskimor
Copy link
Member Author

eskimor commented Jun 28, 2023

bot bench $ runtime polkadot runtime_parachains::paras_inherent
bot bench $ runtime westend runtime_parachains::paras_inherent
bot bench $ runtime rococo runtime_parachains::paras_inherent

@command-bot
Copy link

command-bot bot commented Jun 28, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3089256 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 5-87388d61-fede-4d46-95c5-1d44ee68b169 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3089256 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3089256/artifacts/download.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3089257 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3089257/artifacts/download.

@eskimor
Copy link
Member Author

eskimor commented Jun 29, 2023

bot bench $ runtime westend runtime_parachains::paras_inherent
bot bench $ runtime rococo runtime_parachains::paras_inherent

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090231 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 8-1fbfca47-7f1b-4972-8718-77964bdec9e5 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090232 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 9-8a51bf3c-363e-4a64-b735-2d62f1c68bc6 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090232 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090232/artifacts/download.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090231 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3090231/artifacts/download.

@eskimor
Copy link
Member Author

eskimor commented Jun 29, 2023

bot bench $ runtime rococo runtime_parachains::paras_inherent

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3091553 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent. Check out https://gitlab.parity.io/parity/mirrors/polkadot/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 10-e361ab08-e661-4a8d-9617-ba9e090db8ae to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 29, 2023

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" runtime rococo runtime_parachains::paras_inherent has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3091553 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3091553/artifacts/download.

Copy link
Contributor

@slumber slumber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean PR, thanks!

@tdimitrov
Copy link
Contributor

tdimitrov commented Jul 13, 2023

I did a burn in today. Runtime version: 0.9.41-e2eddbecf7a

Before running disputes (new images were fully deployed around 14:00 UTC):
without_disputes

After enabling disputes:
image

Additionally I saw a spike in relay chain block times:
Screenshot from 2023-07-13 21-02-26

And a finality lag around 60 blocks:
Screenshot from 2023-07-13 21-02-14

Also I noticed some errors in the logs:

15:12:24.721 ERROR tokio-runtime-worker parachain::candidate-backing: Failed to validate and make available: ValidationFailed(ValidationFailed("Check Validation Outputs: Bad request"))

I'm not sure if they are related to the test or to the past runtime upgrades.

EDIT: The results above are without updating the runtime.

@tdimitrov
Copy link
Contributor

tdimitrov commented Jul 17, 2023

I've discussed the results with @ordian and @sandreim and understood that my expectations are not correct. Bigger block times and finality lag is expected during disputes and the values above are acceptable.

I ran another test today. What I did:

  • Deployed master and enabled disputes to get some baseline results.
  • Disabled disputes to make sure the network recovers ✔️
  • Reenabled disputes again and deployed this PR - no significant change in the results.
  • Performed runtime upgrade with a binary from this PR - again no significant change in results.
  • Disabled disputes to make sure the network recovers ✔️

The results:
image
image
image
image
image
image

Some timestamps (times are in UTC on Jul 17th):

  • 07:45 - initiated disputes with master deployed
  • 10:30 - PR deployed on all nodes
  • 11:27 - Disputes stopped to check recovery
  • 11:45 - Network fully recovered
  • 11:53 - Enabled disputes again
  • 12:33 - Runtime upgrade
  • 13:15 - Disputes stopped (and network recovered)

There are some outliers in terms of block import times but the node count is not too much - 2 to 6 nodes most of the time, one slot with around 50 nodes.

I think it's safe to merge.

@eskimor
Copy link
Member Author

eskimor commented Aug 1, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit ff5f602 into master Aug 1, 2023
@paritytech-processbot paritytech-processbot bot deleted the rk-weight-size branch August 1, 2023 12:43
s0me0ne-unkn0wn pushed a commit that referenced this pull request Aug 15, 2023
* Take into account size as well in weight limiting.

* Fix logging.

* More logs.

* Remove randomized selection in provisioner

No longer supported by runtime.

* Fix and simplify weight calculation.

Random filtering of remote disputes got dropped.

* Make existing tests pass.

* Tests for size limiting.

* Fix provisioner.

* Remove rand dependency.

* Better default block length for tests.

* ".git/.scripts/commands/bench/bench.sh" runtime kusama runtime_parachains::paras_inherent

* ".git/.scripts/commands/bench/bench.sh" runtime polkadot runtime_parachains::paras_inherent

* ".git/.scripts/commands/bench/bench.sh" runtime westend runtime_parachains::paras_inherent

* Update runtime/parachains/src/paras_inherent/mod.rs

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>

* Update runtime/parachains/src/paras_inherent/mod.rs

Co-authored-by: Chris Sosnin <48099298+slumber@users.noreply.github.com>

* Add back missing line.

* Fix test.

* fmt fix.

* Add missing test annotation

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: command-bot <>
Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
Co-authored-by: Chris Sosnin <48099298+slumber@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants