mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Modify SubstrateBlockAck as needed
Replaces plan IDs with key + ID, letting the coordinator determine the sessions for the plans. Properly scopes which plan IDs are set on which tributaries, and ensures we have the necessary tributaries at time of handling.
This commit is contained in:
@@ -139,9 +139,15 @@ pub mod coordinator {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, Serialize, Deserialize)]
|
||||
pub struct PlanMeta {
|
||||
pub key: Vec<u8>,
|
||||
pub id: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, Serialize, Deserialize)]
|
||||
pub enum ProcessorMessage {
|
||||
SubstrateBlockAck { network: NetworkId, block: u64, plans: Vec<[u8; 32]> },
|
||||
SubstrateBlockAck { network: NetworkId, block: u64, plans: Vec<PlanMeta> },
|
||||
BatchPreprocess { id: SignId, block: BlockHash, preprocess: Vec<u8> },
|
||||
BatchShare { id: SignId, share: [u8; 32] },
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use serai_client::{
|
||||
validator_sets::primitives::{ValidatorSet, KeyPair},
|
||||
};
|
||||
|
||||
use messages::CoordinatorMessage;
|
||||
use messages::{coordinator::PlanMeta, CoordinatorMessage};
|
||||
|
||||
use serai_env as env;
|
||||
|
||||
@@ -344,7 +344,13 @@ async fn handle_coordinator_msg<D: Db, N: Network, Co: Coordinator>(
|
||||
.send(messages::coordinator::ProcessorMessage::SubstrateBlockAck {
|
||||
network: N::NETWORK,
|
||||
block: substrate_block,
|
||||
plans: to_sign.iter().map(|signable| signable.1).collect(),
|
||||
plans: to_sign
|
||||
.iter()
|
||||
.map(|signable| PlanMeta {
|
||||
key: signable.0.to_bytes().as_ref().to_vec(),
|
||||
id: signable.1,
|
||||
})
|
||||
.collect(),
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user