From d1880bf3d5cc2e62e7a4bac52e4bcd6c636cd379 Mon Sep 17 00:00:00 2001 From: Runtian Zhou Date: Wed, 14 Jun 2023 15:39:05 -0700 Subject: [PATCH 1/2] [aptos-vm] Skip converting storage error --- aptos-move/aptos-vm/src/errors.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aptos-move/aptos-vm/src/errors.rs b/aptos-move/aptos-vm/src/errors.rs index 49dc6796a2329..95d318e2f2f0c 100644 --- a/aptos-move/aptos-vm/src/errors.rs +++ b/aptos-move/aptos-vm/src/errors.rs @@ -132,6 +132,10 @@ pub fn convert_prologue_error( }; VMStatus::Error(new_major_status, None) }, + // Storage error can be a result of speculation failure so throw the error back for caller to handle. + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) + }, status @ VMStatus::ExecutionFailure { .. } | status @ VMStatus::Error(..) => { speculative_error!( log_context, @@ -176,7 +180,10 @@ pub fn convert_epilogue_error( VMStatus::Error(StatusCode::UNEXPECTED_ERROR_FROM_KNOWN_MOVE_FUNCTION, None) }, }, - + // Storage error can be a result of speculation failure so throw the error back for caller to handle. + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) + }, status => { speculative_error!( log_context, @@ -198,7 +205,10 @@ pub fn expect_only_successful_execution( let status = error.into_vm_status(); Err(match status { VMStatus::Executed => VMStatus::Executed, - + // Storage error can be a result of speculation failure so throw the error back for caller to handle. + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { + VMStatus::Error(StatusCode::STORAGE_ERROR, msg) + }, status => { // Only trigger a warning here as some errors could be a result of the speculative parallel execution. // We will report the errors after we obtained the final transaction output in update_counters_for_processed_chunk From be5fe95af3eb9428acdaddbea9101e08e2972c3a Mon Sep 17 00:00:00 2001 From: Runtian Zhou Date: Wed, 14 Jun 2023 16:03:07 -0700 Subject: [PATCH 2/2] fixup! [aptos-vm] Skip converting storage error --- aptos-move/aptos-vm/src/errors.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/aptos-move/aptos-vm/src/errors.rs b/aptos-move/aptos-vm/src/errors.rs index 95d318e2f2f0c..919748dc28a14 100644 --- a/aptos-move/aptos-vm/src/errors.rs +++ b/aptos-move/aptos-vm/src/errors.rs @@ -133,9 +133,7 @@ pub fn convert_prologue_error( VMStatus::Error(new_major_status, None) }, // Storage error can be a result of speculation failure so throw the error back for caller to handle. - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) - }, + e @ VMStatus::Error(StatusCode::STORAGE_ERROR, _) => e, status @ VMStatus::ExecutionFailure { .. } | status @ VMStatus::Error(..) => { speculative_error!( log_context, @@ -181,9 +179,7 @@ pub fn convert_epilogue_error( }, }, // Storage error can be a result of speculation failure so throw the error back for caller to handle. - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) - }, + e @ VMStatus::Error(StatusCode::STORAGE_ERROR, _) => e, status => { speculative_error!( log_context, @@ -206,9 +202,7 @@ pub fn expect_only_successful_execution( Err(match status { VMStatus::Executed => VMStatus::Executed, // Storage error can be a result of speculation failure so throw the error back for caller to handle. - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) => { - VMStatus::Error(StatusCode::STORAGE_ERROR, msg) - }, + e @ VMStatus::Error(StatusCode::STORAGE_ERROR, _) => e, status => { // Only trigger a warning here as some errors could be a result of the speculative parallel execution. // We will report the errors after we obtained the final transaction output in update_counters_for_processed_chunk