miden-protocol 0.15.0

Core components of the Miden protocol
Documentation
use crate::asset::AssetAmount;
use crate::note::NoteId;
use crate::transaction::ExecutedTransaction;

impl ExecutedTransaction {
    /// A Rust implementation of the compute_fee epilogue procedure.
    pub fn compute_fee(&self) -> AssetAmount {
        // Round up the number of cycles to the next power of two and take log2 of it.
        let verification_cycles = self.measurements().trace_length().ilog2();
        let fee_amount =
            self.block_header().fee_parameters().verification_base_fee() * verification_cycles;
        AssetAmount::from(fee_amount)
    }

    /// Returns `true` if the transaction consumes the note with the given ID.
    pub fn consumes_note(&self, note_id: &NoteId) -> bool {
        self.input_notes().iter().any(|n| n.id() == *note_id)
    }
}