Skip to content

Commit 54f8ab5

Browse files
committed
ensure deterministic reshard input
1 parent 69c006d commit 54f8ab5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/qos_client/src/cli/services.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,8 @@ pub(crate) fn reshard_re_encrypt_share(
15521552
unsafe_auto_confirm,
15531553
}: ReshardReEncryptShareArgs,
15541554
) -> Result<(), Error> {
1555-
let reshard_input = read_reshard_input(reshard_input_path)?;
1555+
let mut reshard_input = read_reshard_input(reshard_input_path)?;
1556+
reshard_input.deterministic();
15561557
let attestation_doc =
15571558
read_attestation_doc(&attestation_doc_path, unsafe_skip_attestation)?;
15581559
let mut new_share_set = get_share_set(&new_share_set_dir);

src/qos_core/src/protocol/services/attestation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ pub(in crate::protocol) fn reshard_attestation_doc(
2727
) -> Result<NsmResponse, ProtocolError> {
2828
let ephemeral_public_key =
2929
state.handles.get_ephemeral_key()?.public_key().to_bytes();
30-
let reshard_input = state
30+
let mut reshard_input = state
3131
.reshard_input
3232
.clone()
3333
.ok_or(ProtocolError::MissingReshardInput)?;
34+
reshard_input.deterministic();
3435

3536
Ok(get_post_boot_attestation_doc(
3637
&*state.attestor,

src/qos_core/src/protocol/services/reshard.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ pub struct ReshardInput {
8585
}
8686

8787
impl ReshardInput {
88-
fn deterministic(&mut self) {
88+
/// Make sure reshard input is deterministic
89+
pub fn deterministic(&mut self) {
8990
self.quorum_keys.sort();
9091
}
9192

@@ -249,12 +250,13 @@ pub(in crate::protocol) fn reshard_provision(
249250
input: ReshardProvisionInput,
250251
state: &mut ProtocolState,
251252
) -> Result<bool, ProtocolError> {
252-
let reshard_input = state
253+
let mut reshard_input = state
253254
.reshard_input
254255
.as_ref()
255256
.ok_or(ProtocolError::MissingReshardInput)?
256257
.clone();
257258

259+
reshard_input.deterministic();
258260
input.approval.verify(&reshard_input.qos_hash())?;
259261

260262
if !reshard_input.old_share_set.members.contains(&input.approval.member) {

0 commit comments

Comments
 (0)