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

Make wasm runtimes compile with benchmarks enabled #4303

Merged

Conversation

emostov
Copy link
Contributor

@emostov emostov commented Nov 16, 2021

No description provided.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Nov 16, 2021
@emostov
Copy link
Contributor Author

emostov commented Nov 16, 2021

/benchmark runtime kusama runtime_parachains::paras_inherent

@parity-benchapp
Copy link

parity-benchapp bot commented Nov 16, 2021

Benchmark Runtime Kusama Pallet for branch "zeke-bernhard-inherent-filtering-debug-2" with command cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs

Results
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
   --> runtime/parachains/src/builder.rs:301:5
    |
301 |             &Digest::<T::Hash> { logs: Vec::new() },
    |              ^^^^^^----------- help: remove these generics
    |              |
    |              expected 0 generic arguments
    |
note: struct defined here, with 0 generic parameters
   --> /home/benchbot/.cargo/git/checkouts/substrate-7e08433d4c370a21/c087bbe/primitives/runtime/src/generic/digest.rs:38:12
    |
38  | pub struct Digest {
    |            ^^^^^^

For more information about this error, try `rustc --explain E0107`.
error: could not compile `polkadot-runtime-parachains` due to previous error
error: build failed

ERROR: Unable to commit file ./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs

@emostov
Copy link
Contributor Author

emostov commented Nov 16, 2021

/benchmark runtime kusama runtime_parachains::paras_inherent

@parity-benchapp
Copy link

parity-benchapp bot commented Nov 16, 2021

Benchmark Runtime Kusama Pallet for branch "zeke-bernhard-inherent-filtering-debug-2" with command cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs

Results
Pallet: "runtime_parachains::paras_inherent", Extrinsic: "enter_variable_disputes", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: ParaInherent Included (r:1 w:1)
Storage: System ParentHash (r:1 w:0)
Storage: ParaScheduler AvailabilityCores (r:1 w:1)
Storage: ParasShared CurrentSessionIndex (r:1 w:0)
Storage: ParaInclusion PendingAvailability (r:2 w:1)
Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
Storage: Paras Parachains (r:1 w:0)
Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
Storage: Configuration ActiveConfig (r:1 w:0)
Storage: Session Validators (r:1 w:0)
Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
Storage: Staking ActiveEra (r:1 w:0)
Storage: Staking ErasRewardPoints (r:1 w:1)
Storage: Dmp DownwardMessageQueues (r:1 w:1)
Storage: Hrmp HrmpChannelDigests (r:1 w:1)
Storage: Paras FutureCodeUpgrades (r:1 w:0)
Storage: ParaScheduler SessionStartBlock (r:1 w:0)
Storage: ParaScheduler ParathreadQueue (r:1 w:1)
Storage: ParaScheduler Scheduled (r:1 w:1)
Storage: ParaScheduler ValidatorGroups (r:1 w:0)
Storage: Ump NeedsDispatch (r:1 w:1)
Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
Storage: ParaInherent OnChainVotes (r:0 w:1)
Storage: Hrmp HrmpWatermarks (r:0 w:1)
Storage: Paras Heads (r:0 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    202.5
    + v    0.307
              µs

Reads = 23 + (0 * v)
Writes = 14 + (0 * v)

Min Squares Analysis
========
-- Extrinsic Time --

Data points distribution:
    v   mean µs  sigma µs       %
   10     206.5     3.786    1.8%
   13     207.6     1.921    0.9%
   16       212     7.089    3.3%
   19     208.2     1.942    0.9%
   22     208.5     3.448    1.6%
   25       210     0.948    0.4%
   28     212.4     4.096    1.9%
   31     214.1     3.507    1.6%
   34     213.4     3.196    1.4%
   37     219.7     6.683    3.0%
   40     216.7     3.381    1.5%
   43     216.4     2.895    1.3%
   46     218.9     4.118    1.8%
   49     217.3      4.26    1.9%
   52     220.4     4.149    1.8%
   55     220.1     3.269    1.4%
   58     222.7     3.153    1.4%
   61     221.7     1.911    0.8%
   64     223.5     3.898    1.7%
   67     226.3     6.182    2.7%
   70     228.9     5.722    2.4%
   73     229.5      3.95    1.7%
   76     230.3     4.958    2.1%
   79     228.7       2.9    1.2%
   82     229.6     2.345    1.0%
   85     229.9     2.127    0.9%
   88     229.4      2.46    1.0%
   91     228.9     1.291    0.5%
   94     231.5     3.211    1.3%
   97     231.8     3.594    1.5%
  100     232.4      2.36    1.0%
  103     233.2     3.214    1.3%
  106     233.3      1.31    0.5%
  109     234.7     2.157    0.9%
  112     233.9      1.15    0.4%
  115     236.4     2.742    1.1%
  118     240.1     4.181    1.7%
  121     237.7     1.438    0.6%
  124     238.9     2.087    0.8%
  127     239.4     1.248    0.5%
  130     243.4     2.336    0.9%
  133     242.4     3.431    1.4%
  136     242.7     1.997    0.8%
  139     246.2     2.917    1.1%
  142     248.8     3.623    1.4%
  145     248.6     2.375    0.9%
  148     255.1     4.664    1.8%
  151     252.4     1.941    0.7%
  154     252.7      1.76    0.6%
  157     253.7      3.45    1.3%
  160     256.5     3.309    1.2%
  163     256.6     3.728    1.4%
  166     255.1     2.236    0.8%
  169     256.2      2.26    0.8%
  172     259.4     2.102    0.8%
  175     257.3     2.221    0.8%
  178       257     2.873    1.1%
  181     256.6     1.541    0.6%
  184     258.2     1.057    0.4%
  187     259.7     3.688    1.4%
  190       261     1.837    0.7%
  193       270     8.037    2.9%
  196     263.4      3.16    1.1%
  199     262.4     2.845    1.0%

Quality and confidence:
param     error
v         0.002

Model:
Time ~=    203.8
    + v    0.306
              µs

Reads = 23 + (0 * v)
Writes = 14 + (0 * v)

Pallet: "runtime_parachains::paras_inherent", Extrinsic: "enter_bitfields", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: ParaInherent Included (r:1 w:1)
Storage: System ParentHash (r:1 w:0)
Storage: ParaScheduler AvailabilityCores (r:1 w:1)
Storage: ParasShared CurrentSessionIndex (r:1 w:0)
Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
Storage: Paras Parachains (r:1 w:0)
Storage: ParaInclusion PendingAvailability (r:2 w:1)
Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
Storage: Configuration ActiveConfig (r:1 w:0)
Storage: Session Validators (r:1 w:0)
Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
Storage: Staking ActiveEra (r:1 w:0)
Storage: Staking ErasRewardPoints (r:1 w:1)
Storage: Dmp DownwardMessageQueues (r:1 w:1)
Storage: Hrmp HrmpChannelDigests (r:1 w:1)
Storage: Paras FutureCodeUpgrades (r:1 w:0)
Storage: ParaScheduler SessionStartBlock (r:1 w:0)
Storage: ParaScheduler ParathreadQueue (r:1 w:1)
Storage: ParaScheduler Scheduled (r:1 w:1)
Storage: ParaScheduler ValidatorGroups (r:1 w:0)
Storage: Ump NeedsDispatch (r:1 w:1)
Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
Storage: ParaInclusion AvailabilityBitfields (r:0 w:1)
Storage: ParaInherent OnChainVotes (r:0 w:1)
Storage: Hrmp HrmpWatermarks (r:0 w:1)
Storage: Paras Heads (r:0 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    247.3
              µs

Reads = 23
Writes = 15

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    247.3
              µs

Reads = 23
Writes = 15

Pallet: "runtime_parachains::paras_inherent", Extrinsic: "enter_backed_candidates_variable", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: ParaInherent Included (r:1 w:1)
Storage: System ParentHash (r:1 w:0)
Storage: ParaScheduler AvailabilityCores (r:1 w:1)
Storage: ParasShared CurrentSessionIndex (r:1 w:0)
Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
Storage: Paras Parachains (r:1 w:0)
Storage: ParaInclusion PendingAvailability (r:2 w:1)
Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
Storage: Configuration ActiveConfig (r:1 w:0)
Storage: Session Validators (r:1 w:0)
Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
Storage: Staking ActiveEra (r:1 w:0)
Storage: Staking ErasRewardPoints (r:1 w:1)
Storage: Dmp DownwardMessageQueues (r:1 w:1)
Storage: Hrmp HrmpChannelDigests (r:1 w:1)
Storage: Paras FutureCodeUpgrades (r:1 w:0)
Storage: ParaScheduler SessionStartBlock (r:1 w:0)
Storage: ParaScheduler ParathreadQueue (r:1 w:1)
Storage: ParaScheduler Scheduled (r:1 w:1)
Storage: ParaScheduler ValidatorGroups (r:1 w:0)
Storage: Paras PastCodeMeta (r:1 w:0)
Storage: Paras CurrentCodeHash (r:1 w:0)
Storage: Ump RelayDispatchQueueSize (r:1 w:0)
Storage: Ump NeedsDispatch (r:1 w:1)
Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
Storage: ParaInherent OnChainVotes (r:0 w:1)
Storage: Hrmp HrmpWatermarks (r:0 w:1)
Storage: Paras Heads (r:0 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    315.4
    + v    49.03
              µs

Reads = 26 + (0 * v)
Writes = 14 + (0 * v)

Min Squares Analysis
========
-- Extrinsic Time --

Data points distribution:
    v   mean µs  sigma µs       %
  101      5275      18.6    0.3%
  102      5324     15.82    0.2%
  103      5356     18.43    0.3%
  104      5424     12.37    0.2%
  105      5478     8.859    0.1%
  106      5531     15.01    0.2%
  107      5566     15.66    0.2%
  108      5610     11.79    0.2%
  109      5661     12.33    0.2%
  110      5712     18.09    0.3%
  111      5770     21.31    0.3%
  112      5807     14.62    0.2%
  113      5851     14.72    0.2%
  114      5911     15.62    0.2%
  115      5952      12.6    0.2%
  116      6000     14.52    0.2%
  117      6056      14.3    0.2%
  118      6121     16.87    0.2%
  119      6167     19.43    0.3%
  120      6197     24.31    0.3%
  121      6251     18.76    0.3%
  122      6295     13.19    0.2%
  123      6338     13.37    0.2%
  124      6391     11.71    0.1%
  125      6432     5.228    0.0%
  126      6476     6.334    0.0%
  127      6546        19    0.2%
  128      6585     14.54    0.2%
  129      6641     11.71    0.1%
  130      6697     11.36    0.1%
  131      6732     11.98    0.1%
  132      6779     12.99    0.1%
  133      6827     8.461    0.1%
  134      6891     12.71    0.1%
  135      6932     13.21    0.1%
  136      6985     9.774    0.1%
  137      7028     17.37    0.2%
  138      7096     19.97    0.2%
  139      7127     13.48    0.1%
  140      7188     13.82    0.1%
  141      7224     13.34    0.1%
  142      7272     10.39    0.1%
  143      7322     11.36    0.1%
  144      7381     15.48    0.2%
  145      7425     21.67    0.2%
  146      7480     9.371    0.1%
  147      7525     15.25    0.2%
  148      7600     37.12    0.4%
  149      7613     10.85    0.1%
  150      7734     32.16    0.4%
  151      7717     19.42    0.2%
  152      7765      11.5    0.1%
  153      7830     23.88    0.3%
  154      7867     16.13    0.2%
  155      7917     7.894    0.0%
  156      7980     16.58    0.2%
  157      8010     15.39    0.1%
  158      8069     8.005    0.0%
  159      8114     17.24    0.2%
  160      8187     29.31    0.3%
  161      8221     18.17    0.2%
  162      8263     16.79    0.2%
  163      8314     13.65    0.1%
  164      8367     14.15    0.1%
  165      8403     10.75    0.1%
  166      8454     18.56    0.2%
  167      8518     18.18    0.2%
  168      8543     20.99    0.2%
  169      8646     28.23    0.3%
  170      8643     7.429    0.0%
  171      8723     29.98    0.3%
  172      8759     24.48    0.2%
  173      8795     16.83    0.1%
  174      8851     30.62    0.3%
  175      8883     15.48    0.1%
  176      8933     18.29    0.2%
  177      8996     11.01    0.1%
  178      9054      16.7    0.1%
  179      9112     22.23    0.2%
  180      9136     13.01    0.1%
  181      9189     14.38    0.1%
  182      9242     17.05    0.1%
  183      9304     23.33    0.2%
  184      9326     13.55    0.1%
  185      9391      24.6    0.2%
  186      9434     19.51    0.2%
  187      9488     36.78    0.3%
  188      9542     24.84    0.2%
  189      9569     17.77    0.1%
  190      9636     12.19    0.1%
  191      9683     23.92    0.2%
  192      9738     31.32    0.3%
  193      9801     15.01    0.1%
  194      9821     19.17    0.1%
  195      9858      12.1    0.1%
  196      9924     23.26    0.2%
  197      9982     21.64    0.2%
  198     10030     18.81    0.1%
  199     10080     27.21    0.2%
  200     10130      25.7    0.2%

Quality and confidence:
param     error
v         0.023

Model:
Time ~=    314.5
    + v    49.06
              µs

Reads = 26 + (0 * v)
Writes = 14 + (0 * v)

Pallet: "runtime_parachains::paras_inherent", Extrinsic: "enter_backed_candidate_code_upgrade", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info
========
Storage: ParaInherent Included (r:1 w:1)
Storage: System ParentHash (r:1 w:0)
Storage: ParaScheduler AvailabilityCores (r:1 w:1)
Storage: ParasShared CurrentSessionIndex (r:1 w:0)
Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
Storage: Paras Parachains (r:1 w:0)
Storage: ParaInclusion PendingAvailability (r:2 w:1)
Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
Storage: Configuration ActiveConfig (r:1 w:0)
Storage: Session Validators (r:1 w:0)
Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
Storage: Staking ActiveEra (r:1 w:0)
Storage: Staking ErasRewardPoints (r:1 w:1)
Storage: Dmp DownwardMessageQueues (r:1 w:1)
Storage: Hrmp HrmpChannelDigests (r:1 w:1)
Storage: Paras FutureCodeUpgrades (r:1 w:0)
Storage: ParaScheduler SessionStartBlock (r:1 w:0)
Storage: ParaScheduler ParathreadQueue (r:1 w:1)
Storage: ParaScheduler Scheduled (r:1 w:1)
Storage: ParaScheduler ValidatorGroups (r:1 w:0)
Storage: Paras PastCodeMeta (r:1 w:0)
Storage: Paras CurrentCodeHash (r:1 w:0)
Storage: Ump RelayDispatchQueueSize (r:1 w:0)
Storage: Ump NeedsDispatch (r:1 w:1)
Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
Storage: ParaInherent OnChainVotes (r:0 w:1)
Storage: Hrmp HrmpWatermarks (r:0 w:1)
Storage: Paras Heads (r:0 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    41740
              µs

Reads = 26
Writes = 14

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    41740
              µs

Reads = 26
Writes = 14


@emostov emostov added 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. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. labels Nov 16, 2021
@emostov emostov merged commit 9e7eed5 into bernhard-inherent-filtering Nov 16, 2021
@emostov emostov deleted the zeke-bernhard-inherent-filtering-debug-2 branch November 16, 2021 17:45
paritytech-processbot bot pushed a commit that referenced this pull request Nov 16, 2021
* move things around, add filter methods��

* validator keys, modify availability bitfields according to disputes

* simplify, keep the filter -> sanitize generic for both usecases

* minor

* assure tests still work, reduce changeset

* integration

* start entropy passing

* fixins

* compile, 1 failing test

* filter with coverage

* fixins

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* slip of the pen

* improve test cases

* misc

* fix

* fixins

* test avoid extra into() calls in assert_noop!

* chores

* ff

* test fixup superfluous into call

* chore: pfmt

* improve apply_block_weight_limit to try to maximize the number of sufficiently backed

blocks and add extra bitfields in a round-robin fashion

* new code treats the lack of backed candidates as ok

* Use vrf based entropy

* fixup vrf random

* add warn

* slip of the pen

* fixup

* assure ordering

* rethink apply_weights

* mock

* use a closure as predicate check

* extract and use DisputedBitfield

* chore: simplify

* remove stray dbg

* chore: fmt

* address feedback

* fix test, halfway there

* stage1

* dbg stuff

* make group selection align

* fix session index

* fix wrongly returned candidates

* cleanup

* chore fmt

* fix ensure check

* make good case test work

* more tests for bitfields

* create sanitize_backed_candidates

* fixup tests

* update guide

* add check referenced in the guide

* improve weights code

* fmt

* fixins

* Update roadmap/implementers-guide/src/runtime/inclusion.md

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* compiling + address review

* add comments

* fix weight calc

* address review comments and test failure

* fix

* fix: condition

* Fix random_sel function

* Fix overlength block check

* Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests

* Add benchmarks for code upgrades

* Code upgrade bench; Feature gate TestWeightInfo

* Try and make CI happier

* Feature gate enter test to not(benchmarks)

* Make sure no unused imports/fn

* refactor, re-use, the beginning

* Fix issue with frame benchmarking dep compilation

* More precise feature gating for some derives

* integrate piece-wise

* foo

* fixins

* chore fmt

* fixins

* rename const generic

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix compilation

* limit to test

* remove unused spam slots

* spellcheck

* remove a tick, fix a typo

* Add Code upgrade weights

* comment improvements + >=

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove another tick

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

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* saturating fixins + some spaces

* fix

* benchmarking - preliminary results

* Add training wheels

* Refactor some early exit logic for enter

* Gracefully handle filtering bitfields & candidates (#4280)

This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items.

* Refactor inherent data weight limiting logic (#4287)

* Apply suggestions from code review

* Update runtime/parachains/src/builder.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update runtime/parachains/src/builder.rs

* Update runtime/parachains/src/paras_inherent.rs

* final pass

* Run cargo +nightly-2021-10-29 fmt

* Update implementors guide with `sanitize_*` & `enter` (#4294)

* Make spell check happier

* Make wasm runtimes compile with benchmarks enabled (#4303)

* comment stuff out, use old toml

* Seems to be working?

* Remove feature gating from builder

* Remove commented out stuff

* Remove generic from digest

* Update weight files for runtime

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
drahnr added a commit that referenced this pull request Nov 26, 2021
* move things around, add filter methods��

* validator keys, modify availability bitfields according to disputes

* simplify, keep the filter -> sanitize generic for both usecases

* minor

* assure tests still work, reduce changeset

* integration

* start entropy passing

* fixins

* compile, 1 failing test

* filter with coverage

* fixins

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* slip of the pen

* improve test cases

* misc

* fix

* fixins

* test avoid extra into() calls in assert_noop!

* chores

* ff

* test fixup superfluous into call

* chore: pfmt

* improve apply_block_weight_limit to try to maximize the number of sufficiently backed

blocks and add extra bitfields in a round-robin fashion

* new code treats the lack of backed candidates as ok

* Use vrf based entropy

* fixup vrf random

* add warn

* slip of the pen

* fixup

* assure ordering

* rethink apply_weights

* mock

* use a closure as predicate check

* extract and use DisputedBitfield

* chore: simplify

* remove stray dbg

* chore: fmt

* address feedback

* fix test, halfway there

* stage1

* dbg stuff

* make group selection align

* fix session index

* fix wrongly returned candidates

* cleanup

* chore fmt

* fix ensure check

* make good case test work

* more tests for bitfields

* create sanitize_backed_candidates

* fixup tests

* update guide

* add check referenced in the guide

* improve weights code

* fmt

* fixins

* Update roadmap/implementers-guide/src/runtime/inclusion.md

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* compiling + address review

* add comments

* fix weight calc

* address review comments and test failure

* fix

* fix: condition

* Fix random_sel function

* Fix overlength block check

* Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests

* Add benchmarks for code upgrades

* Code upgrade bench; Feature gate TestWeightInfo

* Try and make CI happier

* Feature gate enter test to not(benchmarks)

* Make sure no unused imports/fn

* refactor, re-use, the beginning

* Fix issue with frame benchmarking dep compilation

* More precise feature gating for some derives

* integrate piece-wise

* foo

* fixins

* chore fmt

* fixins

* rename const generic

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix compilation

* limit to test

* remove unused spam slots

* spellcheck

* remove a tick, fix a typo

* Add Code upgrade weights

* comment improvements + >=

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove another tick

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

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* saturating fixins + some spaces

* fix

* benchmarking - preliminary results

* Add training wheels

* Refactor some early exit logic for enter

* Gracefully handle filtering bitfields & candidates (#4280)

This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items.

* Refactor inherent data weight limiting logic (#4287)

* Apply suggestions from code review

* Update runtime/parachains/src/builder.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update runtime/parachains/src/builder.rs

* Update runtime/parachains/src/paras_inherent.rs

* final pass

* Run cargo +nightly-2021-10-29 fmt

* Update implementors guide with `sanitize_*` & `enter` (#4294)

* Make spell check happier

* Make wasm runtimes compile with benchmarks enabled (#4303)

* comment stuff out, use old toml

* Seems to be working?

* Remove feature gating from builder

* Remove commented out stuff

* Remove generic from digest

* Update weight files for runtime

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
drahnr added a commit that referenced this pull request Nov 26, 2021
* move things around, add filter methods��

* validator keys, modify availability bitfields according to disputes

* simplify, keep the filter -> sanitize generic for both usecases

* minor

* assure tests still work, reduce changeset

* integration

* start entropy passing

* fixins

* compile, 1 failing test

* filter with coverage

* fixins

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* slip of the pen

* improve test cases

* misc

* fix

* fixins

* test avoid extra into() calls in assert_noop!

* chores

* ff

* test fixup superfluous into call

* chore: pfmt

* improve apply_block_weight_limit to try to maximize the number of sufficiently backed

blocks and add extra bitfields in a round-robin fashion

* new code treats the lack of backed candidates as ok

* Use vrf based entropy

* fixup vrf random

* add warn

* slip of the pen

* fixup

* assure ordering

* rethink apply_weights

* mock

* use a closure as predicate check

* extract and use DisputedBitfield

* chore: simplify

* remove stray dbg

* chore: fmt

* address feedback

* fix test, halfway there

* stage1

* dbg stuff

* make group selection align

* fix session index

* fix wrongly returned candidates

* cleanup

* chore fmt

* fix ensure check

* make good case test work

* more tests for bitfields

* create sanitize_backed_candidates

* fixup tests

* update guide

* add check referenced in the guide

* improve weights code

* fmt

* fixins

* Update roadmap/implementers-guide/src/runtime/inclusion.md

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* compiling + address review

* add comments

* fix weight calc

* address review comments and test failure

* fix

* fix: condition

* Fix random_sel function

* Fix overlength block check

* Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests

* Add benchmarks for code upgrades

* Code upgrade bench; Feature gate TestWeightInfo

* Try and make CI happier

* Feature gate enter test to not(benchmarks)

* Make sure no unused imports/fn

* refactor, re-use, the beginning

* Fix issue with frame benchmarking dep compilation

* More precise feature gating for some derives

* integrate piece-wise

* foo

* fixins

* chore fmt

* fixins

* rename const generic

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix compilation

* limit to test

* remove unused spam slots

* spellcheck

* remove a tick, fix a typo

* Add Code upgrade weights

* comment improvements + >=

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove another tick

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

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* saturating fixins + some spaces

* fix

* benchmarking - preliminary results

* Add training wheels

* Refactor some early exit logic for enter

* Gracefully handle filtering bitfields & candidates (#4280)

This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items.

* Refactor inherent data weight limiting logic (#4287)

* Apply suggestions from code review

* Update runtime/parachains/src/builder.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update runtime/parachains/src/builder.rs

* Update runtime/parachains/src/paras_inherent.rs

* final pass

* Run cargo +nightly-2021-10-29 fmt

* Update implementors guide with `sanitize_*` & `enter` (#4294)

* Make spell check happier

* Make wasm runtimes compile with benchmarks enabled (#4303)

* comment stuff out, use old toml

* Seems to be working?

* Remove feature gating from builder

* Remove commented out stuff

* Remove generic from digest

* Update weight files for runtime

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
ordian pushed a commit that referenced this pull request Nov 26, 2021
* move things around, add filter methods��

* validator keys, modify availability bitfields according to disputes

* simplify, keep the filter -> sanitize generic for both usecases

* minor

* assure tests still work, reduce changeset

* integration

* start entropy passing

* fixins

* compile, 1 failing test

* filter with coverage

* fixins

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* slip of the pen

* improve test cases

* misc

* fix

* fixins

* test avoid extra into() calls in assert_noop!

* chores

* ff

* test fixup superfluous into call

* chore: pfmt

* improve apply_block_weight_limit to try to maximize the number of sufficiently backed

blocks and add extra bitfields in a round-robin fashion

* new code treats the lack of backed candidates as ok

* Use vrf based entropy

* fixup vrf random

* add warn

* slip of the pen

* fixup

* assure ordering

* rethink apply_weights

* mock

* use a closure as predicate check

* extract and use DisputedBitfield

* chore: simplify

* remove stray dbg

* chore: fmt

* address feedback

* fix test, halfway there

* stage1

* dbg stuff

* make group selection align

* fix session index

* fix wrongly returned candidates

* cleanup

* chore fmt

* fix ensure check

* make good case test work

* more tests for bitfields

* create sanitize_backed_candidates

* fixup tests

* update guide

* add check referenced in the guide

* improve weights code

* fmt

* fixins

* Update roadmap/implementers-guide/src/runtime/inclusion.md

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* compiling + address review

* add comments

* fix weight calc

* address review comments and test failure

* fix

* fix: condition

* Fix random_sel function

* Fix overlength block check

* Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests

* Add benchmarks for code upgrades

* Code upgrade bench; Feature gate TestWeightInfo

* Try and make CI happier

* Feature gate enter test to not(benchmarks)

* Make sure no unused imports/fn

* refactor, re-use, the beginning

* Fix issue with frame benchmarking dep compilation

* More precise feature gating for some derives

* integrate piece-wise

* foo

* fixins

* chore fmt

* fixins

* rename const generic

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix compilation

* limit to test

* remove unused spam slots

* spellcheck

* remove a tick, fix a typo

* Add Code upgrade weights

* comment improvements + >=

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove another tick

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

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* saturating fixins + some spaces

* fix

* benchmarking - preliminary results

* Add training wheels

* Refactor some early exit logic for enter

* Gracefully handle filtering bitfields & candidates (#4280)

This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items.

* Refactor inherent data weight limiting logic (#4287)

* Apply suggestions from code review

* Update runtime/parachains/src/builder.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update runtime/parachains/src/builder.rs

* Update runtime/parachains/src/paras_inherent.rs

* final pass

* Run cargo +nightly-2021-10-29 fmt

* Update implementors guide with `sanitize_*` & `enter` (#4294)

* Make spell check happier

* Make wasm runtimes compile with benchmarks enabled (#4303)

* comment stuff out, use old toml

* Seems to be working?

* Remove feature gating from builder

* Remove commented out stuff

* Remove generic from digest

* Update weight files for runtime

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
ordian pushed a commit that referenced this pull request Nov 29, 2021
* move paras inherent filtering to runtime (#4028)

* move things around, add filter methods��

* validator keys, modify availability bitfields according to disputes

* simplify, keep the filter -> sanitize generic for both usecases

* minor

* assure tests still work, reduce changeset

* integration

* start entropy passing

* fixins

* compile, 1 failing test

* filter with coverage

* fixins

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* slip of the pen

* improve test cases

* misc

* fix

* fixins

* test avoid extra into() calls in assert_noop!

* chores

* ff

* test fixup superfluous into call

* chore: pfmt

* improve apply_block_weight_limit to try to maximize the number of sufficiently backed

blocks and add extra bitfields in a round-robin fashion

* new code treats the lack of backed candidates as ok

* Use vrf based entropy

* fixup vrf random

* add warn

* slip of the pen

* fixup

* assure ordering

* rethink apply_weights

* mock

* use a closure as predicate check

* extract and use DisputedBitfield

* chore: simplify

* remove stray dbg

* chore: fmt

* address feedback

* fix test, halfway there

* stage1

* dbg stuff

* make group selection align

* fix session index

* fix wrongly returned candidates

* cleanup

* chore fmt

* fix ensure check

* make good case test work

* more tests for bitfields

* create sanitize_backed_candidates

* fixup tests

* update guide

* add check referenced in the guide

* improve weights code

* fmt

* fixins

* Update roadmap/implementers-guide/src/runtime/inclusion.md

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>

* compiling + address review

* add comments

* fix weight calc

* address review comments and test failure

* fix

* fix: condition

* Fix random_sel function

* Fix overlength block check

* Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests

* Add benchmarks for code upgrades

* Code upgrade bench; Feature gate TestWeightInfo

* Try and make CI happier

* Feature gate enter test to not(benchmarks)

* Make sure no unused imports/fn

* refactor, re-use, the beginning

* Fix issue with frame benchmarking dep compilation

* More precise feature gating for some derives

* integrate piece-wise

* foo

* fixins

* chore fmt

* fixins

* rename const generic

* Update runtime/parachains/src/paras_inherent.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Fix compilation

* limit to test

* remove unused spam slots

* spellcheck

* remove a tick, fix a typo

* Add Code upgrade weights

* comment improvements + >=

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* remove another tick

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

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* saturating fixins + some spaces

* fix

* benchmarking - preliminary results

* Add training wheels

* Refactor some early exit logic for enter

* Gracefully handle filtering bitfields & candidates (#4280)

This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items.

* Refactor inherent data weight limiting logic (#4287)

* Apply suggestions from code review

* Update runtime/parachains/src/builder.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Update runtime/parachains/src/builder.rs

* Update runtime/parachains/src/paras_inherent.rs

* final pass

* Run cargo +nightly-2021-10-29 fmt

* Update implementors guide with `sanitize_*` & `enter` (#4294)

* Make spell check happier

* Make wasm runtimes compile with benchmarks enabled (#4303)

* comment stuff out, use old toml

* Seems to be working?

* Remove feature gating from builder

* Remove commented out stuff

* Remove generic from digest

* Update weight files for runtime

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>

* prefer code upgrades in inherent filtering (#4334)

* impl prefered items

Closes #4330

* do not stop attempting to select, just because one did not fit

* doc

* prefered -> preferred

* missing usage of the preferred indices

* sigh

* shuffle is not available for chacha

* remove duplicate weight addition

* ref vs no ref

* add additional assurances to `create_inherent` (#4349)

* minor: move checks into separate fn

* add additional validity checks

* simplify shuffling

* Closes potential OOB weight

* improve docs

* fooo

* remove obsolete comment

* move filtering into the rollback-transaction

Technically this is not necessary but avoids future footguns.

* move check up and avoid duplicate checks

* refactor: make sure backed candidates are sane, even more

* doc wording

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* refactor: avoid const generics for sake of wasm size

`true` -> `FullCheck::Skip`, `false` -> `FullCheck::Yes`.

* chore: unify `CandidateCheckContext` instance names

* refactor: introduce `IndexedRetain` for `Vec<T>`

* chore: make tests prefix free

* doc: re-introduce removed comment

* refactor: remove another const generic to save some wasm size

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* Inherent filtering follow up (#4305)

* Add feature more feature gating for benchmarking + tests

* New line

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs

* Do not assume we use max validators per core

* Use kusama weights for rococo (hopefully temp)

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_paras_inherent.rs

* Add more validity votes when neccesary

* Some fixes for the last commit

* Restore westend weights

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_paras_inherent.rs

* Revert bad westend weights write

* Make sure to update val idx before skipping

* Fix validity vote range to max at group size'

* Temp setup for rococo

* cargo run --quiet --release --features runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtime/rococo/src/weights/runtime_parachains_paras_inherent.rs --header=./file_header.txt

* Augment generated Rococo weights

* Make it compile

* Revert range for enter_backed_candidates_variable

* Delete runtime/kusama/src/weights/runtime_paras_paras_inherent.rs

Co-authored-by: Parity Bot <admin@parity.io>

* prepare worker: Catch unexpected unwinds (#4304)

* prepare worker: Catch unexpected unwinds

* Use more specific wording for unknown panic payload

* Treat non-deterministic prep errors as internal errors (#4364)

Closes #4293

This PR changes the way how we treat a certain subset of PVF preparation
errors. Specifically, now only the deterministic errors are treated as
invalid candidates. That is, the errors that are easily
attributable to either the the PVF contents or the wasmtime code, but
not e.g. I/O errors that could be triggered by the OS (insufficient
memory, disk failure, too much load, etc). The latter are treated as
internal errors and thus do not trigger the disputes.

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
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. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant