Skip to content

Commit

Permalink
perf: Reduce memory usage of CommittedTransaction
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Murzin <[email protected]>
  • Loading branch information
dima74 committed Sep 19, 2024
1 parent d7d73cc commit ffaf5bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/iroha_core/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod pending {
);
CommittedTransaction {
value: tx,
error: Some(error),
error: Some(Box::new(error)),
}
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module contains predicates for block-related objects, mirroring [`crate::block`].

#[cfg(not(feature = "std"))]
use alloc::{format, string::String, vec::Vec};
use alloc::{boxed::Box, format, string::String, vec::Vec};

use iroha_crypto::HashOf;
use iroha_schema::IntoSchema;
Expand Down Expand Up @@ -128,10 +128,10 @@ pub enum TransactionErrorPredicateBox {
IsSome,
}

impl_predicate_box!(Option<TransactionRejectionReason>: TransactionErrorPredicateBox);
impl_predicate_box!(Option<Box<TransactionRejectionReason>>: TransactionErrorPredicateBox);

impl EvaluatePredicate<Option<TransactionRejectionReason>> for TransactionErrorPredicateBox {
fn applies(&self, input: &Option<TransactionRejectionReason>) -> bool {
impl EvaluatePredicate<Option<Box<TransactionRejectionReason>>> for TransactionErrorPredicateBox {
fn applies(&self, input: &Option<Box<TransactionRejectionReason>>) -> bool {
match self {
TransactionErrorPredicateBox::IsSome => input.is_some(),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_data_model/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ mod model {
#[getset(skip)]
pub value: SignedTransaction,
/// Reason of rejection
pub error: Option<error::TransactionRejectionReason>,
pub error: Option<Box<error::TransactionRejectionReason>>,
}
}

Expand Down

0 comments on commit ffaf5bf

Please sign in to comment.