Skip to content

Commit a5f00ca

Browse files
committed
Use serde feature for KES
1 parent 51f1f57 commit a5f00ca

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

Cargo.lock

Lines changed: 17 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ bls12_381 = { version = "0.7.0", features = ["experimental"], optional = true }
1313
blst = { version = "0.3.10", optional = true }
1414
bytes = "1"
1515
digest = { version = "0.9.0", features = ["alloc"] }
16-
ed25519-dalek = "1.0.1"
16+
ed25519-dalek = {version = "1.0.1", features = ["serde"] }
1717
generic-array = "0.14"
1818
group = { version = "0.12.0", features = ["tests"], optional = true }
19-
kes-summed-ed25519 = { git = "https://github.com/input-output-hk/kes" }
19+
kes-summed-ed25519 = { git = "https://github.com/input-output-hk/kes", features = ["serde"]}
2020
libc = "0.2.40"
2121
num-bigint = "0.4.0"
2222
num-integer = { version = "0.1.44", optional = true }

mithril-core/src/stm.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ use crate::multi_sig_blast::{Signature, SigningKey, VerificationKey, Verificatio
114114
#[cfg(not(feature = "blast"))]
115115
use crate::multi_sig_zcash::{Signature, SigningKey, VerificationKey, VerificationKeyPoP};
116116
use digest::{Digest, FixedOutput};
117+
use kes_summed_ed25519::kes::{Sum6Kes, Sum6KesSig};
118+
use kes_summed_ed25519::traits::KesSk;
117119
use rand_core::{CryptoRng, RngCore};
118120
use serde::{Deserialize, Serialize};
119121
use std::collections::{HashMap, HashSet};
120122
use std::convert::{From, TryFrom, TryInto};
121123
use std::hash::{Hash, Hasher};
122-
use kes_summed_ed25519::kes::{Sum6Kes, Sum6KesSig};
123-
use kes_summed_ed25519::traits::KesSk;
124124

125125
/// The quantity of stake held by a party, represented as a `u64`.
126126
pub type Stake = u64;
@@ -270,7 +270,13 @@ impl StmInitializer {
270270
/// Builds an `StmInitializer` that is ready to register with the key registration service.
271271
/// This function generates the signing and verification key with a PoP, signs the verification
272272
/// key with a provided KES signing key, and initialises the structure.
273-
pub fn setup_new<R: RngCore + CryptoRng>(params: StmParameters, kes_sk: &[u8], kes_period: usize, stake: Stake, rng: &mut R) -> Self {
273+
pub fn setup_new<R: RngCore + CryptoRng>(
274+
params: StmParameters,
275+
kes_sk: &[u8],
276+
kes_period: usize,
277+
stake: Stake,
278+
rng: &mut R,
279+
) -> Self {
274280
let sk = SigningKey::gen(rng);
275281
let pk = StmVerificationKeyPoP::from(&sk);
276282
let kes_sk = Sum6Kes::from_bytes(kes_sk).expect("Invalid KES key provided"); // todo: handle this
@@ -281,7 +287,7 @@ impl StmInitializer {
281287
params,
282288
sk,
283289
pk,
284-
kes_sig
290+
kes_sig,
285291
}
286292
}
287293
/// Builds an `StmInitializer` that is ready to register with the key registration service.
@@ -294,7 +300,7 @@ impl StmInitializer {
294300
params,
295301
sk,
296302
pk,
297-
kes_sig: None
303+
kes_sig: None,
298304
}
299305
}
300306

@@ -368,7 +374,7 @@ impl StmInitializer {
368374
params,
369375
sk,
370376
pk,
371-
kes_sig: None
377+
kes_sig: None,
372378
})
373379
}
374380
}
@@ -545,7 +551,7 @@ impl<D: Clone + Digest + FixedOutput> StmSigner<D> {
545551
params: self.params,
546552
pk: StmVerificationKeyPoP::from(&self.sk),
547553
sk: self.sk,
548-
kes_sig: None
554+
kes_sig: None,
549555
}
550556
}
551557

0 commit comments

Comments
 (0)