Skip to content

Commit

Permalink
key_manager serialization fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad committed Nov 13, 2024
1 parent b30e321 commit 974df57
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cosmwasm/enclaves/shared/utils/src/key_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ impl Keychain {
writer.write_all(&val_size.to_le_bytes())?;
writer.write_all(&self.validator_set_for_height.validator_set)?;

if let Some(val) = self.next_mr_enclave {
writer.write_all(&[1 as u8])?;
writer.write_all(&val.m)?;
} else {
writer.write_all(&[0 as u8])?;
}

Ok(())
}

Expand Down Expand Up @@ -118,6 +125,13 @@ impl Keychain {
self.validator_set_for_height.validator_set = vec![0u8; val_size as usize];
reader.read_exact(&mut self.validator_set_for_height.validator_set)?;

reader.read_exact(&mut flag_bytes)?;
if flag_bytes[0] != 0 {
let mut val = sgx_types::sgx_measurement_t::default();
reader.read_exact(&mut val.m)?;
self.next_mr_enclave = Some(val);
}

Ok(())
}

Expand Down

0 comments on commit 974df57

Please sign in to comment.