forked from ghostchain/ghost-node
use new logic from slow-clap for casper runtime
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
c112ad22c2
commit
5e17c12677
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<OriginCaller> for EqualOrGreatestRootCmp {
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to evict validators and nominators from the staking pallet.
|
||||
pub struct RuntimeStakingEvictor<T>(PhantomData<T>);
|
||||
impl<T> StakingEvictor<AccountIdOf<T>> for RuntimeStakingEvictor<T>
|
||||
where
|
||||
T: pallet_staking::Config,
|
||||
{
|
||||
fn try_evict_validator(who: &AccountIdOf<T>) -> bool {
|
||||
pallet_staking::Pallet::<T>::do_remove_validator(who)
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to get the exposure information out of staking pallet directly.
|
||||
pub struct StakingExposureListener<T>(PhantomData<T>);
|
||||
impl<T> ExposureListener<Balance, AccountIdOf<T>> for StakingExposureListener<T>
|
||||
|
||||
@ -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<Runtime>;
|
||||
type StakingEvictor = RuntimeStakingEvictor<Runtime>;
|
||||
|
||||
type ApplauseThreshold = ApplauseThreshold;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user