From cc300fefb01a00c5c5ce35fd78cd281835c7e940 Mon Sep 17 00:00:00 2001 From: Uncle Stinky Date: Tue, 24 Feb 2026 22:06:54 +0300 Subject: [PATCH] apply changes to casper runtime; migrations are included Signed-off-by: Uncle Stinky --- Cargo.lock | 9 ++--- runtime/casper/Cargo.toml | 2 +- runtime/casper/src/lib.rs | 35 ++++++++++--------- runtime/casper/src/weights/ghost_slow_clap.rs | 4 +++ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f303ccb..b9fe5b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "casper-runtime" -version = "3.5.37" +version = "3.5.38" dependencies = [ "casper-runtime-constants", "frame-benchmarking", @@ -3650,13 +3650,14 @@ dependencies = [ [[package]] name = "ghost-networks" -version = "0.1.20" +version = "0.1.25" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", "ghost-core-primitives", "ghost-traits", + "log", "num-traits", "pallet-balances", "pallet-staking", @@ -3837,7 +3838,7 @@ dependencies = [ [[package]] name = "ghost-slow-clap" -version = "0.4.14" +version = "0.4.24" dependencies = [ "frame-benchmarking", "frame-support", @@ -3889,7 +3890,7 @@ dependencies = [ [[package]] name = "ghost-traits" -version = "0.3.26" +version = "0.3.31" dependencies = [ "frame-support", "sp-runtime 31.0.1", diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml index 1887fbc..0de7503 100644 --- a/runtime/casper/Cargo.toml +++ b/runtime/casper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-runtime" -version = "3.5.37" +version = "3.5.38" build = "build.rs" description = "Runtime of the Casper Network" edition.workspace = true diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs index c9ee036..60aa2ba 100644 --- a/runtime/casper/src/lib.rs +++ b/runtime/casper/src/lib.rs @@ -117,11 +117,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("casper"), impl_name: create_runtime_str!("casper-svengali"), authoring_version: 0, - spec_version: 4, - impl_version: 3, + spec_version: 5, + impl_version: 4, apis: RUNTIME_API_VERSIONS, transaction_version: 1, - state_version: 1, + state_version: 2, }; /// The BABE epoch configuration at genesis. @@ -218,10 +218,7 @@ impl pallet_preimage::Config for Runtime { } parameter_types! { - pub const EpochDuration: u64 = prod_or_fast!( - EPOCH_DURATION_IN_SLOTS as u64, - 2 * MINUTES as u64 - ); + pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64; pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; pub const ReportLongevity: u64 = BondingDuration::get() as u64 * @@ -332,14 +329,8 @@ impl pallet_session::historical::Config for Runtime { } parameter_types! { - pub SignedPhase: u32 = prod_or_fast!( - EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) - ); - pub UnsignedPhase: u32 = prod_or_fast!( - EPOCH_DURATION_IN_SLOTS / 4, - (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) - ); + pub SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; + pub UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4; // signed config pub const SignedMaxSubmissions: u32 = 16; @@ -1029,6 +1020,7 @@ impl ghost_networks::Config for Runtime { type RuntimeEvent = RuntimeEvent; type NetworkId = u64; type Currency = Balances; + type MaxNetworks = ConstU32<30>; type RegisterOrigin = EitherOf>, Ghosts>; type UpdateOrigin = EitherOf>, Zombies>; @@ -1059,7 +1051,12 @@ impl ghost_claims::Config for Runtime { parameter_types! { // will be used in `Perbill::from_parts()` - pub const ApplauseThreshold: u32 = 500_000_000; + pub const ApplauseThreshold: u32 = if cfg!(feature = "runtime-benchmarks") { + 0 + } else { + 500_000_000 + }; + pub const MinAuthoritiesNumber: u32 = 5; pub const SlowClapUnsignedPriority: TransactionPriority = TransactionPriority::MAX; pub const SlowClapHistoryDepth: sp_staking::SessionIndex = @@ -1083,6 +1080,7 @@ impl ghost_slow_clap::Config for Runtime { type UnsignedPriority = SlowClapUnsignedPriority; type HistoryDepth = SlowClapHistoryDepth; type MinAuthoritiesNumber = MinAuthoritiesNumber; + type EpochDuration = EpochDuration; type WeightInfo = weights::ghost_slow_clap::WeightInfo; } @@ -1185,7 +1183,10 @@ pub type SignedExtra = ( /// All migrations that will run on the next runtime upgrade. /// Should be cleared after release. -pub type Migrations = (); +pub type Migrations = ( + ghost_networks::migrations::MigrateV0ToV1, + ghost_slow_clap::migrations::MigrateV2ToV3, +); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = diff --git a/runtime/casper/src/weights/ghost_slow_clap.rs b/runtime/casper/src/weights/ghost_slow_clap.rs index 2eb7982..191ae8a 100644 --- a/runtime/casper/src/weights/ghost_slow_clap.rs +++ b/runtime/casper/src/weights/ghost_slow_clap.rs @@ -104,4 +104,8 @@ impl ghost_slow_clap::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(1)) } + + fn try_offend_validators(_offenders_len: u32) -> Weight { + Default::default() + } }