remove Default from CandidateDescriptor (#4484)

* remove Default from CandidateHash

* Apply suggestions from code review

Co-authored-by: Andronik Ordian <write@reusable.software>

* chore: fmt

* remove backed candidate default

* Partial migration away from CandidateReceipt::default

* Remove more CandidateReceipt defaults

* fmt

* Mostly remove CommittedCandidateReceipt default usage

* Remove CommittedCandidateReceipt

* Remove more Defaults from polakdot primitives v1 + fmt

* Remove more Default from polkadot primites v1

* WIP trying to get overseer example + tests to compile

* feat: add primitives test helpers

* reduce deps of helper

* update primitive helpers

* make candidate validation compile

* fixup cargo lock

* make av-store compile

* fixup disputes coordinator tests

* test: fixup backing

* test: fixup approval voting

* fixup bitfield signing

* test: fixup runtime-api

* test: fixup availability dist

* foxi[ pverseer test]

* remove some Defaults, remove bounds from `dummy`

All `fn dummy` in primitives need to be removed anyways.
This aids in the transition.

* it's a test helper, so always use std

* test: fixup parachains runtime tests

Excluding benches.

* fix keyring

* fix paras runtime properly, no more default

* Remove fn dummy() usage from approval voting

* Move TestCandidateBuilder out of av store to test helpers

* Make candidate validation tests pass

* Make most dispute coirdinator tests pass

* Make provisioner tests work

* Make availability recovery tests work with test helpers

* Update polkadot-collator-protocol tests

* Update statement distribution tests

* Update polkadot overseer examples and tests

* Derive default for validation code so we don't break unrelated things

* Make para runtime test pass (no bench)

* Some more work

* chore: cargo fmt

* cargo fix

* avoid some Default::default

* fixup dispute coordinator test

* remove unused crate deps

* remove Default::default wherever possible, replace by dummy_* for the most part

* chore: cargo fmt

* Remove some warnings

* Remove CommittedCandidateReceipt dummy

* Remove CandidateReceipt dummy

* Remove CandidateDescriptor dummy

* Remove commented out code

* Fix para runtime tests

* chore: nightly

* Some updates to the builder

* Dynamically adjust mock head data size

* Make dispute cooridinator tests work

* Fix test candidate_backing_reorders_votes work

* +nightly-2021-10-29 fmt

* Spelling and remove a default use in builder

* Various clean up

* More small updates

* fmt

* More small updates

* Doc comments for test helpers

* 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

* Update lib.rs

* review comments

* fix warnings

* fix test by using correct candidate receipt relay parent

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: emostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
Bernhard Schuster
2021-12-10 13:12:07 +01:00
committed by GitHub
parent 916497e5db
commit 0f1a9fb1eb
68 changed files with 993 additions and 500 deletions
@@ -16,7 +16,7 @@
//! Autogenerated weights for `runtime_parachains::paras_inherent`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-12-02, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-12-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
// Executed Command:
@@ -74,9 +74,9 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
// Storage: Paras Heads (r:0 w:1)
fn enter_variable_disputes(v: u32, ) -> Weight {
(282_901_000 as Weight)
// Standard Error: 13_000
.saturating_add((49_184_000 as Weight).saturating_mul(v as Weight))
(484_589_000 as Weight)
// Standard Error: 15_000
.saturating_add((49_300_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(28 as Weight))
.saturating_add(T::DbWeight::get().writes(17 as Weight))
}
@@ -110,7 +110,7 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
// Storage: Paras Heads (r:0 w:1)
fn enter_bitfields() -> Weight {
(256_399_000 as Weight)
(459_040_000 as Weight)
.saturating_add(T::DbWeight::get().reads(25 as Weight))
.saturating_add(T::DbWeight::get().writes(16 as Weight))
}
@@ -136,7 +136,6 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// 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)
@@ -146,10 +145,10 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
// Storage: Paras Heads (r:0 w:1)
fn enter_backed_candidates_variable(v: u32, ) -> Weight {
(319_740_000 as Weight)
// Standard Error: 26_000
.saturating_add((49_051_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(29 as Weight))
(1_134_397_000 as Weight)
// Standard Error: 29_000
.saturating_add((49_193_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(28 as Weight))
.saturating_add(T::DbWeight::get().writes(15 as Weight))
}
// Storage: ParaInherent Included (r:1 w:1)
@@ -174,8 +173,9 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// 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: Paras FutureCodeHash (r:1 w:0)
// Storage: Paras UpgradeRestrictionSignal (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)
@@ -184,8 +184,8 @@ impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
// Storage: Paras Heads (r:0 w:1)
fn enter_backed_candidate_code_upgrade() -> Weight {
(42_221_346_000 as Weight)
.saturating_add(T::DbWeight::get().reads(29 as Weight))
(43_202_449_000 as Weight)
.saturating_add(T::DbWeight::get().reads(30 as Weight))
.saturating_add(T::DbWeight::get().writes(15 as Weight))
}
}