mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Merge branch 'develop' into next
This resolves the conflicts and gets the workspace `Cargo.toml`s to not be invalid. It doesn't actually get clippy to pass again yet. Does move `crypto/dkg/src/evrf` into a new `crypto/dkg/evrf` crate (which does not yet compile).
This commit is contained in:
@@ -49,7 +49,7 @@ pallet-timestamp = { git = "https://github.com/serai-dex/substrate", default-fea
|
||||
|
||||
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", features = ["ristretto"] }
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../../../crypto/frost", features = ["tests"] }
|
||||
schnorrkel = { path = "../../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
@@ -71,7 +71,7 @@ std = [
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-staking/std",
|
||||
|
||||
|
||||
"sp-consensus-babe/std",
|
||||
|
||||
"frame-system/std",
|
||||
|
||||
@@ -18,8 +18,9 @@ workspace = true
|
||||
[dependencies]
|
||||
zeroize = { version = "^1.5", features = ["derive"], optional = true }
|
||||
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["alloc", "ristretto"] }
|
||||
dkg = { path = "../../../crypto/dkg", version = "0.5", default-features = false }
|
||||
dalek-ff-group = { path = "../../../crypto/dalek-ff-group", default-features = false, features = ["alloc"] }
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["alloc"] }
|
||||
dkg-musig = { path = "../../../crypto/dkg/musig", default-features = false }
|
||||
|
||||
borsh = { version = "1", default-features = false, features = ["derive", "de_strict_order"], optional = true }
|
||||
serde = { version = "1", default-features = false, features = ["derive", "alloc"], optional = true }
|
||||
@@ -33,7 +34,7 @@ sp-std = { git = "https://github.com/serai-dex/substrate", default-features = fa
|
||||
serai-primitives = { path = "../../primitives", default-features = false }
|
||||
|
||||
[features]
|
||||
std = ["zeroize", "ciphersuite/std", "dkg/std", "borsh?/std", "serde?/std", "scale/std", "scale-info/std", "sp-core/std", "sp-std/std", "serai-primitives/std"]
|
||||
std = ["zeroize", "ciphersuite/std", "dkg-musig/std", "borsh?/std", "serde?/std", "scale/std", "scale-info/std", "sp-core/std", "sp-std/std", "serai-primitives/std"]
|
||||
borsh = ["dep:borsh", "serai-primitives/borsh"]
|
||||
serde = ["dep:serde", "serai-primitives/serde"]
|
||||
default = ["std"]
|
||||
|
||||
@@ -5,7 +5,8 @@ use core::time::Duration;
|
||||
#[cfg(feature = "std")]
|
||||
use zeroize::Zeroize;
|
||||
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
|
||||
use scale::{Encode, Decode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
@@ -121,8 +122,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()
|
||||
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);
|
||||
context
|
||||
}
|
||||
|
||||
/// The MuSig public key for a validator set.
|
||||
@@ -136,7 +142,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