forked from 0xPolygonMiden/miden-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
block_builder: using borrows instead of refcount (0xPolygonMiden#188)
- Loading branch information
1 parent
d81d3c1
commit 5e811a1
Showing
20 changed files
with
161 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
use miden_objects::transaction::ProvenTransaction; | ||
use miden_vm::crypto::MerkleError; | ||
use thiserror::Error; | ||
|
||
use crate::MAX_NUM_CREATED_NOTES_PER_BATCH; | ||
|
||
#[derive(Error, Debug, PartialEq)] | ||
/// Error that may happen while building a transaction batch. | ||
/// | ||
/// These errors are returned from the batch builder to the transaction queue, instead of | ||
/// dropping the transactions, they are included into the error values, so that the transaction | ||
/// queue can re-queue them. | ||
#[derive(Error, Debug)] | ||
pub enum BuildBatchError { | ||
#[error( | ||
"Too many notes in the batch. Got: {0}, max: {}", | ||
MAX_NUM_CREATED_NOTES_PER_BATCH | ||
)] | ||
TooManyNotesCreated(usize), | ||
TooManyNotesCreated(usize, Vec<ProvenTransaction>), | ||
|
||
#[error("failed to create notes SMT: {0}")] | ||
NotesSmtError(#[from] MerkleError), | ||
NotesSmtError(MerkleError, Vec<ProvenTransaction>), | ||
} | ||
|
||
impl BuildBatchError { | ||
pub fn into_transactions(self) -> Vec<ProvenTransaction> { | ||
match self { | ||
BuildBatchError::TooManyNotesCreated(_, txs) => txs, | ||
BuildBatchError::NotesSmtError(_, txs) => txs, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.