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

kusama: enable dispute slashes #5974

Merged
merged 107 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 103 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
d6a2eb2
disputes: runtime part of slashing
ordian May 6, 2022
fd2194a
disputes: reward winners
ordian May 9, 2022
9f8daef
disputes/slashing: validate_unsigned impl
ordian May 11, 2022
ee46d14
fmt
ordian May 11, 2022
7b158f6
disputes/slashing: report_dispute_lost_unsigned
ordian May 11, 2022
60a82a4
disputes/slashing: separate winners from losers and report winners
ordian May 13, 2022
b303ee4
disputes/slashing: refactoring
ordian May 13, 2022
6f1d724
impl HandleReports
ordian May 16, 2022
4a55be9
enable on Wenstend
ordian May 16, 2022
1941543
fmt
ordian May 16, 2022
04ad120
add slashing pallet to the mock and test runtimes
ordian May 16, 2022
3784591
fix a bug in report_dispute_lost_unsigned
ordian May 16, 2022
f49b55f
fmt
ordian May 16, 2022
cbcf176
disputes: remove new_participants from summary
ordian May 17, 2022
7b82f0d
disputes: remove punish_inconclusive
ordian May 17, 2022
f863baf
impl SlashingHandler for Pallet for type-safety
ordian May 17, 2022
b4fa682
do not impl slashing::Config on mainnets yet
ordian May 17, 2022
2739900
teach spellcheck deduplication
ordian May 17, 2022
62ff14f
simplify interfaces and resolve some TODOs
ordian May 17, 2022
4db3ab8
resolve some more TODOs
ordian May 17, 2022
02c069d
minor typos
ordian May 17, 2022
6fc8f5f
move slashing into a folder
ordian May 18, 2022
7f3ae20
remove unnecessary clone
ordian May 18, 2022
13c7c84
fix validator_set_count calculation
ordian May 18, 2022
5c98289
introduce ValidatorSetCount
ordian May 18, 2022
8263d16
store ValidatorSetCount
ordian May 18, 2022
c073e08
fmt
ordian May 18, 2022
dc3b6de
add the benchmark
ordian Jun 14, 2022
75f256d
fmt
ordian Jun 14, 2022
65851ad
unflatten slashing
ordian Jun 14, 2022
2210bad
post-rebase fixes
ordian Jun 14, 2022
6ab6b48
remove winners eagerly
ordian Jun 14, 2022
6a0ddfc
use real slashing weights for westend
ordian Jun 14, 2022
29376b1
remove bench test suite
ordian Jun 17, 2022
f76a697
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jun 17, 2022
4800be1
zombinet: modify disputes test to check for an offence report
ordian Jun 17, 2022
4c0f83e
zombinet: add a timeout
ordian Jun 17, 2022
3086e26
add slashing pallet to Rococo
ordian Jun 20, 2022
677a262
zombienet: revert back to rococo-local
ordian Jun 20, 2022
e1ff282
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jun 20, 2022
fe7495e
fmt
ordian Jun 20, 2022
461f37f
remove TODOs
ordian Jun 20, 2022
bae9912
revert some accidental changes
ordian Jun 20, 2022
15fcf48
slashing is submodule of disputes
ordian Jun 21, 2022
097d6c1
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jun 21, 2022
65146ca
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jun 28, 2022
650eb19
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jul 5, 2022
95cd87d
Merge branch 'master' into ao-disputes-offences-runtime
ordian Jul 28, 2022
760bdc7
Change the log target
ordian Jul 30, 2022
d3405cc
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 1, 2022
d5b3324
Merge branch 'ao-disputes-offences-runtime' of github.com:paritytech/…
ordian Aug 1, 2022
f50aa7d
wrap comments with rustfmt, more docs, constants
ordian Aug 1, 2022
248baa5
use Defensive trait
ordian Aug 3, 2022
b02bcef
cargo update -p sp-io
ordian Aug 3, 2022
e1c87c4
merge offence types, remove rewards for now
ordian Aug 3, 2022
37f9cd7
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 3, 2022
b531490
cargo update -p sp-io
ordian Aug 3, 2022
454874f
benchmark fixes
ordian Aug 3, 2022
c0db743
fmt
ordian Aug 3, 2022
9fb1e38
unused var
ordian Aug 3, 2022
9c84b22
fix block_author impl
ordian Aug 3, 2022
19b7c6b
ressurect RewardValidators trait
ordian Aug 3, 2022
784e65e
remove outdated comment
ordian Aug 3, 2022
0c2559c
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 4, 2022
3a2858d
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 4, 2022
c22a943
more module docs
ordian Aug 5, 2022
884d9d8
introduce BenchmarkingConfig
ordian Aug 5, 2022
df81683
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 5, 2022
7101379
typo fix
ordian Aug 5, 2022
ce879df
teach spellcheck unapplied
ordian Aug 5, 2022
b070f34
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 31, 2022
563995b
Merge branch 'master' into ao-disputes-offences-runtime
ordian Aug 31, 2022
7d5171c
use Weight::new()
ordian Aug 31, 2022
b436249
fix mocking rewards
ordian Aug 31, 2022
397046e
use RefTimeWeight
ordian Aug 31, 2022
18965e3
".git/.scripts/bench-bot.sh" runtime westend-dev runtime_parachains::…
Aug 31, 2022
7269e18
refactor maybe_identify_validators
ordian Aug 31, 2022
399e0e6
no more ticket in disguise
ordian Aug 31, 2022
89fb5ed
remove outdated comments
ordian Aug 31, 2022
4f34bd7
lower against valid to 0.1%
ordian Sep 1, 2022
0d99787
bump zombienet version for debug
pepoviola Sep 1, 2022
9223d71
use from_perthousand
ordian Sep 1, 2022
c48aa45
Merge branch 'master' into ao-disputes-offences-runtime
ordian Sep 1, 2022
655fe98
post-merge fixes
ordian Sep 1, 2022
81578ff
Merge branch 'master' into ao-disputes-offences-runtime
ordian Sep 2, 2022
c5472c9
another day, another Weight changes
ordian Sep 2, 2022
6e5f372
Revert "bump zombienet version for debug"
ordian Sep 2, 2022
7bf295a
do not reward block authors
ordian Sep 5, 2022
8309493
Merge branch 'master' into ao-disputes-offences-runtime
ordian Sep 5, 2022
cd9aeb8
fix outdated comment
ordian Sep 6, 2022
3fe81e9
merge master once again
ordian Sep 6, 2022
e87cc9c
merge master once again II
ordian Sep 8, 2022
918b4ca
Merge branch 'master' into ao-disputes-offences-runtime
ordian Sep 19, 2022
b453b1a
use Pays from frame_support::dispatch::Pays
pepoviola Sep 19, 2022
77e5813
kusama: enable dispute slashing
ordian Sep 6, 2022
65cfe84
".git/.scripts/bench-bot.sh" runtime kusama-dev runtime_parachains::d…
Sep 6, 2022
83ade0e
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Sep 20, 2022
9fe7529
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Sep 20, 2022
cabc605
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Jan 5, 2023
ff64f05
post merge fixes
ordian Jan 5, 2023
a9bd663
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Jan 16, 2023
31eb7af
".git/.scripts/commands/bench/bench.sh" runtime kusama-dev runtime_pa…
Jan 16, 2023
7785be8
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Feb 27, 2023
56ac4f0
Merge remote-tracking branch 'origin/master' into ao-kusama-enable-di…
Feb 28, 2023
05dc083
Merge branch 'master' into ao-kusama-enable-dispute-slashes
ordian Mar 16, 2023
d86d16e
Merge branch 'ao-kusama-enable-dispute-slashes' of github.com:parityt…
ordian Mar 16, 2023
188afb0
".git/.scripts/commands/bench/bench.sh" runtime kusama runtime_parach…
Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};

