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]]
|
[[package]]
|
||||||
name = "casper-runtime"
|
name = "casper-runtime"
|
||||||
version = "3.5.41"
|
version = "3.5.42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"casper-runtime-constants",
|
"casper-runtime-constants",
|
||||||
"frame-benchmarking",
|
"frame-benchmarking",
|
||||||
@ -3838,7 +3838,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ghost-slow-clap"
|
name = "ghost-slow-clap"
|
||||||
version = "0.4.28"
|
version = "0.4.30"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"frame-benchmarking",
|
"frame-benchmarking",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
@ -3890,7 +3890,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ghost-traits"
|
name = "ghost-traits"
|
||||||
version = "0.3.32"
|
version = "0.3.33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"frame-support",
|
"frame-support",
|
||||||
"sp-runtime 31.0.1",
|
"sp-runtime 31.0.1",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "casper-runtime"
|
name = "casper-runtime"
|
||||||
version = "3.5.41"
|
version = "3.5.42"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
description = "Runtime of the Casper Network"
|
description = "Runtime of the Casper Network"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use frame_support::{dispatch::DispatchResultWithPostInfo, traits::PrivilegeCmp};
|
use frame_support::{dispatch::DispatchResultWithPostInfo, traits::PrivilegeCmp};
|
||||||
use ghost_traits::exposure::ExposureListener;
|
use ghost_traits::exposure::ExposureListener;
|
||||||
|
use ghost_traits::evictor::StakingEvictor;
|
||||||
use pallet_alliance::{ProposalIndex, ProposalProvider};
|
use pallet_alliance::{ProposalIndex, ProposalProvider};
|
||||||
use primitives::Balance;
|
use primitives::Balance;
|
||||||
use sp_runtime::DispatchError;
|
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.
|
/// Used to get the exposure information out of staking pallet directly.
|
||||||
pub struct StakingExposureListener<T>(PhantomData<T>);
|
pub struct StakingExposureListener<T>(PhantomData<T>);
|
||||||
impl<T> ExposureListener<Balance, AccountIdOf<T>> for StakingExposureListener<T>
|
impl<T> ExposureListener<Balance, AccountIdOf<T>> for StakingExposureListener<T>
|
||||||
|
|||||||
@ -79,7 +79,7 @@ mod genesis_config_presets;
|
|||||||
mod impls;
|
mod impls;
|
||||||
mod weights;
|
mod weights;
|
||||||
|
|
||||||
pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposureListener};
|
pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposureListener, RuntimeStakingEvictor};
|
||||||
|
|
||||||
// Governance configuration.
|
// Governance configuration.
|
||||||
pub mod cult;
|
pub mod cult;
|
||||||
@ -119,8 +119,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
|||||||
spec_name: create_runtime_str!("casper"),
|
spec_name: create_runtime_str!("casper"),
|
||||||
impl_name: create_runtime_str!("casper-svengali"),
|
impl_name: create_runtime_str!("casper-svengali"),
|
||||||
authoring_version: 0,
|
authoring_version: 0,
|
||||||
spec_version: 6,
|
spec_version: 7,
|
||||||
impl_version: 4,
|
impl_version: 5,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
state_version: 1,
|
state_version: 1,
|
||||||
@ -1102,6 +1102,7 @@ impl ghost_slow_clap::Config for Runtime {
|
|||||||
type ReportUnresponsiveness = Offences;
|
type ReportUnresponsiveness = Offences;
|
||||||
type DisabledValidators = Session;
|
type DisabledValidators = Session;
|
||||||
type ExposureListener = StakingExposureListener<Runtime>;
|
type ExposureListener = StakingExposureListener<Runtime>;
|
||||||
|
type StakingEvictor = RuntimeStakingEvictor<Runtime>;
|
||||||
|
|
||||||
type ApplauseThreshold = ApplauseThreshold;
|
type ApplauseThreshold = ApplauseThreshold;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user