Skip to content

Commit

Permalink
Rename to extract_secret_key for correctness / clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed Aug 6, 2024
1 parent 1afdf40 commit f67231e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contracts/btc-staking/src/finality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn slash_finality_provider(
// Extract BTC SK using the evidence
let pk = eots::PublicKey::from_hex(fp_btc_pk_hex)?;
let btc_sk = pk
.extract(
.extract_secret_key(
&evidence.pub_rand,
&evidence.canonical_app_hash,
&evidence.canonical_finality_sig,
Expand Down Expand Up @@ -1052,7 +1052,7 @@ pub(crate) mod tests {
// Extract the secret key to compare it
let pk = eots::PublicKey::from_hex(&pk_hex).unwrap();
let btc_sk = pk
.extract(
.extract_secret_key(
&pub_rand_one,
&add_finality_signature.block_app_hash,
&finality_signature,
Expand Down
10 changes: 5 additions & 5 deletions packages/eots/src/eots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ impl PublicKey {
Ok(recovered_r.eq(&*r))
}

/// extract extracts the secret key from the public key, public
/// randomness, and two pairs of message hashes and signatures
pub fn extract(
/// `extract_secret_key` extracts the secret key from the public key, public randomness,
/// and two pairs of message hashes and signatures.
pub fn extract_secret_key(
&self,
pub_rand: &[u8],
msg1_hash: &[u8],
Expand Down Expand Up @@ -407,7 +407,7 @@ mod tests {
let sig2 = sk.sign(&sec_rand.to_bytes(), &msg_hash2).unwrap();

let extracted_sk = pk
.extract(
.extract_secret_key(
&pub_rand.to_bytes(),
&msg_hash1,
&sig1.to_bytes(),
Expand Down Expand Up @@ -462,7 +462,7 @@ mod tests {

// extract SK
let extracted_sk = pk
.extract(
.extract_secret_key(
&pr.to_bytes(),
&msg1_hash,
&sig1.to_bytes(),
Expand Down

0 comments on commit f67231e

Please sign in to comment.