Skip to content

Commit e64172f

Browse files
blockifier: box ValidateTransactionError in TransactionExecutionError
1 parent 40ac03e commit e64172f

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

crates/apollo_rpc_execution/src/execution_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ fn blockifier_error_mapping() {
818818

819819
let child = blockifier::execution::errors::EntryPointExecutionError::RecursionDepthExceeded;
820820
let blockifier_err = BlockifierTransactionExecutionError::ValidateTransactionError {
821-
error: child,
821+
error: Box::new(child),
822822
class_hash,
823823
storage_address,
824824
selector,

crates/blockifier/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ macro_rules! check_tx_execution_error_inner {
260260
} else {
261261
match $error {
262262
TransactionExecutionError::ValidateTransactionError { error, .. } => {
263-
$crate::check_entry_point_execution_error!(&error, $expected_hint)
263+
$crate::check_entry_point_execution_error!(&*(error.as_ref()), $expected_hint)
264264
}
265265
_ => panic!("Unexpected structure for error: {:?}", $error),
266266
}

crates/blockifier/src/transaction/account_transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ impl ValidatableTransaction for AccountTransaction {
919919
let validate_call_info = validate_call
920920
.execute(state, &mut context, remaining_validation_gas)
921921
.map_err(|error| TransactionExecutionError::ValidateTransactionError {
922-
error,
922+
error: Box::new(error),
923923
class_hash,
924924
storage_address,
925925
selector: validate_selector,

crates/blockifier/src/transaction/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub enum TransactionExecutionError {
117117
TransactionTooLarge { max_capacity: Box<BouncerWeights>, tx_size: Box<BouncerWeights> },
118118
#[error("{}", gen_tx_execution_error_trace(self))]
119119
ValidateTransactionError {
120-
error: EntryPointExecutionError,
120+
error: Box<EntryPointExecutionError>,
121121
class_hash: ClassHash,
122122
storage_address: ContractAddress,
123123
selector: EntryPointSelector,

crates/blockifier/src/transaction/transactions_test.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,12 +2242,14 @@ fn check_native_validate_error(
22422242
validate_constructor: bool,
22432243
) {
22442244
let syscall_error = match error {
2245-
TransactionExecutionError::ValidateTransactionError {
2246-
error: EntryPointExecutionError::NativeUnrecoverableError(boxed_syscall_error),
2247-
..
2248-
} => {
2249-
assert!(!validate_constructor);
2250-
boxed_syscall_error
2245+
TransactionExecutionError::ValidateTransactionError { error: boxed_error, .. } => {
2246+
match *boxed_error {
2247+
EntryPointExecutionError::NativeUnrecoverableError(boxed_syscall_error) => {
2248+
assert!(!validate_constructor);
2249+
boxed_syscall_error
2250+
}
2251+
_ => panic!("Unexpected error: {:?}", boxed_error),
2252+
}
22512253
}
22522254
TransactionExecutionError::ContractConstructorExecutionFailed(
22532255
ConstructorEntryPointExecutionError::ExecutionError { error: boxed_error, .. },
@@ -2333,7 +2335,7 @@ fn test_validate_accounts_tx(
23332335
match cairo_version {
23342336
CairoVersion::Cairo0 | CairoVersion::Cairo1(RunnableCairo1::Casm) => {
23352337
check_tx_execution_error_for_custom_hint!(
2336-
&error,
2338+
error,
23372339
"Unauthorized syscall call_contract in execution mode Validate.",
23382340
validate_constructor,
23392341
);

0 commit comments

Comments
 (0)