use runtime_parachains::{
configuration as parachains_configuration, disputes as parachains_disputes,
dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
initializer as parachains_initializer, origin as parachains_origin, paras as parachains_paras,
disputes::slashing as parachains_slashing, dmp as parachains_dmp, hrmp as parachains_hrmp,
inclusion as parachains_inclusion, initializer as parachains_initializer,
origin as parachains_origin, paras as parachains_paras,
paras_inherent as parachains_paras_inherent, reward_points as parachains_reward_points,
runtime_api_impl::v2 as parachains_runtime_api_impl, scheduler as parachains_scheduler,
session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump,
Expand Down Expand Up @@ -476,9 +477,9 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
#[cfg(feature = "fast-runtime")]
#[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))]
type Fallback = onchain::OnChainExecution<OnChainSeqPhragmen>;
#[cfg(not(feature = "fast-runtime"))]
#[cfg(not(any(feature = "fast-runtime", feature = "runtime-benchmarks")))]
type Fallback = frame_election_provider_support::NoElection<(
AccountId,
BlockNumber,
Expand Down Expand Up @@ -1174,10 +1175,27 @@ impl parachains_initializer::Config for Runtime {
impl parachains_disputes::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
type SlashingHandler = ();
type SlashingHandler = parachains_slashing::SlashValidatorsForDisputes<ParasSlashing>;
type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>;
}

impl parachains_slashing::Config for Runtime {
type KeyOwnerProofSystem = Historical;
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, ValidatorId)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
ValidatorId,
)>>::IdentificationTuple;
type HandleReports = parachains_slashing::SlashingReportHandler<
Self::KeyOwnerIdentification,
Offences,
ReportLongevity,
>;
type WeightInfo = weights::runtime_parachains_disputes_slashing::WeightInfo<Runtime>;
type BenchmarkingConfig = parachains_slashing::BenchConfig<1000>;
}

