Skip to content
  1. Apr 02, 2022
  2. Mar 24, 2022
    • Sergei Shulepov's avatar
      paras: `include_pvf_check_statement` rt bench (#4938) · c8fda4f1
      Sergei Shulepov authored
      
      
      * paras: `include_pvf_check_statement` rt bench
      
      Resolves #4933
      
      This PR adds a benchmark for the `include_pvf_check_statement`
      dispatchable. This is a necessary step to make it work without
      modifications. That enables us to proceed with testing on Versi.
      
      This introduces 5 new benchmarks. Those measure performance of the
      `include_pvf_check_statement` under 2 different conditions:
      
      1. regular vote submission. That's the common case.
      2. submission of the last vote. That happens only once and leads to a
         heavy finalization stage.
      
      There are 2 different types of finalization (one for onboarding, one for
      upgrading) and there are two outcomes: accepted and rejected. Those 4
      are similar but I decided to cover them all and assign the maximum of
      all 4. This is to avoid a situation when one of those paths becomes more
      heavier than others and opens up an attack venue.
      
      The regular vote submission weight is drastically different from the
      submission last vote weight. That's why in case during runtime
      finalization was not executed the weight consumed value will be lowered
      down to the regular vote submission.
      
      The finalization weight is proportional to the number of "causes", i.e.
      the events that caused the PVF pre-checking vote in the first place, and
      here we assume that the maximum number of causes is 100.
      
      Theoretically, there is nothing that prevents an adversary to
      register/upgrade to more than 100 parachains. In that case, the consumed
      weight will be lower than the actual time consumed by the finalization
      process. That can enable a DoS vector.
      
      However, practically, it is not very possible. Right now it is very
      expensive to call `schedule_para_initialize` because it requires a very
      large lock up of funds. Moreover, finalizing a vote with 100 causes
      leads to around 31ms time spent. Finalizing more will require more time.
      However, finalizing with 200 causes will cause ≈62ms delay. This is not
      that bad since even though we had a full block and the adversary tried
      to finalize 200 causes it won't be able to even exceed the operational
      extrinsic boundary of 250ms and even if so it won't make big difference.
      
      That said, this should be addressed later on, esp. when we enable
      parathreads, which will make creating causes easier. One of potential
      solutions will be shifting the logic of finalization into
      `on_initialize`/`on_finalize`. Another is to create a maximum number of
      causes and then reject upgrades or onboardings if that was reached.
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --profile=production --features runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_paras.rs
      
      * Fix import error
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarRobert Klotzner <[email protected]>
      Co-authored-by: default avatarLldenaurois <[email protected]>
      c8fda4f1
  3. Mar 22, 2022
    • Bruno Galvao's avatar
      add weights that need to be generated for rococo (#5052) · f8b979b7
      Bruno Galvao authored
      * add weights that need to be generated for rococo
      
      * remove frame_system
      
      * touch balances weight file
      
      * add empty im-online weight file
      
      * add empty pallet indices weight file
      
      * add empty pallet multisig weight file
      
      * add empty pallet proxy weight file
      
      * add empty pallet session weight file
      
      * add empty pallet timestamp weight file
      
      * add empty pallet utility weight file
      
      * add empty para pallets weight files
      
      * remove utility for now
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-im-online --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-multisig --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-proxy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_common_auctions.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-indices --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_common::paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_common_paras_registrar.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_common::slots --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_common_slots.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_configuration.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_hrmp.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::initializer --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_initializer.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_ump.rs
      
      * update ump for weights sink_process_upward_message -> process_upward_message (#5103)
      
      * update ump for weights sink_process_upward_message -> process_upward_message
      
      * update autogen files
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::disputes --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_disputes.rs
      
      * add frame_system weights for Rococo
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * add pallet-utility runtime benchmarks
      
      * add utility benchmark
      
      * add utility pallet
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=pallet-utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/
      
      * fix cargo format issues
      
      * add pallet_session weights
      
      - since pallet session benchmarking is coupled with pallet staking, for the time being we will use the weights from westend
      
      https://github.com/paritytech/polkadot/pull/5052#issuecomment-1072903719
      
      
      
      * remove newline
      
      * use some of the new weights
      
      * add pallet-utility/std
      
      * add collective and membership benchmarks
      
      * add WeightInfo
      
      * copy weights from Polkadot for now, needs to be updated with relevant weights
      
      * add weights
      
      * copy weights from Polkadot pallet session
      
      * remove newline
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarDan Shields <[email protected]>
      Co-authored-by: default avatarShawn Tabrizi <[email protected]>
      f8b979b7
  4. Mar 09, 2022
    • asynchronous rob's avatar
      Finish migration to v2 primitives (#5037) · 49f7e5cc
      asynchronous rob authored
      * remove v0 primitives from polkadot-primitives
      
      * first pass: remove v0
      
      * fix fallout in erasure-coding
      
      * remove v1 primitives, consolidate to v2
      
      * the great import update
      
      * update runtime_api_impl_v1 to v2 as well
      
      * guide: add `Version` request for runtime API
      
      * add version query to runtime API
      
      * reintroduce OldV1SessionInfo in a limited way
      49f7e5cc
  5. Mar 08, 2022
  6. Feb 26, 2022
    • Falco Hirschenberger's avatar
      Add benchmarking for parachain runtime `ump` pallet (#3889) · fc919376
      Falco Hirschenberger authored
      
      
      * Claim grounds, not working yet.
      
      * still wip, nothing to see
      
      * Module visibility problem
      
      * Add benchmarks for all parachain-enabled chains
      
      * Add missing mock weights
      
      * Fix mock weight info
      
      * Add max-weight to extrinsic weight
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_ump.rs
      
      * sorting declarations
      
      * Use a maximum size message to benchmark worst-case
      
      * remove warning
      
      * Fix msg size overflow in tests
      
      * Use benchmarked weight in PostInfo
      
      * Update runtime/parachains/src/ump.rs
      
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      
      * Delete obsolete file
      
      * Compile fix
      
      * Fix spelling
      
      * Add benchmark for `UmpSink::process_upward_message`
      
      It benchmarks the time to process a message, mainly the size-dependent
      decoding time. This is used interally for refunding weight from
      `service_overweight`
      
      * Fix warning
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_ump.rs
      
      * Update runtime/parachains/src/ump.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Give mock weights for tests a name instead of ()
      
      * Add benchmark for `initializer_on_new_session` aka.
      `perform_outgoing_para_cleanup`
      
      * Remove unnescessary pub specifier and change folding to a for loop
      
      suggestions by @pepyakin
      
      
      
      * Update runtime/parachains/src/ump.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Update runtime/parachains/src/ump.rs
      
      Co-authored-by: default avatarKian Paimani <[email protected]>
      
      * Add comment on weight calculation and expected slight overestimation
      
      * Introduce a size bound constant for upward messages
      
      * Use KiB not kB for message size bound
      
      * Enforce max-message size bound
      
      * Use a const for upward message size bound.
      
      * Decrease max_upward_message_sizes to 50KiB as suggested by @pepyakin
      
      * Fix creating overweight messages
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_ump.rs
      
      * Remove unused variable
      
      * Rename benchmark function to the function actually benchmarked and some
      code cleanup
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_ump.rs
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::ump --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_ump.rs
      
      * Better variable naming
      
      * Fix build
      
      * Fix build
      
      * Fix some remarks from @pepyakin
      
      
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarAlexander Popiak <[email protected]>
      Co-authored-by: default avatarKian Paimani <[email protected]>
      Co-authored-by: default avataremostov <[email protected]>
      fc919376
  7. Feb 25, 2022
  8. Feb 22, 2022
    • Sergei Shulepov's avatar
      paras: `initialize_para_now` and `ParachainsCache` (#4934) · 95a78e87
      Sergei Shulepov authored
      This commit adds a new primitive called `ParachainsCache` to manipulate
      the `Parachains` storage entry in a more convenient way.
      
      Then, on top of that, this commit changes the logic of
      `initialize_para_now` so that it is identical to what is used for
      initialization of onboarding.
      95a78e87
  9. Feb 16, 2022
  10. Feb 03, 2022
  11. Feb 02, 2022
  12. Jan 30, 2022
  13. Jan 28, 2022
  14. Jan 27, 2022
  15. Jan 21, 2022
    • Kian Paimani's avatar
      HRMP benchmarks (#3876) · 3cb2d626
      Kian Paimani authored
      
      
      * wip template for hrmp benchmarks
      
      * add all of the benchmarks, first draft
      
      * File was not saved :/
      
      * cargo +nightly fmt
      
      * Use configs
      
      * add configs
      
      * Fix rococo
      
      * Final touches
      
      * revert fmt changes, one last time
      
      * Fix wrappings
      
      * Fix a bunch of tests
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_hrmp.rs
      
      * add to westend
      
      * actually use everything
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_hrmp.rs
      
      * Update runtime/parachains/src/hrmp.rs
      
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      
      * use real weight in wnd
      
      * reorg
      
      * minor cleanup
      
      * weigh some of the internal stuff as well
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_hrmp.rs
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_hrmp.rs
      
      * add files
      
      * Master.into()
      
      * add validation
      
      * fmt
      
      * fmt
      
      * final fixes
      
      * all runtimes build
      
      * undo formatting
      
      * Update runtime/parachains/src/hrmp.rs
      
      Co-authored-by: default avatarZeke Mostov <[email protected]>
      
      * non-controversial changes
      
      * do it the parachain-way: use const instead of type configs for simplicity.
      
      * borrow assert_storage_consistency_exhaustive
      
      * move assert_storage_consistency_exhaustive to Pallet, so it can be reused for benchmarks as well.
      
      * fix typo
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      Co-authored-by: default avatarSergey Shulepov <[email protected]>
      Co-authored-by: default avatarZeke Mostov <[email protected]>
      3cb2d626
  16. Jan 20, 2022
    • Oliver Tale-Yazdi's avatar
      co #10662: Require `MaxEncodedLen` per default (#4746) · 3d61cc01
      Oliver Tale-Yazdi authored
      
      
      * Add `without_storage_info`
      
      The MaxEncodedLen trait is now enforced by default in Substrate.
      All pallets missing an implementation need to be marked with
      `without_storage_info` now.
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Remove `generate_storage_info`
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * Add more `without_storage_info`
      
      Signed-off-by: default avatarOliver Tale-Yazdi <[email protected]>
      
      * update lockfile for {"substrate"}
      
      Co-authored-by: parity-processbot <>
      3d61cc01
    • Bernhard Schuster's avatar
      [runtime] follow up relay chain cleanups (#4657) · b7a05fd4
      Bernhard Schuster authored
      
      
      * fix miscalculation of remaining weight
      
      * rename a var
      
      * move out enforcing filtering by dropping inherents
      
      * prepare for dispute statement validity check being split off
      
      * refactor
      
      * refactor, only check disputes we actually want to include
      
      * more refactor and documentation
      
      * refactor and minimize inherent checks
      
      * chore: warnings
      
      * fix a few tests
      
      * fix dedup regression
      
      * fix
      
      * more asserts in tests
      
      * remove some asserts
      
      * chore: fmt
      
      * skip signatures checks, some more
      
      * undo unwatend changes
      
      * Update runtime/parachains/src/paras_inherent/mod.rs
      
      Co-authored-by: default avatarsandreim <[email protected]>
      
      * cleanups, checking CheckedDisputeStatments makes no sense
      
      * integrity, if called create_inherent_inner, it shall do the checks, and not rely on enter_inner
      
      * review comments
      
      * use from impl rather than into
      
      * remove outdated comment
      
      * adjust tests accordingly
      
      * assure no weight is lost
      
      * address review comments
      
      * remove unused import
      
      * split error into two and document
      
      * use assurance, O(n)
      
      * Revert "adjust tests accordingly"
      
      This reverts commit 3cc9a3c449f82db38cea22c48f4a21876603374b.
      
      * fix comment
      
      * fix sorting
      
      * comment
      
      Co-authored-by: default avatarsandreim <[email protected]>
      b7a05fd4
  17. Jan 17, 2022
    • Sergey Pepyakin's avatar
      paras: do not allow PVF vote submission if disabled (#4684) · 815021ab
      Sergey Pepyakin authored
      if the PVF pre-checking is disabled the runtime dispatchable will reject
      any attempts of submission. This is also concern the unsigned tx
      validation.
      
      Right now, the `include_pvf_check_statement` dispatchable is effectively
      uncallable because of the weight set to the maximum value. If we were to
      benchmark it, it would become includable in a block, but since there
      will be no active votes, the dispatchable won't do anything.
      
      However, it will execute some code, like signature validation and
      querying some storage entries. To be completely safe, we can bail out
      early if the `pvf_checking_enabled` config is disabled. That's what this
      PR does.
      815021ab
  18. Jan 13, 2022
    • Sergey Pepyakin's avatar
      paras: Add runtime events for PVF pre-checking (#4683) · 21419a81
      Sergey Pepyakin authored
      In this PR, paras module emit runtime events on certain PVF pre-checking
      related conditions.
      
      Specifically, there are 3 new events in the paras module:
      
      1. PvfCheckStarted
      2. PvfCheckAccepted
      3. PvfCheckRejected
      
      All of those have identifiers for the parachain that triggered the PVF
      pre-checking and the validation code that goes through the pre-checking.
      
      The mechanics of those are as follows. Each time a new PVF is added, be
      it due to onboarding or upgrading, the `PvfCheckStarted` will be
      triggered. If another parachain triggers a pre-checking process for the
      validation code which is already being pre-checked, another
      `PvfCheckStarted` event will be triggered with the corresponding para
      id.
      
      When the PVF pre-checking voting for a PVF was finished, several
      `PvfCheckAccepted/Rejected` events will be triggered: one for each para id that
      was subscribed to this check (i.e. was a "cause" for it).
      
      If the PVF pre-checking is disabled, then one can still expect these
      events to be fired. Since insta PVF approval is syncronous, the
      `PvfCheckStarted` will be followed by the `PvfCheckAccepted` with the
      same validation code and para id.
      
      If somebody is interested in following validation code changes for a PVF
      of a parachain, they would need to subscribe to those events. I did not
      supply the topics for the events, since I am not sure if that's needed
      or will be used, but they can be added later if needed.
      21419a81
  19. Jan 12, 2022
  20. Jan 07, 2022
  21. Jan 05, 2022
  22. Jan 03, 2022
    • Keith Yeung's avatar
      Set CurrentCodeHash before running some dispatchable benchmarks (#4645) · 5047ef8e
      Keith Yeung authored
      
      
      * Set CurrentCodeHash before running some dispatchable benchmarks
      
      * Use insert instead of put
      
      * Actually hash the ValidationCode
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_paras.rs
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      5047ef8e
    • Sergey Pepyakin's avatar
      paras: split tests (#4636) · 575775a1
      Sergey Pepyakin authored
      This is only a module structure change: the tests module was promoted to
      have its own file.
      575775a1
  23. Jan 01, 2022
  24. Dec 31, 2021
  25. Dec 30, 2021
  26. Dec 29, 2021
    • Sergey Pepyakin's avatar
      paras: add governance control dispatchables (#4575) · 4bf62d85
      Sergey Pepyakin authored
      * paras: add governance control dispatchables
      
      Adds a couple of functions for governance control for the paras module
      in the anticipation of PVF pre-checking enabling.
      
      Specifically, this commit adds a function for pre-registering a PVF that
      governance trusts enough. This function will come in handy in case there
      is a parachain that does not follow the GoAhead signal. That is, does
      not include https://github.com/paritytech/cumulus/pull/517
      
      .
      
      This may be not an exhaustive list of the functions that may come in
      handy. Any suggestions to add more are welcome.
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_paras.rs
      
      * cargo run --quiet --release --features runtime-benchmarks -- benchmark --chain=rococo-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/rococo/src/weights/runtime_parachains_paras.rs
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      4bf62d85
  27. Dec 28, 2021
  28. Dec 27, 2021
    • Sergey Pepyakin's avatar
      configuration: Unified consistency checks (#4581) · 4d768787
      Sergey Pepyakin authored
      This commit refactors the consistency checks. Instead of each individual
      setter performs its checks locally, we delegate those checks to the
      already existing function `check_consistency`. This removes duplication
      and simplifies the logic.
      
      A motivating example of this one is the next PR in the stack that will
      introduce a check for a field, which validity depends on the validity of
      other two fields. Without this refactoring we will have to place a check
      not only to the field in question, but also to the other two fields so
      that if they are changed they do not violate consistency criteria. It's
      easy to imagine how this can go unwieldy with the number of checks.
      
      This also adds a test that verifies that the default chain spec host
      configuration is consistent.
      4d768787
    • ordian's avatar
      9efb223a
    • ordian's avatar
      session-info: add new fields + migration (#4545) · b342ae11
      ordian authored
      
      
      * session_info: v2 + migration
      
      * use primitives::v2
      
      * use polkadot_primitives::v2
      
      * impl primitives::v2
      
      * fix approval-voting tests
      
      * fix other tests
      
      * hook storage migration up
      
      * backwards compat (1)
      
      * backwards compat (2)
      
      * fmt
      
      * fix tests
      
      * FMT
      
      * do not reexport v1 in v2
      
      * fmt
      
      * set storage version to 1
      
      Co-authored-by: default avatarJavier Viola <[email protected]>
      b342ae11
  29. Dec 24, 2021
    • cheme's avatar
      Companion for substrate#9732 (#4104) · 48dc6750
      cheme authored
      * merge master (do not compile)
      
      * fix
      
      * lock
      
      * update lock
      
      * Update to refactoring.
      
      * runtime version
      
      * fmt
      
      * remove trie patch
      
      * remove patch
      
      * No layout alias for bridge proof.
      
      * update depupdate depss
      
      * No switch until migration.
      
      * master lock
      
      * test
      
      * test
      
      * Revert "test"
      
      This reverts commit 57325ef73332bf4b054aa4a667bb716fcf8a0d89.
      
      * Revert "test"
      
      This reverts commit ce74d0e2062806f72c0e9e9ca07b14165f43521e.
      
      * rename feature
      
      * state version as parameter, use the feature only on runtimes.
      
      * update
      
      * update to state version in runtime
      
      * state version from storage
      
      * update lockfile for substrate
      
      Co-authored-by: parity-processbot <>
      48dc6750
  30. Dec 23, 2021
    • Robert Klotzner's avatar
      First step in implementing #4386 (#4437) · 846828f6
      Robert Klotzner authored
      * First step in implementing https://github.com/paritytech/polkadot/issues/4386
      
      This PR:
      
      - Reduces MAX_UNSHARED_UPLOAD_TIME to 150ms
      - Increases timeout on collation fetching to 1200ms
      - Reduces limit on needed backing votes in the runtime
      
      This PR does not yet reduce the number of needed backing votes on the
      node as this can only be meaningfully enacted once the changed limit in
      the runtime is live.
      
      * Fix tests.
      
      * Guide updates.
      
      * Review remarks.
      
      * Bump minimum required backing votes to 2 in runtime.
      
      * Make sure node side code won't make runtime vomit.
      
      * cargo +nightly fmt
      846828f6
  31. Dec 22, 2021
    • Sergey Pepyakin's avatar
      configuration: refactor configuration initialization (#4569) · 4689ccff
      Sergey Pepyakin authored
      Refactor the configuration module's initializer_on_new_session in such a
      way that it returns the configuration. This would make it inline with
      other special initialization routines like `shared`'s or `paras`.
      
      This will be useful in a following PR that will check consistency of the
      configuration before setting it.
      4689ccff