-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executor: Sign votes and verify votes signatures (#16)
* Introduce `SignedVote` type and remove address from round `Vote` * Add facility for signing votes * Verify votes signatures * Better name for the module * Doc comments * Refactor signing facility into a `SigningScheme`
- Loading branch information
Showing
27 changed files
with
449 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
- How do we deal with errors? | ||
- How do we parametrize over values, id(v), etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ edition = "2021" | |
publish = false | ||
|
||
[dependencies] | ||
secrecy = "0.8.0" | ||
signature = "2.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::{Consensus, Signature}; | ||
|
||
// TODO: Do we need to abstract over `SignedVote` as well? | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct SignedVote<C> | ||
where | ||
C: Consensus, | ||
{ | ||
pub vote: C::Vote, | ||
pub address: C::Address, | ||
pub signature: Signature<C>, | ||
} | ||
|
||
impl<C> SignedVote<C> | ||
where | ||
C: Consensus, | ||
{ | ||
pub fn new(vote: C::Vote, address: C::Address, signature: Signature<C>) -> Self { | ||
Self { | ||
vote, | ||
address, | ||
signature, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use core::fmt::Debug; | ||
|
||
use secrecy::{CloneableSecret, DebugSecret, Zeroize}; | ||
use signature::{Keypair, Signer, Verifier}; | ||
|
||
pub trait SigningScheme | ||
where | ||
Self: Clone + Debug + Eq, | ||
{ | ||
type Signature: Clone + Debug + Eq; | ||
|
||
type PublicKey: Clone + Debug + Eq + Verifier<Self::Signature>; | ||
|
||
type PrivateKey: Clone | ||
+ Signer<Self::Signature> | ||
+ Keypair<VerifyingKey = Self::PublicKey> | ||
+ Zeroize | ||
+ DebugSecret | ||
+ CloneableSecret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::panic))] | ||
|
||
pub mod executor; | ||
pub mod message; |
Oops, something went wrong.