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:
Luke Parker
2023-10-14 20:37:54 -04:00
parent 62e1d63f47
commit 584943d1e9
7 changed files with 62 additions and 18 deletions

View File

@@ -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] },
}

View File

@@ -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;
}