diff --git a/processor/messages/src/lib.rs b/processor/messages/src/lib.rs index 17927ffb..c23bfe3d 100644 --- a/processor/messages/src/lib.rs +++ b/processor/messages/src/lib.rs @@ -176,7 +176,7 @@ pub mod substrate { #[derive(Clone, PartialEq, Eq, Debug, Zeroize, Serialize, Deserialize)] pub enum ProcessorMessage { - Update { key: Vec, batch: SignedBatch }, + Update { key: [u8; 32], batch: SignedBatch }, } } diff --git a/processor/src/main.rs b/processor/src/main.rs index 50385d86..d6dd00cb 100644 --- a/processor/src/main.rs +++ b/processor/src/main.rs @@ -158,7 +158,7 @@ struct TributaryMutable { // The safety of this follows as written above. // TODO: There should only be one SubstrateSigner at a time (see #277) - substrate_signers: HashMap, SubstrateSigner>, + substrate_signers: HashMap<[u8; 32], SubstrateSigner>, } // Items which are mutably borrowed by Substrate. @@ -373,10 +373,9 @@ async fn handle_coordinator_msg( // See TributaryMutable's struct definition for why this block is safe let KeyConfirmed { substrate_keys, network_keys } = tributary_mutable.key_gen.confirm(txn, set, key_pair).await; - tributary_mutable.substrate_signers.insert( - substrate_keys.group_key().to_bytes().to_vec(), - SubstrateSigner::new(substrate_keys), - ); + tributary_mutable + .substrate_signers + .insert(substrate_keys.group_key().to_bytes(), SubstrateSigner::new(substrate_keys)); let key = network_keys.group_key(); @@ -520,7 +519,7 @@ async fn boot( let substrate_signer = SubstrateSigner::new(substrate_keys); // We don't have to load any state for this since the Scanner will re-fire any events // necessary - substrate_signers.insert(substrate_key.to_bytes().to_vec(), substrate_signer); + substrate_signers.insert(substrate_key.to_bytes(), substrate_signer); let mut signer = Signer::new(network.clone(), network_keys); @@ -612,7 +611,7 @@ async fn run(mut raw_db: D, network: N, mut SubstrateSignerEvent::SignedBatch(batch) => { coordinator .send(ProcessorMessage::Substrate(messages::substrate::ProcessorMessage::Update { - key: key.clone(), + key: *key, batch, })) .await; diff --git a/tests/processor/src/tests/batch.rs b/tests/processor/src/tests/batch.rs index 25391524..41e0adf3 100644 --- a/tests/processor/src/tests/batch.rs +++ b/tests/processor/src/tests/batch.rs @@ -125,7 +125,7 @@ pub(crate) async fn sign_batch( key, batch: this_batch, }) => { - assert_eq!(&key, &id.key); + assert_eq!(key.as_slice(), &id.key); if batch.is_none() { assert!(PublicKey::from_raw(id.key.clone().try_into().unwrap())