mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
WIP changes to validator-sets
Actually use the added `Allocations` abstraction Start using the sessions API in the validator-sets pallet Get a `substrate/validator-sets` approximate to compiling
This commit is contained in:
@@ -22,7 +22,7 @@ borsh = { version = "1", default-features = false, features = ["derive", "de_str
|
||||
bitvec = { version = "1", default-features = false, features = ["alloc"] }
|
||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"], optional = true }
|
||||
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }
|
||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "2bfdaed4b3614de2fe7d10e4ece3e6a912833e90", default-features = false }
|
||||
sp-core = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "74839cba4a7f48023080215e5194fd6ab7e270e5", default-features = false }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["alloc"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["alloc"] }
|
||||
|
||||
@@ -6,6 +6,16 @@ use crate::coin::{ExternalCoin, Coin};
|
||||
|
||||
/// Identifier for an embedded elliptic curve.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize, BorshSerialize, BorshDeserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "non_canonical_scale_derivations",
|
||||
derive(
|
||||
scale::Encode,
|
||||
scale::Decode,
|
||||
scale::MaxEncodedLen,
|
||||
scale::DecodeWithMemTracking,
|
||||
scale_info::TypeInfo
|
||||
)
|
||||
)]
|
||||
pub enum EmbeddedEllipticCurve {
|
||||
/// The Embedwards25519 curve, defined over (embedded into) Ed25519's/Ristretto's scalar field.
|
||||
Embedwards25519,
|
||||
@@ -50,14 +60,17 @@ impl ExternalNetworkId {
|
||||
///
|
||||
/// This is guaranteed to return `[Embedwards25519]` or
|
||||
/// `[Embedwards25519, *network specific curve*]`.
|
||||
pub fn embedded_elliptic_curves(&self) -> &'static [EmbeddedEllipticCurve] {
|
||||
pub fn embedded_elliptic_curves(&self) -> impl Iterator<Item = EmbeddedEllipticCurve> {
|
||||
match self {
|
||||
// We need to generate a Ristretto key for oraclizing and a Secp256k1 key for the network
|
||||
Self::Bitcoin | Self::Ethereum => {
|
||||
&[EmbeddedEllipticCurve::Embedwards25519, EmbeddedEllipticCurve::Secq256k1]
|
||||
[EmbeddedEllipticCurve::Embedwards25519, EmbeddedEllipticCurve::Secq256k1]
|
||||
.as_slice()
|
||||
.iter()
|
||||
.copied()
|
||||
}
|
||||
// Since the oraclizing key curve is the same as the network's curve, we only need it
|
||||
Self::Monero => &[EmbeddedEllipticCurve::Embedwards25519],
|
||||
Self::Monero => [EmbeddedEllipticCurve::Embedwards25519].as_slice().iter().copied(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user