pub struct StmSig {
pub sigma: Signature,
pub indexes: Vec<Index>,
pub signer_index: Index,
}
Expand description
Signature created by a single party who has won the lottery.
Fields§
§sigma: Signature
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 StmSig
impl StmSig
sourcepub fn verify<D: Clone + Digest + FixedOutput>(
&self,
params: &StmParameters,
pk: &StmVerificationKey,
stake: &Stake,
avk: &StmAggrVerificationKey<D>,
msg: &[u8],
) -> Result<(), StmSignatureError>
pub fn verify<D: Clone + Digest + FixedOutput>( &self, params: &StmParameters, pk: &StmVerificationKey, stake: &Stake, avk: &StmAggrVerificationKey<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<StmSig, StmSignatureError>
pub fn from_bytes<D: Clone + Digest + FixedOutput>( bytes: &[u8], ) -> Result<StmSig, StmSignatureError>
Extract a batch compatible StmSig
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: &StmParameters,
pk: &StmVerificationKey,
stake: &Stake,
msg: &[u8],
total_stake: &Stake,
) -> Result<(), StmSignatureError>
pub fn verify_core( &self, params: &StmParameters, pk: &StmVerificationKey, 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<'de> Deserialize<'de> for StmSig
impl<'de> Deserialize<'de> for StmSig
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 Ord for StmSig
impl Ord for StmSig
source§impl PartialOrd for StmSig
impl PartialOrd for StmSig
impl Eq for StmSig
Auto Trait Implementations§
impl Freeze for StmSig
impl RefUnwindSafe for StmSig
impl Send for StmSig
impl Sync for StmSig
impl Unpin for StmSig
impl UnwindSafe for StmSig
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)