sui_types/
executable_transaction.rsuse crate::messages_checkpoint::CheckpointSequenceNumber;
use crate::{committee::EpochId, crypto::AuthorityStrongQuorumSignInfo};
use crate::message_envelope::{Envelope, TrustedEnvelope, VerifiedEnvelope};
use crate::transaction::SenderSignedData;
use crate::transaction::TransactionDataAPI;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum CertificateProof {
Checkpoint(EpochId, CheckpointSequenceNumber),
Certified(AuthorityStrongQuorumSignInfo),
QuorumExecuted(EpochId),
SystemTransaction(EpochId),
Consensus(EpochId),
}
impl CertificateProof {
pub fn new_from_cert_sig(sig: AuthorityStrongQuorumSignInfo) -> Self {
Self::Certified(sig)
}
pub fn new_from_checkpoint(epoch: EpochId, checkpoint: CheckpointSequenceNumber) -> Self {
Self::Checkpoint(epoch, checkpoint)
}
pub fn new_system(epoch: EpochId) -> Self {
Self::SystemTransaction(epoch)
}
pub fn new_from_consensus(epoch: EpochId) -> Self {
Self::Consensus(epoch)
}
pub fn epoch(&self) -> EpochId {
match self {
Self::Checkpoint(epoch, _)
| Self::QuorumExecuted(epoch)
| Self::SystemTransaction(epoch)
| Self::Consensus(epoch) => *epoch,
Self::Certified(sig) => sig.epoch,
}
}
}
pub type ExecutableTransaction = Envelope<SenderSignedData, CertificateProof>;
pub type VerifiedExecutableTransaction = VerifiedEnvelope<SenderSignedData, CertificateProof>;
pub type TrustedExecutableTransaction = TrustedEnvelope<SenderSignedData, CertificateProof>;
impl VerifiedExecutableTransaction {
pub fn gas_budget(&self) -> u64 {
self.data().transaction_data().gas_budget()
}
}