fix: 🔧 Remove slashing pallet runtime upgrade logic (post RT400) (#277)

This PR reverts https://github.com/datahaven-xyz/datahaven/pull/272,
included in
[RT400](https://github.com/datahaven-xyz/datahaven/releases/tag/RT400),
as Stagenet / Testnet were upgraded, and the correct `SlashingMode` is
now set for both.

---------

Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
This commit is contained in:
Steve Degosserie 2025-11-10 12:15:29 +01:00 committed by GitHub
parent ff5cd8dc59
commit 7bd5bc8784
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 3505 additions and 17560 deletions

View file

@ -159,10 +159,6 @@ pub mod pallet {
/// The weight information of this pallet.
type WeightInfo: WeightInfo;
/// Slashing mode option configuration
#[pallet::constant]
type SlashingMode: Get<SlashingModeOption>;
}
#[pallet::error]
@ -366,11 +362,6 @@ pub mod pallet {
let processed = Self::process_slashes_queue(T::QueuedSlashesProcessedPerBlock::get());
T::WeightInfo::process_slashes_queue(processed)
}
fn on_runtime_upgrade() -> Weight {
SlashingMode::<T>::put(T::SlashingMode::get());
T::DbWeight::get().writes(1)
}
}
}

View file

@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>
use crate::SlashingModeOption;
use frame_support::traits::OnInitialize;
use pallet_external_validators::traits::ActiveEraInfo;
use pallet_external_validators::traits::EraIndex;
@ -262,14 +261,6 @@ impl external_validator_slashes::Config for Test {
type QueuedSlashesProcessedPerBlock = ConstU32<20>;
type WeightInfo = ();
type SendMessage = MockOkOutboundQueue;
type SlashingMode = SlashingMode;
}
pub struct SlashingMode;
impl Get<SlashingModeOption> for SlashingMode {
fn get() -> SlashingModeOption {
SlashingModeOption::Enabled
}
}
pub struct FullIdentificationOf;

View file

@ -40,7 +40,6 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -1640,12 +1639,10 @@ impl pallet_external_validator_slashes::Config for Runtime {
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = mainnet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::Disabled, SlashingModeOption::Disabled);
}
#[cfg(test)]

View file

@ -40,7 +40,6 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -1645,12 +1644,10 @@ impl pallet_external_validator_slashes::Config for Runtime {
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = stagenet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::LogOnly, SlashingModeOption::LogOnly);
}
#[cfg(test)]

View file

@ -40,7 +40,6 @@ use super::{
MAXIMUM_BLOCK_WEIGHT, NORMAL_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
};
use codec::{Decode, Encode, MaxEncodedLen};
use pallet_external_validator_slashes::SlashingModeOption;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
@ -1646,13 +1645,10 @@ impl pallet_external_validator_slashes::Config for Runtime {
type QueuedSlashesProcessedPerBlock = ConstU32<10>;
type WeightInfo = testnet_weights::pallet_external_validator_slashes::WeightInfo<Runtime>;
type SendMessage = SlashesSendAdapter;
type SlashingMode = SlashingMode;
}
parameter_types! {
pub const SlashDeferDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(0, 0);
pub const SlashingMode: SlashingModeOption = polkadot_runtime_common::prod_or_fast!(SlashingModeOption::Disabled, SlashingModeOption::Disabled);
}
#[cfg(test)]

Binary file not shown.

File diff suppressed because it is too large Load diff

0
test/bun.lockb Executable file → Normal file
View file