mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Add dedicated BatchSignId
This commit is contained in:
@@ -106,15 +106,22 @@ pub mod sign {
|
||||
}
|
||||
|
||||
pub mod coordinator {
|
||||
use super::{sign::SignId, *};
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug, Zeroize, Encode, Decode, Serialize, Deserialize)]
|
||||
pub struct BatchSignId {
|
||||
pub key: [u8; 32],
|
||||
pub id: [u8; 5],
|
||||
pub attempt: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
pub enum CoordinatorMessage {
|
||||
// Uses Vec<u8> instead of [u8; 64] since serde Deserialize isn't implemented for [u8; 64]
|
||||
BatchPreprocesses { id: SignId, preprocesses: HashMap<Participant, Vec<u8>> },
|
||||
BatchShares { id: SignId, shares: HashMap<Participant, [u8; 32]> },
|
||||
BatchPreprocesses { id: BatchSignId, preprocesses: HashMap<Participant, Vec<u8>> },
|
||||
BatchShares { id: BatchSignId, shares: HashMap<Participant, [u8; 32]> },
|
||||
// Re-attempt a batch signing protocol.
|
||||
BatchReattempt { id: SignId },
|
||||
BatchReattempt { id: BatchSignId },
|
||||
}
|
||||
|
||||
impl CoordinatorMessage {
|
||||
@@ -148,8 +155,8 @@ pub mod coordinator {
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, Serialize, Deserialize)]
|
||||
pub enum ProcessorMessage {
|
||||
SubstrateBlockAck { network: NetworkId, block: u64, plans: Vec<PlanMeta> },
|
||||
BatchPreprocess { id: SignId, block: BlockHash, preprocesses: Vec<Vec<u8>> },
|
||||
BatchShare { id: SignId, shares: Vec<[u8; 32]> },
|
||||
BatchPreprocess { id: BatchSignId, block: BlockHash, preprocesses: Vec<Vec<u8>> },
|
||||
BatchShare { id: BatchSignId, shares: Vec<[u8; 32]> },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +366,7 @@ impl ProcessorMessage {
|
||||
coordinator::ProcessorMessage::SubstrateBlockAck { network, block, .. } => {
|
||||
(0, (network, block).encode())
|
||||
}
|
||||
// Unique since SignId
|
||||
// Unique since BatchSignId
|
||||
coordinator::ProcessorMessage::BatchPreprocess { id, .. } => (1, id.encode()),
|
||||
coordinator::ProcessorMessage::BatchShare { id, .. } => (2, id.encode()),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user