@@ -379,9 +379,9 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
379379 ( reason, maybe_address, return_data)
380380 }
381381 RuntimeKind :: Call ( code_address) => {
382- let return_data = self . cleanup_for_call (
382+ let ( reason , return_data) = self . cleanup_for_call (
383383 code_address,
384- & reason,
384+ reason,
385385 runtime. inner . machine ( ) . return_value ( ) ,
386386 ) ;
387387 ( reason, None , return_data)
@@ -931,7 +931,9 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
931931 exit_status,
932932 output,
933933 } ) => {
934- let _ = self . exit_substate ( StackExitKind :: Succeeded ) ;
934+ if let Err ( e) = self . exit_substate ( StackExitKind :: Succeeded ) {
935+ return Capture :: Exit ( ( e. into ( ) , Vec :: new ( ) ) ) ;
936+ }
935937 Capture :: Exit ( ( ExitReason :: Succeed ( exit_status) , output) )
936938 }
937939 Err ( PrecompileFailure :: Error { exit_status } ) => {
@@ -1017,10 +1019,10 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
10171019 return ( e. into ( ) , None , Vec :: new ( ) ) ;
10181020 }
10191021 let exit_result = self . exit_substate ( StackExitKind :: Succeeded ) ;
1020- self . state . set_code ( address, out) ;
10211022 if let Err ( e) = exit_result {
10221023 return ( e. into ( ) , None , Vec :: new ( ) ) ;
10231024 }
1025+ self . state . set_code ( address, out) ;
10241026 ( ExitReason :: Succeed ( s) , Some ( address) , Vec :: new ( ) )
10251027 }
10261028 Err ( e) => {
@@ -1049,27 +1051,29 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
10491051 fn cleanup_for_call (
10501052 & mut self ,
10511053 code_address : H160 ,
1052- reason : & ExitReason ,
1054+ reason : ExitReason ,
10531055 return_data : Vec < u8 > ,
1054- ) -> Vec < u8 > {
1056+ ) -> ( ExitReason , Vec < u8 > ) {
10551057 log:: debug!( target: "evm" , "Call execution using address {}: {:?}" , code_address, reason) ;
10561058 match reason {
10571059 ExitReason :: Succeed ( _) => {
1058- let _ = self . exit_substate ( StackExitKind :: Succeeded ) ;
1059- return_data
1060+ if let Err ( e) = self . exit_substate ( StackExitKind :: Succeeded ) {
1061+ return ( e. into ( ) , Vec :: new ( ) ) ;
1062+ }
1063+ ( reason, return_data)
10601064 }
10611065 ExitReason :: Error ( _) => {
10621066 let _ = self . exit_substate ( StackExitKind :: Failed ) ;
1063- Vec :: new ( )
1067+ ( reason , Vec :: new ( ) )
10641068 }
10651069 ExitReason :: Revert ( _) => {
10661070 let _ = self . exit_substate ( StackExitKind :: Reverted ) ;
1067- return_data
1071+ ( reason , return_data)
10681072 }
10691073 ExitReason :: Fatal ( _) => {
10701074 self . state . metadata_mut ( ) . gasometer . fail ( ) ;
10711075 let _ = self . exit_substate ( StackExitKind :: Failed ) ;
1072- Vec :: new ( )
1076+ ( reason , Vec :: new ( ) )
10731077 }
10741078 }
10751079 }
0 commit comments