pub struct Certificate {
pub hash: String,
pub previous_hash: String,
pub epoch: Epoch,
pub metadata: CertificateMetadata,
pub protocol_message: ProtocolMessage,
pub signed_message: String,
pub aggregate_verification_key: ProtocolAggregateVerificationKey,
pub signature: CertificateSignature,
}
Expand description
Certificate represents a Mithril certificate embedding a Mithril STM multisignature
Fields§
§hash: String
Hash of the current certificate Computed from the other fields of the certificate aka H(Cp,n))
previous_hash: String
Hash of the previous certificate in the chain This is either the hash of the first certificate of the epoch in the chain Or the first certificate of the previous epoch in the chain (if the certificate is the first of its epoch) aka H(FC(n))
epoch: Epoch
Cardano chain epoch number
metadata: CertificateMetadata
Certificate metadata aka METADATA(p,n)
protocol_message: ProtocolMessage
Structured message that is used to create the signed message aka MSG(p,n) U AVK(n-1)
signed_message: String
Message that is signed by the signers aka H(MSG(p,n) || AVK(n-1))
aggregate_verification_key: ProtocolAggregateVerificationKey
Aggregate verification key The AVK used to sign during the current epoch aka AVK(n-2)
signature: CertificateSignature
Certificate signature
Implementations§
source§impl Certificate
impl Certificate
sourcepub fn new<T: Into<String>>(
previous_hash: T,
epoch: Epoch,
metadata: CertificateMetadata,
protocol_message: ProtocolMessage,
aggregate_verification_key: ProtocolAggregateVerificationKey,
signature: CertificateSignature,
) -> Certificate
pub fn new<T: Into<String>>( previous_hash: T, epoch: Epoch, metadata: CertificateMetadata, protocol_message: ProtocolMessage, aggregate_verification_key: ProtocolAggregateVerificationKey, signature: CertificateSignature, ) -> Certificate
Certificate factory
sourcepub fn compute_hash(&self) -> String
pub fn compute_hash(&self) -> String
Computes the hash of a Certificate
sourcepub fn is_genesis(&self) -> bool
pub fn is_genesis(&self) -> bool
Tell if the certificate is a genesis certificate
sourcepub fn is_chaining_to_itself(&self) -> bool
pub fn is_chaining_to_itself(&self) -> bool
Return true if the certificate is chaining into itself (meaning that its hash and previous hash are equal).
sourcepub fn match_message(&self, message: &ProtocolMessage) -> bool
pub fn match_message(&self, message: &ProtocolMessage) -> bool
Check that the certificate signed message match the given protocol message.
sourcepub fn signed_entity_type(&self) -> SignedEntityType
pub fn signed_entity_type(&self) -> SignedEntityType
Get the certificate signed entity type.
Trait Implementations§
source§impl Clone for Certificate
impl Clone for Certificate
source§fn clone(&self) -> Certificate
fn clone(&self) -> Certificate
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Certificate
impl Debug for Certificate
source§impl PartialEq for Certificate
impl PartialEq for Certificate
source§impl TryFrom<Certificate> for CertificateMessage
impl TryFrom<Certificate> for CertificateMessage
source§impl TryFrom<CertificateMessage> for Certificate
impl TryFrom<CertificateMessage> for Certificate
Auto Trait Implementations§
impl Freeze for Certificate
impl RefUnwindSafe for Certificate
impl Send for Certificate
impl Sync for Certificate
impl Unpin for Certificate
impl UnwindSafe for Certificate
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more