pub struct ProvenTransaction { /* private fields */ }Expand description
Result of executing and proving a transaction. Contains all the data required to verify that a transaction was executed correctly.
A proven transaction must not be empty. A transaction is empty if the account state is unchanged or the number of input notes is zero. This check prevents proving a transaction once and submitting it to the network many times. Output notes are not considered because they can be empty (i.e. contain no assets). Otherwise, a transaction with no account state change, no input notes and one such empty output note could be resubmitted many times to the network and fill up block space which is a form of DOS attack.
Implementations§
Source§impl ProvenTransaction
impl ProvenTransaction
Sourcepub fn new(
account_update: TxAccountUpdate,
input_notes: impl IntoIterator<Item = impl Into<InputNoteCommitment>>,
output_notes: impl IntoIterator<Item = impl Into<OutputNote>>,
ref_block_num: BlockNumber,
ref_block_commitment: Word,
fee: FungibleAsset,
expiration_block_num: BlockNumber,
proof: ExecutionProof,
) -> Result<Self, ProvenTransactionError>
pub fn new( account_update: TxAccountUpdate, input_notes: impl IntoIterator<Item = impl Into<InputNoteCommitment>>, output_notes: impl IntoIterator<Item = impl Into<OutputNote>>, ref_block_num: BlockNumber, ref_block_commitment: Word, fee: FungibleAsset, expiration_block_num: BlockNumber, proof: ExecutionProof, ) -> Result<Self, ProvenTransactionError>
Creates a new ProvenTransaction from the specified components.
§Errors
Returns an error if:
- The total number of input notes is greater than
MAX_INPUT_NOTES_PER_TX. - The vector of input notes contains duplicates.
- The total number of output notes is greater than
MAX_OUTPUT_NOTES_PER_TX. - The vector of output notes contains duplicates.
- The transaction is empty, which is the case if the account state is unchanged or the number of input notes is zero.
- The commitment computed on the actual account delta contained in
TxAccountUpdatedoes not match its declared account delta commitment.
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Returns unique identifier of this transaction.
Sourcepub fn account_id(&self) -> AccountId
pub fn account_id(&self) -> AccountId
Returns ID of the account against which this transaction was executed.
Sourcepub fn account_update(&self) -> &TxAccountUpdate
pub fn account_update(&self) -> &TxAccountUpdate
Returns the account update details.
Sourcepub fn input_notes(&self) -> &InputNotes<InputNoteCommitment>
pub fn input_notes(&self) -> &InputNotes<InputNoteCommitment>
Returns a reference to the notes consumed by the transaction.
Sourcepub fn output_notes(&self) -> &OutputNotes
pub fn output_notes(&self) -> &OutputNotes
Returns a reference to the notes produced by the transaction.
Sourcepub fn proof(&self) -> &ExecutionProof
pub fn proof(&self) -> &ExecutionProof
Returns the proof of the transaction.
Sourcepub fn ref_block_num(&self) -> BlockNumber
pub fn ref_block_num(&self) -> BlockNumber
Returns the number of the reference block the transaction was executed against.
Sourcepub fn ref_block_commitment(&self) -> Word
pub fn ref_block_commitment(&self) -> Word
Returns the commitment of the block transaction was executed against.
Sourcepub fn fee(&self) -> FungibleAsset
pub fn fee(&self) -> FungibleAsset
Returns the fee of the transaction.
Sourcepub fn unauthenticated_notes(&self) -> impl Iterator<Item = &NoteHeader>
pub fn unauthenticated_notes(&self) -> impl Iterator<Item = &NoteHeader>
Returns an iterator of the headers of unauthenticated input notes in this transaction.
Sourcepub fn expiration_block_num(&self) -> BlockNumber
pub fn expiration_block_num(&self) -> BlockNumber
Returns the block number at which the transaction will expire.
Sourcepub fn nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_
pub fn nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_
Returns an iterator over the nullifiers of all input notes in this transaction.
This includes both authenticated and unauthenticated notes.
Trait Implementations§
Source§impl Clone for ProvenTransaction
impl Clone for ProvenTransaction
Source§fn clone(&self) -> ProvenTransaction
fn clone(&self) -> ProvenTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProvenTransaction
impl Debug for ProvenTransaction
Source§impl Deserializable for ProvenTransaction
impl Deserializable for ProvenTransaction
Source§fn read_from<R: ByteReader>(
source: &mut R,
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R, ) -> Result<Self, DeserializationError>
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn min_serialized_size() -> usize
fn min_serialized_size() -> usize
Source§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§fn read_from_bytes_with_budget(
bytes: &[u8],
budget: usize,
) -> Result<Self, DeserializationError>
fn read_from_bytes_with_budget( bytes: &[u8], budget: usize, ) -> Result<Self, DeserializationError>
Self from bytes with a byte budget limit. Read moreSource§impl From<&ProvenTransaction> for TransactionHeader
impl From<&ProvenTransaction> for TransactionHeader
Source§fn from(tx: &ProvenTransaction) -> Self
fn from(tx: &ProvenTransaction) -> Self
Constructs a TransactionHeader from a ProvenTransaction.
Source§impl From<&ProvenTransaction> for TransactionId
impl From<&ProvenTransaction> for TransactionId
Source§fn from(tx: &ProvenTransaction) -> Self
fn from(tx: &ProvenTransaction) -> Self
Source§impl PartialEq for ProvenTransaction
impl PartialEq for ProvenTransaction
Source§impl Serializable for ProvenTransaction
impl Serializable for ProvenTransaction
Source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
impl Eq for ProvenTransaction
impl StructuralPartialEq for ProvenTransaction
Auto Trait Implementations§
impl Freeze for ProvenTransaction
impl RefUnwindSafe for ProvenTransaction
impl Send for ProvenTransaction
impl Sync for ProvenTransaction
impl Unpin for ProvenTransaction
impl UnsafeUnpin for ProvenTransaction
impl UnwindSafe for ProvenTransaction
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more