mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-24 11:36:18 +00:00
Slash on SignCompleted for unrecognized plan
This commit is contained in:
parent
b8ac8e697b
commit
de41be6e26
2 changed files with 15 additions and 4 deletions
|
@ -530,15 +530,27 @@ pub(crate) async fn handle_application_tx<
|
||||||
Accumulation::NotReady => {}
|
Accumulation::NotReady => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Transaction::SignCompleted { plan, tx_hash, .. } => {
|
Transaction::SignCompleted { plan, tx_hash, first_signer, signature: _ } => {
|
||||||
log::info!(
|
log::info!(
|
||||||
"on-chain SignCompleted claims {} completes {}",
|
"on-chain SignCompleted claims {} completes {}",
|
||||||
hex::encode(&tx_hash),
|
hex::encode(&tx_hash),
|
||||||
hex::encode(plan)
|
hex::encode(plan)
|
||||||
);
|
);
|
||||||
// TODO: Confirm this is a valid plan ID
|
|
||||||
|
if TributaryDb::<D>::attempt(txn, genesis, Topic::Sign(plan)).is_none() {
|
||||||
|
fatal_slash::<D>(
|
||||||
|
txn,
|
||||||
|
genesis,
|
||||||
|
first_signer.to_bytes(),
|
||||||
|
"claimed an unrecognized plan was completed",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Confirm this signer hasn't prior published a completion
|
// TODO: Confirm this signer hasn't prior published a completion
|
||||||
let Some(key_pair) = TributaryDb::<D>::key_pair(txn, spec.set()) else { todo!() };
|
let Some(key_pair) = TributaryDb::<D>::key_pair(txn, spec.set()) else {
|
||||||
|
panic!("SignCompleted for recognized plan ID despite not having a key pair for this set")
|
||||||
|
};
|
||||||
processors
|
processors
|
||||||
.send(
|
.send(
|
||||||
spec.set().network,
|
spec.set().network,
|
||||||
|
|
|
@ -329,7 +329,6 @@ impl<N: Network, D: Db> Signer<N, D> {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we don't have this in RAM, it should be because we already finished signing it
|
// If we don't have this in RAM, it should be because we already finished signing it
|
||||||
// TODO: Will the coordinator ever send us Completed for an unknown ID?
|
|
||||||
assert!(!SignerDb::<N, D>::completions(txn, id).is_empty());
|
assert!(!SignerDb::<N, D>::completions(txn, id).is_empty());
|
||||||
info!(
|
info!(
|
||||||
"signer {} informed of the eventuality completion for plan {}, {}",
|
"signer {} informed of the eventuality completion for plan {}, {}",
|
||||||
|
|
Loading…
Reference in a new issue