diff --git a/Cargo.lock b/Cargo.lock index e08351b..0b916bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "casper-runtime" -version = "3.5.41" +version = "3.5.42" dependencies = [ "casper-runtime-constants", "frame-benchmarking", @@ -3838,7 +3838,7 @@ dependencies = [ [[package]] name = "ghost-slow-clap" -version = "0.4.28" +version = "0.4.30" dependencies = [ "frame-benchmarking", "frame-support", @@ -3890,7 +3890,7 @@ dependencies = [ [[package]] name = "ghost-traits" -version = "0.3.32" +version = "0.3.33" dependencies = [ "frame-support", "sp-runtime 31.0.1", diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml index 5baa041..e224145 100644 --- a/runtime/casper/Cargo.toml +++ b/runtime/casper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-runtime" -version = "3.5.41" +version = "3.5.42" build = "build.rs" description = "Runtime of the Casper Network" edition.workspace = true diff --git a/runtime/casper/src/impls.rs b/runtime/casper/src/impls.rs index 8450e0e..ff830c4 100644 --- a/runtime/casper/src/impls.rs +++ b/runtime/casper/src/impls.rs @@ -1,6 +1,7 @@ use super::*; use frame_support::{dispatch::DispatchResultWithPostInfo, traits::PrivilegeCmp}; use ghost_traits::exposure::ExposureListener; +use ghost_traits::evictor::StakingEvictor; use pallet_alliance::{ProposalIndex, ProposalProvider}; use primitives::Balance; use sp_runtime::DispatchError; @@ -78,6 +79,17 @@ impl PrivilegeCmp for EqualOrGreatestRootCmp { } } +/// Used to evict validators and nominators from the staking pallet. +pub struct RuntimeStakingEvictor(PhantomData); +impl StakingEvictor> for RuntimeStakingEvictor +where + T: pallet_staking::Config, +{ + fn try_evict_validator(who: &AccountIdOf) -> bool { + pallet_staking::Pallet::::do_remove_validator(who) + } +} + /// Used to get the exposure information out of staking pallet directly. pub struct StakingExposureListener(PhantomData); impl ExposureListener> for StakingExposureListener diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs index b7a5bbe..0bc0a7a 100644 --- a/runtime/casper/src/lib.rs +++ b/runtime/casper/src/lib.rs @@ -79,7 +79,7 @@ mod genesis_config_presets; mod impls; mod weights; -pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposureListener}; +pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposureListener, RuntimeStakingEvictor}; // Governance configuration. pub mod cult; @@ -119,8 +119,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("casper"), impl_name: create_runtime_str!("casper-svengali"), authoring_version: 0, - spec_version: 6, - impl_version: 4, + spec_version: 7, + impl_version: 5, apis: RUNTIME_API_VERSIONS, transaction_version: 1, state_version: 1, @@ -1102,6 +1102,7 @@ impl ghost_slow_clap::Config for Runtime { type ReportUnresponsiveness = Offences; type DisabledValidators = Session; type ExposureListener = StakingExposureListener; + type StakingEvictor = RuntimeStakingEvictor; type ApplauseThreshold = ApplauseThreshold;