pub struct Commit<A: AggregateSignature> { /* private fields */ }Expand description
A commit for a specific block.
In order for this to be valid, the signature MUST be valid and aggregated from signatures by validators whose weight is sufficient for the threshold. Deserialization or instantiation alone DOES NOT signify validity.
Implementations§
Source§impl<A: AggregateSignature> Commit<A>
impl<A: AggregateSignature> Commit<A>
Sourcepub fn block_number(&self) -> BlockNumber
pub fn block_number(&self) -> BlockNumber
The block number this commit is for.
Sourcepub fn verify<S: ?Sized + SignatureScheme<AggregateSignature = A>>(
&self,
validator_set: &(impl ?Sized + ValidatorSet<Validator = S::Validator>),
signature_scheme: &S,
genesis: impl AsRef<[u8]>,
block_hash: impl AsRef<[u8]>,
) -> bool
pub fn verify<S: ?Sized + SignatureScheme<AggregateSignature = A>>( &self, validator_set: &(impl ?Sized + ValidatorSet<Validator = S::Validator>), signature_scheme: &S, genesis: impl AsRef<[u8]>, block_hash: impl AsRef<[u8]>, ) -> bool
Verify a commit.
The genesis MUST be a valid genesis for a Blockchain.
Trait Implementations§
Source§impl<A> BorshDeserialize for Commit<A>where
A: BorshDeserialize + AggregateSignature,
Available on crate feature alloc only.
impl<A> BorshDeserialize for Commit<A>where
A: BorshDeserialize + AggregateSignature,
Available on crate feature
alloc only.fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl<A> BorshSerialize for Commit<A>where
A: BorshSerialize + AggregateSignature,
Available on crate feature alloc only.
impl<A> BorshSerialize for Commit<A>where
A: BorshSerialize + AggregateSignature,
Available on crate feature
alloc only.Source§impl<A: AggregateSignature> Clone for Commit<A>
impl<A: AggregateSignature> Clone for Commit<A>
Auto Trait Implementations§
impl<A> Freeze for Commit<A>where
A: Freeze,
impl<A> RefUnwindSafe for Commit<A>where
A: RefUnwindSafe,
impl<A> Send for Commit<A>where
A: Send,
impl<A> Sync for Commit<A>where
A: Sync,
impl<A> Unpin for Commit<A>where
A: Unpin,
impl<A> UnsafeUnpin for Commit<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for Commit<A>where
A: UnwindSafe,
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