mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
add reasons to slash evidence (#414)
* add reasons to slash evidence * fix CI failing * Remove unnecessary clones .encode() takes &self * InvalidVr to InvalidValidRound * Unrelated to this PR: Clarify reasoning/potentials behind dropping evidence * Clarify prevotes in SlashEvidence test * Replace use of read_to_end * Restore decode_signed_message --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -319,19 +319,19 @@ impl<D: Db, T: TransactionTrait, P: P2p> Network for TendermintNetwork<D, T, P>
|
||||
self.p2p.broadcast(self.genesis, to_broadcast).await
|
||||
}
|
||||
|
||||
async fn slash(&mut self, validator: Self::ValidatorId, slash_event: SlashEvent<Self>) {
|
||||
async fn slash(&mut self, validator: Self::ValidatorId, slash_event: SlashEvent) {
|
||||
log::error!(
|
||||
"validator {} triggered a slash event on tributary {} (with evidence: {})",
|
||||
hex::encode(validator),
|
||||
hex::encode(self.genesis),
|
||||
matches!(slash_event, SlashEvent::WithEvidence(_, _)),
|
||||
matches!(slash_event, SlashEvent::WithEvidence(_)),
|
||||
);
|
||||
|
||||
let signer = self.signer();
|
||||
let Some(tx) = (match slash_event {
|
||||
SlashEvent::WithEvidence(m1, m2) => {
|
||||
SlashEvent::WithEvidence(evidence) => {
|
||||
// create an unsigned evidence tx
|
||||
Some(TendermintTx::SlashEvidence((m1, m2).encode()))
|
||||
Some(TendermintTx::SlashEvidence(evidence))
|
||||
}
|
||||
SlashEvent::Id(_reason, _block, _round) => {
|
||||
// TODO: Increase locally observed slash points
|
||||
|
||||
Reference in New Issue
Block a user