mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Handle sign::ProcessorMessage::[Preprocesses, Shares]
This commit is contained in:
@@ -24,7 +24,7 @@ use serai_task::{Task, TaskHandle, ContinuallyRan};
|
|||||||
|
|
||||||
use serai_cosign::{Faulted, SignedCosign, Cosigning};
|
use serai_cosign::{Faulted, SignedCosign, Cosigning};
|
||||||
use serai_coordinator_substrate::{CanonicalEventStream, EphemeralEventStream, SignSlashReport};
|
use serai_coordinator_substrate::{CanonicalEventStream, EphemeralEventStream, SignSlashReport};
|
||||||
use serai_coordinator_tributary::{Signed, Transaction, SubstrateBlockPlans};
|
use serai_coordinator_tributary::{SigningProtocolRound, Signed, Transaction, SubstrateBlockPlans};
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
use db::*;
|
use db::*;
|
||||||
@@ -216,9 +216,41 @@ async fn handle_processor_messages(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
messages::sign::ProcessorMessage::Preprocesses { id, preprocesses } => {
|
messages::sign::ProcessorMessage::Preprocesses { id, preprocesses } => {
|
||||||
todo!("TODO Transaction::Batch + Transaction::Sign")
|
let set = ValidatorSet { network, session: id.session };
|
||||||
|
if id.attempt == 0 {
|
||||||
|
// Batches are declared by their intent to be signed
|
||||||
|
// TODO: Document this in processor <-> coordinator rebuild issue
|
||||||
|
if let messages::sign::VariantSignId::Batch(hash) = id.id {
|
||||||
|
TributaryTransactions::send(&mut txn, set, &Transaction::Batch { hash });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TributaryTransactions::send(
|
||||||
|
&mut txn,
|
||||||
|
set,
|
||||||
|
&Transaction::Sign {
|
||||||
|
id: id.id,
|
||||||
|
attempt: id.attempt,
|
||||||
|
round: SigningProtocolRound::Preprocess,
|
||||||
|
data: preprocesses,
|
||||||
|
signed: Signed::default(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
messages::sign::ProcessorMessage::Shares { id, shares } => {
|
||||||
|
let set = ValidatorSet { network, session: id.session };
|
||||||
|
TributaryTransactions::send(
|
||||||
|
&mut txn,
|
||||||
|
set,
|
||||||
|
&Transaction::Sign {
|
||||||
|
id: id.id,
|
||||||
|
attempt: id.attempt,
|
||||||
|
round: SigningProtocolRound::Share,
|
||||||
|
data: shares,
|
||||||
|
signed: Signed::default(),
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
messages::sign::ProcessorMessage::Shares { id, shares } => todo!("TODO Transaction::Sign"),
|
|
||||||
},
|
},
|
||||||
messages::ProcessorMessage::Coordinator(msg) => match msg {
|
messages::ProcessorMessage::Coordinator(msg) => match msg {
|
||||||
messages::coordinator::ProcessorMessage::CosignedBlock { cosign } => {
|
messages::coordinator::ProcessorMessage::CosignedBlock { cosign } => {
|
||||||
|
|||||||
@@ -259,9 +259,7 @@ impl TransactionTrait for Transaction {
|
|||||||
|
|
||||||
Transaction::Cosign { .. } => TransactionKind::Provided("Cosign"),
|
Transaction::Cosign { .. } => TransactionKind::Provided("Cosign"),
|
||||||
Transaction::Cosigned { .. } => TransactionKind::Provided("Cosigned"),
|
Transaction::Cosigned { .. } => TransactionKind::Provided("Cosigned"),
|
||||||
// TODO: Provide this
|
|
||||||
Transaction::SubstrateBlock { .. } => TransactionKind::Provided("SubstrateBlock"),
|
Transaction::SubstrateBlock { .. } => TransactionKind::Provided("SubstrateBlock"),
|
||||||
// TODO: Provide this
|
|
||||||
Transaction::Batch { .. } => TransactionKind::Provided("Batch"),
|
Transaction::Batch { .. } => TransactionKind::Provided("Batch"),
|
||||||
|
|
||||||
Transaction::Sign { id, attempt, round, signed, .. } => TransactionKind::Signed(
|
Transaction::Sign { id, attempt, round, signed, .. } => TransactionKind::Signed(
|
||||||
|
|||||||
Reference in New Issue
Block a user