-
Notifications
You must be signed in to change notification settings - Fork 19
chore: deterministic backward compatibility tests #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,14 +376,22 @@ impl Custodian { | |
| }) | ||
| } | ||
|
|
||
| // We allow the following lints because we are fine with mutating the rng even if | ||
| // we end up returning an error when signing the encrypted share. | ||
| #[allow(unknown_lints)] | ||
| #[allow(non_local_effect_before_error_return)] | ||
| pub fn generate_setup_message<R: Rng + CryptoRng>( | ||
| &self, | ||
| rng: &mut R, | ||
| custodian_name: String, // This is the human readable name of the custodian to be used in the setup message | ||
| ) -> Result<InternalCustodianSetupMessage, BackupError> { | ||
| let timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(); | ||
| self.generate_setup_message_with_timestamp(rng, custodian_name, timestamp) | ||
| } | ||
|
|
||
| // The timestamp is taken as an explicit argument so that callers needing deterministic | ||
| // output (e.g. backward-compatibility data generators) can pass a fixed value. | ||
| pub fn generate_setup_message_with_timestamp<R: Rng + CryptoRng>( | ||
| &self, | ||
| rng: &mut R, | ||
| custodian_name: String, | ||
| timestamp: u64, | ||
| ) -> Result<InternalCustodianSetupMessage, BackupError> { | ||
|
Comment on lines
+383
to
395
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need both of these? Is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a bit tricky, |
||
| let mut random_value = [0u8; 32]; | ||
| rng.fill_bytes(&mut random_value); | ||
|
|
@@ -392,7 +400,7 @@ impl Custodian { | |
| header: HEADER.to_string(), | ||
| custodian_role: self.role, | ||
| random_value, | ||
| timestamp: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(), | ||
| timestamp, | ||
| public_enc_key: self.enc_key.clone(), | ||
| public_verf_key: self.verification_key().clone(), | ||
| name: custodian_name, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 904f248