Skip to content

Commit 19a81ef

Browse files
authored
Merge branch 'main' into block_ser_ledger
2 parents 77f8bcf + 575a153 commit 19a81ef

File tree

21 files changed

+532
-95
lines changed

21 files changed

+532
-95
lines changed

.github/workflows/semantic_pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
rust/cardano-chain-follower
2121
rust/catalyst-voting
2222
rust/immutable-ledger
23+
rust/vote-tx-v1
24+
rust/vote-tx-v2
2325
rust/cbork
2426
rust/hermes-ipfs
2527
dart

docs/src/architecture/08_concepts/catalyst_voting/cddl/gen_vote_tx.cddl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tx-body<choice-t, proof-t, prop-id-t> = [
77
vote-type
88
event,
99
votes<choice-t, proof-t, prop-id-t>,
10-
voters-data,
10+
voter-data,
1111
]
1212

1313
vote-type = UUID ; e.g. Public or Private vote
@@ -25,7 +25,7 @@ choice<choice-t> = #6.24(bytes .cbor choice-t) ; encoded-cbor
2525
proof<proof-t> = #6.24(bytes .cbor proof-t) ; encoded-cbor
2626
prop-id<prop-id-t> = #6.24(bytes .cbor prop-id-t) ; encoded-cbor
2727

28-
voters-data = encoded-cbor
28+
voter-data = encoded-cbor
2929

3030
UUID = #6.37(bytes) ; UUID type
3131
signature = #6.98(cose.COSE_Sign) ; COSE signature

docs/src/architecture/08_concepts/catalyst_voting/gen_vote_tx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Vote:
4242
so it's redundant to provide an additional identifier for the proposal,
4343
so it could be placed `null`.
4444

45-
`voters-data` - an any additional voter's specific data.
45+
`voter-data` - an any additional voter's specific data.
4646

4747
### Transaction signing
4848

rust/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ members = [
1010
"catalyst-voting",
1111
"catalyst-voting", "jormungandr-vote-tx",
1212
"immutable-ledger",
13+
"vote-tx-v1",
14+
"vote-tx-v2",
1315
]
1416

1517
[workspace.package]

rust/Earthfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ COPY_SRC:
1010
.cargo .config \
1111
c509-certificate \
1212
cardano-chain-follower \
13-
catalyst-voting jormungandr-vote-tx \
13+
catalyst-voting vote-tx-v1 vote-tx-v2 \
1414
cbork cbork-abnf-parser cbork-cddl-parser \
1515
hermes-ipfs \
1616
immutable-ledger .
@@ -53,7 +53,7 @@ build:
5353
--cmd="/scripts/std_build.py" \
5454
--args1="--libs=c509-certificate --libs=cardano-chain-follower --libs=hermes-ipfs" \
5555
--args2="--libs=cbork-cddl-parser --libs=cbork-abnf-parser" \
56-
--args3="--libs=catalyst-voting --libs=jormungandr-vote-tx" \
56+
--args3="--libs=catalyst-voting --libs=vote-tx-v1 --libs=vote-tx-v2" \
5757
--args4="--bins=cbork/cbork" \
5858
--args5="--cov_report=$HOME/build/coverage-report.info" \
5959
--output="release/[^\./]+" \

rust/catalyst-voting/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ curve25519-dalek = { version = "4.1.3", features = ["digest", "rand_core"] }
2424
ed25519-dalek = { version = "2.1.1", features = ["rand_core"] }
2525
blake2b_simd = "1.0.2"
2626
rayon = "1.10.0"
27-
proptest = { version = "1.5.0" }
2827

2928
[dev-dependencies]
3029
criterion = "0.5.1"
30+
proptest = { version = "1.5.0" }
3131
# Potentially it could be replaced with using `proptest::property_test` attribute macro,
3232
# after this PR will be merged https://github.com/proptest-rs/proptest/pull/523
3333
test-strategy = "0.4.0"

rust/catalyst-voting/src/crypto/ed25519/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use ed25519_dalek::{
66
ed25519::signature::Signer, Signature as Ed25519Signature, SigningKey, VerifyingKey,
77
};
88

9+
use super::rng::default_rng;
910
use crate::crypto::rng::rand_core::CryptoRngCore;
1011

1112
/// `Ed25519` private key struct.
@@ -19,6 +20,11 @@ impl PrivateKey {
1920
Self(SigningKey::generate(rng))
2021
}
2122

23+
/// Randomly generate the `ElectionSecretKey` with the `crypto::default_rng`.
24+
pub fn random_with_default_rng() -> Self {
25+
Self::random(&mut default_rng())
26+
}
27+
2228
/// Get associated `Ed25519` public key.
2329
pub fn public_key(&self) -> PublicKey {
2430
PublicKey(self.0.verifying_key())
@@ -46,7 +52,7 @@ pub fn verify_signature(pk: &PublicKey, msg: &[u8], sig: &Signature) -> bool {
4652
pk.0.verify_strict(msg, &sig.0).is_ok()
4753
}
4854

49-
#[allow(missing_docs, clippy::missing_docs_in_private_items)]
55+
#[cfg(test)]
5056
mod arbitrary_impl {
5157
use proptest::prelude::{any, Arbitrary, BoxedStrategy, Strategy};
5258

rust/catalyst-voting/src/crypto/elgamal/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Add<&Ciphertext> for &Ciphertext {
6666
}
6767
}
6868

69-
#[allow(missing_docs, clippy::missing_docs_in_private_items)]
69+
#[cfg(test)]
7070
mod arbitrary_impl {
7171
use proptest::{
7272
arbitrary::any,

rust/catalyst-voting/src/crypto/group/ristretto255/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Sub<&GroupElement> for &GroupElement {
159159
}
160160
}
161161

162-
#[allow(missing_docs, clippy::missing_docs_in_private_items)]
162+
#[cfg(test)]
163163
mod arbitrary_impl {
164164
use proptest::{
165165
arbitrary::any,

rust/catalyst-voting/src/crypto/zk_unit_vector/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn check_2(
235235
&right_1 + &right_2 == left
236236
}
237237

238-
#[allow(missing_docs, clippy::missing_docs_in_private_items)]
238+
#[cfg(test)]
239239
mod arbitrary_impl {
240240
use proptest::{
241241
prelude::{any_with, Arbitrary, BoxedStrategy, Strategy},

0 commit comments

Comments
 (0)