parameter_types! {
pub const ParaDeposit: Balance = 40 * UNITS;
}
Expand Down Expand Up @@ -1441,6 +1459,7 @@ construct_runtime! {
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config} = 60,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>} = 62,
ParasSlashing: parachains_slashing::{Pallet, Call, Storage, ValidateUnsigned} = 63,

// Parachain Onboarding Pallets. Start indices at 70 to leave room.
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>} = 70,
Expand Down Expand Up @@ -1520,6 +1539,7 @@ mod benches {
[runtime_parachains::configuration, Configuration]
[runtime_parachains::hrmp, Hrmp]
[runtime_parachains::disputes, ParasDisputes]
[runtime_parachains::disputes::slashing, ParasSlashing]
[runtime_parachains::initializer, Initializer]
[runtime_parachains::paras_inherent, ParaInherent]
[runtime_parachains::paras, Paras]
Expand Down Expand Up @@ -2026,6 +2046,7 @@ sp_api::impl_runtime_apis! {
impl frame_system_benchmarking::Config for Runtime {}
impl frame_benchmarking::baseline::Config for Runtime {}
impl pallet_nomination_pools_benchmarking::Config for Runtime {}
impl runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {}

impl pallet_xcm_benchmarks::Config for Runtime {
type XcmConfig = XcmConfig;
Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub mod runtime_common_paras_registrar;
pub mod runtime_common_slots;
pub mod runtime_parachains_configuration;
pub mod runtime_parachains_disputes;
pub mod runtime_parachains_disputes_slashing;
pub mod runtime_parachains_hrmp;
pub mod runtime_parachains_initializer;
pub mod runtime_parachains_paras;
Expand Down
70 changes: 70 additions & 0 deletions runtime/kusama/src/weights/runtime_parachains_disputes_slashing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `runtime_parachains::disputes::slashing`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-01-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024

// Executed Command:
// /home/benchbot/cargo_target_dir/production/polkadot
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
// --pallet=runtime_parachains::disputes::slashing
// --chain=kusama-dev
// --header=./file_header.txt
// --output=./runtime/kusama/src/weights/

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for `runtime_parachains::disputes::slashing`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> runtime_parachains::disputes::slashing::WeightInfo for WeightInfo<T> {
// Storage: Session CurrentIndex (r:1 w:0)
// Storage: Historical HistoricalSessions (r:1 w:0)
// Storage: ParaSessionInfo Sessions (r:1 w:0)
// Storage: ParasSlashing UnappliedSlashes (r:1 w:1)
// Storage: Offences ReportsByKindIndex (r:1 w:1)
// Storage: Offences ConcurrentReportsIndex (r:1 w:1)
// Storage: Offences Reports (r:1 w:1)
// Storage: Staking SlashRewardFraction (r:1 w:0)
// Storage: Staking ActiveEra (r:1 w:0)
// Storage: Staking ErasStartSessionIndex (r:1 w:0)
// Storage: Staking Invulnerables (r:1 w:0)
// Storage: Staking ValidatorSlashInEra (r:1 w:0)
/// The range of component `n` is `[4, 1000]`.
fn report_dispute_lost(n: u32, ) -> Weight {
// Minimum execution time: 89_459 nanoseconds.
Weight::from_ref_time(123_050_909)
// Standard Error: 1_483
.saturating_add(Weight::from_ref_time(105_924).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(12))
.saturating_add(T::DbWeight::get().writes(4))
}
}