pub trait CollateralSlasher {
// Required method
fn credit(&mut self, validator_index: u32, amount_mojos: u64);
// Provided method
fn slash(
&mut self,
_validator_index: u32,
_amount_mojos: u64,
_epoch: u64,
) -> Result<(u64, u64), CollateralError> { ... }
}Expand description
Collateral-slash reversal surface.
Traces to SPEC §15.3, catalogue row DSL-065.
§Consumer
- Appeal adjudication (DSL-065) calls
credit(validator_index, amount_mojos)per reverted validator when aCollateralSlasheris supplied. Semantically a revert of the consensus-layer collateral debit that ran alongside theValidatorEntry::slash_absolutestake debit at admission.
§Optional wiring
Light-client deployments may not track collateral at all. The
adjudicator accepts Option<&mut dyn CollateralSlasher> and
no-ops when None — collateral revert is a full-node concern.
§Idempotence
The trait does not specify idempotence. Callers MUST call
credit exactly once per reverted validator — the adjudicator
does so by construction (one pass over base_slash_per_validator).
Required Methods§
Provided Methods§
Sourcefn slash(
&mut self,
_validator_index: u32,
_amount_mojos: u64,
_epoch: u64,
) -> Result<(u64, u64), CollateralError>
fn slash( &mut self, _validator_index: u32, _amount_mojos: u64, _epoch: u64, ) -> Result<(u64, u64), CollateralError>
Debit amount_mojos of collateral from validator_index
at epoch. Implements the slash leg of DSL-139; companion
to credit.
Default impl returns Err(CollateralError::NoCollateral):
current production wiring only uses credit (via
DSL-129 reorg rewind + DSL-065 sustained-appeal revert);
collateral debits land later under a consensus-layer
slasher. Providing a default keeps every existing
impl CollateralSlasher (test spies + future production
impls) working without a breaking signature change.
§Returns
Ok((slashed, remaining))— actual debit and post- debit collateral balance.Err(CollateralError::NoCollateral)— validator has no collateral position. Soft failure; DSL-022 submit_evidence ignores this and still slashes stake.