@@ -920,7 +920,7 @@ impl<'a> VM<'a> {
920
920
. pop ( )
921
921
. ok_or ( VMError :: Internal ( InternalError :: CouldNotPopCallframe ) ) ?;
922
922
if retdata. is_create {
923
- self . handle_return_create ( tx_report, retdata) ?;
923
+ self . handle_return_create ( call_frame , tx_report, retdata) ?;
924
924
} else {
925
925
self . handle_return_call ( call_frame, tx_report, retdata) ?;
926
926
}
@@ -960,6 +960,12 @@ impl<'a> VM<'a> {
960
960
self . current_call_frame_mut ( ) ?
961
961
. stack
962
962
. push ( SUCCESS_FOR_CALL ) ?;
963
+ for ( address, account_opt) in call_frame. cache_backup . clone ( ) {
964
+ self . current_call_frame_mut ( ) ?
965
+ . cache_backup
966
+ . entry ( address)
967
+ . or_insert ( account_opt) ;
968
+ }
963
969
}
964
970
TxResult :: Revert ( _) => {
965
971
// Revert value transfer
@@ -976,6 +982,7 @@ impl<'a> VM<'a> {
976
982
}
977
983
pub fn handle_return_create (
978
984
& mut self ,
985
+ call_frame : & CallFrame ,
979
986
tx_report : & ExecutionReport ,
980
987
retdata : RetData ,
981
988
) -> Result < ( ) , VMError > {
@@ -1000,6 +1007,12 @@ impl<'a> VM<'a> {
1000
1007
self . current_call_frame_mut ( ) ?
1001
1008
. stack
1002
1009
. push ( address_to_word ( retdata. to ) ) ?;
1010
+ for ( address, account_opt) in call_frame. cache_backup . clone ( ) {
1011
+ self . current_call_frame_mut ( ) ?
1012
+ . cache_backup
1013
+ . entry ( address)
1014
+ . or_insert ( account_opt) ;
1015
+ }
1003
1016
}
1004
1017
TxResult :: Revert ( err) => {
1005
1018
// Return value to sender
0 commit comments