pub struct ProvenBatch { /* private fields */ }Expand description
A transaction batch with an execution proof. Currently, this only carries a skeleton proof which does not attest to anything meaningful.
The batch’s transactions may carry outstanding precompile claims. The batch prover settles them
with a single precompile proof, but that proof is not part of the proven batch (yet), so a party
that holds only a ProvenBatch cannot check those claims. This goes away once the batch
kernel verifies the precompile proof in-circuit, in which case the batch proof will recursively
attest to the veracity of the precompile claims.
Implementations§
Source§impl ProvenBatch
impl ProvenBatch
Sourcepub fn new(
reference_block_commitment: Word,
reference_block_num: BlockNumber,
account_updates: impl IntoIterator<Item = BatchAccountUpdate>,
input_notes: InputNotes<InputNoteCommitment>,
output_notes: Vec<OutputNote>,
batch_expiration_block_num: BlockNumber,
transactions: OrderedTransactionHeaders,
proof: ExecutionProof,
) -> Result<Self, ProvenBatchError>
pub fn new( reference_block_commitment: Word, reference_block_num: BlockNumber, account_updates: impl IntoIterator<Item = BatchAccountUpdate>, input_notes: InputNotes<InputNoteCommitment>, output_notes: Vec<OutputNote>, batch_expiration_block_num: BlockNumber, transactions: OrderedTransactionHeaders, proof: ExecutionProof, ) -> Result<Self, ProvenBatchError>
Creates a new ProvenBatch from the provided parts and validates its local structural
constraints.
This verifies that the account updates form the state transitions described by the
TransactionHeaders. It also checks the supplied input and output notes for duplicates
and known overlap, but does not verify that they are the correctly aggregated note sets
derived from the transaction headers.
This does not verify the execution proof, per-transaction reference blocks or expiration
block numbers, or note inclusion proofs. Those checks require data which is not present in
a TransactionHeader and must be performed before constructing the proven batch or by a
batch verifier.
§Errors
Returns an error if the proof contains precompiles, any local structural limit or invariant is violated, or the aggregate account updates do not match the transaction headers.
Sourcepub fn new_unchecked(
id: BatchId,
reference_block_commitment: Word,
reference_block_num: BlockNumber,
account_updates: BTreeMap<AccountId, BatchAccountUpdate>,
input_notes: InputNotes<InputNoteCommitment>,
output_notes: Vec<OutputNote>,
batch_expiration_block_num: BlockNumber,
transactions: OrderedTransactionHeaders,
proof: ExecutionProof,
) -> Result<Self, ProvenBatchError>
pub fn new_unchecked( id: BatchId, reference_block_commitment: Word, reference_block_num: BlockNumber, account_updates: BTreeMap<AccountId, BatchAccountUpdate>, input_notes: InputNotes<InputNoteCommitment>, output_notes: Vec<OutputNote>, batch_expiration_block_num: BlockNumber, transactions: OrderedTransactionHeaders, proof: ExecutionProof, ) -> Result<Self, ProvenBatchError>
Creates a new ProvenBatch from the provided parts without checking any constraints
except the expiration constraint listed below.
Callers must ensure that the batch satisfies the structural constraints checked by
ProvenBatch::new.
§Errors
Returns an error if the batch expiration block number is not greater than the reference block number.
Sourcepub fn id(&self) -> BatchId
pub fn id(&self) -> BatchId
The ID of this batch. See BatchId for details on how it is computed.
Sourcepub fn reference_block_commitment(&self) -> Word
pub fn reference_block_commitment(&self) -> Word
Returns the commitment to the reference block of the batch.
Sourcepub fn reference_block_num(&self) -> BlockNumber
pub fn reference_block_num(&self) -> BlockNumber
Returns the number of the reference block of the batch.
Sourcepub fn batch_expiration_block_num(&self) -> BlockNumber
pub fn batch_expiration_block_num(&self) -> BlockNumber
Returns the block number at which the batch will expire.
Sourcepub fn updated_accounts(&self) -> impl Iterator<Item = AccountId> + use<'_>
pub fn updated_accounts(&self) -> impl Iterator<Item = AccountId> + use<'_>
Returns an iterator over the IDs of all accounts updated in this batch.
Sourcepub fn proof_security_level(&self) -> u32
pub fn proof_security_level(&self) -> u32
Returns the proof security level of the batch.
Sourcepub fn account_updates(&self) -> &BTreeMap<AccountId, BatchAccountUpdate>
pub fn account_updates(&self) -> &BTreeMap<AccountId, BatchAccountUpdate>
Returns the map of account IDs mapped to their BatchAccountUpdates.
If an account was updated by multiple transactions, the BatchAccountUpdate is the result
of merging the individual updates.
For example, suppose an account’s state before this batch is A and the batch contains two
transactions that updated it. Applying the first transaction results in intermediate state
B, and applying the second one results in state C. Then the returned update represents
the state transition from A to C.
Sourcepub fn input_notes(&self) -> &InputNotes<InputNoteCommitment>
pub fn input_notes(&self) -> &InputNotes<InputNoteCommitment>
Returns the input notes supplied for this batch.
Sourcepub fn created_nullifiers(&self) -> impl Iterator<Item = Nullifier> + use<'_>
pub fn created_nullifiers(&self) -> impl Iterator<Item = Nullifier> + use<'_>
Returns an iterator over the nullifiers derived from the supplied input notes.
Sourcepub fn output_notes(&self) -> &[OutputNote]
pub fn output_notes(&self) -> &[OutputNote]
Returns the output notes supplied for this batch.
Sourcepub fn transactions(&self) -> &OrderedTransactionHeaders
pub fn transactions(&self) -> &OrderedTransactionHeaders
Returns the OrderedTransactionHeaders included in this batch.
Sourcepub fn proof(&self) -> &ExecutionProof
pub fn proof(&self) -> &ExecutionProof
Returns the execution proof attached to this batch.
Sourcepub fn into_transactions(self) -> OrderedTransactionHeaders
pub fn into_transactions(self) -> OrderedTransactionHeaders
Consumes self and returns the contained OrderedTransactionHeaders of this batch.
Trait Implementations§
Source§impl Clone for ProvenBatch
impl Clone for ProvenBatch
Source§impl Debug for ProvenBatch
impl Debug for ProvenBatch
Source§impl Deserializable for ProvenBatch
impl Deserializable for ProvenBatch
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 moreimpl Eq for ProvenBatch
Source§impl PartialEq for ProvenBatch
impl PartialEq for ProvenBatch
Source§impl Serializable for ProvenBatch
impl Serializable for ProvenBatch
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 StructuralPartialEq for ProvenBatch
Auto Trait Implementations§
impl Freeze for ProvenBatch
impl RefUnwindSafe for ProvenBatch
impl Send for ProvenBatch
impl Sync for ProvenBatch
impl Unpin for ProvenBatch
impl UnsafeUnpin for ProvenBatch
impl UnwindSafe for ProvenBatch
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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