mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Remove Session from VariantSignId::SlashReport
It's only there to make the VariantSignid unique across Sessions. By localizing the VariantSignid to a Session, we avoid this, and can better ensure we don't queue work for historic sessions.
This commit is contained in:
@@ -14,7 +14,7 @@ use messages::sign::{VariantSignId, SignId, ProcessorMessage};
|
||||
|
||||
create_db!(
|
||||
FrostAttemptManager {
|
||||
Attempted: (id: VariantSignId) -> u32,
|
||||
Attempted: (session: Session, id: VariantSignId) -> u32,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -92,11 +92,11 @@ impl<D: Db, M: Clone + PreprocessMachine> SigningProtocol<D, M> {
|
||||
*/
|
||||
{
|
||||
let mut txn = self.db.txn();
|
||||
let prior_attempted = Attempted::get(&txn, self.id);
|
||||
let prior_attempted = Attempted::get(&txn, self.session, self.id);
|
||||
if Some(attempt) <= prior_attempted {
|
||||
return vec![];
|
||||
}
|
||||
Attempted::set(&mut txn, self.id, &attempt);
|
||||
Attempted::set(&mut txn, self.session, self.id, &attempt);
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ impl<D: Db, M: Clone + PreprocessMachine> SigningProtocol<D, M> {
|
||||
}
|
||||
|
||||
/// Cleanup the database entries for a specified signing protocol.
|
||||
pub(crate) fn cleanup(txn: &mut impl DbTxn, id: VariantSignId) {
|
||||
Attempted::del(txn, id);
|
||||
pub(crate) fn cleanup(txn: &mut impl DbTxn, session: Session, id: VariantSignId) {
|
||||
Attempted::del(txn, session, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ impl<D: Db, M: Clone + PreprocessMachine> AttemptManager<D, M> {
|
||||
|
||||
/// Register a signing protocol to attempt.
|
||||
///
|
||||
/// This ID must be unique across all sessions, attempt managers, protocols, etc.
|
||||
/// This ID must be unique to the session, across all attempt managers, protocols, etc.
|
||||
pub fn register(&mut self, id: VariantSignId, machines: Vec<M>) -> Vec<ProcessorMessage> {
|
||||
let mut protocol =
|
||||
SigningProtocol::new(self.db.clone(), self.session, self.start_i, id, machines);
|
||||
@@ -66,7 +66,7 @@ impl<D: Db, M: Clone + PreprocessMachine> AttemptManager<D, M> {
|
||||
} else {
|
||||
log::info!("retired signing protocol {id:?}");
|
||||
}
|
||||
SigningProtocol::<D, M>::cleanup(txn, id);
|
||||
SigningProtocol::<D, M>::cleanup(txn, self.session, id);
|
||||
}
|
||||
|
||||
/// Handle a message for a signing protocol.
|
||||
|
||||
Reference in New Issue
Block a user