diff --git a/crates/iroha_core/src/block.rs b/crates/iroha_core/src/block.rs index f7241e71ceb..98ff226687b 100644 --- a/crates/iroha_core/src/block.rs +++ b/crates/iroha_core/src/block.rs @@ -232,7 +232,7 @@ mod pending { ); CommittedTransaction { value: tx, - error: Some(error), + error: Some(Box::new(error)), } } }) diff --git a/crates/iroha_data_model/src/query/predicate/predicate_atoms/block.rs b/crates/iroha_data_model/src/query/predicate/predicate_atoms/block.rs index 666ba288fcf..c1d7ecb24b3 100644 --- a/crates/iroha_data_model/src/query/predicate/predicate_atoms/block.rs +++ b/crates/iroha_data_model/src/query/predicate/predicate_atoms/block.rs @@ -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; @@ -128,10 +128,10 @@ pub enum TransactionErrorPredicateBox { IsSome, } -impl_predicate_box!(Option: TransactionErrorPredicateBox); +impl_predicate_box!(Option>: TransactionErrorPredicateBox); -impl EvaluatePredicate> for TransactionErrorPredicateBox { - fn applies(&self, input: &Option) -> bool { +impl EvaluatePredicate>> for TransactionErrorPredicateBox { + fn applies(&self, input: &Option>) -> bool { match self { TransactionErrorPredicateBox::IsSome => input.is_some(), } diff --git a/crates/iroha_data_model/src/transaction.rs b/crates/iroha_data_model/src/transaction.rs index e268e46c13c..5b5a3cfc968 100644 --- a/crates/iroha_data_model/src/transaction.rs +++ b/crates/iroha_data_model/src/transaction.rs @@ -175,7 +175,8 @@ mod model { #[getset(skip)] pub value: SignedTransaction, /// Reason of rejection - pub error: Option, + // NOTE: Using `Box` reduces memory use by 10% + pub error: Option>, } } diff --git a/crates/iroha_schema_gen/src/lib.rs b/crates/iroha_schema_gen/src/lib.rs index 276b328b68c..79a80583ed1 100644 --- a/crates/iroha_schema_gen/src/lib.rs +++ b/crates/iroha_schema_gen/src/lib.rs @@ -330,7 +330,7 @@ types!( Option, Option, Option, - Option, + Option>, Option, Option, Option,