datahaven/operator/pallets/external-validators/Cargo.toml
undercover-cactus f0896907ae
feat: add slashing support (#242)
## 🔨 Add Slashing Support for Runtime

This PR introduces the slashing functionality for the DataHaven runtime,
enabling punitive measures against misbehaving validators.


### Features
- Deferred slashing with configurable veto periods
- Cross-chain slashing message delivery trough Snowbridge
- Governance controls for slashing parameters and emergency cancellation

We introduced the `external-validator-slashes` pallet, which allows to
slash validators that misbehave. The slashing is triggered when an
offence is reported via the offence pallet (which is already
implemented). The message is sent through Snowbrige's outbound queue and
the real slashing happens in the contracts side, which will come in a
follow up PR.

There is a configurable window of time between the time the validator is
being reported, and the time the slash is triggered. This allows that in
case of an error we are still able to cancel the slashing, using a sudo
account.

For convenience, we also have extrinsics for corner cases:

- **`force_inject_slash`**: Root-only function to manually inject
slashes for specific validators with custom percentages. Useful for
emergency situations or governance-directed slashing outside normal
offence detection
- **`cancel_deferred_slash`**: Allows governance to cancel pending
slashes during the defer period by specifying era and slash indices.
Provides safety mechanism against false positives or malicious slash
reports
- **`set_slashing_mode`**: Configurable slashing behavior with three
modes - `Enabled` (normal operation), `LogOnly` (track offences without
applying slashes), and `Disabled` (completely halt slashing). Critical
for emergency response and testing

---------

Co-authored-by: Gonza Montiel <gon.montiel@gmail.com>
Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00

79 lines
2 KiB
TOML

[package]
name = "pallet-external-validators"
authors = { workspace = true }
description = "Simple pallet to store external validators."
edition = "2021"
license = "GPL-3.0-only"
version = { workspace = true }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[lints]
workspace = true
[dependencies]
log = { workspace = true }
parity-scale-codec = { workspace = true }
rand = { workspace = true, optional = true }
scale-info = { workspace = true, features = ["derive"] }
macro_rules_attribute = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
impl-trait-for-tuples = { workspace = true }
sp-runtime = { workspace = true }
sp-staking = { workspace = true }
sp-std = { workspace = true }
sp-core = { workspace = true }
frame-benchmarking = { workspace = true }
pallet-balances = { workspace = true, optional = true }
pallet-session = { workspace = true, features = ["historical"] }
snowbridge-outbound-queue-primitives = { workspace = true }
[dev-dependencies]
pallet-timestamp = { workspace = true }
sp-io = { workspace = true }
[features]
default = ["std"]
std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-balances/std",
"pallet-session/std",
"pallet-timestamp/std",
"parity-scale-codec/std",
"rand?/std",
"scale-info/std",
"snowbridge-outbound-queue-primitives/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-staking/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"rand",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances?/try-runtime",
"pallet-session/try-runtime",
"pallet-timestamp/try-runtime",
"sp-runtime/try-runtime",
]