mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Fix clippy, update old dependencies
This commit is contained in:
499
Cargo.lock
generated
499
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -205,6 +205,9 @@ matches = { path = "patches/matches" }
|
||||
option-ext = { path = "patches/option-ext" }
|
||||
directories-next = { path = "patches/directories-next" }
|
||||
|
||||
# Patch to include `FromUniformBytes<64>` over Scalar
|
||||
k256 = { git = "https://github.com/kayabaNerve/elliptic-curves", rev = "fc92333e222b7f0cbe268d2ca92ed572f71f3e1d" }
|
||||
|
||||
[workspace.lints.clippy]
|
||||
unwrap_or_default = "allow"
|
||||
map_unwrap_or = "allow"
|
||||
|
||||
@@ -18,7 +18,7 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
parity-db = { version = "0.4", default-features = false, optional = true }
|
||||
rocksdb = { version = "0.23", default-features = false, features = ["zstd"], optional = true }
|
||||
rocksdb = { version = "0.24", default-features = false, features = ["zstd"], optional = true }
|
||||
|
||||
[features]
|
||||
parity-db = ["dep:parity-db"]
|
||||
|
||||
@@ -29,7 +29,7 @@ transcript = { package = "flexible-transcript", path = "../crypto/transcript", d
|
||||
dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] }
|
||||
dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-musig", path = "../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../crypto/frost" }
|
||||
frost-schnorrkel = { path = "../crypto/schnorrkel" }
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ impl<D: Db> ContinuallyRan for CosignIntendTask<D> {
|
||||
|
||||
// Tell each set of their expectation to cosign this block
|
||||
for set in global_session_info.sets {
|
||||
log::debug!("{:?} will be cosigning block #{block_number}", set);
|
||||
log::debug!("{set:?} will be cosigning block #{block_number}");
|
||||
IntendedCosigns::send(
|
||||
&mut txn,
|
||||
set,
|
||||
|
||||
@@ -3,13 +3,11 @@ use std::{boxed::Box, collections::HashMap};
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg::{Participant, musig};
|
||||
use frost_schnorrkel::{
|
||||
frost::{
|
||||
dkg::{Participant, musig::musig},
|
||||
FrostError,
|
||||
sign::*,
|
||||
},
|
||||
frost::{FrostError, sign::*},
|
||||
Schnorrkel,
|
||||
};
|
||||
|
||||
@@ -155,16 +153,15 @@ impl<CD: DbTrait, TD: DbTrait> ConfirmDkgTask<CD, TD> {
|
||||
db: &mut CD,
|
||||
set: ExternalValidatorSet,
|
||||
attempt: u32,
|
||||
key: &Zeroizing<<Ristretto as Ciphersuite>::F>,
|
||||
key: Zeroizing<<Ristretto as Ciphersuite>::F>,
|
||||
signer: &mut Option<Signer>,
|
||||
) {
|
||||
// Perform the preprocess
|
||||
let public_key = Ristretto::generator() * key.deref();
|
||||
let (machine, preprocess) = AlgorithmMachine::new(
|
||||
schnorrkel(),
|
||||
// We use a 1-of-1 Musig here as we don't know who will actually be in this Musig yet
|
||||
musig(&musig_context(set.into()), key, &[Ristretto::generator() * key.deref()])
|
||||
.unwrap()
|
||||
.into(),
|
||||
musig(musig_context(set.into()), key, &[public_key]).unwrap(),
|
||||
)
|
||||
.preprocess(&mut OsRng);
|
||||
// We take the preprocess so we can use it in a distinct machine with the actual Musig
|
||||
@@ -199,7 +196,7 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
// If we were sent a key to set, create the signer for it
|
||||
if self.signer.is_none() && KeysToConfirm::get(&self.db, self.set.set).is_some() {
|
||||
// Create and publish the initial preprocess
|
||||
Self::preprocess(&mut self.db, self.set.set, 0, &self.key, &mut self.signer);
|
||||
Self::preprocess(&mut self.db, self.set.set, 0, self.key.clone(), &mut self.signer);
|
||||
|
||||
made_progress = true;
|
||||
}
|
||||
@@ -219,7 +216,13 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
id: messages::sign::SignId { attempt, .. },
|
||||
} => {
|
||||
// Create and publish the preprocess for the specified attempt
|
||||
Self::preprocess(&mut self.db, self.set.set, attempt, &self.key, &mut self.signer);
|
||||
Self::preprocess(
|
||||
&mut self.db,
|
||||
self.set.set,
|
||||
attempt,
|
||||
self.key.clone(),
|
||||
&mut self.signer,
|
||||
);
|
||||
}
|
||||
messages::sign::CoordinatorMessage::Preprocesses {
|
||||
id: messages::sign::SignId { attempt, .. },
|
||||
@@ -258,9 +261,9 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let keys = musig(&musig_context(self.set.set.into()), &self.key, &musig_public_keys)
|
||||
.unwrap()
|
||||
.into();
|
||||
let keys =
|
||||
musig(musig_context(self.set.set.into()), self.key.clone(), &musig_public_keys)
|
||||
.unwrap();
|
||||
|
||||
// Rebuild the machine
|
||||
let (machine, preprocess_from_cache) =
|
||||
|
||||
@@ -6,10 +6,7 @@ use rand_core::{RngCore, OsRng};
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{
|
||||
ff::{Field, PrimeField},
|
||||
GroupEncoding,
|
||||
},
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::sync::Arc;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ use std::sync::Arc;
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
use blake2::{digest::typenum::U32, Digest, Blake2s};
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
@@ -67,9 +68,7 @@ async fn provide_transaction<TD: DbTrait, P: P2p>(
|
||||
// advancing
|
||||
Err(ProvidedError::LocalMismatchesOnChain) => loop {
|
||||
log::error!(
|
||||
"Tributary {:?} was supposed to provide {:?} but peers disagree, halting Tributary",
|
||||
set,
|
||||
tx,
|
||||
"Tributary {set:?} was supposed to provide {tx:?} but peers disagree, halting Tributary",
|
||||
);
|
||||
// Print this every five minutes as this does need to be handled
|
||||
tokio::time::sleep(Duration::from_secs(5 * 60)).await;
|
||||
|
||||
@@ -27,7 +27,8 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] }
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.3", default-features = false, features = ["std", "recommended"] }
|
||||
|
||||
ciphersuite = { package = "ciphersuite", path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", version = "0.5", default-features = false, features = ["std", "aggregate"] }
|
||||
|
||||
hex = { version = "0.4", default-features = false, features = ["std"] }
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::{sync::Arc, io};
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use scale::Decode;
|
||||
use futures_channel::mpsc::UnboundedReceiver;
|
||||
|
||||
@@ -9,7 +9,6 @@ use rand_chacha::ChaCha12Rng;
|
||||
|
||||
use transcript::{Transcript, RecommendedTranscript};
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{
|
||||
GroupEncoding,
|
||||
@@ -17,6 +16,7 @@ use ciphersuite::{
|
||||
},
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::{
|
||||
SchnorrSignature,
|
||||
aggregate::{SchnorrAggregator, SchnorrAggregate},
|
||||
@@ -164,7 +164,6 @@ impl SignatureScheme for Validators {
|
||||
type AggregateSignature = Vec<u8>;
|
||||
type Signer = Arc<Signer>;
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, validator: Self::ValidatorId, msg: &[u8], sig: &Self::Signature) -> bool {
|
||||
if !self.weights.contains_key(&validator) {
|
||||
return false;
|
||||
@@ -197,7 +196,6 @@ impl SignatureScheme for Validators {
|
||||
aggregate.serialize()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[Self::ValidatorId],
|
||||
|
||||
@@ -8,8 +8,9 @@ use blake2::{Digest, Blake2b512};
|
||||
|
||||
use ciphersuite::{
|
||||
group::{Group, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::SchnorrSignature;
|
||||
|
||||
use crate::{TRANSACTION_SIZE_LIMIT, ReadWrite};
|
||||
|
||||
@@ -114,7 +114,6 @@ impl<S: SignatureScheme> SignatureScheme for Arc<S> {
|
||||
self.as_ref().aggregate(validators, msg, sigs)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[Self::ValidatorId],
|
||||
|
||||
@@ -46,7 +46,6 @@ impl SignatureScheme for TestSignatureScheme {
|
||||
type AggregateSignature = Vec<[u8; 32]>;
|
||||
type Signer = TestSigner;
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, validator: u16, msg: &[u8], sig: &[u8; 32]) -> bool {
|
||||
(sig[.. 2] == validator.to_le_bytes()) && (sig[2 ..] == [msg, &[0; 30]].concat()[.. 30])
|
||||
}
|
||||
@@ -60,7 +59,6 @@ impl SignatureScheme for TestSignatureScheme {
|
||||
sigs.to_vec()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[TestValidatorId],
|
||||
|
||||
@@ -26,6 +26,7 @@ borsh = { version = "1", default-features = false, features = ["std", "derive",
|
||||
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] }
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ impl<TD: Db, TDT: DbTxn, P: P2p> ScanBlock<'_, TD, TDT, P> {
|
||||
let signer = signer(signed);
|
||||
|
||||
// Check the participant voted to be removed actually exists
|
||||
if !self.validators.iter().any(|validator| *validator == participant) {
|
||||
if !self.validators.contains(&participant) {
|
||||
TributaryDb::fatal_slash(
|
||||
self.tributary_txn,
|
||||
self.set.set,
|
||||
|
||||
@@ -5,11 +5,11 @@ use zeroize::Zeroizing;
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use blake2::{digest::typenum::U32, Digest, Blake2b};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{Group, GroupEncoding},
|
||||
group::{ff::Field, Group, GroupEncoding},
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::SchnorrSignature;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
@@ -13,6 +13,9 @@ use elliptic_curve::{
|
||||
|
||||
use ciphersuite::{group::ff::PrimeField, Ciphersuite};
|
||||
|
||||
pub use k256;
|
||||
pub use p256;
|
||||
|
||||
macro_rules! kp_curve {
|
||||
(
|
||||
$feature: literal,
|
||||
|
||||
@@ -76,7 +76,6 @@ impl<C: Curves> Generators<C> {
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO
|
||||
/// Secp256k1, and an elliptic curve defined over its scalar field (secq256k1).
|
||||
#[cfg(feature = "secp256k1")]
|
||||
pub struct Secp256k1;
|
||||
@@ -86,7 +85,6 @@ impl Curves for Secp256k1 {
|
||||
type EmbeddedCurve = secq256k1::Secq256k1;
|
||||
type EmbeddedCurveParameters = secq256k1::Secq256k1;
|
||||
}
|
||||
*/
|
||||
|
||||
/// Ed25519, and an elliptic curve defined over its scalar field (embedwards25519).
|
||||
#[cfg(feature = "ed25519")]
|
||||
|
||||
@@ -47,12 +47,12 @@ mod tests;
|
||||
/// `Participation` is meant to be broadcast to all other participants over an authenticated,
|
||||
/// reliable broadcast channel.
|
||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||
pub struct Participation<C: Ciphersuite> {
|
||||
pub struct Participation<C: Curves> {
|
||||
proof: Vec<u8>,
|
||||
encrypted_secret_shares: HashMap<Participant, C::F>,
|
||||
encrypted_secret_shares: HashMap<Participant, <C::ToweringCurve as Ciphersuite>::F>,
|
||||
}
|
||||
|
||||
impl<C: Ciphersuite> Participation<C> {
|
||||
impl<C: Curves> Participation<C> {
|
||||
pub fn read<R: Read>(reader: &mut R, n: u16) -> io::Result<Self> {
|
||||
// Ban <32-bit platforms, allowing us to assume `u32` -> `usize` works
|
||||
const _NO_16_BIT_PLATFORMS: [(); (usize::BITS - u32::BITS) as usize] = [(); _];
|
||||
@@ -79,7 +79,7 @@ impl<C: Ciphersuite> Participation<C> {
|
||||
|
||||
let mut encrypted_secret_shares = HashMap::with_capacity(usize::from(n));
|
||||
for i in Participant::iter().take(usize::from(n)) {
|
||||
encrypted_secret_shares.insert(i, C::read_F(reader)?);
|
||||
encrypted_secret_shares.insert(i, <C::ToweringCurve as Ciphersuite>::read_F(reader)?);
|
||||
}
|
||||
|
||||
Ok(Self { proof, encrypted_secret_shares })
|
||||
@@ -190,7 +190,7 @@ impl<C: Curves> Dkg<C> {
|
||||
t: u16,
|
||||
evrf_public_keys: &[<C::EmbeddedCurve as Ciphersuite>::G],
|
||||
evrf_private_key: &Zeroizing<<C::EmbeddedCurve as Ciphersuite>::F>,
|
||||
) -> Result<Participation<C::ToweringCurve>, Error> {
|
||||
) -> Result<Participation<C>, Error> {
|
||||
let Ok(n) = u16::try_from(evrf_public_keys.len()) else {
|
||||
Err(Error::TooManyParticipants { provided: evrf_public_keys.len() })?
|
||||
};
|
||||
@@ -311,7 +311,7 @@ impl<C: Curves> Dkg<C> {
|
||||
context: [u8; 32],
|
||||
t: u16,
|
||||
evrf_public_keys: &[<C::EmbeddedCurve as Ciphersuite>::G],
|
||||
participations: &HashMap<Participant, Participation<C::ToweringCurve>>,
|
||||
participations: &HashMap<Participant, Participation<C>>,
|
||||
) -> Result<VerifyResult<C>, Error> {
|
||||
let Ok(n) = u16::try_from(evrf_public_keys.len()) else {
|
||||
Err(Error::TooManyParticipants { provided: evrf_public_keys.len() })?
|
||||
|
||||
@@ -210,7 +210,6 @@ impl<C: Curve, T: Sync + Clone + Debug + Transcript, H: Hram<C>> Algorithm<C> fo
|
||||
SchnorrSignature::<C>::sign(params.secret_share(), nonces.swap_remove(0), c).s
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, group_key: C::G, nonces: &[Vec<C::G>], sum: C::F) -> Option<Self::Signature> {
|
||||
let sig = SchnorrSignature { R: nonces[0][0], s: sum };
|
||||
Some(sig).filter(|sig| sig.verify(group_key, self.c.unwrap()))
|
||||
|
||||
@@ -121,7 +121,6 @@ impl<C: Curve> Algorithm<C> for MultiNonce<C> {
|
||||
res
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, _: C::G, nonces: &[Vec<C::G>], sum: C::F) -> Option<Self::Signature> {
|
||||
verify_nonces::<C>(nonces);
|
||||
assert_eq!(&self.nonces.clone().unwrap(), nonces);
|
||||
|
||||
@@ -128,7 +128,6 @@ impl Algorithm<Ristretto> for Schnorrkel {
|
||||
)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify(
|
||||
&self,
|
||||
group_key: RistrettoPoint,
|
||||
|
||||
@@ -132,6 +132,7 @@ unknown-git = "deny"
|
||||
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
||||
allow-git = [
|
||||
"https://github.com/rust-lang-nursery/lazy-static.rs",
|
||||
"https://github.com/kayabaNerve/elliptic-curves",
|
||||
"https://github.com/kayabaNerve/pasta_curves",
|
||||
"https://github.com/kayabaNerve/monero-oxide",
|
||||
"https://github.com/serai-dex/substrate-bip39",
|
||||
|
||||
@@ -146,7 +146,7 @@ pub(crate) fn ack_message(from: Service, to: Service, id: u64, sig: SchnorrSigna
|
||||
// It's the second if we acknowledge messages before saving them as acknowledged
|
||||
// TODO: Check only a proper message is being acked
|
||||
|
||||
log::info!("Acknowledging From: {:?} To: {:?} ID: {}", from, to, id);
|
||||
log::info!("Acknowledging From: {from:?} To: {to:?} ID: {id}");
|
||||
|
||||
QUEUES.read().unwrap()[&(from, to)].write().unwrap().ack_message(id)
|
||||
}
|
||||
|
||||
@@ -135,7 +135,6 @@ mod frost_crypto {
|
||||
self.0.sign_share(params, nonce_sums, nonces, msg)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify(
|
||||
&self,
|
||||
group_key: ProjectivePoint,
|
||||
|
||||
@@ -21,8 +21,8 @@ tower = "0.5"
|
||||
serde_json = { version = "1", default-features = false }
|
||||
simple-request = { path = "../../../common/request", version = "0.1", default-features = false }
|
||||
|
||||
alloy-json-rpc = { version = "0.14", default-features = false }
|
||||
alloy-transport = { version = "0.14", default-features = false }
|
||||
alloy-json-rpc = { version = "1", default-features = false }
|
||||
alloy-transport = { version = "1", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["tls"]
|
||||
|
||||
@@ -32,11 +32,11 @@ k256 = { version = "^0.13.1", default-features = false, features = ["ecdsa"] }
|
||||
alloy-core = { version = "1", default-features = false }
|
||||
alloy-sol-types = { version = "1", default-features = false }
|
||||
|
||||
alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-rpc-client = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-simple-request-transport = { path = "../alloy-simple-request-transport", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-rpc-client = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
alloy-node-bindings = { version = "0.14", default-features = false }
|
||||
alloy-node-bindings = { version = "1", default-features = false }
|
||||
|
||||
tokio = { version = "1", default-features = false, features = ["macros"] }
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
pub use ciphersuite::*;
|
||||
#[cfg(feature = "ed25519")]
|
||||
use dalek_ff_group::Ed25519;
|
||||
pub use dalek_ff_group::Ed25519;
|
||||
|
||||
@@ -13,7 +13,7 @@ all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dependencies]
|
||||
rocksdb = { version = "0.23", default-features = false, features = ["bindgen-runtime"] }
|
||||
rocksdb = { version = "0.24", default-features = false, features = ["bindgen-runtime"] }
|
||||
|
||||
[features]
|
||||
jemalloc = [] # Dropped as this causes a compilation failure on windows
|
||||
|
||||
@@ -4,9 +4,9 @@ use zeroize::{Zeroize, Zeroizing};
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dkg::evrf::EvrfCurve;
|
||||
use dkg::{Curves, Ristretto};
|
||||
|
||||
use serai_client::validator_sets::primitives::Session;
|
||||
|
||||
@@ -100,8 +100,8 @@ fn key_gen<K: KeyGenParams>() -> KeyGen<K> {
|
||||
res
|
||||
}
|
||||
KeyGen::new(
|
||||
read_key_from_env::<<Ristretto as EvrfCurve>::EmbeddedCurve>("SUBSTRATE_EVRF_KEY"),
|
||||
read_key_from_env::<<K::ExternalNetworkCiphersuite as EvrfCurve>::EmbeddedCurve>(
|
||||
read_key_from_env::<<Ristretto as Curves>::EmbeddedCurve>("SUBSTRATE_EVRF_KEY"),
|
||||
read_key_from_env::<<K::ExternalNetworkCiphersuite as Curves>::EmbeddedCurve>(
|
||||
"NETWORK_EVRF_KEY",
|
||||
),
|
||||
)
|
||||
@@ -170,11 +170,13 @@ impl Hooks for () {
|
||||
pub async fn main_loop<
|
||||
H: Hooks,
|
||||
S: ScannerFeed,
|
||||
K: KeyGenParams<ExternalNetworkCiphersuite: Ciphersuite<G = KeyFor<S>>>,
|
||||
K: KeyGenParams<ExternalNetworkCiphersuite: Curves<ToweringCurve: Ciphersuite<G = KeyFor<S>>>>,
|
||||
Sch: Clone
|
||||
+ Scheduler<
|
||||
S,
|
||||
SignableTransaction: SignableTransaction<Ciphersuite = K::ExternalNetworkCiphersuite>,
|
||||
SignableTransaction: SignableTransaction<
|
||||
Ciphersuite = <K::ExternalNetworkCiphersuite as Curves>::ToweringCurve,
|
||||
>,
|
||||
>,
|
||||
>(
|
||||
mut db: Db,
|
||||
|
||||
@@ -25,6 +25,7 @@ scale = { package = "parity-scale-codec", version = "3", default-features = fals
|
||||
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "secp256k1"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1};
|
||||
use frost::ThresholdKeys;
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dkg::{ThresholdKeys, Curves, Secp256k1};
|
||||
|
||||
use crate::{primitives::x_coord_to_even_point, scan::scanner};
|
||||
|
||||
@@ -9,20 +9,26 @@ impl key_gen::KeyGenParams for KeyGenParams {
|
||||
|
||||
type ExternalNetworkCiphersuite = Secp256k1;
|
||||
|
||||
fn tweak_keys(keys: &mut ThresholdKeys<Self::ExternalNetworkCiphersuite>) {
|
||||
*keys = bitcoin_serai::wallet::tweak_keys(keys);
|
||||
fn tweak_keys(
|
||||
keys: &mut ThresholdKeys<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve>,
|
||||
) {
|
||||
*keys = bitcoin_serai::wallet::tweak_keys(keys.clone());
|
||||
// Also create a scanner to assert these keys, and all expected paths, are usable
|
||||
scanner(keys.group_key());
|
||||
}
|
||||
|
||||
fn encode_key(key: <Self::ExternalNetworkCiphersuite as Ciphersuite>::G) -> Vec<u8> {
|
||||
fn encode_key(
|
||||
key: <<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G,
|
||||
) -> Vec<u8> {
|
||||
let key = key.to_bytes();
|
||||
let key: &[u8] = key.as_ref();
|
||||
// Skip the parity encoding as we know this key is even
|
||||
key[1 ..].to_vec()
|
||||
}
|
||||
|
||||
fn decode_key(key: &[u8]) -> Option<<Self::ExternalNetworkCiphersuite as Ciphersuite>::G> {
|
||||
fn decode_key(
|
||||
key: &[u8],
|
||||
) -> Option<<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G> {
|
||||
x_coord_to_even_point(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use core::fmt;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use bitcoin_serai::bitcoin::block::{Header, Block as BBlock};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use bitcoin_serai::bitcoin::key::{Parity, XOnlyPublicKey};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use bitcoin_serai::{
|
||||
bitcoin::{
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::io;
|
||||
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use ciphersuite::Secp256k1;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use frost::{dkg::ThresholdKeys, sign::PreprocessMachine};
|
||||
|
||||
use bitcoin_serai::{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::{sync::LazyLock, collections::HashMap};
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use bitcoin_serai::{
|
||||
bitcoin::{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use core::future::Future;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use bitcoin_serai::{
|
||||
bitcoin::ScriptBuf,
|
||||
|
||||
@@ -26,6 +26,7 @@ scale = { package = "parity-scale-codec", version = "3", default-features = fals
|
||||
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "secp256k1"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["secp256k1"] }
|
||||
|
||||
@@ -34,11 +35,11 @@ k256 = { version = "^0.13.1", default-features = false, features = ["std"] }
|
||||
alloy-core = { version = "1", default-features = false }
|
||||
alloy-rlp = { version = "0.3", default-features = false }
|
||||
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-transport = { version = "0.14", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-transport = { version = "1", default-features = false }
|
||||
alloy-simple-request-transport = { path = "../../networks/ethereum/alloy-simple-request-transport", default-features = false }
|
||||
alloy-rpc-client = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-rpc-client = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
serai-client = { path = "../../substrate/client", default-features = false, features = ["ethereum"] }
|
||||
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
TODO
|
||||
|
||||
async fn publish_completion(
|
||||
&self,
|
||||
completion: &<Self::Eventuality as EventualityTrait>::Completion,
|
||||
) -> Result<(), NetworkError> {
|
||||
// Publish this to the dedicated TX server for a solver to actually publish
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
}
|
||||
|
||||
// Publish this using a dummy account we fund with magic RPC commands
|
||||
#[cfg(test)]
|
||||
{
|
||||
let router = self.router().await;
|
||||
let router = router.as_ref().unwrap();
|
||||
|
||||
let mut tx = match completion.command() {
|
||||
RouterCommand::UpdateSeraiKey { key, .. } => {
|
||||
router.update_serai_key(key, completion.signature())
|
||||
}
|
||||
RouterCommand::Execute { outs, .. } => router.execute(
|
||||
&outs.iter().cloned().map(Into::into).collect::<Vec<_>>(),
|
||||
completion.signature(),
|
||||
),
|
||||
};
|
||||
tx.gas_limit = 1_000_000u64.into();
|
||||
tx.gas_price = 1_000_000_000u64.into();
|
||||
let tx = ethereum_serai::crypto::deterministically_sign(tx);
|
||||
|
||||
if self.provider.get_transaction_by_hash(*tx.hash()).await.unwrap().is_none() {
|
||||
self
|
||||
.provider
|
||||
.raw_request::<_, ()>(
|
||||
"anvil_setBalance".into(),
|
||||
[
|
||||
tx.recover_signer().unwrap().to_string(),
|
||||
(U256::from(tx.tx().gas_limit) * U256::from(tx.tx().gas_price)).to_string(),
|
||||
],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let (tx, sig, _) = tx.into_parts();
|
||||
let mut bytes = vec![];
|
||||
tx.encode_with_signature_fields(&sig, &mut bytes);
|
||||
let pending_tx = self.provider.send_raw_transaction(&bytes).await.unwrap();
|
||||
self.mine_block().await;
|
||||
assert!(pending_tx.get_receipt().await.unwrap().status());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
async fn get_transaction_by_eventuality(
|
||||
&self,
|
||||
block: usize,
|
||||
eventuality: &Self::Eventuality,
|
||||
) -> Self::Transaction {
|
||||
// We mine 96 blocks to ensure the 32 blocks relevant are finalized
|
||||
// Back-check the prior two epochs in response to this
|
||||
// TODO: Review why this is sub(3) and not sub(2)
|
||||
for block in block.saturating_sub(3) ..= block {
|
||||
match eventuality.1 {
|
||||
RouterCommand::UpdateSeraiKey { nonce, .. } | RouterCommand::Execute { nonce, .. } => {
|
||||
let router = self.router().await;
|
||||
let router = router.as_ref().unwrap();
|
||||
|
||||
let block = u64::try_from(block).unwrap();
|
||||
let filter = router
|
||||
.key_updated_filter()
|
||||
.from_block(block * 32)
|
||||
.to_block(((block + 1) * 32) - 1)
|
||||
.topic1(nonce);
|
||||
let logs = self.provider.get_logs(&filter).await.unwrap();
|
||||
if let Some(log) = logs.first() {
|
||||
return self
|
||||
.provider
|
||||
.get_transaction_by_hash(log.clone().transaction_hash.unwrap())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
};
|
||||
|
||||
let filter = router
|
||||
.executed_filter()
|
||||
.from_block(block * 32)
|
||||
.to_block(((block + 1) * 32) - 1)
|
||||
.topic1(nonce);
|
||||
let logs = self.provider.get_logs(&filter).await.unwrap();
|
||||
if logs.is_empty() {
|
||||
continue;
|
||||
}
|
||||
return self
|
||||
.provider
|
||||
.get_transaction_by_hash(logs[0].transaction_hash.unwrap())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
panic!("couldn't find completion in any three of checked blocks");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
async fn mine_block(&self) {
|
||||
self.provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
async fn test_send(&self, send_to: Self::Address) -> Self::Block {
|
||||
use rand_core::OsRng;
|
||||
use ciphersuite::group::ff::Field;
|
||||
use ethereum_serai::alloy::sol_types::SolCall;
|
||||
|
||||
let key = <Secp256k1 as Ciphersuite>::F::random(&mut OsRng);
|
||||
let address = ethereum_serai::crypto::address(&(Secp256k1::generator() * key));
|
||||
|
||||
// Set a 1.1 ETH balance
|
||||
self
|
||||
.provider
|
||||
.raw_request::<_, ()>(
|
||||
"anvil_setBalance".into(),
|
||||
[Address(address).to_string(), "1100000000000000000".into()],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let value = U256::from_str_radix("1000000000000000000", 10).unwrap();
|
||||
let tx = ethereum_serai::alloy::consensus::TxLegacy {
|
||||
chain_id: None,
|
||||
nonce: 0,
|
||||
gas_price: 1_000_000_000u128,
|
||||
gas_limit: 200_000u128,
|
||||
to: ethereum_serai::alloy::primitives::TxKind::Call(send_to.0.into()),
|
||||
// 1 ETH
|
||||
value,
|
||||
input: ethereum_serai::router::abi::inInstructionCall::new((
|
||||
[0; 20].into(),
|
||||
value,
|
||||
vec![].into(),
|
||||
))
|
||||
.abi_encode()
|
||||
.into(),
|
||||
};
|
||||
|
||||
use ethereum_serai::alloy::{primitives::Signature, consensus::SignableTransaction};
|
||||
let sig = k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(key).unwrap())
|
||||
.sign_prehash_recoverable(tx.signature_hash().as_ref())
|
||||
.unwrap();
|
||||
|
||||
let mut bytes = vec![];
|
||||
tx.encode_with_signature_fields(&Signature::from(sig), &mut bytes);
|
||||
let pending_tx = self.provider.send_raw_transaction(&bytes).await.ok().unwrap();
|
||||
|
||||
// Mine an epoch containing this TX
|
||||
self.mine_block().await;
|
||||
assert!(pending_tx.get_receipt().await.unwrap().status());
|
||||
// Yield the freshly mined block
|
||||
self.get_block(self.get_latest_block_number().await.unwrap()).await.unwrap()
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// TODO
|
||||
|
||||
use rand_core::OsRng;
|
||||
|
||||
use group::ff::{Field, PrimeField};
|
||||
use k256::{
|
||||
ecdsa::{
|
||||
self, hazmat::SignPrimitive, signature::hazmat::PrehashVerifier, SigningKey, VerifyingKey,
|
||||
},
|
||||
Scalar, ProjectivePoint,
|
||||
};
|
||||
|
||||
use frost::{
|
||||
curve::{Ciphersuite, Secp256k1},
|
||||
algorithm::{Hram, IetfSchnorr},
|
||||
tests::{algorithm_machines, sign},
|
||||
};
|
||||
|
||||
use crate::{crypto::*, tests::key_gen};
|
||||
|
||||
// Run the sign test with the EthereumHram
|
||||
#[test]
|
||||
fn test_signing() {
|
||||
let (keys, _) = key_gen();
|
||||
|
||||
const MESSAGE: &[u8] = b"Hello, World!";
|
||||
|
||||
let algo = IetfSchnorr::<Secp256k1, EthereumHram>::ietf();
|
||||
let _sig =
|
||||
sign(&mut OsRng, &algo, keys.clone(), algorithm_machines(&mut OsRng, &algo, &keys), MESSAGE);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// TODO
|
||||
|
||||
use std::{sync::Arc, collections::HashMap};
|
||||
|
||||
use rand_core::OsRng;
|
||||
|
||||
use k256::{Scalar, ProjectivePoint};
|
||||
use frost::{curve::Secp256k1, Participant, ThresholdKeys, tests::key_gen as frost_key_gen};
|
||||
|
||||
use alloy_core::{
|
||||
primitives::{Address, U256, Bytes, Signature, TxKind},
|
||||
hex::FromHex,
|
||||
};
|
||||
use alloy_consensus::{SignableTransaction, TxLegacy};
|
||||
|
||||
use alloy_rpc_types_eth::TransactionReceipt;
|
||||
use alloy_simple_request_transport::SimpleRequest;
|
||||
use alloy_provider::{Provider, RootProvider};
|
||||
|
||||
use crate::crypto::{address, deterministically_sign, PublicKey};
|
||||
|
||||
#[cfg(test)]
|
||||
mod crypto;
|
||||
|
||||
#[cfg(test)]
|
||||
use contracts::tests as abi;
|
||||
#[cfg(test)]
|
||||
mod router;
|
||||
|
||||
pub fn key_gen() -> (HashMap<Participant, ThresholdKeys<Secp256k1>>, PublicKey) {
|
||||
let mut keys = frost_key_gen::<_, Secp256k1>(&mut OsRng);
|
||||
let mut group_key = keys[&Participant::new(1).unwrap()].group_key();
|
||||
|
||||
let mut offset = Scalar::ZERO;
|
||||
while PublicKey::new(group_key).is_none() {
|
||||
offset += Scalar::ONE;
|
||||
group_key += ProjectivePoint::GENERATOR;
|
||||
}
|
||||
for keys in keys.values_mut() {
|
||||
*keys = keys.offset(offset);
|
||||
}
|
||||
let public_key = PublicKey::new(group_key).unwrap();
|
||||
|
||||
(keys, public_key)
|
||||
}
|
||||
@@ -22,11 +22,11 @@ alloy-core = { version = "1", default-features = false }
|
||||
alloy-sol-types = { version = "1", default-features = false }
|
||||
alloy-sol-macro = { version = "1", default-features = false }
|
||||
|
||||
alloy-consensus = { version = "0.14", default-features = false }
|
||||
alloy-consensus = { version = "1", default-features = false }
|
||||
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-transport = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-transport = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false }
|
||||
|
||||
@@ -35,9 +35,9 @@ build-solidity-contracts = { path = "../../../networks/ethereum/build-contracts"
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false }
|
||||
alloy-rpc-client = { version = "0.14", default-features = false }
|
||||
alloy-node-bindings = { version = "0.14", default-features = false }
|
||||
alloy-rpc-client = { version = "1", default-features = false }
|
||||
alloy-node-bindings = { version = "1", default-features = false }
|
||||
|
||||
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
|
||||
tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] }
|
||||
|
||||
ethereum-test-primitives = { package = "serai-ethereum-test-primitives", path = "../test-primitives" }
|
||||
|
||||
@@ -22,9 +22,9 @@ alloy-core = { version = "1", default-features = false }
|
||||
alloy-sol-types = { version = "1", default-features = false }
|
||||
alloy-sol-macro = { version = "1", default-features = false }
|
||||
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-transport = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-transport = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false }
|
||||
|
||||
|
||||
@@ -23,4 +23,4 @@ group = { version = "0.13", default-features = false }
|
||||
k256 = { version = "^0.13.1", default-features = false, features = ["std", "arithmetic"] }
|
||||
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
alloy-consensus = { version = "0.14", default-features = false, features = ["k256"] }
|
||||
alloy-consensus = { version = "1", default-features = false, features = ["k256"] }
|
||||
|
||||
@@ -27,13 +27,13 @@ alloy-core = { version = "1", default-features = false }
|
||||
alloy-sol-types = { version = "1", default-features = false }
|
||||
alloy-sol-macro = { version = "1", default-features = false }
|
||||
|
||||
alloy-consensus = { version = "0.14", default-features = false }
|
||||
alloy-consensus = { version = "1", default-features = false }
|
||||
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-transport = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-transport = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
revm = { version = "22", default-features = false, features = ["std"] }
|
||||
revm = { version = "29", default-features = false, features = ["std"] }
|
||||
|
||||
ethereum-schnorr = { package = "ethereum-schnorr-contract", path = "../../../networks/ethereum/schnorr", default-features = false }
|
||||
|
||||
@@ -61,10 +61,10 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||
k256 = { version = "0.13", default-features = false, features = ["std"] }
|
||||
|
||||
alloy-simple-request-transport = { path = "../../../networks/ethereum/alloy-simple-request-transport", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false, features = ["debug-api", "trace-api"] }
|
||||
alloy-rpc-client = { version = "0.14", default-features = false }
|
||||
alloy-node-bindings = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false, features = ["debug-api", "trace-api"] }
|
||||
alloy-rpc-client = { version = "1", default-features = false }
|
||||
alloy-node-bindings = { version = "1", default-features = false }
|
||||
|
||||
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros"] }
|
||||
tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros"] }
|
||||
|
||||
ethereum-test-primitives = { package = "serai-ethereum-test-primitives", path = "../test-primitives" }
|
||||
|
||||
@@ -21,8 +21,8 @@ use revm::{
|
||||
},
|
||||
context::{
|
||||
result::{EVMError, InvalidTransaction, ExecutionResult},
|
||||
evm::{EvmData, Evm},
|
||||
context::Context,
|
||||
evm::Evm,
|
||||
*,
|
||||
},
|
||||
inspector::{Inspector, InspectorHandler},
|
||||
@@ -124,6 +124,7 @@ pub(crate) type GasEstimator = Evm<
|
||||
WorstCaseCallInspector,
|
||||
EthInstructions<EthInterpreter, RevmContext>,
|
||||
EthPrecompiles,
|
||||
EthFrame,
|
||||
>;
|
||||
|
||||
impl Router {
|
||||
@@ -218,26 +219,24 @@ impl Router {
|
||||
db
|
||||
};
|
||||
|
||||
Evm {
|
||||
data: EvmData {
|
||||
ctx: RevmContext::new(db, SPEC_ID)
|
||||
.modify_cfg_chained(|cfg| {
|
||||
cfg.chain_id = CHAIN_ID.try_into().unwrap();
|
||||
})
|
||||
.modify_tx_chained(|tx: &mut TxEnv| {
|
||||
tx.gas_limit = u64::MAX;
|
||||
tx.kind = self.address.into();
|
||||
}),
|
||||
inspector: WorstCaseCallInspector {
|
||||
erc20,
|
||||
call_depth: 0,
|
||||
unused_gas: 0,
|
||||
override_immediate_call_return_value: false,
|
||||
},
|
||||
Evm::new_with_inspector(
|
||||
RevmContext::new(db, SPEC_ID)
|
||||
.modify_cfg_chained(|cfg| {
|
||||
cfg.chain_id = CHAIN_ID.try_into().unwrap();
|
||||
})
|
||||
.modify_tx_chained(|tx: &mut TxEnv| {
|
||||
tx.gas_limit = u64::MAX;
|
||||
tx.kind = self.address.into();
|
||||
}),
|
||||
WorstCaseCallInspector {
|
||||
erc20,
|
||||
call_depth: 0,
|
||||
unused_gas: 0,
|
||||
override_immediate_call_return_value: false,
|
||||
},
|
||||
instruction: EthInstructions::default(),
|
||||
precompiles: precompiles(),
|
||||
}
|
||||
EthInstructions::default(),
|
||||
precompiles(),
|
||||
)
|
||||
}
|
||||
|
||||
/// The worst-case gas cost for a legacy transaction which executes this batch.
|
||||
@@ -262,7 +261,7 @@ impl Router {
|
||||
let fee = if fee_per_gas == U256::ZERO { U256::ZERO } else { U256::ONE };
|
||||
|
||||
// Set a balance of the amount sent out to ensure we don't error on that premise
|
||||
gas_estimator.data.ctx.modify_db(|db| {
|
||||
gas_estimator.ctx.modify_db(|db| {
|
||||
let account = db.load_account(self.address).unwrap();
|
||||
account.info.balance = fee + outs.0.iter().map(|out| out.amount).sum::<U256>();
|
||||
});
|
||||
@@ -290,7 +289,7 @@ impl Router {
|
||||
consistent use of nonce #1 shows storage read/writes aren't being persisted. They're solely
|
||||
returned upon execution in a `state` field we ignore.
|
||||
*/
|
||||
gas_estimator.data.ctx.modify_tx(|tx| {
|
||||
gas_estimator.ctx.modify_tx(|tx| {
|
||||
tx.caller = Address::from({
|
||||
/*
|
||||
We assume the transaction sender is not the destination of any `OutInstruction`, making
|
||||
@@ -317,21 +316,17 @@ impl Router {
|
||||
});
|
||||
|
||||
// Execute the transaction
|
||||
let mut gas = match MainnetHandler::<
|
||||
_,
|
||||
EVMError<Infallible, InvalidTransaction>,
|
||||
EthFrame<_, _, _>,
|
||||
>::default()
|
||||
.inspect_run(&mut gas_estimator)
|
||||
.unwrap()
|
||||
.result
|
||||
{
|
||||
ExecutionResult::Success { gas_used, gas_refunded, .. } => {
|
||||
assert_eq!(gas_refunded, 0);
|
||||
gas_used
|
||||
}
|
||||
res => panic!("estimated execute transaction failed: {res:?}"),
|
||||
};
|
||||
let mut gas =
|
||||
match MainnetHandler::<_, EVMError<Infallible, InvalidTransaction>, EthFrame<_>>::default()
|
||||
.inspect_run(&mut gas_estimator)
|
||||
.unwrap()
|
||||
{
|
||||
ExecutionResult::Success { gas_used, gas_refunded, .. } => {
|
||||
assert_eq!(gas_refunded, 0);
|
||||
gas_used
|
||||
}
|
||||
res => panic!("estimated execute transaction failed: {res:?}"),
|
||||
};
|
||||
gas += gas_estimator.into_inspector().unused_gas;
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use dkg::ThresholdKeys;
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dkg::{ThresholdKeys, Curves, Secp256k1};
|
||||
|
||||
use ethereum_schnorr::PublicKey;
|
||||
|
||||
@@ -9,17 +9,23 @@ impl key_gen::KeyGenParams for KeyGenParams {
|
||||
|
||||
type ExternalNetworkCiphersuite = Secp256k1;
|
||||
|
||||
fn tweak_keys(keys: &mut ThresholdKeys<Self::ExternalNetworkCiphersuite>) {
|
||||
fn tweak_keys(
|
||||
keys: &mut ThresholdKeys<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve>,
|
||||
) {
|
||||
while PublicKey::new(keys.group_key()).is_none() {
|
||||
*keys = keys.offset(<Secp256k1 as Ciphersuite>::F::ONE);
|
||||
*keys = keys.clone().offset(<<Secp256k1 as Curves>::ToweringCurve as Ciphersuite>::F::ONE);
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_key(key: <Self::ExternalNetworkCiphersuite as Ciphersuite>::G) -> Vec<u8> {
|
||||
fn encode_key(
|
||||
key: <<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G,
|
||||
) -> Vec<u8> {
|
||||
PublicKey::new(key).unwrap().eth_repr().to_vec()
|
||||
}
|
||||
|
||||
fn decode_key(key: &[u8]) -> Option<<Self::ExternalNetworkCiphersuite as Ciphersuite>::G> {
|
||||
fn decode_key(
|
||||
key: &[u8],
|
||||
) -> Option<<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G> {
|
||||
PublicKey::from_eth_repr(key.try_into().ok()?).map(|key| key.point())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use serai_client::networks::ethereum::Address;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ use std::{io, collections::HashMap};
|
||||
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use ciphersuite::{Ciphersuite, Secp256k1};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use frost::{
|
||||
dkg::{Participant, ThresholdKeys},
|
||||
FrostError,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use alloy_core::primitives::U256;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::io;
|
||||
|
||||
use ciphersuite::Secp256k1;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use alloy_core::primitives::{U256, Address as EthereumAddress};
|
||||
|
||||
@@ -20,9 +20,9 @@ workspace = true
|
||||
k256 = { version = "0.13", default-features = false, features = ["std"] }
|
||||
|
||||
alloy-core = { version = "1", default-features = false }
|
||||
alloy-consensus = { version = "0.14", default-features = false, features = ["std"] }
|
||||
alloy-consensus = { version = "1", default-features = false, features = ["std"] }
|
||||
|
||||
alloy-rpc-types-eth = { version = "0.14", default-features = false }
|
||||
alloy-provider = { version = "0.14", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "1", default-features = false }
|
||||
alloy-provider = { version = "1", default-features = false }
|
||||
|
||||
ethereum-primitives = { package = "serai-processor-ethereum-primitives", path = "../primitives", default-features = false }
|
||||
|
||||
@@ -31,9 +31,7 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] }
|
||||
# Cryptography
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", default-features = false, features = ["std"] }
|
||||
ec-divisors = { git = "https://github.com/kayabaNerve/monero-oxide", rev = "54da48f27a05fa8656014942919da1dfbab4d8e3", default-features = false }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "ristretto"] }
|
||||
|
||||
# Substrate
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::collections::HashMap;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
|
||||
use dkg::{Participant, ThresholdCore, ThresholdKeys, evrf::EvrfCurve};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dkg::*;
|
||||
|
||||
use serai_validator_sets_primitives::Session;
|
||||
|
||||
@@ -17,9 +17,9 @@ pub(crate) struct Params<P: KeyGenParams> {
|
||||
pub(crate) t: u16,
|
||||
pub(crate) n: u16,
|
||||
pub(crate) substrate_evrf_public_keys:
|
||||
Vec<<<Ristretto as EvrfCurve>::EmbeddedCurve as Ciphersuite>::G>,
|
||||
Vec<<<Ristretto as Curves>::EmbeddedCurve as Ciphersuite>::G>,
|
||||
pub(crate) network_evrf_public_keys:
|
||||
Vec<<<P::ExternalNetworkCiphersuite as EvrfCurve>::EmbeddedCurve as Ciphersuite>::G>,
|
||||
Vec<<<P::ExternalNetworkCiphersuite as Curves>::EmbeddedCurve as Ciphersuite>::G>,
|
||||
}
|
||||
|
||||
#[derive(BorshSerialize, BorshDeserialize)]
|
||||
@@ -85,7 +85,7 @@ impl<P: KeyGenParams> KeyGenDb<P> {
|
||||
.substrate_evrf_public_keys
|
||||
.into_iter()
|
||||
.map(|key| {
|
||||
<<Ristretto as EvrfCurve>::EmbeddedCurve as Ciphersuite>::read_G(&mut key.as_slice())
|
||||
<<Ristretto as Curves>::EmbeddedCurve as Ciphersuite>::read_G(&mut key.as_slice())
|
||||
.unwrap()
|
||||
})
|
||||
.collect(),
|
||||
@@ -93,7 +93,7 @@ impl<P: KeyGenParams> KeyGenDb<P> {
|
||||
.network_evrf_public_keys
|
||||
.into_iter()
|
||||
.map(|key| {
|
||||
<<P::ExternalNetworkCiphersuite as EvrfCurve>::EmbeddedCurve as Ciphersuite>::read_G::<
|
||||
<<P::ExternalNetworkCiphersuite as Curves>::EmbeddedCurve as Ciphersuite>::read_G::<
|
||||
&[u8],
|
||||
>(&mut key.as_ref())
|
||||
.unwrap()
|
||||
@@ -117,8 +117,8 @@ impl<P: KeyGenParams> KeyGenDb<P> {
|
||||
pub(crate) fn set_key_shares(
|
||||
txn: &mut impl DbTxn,
|
||||
session: Session,
|
||||
substrate_keys: &[ThresholdKeys<Ristretto>],
|
||||
network_keys: &[ThresholdKeys<P::ExternalNetworkCiphersuite>],
|
||||
substrate_keys: &[ThresholdKeys<<Ristretto as Curves>::ToweringCurve>],
|
||||
network_keys: &[ThresholdKeys<<P::ExternalNetworkCiphersuite as Curves>::ToweringCurve>],
|
||||
) {
|
||||
assert_eq!(substrate_keys.len(), network_keys.len());
|
||||
|
||||
@@ -134,16 +134,18 @@ impl<P: KeyGenParams> KeyGenDb<P> {
|
||||
pub(crate) fn key_shares(
|
||||
getter: &impl Get,
|
||||
session: Session,
|
||||
) -> Option<(Vec<ThresholdKeys<Ristretto>>, Vec<ThresholdKeys<P::ExternalNetworkCiphersuite>>)>
|
||||
{
|
||||
) -> Option<(
|
||||
Vec<ThresholdKeys<<Ristretto as Curves>::ToweringCurve>>,
|
||||
Vec<ThresholdKeys<<P::ExternalNetworkCiphersuite as Curves>::ToweringCurve>>,
|
||||
)> {
|
||||
let keys = _db::KeyShares::get(getter, &session)?;
|
||||
let mut keys: &[u8] = keys.as_ref();
|
||||
|
||||
let mut substrate_keys = vec![];
|
||||
let mut network_keys = vec![];
|
||||
while !keys.is_empty() {
|
||||
substrate_keys.push(ThresholdKeys::new(ThresholdCore::read(&mut keys).unwrap()));
|
||||
let mut these_network_keys = ThresholdKeys::new(ThresholdCore::read(&mut keys).unwrap());
|
||||
substrate_keys.push(ThresholdKeys::read(&mut keys).unwrap());
|
||||
let mut these_network_keys = ThresholdKeys::read(&mut keys).unwrap();
|
||||
P::tweak_keys(&mut these_network_keys);
|
||||
network_keys.push(these_network_keys);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
collections::HashMap,
|
||||
};
|
||||
|
||||
use dkg::evrf::*;
|
||||
use dkg::*;
|
||||
|
||||
use serai_validator_sets_primitives::MAX_KEY_SHARES_PER_SET;
|
||||
|
||||
@@ -21,14 +21,14 @@ use serai_validator_sets_primitives::MAX_KEY_SHARES_PER_SET;
|
||||
static GENERATORS: LazyLock<Mutex<HashMap<TypeId, &'static (dyn Send + Sync + Any)>>> =
|
||||
LazyLock::new(|| Mutex::new(HashMap::new()));
|
||||
|
||||
pub(crate) fn generators<C: EvrfCurve>() -> &'static EvrfGenerators<C> {
|
||||
pub(crate) fn generators<C: 'static + Curves>() -> &'static Generators<C> {
|
||||
GENERATORS
|
||||
.lock()
|
||||
.unwrap()
|
||||
.entry(TypeId::of::<C>())
|
||||
.or_insert_with(|| {
|
||||
// If we haven't prior needed generators for this Ciphersuite, generate new ones
|
||||
Box::leak(Box::new(EvrfGenerators::<C>::new(
|
||||
Box::leak(Box::new(Generators::<C>::new(
|
||||
(MAX_KEY_SHARES_PER_SET * 2 / 3) + 1,
|
||||
MAX_KEY_SHARES_PER_SET,
|
||||
)))
|
||||
|
||||
@@ -13,9 +13,9 @@ use blake2::{Digest, Blake2s256};
|
||||
use transcript::{Transcript, RecommendedTranscript};
|
||||
use ciphersuite::{
|
||||
group::{Group, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dkg::{Participant, ThresholdKeys, evrf::*};
|
||||
use dkg::*;
|
||||
|
||||
use serai_validator_sets_primitives::Session;
|
||||
use messages::key_gen::*;
|
||||
@@ -34,33 +34,36 @@ pub trait KeyGenParams {
|
||||
const ID: &'static str;
|
||||
|
||||
/// The curve used for the external network.
|
||||
type ExternalNetworkCiphersuite: EvrfCurve<
|
||||
EmbeddedCurve: Ciphersuite<
|
||||
G: ec_divisors::DivisorCurve<
|
||||
FieldElement = <Self::ExternalNetworkCiphersuite as Ciphersuite>::F,
|
||||
>,
|
||||
>,
|
||||
>;
|
||||
type ExternalNetworkCiphersuite: 'static + Curves;
|
||||
|
||||
/// Tweaks keys as necessary/beneficial.
|
||||
///
|
||||
/// A default implementation which doesn't perform any tweaking is provided.
|
||||
fn tweak_keys(keys: &mut ThresholdKeys<Self::ExternalNetworkCiphersuite>) {
|
||||
fn tweak_keys(
|
||||
keys: &mut ThresholdKeys<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve>,
|
||||
) {
|
||||
let _ = keys;
|
||||
}
|
||||
|
||||
/// Encode keys as optimal.
|
||||
///
|
||||
/// A default implementation is provided which calls the traditional `to_bytes`.
|
||||
fn encode_key(key: <Self::ExternalNetworkCiphersuite as Ciphersuite>::G) -> Vec<u8> {
|
||||
fn encode_key(
|
||||
key: <<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G,
|
||||
) -> Vec<u8> {
|
||||
key.to_bytes().as_ref().to_vec()
|
||||
}
|
||||
|
||||
/// Decode keys from their optimal encoding.
|
||||
///
|
||||
/// A default implementation is provided which calls the traditional `from_bytes`.
|
||||
fn decode_key(mut key: &[u8]) -> Option<<Self::ExternalNetworkCiphersuite as Ciphersuite>::G> {
|
||||
let res = <Self::ExternalNetworkCiphersuite as Ciphersuite>::read_G(&mut key).ok()?;
|
||||
fn decode_key(
|
||||
mut key: &[u8],
|
||||
) -> Option<<<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::G> {
|
||||
let res = <<Self::ExternalNetworkCiphersuite as Curves>::ToweringCurve as Ciphersuite>::read_G(
|
||||
&mut key,
|
||||
)
|
||||
.ok()?;
|
||||
if !key.is_empty() {
|
||||
None?;
|
||||
}
|
||||
@@ -96,10 +99,10 @@ pub trait KeyGenParams {
|
||||
|
||||
Returns the coerced keys and faulty participants.
|
||||
*/
|
||||
fn coerce_keys<C: EvrfCurve>(
|
||||
fn coerce_keys<C: 'static + Curves>(
|
||||
key_bytes: &[impl AsRef<[u8]>],
|
||||
) -> (Vec<<C::EmbeddedCurve as Ciphersuite>::G>, Vec<Participant>) {
|
||||
fn evrf_key<C: EvrfCurve>(key: &[u8]) -> Option<<C::EmbeddedCurve as Ciphersuite>::G> {
|
||||
fn evrf_key<C: 'static + Curves>(key: &[u8]) -> Option<<C::EmbeddedCurve as Ciphersuite>::G> {
|
||||
let mut repr = <<C::EmbeddedCurve as Ciphersuite>::G as GroupEncoding>::Repr::default();
|
||||
if repr.as_ref().len() != key.len() {
|
||||
None?;
|
||||
@@ -146,21 +149,18 @@ fn coerce_keys<C: EvrfCurve>(
|
||||
/// An instance of the Serai key generation protocol.
|
||||
#[derive(Debug)]
|
||||
pub struct KeyGen<P: KeyGenParams> {
|
||||
substrate_evrf_private_key:
|
||||
Zeroizing<<<Ristretto as EvrfCurve>::EmbeddedCurve as Ciphersuite>::F>,
|
||||
substrate_evrf_private_key: Zeroizing<<<Ristretto as Curves>::EmbeddedCurve as Ciphersuite>::F>,
|
||||
network_evrf_private_key:
|
||||
Zeroizing<<<P::ExternalNetworkCiphersuite as EvrfCurve>::EmbeddedCurve as Ciphersuite>::F>,
|
||||
Zeroizing<<<P::ExternalNetworkCiphersuite as Curves>::EmbeddedCurve as Ciphersuite>::F>,
|
||||
}
|
||||
|
||||
impl<P: KeyGenParams> KeyGen<P> {
|
||||
/// Create a new key generation instance.
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(
|
||||
substrate_evrf_private_key: Zeroizing<
|
||||
<<Ristretto as EvrfCurve>::EmbeddedCurve as Ciphersuite>::F,
|
||||
>,
|
||||
substrate_evrf_private_key: Zeroizing<<<Ristretto as Curves>::EmbeddedCurve as Ciphersuite>::F>,
|
||||
network_evrf_private_key: Zeroizing<
|
||||
<<P::ExternalNetworkCiphersuite as EvrfCurve>::EmbeddedCurve as Ciphersuite>::F,
|
||||
<<P::ExternalNetworkCiphersuite as Curves>::EmbeddedCurve as Ciphersuite>::F,
|
||||
>,
|
||||
) -> KeyGen<P> {
|
||||
KeyGen { substrate_evrf_private_key, network_evrf_private_key }
|
||||
@@ -171,8 +171,10 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
pub fn key_shares(
|
||||
getter: &impl Get,
|
||||
session: Session,
|
||||
) -> Option<(Vec<ThresholdKeys<Ristretto>>, Vec<ThresholdKeys<P::ExternalNetworkCiphersuite>>)>
|
||||
{
|
||||
) -> Option<(
|
||||
Vec<ThresholdKeys<<Ristretto as Curves>::ToweringCurve>>,
|
||||
Vec<ThresholdKeys<<P::ExternalNetworkCiphersuite as Curves>::ToweringCurve>>,
|
||||
)> {
|
||||
// This is safe, despite not having a txn, since it's a static value
|
||||
// It doesn't change over time/in relation to other operations
|
||||
// It is solely set or unset
|
||||
@@ -209,14 +211,14 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
faulty.extend(additional_faulty);
|
||||
|
||||
// Participate for both Substrate and the network
|
||||
fn participate<C: EvrfCurve>(
|
||||
fn participate<C: 'static + Curves>(
|
||||
context: [u8; 32],
|
||||
threshold: u16,
|
||||
evrf_public_keys: &[<C::EmbeddedCurve as Ciphersuite>::G],
|
||||
evrf_private_key: &Zeroizing<<C::EmbeddedCurve as Ciphersuite>::F>,
|
||||
output: &mut impl io::Write,
|
||||
) {
|
||||
let participation = EvrfDkg::<C>::participate(
|
||||
let participation = Dkg::<C>::participate(
|
||||
&mut OsRng,
|
||||
generators(),
|
||||
context,
|
||||
@@ -270,7 +272,7 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
}
|
||||
|
||||
CoordinatorMessage::Participation { session, participant, participation } => {
|
||||
log::debug!("received participation from {:?} for {:?}", participant, session);
|
||||
log::debug!("received participation from {participant:?} for {session:?}");
|
||||
|
||||
let Params { t: threshold, n, substrate_evrf_public_keys, network_evrf_public_keys } =
|
||||
KeyGenDb::<P>::params(txn, session).unwrap();
|
||||
@@ -305,9 +307,9 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
// participations and continue. We solely have to verify them, as to identify malicious
|
||||
// participants and prevent DoSs, before returning
|
||||
if Self::key_shares(txn, session).is_some() {
|
||||
log::debug!("already finished generating a key for {:?}", session);
|
||||
log::debug!("already finished generating a key for {session:?}");
|
||||
|
||||
match EvrfDkg::<Ristretto>::verify(
|
||||
match Dkg::<Ristretto>::verify(
|
||||
&mut OsRng,
|
||||
generators(),
|
||||
context::<P>(session, SUBSTRATE_KEY_CONTEXT),
|
||||
@@ -324,7 +326,7 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
}
|
||||
}
|
||||
|
||||
match EvrfDkg::<P::ExternalNetworkCiphersuite>::verify(
|
||||
match Dkg::<P::ExternalNetworkCiphersuite>::verify(
|
||||
&mut OsRng,
|
||||
generators(),
|
||||
context::<P>(session, NETWORK_KEY_CONTEXT),
|
||||
@@ -404,7 +406,7 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
}
|
||||
|
||||
// If we now have the threshold participating, verify their `Participation`s
|
||||
fn verify_dkg<P: KeyGenParams, C: EvrfCurve>(
|
||||
fn verify_dkg<P: KeyGenParams, C: 'static + Curves>(
|
||||
txn: &mut impl DbTxn,
|
||||
session: Session,
|
||||
true_if_substrate_false_if_network: bool,
|
||||
@@ -412,7 +414,7 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
evrf_public_keys: &[<C::EmbeddedCurve as Ciphersuite>::G],
|
||||
substrate_participations: &mut HashMap<Participant, Vec<u8>>,
|
||||
network_participations: &mut HashMap<Participant, Vec<u8>>,
|
||||
) -> Result<EvrfDkg<C>, Vec<ProcessorMessage>> {
|
||||
) -> Result<Dkg<C>, Vec<ProcessorMessage>> {
|
||||
// Parse the `Participation`s
|
||||
let participations = (if true_if_substrate_false_if_network {
|
||||
&*substrate_participations
|
||||
@@ -433,7 +435,7 @@ impl<P: KeyGenParams> KeyGen<P> {
|
||||
.collect();
|
||||
|
||||
// Actually call verify on the DKG
|
||||
match EvrfDkg::<C>::verify(
|
||||
match Dkg::<C>::verify(
|
||||
&mut OsRng,
|
||||
generators(),
|
||||
context::<P>(
|
||||
|
||||
@@ -25,8 +25,8 @@ zeroize = { version = "1", default-features = false, features = ["std"] }
|
||||
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["std"] }
|
||||
borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] }
|
||||
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std", "ed25519"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use ciphersuite::Ed25519;
|
||||
use dkg::Ed25519;
|
||||
|
||||
pub(crate) struct KeyGenParams;
|
||||
impl key_gen::KeyGenParams for KeyGenParams {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ed25519};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ed25519;
|
||||
|
||||
use monero_wallet::{
|
||||
block::Block as MBlock, rpc::ScannableBlock as MScannableBlock, ScanError, GuaranteedScanner,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ed25519};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ed25519;
|
||||
|
||||
use monero_wallet::{address::SubaddressIndex, ViewPairError, GuaranteedViewPair};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
use ciphersuite::{group::Group, Ciphersuite, Ed25519};
|
||||
use ciphersuite::{group::Group, Ciphersuite};
|
||||
use dalek_ff_group::Ed25519;
|
||||
|
||||
use monero_wallet::WalletOutput;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::io;
|
||||
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use ciphersuite::Ed25519;
|
||||
use dalek_ff_group::Ed25519;
|
||||
use frost::{dkg::ThresholdKeys, sign::PreprocessMachine};
|
||||
|
||||
use monero_wallet::{
|
||||
|
||||
@@ -4,7 +4,8 @@ use zeroize::Zeroizing;
|
||||
use rand_core::SeedableRng;
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ed25519};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ed25519;
|
||||
|
||||
use monero_wallet::rpc::{FeeRate, RpcError};
|
||||
|
||||
@@ -200,6 +201,9 @@ impl TransactionPlanner<Rpc, ()> for Planner {
|
||||
Err(SendError::TooLargeTransaction) => {
|
||||
panic!("too large transaction despite MAX_INPUTS/MAX_OUTPUTS")
|
||||
}
|
||||
Err(SendError::AmountsUnrepresentable { .. }) => {
|
||||
panic!("monero-wallet AmountsUnrepresentable")
|
||||
}
|
||||
Err(
|
||||
SendError::WrongPrivateKey |
|
||||
SendError::MaliciousSerialization |
|
||||
@@ -255,6 +259,9 @@ impl TransactionPlanner<Rpc, ()> for Planner {
|
||||
Err(SendError::TooLargeTransaction) => {
|
||||
panic!("too large transaction despite MAX_INPUTS/MAX_OUTPUTS")
|
||||
}
|
||||
Err(SendError::AmountsUnrepresentable { .. }) => {
|
||||
panic!("monero-wallet AmountsUnrepresentable")
|
||||
}
|
||||
Err(
|
||||
SendError::WrongPrivateKey |
|
||||
SendError::MaliciousSerialization |
|
||||
|
||||
@@ -70,12 +70,13 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for IndexTask<D, S> {
|
||||
Err(e) => Err(format!("couldn't fetch the latest finalized block number: {e:?}"))?,
|
||||
};
|
||||
|
||||
#[allow(clippy::uninlined_format_args)]
|
||||
if latest_finalized < our_latest_finalized {
|
||||
// Explicitly log this as an error as returned ephemeral errors are logged with debug
|
||||
// This doesn't panic as the node should sync along our indexed chain, and if it doesn't,
|
||||
// we'll panic at that point in time
|
||||
log::error!(
|
||||
"node is out of sync, latest finalized {} is behind our indexed {}",
|
||||
"node is out of sync, latest finalized ({}) is behind our indexed ({})",
|
||||
latest_finalized,
|
||||
our_latest_finalized
|
||||
);
|
||||
|
||||
@@ -26,6 +26,7 @@ zeroize = { version = "1", default-features = false, features = ["std"] }
|
||||
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false }
|
||||
frost-schnorrkel = { path = "../../crypto/schnorrkel", default-features = false }
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ use core::future::Future;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use blake2::{digest::typenum::U32, Digest, Blake2b};
|
||||
use ciphersuite::{group::GroupEncoding, Ristretto};
|
||||
use ciphersuite::group::GroupEncoding;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use core::future::Future;
|
||||
|
||||
use ciphersuite::Ristretto;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
@@ -7,8 +7,9 @@ use std::collections::HashMap;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
|
||||
use frost::dkg::{ThresholdCore, ThresholdKeys};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use serai_primitives::Signature;
|
||||
use serai_validator_sets_primitives::{Session, SlashReport};
|
||||
@@ -262,11 +263,8 @@ impl<
|
||||
let mut substrate_keys = vec![];
|
||||
let mut external_keys = vec![];
|
||||
while !buf.is_empty() {
|
||||
substrate_keys
|
||||
.push(ThresholdKeys::from(ThresholdCore::<Ristretto>::read(&mut buf).unwrap()));
|
||||
external_keys.push(ThresholdKeys::from(
|
||||
ThresholdCore::<CiphersuiteFor<S, Sch>>::read(&mut buf).unwrap(),
|
||||
));
|
||||
substrate_keys.push(ThresholdKeys::<Ristretto>::read(&mut buf).unwrap());
|
||||
external_keys.push(ThresholdKeys::<CiphersuiteFor<S, Sch>>::read(&mut buf).unwrap());
|
||||
}
|
||||
|
||||
tasks.insert(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use core::{marker::PhantomData, future::Future};
|
||||
|
||||
use ciphersuite::Ristretto;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::dkg::ThresholdKeys;
|
||||
|
||||
use serai_primitives::Signature;
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use ciphersuite::Ristretto;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use frost::{
|
||||
dkg::{Participant, ThresholdKeys},
|
||||
FrostError,
|
||||
|
||||
@@ -51,8 +51,9 @@ hex = "0.4"
|
||||
|
||||
blake2 = "0.10"
|
||||
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" }
|
||||
dkg-musig = { path = "../../crypto/dkg/musig" }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["tests"] }
|
||||
schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use core::{str::FromStr, fmt};
|
||||
|
||||
use scale::{Encode, Decode};
|
||||
|
||||
use dalek_ff_group::Ed25519;
|
||||
use ciphersuite::Ciphersuite;
|
||||
|
||||
|
||||
@@ -301,13 +301,13 @@ impl Serai {
|
||||
///
|
||||
/// The binding occurs at time of call. This does not track the latest finalized block and update
|
||||
/// itself.
|
||||
pub async fn as_of_latest_finalized_block(&self) -> Result<TemporalSerai, SeraiError> {
|
||||
pub async fn as_of_latest_finalized_block(&self) -> Result<TemporalSerai<'_>, SeraiError> {
|
||||
let latest = self.latest_finalized_block_hash().await?;
|
||||
Ok(TemporalSerai { serai: self, block: latest, events: RwLock::new(None) })
|
||||
}
|
||||
|
||||
/// Returns a TemporalSerai able to retrieve state as of the specified block.
|
||||
pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai {
|
||||
pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai<'_> {
|
||||
TemporalSerai { serai: self, block, events: RwLock::new(None) }
|
||||
}
|
||||
|
||||
@@ -424,11 +424,11 @@ impl TemporalSerai<'_> {
|
||||
SeraiValidatorSets(self)
|
||||
}
|
||||
|
||||
pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity {
|
||||
pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity<'_> {
|
||||
SeraiGenesisLiquidity(self)
|
||||
}
|
||||
|
||||
pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens {
|
||||
pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens<'_> {
|
||||
SeraiLiquidityTokens(self)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ async fn set_values(serai: &Serai, values: &Values) {
|
||||
frost::tests::algorithm_machines(
|
||||
&mut OsRng,
|
||||
&Schnorrkel::new(b"substrate"),
|
||||
&HashMap::from([(threshold_keys.params().i(), threshold_keys.into())]),
|
||||
&HashMap::from([(threshold_keys.params().i(), threshold_keys)]),
|
||||
),
|
||||
&oraclize_values_message(&set, values),
|
||||
);
|
||||
|
||||
@@ -55,8 +55,8 @@ pub async fn set_keys(
|
||||
}
|
||||
|
||||
let mut musig_keys = HashMap::new();
|
||||
for tk in threshold_keys {
|
||||
musig_keys.insert(tk.params().i(), tk.into());
|
||||
for threshold_keys in threshold_keys {
|
||||
musig_keys.insert(threshold_keys.params().i(), threshold_keys);
|
||||
}
|
||||
|
||||
let sig = frost::tests::sign_without_caching(
|
||||
|
||||
@@ -5,8 +5,10 @@ use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ed25519, Secp256k1,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ed25519;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use sp_core::{
|
||||
Pair as PairTrait,
|
||||
@@ -67,7 +69,7 @@ async fn test_external_address(serai: Serai) {
|
||||
set_network_keys::<Secp256k1>(
|
||||
&serai,
|
||||
ExternalValidatorSet { session: Session(0), network },
|
||||
&[pair.clone()],
|
||||
core::slice::from_ref(&pair),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
@@ -1298,7 +1298,7 @@ fn cannot_block_pool_creation() {
|
||||
));
|
||||
// Then, the attacker creates 14 tokens and sends one of each to the pool account
|
||||
// skip the coin1 and coin2 coins.
|
||||
for coin in coins().into_iter().filter(|c| (*c != coin1 && *c != coin2)) {
|
||||
for coin in coins().into_iter().filter(|c| (*c != coin1) && (*c != coin2)) {
|
||||
assert_ok!(CoinsPallet::<Test>::mint(attacker, Balance { coin, amount: Amount(1000) }));
|
||||
assert_ok!(CoinsPallet::<Test>::transfer_internal(
|
||||
attacker,
|
||||
|
||||
@@ -28,6 +28,8 @@ log = "0.4"
|
||||
schnorrkel = "0.11"
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite" }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
embedwards25519 = { path = "../../crypto/evrf/embedwards25519" }
|
||||
secq256k1 = { path = "../../crypto/evrf/secq256k1" }
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::result_large_err)]
|
||||
|
||||
mod keystore;
|
||||
|
||||
mod chain_spec;
|
||||
|
||||
@@ -50,8 +50,10 @@ where
|
||||
{
|
||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||
use ciphersuite::{Ciphersuite, Ed25519, Secp256k1};
|
||||
use bitcoin_serai::{bitcoin, crypto::x_only};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::{k256::elliptic_curve::point::AffineCoordinates, Secp256k1};
|
||||
use dalek_ff_group::Ed25519;
|
||||
use bitcoin_serai::bitcoin;
|
||||
|
||||
let mut module = RpcModule::new(());
|
||||
let FullDeps { id, client, pool, deny_unsafe, authority_discovery } = deps;
|
||||
@@ -128,7 +130,11 @@ where
|
||||
.map_err(|_| Error::Custom("invalid key stored in db".to_string()))?;
|
||||
|
||||
let addr = bitcoin::Address::p2tr_tweaked(
|
||||
bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked(x_only(&key)),
|
||||
bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked(
|
||||
bitcoin::key::XOnlyPublicKey::from_slice(key.to_affine().x().as_slice()).map_err(
|
||||
|_| Error::Custom("x-coordinate for Bitcoin key was invalid".to_string()),
|
||||
)?,
|
||||
),
|
||||
bitcoin::address::KnownHrp::Mainnet,
|
||||
);
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ 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 = ["std"] }
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg-musig = { path = "../../../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../../../crypto/frost", features = ["tests"] }
|
||||
schnorrkel = { path = "../../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@ use crate::{mock::*, primitives::*};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use frost::dkg::musig::musig;
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg_musig::musig;
|
||||
use schnorrkel::Schnorrkel;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
@@ -87,14 +88,14 @@ fn set_keys_signature(set: &ExternalValidatorSet, key_pair: &KeyPair, pairs: &[P
|
||||
assert_eq!(Ristretto::generator() * secret_key, pub_keys[i]);
|
||||
|
||||
threshold_keys.push(
|
||||
musig::<Ristretto>(&musig_context((*set).into()), &Zeroizing::new(secret_key), &pub_keys)
|
||||
musig::<Ristretto>(musig_context((*set).into()), Zeroizing::new(secret_key), &pub_keys)
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let mut musig_keys = HashMap::new();
|
||||
for tk in threshold_keys {
|
||||
musig_keys.insert(tk.params().i(), tk.into());
|
||||
for threshold_keys in threshold_keys {
|
||||
musig_keys.insert(threshold_keys.params().i(), threshold_keys);
|
||||
}
|
||||
|
||||
let sig = frost::tests::sign_without_caching(
|
||||
|
||||
@@ -25,6 +25,8 @@ rand_core = { version = "0.6", default-features = false }
|
||||
blake2 = "0.10"
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
embedwards25519 = { path = "../../crypto/evrf/embedwards25519" }
|
||||
secq256k1 = { path = "../../crypto/evrf/secq256k1" }
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@ use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use embedwards25519::Embedwards25519;
|
||||
use secq256k1::Secq256k1;
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ use blake2::{
|
||||
digest::{consts::U32, Digest},
|
||||
Blake2b,
|
||||
};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto, Secp256k1};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite}
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg::Participant;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
@@ -5,8 +5,10 @@ use rand_core::OsRng;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ristretto, Secp256k1,
|
||||
Ciphersuite,
|
||||
};
|
||||
use ciphersuite_kp256::Secq256k1;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg::Participant;
|
||||
|
||||
use serai_client::{
|
||||
|
||||
@@ -23,6 +23,7 @@ zeroize = { version = "1", default-features = false }
|
||||
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
|
||||
serai-primitives = { path = "../../substrate/primitives" }
|
||||
serai-message-queue = { path = "../../message-queue" }
|
||||
|
||||
@@ -4,8 +4,9 @@ use rand_core::OsRng;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS};
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@ rand_core = { version = "0.6", default-features = false, features = ["getrandom"
|
||||
|
||||
curve25519-dalek = "4"
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-evrf", path = "../../crypto/dkg/evrf", default-features = false, features = ["std"] }
|
||||
|
||||
bitcoin-serai = { path = "../../networks/bitcoin" }
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite, Secp256k1, Ed25519, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dkg::evrf::*;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
use dalek_ff_group::{Ed25519, Ristretto};
|
||||
use dkg::*;
|
||||
|
||||
use serai_client::primitives::{ExternalNetworkId, insecure_arbitrary_key_from_name};
|
||||
use messages::{ProcessorMessage, CoordinatorMessage};
|
||||
|
||||
Reference in New Issue
Block a user