mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Update everything which uses dkg to the new APIs
This commit is contained in:
@@ -107,8 +107,13 @@ impl Zeroize for KeyPair {
|
||||
}
|
||||
|
||||
/// The MuSig context for a validator set.
|
||||
pub fn musig_context(set: ValidatorSet) -> Vec<u8> {
|
||||
[b"ValidatorSets-musig_key".as_ref(), &set.encode()].concat()
|
||||
pub fn musig_context(set: ValidatorSet) -> [u8; 32] {
|
||||
let mut context = [0; 32];
|
||||
const DST: &[u8] = b"ValidatorSets-musig_key";
|
||||
context[.. DST.len()].copy_from_slice(DST);
|
||||
let set = set.encode();
|
||||
context[DST.len() .. (DST.len() + set.len())].copy_from_slice(set.len());
|
||||
context
|
||||
}
|
||||
|
||||
/// The MuSig public key for a validator set.
|
||||
@@ -122,7 +127,7 @@ pub fn musig_key(set: ValidatorSet, set_keys: &[Public]) -> Public {
|
||||
.expect("invalid participant"),
|
||||
);
|
||||
}
|
||||
Public(dkg::musig::musig_key::<Ristretto>(&musig_context(set), &keys).unwrap().to_bytes())
|
||||
Public(dkg_musig::musig_key_vartime::<Ristretto>(musig_context(set), &keys).unwrap().to_bytes())
|
||||
}
|
||||
|
||||
/// The message for the set_keys signature.
|
||||
|
||||
Reference in New Issue
Block a user