pub struct SingleSignature {
pub sigma: BlsSignature,
pub indexes: Vec<Index>,
pub signer_index: Index,
}
Expand description
Signature created by a single party who has won the lottery.
Fields§
§sigma: BlsSignature
The signature from the underlying MSP scheme.
indexes: Vec<Index>
The index(es) for which the signature is valid
signer_index: Index
Merkle tree index of the signer.
Implementations§
Source§impl SingleSignature
impl SingleSignature
Sourcepub fn verify<D: Clone + Digest + FixedOutput>(
&self,
params: &Parameters,
pk: &VerificationKey,
stake: &Stake,
avk: &AggregateVerificationKey<D>,
msg: &[u8],
) -> Result<(), StmSignatureError>
pub fn verify<D: Clone + Digest + FixedOutput>( &self, params: &Parameters, pk: &VerificationKey, stake: &Stake, avk: &AggregateVerificationKey<D>, msg: &[u8], ) -> Result<(), StmSignatureError>
Verify an stm signature by checking that the lottery was won, the merkle path is correct, the indexes are in the desired range and the underlying multi signature validates.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Convert an StmSig
into bytes
§Layout
- Stake
- Number of valid indexes (as u64)
- Indexes of the signature
- Public Key
- Signature
- Merkle index of the signer.
Sourcepub fn from_bytes<D: Clone + Digest + FixedOutput>(
bytes: &[u8],
) -> Result<SingleSignature, StmSignatureError>
pub fn from_bytes<D: Clone + Digest + FixedOutput>( bytes: &[u8], ) -> Result<SingleSignature, StmSignatureError>
Extract a batch compatible SingleSignature
from a byte slice.
Sourcepub fn cmp_stm_sig(&self, other: &Self) -> Ordering
pub fn cmp_stm_sig(&self, other: &Self) -> Ordering
Compare two StmSig
by their signers’ merkle tree indexes.
Sourcepub fn verify_core(
&self,
params: &Parameters,
pk: &VerificationKey,
stake: &Stake,
msg: &[u8],
total_stake: &Stake,
) -> Result<(), StmSignatureError>
pub fn verify_core( &self, params: &Parameters, pk: &VerificationKey, stake: &Stake, msg: &[u8], total_stake: &Stake, ) -> Result<(), StmSignatureError>
Verify a core signature by checking that the lottery was won, the indexes are in the desired range and the underlying multi signature validates.
Trait Implementations§
Source§impl Clone for SingleSignature
impl Clone for SingleSignature
Source§fn clone(&self) -> SingleSignature
fn clone(&self) -> SingleSignature
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SingleSignature
impl Debug for SingleSignature
Source§impl<'de> Deserialize<'de> for SingleSignature
impl<'de> Deserialize<'de> for SingleSignature
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for SingleSignature
impl Hash for SingleSignature
Source§impl Ord for SingleSignature
impl Ord for SingleSignature
Source§impl PartialEq for SingleSignature
impl PartialEq for SingleSignature
Source§impl PartialOrd for SingleSignature
impl PartialOrd for SingleSignature
Source§impl Serialize for SingleSignature
impl Serialize for SingleSignature
impl Eq for SingleSignature
Auto Trait Implementations§
impl Freeze for SingleSignature
impl RefUnwindSafe for SingleSignature
impl Send for SingleSignature
impl Sync for SingleSignature
impl Unpin for SingleSignature
impl UnwindSafe for SingleSignature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more