@@ -1103,26 +1103,11 @@ impl<N: Network, C: ConsensusStorage<N>> VM<N, C> {
11031103 ShouldAbortResult :: Finalize ( 0 )
11041104 // If the consensus version is >= V16, ensure that the transaction is not exceeding spend or deployment limits.
11051105 } else {
1106- // Compute microcredit spend from deployment or execution cost details.
1107- let compute_spend = match transaction {
1108- Transaction :: Deploy ( _, _, _, deployment, _) => {
1109- match deployment_cost ( self . process ( ) , deployment, consensus_version) {
1110- Ok ( ( _, cost_details) ) => deploy_compute_cost_in_microcredits ( cost_details, consensus_version) ,
1111- Err ( e) => {
1112- return ShouldAbortResult :: Abort ( format ! ( "Failed to compute the deployment cost: {e}" ) ) ;
1113- }
1114- }
1115- }
1116- Transaction :: Execute ( _, _, execution, _) => {
1117- match execution_cost ( self . process ( ) , execution, consensus_version) {
1118- Ok ( ( _, cost_details) ) => execute_compute_cost_in_microcredits ( cost_details, consensus_version) ,
1119- Err ( e) => {
1120- return ShouldAbortResult :: Abort ( format ! ( "Failed to compute the execution cost: {e}" ) ) ;
1121- }
1122- }
1123- }
1124- Transaction :: Fee ( ..) => 0 , // Fee transactions are already aborted above and don't contribute compute spend.
1125- } ;
1106+ let compute_spend =
1107+ match transaction_compute_spend_in_microcredits ( self . process ( ) , transaction, consensus_version) {
1108+ Ok ( compute_spend) => compute_spend,
1109+ Err ( e) => return ShouldAbortResult :: Abort ( format ! ( "Failed to compute transaction spend: {e}" ) ) ,
1110+ } ;
11261111
11271112 if compute_spend > transaction_spend_limit {
11281113 return ShouldAbortResult :: Abort ( format ! (
0 commit comments