diff --git a/coordinator/src/tributary/handle.rs b/coordinator/src/tributary/handle.rs index cfd67342..ebc44248 100644 --- a/coordinator/src/tributary/handle.rs +++ b/coordinator/src/tributary/handle.rs @@ -530,15 +530,27 @@ pub(crate) async fn handle_application_tx< Accumulation::NotReady => {} } } - Transaction::SignCompleted { plan, tx_hash, .. } => { + Transaction::SignCompleted { plan, tx_hash, first_signer, signature: _ } => { log::info!( "on-chain SignCompleted claims {} completes {}", hex::encode(&tx_hash), hex::encode(plan) ); - // TODO: Confirm this is a valid plan ID + + if TributaryDb::::attempt(txn, genesis, Topic::Sign(plan)).is_none() { + fatal_slash::( + txn, + genesis, + first_signer.to_bytes(), + "claimed an unrecognized plan was completed", + ); + return; + }; + // TODO: Confirm this signer hasn't prior published a completion - let Some(key_pair) = TributaryDb::::key_pair(txn, spec.set()) else { todo!() }; + let Some(key_pair) = TributaryDb::::key_pair(txn, spec.set()) else { + panic!("SignCompleted for recognized plan ID despite not having a key pair for this set") + }; processors .send( spec.set().network, diff --git a/processor/src/signer.rs b/processor/src/signer.rs index bf73c272..36943962 100644 --- a/processor/src/signer.rs +++ b/processor/src/signer.rs @@ -329,7 +329,6 @@ impl Signer { } } else { // 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::::completions(txn, id).is_empty()); info!( "signer {} informed of the eventuality completion for plan {}, {}",